blob: dd0110c6b69efc5fee826efbbd0ac9165850efa3 [file] [log] [blame]
Alex Bradburyb2e54722016-11-01 17:27:54 +00001//===-- RISCVTargetMachine.h - Define TargetMachine for RISCV ---*- 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
Alex Bradburyb2e54722016-11-01 17:27:54 +00006//
7//===----------------------------------------------------------------------===//
8//
9// This file declares the RISCV specific subclass of TargetMachine.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_LIB_TARGET_RISCV_RISCVTARGETMACHINE_H
14#define LLVM_LIB_TARGET_RISCV_RISCVTARGETMACHINE_H
15
Alex Bradbury6b2cca72016-11-01 23:47:30 +000016#include "MCTargetDesc/RISCVMCTargetDesc.h"
Alex Bradbury89718422017-10-19 21:37:38 +000017#include "RISCVSubtarget.h"
Alex Bradburyb2e54722016-11-01 17:27:54 +000018#include "llvm/CodeGen/SelectionDAGTargetInfo.h"
Alex Bradburyb2e54722016-11-01 17:27:54 +000019#include "llvm/IR/DataLayout.h"
Alex Bradbury6b2cca72016-11-01 23:47:30 +000020#include "llvm/Target/TargetMachine.h"
Alex Bradburyb2e54722016-11-01 17:27:54 +000021
22namespace llvm {
Matthias Braunbb8507e2017-10-12 22:57:28 +000023class RISCVTargetMachine : public LLVMTargetMachine {
Alex Bradburyb2e54722016-11-01 17:27:54 +000024 std::unique_ptr<TargetLoweringObjectFile> TLOF;
Alex Bradbury89718422017-10-19 21:37:38 +000025 RISCVSubtarget Subtarget;
Alex Bradburyb2e54722016-11-01 17:27:54 +000026
27public:
28 RISCVTargetMachine(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);
Alex Bradburyb2e54722016-11-01 17:27:54 +000032
Alex Bradbury89718422017-10-19 21:37:38 +000033 const RISCVSubtarget *getSubtargetImpl(const Function &) const override {
34 return &Subtarget;
35 }
36
Alex Bradburyb2e54722016-11-01 17:27:54 +000037 TargetPassConfig *createPassConfig(PassManagerBase &PM) override;
38
39 TargetLoweringObjectFile *getObjFileLowering() const override {
40 return TLOF.get();
41 }
42};
Alex Bradburyb2e54722016-11-01 17:27:54 +000043}
44
45#endif