1 //===-- X86TargetMachine.h - Define TargetMachine for the X86 ---*- C++ -*-===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 // 10 // This file declares the X86 specific subclass of TargetMachine. 11 // 12 //===----------------------------------------------------------------------===// 13 14 #ifndef X86TARGETMACHINE_H 15 #define X86TARGETMACHINE_H 16 17 #include "X86.h" 18 #include "X86FrameLowering.h" 19 #include "X86ISelLowering.h" 20 #include "X86InstrInfo.h" 21 #include "X86JITInfo.h" 22 #include "X86SelectionDAGInfo.h" 23 #include "X86Subtarget.h" 24 #include "llvm/IR/DataLayout.h" 25 #include "llvm/Target/TargetFrameLowering.h" 26 #include "llvm/Target/TargetMachine.h" 27 28 namespace llvm { 29 30 class StringRef; 31 32 class X86TargetMachine : public LLVMTargetMachine { 33 virtual void anchor(); 34 X86Subtarget Subtarget; 35 X86FrameLowering FrameLowering; 36 InstrItineraryData InstrItins; 37 const DataLayout DL; // Calculates type size & alignment 38 X86InstrInfo InstrInfo; 39 X86TargetLowering TLInfo; 40 X86SelectionDAGInfo TSInfo; 41 X86JITInfo JITInfo; 42 43 public: 44 X86TargetMachine(const Target &T, StringRef TT, 45 StringRef CPU, StringRef FS, const TargetOptions &Options, 46 Reloc::Model RM, CodeModel::Model CM, 47 CodeGenOpt::Level OL); 48 49 virtual const DataLayout *getDataLayout() const { return &DL; } 50 virtual const X86InstrInfo *getInstrInfo() const { 51 return &InstrInfo; 52 } 53 virtual const TargetFrameLowering *getFrameLowering() const { 54 return &FrameLowering; 55 } 56 virtual X86JITInfo *getJITInfo() { 57 return &JITInfo; 58 } 59 virtual const X86Subtarget *getSubtargetImpl() const{ return &Subtarget; } 60 virtual const X86TargetLowering *getTargetLowering() const { 61 return &TLInfo; 62 } 63 virtual const X86SelectionDAGInfo *getSelectionDAGInfo() const { 64 return &TSInfo; 65 } 66 virtual const X86RegisterInfo *getRegisterInfo() const { 67 return &getInstrInfo()->getRegisterInfo(); 68 } 69 virtual const InstrItineraryData *getInstrItineraryData() const { 70 return &InstrItins; 71 } 72 73 /// \brief Register X86 analysis passes with a pass manager. 74 virtual void addAnalysisPasses(PassManagerBase &PM); 75 76 // Set up the pass pipeline. 77 virtual TargetPassConfig *createPassConfig(PassManagerBase &PM); 78 79 virtual bool addCodeEmitter(PassManagerBase &PM, 80 JITCodeEmitter &JCE); 81 }; 82 83 } // End llvm namespace 84 85 #endif 86