xref: /llvm-project/llvm/lib/Target/SystemZ/SystemZTargetMachine.h (revision eec21ccee0950d52926a79685573db1996e3ba5b)
1 //=- SystemZTargetMachine.h - Define TargetMachine for SystemZ ----*- 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 SystemZ specific subclass of TargetMachine.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 
14 #ifndef LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZTARGETMACHINE_H
15 #define LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZTARGETMACHINE_H
16 
17 #include "SystemZSubtarget.h"
18 #include "llvm/ADT/StringRef.h"
19 #include "llvm/Analysis/TargetTransformInfo.h"
20 #include "llvm/CodeGen/CodeGenTargetMachineImpl.h"
21 #include "llvm/Support/CodeGen.h"
22 #include "llvm/Target/TargetMachine.h"
23 #include <memory>
24 #include <optional>
25 
26 namespace llvm {
27 
28 class SystemZTargetMachine : public CodeGenTargetMachineImpl {
29   std::unique_ptr<TargetLoweringObjectFile> TLOF;
30 
31   mutable StringMap<std::unique_ptr<SystemZSubtarget>> SubtargetMap;
32 
33 public:
34   SystemZTargetMachine(const Target &T, const Triple &TT, StringRef CPU,
35                        StringRef FS, const TargetOptions &Options,
36                        std::optional<Reloc::Model> RM,
37                        std::optional<CodeModel::Model> CM, CodeGenOptLevel OL,
38                        bool JIT);
39   ~SystemZTargetMachine() override;
40 
41   const SystemZSubtarget *getSubtargetImpl(const Function &) const override;
42   // DO NOT IMPLEMENT: There is no such thing as a valid default subtarget,
43   // subtargets are per-function entities based on the target-specific
44   // attributes of each function.
45   const SystemZSubtarget *getSubtargetImpl() const = delete;
46 
47   // Override CodeGenTargetMachineImpl
48   TargetPassConfig *createPassConfig(PassManagerBase &PM) override;
49   TargetTransformInfo getTargetTransformInfo(const Function &F) const override;
50 
51   TargetLoweringObjectFile *getObjFileLowering() const override {
52     return TLOF.get();
53   }
54 
55   MachineFunctionInfo *
56   createMachineFunctionInfo(BumpPtrAllocator &Allocator, const Function &F,
57                             const TargetSubtargetInfo *STI) const override;
58 
59   bool targetSchedulesPostRAScheduling() const override { return true; };
60 };
61 
62 } // end namespace llvm
63 
64 #endif // LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZTARGETMACHINE_H
65