mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-02 00:37:09 +00:00
[GlobalISel] Add RegBankSelect hooks into the pass pipeline.
Now, RegBankSelect will happen after the IRTranslation and the target may optionally add additional passes in between. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265716 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
62aa62a6e9
commit
e8aba9ba83
@ -220,6 +220,15 @@ public:
|
||||
/// LLVM code to machine instructions with possibly generic opcodes.
|
||||
virtual bool addIRTranslator() { return true; }
|
||||
|
||||
/// This method may be implemented by targets that want to run passes
|
||||
/// immediately before the register bank selection.
|
||||
virtual void addPreRegBankSelect() {}
|
||||
|
||||
/// This method should install a register bank selector pass, which
|
||||
/// assigns register banks to virtual registers without a register
|
||||
/// class or register banks.
|
||||
virtual bool addRegBankSelect() { return true; }
|
||||
|
||||
/// Add the complete, standard set of LLVM CodeGen passes.
|
||||
/// Fully developed targets will not generally override this.
|
||||
virtual void addMachinePasses();
|
||||
|
@ -143,6 +143,14 @@ addPassesToGenerateCode(LLVMTargetMachine *TM, PassManagerBase &PM,
|
||||
if (LLVM_UNLIKELY(EnableGlobalISel)) {
|
||||
if (PassConfig->addIRTranslator())
|
||||
return nullptr;
|
||||
|
||||
// Before running the register bank selector, ask the target if it
|
||||
// wants to run some passes.
|
||||
PassConfig->addPreRegBankSelect();
|
||||
|
||||
if (PassConfig->addRegBankSelect())
|
||||
return nullptr;
|
||||
|
||||
} else if (PassConfig->addInstSelector())
|
||||
return nullptr;
|
||||
|
||||
|
@ -19,6 +19,7 @@
|
||||
#ifdef LLVM_BUILD_GLOBAL_ISEL
|
||||
# include "llvm/CodeGen/GlobalISel/IRTranslator.h"
|
||||
#endif
|
||||
#include "llvm/CodeGen/GlobalISel/RegBankSelect.h"
|
||||
#include "llvm/CodeGen/Passes.h"
|
||||
#include "llvm/CodeGen/RegAllocRegistry.h"
|
||||
#include "llvm/IR/Function.h"
|
||||
@ -241,6 +242,7 @@ public:
|
||||
bool addInstSelector() override;
|
||||
#ifdef LLVM_BUILD_GLOBAL_ISEL
|
||||
bool addIRTranslator() override;
|
||||
bool addRegBankSelect() override;
|
||||
#endif
|
||||
bool addILPOpts() override;
|
||||
void addPreRegAlloc() override;
|
||||
@ -339,6 +341,10 @@ bool AArch64PassConfig::addIRTranslator() {
|
||||
addPass(new IRTranslator());
|
||||
return false;
|
||||
}
|
||||
bool AArch64PassConfig::addRegBankSelect() {
|
||||
addPass(new RegBankSelect());
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool AArch64PassConfig::addILPOpts() {
|
||||
|
Loading…
Reference in New Issue
Block a user