[llvm] r265716 - [GlobalISel] Add RegBankSelect hooks into the pass pipeline.
Quentin Colombet via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 7 13:27:33 PDT 2016
Author: qcolombet
Date: Thu Apr 7 15:27:33 2016
New Revision: 265716
URL: http://llvm.org/viewvc/llvm-project?rev=265716&view=rev
Log:
[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.
Modified:
llvm/trunk/include/llvm/CodeGen/Passes.h
llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp
llvm/trunk/lib/Target/AArch64/AArch64TargetMachine.cpp
Modified: llvm/trunk/include/llvm/CodeGen/Passes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/Passes.h?rev=265716&r1=265715&r2=265716&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/Passes.h (original)
+++ llvm/trunk/include/llvm/CodeGen/Passes.h Thu Apr 7 15:27:33 2016
@@ -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();
Modified: llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp?rev=265716&r1=265715&r2=265716&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp (original)
+++ llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp Thu Apr 7 15:27:33 2016
@@ -143,6 +143,14 @@ addPassesToGenerateCode(LLVMTargetMachin
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;
Modified: llvm/trunk/lib/Target/AArch64/AArch64TargetMachine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/AArch64TargetMachine.cpp?rev=265716&r1=265715&r2=265716&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AArch64/AArch64TargetMachine.cpp (original)
+++ llvm/trunk/lib/Target/AArch64/AArch64TargetMachine.cpp Thu Apr 7 15:27:33 2016
@@ -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() {
More information about the llvm-commits
mailing list