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/Passes.h"
19 #include "llvm/CodeGen/SelectionDAGISel.h"
20 #include "llvm/Target/TargetFrameLowering.h"
21 #include "llvm/Target/TargetMachine.h"
22 #include "MCTargetDesc/MipsABIInfo.h"
25 class formatted_raw_ostream;
26 class MipsRegisterInfo;
28 class MipsTargetMachine : public LLVMTargetMachine {
30 std::unique_ptr<TargetLoweringObjectFile> TLOF;
33 const DataLayout DL; // Calculates type size & alignment
34 MipsSubtarget *Subtarget;
35 MipsSubtarget DefaultSubtarget;
36 MipsSubtarget NoMips16Subtarget;
37 MipsSubtarget Mips16Subtarget;
39 mutable StringMap<std::unique_ptr<MipsSubtarget>> SubtargetMap;
42 MipsTargetMachine(const Target &T, StringRef TT, StringRef CPU, StringRef FS,
43 const TargetOptions &Options, Reloc::Model RM,
44 CodeModel::Model CM, CodeGenOpt::Level OL, bool isLittle);
45 ~MipsTargetMachine() override;
47 void addAnalysisPasses(PassManagerBase &PM) override;
49 const DataLayout *getDataLayout() const override { return &DL; }
50 const MipsSubtarget *getSubtargetImpl() const override {
53 return &DefaultSubtarget;
56 const MipsSubtarget *getSubtargetImpl(const Function &F) const override;
58 /// \brief Reset the subtarget for the Mips target.
59 void resetSubtarget(MachineFunction *MF);
61 // Pass Pipeline Configuration
62 TargetPassConfig *createPassConfig(PassManagerBase &PM) override;
64 TargetLoweringObjectFile *getObjFileLowering() const override {
68 bool isLittleEndian() const { return isLittle; }
69 const MipsABIInfo &getABI() const { return ABI; }
72 /// MipsebTargetMachine - Mips32/64 big endian target machine.
74 class MipsebTargetMachine : public MipsTargetMachine {
75 virtual void anchor();
77 MipsebTargetMachine(const Target &T, StringRef TT,
78 StringRef CPU, StringRef FS, const TargetOptions &Options,
79 Reloc::Model RM, CodeModel::Model CM,
80 CodeGenOpt::Level OL);
83 /// MipselTargetMachine - Mips32/64 little endian target machine.
85 class MipselTargetMachine : public MipsTargetMachine {
86 virtual void anchor();
88 MipselTargetMachine(const Target &T, StringRef TT,
89 StringRef CPU, StringRef FS, const TargetOptions &Options,
90 Reloc::Model RM, CodeModel::Model CM,
91 CodeGenOpt::Level OL);
94 } // End llvm namespace