Scott Michel | a589a08 | 2007-12-03 23:14:43 +0000 | [diff] [blame] | 1 | //===-- SPU.h - Top-level interface for Cell SPU Target ----------*- C++ -*-==// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
Chris Lattner | 4ee451d | 2007-12-29 20:36:04 +0000 | [diff] [blame^] | 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
Scott Michel | a589a08 | 2007-12-03 23:14:43 +0000 | [diff] [blame] | 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // This file contains the entry points for global functions defined in the LLVM |
| 11 | // Cell SPU back-end. |
| 12 | // |
| 13 | //===----------------------------------------------------------------------===// |
| 14 | |
| 15 | #ifndef LLVM_TARGET_IBMCELLSPU_H |
| 16 | #define LLVM_TARGET_IBMCELLSPU_H |
| 17 | |
| 18 | #include <iosfwd> |
| 19 | |
| 20 | namespace llvm { |
| 21 | class SPUTargetMachine; |
| 22 | class FunctionPass; |
| 23 | |
| 24 | FunctionPass *createSPUISelDag(SPUTargetMachine &TM); |
| 25 | FunctionPass *createSPUAsmPrinterPass(std::ostream &o, SPUTargetMachine &tm); |
| 26 | |
Scott Michel | ec2a08f | 2007-12-15 00:38:50 +0000 | [diff] [blame] | 27 | /*--== Utility functions/predicates/etc used all over the place: --==*/ |
Scott Michel | a589a08 | 2007-12-03 23:14:43 +0000 | [diff] [blame] | 28 | //! Predicate test for a signed 10-bit value |
| 29 | /*! |
| 30 | \param Value The input value to be tested |
| 31 | |
| 32 | This predicate tests for a signed 10-bit value, returning the 10-bit value |
| 33 | as a short if true. |
| 34 | */ |
| 35 | inline bool isS10Constant(short Value) { |
| 36 | int SExtValue = ((int) Value << (32 - 10)) >> (32 - 10); |
| 37 | return ((Value > 0 && Value <= (1 << 9) - 1) |
| 38 | || (Value < 0 && (short) SExtValue == Value)); |
| 39 | } |
| 40 | |
| 41 | inline bool isS10Constant(int Value) { |
| 42 | return (Value >= -(1 << 9) && Value <= (1 << 9) - 1); |
| 43 | } |
| 44 | |
| 45 | inline bool isS10Constant(uint32_t Value) { |
| 46 | return (Value <= ((1 << 9) - 1)); |
| 47 | } |
| 48 | |
| 49 | inline bool isS10Constant(int64_t Value) { |
| 50 | return (Value >= -(1 << 9) && Value <= (1 << 9) - 1); |
| 51 | } |
| 52 | |
| 53 | inline bool isS10Constant(uint64_t Value) { |
| 54 | return (Value <= ((1 << 9) - 1)); |
| 55 | } |
Scott Michel | ec2a08f | 2007-12-15 00:38:50 +0000 | [diff] [blame] | 56 | |
| 57 | //! Predicate test for an unsigned 10-bit value |
| 58 | /*! |
| 59 | \param Value The input value to be tested |
| 60 | |
| 61 | This predicate tests for an unsigned 10-bit value, returning the 10-bit value |
| 62 | as a short if true. |
| 63 | */ |
| 64 | inline bool isU10Constant(short Value) { |
| 65 | return (Value == (Value & 0x3ff)); |
| 66 | } |
| 67 | |
| 68 | inline bool isU10Constant(int Value) { |
| 69 | return (Value == (Value & 0x3ff)); |
| 70 | } |
| 71 | |
| 72 | inline bool isU10Constant(uint32_t Value) { |
| 73 | return (Value == (Value & 0x3ff)); |
| 74 | } |
| 75 | |
| 76 | inline bool isU10Constant(int64_t Value) { |
| 77 | return (Value == (Value & 0x3ff)); |
| 78 | } |
| 79 | |
| 80 | inline bool isU10Constant(uint64_t Value) { |
| 81 | return (Value == (Value & 0x3ff)); |
| 82 | } |
Scott Michel | a589a08 | 2007-12-03 23:14:43 +0000 | [diff] [blame] | 83 | } |
| 84 | |
| 85 | // Defines symbolic names for the SPU instructions. |
| 86 | // |
| 87 | #include "SPUGenInstrNames.inc" |
| 88 | |
| 89 | #endif /* LLVM_TARGET_IBMCELLSPU_H */ |