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"
19 #include "llvm/Target/TargetMachine.h"
22 class SPUTargetMachine;
24 class formatted_raw_ostream;
26 FunctionPass *createSPUISelDag(SPUTargetMachine &TM);
27 FunctionPass *createSPUAsmPrinterPass(formatted_raw_ostream &o,
31 /*--== Utility functions/predicates/etc used all over the place: --==*/
32 //! Predicate test for a signed 10-bit value
34 \param Value The input value to be tested
36 This predicate tests for a signed 10-bit value, returning the 10-bit value
40 inline bool isS10Constant(T Value);
43 inline bool isS10Constant<short>(short Value) {
44 int SExtValue = ((int) Value << (32 - 10)) >> (32 - 10);
45 return ((Value > 0 && Value <= (1 << 9) - 1)
46 || (Value < 0 && (short) SExtValue == Value));
50 inline bool isS10Constant<int>(int Value) {
51 return (Value >= -(1 << 9) && Value <= (1 << 9) - 1);
55 inline bool isS10Constant<uint32_t>(uint32_t Value) {
56 return (Value <= ((1 << 9) - 1));
60 inline bool isS10Constant<int64_t>(int64_t Value) {
61 return (Value >= -(1 << 9) && Value <= (1 << 9) - 1);
65 inline bool isS10Constant<uint64_t>(uint64_t Value) {
66 return (Value <= ((1 << 9) - 1));
69 //! Predicate test for an unsigned 10-bit value
71 \param Value The input value to be tested
73 This predicate tests for an unsigned 10-bit value, returning the 10-bit value
76 inline bool isU10Constant(short Value) {
77 return (Value == (Value & 0x3ff));
80 inline bool isU10Constant(int Value) {
81 return (Value == (Value & 0x3ff));
84 inline bool isU10Constant(uint32_t Value) {
85 return (Value == (Value & 0x3ff));
88 inline bool isU10Constant(int64_t Value) {
89 return (Value == (Value & 0x3ff));
92 inline bool isU10Constant(uint64_t Value) {
93 return (Value == (Value & 0x3ff));
97 // Defines symbolic names for the SPU instructions.
99 #include "SPUGenInstrNames.inc"
101 #endif /* LLVM_TARGET_IBMCELLSPU_H */