1 //===-- MipsTargetMachine.h - Define TargetMachine for Mips -----*- 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 Mips specific subclass of TargetMachine. 11 // 12 //===----------------------------------------------------------------------===// 13 14 #ifndef MIPSTARGETMACHINE_H 15 #define MIPSTARGETMACHINE_H 16 17 #include "MipsFrameLowering.h" 18 #include "MipsISelLowering.h" 19 #include "MipsInstrInfo.h" 20 #include "MipsJITInfo.h" 21 #include "MipsSelectionDAGInfo.h" 22 #include "MipsSubtarget.h" 23 #include "llvm/DataLayout.h" 24 #include "llvm/Target/TargetFrameLowering.h" 25 #include "llvm/Target/TargetMachine.h" 26 #include "llvm/Target/TargetTransformImpl.h" 27 28 namespace llvm { 29 class formatted_raw_ostream; 30 class MipsRegisterInfo; 31 32 class MipsTargetMachine : public LLVMTargetMachine { 33 MipsSubtarget Subtarget; 34 const DataLayout DL; // Calculates type size & alignment 35 const MipsInstrInfo *InstrInfo; 36 const MipsFrameLowering *FrameLowering; 37 MipsTargetLowering TLInfo; 38 MipsSelectionDAGInfo TSInfo; 39 MipsJITInfo JITInfo; 40 ScalarTargetTransformImpl STTI; 41 VectorTargetTransformImpl VTTI; 42 43 public: 44 MipsTargetMachine(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 bool isLittle); 49 50 virtual ~MipsTargetMachine() { delete InstrInfo; } 51 52 virtual const MipsInstrInfo *getInstrInfo() const 53 { return InstrInfo; } 54 virtual const TargetFrameLowering *getFrameLowering() const 55 { return FrameLowering; } 56 virtual const MipsSubtarget *getSubtargetImpl() const 57 { return &Subtarget; } 58 virtual const DataLayout *getDataLayout() const 59 { return &DL;} 60 virtual MipsJITInfo *getJITInfo() 61 { return &JITInfo; } 62 63 virtual const MipsRegisterInfo *getRegisterInfo() const { 64 return &InstrInfo->getRegisterInfo(); 65 } 66 67 virtual const MipsTargetLowering *getTargetLowering() const { 68 return &TLInfo; 69 } 70 71 virtual const MipsSelectionDAGInfo* getSelectionDAGInfo() const { 72 return &TSInfo; 73 } 74 75 virtual const ScalarTargetTransformInfo *getScalarTargetTransformInfo()const { 76 return &STTI; 77 } 78 virtual const VectorTargetTransformInfo *getVectorTargetTransformInfo()const { 79 return &VTTI; 80 } 81 82 // Pass Pipeline Configuration 83 virtual TargetPassConfig *createPassConfig(PassManagerBase &PM); 84 virtual bool addCodeEmitter(PassManagerBase &PM, JITCodeEmitter &JCE); 85 }; 86 87 /// MipsebTargetMachine - Mips32/64 big endian target machine. 88 /// 89 class MipsebTargetMachine : public MipsTargetMachine { 90 virtual void anchor(); 91 public: 92 MipsebTargetMachine(const Target &T, StringRef TT, 93 StringRef CPU, StringRef FS, const TargetOptions &Options, 94 Reloc::Model RM, CodeModel::Model CM, 95 CodeGenOpt::Level OL); 96 }; 97 98 /// MipselTargetMachine - Mips32/64 little endian target machine. 99 /// 100 class MipselTargetMachine : public MipsTargetMachine { 101 virtual void anchor(); 102 public: 103 MipselTargetMachine(const Target &T, StringRef TT, 104 StringRef CPU, StringRef FS, const TargetOptions &Options, 105 Reloc::Model RM, CodeModel::Model CM, 106 CodeGenOpt::Level OL); 107 }; 108 109 } // End llvm namespace 110 111 #endif 112