1 //===-- LanaiTargetMachine.h - Define TargetMachine for Lanai --- C++ ---===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file declares the Lanai specific subclass of TargetMachine.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef LLVM_LIB_TARGET_LANAI_LANAITARGETMACHINE_H
14 #define LLVM_LIB_TARGET_LANAI_LANAITARGETMACHINE_H
15 
16 #include "LanaiFrameLowering.h"
17 #include "LanaiISelLowering.h"
18 #include "LanaiInstrInfo.h"
19 #include "LanaiSelectionDAGInfo.h"
20 #include "LanaiSubtarget.h"
21 #include "llvm/CodeGen/TargetFrameLowering.h"
22 #include "llvm/Target/TargetMachine.h"
23 
24 namespace llvm {
25 
26 class LanaiTargetMachine : public LLVMTargetMachine {
27   LanaiSubtarget Subtarget;
28   std::unique_ptr<TargetLoweringObjectFile> TLOF;
29 
30 public:
31   LanaiTargetMachine(const Target &TheTarget, const Triple &TargetTriple,
32                      StringRef Cpu, StringRef FeatureString,
33                      const TargetOptions &Options,
34                      Optional<Reloc::Model> RelocationModel,
35                      Optional<CodeModel::Model> CodeModel,
36                      CodeGenOpt::Level OptLevel, bool JIT);
37 
38   const LanaiSubtarget *
39   getSubtargetImpl(const llvm::Function & /*Fn*/) const override {
40     return &Subtarget;
41   }
42 
43   TargetTransformInfo getTargetTransformInfo(const Function &F) override;
44 
45   // Pass Pipeline Configuration
46   TargetPassConfig *createPassConfig(PassManagerBase &pass_manager) override;
47 
48   TargetLoweringObjectFile *getObjFileLowering() const override {
49     return TLOF.get();
50   }
51 
52   bool isMachineVerifierClean() const override {
53     return false;
54   }
55 };
56 } // namespace llvm
57 
58 #endif // LLVM_LIB_TARGET_LANAI_LANAITARGETMACHINE_H
59