LLVM API Documentation

X86TargetMachine.h

Go to the documentation of this file.
00001 //===-- X86TargetMachine.h - Define TargetMachine for the X86 ---*- C++ -*-===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file was developed by the LLVM research group and is distributed under
00006 // the University of Illinois Open Source License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 //
00010 // This file declares the X86 specific subclass of TargetMachine.
00011 //
00012 //===----------------------------------------------------------------------===//
00013 
00014 #ifndef X86TARGETMACHINE_H
00015 #define X86TARGETMACHINE_H
00016 
00017 #include "llvm/Target/TargetMachine.h"
00018 #include "llvm/Target/TargetData.h"
00019 #include "llvm/Target/TargetFrameInfo.h"
00020 #include "llvm/PassManager.h"
00021 #include "X86.h"
00022 #include "X86InstrInfo.h"
00023 #include "X86JITInfo.h"
00024 #include "X86Subtarget.h"
00025 #include "X86ISelLowering.h"
00026 
00027 namespace llvm {
00028 
00029 class X86TargetMachine : public TargetMachine {
00030   X86Subtarget      Subtarget;
00031   const TargetData DataLayout;       // Calculates type size & alignment
00032   TargetFrameInfo   FrameInfo;
00033   X86InstrInfo      InstrInfo;
00034   X86JITInfo        JITInfo;
00035   X86TargetLowering TLInfo;
00036 public:
00037   X86TargetMachine(const Module &M, const std::string &FS);
00038 
00039   virtual const X86InstrInfo     *getInstrInfo() const { return &InstrInfo; }
00040   virtual const TargetFrameInfo  *getFrameInfo() const { return &FrameInfo; }
00041   virtual       TargetJITInfo    *getJITInfo()         { return &JITInfo; }
00042   virtual const TargetSubtarget  *getSubtargetImpl() const{ return &Subtarget; }
00043   virtual       X86TargetLowering *getTargetLowering() const { 
00044     return const_cast<X86TargetLowering*>(&TLInfo); 
00045   }
00046   virtual const MRegisterInfo    *getRegisterInfo() const {
00047     return &InstrInfo.getRegisterInfo();
00048   }
00049   virtual const TargetData       *getTargetData() const { return &DataLayout; }
00050 
00051   virtual bool addPassesToEmitMachineCode(FunctionPassManager &PM,
00052                                           MachineCodeEmitter &MCE);
00053 
00054   virtual bool addPassesToEmitFile(PassManager &PM, std::ostream &Out,
00055                                    CodeGenFileType FileType, bool Fast);
00056 
00057   static unsigned getModuleMatchQuality(const Module &M);
00058   static unsigned getJITMatchQuality();
00059 };
00060 } // End llvm namespace
00061 
00062 #endif