Nate Begeman | 21e463b | 2005-10-16 05:39:50 +0000 | [diff] [blame] | 1 | //===-- PPCTargetMachine.h - Define TargetMachine for PowerPC -----*- C++ -*-=// |
Misha Brukman | b5f662f | 2005-04-21 23:30:14 +0000 | [diff] [blame] | 2 | // |
Misha Brukman | 3d9a6c2 | 2004-08-11 00:09:42 +0000 | [diff] [blame] | 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
Chris Lattner | 4ee451d | 2007-12-29 20:36:04 +0000 | [diff] [blame] | 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
Misha Brukman | b5f662f | 2005-04-21 23:30:14 +0000 | [diff] [blame] | 7 | // |
Misha Brukman | 3d9a6c2 | 2004-08-11 00:09:42 +0000 | [diff] [blame] | 8 | //===----------------------------------------------------------------------===// |
Misha Brukman | b5f662f | 2005-04-21 23:30:14 +0000 | [diff] [blame] | 9 | // |
Misha Brukman | f2ccb77 | 2004-08-17 04:55:41 +0000 | [diff] [blame] | 10 | // This file declares the PowerPC specific subclass of TargetMachine. |
Misha Brukman | 3d9a6c2 | 2004-08-11 00:09:42 +0000 | [diff] [blame] | 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
Nate Begeman | 21e463b | 2005-10-16 05:39:50 +0000 | [diff] [blame] | 14 | #ifndef PPC_TARGETMACHINE_H |
| 15 | #define PPC_TARGETMACHINE_H |
Misha Brukman | 3d9a6c2 | 2004-08-11 00:09:42 +0000 | [diff] [blame] | 16 | |
Chris Lattner | 2668959 | 2005-10-14 23:51:18 +0000 | [diff] [blame] | 17 | #include "PPCFrameInfo.h" |
| 18 | #include "PPCSubtarget.h" |
Chris Lattner | b9459b7 | 2005-10-14 23:53:41 +0000 | [diff] [blame] | 19 | #include "PPCJITInfo.h" |
Chris Lattner | 16e71f2 | 2005-10-14 23:59:06 +0000 | [diff] [blame] | 20 | #include "PPCInstrInfo.h" |
Evan Cheng | c4c6257 | 2006-03-13 23:20:37 +0000 | [diff] [blame] | 21 | #include "PPCISelLowering.h" |
Bill Wendling | 0ea18ff | 2007-01-24 03:41:36 +0000 | [diff] [blame] | 22 | #include "PPCMachOWriterInfo.h" |
Chris Lattner | ec4b73c | 2005-10-14 23:44:05 +0000 | [diff] [blame] | 23 | #include "llvm/Target/TargetMachine.h" |
Owen Anderson | 07000c6 | 2006-05-12 06:33:49 +0000 | [diff] [blame] | 24 | #include "llvm/Target/TargetData.h" |
Misha Brukman | 3d9a6c2 | 2004-08-11 00:09:42 +0000 | [diff] [blame] | 25 | |
| 26 | namespace llvm { |
Chris Lattner | de12382 | 2005-10-15 21:58:54 +0000 | [diff] [blame] | 27 | class PassManager; |
Chris Lattner | ec4b73c | 2005-10-14 23:44:05 +0000 | [diff] [blame] | 28 | class GlobalValue; |
Misha Brukman | 3d9a6c2 | 2004-08-11 00:09:42 +0000 | [diff] [blame] | 29 | |
Chris Lattner | 94de9a8 | 2006-06-16 01:37:27 +0000 | [diff] [blame] | 30 | /// PPCTargetMachine - Common code between 32-bit and 64-bit PowerPC targets. |
| 31 | /// |
Chris Lattner | 1911fd4 | 2006-09-04 04:14:57 +0000 | [diff] [blame] | 32 | class PPCTargetMachine : public LLVMTargetMachine { |
Chris Lattner | 94de9a8 | 2006-06-16 01:37:27 +0000 | [diff] [blame] | 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; |
Bill Wendling | 0ea18ff | 2007-01-24 03:41:36 +0000 | [diff] [blame] | 40 | PPCMachOWriterInfo MachOWriterInfo; |
| 41 | |
Jim Laskey | fde1b3b | 2006-09-07 23:39:26 +0000 | [diff] [blame] | 42 | protected: |
| 43 | virtual const TargetAsmInfo *createTargetAsmInfo() const; |
| 44 | |
Chris Lattner | ec4b73c | 2005-10-14 23:44:05 +0000 | [diff] [blame] | 45 | public: |
Chris Lattner | 94de9a8 | 2006-06-16 01:37:27 +0000 | [diff] [blame] | 46 | PPCTargetMachine(const Module &M, const std::string &FS, bool is64Bit); |
Nate Begeman | 21e463b | 2005-10-16 05:39:50 +0000 | [diff] [blame] | 47 | |
| 48 | virtual const PPCInstrInfo *getInstrInfo() const { return &InstrInfo; } |
Chris Lattner | ec4b73c | 2005-10-14 23:44:05 +0000 | [diff] [blame] | 49 | virtual const TargetFrameInfo *getFrameInfo() const { return &FrameInfo; } |
Nate Begeman | 21e463b | 2005-10-16 05:39:50 +0000 | [diff] [blame] | 50 | virtual TargetJITInfo *getJITInfo() { return &JITInfo; } |
Chris Lattner | b65e725 | 2006-05-12 21:09:57 +0000 | [diff] [blame] | 51 | virtual PPCTargetLowering *getTargetLowering() const { |
| 52 | return const_cast<PPCTargetLowering*>(&TLInfo); |
| 53 | } |
Dan Gohman | 6f0d024 | 2008-02-10 18:45:23 +0000 | [diff] [blame] | 54 | virtual const TargetRegisterInfo *getRegisterInfo() const { |
Misha Brukman | f2ccb77 | 2004-08-17 04:55:41 +0000 | [diff] [blame] | 55 | return &InstrInfo.getRegisterInfo(); |
| 56 | } |
Chris Lattner | 94de9a8 | 2006-06-16 01:37:27 +0000 | [diff] [blame] | 57 | |
| 58 | virtual const TargetData *getTargetData() const { return &DataLayout; } |
| 59 | virtual const PPCSubtarget *getSubtargetImpl() const { return &Subtarget; } |
Jim Laskey | 6cee630 | 2005-11-01 20:06:59 +0000 | [diff] [blame] | 60 | virtual const InstrItineraryData getInstrItineraryData() const { |
| 61 | return InstrItins; |
| 62 | } |
Bill Wendling | 0ea18ff | 2007-01-24 03:41:36 +0000 | [diff] [blame] | 63 | virtual const PPCMachOWriterInfo *getMachOWriterInfo() const { |
| 64 | return &MachOWriterInfo; |
| 65 | } |
Jim Laskey | 6cee630 | 2005-11-01 20:06:59 +0000 | [diff] [blame] | 66 | |
Chris Lattner | 1911fd4 | 2006-09-04 04:14:57 +0000 | [diff] [blame] | 67 | // Pass Pipeline Configuration |
Dan Gohman | bfae831 | 2008-03-11 22:29:46 +0000 | [diff] [blame^] | 68 | virtual bool addInstSelector(PassManagerBase &PM, bool Fast); |
| 69 | virtual bool addPreEmitPass(PassManagerBase &PM, bool Fast); |
| 70 | virtual bool addAssemblyEmitter(PassManagerBase &PM, bool Fast, |
Chris Lattner | 1911fd4 | 2006-09-04 04:14:57 +0000 | [diff] [blame] | 71 | std::ostream &Out); |
Dan Gohman | bfae831 | 2008-03-11 22:29:46 +0000 | [diff] [blame^] | 72 | virtual bool addCodeEmitter(PassManagerBase &PM, bool Fast, |
Evan Cheng | 8bd6035 | 2007-07-20 21:56:13 +0000 | [diff] [blame] | 73 | bool DumpAsm, MachineCodeEmitter &MCE); |
Dan Gohman | bfae831 | 2008-03-11 22:29:46 +0000 | [diff] [blame^] | 74 | virtual bool addSimpleCodeEmitter(PassManagerBase &PM, bool Fast, |
Evan Cheng | 8bd6035 | 2007-07-20 21:56:13 +0000 | [diff] [blame] | 75 | bool DumpAsm, MachineCodeEmitter &MCE); |
Dan Gohman | 50cdabc | 2007-11-19 20:46:23 +0000 | [diff] [blame] | 76 | virtual bool getEnableTailMergeDefault() const; |
Misha Brukman | 3d9a6c2 | 2004-08-11 00:09:42 +0000 | [diff] [blame] | 77 | }; |
Chris Lattner | 94de9a8 | 2006-06-16 01:37:27 +0000 | [diff] [blame] | 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); |
Nate Begeman | 21e463b | 2005-10-16 05:39:50 +0000 | [diff] [blame] | 84 | |
Chris Lattner | 94de9a8 | 2006-06-16 01:37:27 +0000 | [diff] [blame] | 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 | |
Misha Brukman | 3d9a6c2 | 2004-08-11 00:09:42 +0000 | [diff] [blame] | 99 | } // end namespace llvm |
| 100 | |
| 101 | #endif |