• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #include "X86InstrInfo.h"
17 #include "X86Subtarget.h"
18 #include "llvm/IR/DataLayout.h"
19 #include "llvm/Target/TargetMachine.h"
20 
21 namespace llvm {
22 
23 class StringRef;
24 
25 class X86TargetMachine final : public LLVMTargetMachine {
26   virtual void anchor();
27   X86Subtarget       Subtarget;
28 
29 public:
30   X86TargetMachine(const Target &T, StringRef TT,
31                    StringRef CPU, StringRef FS, const TargetOptions &Options,
32                    Reloc::Model RM, CodeModel::Model CM,
33                    CodeGenOpt::Level OL);
34 
getDataLayout()35   const DataLayout *getDataLayout() const override {
36     return getSubtargetImpl()->getDataLayout();
37   }
getInstrInfo()38   const X86InstrInfo *getInstrInfo() const override {
39     return getSubtargetImpl()->getInstrInfo();
40   }
getFrameLowering()41   const TargetFrameLowering *getFrameLowering() const override {
42     return getSubtargetImpl()->getFrameLowering();
43   }
getJITInfo()44   X86JITInfo *getJITInfo() override { return Subtarget.getJITInfo(); }
getSubtargetImpl()45   const X86Subtarget *getSubtargetImpl() const override { return &Subtarget; }
getTargetLowering()46   const X86TargetLowering *getTargetLowering() const override {
47     return getSubtargetImpl()->getTargetLowering();
48   }
getSelectionDAGInfo()49   const X86SelectionDAGInfo *getSelectionDAGInfo() const override {
50     return getSubtargetImpl()->getSelectionDAGInfo();
51   }
getRegisterInfo()52   const X86RegisterInfo  *getRegisterInfo() const override {
53     return &getInstrInfo()->getRegisterInfo();
54   }
getInstrItineraryData()55   const InstrItineraryData *getInstrItineraryData() const override {
56     return &getSubtargetImpl()->getInstrItineraryData();
57   }
58 
59   /// \brief Register X86 analysis passes with a pass manager.
60   void addAnalysisPasses(PassManagerBase &PM) override;
61 
62   // Set up the pass pipeline.
63   TargetPassConfig *createPassConfig(PassManagerBase &PM) override;
64 
65   bool addCodeEmitter(PassManagerBase &PM, JITCodeEmitter &JCE) override;
66 };
67 
68 } // End llvm namespace
69 
70 #endif
71