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"
22 class SPUTargetMachine;
26 FunctionPass *createSPUISelDag(SPUTargetMachine &TM);
27 FunctionPass *createSPUAsmPrinterPass(raw_ostream &o, SPUTargetMachine &tm);
29 /*--== Utility functions/predicates/etc used all over the place: --==*/
30 //! Predicate test for a signed 10-bit value
32 \param Value The input value to be tested
34 This predicate tests for a signed 10-bit value, returning the 10-bit value
38 inline bool isS10Constant(T Value);
41 inline bool isS10Constant<short>(short Value) {
42 int SExtValue = ((int) Value << (32 - 10)) >> (32 - 10);
43 return ((Value > 0 && Value <= (1 << 9) - 1)
44 || (Value < 0 && (short) SExtValue == Value));
48 inline bool isS10Constant<int>(int Value) {
49 return (Value >= -(1 << 9) && Value <= (1 << 9) - 1);
53 inline bool isS10Constant<uint32_t>(uint32_t Value) {
54 return (Value <= ((1 << 9) - 1));
58 inline bool isS10Constant<int64_t>(int64_t Value) {
59 return (Value >= -(1 << 9) && Value <= (1 << 9) - 1);
63 inline bool isS10Constant<uint64_t>(uint64_t Value) {
64 return (Value <= ((1 << 9) - 1));
67 //! Predicate test for an unsigned 10-bit value
69 \param Value The input value to be tested
71 This predicate tests for an unsigned 10-bit value, returning the 10-bit value
74 inline bool isU10Constant(short Value) {
75 return (Value == (Value & 0x3ff));
78 inline bool isU10Constant(int Value) {
79 return (Value == (Value & 0x3ff));
82 inline bool isU10Constant(uint32_t Value) {
83 return (Value == (Value & 0x3ff));
86 inline bool isU10Constant(int64_t Value) {
87 return (Value == (Value & 0x3ff));
90 inline bool isU10Constant(uint64_t Value) {
91 return (Value == (Value & 0x3ff));
95 // Defines symbolic names for the SPU instructions.
97 #include "SPUGenInstrNames.inc"
99 #endif /* LLVM_TARGET_IBMCELLSPU_H */