d66fce2bc0c7264dbaf00c781d4d5c5370a50555
[oota-llvm.git] / lib / Target / CellSPU / SPU.h
1 //===-- SPU.h - Top-level interface for Cell SPU Target ----------*- C++ -*-==//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file was developed by a team from the Computer Systems Research
6 // Department at The Aerospace Corporation.
7 //
8 // See README.txt for details.
9 //
10 //===----------------------------------------------------------------------===//
11 //
12 // This file contains the entry points for global functions defined in the LLVM
13 // Cell SPU back-end.
14 //
15 //===----------------------------------------------------------------------===//
16
17 #ifndef LLVM_TARGET_IBMCELLSPU_H
18 #define LLVM_TARGET_IBMCELLSPU_H
19
20 #include <iosfwd>
21
22 namespace llvm {
23   class SPUTargetMachine;
24   class FunctionPass;
25
26   FunctionPass *createSPUISelDag(SPUTargetMachine &TM);
27   FunctionPass *createSPUAsmPrinterPass(std::ostream &o, SPUTargetMachine &tm);
28
29   /* Utility functions/predicates/etc used all over the place: */
30   //! Predicate test for a signed 10-bit value
31   /*!
32     \param Value The input value to be tested
33
34     This predicate tests for a signed 10-bit value, returning the 10-bit value
35     as a short if true.
36    */
37   inline bool isS10Constant(short Value) {
38     int SExtValue = ((int) Value << (32 - 10)) >> (32 - 10);
39     return ((Value > 0 && Value <= (1 << 9) - 1)
40             || (Value < 0 && (short) SExtValue == Value));
41   }
42
43   inline bool isS10Constant(int Value) {
44     return (Value >= -(1 << 9) && Value <= (1 << 9) - 1);
45   }
46
47   inline bool isS10Constant(uint32_t Value) {
48     return (Value <= ((1 << 9) - 1));
49   }
50
51   inline bool isS10Constant(int64_t Value) {
52     return (Value >= -(1 << 9) && Value <= (1 << 9) - 1);
53   }
54
55   inline bool isS10Constant(uint64_t Value) {
56     return (Value <= ((1 << 9) - 1));
57   }
58 }
59
60 // Defines symbolic names for the SPU instructions.
61 //
62 #include "SPUGenInstrNames.inc"
63
64 #endif /* LLVM_TARGET_IBMCELLSPU_H */