Chris Lattner | b4f68ed | 2002-10-29 22:37:54 +0000 | [diff] [blame] | 1 | //===-- X86TargetMachine.h - Define TargetMachine for the X86 ---*- C++ -*-===// |
Misha Brukman | 0e0a7a45 | 2005-04-21 23:38:14 +0000 | [diff] [blame] | 2 | // |
John Criswell | 856ba76 | 2003-10-21 15:17:13 +0000 | [diff] [blame] | 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. |
Misha Brukman | 0e0a7a45 | 2005-04-21 23:38:14 +0000 | [diff] [blame] | 7 | // |
John Criswell | 856ba76 | 2003-10-21 15:17:13 +0000 | [diff] [blame] | 8 | //===----------------------------------------------------------------------===// |
Misha Brukman | 0e0a7a45 | 2005-04-21 23:38:14 +0000 | [diff] [blame] | 9 | // |
Chris Lattner | b4f68ed | 2002-10-29 22:37:54 +0000 | [diff] [blame] | 10 | // This file declares the X86 specific subclass of TargetMachine. |
| 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
| 14 | #ifndef X86TARGETMACHINE_H |
| 15 | #define X86TARGETMACHINE_H |
| 16 | |
| 17 | #include "llvm/Target/TargetMachine.h" |
Owen Anderson | 07000c6 | 2006-05-12 06:33:49 +0000 | [diff] [blame] | 18 | #include "llvm/Target/TargetData.h" |
Chris Lattner | 8bd66e6 | 2002-12-28 21:00:25 +0000 | [diff] [blame] | 19 | #include "llvm/Target/TargetFrameInfo.h" |
Evan Cheng | c4c6257 | 2006-03-13 23:20:37 +0000 | [diff] [blame] | 20 | #include "X86.h" |
Chris Lattner | b4f68ed | 2002-10-29 22:37:54 +0000 | [diff] [blame] | 21 | #include "X86InstrInfo.h" |
Chris Lattner | 1e60a91 | 2003-12-20 01:22:19 +0000 | [diff] [blame] | 22 | #include "X86JITInfo.h" |
Nate Begeman | fb5792f | 2005-07-12 01:41:54 +0000 | [diff] [blame] | 23 | #include "X86Subtarget.h" |
Evan Cheng | c4c6257 | 2006-03-13 23:20:37 +0000 | [diff] [blame] | 24 | #include "X86ISelLowering.h" |
Chris Lattner | b4f68ed | 2002-10-29 22:37:54 +0000 | [diff] [blame] | 25 | |
Brian Gaeke | d0fde30 | 2003-11-11 22:41:34 +0000 | [diff] [blame] | 26 | namespace llvm { |
| 27 | |
Chris Lattner | 1911fd4 | 2006-09-04 04:14:57 +0000 | [diff] [blame] | 28 | class X86TargetMachine : public LLVMTargetMachine { |
Evan Cheng | c4c6257 | 2006-03-13 23:20:37 +0000 | [diff] [blame] | 29 | X86Subtarget Subtarget; |
Evan Cheng | aa3c141 | 2006-05-30 21:45:53 +0000 | [diff] [blame] | 30 | const TargetData DataLayout; // Calculates type size & alignment |
Evan Cheng | c4c6257 | 2006-03-13 23:20:37 +0000 | [diff] [blame] | 31 | TargetFrameInfo FrameInfo; |
Evan Cheng | aa3c141 | 2006-05-30 21:45:53 +0000 | [diff] [blame] | 32 | X86InstrInfo InstrInfo; |
Evan Cheng | c4c6257 | 2006-03-13 23:20:37 +0000 | [diff] [blame] | 33 | X86JITInfo JITInfo; |
| 34 | X86TargetLowering TLInfo; |
Jim Laskey | fde1b3b | 2006-09-07 23:39:26 +0000 | [diff] [blame^] | 35 | |
| 36 | protected: |
| 37 | virtual const TargetAsmInfo *createTargetAsmInfo() const; |
| 38 | |
Chris Lattner | b4f68ed | 2002-10-29 22:37:54 +0000 | [diff] [blame] | 39 | public: |
Chris Lattner | bc641b9 | 2006-03-23 05:43:16 +0000 | [diff] [blame] | 40 | X86TargetMachine(const Module &M, const std::string &FS); |
Chris Lattner | b4f68ed | 2002-10-29 22:37:54 +0000 | [diff] [blame] | 41 | |
Chris Lattner | d029cd2 | 2004-06-02 05:55:25 +0000 | [diff] [blame] | 42 | virtual const X86InstrInfo *getInstrInfo() const { return &InstrInfo; } |
| 43 | virtual const TargetFrameInfo *getFrameInfo() const { return &FrameInfo; } |
Brian Gaeke | 05b15fb | 2004-03-01 06:43:29 +0000 | [diff] [blame] | 44 | virtual TargetJITInfo *getJITInfo() { return &JITInfo; } |
Nate Begeman | fb5792f | 2005-07-12 01:41:54 +0000 | [diff] [blame] | 45 | virtual const TargetSubtarget *getSubtargetImpl() const{ return &Subtarget; } |
Chris Lattner | 98d0d7d | 2006-05-12 21:14:20 +0000 | [diff] [blame] | 46 | virtual X86TargetLowering *getTargetLowering() const { |
| 47 | return const_cast<X86TargetLowering*>(&TLInfo); |
| 48 | } |
Brian Gaeke | 05b15fb | 2004-03-01 06:43:29 +0000 | [diff] [blame] | 49 | virtual const MRegisterInfo *getRegisterInfo() const { |
Chris Lattner | fde4b51 | 2002-12-28 20:33:52 +0000 | [diff] [blame] | 50 | return &InstrInfo.getRegisterInfo(); |
| 51 | } |
Owen Anderson | a69571c | 2006-05-03 01:29:57 +0000 | [diff] [blame] | 52 | virtual const TargetData *getTargetData() const { return &DataLayout; } |
Chris Lattner | fde4b51 | 2002-12-28 20:33:52 +0000 | [diff] [blame] | 53 | |
Chris Lattner | d36c970 | 2004-07-11 02:48:49 +0000 | [diff] [blame] | 54 | static unsigned getModuleMatchQuality(const Module &M); |
| 55 | static unsigned getJITMatchQuality(); |
Chris Lattner | 1911fd4 | 2006-09-04 04:14:57 +0000 | [diff] [blame] | 56 | |
Chris Lattner | 1911fd4 | 2006-09-04 04:14:57 +0000 | [diff] [blame] | 57 | // Set up the pass pipeline. |
| 58 | virtual bool addInstSelector(FunctionPassManager &PM, bool Fast); |
| 59 | virtual bool addPostRegAlloc(FunctionPassManager &PM, bool Fast); |
| 60 | virtual bool addAssemblyEmitter(FunctionPassManager &PM, bool Fast, |
| 61 | std::ostream &Out); |
| 62 | virtual bool addObjectWriter(FunctionPassManager &PM, bool Fast, |
| 63 | std::ostream &Out); |
| 64 | virtual bool addCodeEmitter(FunctionPassManager &PM, bool Fast, |
| 65 | MachineCodeEmitter &MCE); |
Chris Lattner | b4f68ed | 2002-10-29 22:37:54 +0000 | [diff] [blame] | 66 | }; |
Brian Gaeke | d0fde30 | 2003-11-11 22:41:34 +0000 | [diff] [blame] | 67 | } // End llvm namespace |
| 68 | |
Chris Lattner | b4f68ed | 2002-10-29 22:37:54 +0000 | [diff] [blame] | 69 | #endif |