blob: 02361dddebf7b462fd685f141836dae74ac2bb62 [file] [log] [blame]
Alex Bradburyb2e54722016-11-01 17:27:54 +00001//===-- RISCVTargetMachine.h - Define TargetMachine for RISCV ---*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file declares the RISCV specific subclass of TargetMachine.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_LIB_TARGET_RISCV_RISCVTARGETMACHINE_H
15#define LLVM_LIB_TARGET_RISCV_RISCVTARGETMACHINE_H
16
Alex Bradbury6b2cca72016-11-01 23:47:30 +000017#include "MCTargetDesc/RISCVMCTargetDesc.h"
Alex Bradbury89718422017-10-19 21:37:38 +000018#include "RISCVSubtarget.h"
Alex Bradburyb2e54722016-11-01 17:27:54 +000019#include "llvm/CodeGen/SelectionDAGTargetInfo.h"
Alex Bradburyb2e54722016-11-01 17:27:54 +000020#include "llvm/IR/DataLayout.h"
Alex Bradbury6b2cca72016-11-01 23:47:30 +000021#include "llvm/Target/TargetMachine.h"
Alex Bradburyb2e54722016-11-01 17:27:54 +000022
23namespace llvm {
Matthias Braunbb8507e2017-10-12 22:57:28 +000024class RISCVTargetMachine : public LLVMTargetMachine {
Alex Bradburyb2e54722016-11-01 17:27:54 +000025 std::unique_ptr<TargetLoweringObjectFile> TLOF;
Alex Bradbury89718422017-10-19 21:37:38 +000026 RISCVSubtarget Subtarget;
Alex Bradburyb2e54722016-11-01 17:27:54 +000027
28public:
29 RISCVTargetMachine(const Target &T, const Triple &TT, StringRef CPU,
30 StringRef FS, const TargetOptions &Options,
Rafael Espindola79e238a2017-08-03 02:16:21 +000031 Optional<Reloc::Model> RM, Optional<CodeModel::Model> CM,
32 CodeGenOpt::Level OL, bool JIT);
Alex Bradburyb2e54722016-11-01 17:27:54 +000033
Alex Bradbury89718422017-10-19 21:37:38 +000034 const RISCVSubtarget *getSubtargetImpl(const Function &) const override {
35 return &Subtarget;
36 }
37
Alex Bradburyb2e54722016-11-01 17:27:54 +000038 TargetPassConfig *createPassConfig(PassManagerBase &PM) override;
39
40 TargetLoweringObjectFile *getObjFileLowering() const override {
41 return TLOF.get();
42 }
43};
Alex Bradburyb2e54722016-11-01 17:27:54 +000044}
45
46#endif