1//===-- SparcTargetMachine.h - Define TargetMachine for Sparc ---*- 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 Sparc specific subclass of TargetMachine.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_LIB_TARGET_SPARC_SPARCTARGETMACHINE_H
14#define LLVM_LIB_TARGET_SPARC_SPARCTARGETMACHINE_H
15
16#include "SparcInstrInfo.h"
17#include "SparcSubtarget.h"
18#include "llvm/CodeGen/CodeGenTargetMachineImpl.h"
19#include "llvm/Target/TargetMachine.h"
20#include <optional>
21
22namespace llvm {
23
24class SparcTargetMachine : public CodeGenTargetMachineImpl {
25 const SparcOptions &CLOpts;
26 std::unique_ptr<TargetLoweringObjectFile> TLOF;
27 mutable StringMap<std::unique_ptr<SparcSubtarget>> SubtargetMap;
28
29public:
30 SparcTargetMachine(const Target &T, const Triple &TT, StringRef CPU,
31 StringRef FS, const TargetOptions &Options,
32 std::optional<Reloc::Model> RM,
33 std::optional<CodeModel::Model> CM, CodeGenOptLevel OL,
34 bool JIT);
35 ~SparcTargetMachine() override;
36
37 const SparcOptions &getCLOpts() const { return CLOpts; }
38
39 const SparcSubtarget *getSubtargetImpl(const Function &F) const override;
40
41 // Pass Pipeline Configuration
42 TargetPassConfig *createPassConfig(PassManagerBase &PM) override;
43 TargetLoweringObjectFile *getObjFileLowering() const override {
44 return TLOF.get();
45 }
46 TargetTransformInfo getTargetTransformInfo(const Function &F) const override;
47
48 MachineFunctionInfo *
49 createMachineFunctionInfo(BumpPtrAllocator &Allocator, const Function &F,
50 const TargetSubtargetInfo *STI) const override;
51};
52
53/// Sparc 32-bit target machine
54///
55class SparcV8TargetMachine : public SparcTargetMachine {
56 virtual void anchor();
57
58public:
59 SparcV8TargetMachine(const Target &T, const Triple &TT, StringRef CPU,
60 StringRef FS, const TargetOptions &Options,
61 std::optional<Reloc::Model> RM,
62 std::optional<CodeModel::Model> CM, CodeGenOptLevel OL,
63 bool JIT);
64};
65
66/// Sparc 64-bit target machine
67///
68class SparcV9TargetMachine : public SparcTargetMachine {
69 virtual void anchor();
70
71public:
72 SparcV9TargetMachine(const Target &T, const Triple &TT, StringRef CPU,
73 StringRef FS, const TargetOptions &Options,
74 std::optional<Reloc::Model> RM,
75 std::optional<CodeModel::Model> CM, CodeGenOptLevel OL,
76 bool JIT);
77};
78
79class SparcelTargetMachine : public SparcTargetMachine {
80 virtual void anchor();
81
82public:
83 SparcelTargetMachine(const Target &T, const Triple &TT, StringRef CPU,
84 StringRef FS, const TargetOptions &Options,
85 std::optional<Reloc::Model> RM,
86 std::optional<CodeModel::Model> CM, CodeGenOptLevel OL,
87 bool JIT);
88};
89
90} // end namespace llvm
91
92#endif
93