PPCTargetMachine.h revision de123822e5cc9a7d09b12166439cfd35a6c9ed62
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 23namespace llvm { 24class PassManager; 25class IntrinsicLowering; 26class GlobalValue; 27class IntrinsicLowering; 28 29// FIXME: Merge into only subclass. 30class PowerPCTargetMachine : public TargetMachine { 31 PowerPCFrameInfo FrameInfo; 32 PPCSubtarget Subtarget; 33protected: 34 PowerPCTargetMachine(const std::string &name, IntrinsicLowering *IL, 35 const Module &M, const std::string &FS, 36 const TargetData &TD, 37 const PowerPCFrameInfo &TFI); 38public: 39 virtual const TargetFrameInfo *getFrameInfo() const { return &FrameInfo; } 40 virtual const TargetSubtarget *getSubtargetImpl() const{ return &Subtarget; } 41 42 virtual bool addPassesToEmitFile(PassManager &PM, std::ostream &Out, 43 CodeGenFileType FileType); 44}; 45 46class PPC32TargetMachine : public PowerPCTargetMachine { 47 PPC32InstrInfo InstrInfo; 48 PPC32JITInfo JITInfo; 49 50public: 51 PPC32TargetMachine(const Module &M, IntrinsicLowering *IL, 52 const std::string &FS); 53 virtual const PPC32InstrInfo *getInstrInfo() const { return &InstrInfo; } 54 virtual const MRegisterInfo *getRegisterInfo() const { 55 return &InstrInfo.getRegisterInfo(); 56 } 57 58 virtual TargetJITInfo *getJITInfo() { 59 return &JITInfo; 60 } 61 62 static unsigned getJITMatchQuality(); 63 64 static unsigned getModuleMatchQuality(const Module &M); 65 66 bool addPassesToEmitMachineCode(FunctionPassManager &PM, 67 MachineCodeEmitter &MCE); 68}; 69 70} // end namespace llvm 71 72#endif 73