Chris Lattner | b4f68ed | 2002-10-29 22:37:54 +0000 | [diff] [blame] | 1 | //===-- X86TargetMachine.h - Define TargetMachine for the X86 ---*- C++ -*-===// |
| 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. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 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" |
Chris Lattner | 8bd66e6 | 2002-12-28 21:00:25 +0000 | [diff] [blame] | 18 | #include "llvm/Target/TargetFrameInfo.h" |
Brian Gaeke | 8844a0b | 2003-08-13 18:17:27 +0000 | [diff] [blame] | 19 | #include "llvm/PassManager.h" |
Chris Lattner | b4f68ed | 2002-10-29 22:37:54 +0000 | [diff] [blame] | 20 | #include "X86InstrInfo.h" |
Chris Lattner | 1e60a91 | 2003-12-20 01:22:19 +0000 | [diff] [blame] | 21 | #include "X86JITInfo.h" |
Chris Lattner | b4f68ed | 2002-10-29 22:37:54 +0000 | [diff] [blame] | 22 | |
Brian Gaeke | d0fde30 | 2003-11-11 22:41:34 +0000 | [diff] [blame] | 23 | namespace llvm { |
Chris Lattner | 4482715 | 2003-12-28 09:47:19 +0000 | [diff] [blame] | 24 | class IntrinsicLowering; |
Brian Gaeke | d0fde30 | 2003-11-11 22:41:34 +0000 | [diff] [blame] | 25 | |
Chris Lattner | b4f68ed | 2002-10-29 22:37:54 +0000 | [diff] [blame] | 26 | class X86TargetMachine : public TargetMachine { |
Chris Lattner | 1e60a91 | 2003-12-20 01:22:19 +0000 | [diff] [blame] | 27 | X86InstrInfo InstrInfo; |
Chris Lattner | fde4b51 | 2002-12-28 20:33:52 +0000 | [diff] [blame] | 28 | TargetFrameInfo FrameInfo; |
Chris Lattner | 1e60a91 | 2003-12-20 01:22:19 +0000 | [diff] [blame] | 29 | X86JITInfo JITInfo; |
Chris Lattner | b4f68ed | 2002-10-29 22:37:54 +0000 | [diff] [blame] | 30 | public: |
Chris Lattner | 4482715 | 2003-12-28 09:47:19 +0000 | [diff] [blame] | 31 | X86TargetMachine(const Module &M, IntrinsicLowering *IL); |
Chris Lattner | b4f68ed | 2002-10-29 22:37:54 +0000 | [diff] [blame] | 32 | |
Chris Lattner | d029cd2 | 2004-06-02 05:55:25 +0000 | [diff] [blame^] | 33 | virtual const X86InstrInfo *getInstrInfo() const { return &InstrInfo; } |
| 34 | virtual const TargetFrameInfo *getFrameInfo() const { return &FrameInfo; } |
Brian Gaeke | 05b15fb | 2004-03-01 06:43:29 +0000 | [diff] [blame] | 35 | virtual TargetJITInfo *getJITInfo() { return &JITInfo; } |
| 36 | virtual const MRegisterInfo *getRegisterInfo() const { |
Chris Lattner | fde4b51 | 2002-12-28 20:33:52 +0000 | [diff] [blame] | 37 | return &InstrInfo.getRegisterInfo(); |
| 38 | } |
| 39 | |
Chris Lattner | 40ead95 | 2002-12-02 21:24:12 +0000 | [diff] [blame] | 40 | /// addPassesToEmitMachineCode - Add passes to the specified pass manager to |
Brian Gaeke | 8844a0b | 2003-08-13 18:17:27 +0000 | [diff] [blame] | 41 | /// get machine code emitted. This uses a MachineCodeEmitter object to handle |
Chris Lattner | 40ead95 | 2002-12-02 21:24:12 +0000 | [diff] [blame] | 42 | /// actually outputting the machine code and resolving things like the address |
| 43 | /// of functions. This method should returns true if machine code emission is |
| 44 | /// not supported. |
| 45 | /// |
Brian Gaeke | 8844a0b | 2003-08-13 18:17:27 +0000 | [diff] [blame] | 46 | virtual bool addPassesToEmitMachineCode(FunctionPassManager &PM, |
Chris Lattner | 40ead95 | 2002-12-02 21:24:12 +0000 | [diff] [blame] | 47 | MachineCodeEmitter &MCE); |
Brian Gaeke | de3aa4f | 2003-06-18 21:43:21 +0000 | [diff] [blame] | 48 | |
| 49 | virtual bool addPassesToEmitAssembly(PassManager &PM, std::ostream &Out); |
Chris Lattner | b4f68ed | 2002-10-29 22:37:54 +0000 | [diff] [blame] | 50 | }; |
| 51 | |
Alkis Evlogimenos | 39c2005 | 2004-03-09 03:34:53 +0000 | [diff] [blame] | 52 | // this is implemented in X86CodeEmitter.cpp |
| 53 | namespace X86 { |
| 54 | void emitInstruction(MachineCodeEmitter& mce, |
| 55 | const X86InstrInfo& ii, |
| 56 | const MachineInstr& MI); |
| 57 | } |
| 58 | |
Brian Gaeke | d0fde30 | 2003-11-11 22:41:34 +0000 | [diff] [blame] | 59 | } // End llvm namespace |
| 60 | |
Chris Lattner | b4f68ed | 2002-10-29 22:37:54 +0000 | [diff] [blame] | 61 | #endif |