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
21 class SPUTargetMachine;
25 FunctionPass *createSPUISelDag(SPUTargetMachine &TM);
26 FunctionPass *createSPUAsmPrinterPass(raw_ostream &o, SPUTargetMachine &tm);
28 /*--== Utility functions/predicates/etc used all over the place: --==*/
29 //! Predicate test for a signed 10-bit value
31 \param Value The input value to be tested
33 This predicate tests for a signed 10-bit value, returning the 10-bit value
36 inline bool isS10Constant(short Value) {
37 int SExtValue = ((int) Value << (32 - 10)) >> (32 - 10);
38 return ((Value > 0 && Value <= (1 << 9) - 1)
39 || (Value < 0 && (short) SExtValue == Value));
42 inline bool isS10Constant(int Value) {
43 return (Value >= -(1 << 9) && Value <= (1 << 9) - 1);
46 inline bool isS10Constant(uint32_t Value) {
47 return (Value <= ((1 << 9) - 1));
50 inline bool isS10Constant(int64_t Value) {
51 return (Value >= -(1 << 9) && Value <= (1 << 9) - 1);
54 inline bool isS10Constant(uint64_t Value) {
55 return (Value <= ((1 << 9) - 1));
58 //! Predicate test for an unsigned 10-bit value
60 \param Value The input value to be tested
62 This predicate tests for an unsigned 10-bit value, returning the 10-bit value
65 inline bool isU10Constant(short Value) {
66 return (Value == (Value & 0x3ff));
69 inline bool isU10Constant(int Value) {
70 return (Value == (Value & 0x3ff));
73 inline bool isU10Constant(uint32_t Value) {
74 return (Value == (Value & 0x3ff));
77 inline bool isU10Constant(int64_t Value) {
78 return (Value == (Value & 0x3ff));
81 inline bool isU10Constant(uint64_t Value) {
82 return (Value == (Value & 0x3ff));
86 // Defines symbolic names for the SPU instructions.
88 #include "SPUGenInstrNames.inc"
90 #endif /* LLVM_TARGET_IBMCELLSPU_H */