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;
26 FunctionPass *createSPUISelDag(SPUTargetMachine &TM);
27 FunctionPass *createSPUAsmPrinterPass(raw_ostream &o,
29 CodeGenOpt::Level OptLevel,
32 /*--== Utility functions/predicates/etc used all over the place: --==*/
33 //! Predicate test for a signed 10-bit value
35 \param Value The input value to be tested
37 This predicate tests for a signed 10-bit value, returning the 10-bit value
41 inline bool isS10Constant(T Value);
44 inline bool isS10Constant<short>(short Value) {
45 int SExtValue = ((int) Value << (32 - 10)) >> (32 - 10);
46 return ((Value > 0 && Value <= (1 << 9) - 1)
47 || (Value < 0 && (short) SExtValue == Value));
51 inline bool isS10Constant<int>(int Value) {
52 return (Value >= -(1 << 9) && Value <= (1 << 9) - 1);
56 inline bool isS10Constant<uint32_t>(uint32_t Value) {
57 return (Value <= ((1 << 9) - 1));
61 inline bool isS10Constant<int64_t>(int64_t Value) {
62 return (Value >= -(1 << 9) && Value <= (1 << 9) - 1);
66 inline bool isS10Constant<uint64_t>(uint64_t Value) {
67 return (Value <= ((1 << 9) - 1));
70 //! Predicate test for an unsigned 10-bit value
72 \param Value The input value to be tested
74 This predicate tests for an unsigned 10-bit value, returning the 10-bit value
77 inline bool isU10Constant(short Value) {
78 return (Value == (Value & 0x3ff));
81 inline bool isU10Constant(int Value) {
82 return (Value == (Value & 0x3ff));
85 inline bool isU10Constant(uint32_t Value) {
86 return (Value == (Value & 0x3ff));
89 inline bool isU10Constant(int64_t Value) {
90 return (Value == (Value & 0x3ff));
93 inline bool isU10Constant(uint64_t Value) {
94 return (Value == (Value & 0x3ff));
98 // Defines symbolic names for the SPU instructions.
100 #include "SPUGenInstrNames.inc"
102 #endif /* LLVM_TARGET_IBMCELLSPU_H */