LLVM API Documentation
00001 //===-- SPU.h - Top-level interface for Cell SPU Target ----------*- C++ -*-==// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file is distributed under the University of Illinois Open Source 00006 // License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 // 00010 // This file contains the entry points for global functions defined in the LLVM 00011 // Cell SPU back-end. 00012 // 00013 //===----------------------------------------------------------------------===// 00014 00015 #ifndef LLVM_TARGET_IBMCELLSPU_H 00016 #define LLVM_TARGET_IBMCELLSPU_H 00017 00018 #include "llvm/Support/DataTypes.h" 00019 00020 namespace llvm { 00021 class SPUTargetMachine; 00022 class FunctionPass; 00023 class raw_ostream; 00024 00025 FunctionPass *createSPUISelDag(SPUTargetMachine &TM); 00026 FunctionPass *createSPUAsmPrinterPass(raw_ostream &o, SPUTargetMachine &tm); 00027 00028 /*--== Utility functions/predicates/etc used all over the place: --==*/ 00029 //! Predicate test for a signed 10-bit value 00030 /*! 00031 \param Value The input value to be tested 00032 00033 This predicate tests for a signed 10-bit value, returning the 10-bit value 00034 as a short if true. 00035 */ 00036 template<typename T> 00037 inline bool isS10Constant(T Value); 00038 00039 template<> 00040 inline bool isS10Constant<short>(short Value) { 00041 int SExtValue = ((int) Value << (32 - 10)) >> (32 - 10); 00042 return ((Value > 0 && Value <= (1 << 9) - 1) 00043 || (Value < 0 && (short) SExtValue == Value)); 00044 } 00045 00046 template<> 00047 inline bool isS10Constant<int>(int Value) { 00048 return (Value >= -(1 << 9) && Value <= (1 << 9) - 1); 00049 } 00050 00051 template<> 00052 inline bool isS10Constant<uint32_t>(uint32_t Value) { 00053 return (Value <= ((1 << 9) - 1)); 00054 } 00055 00056 template<> 00057 inline bool isS10Constant<int64_t>(int64_t Value) { 00058 return (Value >= -(1 << 9) && Value <= (1 << 9) - 1); 00059 } 00060 00061 template<> 00062 inline bool isS10Constant<uint64_t>(uint64_t Value) { 00063 return (Value <= ((1 << 9) - 1)); 00064 } 00065 00066 //! Predicate test for an unsigned 10-bit value 00067 /*! 00068 \param Value The input value to be tested 00069 00070 This predicate tests for an unsigned 10-bit value, returning the 10-bit value 00071 as a short if true. 00072 */ 00073 inline bool isU10Constant(short Value) { 00074 return (Value == (Value & 0x3ff)); 00075 } 00076 00077 inline bool isU10Constant(int Value) { 00078 return (Value == (Value & 0x3ff)); 00079 } 00080 00081 inline bool isU10Constant(uint32_t Value) { 00082 return (Value == (Value & 0x3ff)); 00083 } 00084 00085 inline bool isU10Constant(int64_t Value) { 00086 return (Value == (Value & 0x3ff)); 00087 } 00088 00089 inline bool isU10Constant(uint64_t Value) { 00090 return (Value == (Value & 0x3ff)); 00091 } 00092 } 00093 00094 // Defines symbolic names for the SPU instructions. 00095 // 00096 #include "SPUGenInstrNames.inc" 00097 00098 #endif /* LLVM_TARGET_IBMCELLSPU_H */