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 | // |
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 | 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 | |
Evan Cheng | c4c6257 | 2006-03-13 23:20:37 +0000 | [diff] [blame] | 17 | #include "X86.h" |
Bill Wendling | fcdea7b | 2007-01-27 02:56:16 +0000 | [diff] [blame] | 18 | #include "X86ELFWriterInfo.h" |
Chris Lattner | b4f68ed | 2002-10-29 22:37:54 +0000 | [diff] [blame] | 19 | #include "X86InstrInfo.h" |
Evan Cheng | c4c6257 | 2006-03-13 23:20:37 +0000 | [diff] [blame] | 20 | #include "X86ISelLowering.h" |
Anton Korobeynikov | 16c29b5 | 2011-01-10 12:39:04 +0000 | [diff] [blame] | 21 | #include "X86FrameLowering.h" |
Anton Korobeynikov | 3346491 | 2010-11-15 00:06:54 +0000 | [diff] [blame] | 22 | #include "X86JITInfo.h" |
Dan Gohman | ff7a562 | 2010-05-11 17:31:57 +0000 | [diff] [blame] | 23 | #include "X86SelectionDAGInfo.h" |
Anton Korobeynikov | 3346491 | 2010-11-15 00:06:54 +0000 | [diff] [blame] | 24 | #include "X86Subtarget.h" |
| 25 | #include "llvm/Target/TargetMachine.h" |
| 26 | #include "llvm/Target/TargetData.h" |
Anton Korobeynikov | 16c29b5 | 2011-01-10 12:39:04 +0000 | [diff] [blame] | 27 | #include "llvm/Target/TargetFrameLowering.h" |
Chris Lattner | b4f68ed | 2002-10-29 22:37:54 +0000 | [diff] [blame] | 28 | |
Brian Gaeke | d0fde30 | 2003-11-11 22:41:34 +0000 | [diff] [blame] | 29 | namespace llvm { |
Owen Anderson | cb37188 | 2008-08-21 00:14:44 +0000 | [diff] [blame] | 30 | |
David Greene | 7184781 | 2009-07-14 20:18:05 +0000 | [diff] [blame] | 31 | class formatted_raw_ostream; |
Evan Cheng | 4396613 | 2011-07-19 06:37:02 +0000 | [diff] [blame] | 32 | class StringRef; |
Brian Gaeke | d0fde30 | 2003-11-11 22:41:34 +0000 | [diff] [blame] | 33 | |
Chris Lattner | 1911fd4 | 2006-09-04 04:14:57 +0000 | [diff] [blame] | 34 | class X86TargetMachine : public LLVMTargetMachine { |
Evan Cheng | c4c6257 | 2006-03-13 23:20:37 +0000 | [diff] [blame] | 35 | X86Subtarget Subtarget; |
Anton Korobeynikov | 16c29b5 | 2011-01-10 12:39:04 +0000 | [diff] [blame] | 36 | X86FrameLowering FrameLowering; |
Bill Wendling | fcdea7b | 2007-01-27 02:56:16 +0000 | [diff] [blame] | 37 | X86ELFWriterInfo ELFWriterInfo; |
Jim Laskey | fde1b3b | 2006-09-07 23:39:26 +0000 | [diff] [blame] | 38 | |
Chris Lattner | b4f68ed | 2002-10-29 22:37:54 +0000 | [diff] [blame] | 39 | public: |
Evan Cheng | 4396613 | 2011-07-19 06:37:02 +0000 | [diff] [blame] | 40 | X86TargetMachine(const Target &T, StringRef TT, |
Nick Lewycky | 8a8d479 | 2011-12-02 22:16:29 +0000 | [diff] [blame^] | 41 | StringRef CPU, StringRef FS, const TargetOptions &Options, |
Evan Cheng | 34ad6db | 2011-07-20 07:51:56 +0000 | [diff] [blame] | 42 | Reloc::Model RM, CodeModel::Model CM, |
Evan Cheng | b95fc31 | 2011-11-16 08:38:26 +0000 | [diff] [blame] | 43 | CodeGenOpt::Level OL, |
Evan Cheng | 34ad6db | 2011-07-20 07:51:56 +0000 | [diff] [blame] | 44 | bool is64Bit); |
Chris Lattner | b4f68ed | 2002-10-29 22:37:54 +0000 | [diff] [blame] | 45 | |
Rafael Espindola | 0febc46 | 2010-10-03 18:59:45 +0000 | [diff] [blame] | 46 | virtual const X86InstrInfo *getInstrInfo() const { |
| 47 | llvm_unreachable("getInstrInfo not implemented"); |
| 48 | } |
Anton Korobeynikov | 16c29b5 | 2011-01-10 12:39:04 +0000 | [diff] [blame] | 49 | virtual const TargetFrameLowering *getFrameLowering() const { |
| 50 | return &FrameLowering; |
| 51 | } |
Rafael Espindola | 0febc46 | 2010-10-03 18:59:45 +0000 | [diff] [blame] | 52 | virtual X86JITInfo *getJITInfo() { |
| 53 | llvm_unreachable("getJITInfo not implemented"); |
| 54 | } |
Dan Gohman | c9f5f3f | 2008-05-14 01:58:56 +0000 | [diff] [blame] | 55 | virtual const X86Subtarget *getSubtargetImpl() const{ return &Subtarget; } |
Rafael Espindola | 0febc46 | 2010-10-03 18:59:45 +0000 | [diff] [blame] | 56 | virtual const X86TargetLowering *getTargetLowering() const { |
| 57 | llvm_unreachable("getTargetLowering not implemented"); |
Chris Lattner | 98d0d7d | 2006-05-12 21:14:20 +0000 | [diff] [blame] | 58 | } |
Dan Gohman | ff7a562 | 2010-05-11 17:31:57 +0000 | [diff] [blame] | 59 | virtual const X86SelectionDAGInfo *getSelectionDAGInfo() const { |
Rafael Espindola | 0febc46 | 2010-10-03 18:59:45 +0000 | [diff] [blame] | 60 | llvm_unreachable("getSelectionDAGInfo not implemented"); |
Dan Gohman | ff7a562 | 2010-05-11 17:31:57 +0000 | [diff] [blame] | 61 | } |
Dan Gohman | c9f5f3f | 2008-05-14 01:58:56 +0000 | [diff] [blame] | 62 | virtual const X86RegisterInfo *getRegisterInfo() const { |
Rafael Espindola | 0febc46 | 2010-10-03 18:59:45 +0000 | [diff] [blame] | 63 | return &getInstrInfo()->getRegisterInfo(); |
Chris Lattner | fde4b51 | 2002-12-28 20:33:52 +0000 | [diff] [blame] | 64 | } |
Bill Wendling | fcdea7b | 2007-01-27 02:56:16 +0000 | [diff] [blame] | 65 | virtual const X86ELFWriterInfo *getELFWriterInfo() const { |
Bill Wendling | eb1ac33 | 2007-02-08 01:39:44 +0000 | [diff] [blame] | 66 | return Subtarget.isTargetELF() ? &ELFWriterInfo : 0; |
Bill Wendling | fcdea7b | 2007-01-27 02:56:16 +0000 | [diff] [blame] | 67 | } |
Chris Lattner | fde4b51 | 2002-12-28 20:33:52 +0000 | [diff] [blame] | 68 | |
Chris Lattner | 1911fd4 | 2006-09-04 04:14:57 +0000 | [diff] [blame] | 69 | // Set up the pass pipeline. |
Evan Cheng | b95fc31 | 2011-11-16 08:38:26 +0000 | [diff] [blame] | 70 | virtual bool addInstSelector(PassManagerBase &PM); |
| 71 | virtual bool addPreRegAlloc(PassManagerBase &PM); |
| 72 | virtual bool addPostRegAlloc(PassManagerBase &PM); |
| 73 | virtual bool addPreEmitPass(PassManagerBase &PM); |
| 74 | virtual bool addCodeEmitter(PassManagerBase &PM, |
Daniel Dunbar | cfe9a60 | 2009-07-15 22:33:19 +0000 | [diff] [blame] | 75 | JITCodeEmitter &JCE); |
Chris Lattner | b4f68ed | 2002-10-29 22:37:54 +0000 | [diff] [blame] | 76 | }; |
Evan Cheng | 25ab690 | 2006-09-08 06:48:29 +0000 | [diff] [blame] | 77 | |
| 78 | /// X86_32TargetMachine - X86 32-bit target machine. |
| 79 | /// |
| 80 | class X86_32TargetMachine : public X86TargetMachine { |
Rafael Espindola | 0febc46 | 2010-10-03 18:59:45 +0000 | [diff] [blame] | 81 | const TargetData DataLayout; // Calculates type size & alignment |
| 82 | X86InstrInfo InstrInfo; |
| 83 | X86SelectionDAGInfo TSInfo; |
| 84 | X86TargetLowering TLInfo; |
| 85 | X86JITInfo JITInfo; |
Evan Cheng | 25ab690 | 2006-09-08 06:48:29 +0000 | [diff] [blame] | 86 | public: |
Evan Cheng | 4396613 | 2011-07-19 06:37:02 +0000 | [diff] [blame] | 87 | X86_32TargetMachine(const Target &T, StringRef TT, |
Nick Lewycky | 8a8d479 | 2011-12-02 22:16:29 +0000 | [diff] [blame^] | 88 | StringRef CPU, StringRef FS, const TargetOptions &Options, |
Evan Cheng | b95fc31 | 2011-11-16 08:38:26 +0000 | [diff] [blame] | 89 | Reloc::Model RM, CodeModel::Model CM, |
| 90 | CodeGenOpt::Level OL); |
Rafael Espindola | 0febc46 | 2010-10-03 18:59:45 +0000 | [diff] [blame] | 91 | virtual const TargetData *getTargetData() const { return &DataLayout; } |
| 92 | virtual const X86TargetLowering *getTargetLowering() const { |
| 93 | return &TLInfo; |
| 94 | } |
| 95 | virtual const X86SelectionDAGInfo *getSelectionDAGInfo() const { |
| 96 | return &TSInfo; |
| 97 | } |
| 98 | virtual const X86InstrInfo *getInstrInfo() const { |
| 99 | return &InstrInfo; |
| 100 | } |
| 101 | virtual X86JITInfo *getJITInfo() { |
| 102 | return &JITInfo; |
| 103 | } |
Evan Cheng | 25ab690 | 2006-09-08 06:48:29 +0000 | [diff] [blame] | 104 | }; |
| 105 | |
| 106 | /// X86_64TargetMachine - X86 64-bit target machine. |
| 107 | /// |
| 108 | class X86_64TargetMachine : public X86TargetMachine { |
Rafael Espindola | 0febc46 | 2010-10-03 18:59:45 +0000 | [diff] [blame] | 109 | const TargetData DataLayout; // Calculates type size & alignment |
| 110 | X86InstrInfo InstrInfo; |
| 111 | X86SelectionDAGInfo TSInfo; |
| 112 | X86TargetLowering TLInfo; |
| 113 | X86JITInfo JITInfo; |
Evan Cheng | 25ab690 | 2006-09-08 06:48:29 +0000 | [diff] [blame] | 114 | public: |
Evan Cheng | 4396613 | 2011-07-19 06:37:02 +0000 | [diff] [blame] | 115 | X86_64TargetMachine(const Target &T, StringRef TT, |
Nick Lewycky | 8a8d479 | 2011-12-02 22:16:29 +0000 | [diff] [blame^] | 116 | StringRef CPU, StringRef FS, const TargetOptions &Options, |
Evan Cheng | b95fc31 | 2011-11-16 08:38:26 +0000 | [diff] [blame] | 117 | Reloc::Model RM, CodeModel::Model CM, |
| 118 | CodeGenOpt::Level OL); |
Rafael Espindola | 0febc46 | 2010-10-03 18:59:45 +0000 | [diff] [blame] | 119 | virtual const TargetData *getTargetData() const { return &DataLayout; } |
| 120 | virtual const X86TargetLowering *getTargetLowering() const { |
| 121 | return &TLInfo; |
| 122 | } |
| 123 | virtual const X86SelectionDAGInfo *getSelectionDAGInfo() const { |
| 124 | return &TSInfo; |
| 125 | } |
| 126 | virtual const X86InstrInfo *getInstrInfo() const { |
| 127 | return &InstrInfo; |
| 128 | } |
| 129 | virtual X86JITInfo *getJITInfo() { |
| 130 | return &JITInfo; |
| 131 | } |
Evan Cheng | 25ab690 | 2006-09-08 06:48:29 +0000 | [diff] [blame] | 132 | }; |
| 133 | |
Brian Gaeke | d0fde30 | 2003-11-11 22:41:34 +0000 | [diff] [blame] | 134 | } // End llvm namespace |
| 135 | |
Chris Lattner | b4f68ed | 2002-10-29 22:37:54 +0000 | [diff] [blame] | 136 | #endif |