Fix uninitialized variable
[llvm-core.git] / lib / Target / Mips / MipsTargetMachine.h
blobd9b73d15111943270ff605ce989eef16e8360d53
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.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_LIB_TARGET_MIPS_MIPSTARGETMACHINE_H
15 #define LLVM_LIB_TARGET_MIPS_MIPSTARGETMACHINE_H
17 #include "MCTargetDesc/MipsABIInfo.h"
18 #include "MipsSubtarget.h"
19 #include "llvm/ADT/Optional.h"
20 #include "llvm/ADT/StringMap.h"
21 #include "llvm/ADT/StringRef.h"
22 #include "llvm/Support/CodeGen.h"
23 #include "llvm/Target/TargetMachine.h"
24 #include <memory>
26 namespace llvm {
28 class MipsTargetMachine : public LLVMTargetMachine {
29 bool isLittle;
30 std::unique_ptr<TargetLoweringObjectFile> TLOF;
31 // Selected ABI
32 MipsABIInfo ABI;
33 MipsSubtarget *Subtarget;
34 MipsSubtarget DefaultSubtarget;
35 MipsSubtarget NoMips16Subtarget;
36 MipsSubtarget Mips16Subtarget;
38 mutable StringMap<std::unique_ptr<MipsSubtarget>> SubtargetMap;
40 public:
41 MipsTargetMachine(const Target &T, const Triple &TT, StringRef CPU,
42 StringRef FS, const TargetOptions &Options,
43 Optional<Reloc::Model> RM, Optional<CodeModel::Model> CM,
44 CodeGenOpt::Level OL, bool JIT, bool isLittle);
45 ~MipsTargetMachine() override;
47 TargetTransformInfo getTargetTransformInfo(const Function &F) override;
49 const MipsSubtarget *getSubtargetImpl() const {
50 if (Subtarget)
51 return Subtarget;
52 return &DefaultSubtarget;
55 const MipsSubtarget *getSubtargetImpl(const Function &F) const override;
57 /// Reset the subtarget for the Mips target.
58 void resetSubtarget(MachineFunction *MF);
60 // Pass Pipeline Configuration
61 TargetPassConfig *createPassConfig(PassManagerBase &PM) override;
63 TargetLoweringObjectFile *getObjFileLowering() const override {
64 return TLOF.get();
67 bool isLittleEndian() const { return isLittle; }
68 const MipsABIInfo &getABI() const { return ABI; }
70 bool isMachineVerifierClean() const override {
71 return false;
75 /// Mips32/64 big endian target machine.
76 ///
77 class MipsebTargetMachine : public MipsTargetMachine {
78 virtual void anchor();
80 public:
81 MipsebTargetMachine(const Target &T, const Triple &TT, StringRef CPU,
82 StringRef FS, const TargetOptions &Options,
83 Optional<Reloc::Model> RM, Optional<CodeModel::Model> CM,
84 CodeGenOpt::Level OL, bool JIT);
87 /// Mips32/64 little endian target machine.
88 ///
89 class MipselTargetMachine : public MipsTargetMachine {
90 virtual void anchor();
92 public:
93 MipselTargetMachine(const Target &T, const Triple &TT, StringRef CPU,
94 StringRef FS, const TargetOptions &Options,
95 Optional<Reloc::Model> RM, Optional<CodeModel::Model> CM,
96 CodeGenOpt::Level OL, bool JIT);
99 } // end namespace llvm
101 #endif // LLVM_LIB_TARGET_MIPS_MIPSTARGETMACHINE_H