Update comments.
[llvm/msp430.git] / lib / Target / CellSPU / SPU.h
blob9bb199a16e1f64ddb9d3eb3100618edd5b9c04fa
1 //===-- SPU.h - Top-level interface for Cell SPU Target ----------*- C++ -*-==//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file contains the entry points for global functions defined in the LLVM
11 // Cell SPU back-end.
13 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_TARGET_IBMCELLSPU_H
16 #define LLVM_TARGET_IBMCELLSPU_H
18 #include "llvm/Support/DataTypes.h"
20 namespace llvm {
21 class SPUTargetMachine;
22 class FunctionPass;
23 class raw_ostream;
25 FunctionPass *createSPUISelDag(SPUTargetMachine &TM);
26 FunctionPass *createSPUAsmPrinterPass(raw_ostream &o,
27 SPUTargetMachine &tm,
28 bool fast, bool verbose);
30 /*--== Utility functions/predicates/etc used all over the place: --==*/
31 //! Predicate test for a signed 10-bit value
32 /*!
33 \param Value The input value to be tested
35 This predicate tests for a signed 10-bit value, returning the 10-bit value
36 as a short if true.
38 template<typename T>
39 inline bool isS10Constant(T Value);
41 template<>
42 inline bool isS10Constant<short>(short Value) {
43 int SExtValue = ((int) Value << (32 - 10)) >> (32 - 10);
44 return ((Value > 0 && Value <= (1 << 9) - 1)
45 || (Value < 0 && (short) SExtValue == Value));
48 template<>
49 inline bool isS10Constant<int>(int Value) {
50 return (Value >= -(1 << 9) && Value <= (1 << 9) - 1);
53 template<>
54 inline bool isS10Constant<uint32_t>(uint32_t Value) {
55 return (Value <= ((1 << 9) - 1));
58 template<>
59 inline bool isS10Constant<int64_t>(int64_t Value) {
60 return (Value >= -(1 << 9) && Value <= (1 << 9) - 1);
63 template<>
64 inline bool isS10Constant<uint64_t>(uint64_t Value) {
65 return (Value <= ((1 << 9) - 1));
68 //! Predicate test for an unsigned 10-bit value
69 /*!
70 \param Value The input value to be tested
72 This predicate tests for an unsigned 10-bit value, returning the 10-bit value
73 as a short if true.
75 inline bool isU10Constant(short Value) {
76 return (Value == (Value & 0x3ff));
79 inline bool isU10Constant(int Value) {
80 return (Value == (Value & 0x3ff));
83 inline bool isU10Constant(uint32_t Value) {
84 return (Value == (Value & 0x3ff));
87 inline bool isU10Constant(int64_t Value) {
88 return (Value == (Value & 0x3ff));
91 inline bool isU10Constant(uint64_t Value) {
92 return (Value == (Value & 0x3ff));
96 // Defines symbolic names for the SPU instructions.
98 #include "SPUGenInstrNames.inc"
100 #endif /* LLVM_TARGET_IBMCELLSPU_H */