1 //===-- XCoreTargetMachine.h - Define TargetMachine for XCore ---*- 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 XCore specific subclass of TargetMachine. 11 // 12 //===----------------------------------------------------------------------===// 13 14 #ifndef XCORETARGETMACHINE_H 15 #define XCORETARGETMACHINE_H 16 17 #include "llvm/Target/TargetMachine.h" 18 #include "llvm/Target/TargetData.h" 19 #include "XCoreFrameInfo.h" 20 #include "XCoreSubtarget.h" 21 #include "XCoreInstrInfo.h" 22 #include "XCoreISelLowering.h" 23 24 namespace llvm { 25 26 class Module; 27 28 class XCoreTargetMachine : public LLVMTargetMachine { 29 XCoreSubtarget Subtarget; 30 const TargetData DataLayout; // Calculates type size & alignment 31 XCoreInstrInfo InstrInfo; 32 XCoreFrameInfo FrameInfo; 33 XCoreTargetLowering TLInfo; 34 35 protected: 36 virtual const TargetAsmInfo *createTargetAsmInfo() const; 37 38 public: 39 XCoreTargetMachine(const Module &M, const std::string &FS); 40 41 virtual const XCoreInstrInfo *getInstrInfo() const { return &InstrInfo; } 42 virtual const XCoreFrameInfo *getFrameInfo() const { return &FrameInfo; } 43 virtual const XCoreSubtarget *getSubtargetImpl() const { return &Subtarget; } 44 virtual XCoreTargetLowering *getTargetLowering() const { 45 return const_cast<XCoreTargetLowering*>(&TLInfo); 46 } 47 48 virtual const TargetRegisterInfo *getRegisterInfo() const { 49 return &InstrInfo.getRegisterInfo(); 50 } 51 virtual const TargetData *getTargetData() const { return &DataLayout; } 52 static unsigned getModuleMatchQuality(const Module &M); 53 54 // Pass Pipeline Configuration 55 virtual bool addInstSelector(PassManagerBase &PM, CodeGenOpt::Level OptLevel); 56 virtual bool addAssemblyEmitter(PassManagerBase &PM, 57 CodeGenOpt::Level OptLevel, 58 bool Verbose, raw_ostream &Out); 59 }; 60 61 } // end namespace llvm 62 63 #endif 64