1 //===-- MipsTargetMachine.h - Define TargetMachine for Mips -----*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file declares the Mips specific subclass of TargetMachine.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_LIB_TARGET_MIPS_MIPSTARGETMACHINE_H
15 #define LLVM_LIB_TARGET_MIPS_MIPSTARGETMACHINE_H
17 #include "MipsSubtarget.h"
18 #include "llvm/CodeGen/BasicTTIImpl.h"
19 #include "llvm/CodeGen/Passes.h"
20 #include "llvm/CodeGen/SelectionDAGISel.h"
21 #include "llvm/Target/TargetFrameLowering.h"
22 #include "llvm/Target/TargetMachine.h"
23 #include "MCTargetDesc/MipsABIInfo.h"
26 class formatted_raw_ostream;
27 class MipsRegisterInfo;
29 class MipsTargetMachine : public LLVMTargetMachine {
31 std::unique_ptr<TargetLoweringObjectFile> TLOF;
34 const DataLayout DL; // Calculates type size & alignment
35 MipsSubtarget *Subtarget;
36 MipsSubtarget DefaultSubtarget;
37 MipsSubtarget NoMips16Subtarget;
38 MipsSubtarget Mips16Subtarget;
40 mutable StringMap<std::unique_ptr<MipsSubtarget>> SubtargetMap;
43 MipsTargetMachine(const Target &T, StringRef TT, StringRef CPU, StringRef FS,
44 const TargetOptions &Options, Reloc::Model RM,
45 CodeModel::Model CM, CodeGenOpt::Level OL, bool isLittle);
46 ~MipsTargetMachine() override;
48 TargetIRAnalysis getTargetIRAnalysis() override;
50 const DataLayout *getDataLayout() const override { return &DL; }
51 const MipsSubtarget *getSubtargetImpl() const override {
54 return &DefaultSubtarget;
57 const MipsSubtarget *getSubtargetImpl(const Function &F) const override;
59 /// \brief Reset the subtarget for the Mips target.
60 void resetSubtarget(MachineFunction *MF);
62 // Pass Pipeline Configuration
63 TargetPassConfig *createPassConfig(PassManagerBase &PM) override;
65 TargetLoweringObjectFile *getObjFileLowering() const override {
69 bool isLittleEndian() const { return isLittle; }
70 const MipsABIInfo &getABI() const { return ABI; }
73 /// MipsebTargetMachine - Mips32/64 big endian target machine.
75 class MipsebTargetMachine : public MipsTargetMachine {
76 virtual void anchor();
78 MipsebTargetMachine(const Target &T, StringRef TT,
79 StringRef CPU, StringRef FS, const TargetOptions &Options,
80 Reloc::Model RM, CodeModel::Model CM,
81 CodeGenOpt::Level OL);
84 /// MipselTargetMachine - Mips32/64 little endian target machine.
86 class MipselTargetMachine : public MipsTargetMachine {
87 virtual void anchor();
89 MipselTargetMachine(const Target &T, StringRef TT,
90 StringRef CPU, StringRef FS, const TargetOptions &Options,
91 Reloc::Model RM, CodeModel::Model CM,
92 CodeGenOpt::Level OL);
95 } // End llvm namespace