1 //===-- SPU.h - Top-level interface for Cell SPU Target ----------*- C++ -*-==//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file contains the entry points for global functions defined in the LLVM
13 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_TARGET_IBMCELLSPU_H
16 #define LLVM_TARGET_IBMCELLSPU_H
18 #include "llvm/Support/DataTypes.h"
21 class SPUTargetMachine
;
25 FunctionPass
*createSPUISelDag(SPUTargetMachine
&TM
);
26 FunctionPass
*createSPUAsmPrinterPass(raw_ostream
&o
,
28 bool fast
, bool verbose
);
30 /*--== Utility functions/predicates/etc used all over the place: --==*/
31 //! Predicate test for a signed 10-bit value
33 \param Value The input value to be tested
35 This predicate tests for a signed 10-bit value, returning the 10-bit value
39 inline bool isS10Constant(T Value
);
42 inline bool isS10Constant
<short>(short Value
) {
43 int SExtValue
= ((int) Value
<< (32 - 10)) >> (32 - 10);
44 return ((Value
> 0 && Value
<= (1 << 9) - 1)
45 || (Value
< 0 && (short) SExtValue
== Value
));
49 inline bool isS10Constant
<int>(int Value
) {
50 return (Value
>= -(1 << 9) && Value
<= (1 << 9) - 1);
54 inline bool isS10Constant
<uint32_t>(uint32_t Value
) {
55 return (Value
<= ((1 << 9) - 1));
59 inline bool isS10Constant
<int64_t>(int64_t Value
) {
60 return (Value
>= -(1 << 9) && Value
<= (1 << 9) - 1);
64 inline bool isS10Constant
<uint64_t>(uint64_t Value
) {
65 return (Value
<= ((1 << 9) - 1));
68 //! Predicate test for an unsigned 10-bit value
70 \param Value The input value to be tested
72 This predicate tests for an unsigned 10-bit value, returning the 10-bit value
75 inline bool isU10Constant(short Value
) {
76 return (Value
== (Value
& 0x3ff));
79 inline bool isU10Constant(int Value
) {
80 return (Value
== (Value
& 0x3ff));
83 inline bool isU10Constant(uint32_t Value
) {
84 return (Value
== (Value
& 0x3ff));
87 inline bool isU10Constant(int64_t Value
) {
88 return (Value
== (Value
& 0x3ff));
91 inline bool isU10Constant(uint64_t Value
) {
92 return (Value
== (Value
& 0x3ff));
96 // Defines symbolic names for the SPU instructions.
98 #include "SPUGenInstrNames.inc"
100 #endif /* LLVM_TARGET_IBMCELLSPU_H */