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 was developed by the LLVM research group and is distributed under
00006 // the University of Illinois Open Source 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 "llvm/Target/TargetMachine.h"
00023 #include "llvm/Target/TargetData.h"
00024 
00025 namespace llvm {
00026 class PassManager;
00027 class GlobalValue;
00028 
00029 /// PPCTargetMachine - Common code between 32-bit and 64-bit PowerPC targets.
00030 ///
00031 class PPCTargetMachine : public TargetMachine {
00032   PPCSubtarget        Subtarget;
00033   const TargetData    DataLayout;       // Calculates type size & alignment
00034   PPCInstrInfo        InstrInfo;
00035   PPCFrameInfo        FrameInfo;
00036   PPCJITInfo          JITInfo;
00037   PPCTargetLowering   TLInfo;
00038   InstrItineraryData  InstrItins;
00039 public:
00040   PPCTargetMachine(const Module &M, const std::string &FS, bool is64Bit);
00041 
00042   virtual const PPCInstrInfo     *getInstrInfo() const { return &InstrInfo; }
00043   virtual const TargetFrameInfo  *getFrameInfo() const { return &FrameInfo; }
00044   virtual       TargetJITInfo    *getJITInfo()         { return &JITInfo; }
00045   virtual       PPCTargetLowering *getTargetLowering() const { 
00046    return const_cast<PPCTargetLowering*>(&TLInfo); 
00047   }
00048   virtual const MRegisterInfo    *getRegisterInfo() const {
00049     return &InstrInfo.getRegisterInfo();
00050   }
00051   
00052   virtual const TargetData    *getTargetData() const    { return &DataLayout; }
00053   virtual const PPCSubtarget  *getSubtargetImpl() const { return &Subtarget; }
00054   virtual const InstrItineraryData getInstrItineraryData() const {  
00055     return InstrItins;
00056   }
00057   
00058 
00059   virtual bool addPassesToEmitFile(PassManager &PM, std::ostream &Out,
00060                                    CodeGenFileType FileType, bool Fast);
00061   
00062   bool addPassesToEmitMachineCode(FunctionPassManager &PM,
00063                                   MachineCodeEmitter &MCE);
00064 };
00065 
00066 /// PPC32TargetMachine - PowerPC 32-bit target machine.
00067 ///
00068 class PPC32TargetMachine : public PPCTargetMachine {
00069 public:
00070   PPC32TargetMachine(const Module &M, const std::string &FS);
00071   
00072   static unsigned getJITMatchQuality();
00073   static unsigned getModuleMatchQuality(const Module &M);
00074 };
00075 
00076 /// PPC64TargetMachine - PowerPC 64-bit target machine.
00077 ///
00078 class PPC64TargetMachine : public PPCTargetMachine {
00079 public:
00080   PPC64TargetMachine(const Module &M, const std::string &FS);
00081   
00082   static unsigned getJITMatchQuality();
00083   static unsigned getModuleMatchQuality(const Module &M);
00084 };
00085 
00086 } // end namespace llvm
00087 
00088 #endif