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