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