1 //===-- PPC32TargetMachine.h - Define TargetMachine for PowerPC -*- C++ -*-=// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file was developed by the LLVM research group and is distributed under 6 // the University of Illinois Open Source License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 // 10 // This file declares the PowerPC specific subclass of TargetMachine. 11 // 12 //===----------------------------------------------------------------------===// 13 14 #ifndef POWERPC32_TARGETMACHINE_H 15 #define POWERPC32_TARGETMACHINE_H 16 17 #include "PPCFrameInfo.h" 18 #include "PPCSubtarget.h" 19 #include "PPCJITInfo.h" 20 #include "PPCInstrInfo.h" 21 #include "llvm/Target/TargetMachine.h" 22 #include "llvm/Target/TargetFrameInfo.h" 23 #include "llvm/PassManager.h" 24 25 namespace llvm { 26 27 class IntrinsicLowering; 28 class GlobalValue; 29 class IntrinsicLowering; 30 31 // FIXME: Merge into only subclass. 32 class PowerPCTargetMachine : public TargetMachine { 33 PowerPCFrameInfo FrameInfo; 34 PPCSubtarget Subtarget; 35 protected: 36 PowerPCTargetMachine(const std::string &name, IntrinsicLowering *IL, 37 const Module &M, const std::string &FS, 38 const TargetData &TD, 39 const PowerPCFrameInfo &TFI); 40 public: 41 virtual const TargetFrameInfo *getFrameInfo() const { return &FrameInfo; } 42 virtual const TargetSubtarget *getSubtargetImpl() const{ return &Subtarget; } 43 44 virtual bool addPassesToEmitFile(PassManager &PM, std::ostream &Out, 45 CodeGenFileType FileType); 46 }; 47 48 class PPC32TargetMachine : public PowerPCTargetMachine { 49 PPC32InstrInfo InstrInfo; 50 PPC32JITInfo JITInfo; 51 52 public: 53 PPC32TargetMachine(const Module &M, IntrinsicLowering *IL, 54 const std::string &FS); 55 virtual const PPC32InstrInfo *getInstrInfo() const { return &InstrInfo; } 56 virtual const MRegisterInfo *getRegisterInfo() const { 57 return &InstrInfo.getRegisterInfo(); 58 } 59 60 virtual TargetJITInfo *getJITInfo() { 61 return &JITInfo; 62 } 63 64 static unsigned getJITMatchQuality(); 65 66 static unsigned getModuleMatchQuality(const Module &M); 67 68 bool addPassesToEmitMachineCode(FunctionPassManager &PM, 69 MachineCodeEmitter &MCE); 70 }; 71 72 } // end namespace llvm 73 74 #endif 75