blob: 4083f61433b1678d0ebb2e823869ef146a157854 [file] [log] [blame]
Chris Lattner158e1f52006-02-05 05:50:24 +00001//===-- SparcTargetMachine.h - Define TargetMachine for Sparc ---*- C++ -*-===//
2//
Chandler Carruth2946cd72019-01-19 08:50:56 +00003// 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
Chris Lattner158e1f52006-02-05 05:50:24 +00006//
7//===----------------------------------------------------------------------===//
8//
9// This file declares the Sparc specific subclass of TargetMachine.
10//
11//===----------------------------------------------------------------------===//
12
Benjamin Kramera7c40ef2014-08-13 16:26:38 +000013#ifndef LLVM_LIB_TARGET_SPARC_SPARCTARGETMACHINE_H
14#define LLVM_LIB_TARGET_SPARC_SPARCTARGETMACHINE_H
Chris Lattner158e1f52006-02-05 05:50:24 +000015
Chandler Carruth802d7552012-12-04 07:12:27 +000016#include "SparcInstrInfo.h"
Anton Korobeynikovf7183ed2010-11-15 00:06:54 +000017#include "SparcSubtarget.h"
Chandler Carruth802d7552012-12-04 07:12:27 +000018#include "llvm/Target/TargetMachine.h"
Chris Lattner158e1f52006-02-05 05:50:24 +000019
20namespace llvm {
21
Matthias Braunbb8507e2017-10-12 22:57:28 +000022class SparcTargetMachine : public LLVMTargetMachine {
Aditya Nandakumara2719322014-11-13 09:26:31 +000023 std::unique_ptr<TargetLoweringObjectFile> TLOF;
Chris Dewhurst4f7cac32016-05-23 10:56:36 +000024 SparcSubtarget Subtarget;
Chris Dewhurst68388a02016-05-18 09:14:13 +000025 bool is64Bit;
26 mutable StringMap<std::unique_ptr<SparcSubtarget>> SubtargetMap;
Chris Lattner158e1f52006-02-05 05:50:24 +000027public:
Daniel Sanders3e5de882015-06-11 19:41:26 +000028 SparcTargetMachine(const Target &T, const Triple &TT, StringRef CPU,
29 StringRef FS, const TargetOptions &Options,
Rafael Espindola79e238a2017-08-03 02:16:21 +000030 Optional<Reloc::Model> RM, Optional<CodeModel::Model> CM,
31 CodeGenOpt::Level OL, bool JIT, bool is64bit);
Reid Kleckner357600e2014-11-20 23:37:18 +000032 ~SparcTargetMachine() override;
Chris Lattner158e1f52006-02-05 05:50:24 +000033
Chris Dewhurst4f7cac32016-05-23 10:56:36 +000034 const SparcSubtarget *getSubtargetImpl() const { return &Subtarget; }
Chris Dewhurst68388a02016-05-18 09:14:13 +000035 const SparcSubtarget *getSubtargetImpl(const Function &) const override;
Rafael Espindolab8141d52014-08-05 22:10:21 +000036
Chris Lattner12e97302006-09-04 04:14:57 +000037 // Pass Pipeline Configuration
Craig Topperb0c941b2014-04-29 07:57:13 +000038 TargetPassConfig *createPassConfig(PassManagerBase &PM) override;
Aditya Nandakumara2719322014-11-13 09:26:31 +000039 TargetLoweringObjectFile *getObjFileLowering() const override {
40 return TLOF.get();
41 }
Chris Lattner158e1f52006-02-05 05:50:24 +000042};
43
Rafael Espindola38af4d62016-05-18 16:00:24 +000044/// Sparc 32-bit target machine
Chris Lattner8228b112010-02-04 06:34:01 +000045///
46class SparcV8TargetMachine : public SparcTargetMachine {
David Blaikiea379b1812011-12-20 02:50:00 +000047 virtual void anchor();
Chris Lattner8228b112010-02-04 06:34:01 +000048public:
Daniel Sanders3e5de882015-06-11 19:41:26 +000049 SparcV8TargetMachine(const Target &T, const Triple &TT, StringRef CPU,
50 StringRef FS, const TargetOptions &Options,
Rafael Espindola79e238a2017-08-03 02:16:21 +000051 Optional<Reloc::Model> RM, Optional<CodeModel::Model> CM,
52 CodeGenOpt::Level OL, bool JIT);
Chris Lattner8228b112010-02-04 06:34:01 +000053};
54
Rafael Espindola38af4d62016-05-18 16:00:24 +000055/// Sparc 64-bit target machine
Chris Lattner8228b112010-02-04 06:34:01 +000056///
57class SparcV9TargetMachine : public SparcTargetMachine {
David Blaikiea379b1812011-12-20 02:50:00 +000058 virtual void anchor();
Chris Lattner8228b112010-02-04 06:34:01 +000059public:
Daniel Sanders3e5de882015-06-11 19:41:26 +000060 SparcV9TargetMachine(const Target &T, const Triple &TT, StringRef CPU,
Douglas Katzman9160e782015-04-29 20:30:57 +000061 StringRef FS, const TargetOptions &Options,
Rafael Espindola79e238a2017-08-03 02:16:21 +000062 Optional<Reloc::Model> RM, Optional<CodeModel::Model> CM,
63 CodeGenOpt::Level OL, bool JIT);
Douglas Katzman9160e782015-04-29 20:30:57 +000064};
65
66class SparcelTargetMachine : public SparcTargetMachine {
67 virtual void anchor();
68
69public:
Daniel Sanders3e5de882015-06-11 19:41:26 +000070 SparcelTargetMachine(const Target &T, const Triple &TT, StringRef CPU,
Douglas Katzman9160e782015-04-29 20:30:57 +000071 StringRef FS, const TargetOptions &Options,
Rafael Espindola79e238a2017-08-03 02:16:21 +000072 Optional<Reloc::Model> RM, Optional<CodeModel::Model> CM,
73 CodeGenOpt::Level OL, bool JIT);
Chris Lattner8228b112010-02-04 06:34:01 +000074};
75
Chris Lattner158e1f52006-02-05 05:50:24 +000076} // end namespace llvm
77
78#endif