LLVM API Documentation
00001 //===-- XCoreTargetMachine.h - Define TargetMachine for XCore ---*- C++ -*-===// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file is distributed under the University of Illinois Open Source 00006 // License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 // 00010 // This file declares the XCore specific subclass of TargetMachine. 00011 // 00012 //===----------------------------------------------------------------------===// 00013 00014 #ifndef XCORETARGETMACHINE_H 00015 #define XCORETARGETMACHINE_H 00016 00017 #include "llvm/Target/TargetMachine.h" 00018 #include "llvm/Target/TargetData.h" 00019 #include "XCoreFrameInfo.h" 00020 #include "XCoreSubtarget.h" 00021 #include "XCoreInstrInfo.h" 00022 #include "XCoreISelLowering.h" 00023 00024 namespace llvm { 00025 00026 class Module; 00027 00028 class XCoreTargetMachine : public LLVMTargetMachine { 00029 XCoreSubtarget Subtarget; 00030 const TargetData DataLayout; // Calculates type size & alignment 00031 XCoreInstrInfo InstrInfo; 00032 XCoreFrameInfo FrameInfo; 00033 XCoreTargetLowering TLInfo; 00034 00035 protected: 00036 virtual const TargetAsmInfo *createTargetAsmInfo() const; 00037 00038 public: 00039 XCoreTargetMachine(const Module &M, const std::string &FS); 00040 00041 virtual const XCoreInstrInfo *getInstrInfo() const { return &InstrInfo; } 00042 virtual const XCoreFrameInfo *getFrameInfo() const { return &FrameInfo; } 00043 virtual const XCoreSubtarget *getSubtargetImpl() const { return &Subtarget; } 00044 virtual XCoreTargetLowering *getTargetLowering() const { 00045 return const_cast<XCoreTargetLowering*>(&TLInfo); 00046 } 00047 00048 virtual const TargetRegisterInfo *getRegisterInfo() const { 00049 return &InstrInfo.getRegisterInfo(); 00050 } 00051 virtual const TargetData *getTargetData() const { return &DataLayout; } 00052 static unsigned getModuleMatchQuality(const Module &M); 00053 00054 // Pass Pipeline Configuration 00055 virtual bool addInstSelector(PassManagerBase &PM, bool Fast); 00056 virtual bool addAssemblyEmitter(PassManagerBase &PM, bool Fast, 00057 raw_ostream &Out); 00058 }; 00059 00060 } // end namespace llvm 00061 00062 #endif