45 return "e-m:e-p:64:64-i64:64-i128:128-n64-S128";
48 return "e-m:e-p:32:32-i64:64-n32-S128";
86 std::string
Key = CPU +
FS;
87 auto &
I = SubtargetMap[
Key];
94 if (
const MDString *ModuleTargetABI = dyn_cast_or_null<MDString>(
98 ModuleTargetABI->getString() != ABIName) {
101 ABIName = ModuleTargetABI->getString();
103 I = std::make_unique<RISCVSubtarget>(
TargetTriple, CPU,
FS, ABIName, *
this);
120 return getTM<RISCVTargetMachine>();
123 void addIRPasses()
override;
124 bool addInstSelector()
override;
125 bool addIRTranslator()
override;
126 bool addLegalizeMachineIR()
override;
127 bool addRegBankSelect()
override;
128 bool addGlobalInstructionSelect()
override;
129 void addPreEmitPass()
override;
130 void addPreEmitPass2()
override;
131 void addPreRegAlloc()
override;
136 return new RISCVPassConfig(*
this, PM);
139 void RISCVPassConfig::addIRPasses() {
144 bool RISCVPassConfig::addInstSelector() {
150 bool RISCVPassConfig::addIRTranslator() {
155 bool RISCVPassConfig::addLegalizeMachineIR() {
160 bool RISCVPassConfig::addRegBankSelect() {
165 bool RISCVPassConfig::addGlobalInstructionSelect() {
172 void RISCVPassConfig::addPreEmitPass2() {
179 void RISCVPassConfig::addPreRegAlloc() {
const RISCVSubtarget * getSubtargetImpl() const =delete
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
CodeModel::Model getEffectiveCodeModel(Optional< CodeModel::Model > CM, CodeModel::Model Default)
Helper method for getting the code model, returning Default if CM does not have a value...
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
LLVM_NODISCARD std::string str() const
str - Get the contents as an std::string.
MCTargetOptions MCOptions
Machine level options.
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
This class represents lattice values for constants.
virtual void addIRPasses()
Add common target configurable passes that perform LLVM IR to IR transforms following machine indepen...
void initializeRISCVExpandPseudoPass(PassRegistry &)
Triple TargetTriple
Triple string, CPU name, and target feature strings the TargetMachine instance is created with...
char & BranchRelaxationPassID
BranchRelaxation - This pass replaces branches that need to jump further than is supported by a branc...
static GCMetadataPrinterRegistry::Add< OcamlGCMetadataPrinter > Y("ocaml", "ocaml 3.10-compatible collector")
LLVM_EXTERNAL_VISIBILITY void LLVMInitializeRISCVTarget()
void resetTargetOptions(const Function &F) const
Reset the target options based on the function's attributes.
No attributes have been set.
Target & getTheRISCV32Target()
Target-Independent Code Generator Pass Configuration Options.
FunctionPass * createRISCVISelDag(RISCVTargetMachine &TM)
RegisterTargetMachine - Helper template for registering a target machine implementation, for use in the target machine initialization function.
bool isArch32Bit() const
Test whether the architecture is 32-bit.
bool hasAttribute(AttrKind Val) const
Return true if the attribute is present.
static Reloc::Model getEffectiveRelocModel(Optional< Reloc::Model > RM)
This pass implements the reg bank selector pass used in the GlobalISel pipeline.
Metadata * getModuleFlag(StringRef Key) const
Return the corresponding value if Key appears in module flags, otherwise return null.
Target & getTheRISCV64Target()
This class describes a target machine that is implemented with the LLVM target-independent code gener...
void setMachineOutliner(bool Enable)
ABI getTargetABI(StringRef ABIName)
Triple - Helper class for working with autoconf configuration names.
PassManagerBase - An abstract interface to allow code to add passes to a pass manager without having ...
#define LLVM_EXTERNAL_VISIBILITY
This pass is responsible for selecting generic machine instructions to target-specific instructions...
Target - Wrapper for Target specific information.
TargetTransformInfo getTargetTransformInfo(const Function &F) override
Get a TargetTransformInfo implementation for the target.
StringRef getABIName() const
getABIName - If this returns a non-empty string this represents the textual name of the ABI that we w...
StringRef getValueAsString() const
Return the attribute's value as a string.
bool isArch64Bit() const
Test whether the architecture is 64-bit.
static StringRef computeDataLayout(const Triple &TT)
FunctionPass * createRISCVMergeBaseOffsetOptPass()
Returns an instance of the Merge Base Offset Optimization pass.
FunctionPass * createRISCVExpandPseudoPass()
RISCVTargetMachine(const Target &T, const Triple &TT, StringRef CPU, StringRef FS, const TargetOptions &Options, Optional< Reloc::Model > RM, Optional< CodeModel::Model > CM, CodeGenOpt::Level OL, bool JIT)
This file declares the IRTranslator pass.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
Module * getParent()
Get the module that this global value is contained inside of...
TargetPassConfig * createPassConfig(PassManagerBase &PM) override
Create a pass configuration object to be used by addPassToEmitX methods for generating a pipeline of ...
Attribute getFnAttribute(Attribute::AttrKind Kind) const
Return the attribute for the given attribute kind.
StringRef - Represent a constant reference to a string, i.e.
This implementation is used for RISCV ELF targets.
FunctionPass * createAtomicExpandPass()
void initializeGlobalISel(PassRegistry &)
Initialize all passes linked into the GlobalISel library.