LLVM API Documentation

PPCSubtarget.h

Go to the documentation of this file.
00001 //=====-- PPCSubtarget.h - Define Subtarget for the PPC -------*- C++ -*--====//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file was developed by Nate Begeman and is distributed under the
00006 // University of Illinois Open Source License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 //
00010 // This file declares the PowerPC specific subclass of TargetSubtarget.
00011 //
00012 //===----------------------------------------------------------------------===//
00013 
00014 #ifndef POWERPCSUBTARGET_H
00015 #define POWERPCSUBTARGET_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 
00025 class PPCSubtarget : public TargetSubtarget {
00026 protected:
00027   /// stackAlignment - The minimum alignment known to hold of the stack frame on
00028   /// entry to the function and which must be maintained by every function.
00029   unsigned StackAlignment;
00030   
00031   /// Selected instruction itineraries (one entry per itinerary class.)
00032   InstrItineraryData InstrItins;
00033 
00034   /// Used by the ISel to turn in optimizations for POWER4-derived architectures
00035   bool IsGigaProcessor;
00036   bool Is64Bit;
00037   bool Has64BitRegs;
00038   bool HasAltivec;
00039   bool HasFSQRT;
00040   bool HasSTFIWX;
00041   bool IsAIX;
00042   bool IsDarwin;
00043 public:
00044   /// This constructor initializes the data members to match that
00045   /// of the specified module.
00046   ///
00047   PPCSubtarget(const Module &M, const std::string &FS);
00048   
00049   /// ParseSubtargetFeatures - Parses features string setting specified 
00050   /// subtarget options.  Definition of function is auto generated by tblgen.
00051   void ParseSubtargetFeatures(const std::string &FS, const std::string &CPU);
00052 
00053   /// getStackAlignment - Returns the minimum alignment known to hold of the
00054   /// stack frame on entry to the function and which must be maintained by every
00055   /// function for this subtarget.
00056   unsigned getStackAlignment() const { return StackAlignment; }
00057   
00058   /// getInstrItins - Return the instruction itineraies based on subtarget 
00059   /// selection.
00060   const InstrItineraryData getInstrItineraryData() const { return InstrItins; }
00061   
00062 
00063   bool hasFSQRT() const { return HasFSQRT; }
00064   bool hasSTFIWX() const { return HasSTFIWX; }
00065   bool has64BitRegs() const { return Has64BitRegs; }
00066   bool hasAltivec() const { return HasAltivec; }
00067   
00068   bool isAIX() const { return IsAIX; }
00069   bool isDarwin() const { return IsDarwin; }
00070   bool is64Bit() const { return Is64Bit; }
00071   bool isGigaProcessor() const { return IsGigaProcessor; }
00072 };
00073 } // End llvm namespace
00074 
00075 #endif