34#define DEBUG_TYPE "m68k"
50 std::optional<Reloc::Model> RM) {
72 std::optional<Reloc::Model>
RM,
73 std::optional<CodeModel::Model> CM,
79 Subtarget(TT, CPU, FS, *this) {
87 Attribute CPUAttr =
F.getFnAttribute(
"target-cpu");
88 Attribute FSAttr =
F.getFnAttribute(
"target-features");
93 auto &
I = SubtargetMap[CPU + FS];
99 I = std::make_unique<M68kSubtarget>(
TargetTriple, CPU, FS, *
this);
125 const M68kSubtarget &getM68kSubtarget()
const {
126 return *getM68kTargetMachine().getSubtargetImpl();
128 void addIRPasses()
override;
129 bool addIRTranslator()
override;
130 bool addLegalizeMachineIR()
override;
131 bool addRegBankSelect()
override;
132 bool addGlobalInstructionSelect()
override;
133 bool addInstSelector()
override;
134 void addPreSched2()
override;
135 void addPreEmitPass()
override;
140 return new M68kPassConfig(*
this, PM);
143void M68kPassConfig::addIRPasses() {
148bool M68kPassConfig::addInstSelector() {
155bool M68kPassConfig::addIRTranslator() {
160bool M68kPassConfig::addLegalizeMachineIR() {
165bool M68kPassConfig::addRegBankSelect() {
170bool M68kPassConfig::addGlobalInstructionSelect() {
177void M68kPassConfig::addPreEmitPass() {
#define LLVM_EXTERNAL_VISIBILITY
This file declares the IRTranslator pass.
This file declares the M68k specific subclass of MachineFunctionInfo.
This file declares the M68k specific subclass of TargetSubtargetInfo.
LLVM_EXTERNAL_VISIBILITY void LLVMInitializeM68kTarget()
This file declares the M68k specific subclass of TargetMachine.
This file contains declarations for M68k ELF object file lowering.
This file contains the entry points for global functions defined in the M68k target library,...
This file describes the interface of the MachineFunctionPass responsible for assigning the generic vi...
const GCNTargetMachine & getTM(const GCNSubtarget *STI)
static TableGen::Emitter::OptClass< SkeletonEmitter > X("gen-skeleton-class", "Generate example skeleton class")
Target-Independent Code Generator Pass Configuration Options pass.
Functions, function parameters, and return types can have attributes to indicate how they should be t...
LLVM_ABI StringRef getValueAsString() const
Return the attribute's value as a string.
bool isValid() const
Return true if the attribute is any kind of attribute.
CodeGenTargetMachineImpl(const Target &T, StringRef DataLayoutString, const Triple &TT, StringRef CPU, StringRef FS, const TargetOptions &Options, Reloc::Model RM, CodeModel::Model CM, CodeGenOptLevel OL)
This pass is responsible for selecting generic machine instructions to target-specific instructions.
~M68kTargetMachine() override
const M68kSubtarget * getSubtargetImpl() const
MachineFunctionInfo * createMachineFunctionInfo(BumpPtrAllocator &Allocator, const Function &F, const TargetSubtargetInfo *STI) const override
Create the target's instance of MachineFunctionInfo.
M68kTargetMachine(const Target &T, const Triple &TT, StringRef CPU, StringRef FS, const TargetOptions &Options, std::optional< Reloc::Model > RM, std::optional< CodeModel::Model > CM, CodeGenOptLevel OL, bool JIT)
TargetPassConfig * createPassConfig(PassManagerBase &PM) override
Create a pass configuration object to be used by addPassToEmitX methods for generating a pipeline of ...
static LLVM_ABI PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
This pass implements the reg bank selector pass used in the GlobalISel pipeline.
StringRef - Represent a constant reference to a string, i.e.
std::string str() const
str - Get the contents as an std::string.
Triple TargetTriple
Triple string, CPU name, and target feature strings the TargetMachine instance is created with.
std::unique_ptr< const MCSubtargetInfo > STI
void resetTargetOptions(const Function &F) const
Reset the target options based on the function's attributes.
Target-Independent Code Generator Pass Configuration Options.
virtual void addIRPasses()
Add common target configurable passes that perform LLVM IR to IR transforms following machine indepen...
TargetSubtargetInfo - Generic base class for all target subtargets.
Target - Wrapper for Target specific information.
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_unreachable(msg)
Marks that the current location is not supposed to be reachable.
This is an optimization pass for GlobalISel generic memory operations.
void initializeM68kGlobalBaseRegPass(PassRegistry &)
void initializeM68kExpandPseudoPass(PassRegistry &)
void initializeM68kCollapseMOVEMPass(PassRegistry &)
FunctionPass * createM68kGlobalBaseRegPass()
This pass initializes a global base register for PIC on M68k.
static Reloc::Model getEffectiveRelocModel(std::optional< Reloc::Model > RM)
CodeModel::Model getEffectiveCodeModel(std::optional< CodeModel::Model > CM, CodeModel::Model Default)
Helper method for getting the code model, returning Default if CM does not have a value.
FunctionPass * createM68kCollapseMOVEMPass()
Finds sequential MOVEM instruction and collapse them into a single one.
FunctionPass * createM68kISelDag(M68kTargetMachine &TM)
This pass converts a legalized DAG into a M68k-specific DAG, ready for instruction scheduling.
BumpPtrAllocatorImpl BumpPtrAllocator
The standard BumpPtrAllocator which just uses the default template parameters.
CodeGenOptLevel
Code generation optimization level.
void initializeM68kDAGToDAGISelLegacyPass(PassRegistry &)
LLVM_ABI void initializeGlobalISel(PassRegistry &)
Initialize all passes linked into the GlobalISel library.
Target & getTheM68kTarget()
FunctionPass * createM68kExpandPseudoPass()
Return a Machine IR pass that expands M68k-specific pseudo instructions into a sequence of actual ins...
LLVM_ABI FunctionPass * createAtomicExpandLegacyPass()
AtomicExpandPass - At IR level this pass replace atomic instructions with __atomic_* library calls,...
void initializeM68kAsmPrinterPass(PassRegistry &)
Implement std::hash so that hash_code can be used in STL containers.
MachineFunctionInfo - This class can be derived from and used by targets to hold private target-speci...
static FuncInfoTy * create(BumpPtrAllocator &Allocator, const Function &F, const SubtargetTy *STI)
Factory function: default behavior is to call new using the supplied allocator.
RegisterTargetMachine - Helper template for registering a target machine implementation,...