LLVM API Documentation

SPUSubtarget.h

Go to the documentation of this file.
00001 //===-- SPUSubtarget.h - Define Subtarget for the Cell SPU ------*- 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 declares the Cell SPU-specific subclass of TargetSubtarget.
00011 //
00012 //===----------------------------------------------------------------------===//
00013 
00014 #ifndef CELLSUBTARGET_H
00015 #define CELLSUBTARGET_H
00016 
00017 #include "llvm/Target/TargetInstrItineraries.h"
00018 #include "llvm/Target/TargetSubtarget.h"
00019 
00020 #include <string>
00021 
00022 namespace llvm {
00023   class Module;
00024   class GlobalValue;
00025   class TargetMachine;
00026 
00027   namespace SPU {
00028     enum {
00029       PROC_NONE,
00030       DEFAULT_PROC
00031     };
00032   }
00033     
00034   class SPUSubtarget : public TargetSubtarget {
00035   protected:
00036     const TargetMachine &TM;
00037     
00038     /// stackAlignment - The minimum alignment known to hold of the stack frame
00039     /// on entry to the function and which must be maintained by every function.
00040     unsigned StackAlignment;
00041     
00042     /// Selected instruction itineraries (one entry per itinerary class.)
00043     InstrItineraryData InstrItins;
00044 
00045     /// Which SPU processor (this isn't really used, but it's there to keep
00046     /// the C compiler happy)
00047     unsigned ProcDirective;
00048 
00049     /// Use (assume) large memory -- effectively disables the LQA/STQA
00050     /// instructions that assume 259K local store.
00051     bool UseLargeMem;
00052     
00053   public:
00054     /// This constructor initializes the data members to match that
00055     /// of the specified module.
00056     ///
00057     SPUSubtarget(const TargetMachine &TM, const Module &M,
00058                  const std::string &FS);
00059     
00060     /// ParseSubtargetFeatures - Parses features string setting specified 
00061     /// subtarget options.  Definition of function is auto generated by tblgen.
00062     void ParseSubtargetFeatures(const std::string &FS, const std::string &CPU);
00063     
00064     /// SetJITMode - This is called to inform the subtarget info that we are
00065     /// producing code for the JIT.
00066     void SetJITMode();
00067 
00068     /// getStackAlignment - Returns the minimum alignment known to hold of the
00069     /// stack frame on entry to the function and which must be maintained by
00070     /// every function for this subtarget.
00071     unsigned getStackAlignment() const { return StackAlignment; }
00072     
00073     /// getInstrItins - Return the instruction itineraies based on subtarget 
00074     /// selection.
00075     const InstrItineraryData &getInstrItineraryData() const {
00076       return InstrItins;
00077     }
00078 
00079     /// Use large memory addressing predicate
00080     bool usingLargeMem() const {
00081       return UseLargeMem;
00082     }
00083 
00084     /// getTargetDataString - Return the pointer size and type alignment
00085     /// properties of this subtarget.
00086     const char *getTargetDataString() const {
00087       return "E-p:32:32:128-f64:64:128-f32:32:128-i64:32:128-i32:32:128"
00088              "-i16:16:128-i8:8:128-i1:8:128-a:0:128-v64:128:128-v128:128:128"
00089              "-s:128:128";
00090     }
00091   };
00092 } // End llvm namespace
00093 
00094 #endif