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