LLVM API Documentation

PPCTargetMachine.h
Go to the documentation of this file.
00001 //===-- PPCTargetMachine.h - Define TargetMachine for PowerPC ---*- 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 PowerPC specific subclass of TargetMachine.
00011 //
00012 //===----------------------------------------------------------------------===//
00013 
00014 #ifndef PPC_TARGETMACHINE_H
00015 #define PPC_TARGETMACHINE_H
00016 
00017 #include "PPCFrameLowering.h"
00018 #include "PPCISelLowering.h"
00019 #include "PPCInstrInfo.h"
00020 #include "PPCJITInfo.h"
00021 #include "PPCSelectionDAGInfo.h"
00022 #include "PPCSubtarget.h"
00023 #include "llvm/IR/DataLayout.h"
00024 #include "llvm/Target/TargetMachine.h"
00025 
00026 namespace llvm {
00027 
00028 /// PPCTargetMachine - Common code between 32-bit and 64-bit PowerPC targets.
00029 ///
00030 class PPCTargetMachine : public LLVMTargetMachine {
00031   PPCSubtarget        Subtarget;
00032   const DataLayout    DL;       // Calculates type size & alignment
00033   PPCInstrInfo        InstrInfo;
00034   PPCFrameLowering    FrameLowering;
00035   PPCJITInfo          JITInfo;
00036   PPCTargetLowering   TLInfo;
00037   PPCSelectionDAGInfo TSInfo;
00038   InstrItineraryData  InstrItins;
00039 
00040 public:
00041   PPCTargetMachine(const Target &T, StringRef TT,
00042                    StringRef CPU, StringRef FS, const TargetOptions &Options,
00043                    Reloc::Model RM, CodeModel::Model CM,
00044                    CodeGenOpt::Level OL, bool is64Bit);
00045 
00046   virtual const PPCInstrInfo      *getInstrInfo() const { return &InstrInfo; }
00047   virtual const PPCFrameLowering  *getFrameLowering() const {
00048     return &FrameLowering;
00049   }
00050   virtual       PPCJITInfo        *getJITInfo()         { return &JITInfo; }
00051   virtual const PPCTargetLowering *getTargetLowering() const {
00052    return &TLInfo;
00053   }
00054   virtual const PPCSelectionDAGInfo* getSelectionDAGInfo() const {
00055     return &TSInfo;
00056   }
00057   virtual const PPCRegisterInfo   *getRegisterInfo() const {
00058     return &InstrInfo.getRegisterInfo();
00059   }
00060 
00061   virtual const DataLayout    *getDataLayout() const    { return &DL; }
00062   virtual const PPCSubtarget  *getSubtargetImpl() const { return &Subtarget; }
00063   virtual const InstrItineraryData *getInstrItineraryData() const {
00064     return &InstrItins;
00065   }
00066 
00067   // Pass Pipeline Configuration
00068   virtual TargetPassConfig *createPassConfig(PassManagerBase &PM);
00069   virtual bool addCodeEmitter(PassManagerBase &PM,
00070                               JITCodeEmitter &JCE);
00071 
00072   /// \brief Register PPC analysis passes with a pass manager.
00073   virtual void addAnalysisPasses(PassManagerBase &PM);
00074 };
00075 
00076 /// PPC32TargetMachine - PowerPC 32-bit target machine.
00077 ///
00078 class PPC32TargetMachine : public PPCTargetMachine {
00079   virtual void anchor();
00080 public:
00081   PPC32TargetMachine(const Target &T, StringRef TT,
00082                      StringRef CPU, StringRef FS, const TargetOptions &Options,
00083                      Reloc::Model RM, CodeModel::Model CM,
00084                      CodeGenOpt::Level OL);
00085 };
00086 
00087 /// PPC64TargetMachine - PowerPC 64-bit target machine.
00088 ///
00089 class PPC64TargetMachine : public PPCTargetMachine {
00090   virtual void anchor();
00091 public:
00092   PPC64TargetMachine(const Target &T, StringRef TT,
00093                      StringRef CPU, StringRef FS, const TargetOptions &Options,
00094                      Reloc::Model RM, CodeModel::Model CM,
00095                      CodeGenOpt::Level OL);
00096 };
00097 
00098 } // end namespace llvm
00099 
00100 #endif