LLVM API Documentation

SparcSubtarget.h
Go to the documentation of this file.
00001 //===-- SparcSubtarget.h - Define Subtarget for the SPARC -------*- 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 SPARC specific subclass of TargetSubtargetInfo.
00011 //
00012 //===----------------------------------------------------------------------===//
00013 
00014 #ifndef LLVM_LIB_TARGET_SPARC_SPARCSUBTARGET_H
00015 #define LLVM_LIB_TARGET_SPARC_SPARCSUBTARGET_H
00016 
00017 #include "SparcFrameLowering.h"
00018 #include "SparcInstrInfo.h"
00019 #include "SparcISelLowering.h"
00020 #include "SparcSelectionDAGInfo.h"
00021 #include "llvm/IR/DataLayout.h"
00022 #include "llvm/Target/TargetFrameLowering.h"
00023 #include "llvm/Target/TargetSubtargetInfo.h"
00024 #include <string>
00025 
00026 #define GET_SUBTARGETINFO_HEADER
00027 #include "SparcGenSubtargetInfo.inc"
00028 
00029 namespace llvm {
00030 class StringRef;
00031 
00032 class SparcSubtarget : public SparcGenSubtargetInfo {
00033   virtual void anchor();
00034   bool IsV9;
00035   bool V8DeprecatedInsts;
00036   bool IsVIS, IsVIS2, IsVIS3;
00037   bool Is64Bit;
00038   bool HasHardQuad;
00039   bool UsePopc;
00040   const DataLayout DL;       // Calculates type size & alignment
00041   SparcInstrInfo InstrInfo;
00042   SparcTargetLowering TLInfo;
00043   SparcSelectionDAGInfo TSInfo;
00044   SparcFrameLowering FrameLowering;
00045 
00046 public:
00047   SparcSubtarget(const std::string &TT, const std::string &CPU,
00048                  const std::string &FS, TargetMachine &TM, bool is64bit);
00049 
00050   const SparcInstrInfo *getInstrInfo() const override { return &InstrInfo; }
00051   const TargetFrameLowering *getFrameLowering() const override {
00052     return &FrameLowering;
00053   }
00054   const SparcRegisterInfo *getRegisterInfo() const override {
00055     return &InstrInfo.getRegisterInfo();
00056   }
00057   const SparcTargetLowering *getTargetLowering() const override {
00058     return &TLInfo;
00059   }
00060   const SparcSelectionDAGInfo *getSelectionDAGInfo() const override {
00061     return &TSInfo;
00062   }
00063   const DataLayout *getDataLayout() const override { return &DL; }
00064 
00065   bool isV9() const { return IsV9; }
00066   bool isVIS() const { return IsVIS; }
00067   bool isVIS2() const { return IsVIS2; }
00068   bool isVIS3() const { return IsVIS3; }
00069   bool useDeprecatedV8Instructions() const { return V8DeprecatedInsts; }
00070   bool hasHardQuad() const { return HasHardQuad; }
00071   bool usePopc() const { return UsePopc; }
00072 
00073   /// ParseSubtargetFeatures - Parses features string setting specified
00074   /// subtarget options.  Definition of function is auto generated by tblgen.
00075   void ParseSubtargetFeatures(StringRef CPU, StringRef FS);
00076   SparcSubtarget &initializeSubtargetDependencies(StringRef CPU, StringRef FS);
00077 
00078   bool is64Bit() const { return Is64Bit; }
00079 
00080   /// The 64-bit ABI uses biased stack and frame pointers, so the stack frame
00081   /// of the current function is the area from [%sp+BIAS] to [%fp+BIAS].
00082   int64_t getStackPointerBias() const {
00083     return is64Bit() ? 2047 : 0;
00084   }
00085 
00086   /// Given a actual stack size as determined by FrameInfo, this function
00087   /// returns adjusted framesize which includes space for register window
00088   /// spills and arguments.
00089   int getAdjustedFrameSize(int stackSize) const;
00090 
00091 };
00092 
00093 } // end namespace llvm
00094 
00095 #endif