xref: /freebsd/contrib/llvm-project/llvm/lib/Target/VE/VETargetMachine.h (revision 7fdf597e96a02165cfe22ff357b857d5fa15ed8a)
1 //===-- VETargetMachine.h - Define TargetMachine for VE ---------*- 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 VE specific subclass of TargetMachine.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef LLVM_LIB_TARGET_VE_VETARGETMACHINE_H
14 #define LLVM_LIB_TARGET_VE_VETARGETMACHINE_H
15 
16 #include "VEInstrInfo.h"
17 #include "VESubtarget.h"
18 #include "llvm/Target/TargetMachine.h"
19 #include <optional>
20 
21 namespace llvm {
22 
23 class VETargetMachine : public LLVMTargetMachine {
24   std::unique_ptr<TargetLoweringObjectFile> TLOF;
25   VESubtarget Subtarget;
26   // Hold Strings that can be free'd all together with VETargetMachine
27   //   e.g.: "GCC_except_tableXX" string.
28   std::list<std::string> StrList;
29 
30 public:
31   VETargetMachine(const Target &T, const Triple &TT, StringRef CPU,
32                   StringRef FS, const TargetOptions &Options,
33                   std::optional<Reloc::Model> RM,
34                   std::optional<CodeModel::Model> CM, CodeGenOptLevel OL,
35                   bool JIT);
36   ~VETargetMachine() override;
37 
38   const VESubtarget *getSubtargetImpl() const { return &Subtarget; }
39   const VESubtarget *getSubtargetImpl(const Function &) const override {
40     return &Subtarget;
41   }
42   std::list<std::string> *getStrList() const {
43     return const_cast<std::list<std::string> *>(&StrList);
44   }
45 
46   // Pass Pipeline Configuration
47   TargetPassConfig *createPassConfig(PassManagerBase &PM) override;
48   TargetLoweringObjectFile *getObjFileLowering() const override {
49     return TLOF.get();
50   }
51 
52   MachineFunctionInfo *
53   createMachineFunctionInfo(BumpPtrAllocator &Allocator, const Function &F,
54                             const TargetSubtargetInfo *STI) const override;
55 
56   bool isMachineVerifierClean() const override { return false; }
57 
58   TargetTransformInfo getTargetTransformInfo(const Function &F) const override;
59 
60   unsigned getSjLjDataSize() const override { return 64; }
61 };
62 
63 } // namespace llvm
64 
65 #endif
66