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 "PPCFrameInfo.h"
00018 #include "PPCSubtarget.h"
00019 #include "PPCJITInfo.h"
00020 #include "PPCInstrInfo.h"
00021 #include "PPCISelLowering.h"
00022 #include "PPCMachOWriterInfo.h"
00023 #include "llvm/Target/TargetMachine.h"
00024 #include "llvm/Target/TargetData.h"
00025 
00026 namespace llvm {
00027 class PassManager;
00028 class GlobalValue;
00029 
00030 /// PPCTargetMachine - Common code between 32-bit and 64-bit PowerPC targets.
00031 ///
00032 class PPCTargetMachine : public LLVMTargetMachine {
00033   PPCSubtarget        Subtarget;
00034   const TargetData    DataLayout;       // Calculates type size & alignment
00035   PPCInstrInfo        InstrInfo;
00036   PPCFrameInfo        FrameInfo;
00037   PPCJITInfo          JITInfo;
00038   PPCTargetLowering   TLInfo;
00039   InstrItineraryData  InstrItins;
00040   PPCMachOWriterInfo  MachOWriterInfo;
00041 
00042 public:
00043   PPCTargetMachine(const Target &T, const std::string &TT,
00044                    const std::string &FS, bool is64Bit);
00045 
00046   virtual const PPCInstrInfo     *getInstrInfo() const { return &InstrInfo; }
00047   virtual const PPCFrameInfo     *getFrameInfo() const { return &FrameInfo; }
00048   virtual       PPCJITInfo       *getJITInfo()         { return &JITInfo; }
00049   virtual       PPCTargetLowering *getTargetLowering() const { 
00050    return const_cast<PPCTargetLowering*>(&TLInfo); 
00051   }
00052   virtual const PPCRegisterInfo  *getRegisterInfo() const {
00053     return &InstrInfo.getRegisterInfo();
00054   }
00055   
00056   virtual const TargetData    *getTargetData() const    { return &DataLayout; }
00057   virtual const PPCSubtarget  *getSubtargetImpl() const { return &Subtarget; }
00058   virtual const InstrItineraryData getInstrItineraryData() const {  
00059     return InstrItins;
00060   }
00061   virtual const PPCMachOWriterInfo *getMachOWriterInfo() const {
00062     return &MachOWriterInfo;
00063   }
00064 
00065   // Pass Pipeline Configuration
00066   virtual bool addInstSelector(PassManagerBase &PM, CodeGenOpt::Level OptLevel);
00067   virtual bool addPreEmitPass(PassManagerBase &PM, CodeGenOpt::Level OptLevel);
00068   virtual bool addCodeEmitter(PassManagerBase &PM, CodeGenOpt::Level OptLevel,
00069                               MachineCodeEmitter &MCE);
00070   virtual bool addCodeEmitter(PassManagerBase &PM, CodeGenOpt::Level OptLevel,
00071                               JITCodeEmitter &JCE);
00072   virtual bool addCodeEmitter(PassManagerBase &PM, CodeGenOpt::Level OptLevel,
00073                               ObjectCodeEmitter &OCE);
00074   virtual bool addSimpleCodeEmitter(PassManagerBase &PM,
00075                                     CodeGenOpt::Level OptLevel,
00076                                     MachineCodeEmitter &MCE);
00077   virtual bool addSimpleCodeEmitter(PassManagerBase &PM,
00078                                     CodeGenOpt::Level OptLevel,
00079                                     JITCodeEmitter &JCE);
00080   virtual bool addSimpleCodeEmitter(PassManagerBase &PM,
00081                                     CodeGenOpt::Level OptLevel,
00082                                     ObjectCodeEmitter &OCE);
00083   virtual bool getEnableTailMergeDefault() const;
00084 };
00085 
00086 /// PPC32TargetMachine - PowerPC 32-bit target machine.
00087 ///
00088 class PPC32TargetMachine : public PPCTargetMachine {
00089 public:
00090   PPC32TargetMachine(const Target &T, const std::string &TT,
00091                      const std::string &FS);
00092 };
00093 
00094 /// PPC64TargetMachine - PowerPC 64-bit target machine.
00095 ///
00096 class PPC64TargetMachine : public PPCTargetMachine {
00097 public:
00098   PPC64TargetMachine(const Target &T, const std::string &TT,
00099                      const std::string &FS);
00100 };
00101 
00102 } // end namespace llvm
00103 
00104 #endif