2016-11-02 01:27:54 +08:00
|
|
|
//===-- RISCVTargetMachine.h - Define TargetMachine for RISCV ---*- C++ -*-===//
|
|
|
|
//
|
2019-01-19 16:50:56 +08:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2016-11-02 01:27:54 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file declares the RISCV specific subclass of TargetMachine.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef LLVM_LIB_TARGET_RISCV_RISCVTARGETMACHINE_H
|
|
|
|
#define LLVM_LIB_TARGET_RISCV_RISCVTARGETMACHINE_H
|
|
|
|
|
2016-11-02 07:47:30 +08:00
|
|
|
#include "MCTargetDesc/RISCVMCTargetDesc.h"
|
2017-10-20 05:37:38 +08:00
|
|
|
#include "RISCVSubtarget.h"
|
2016-11-02 01:27:54 +08:00
|
|
|
#include "llvm/CodeGen/SelectionDAGTargetInfo.h"
|
|
|
|
#include "llvm/IR/DataLayout.h"
|
2016-11-02 07:47:30 +08:00
|
|
|
#include "llvm/Target/TargetMachine.h"
|
2016-11-02 01:27:54 +08:00
|
|
|
|
|
|
|
namespace llvm {
|
2017-10-13 06:57:28 +08:00
|
|
|
class RISCVTargetMachine : public LLVMTargetMachine {
|
2016-11-02 01:27:54 +08:00
|
|
|
std::unique_ptr<TargetLoweringObjectFile> TLOF;
|
2017-10-20 05:37:38 +08:00
|
|
|
RISCVSubtarget Subtarget;
|
2016-11-02 01:27:54 +08:00
|
|
|
|
|
|
|
public:
|
|
|
|
RISCVTargetMachine(const Target &T, const Triple &TT, StringRef CPU,
|
|
|
|
StringRef FS, const TargetOptions &Options,
|
2017-08-03 10:16:21 +08:00
|
|
|
Optional<Reloc::Model> RM, Optional<CodeModel::Model> CM,
|
|
|
|
CodeGenOpt::Level OL, bool JIT);
|
2016-11-02 01:27:54 +08:00
|
|
|
|
2017-10-20 05:37:38 +08:00
|
|
|
const RISCVSubtarget *getSubtargetImpl(const Function &) const override {
|
|
|
|
return &Subtarget;
|
|
|
|
}
|
|
|
|
|
2016-11-02 01:27:54 +08:00
|
|
|
TargetPassConfig *createPassConfig(PassManagerBase &PM) override;
|
|
|
|
|
|
|
|
TargetLoweringObjectFile *getObjFileLowering() const override {
|
|
|
|
return TLOF.get();
|
|
|
|
}
|
[RISCV] Add RISCV-specific TargetTransformInfo
Summary:
LLVM Allows Targets to provide information that guides optimisations
made to LLVM IR. This is done with callbacks on a TargetTransformInfo object.
This patch adds a TargetTransformInfo class for RISC-V. This will allow us to
implement RISC-V specific callbacks as they become necessary.
This commit also adds the getIntImmCost callbacks, and tests them with a simple
constant hoisting test. Our immediate costs are on the conservative side, for
the moment, but we prevent hoisting in most circumstances anyway.
Previous review was on D63007
Reviewers: asb, luismarques
Reviewed By: asb
Subscribers: ributzka, MaskRay, llvm-commits, Jim, benna, psnobl, jocewei, PkmX, rkruppe, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, shiva0217, kito-cheng, niosHD, sabuasal, apazos, simoncook, johnrusso, rbar, hiraditya, mgorny
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D63433
llvm-svn: 364046
2019-06-21 21:36:09 +08:00
|
|
|
|
|
|
|
TargetTransformInfo getTargetTransformInfo(const Function &F) override;
|
2016-11-02 01:27:54 +08:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|