Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1 | //===-- PPCTargetMachine.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 PPC_TARGETMACHINE_H |
| 15 | #define PPC_TARGETMACHINE_H |
| 16 | |
| 17 | #include "PPCFrameInfo.h" |
| 18 | #include "PPCSubtarget.h" |
| 19 | #include "PPCJITInfo.h" |
| 20 | #include "PPCInstrInfo.h" |
| 21 | #include "PPCISelLowering.h" |
| 22 | #include "PPCMachOWriterInfo.h" |
| 23 | #include "llvm/Target/TargetMachine.h" |
| 24 | #include "llvm/Target/TargetData.h" |
| 25 | |
| 26 | namespace llvm { |
| 27 | class PassManager; |
| 28 | class GlobalValue; |
| 29 | |
| 30 | /// PPCTargetMachine - Common code between 32-bit and 64-bit PowerPC targets. |
| 31 | /// |
| 32 | class PPCTargetMachine : public LLVMTargetMachine { |
| 33 | PPCSubtarget Subtarget; |
| 34 | const TargetData DataLayout; // Calculates type size & alignment |
| 35 | PPCInstrInfo InstrInfo; |
| 36 | PPCFrameInfo FrameInfo; |
| 37 | PPCJITInfo JITInfo; |
| 38 | PPCTargetLowering TLInfo; |
| 39 | InstrItineraryData InstrItins; |
| 40 | PPCMachOWriterInfo MachOWriterInfo; |
| 41 | |
| 42 | protected: |
| 43 | virtual const TargetAsmInfo *createTargetAsmInfo() const; |
| 44 | |
| 45 | public: |
| 46 | PPCTargetMachine(const Module &M, const std::string &FS, bool is64Bit); |
| 47 | |
| 48 | virtual const PPCInstrInfo *getInstrInfo() const { return &InstrInfo; } |
| 49 | virtual const TargetFrameInfo *getFrameInfo() const { return &FrameInfo; } |
| 50 | virtual TargetJITInfo *getJITInfo() { return &JITInfo; } |
| 51 | virtual PPCTargetLowering *getTargetLowering() const { |
| 52 | return const_cast<PPCTargetLowering*>(&TLInfo); |
| 53 | } |
| 54 | virtual const MRegisterInfo *getRegisterInfo() const { |
| 55 | return &InstrInfo.getRegisterInfo(); |
| 56 | } |
| 57 | |
| 58 | virtual const TargetData *getTargetData() const { return &DataLayout; } |
| 59 | virtual const PPCSubtarget *getSubtargetImpl() const { return &Subtarget; } |
| 60 | virtual const InstrItineraryData getInstrItineraryData() const { |
| 61 | return InstrItins; |
| 62 | } |
| 63 | virtual const PPCMachOWriterInfo *getMachOWriterInfo() const { |
| 64 | return &MachOWriterInfo; |
| 65 | } |
| 66 | |
| 67 | // Pass Pipeline Configuration |
| 68 | virtual bool addInstSelector(FunctionPassManager &PM, bool Fast); |
| 69 | virtual bool addPreEmitPass(FunctionPassManager &PM, bool Fast); |
| 70 | virtual bool addAssemblyEmitter(FunctionPassManager &PM, bool Fast, |
| 71 | std::ostream &Out); |
| 72 | virtual bool addCodeEmitter(FunctionPassManager &PM, bool Fast, |
Evan Cheng | 7754721 | 2007-07-20 21:56:13 +0000 | [diff] [blame] | 73 | bool DumpAsm, MachineCodeEmitter &MCE); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 74 | virtual bool addSimpleCodeEmitter(FunctionPassManager &PM, bool Fast, |
Evan Cheng | 7754721 | 2007-07-20 21:56:13 +0000 | [diff] [blame] | 75 | bool DumpAsm, MachineCodeEmitter &MCE); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 76 | virtual const bool getEnableTailMergeDefault() const; |
| 77 | }; |
| 78 | |
| 79 | /// PPC32TargetMachine - PowerPC 32-bit target machine. |
| 80 | /// |
| 81 | class PPC32TargetMachine : public PPCTargetMachine { |
| 82 | public: |
| 83 | PPC32TargetMachine(const Module &M, const std::string &FS); |
| 84 | |
| 85 | static unsigned getJITMatchQuality(); |
| 86 | static unsigned getModuleMatchQuality(const Module &M); |
| 87 | }; |
| 88 | |
| 89 | /// PPC64TargetMachine - PowerPC 64-bit target machine. |
| 90 | /// |
| 91 | class PPC64TargetMachine : public PPCTargetMachine { |
| 92 | public: |
| 93 | PPC64TargetMachine(const Module &M, const std::string &FS); |
| 94 | |
| 95 | static unsigned getJITMatchQuality(); |
| 96 | static unsigned getModuleMatchQuality(const Module &M); |
| 97 | }; |
| 98 | |
| 99 | } // end namespace llvm |
| 100 | |
| 101 | #endif |