mirror of
https://github.com/RPCSX/llvm.git
synced 2024-11-28 14:10:41 +00:00
[PBQP] Teach PassConfig to tell if the default register allocator is used.
This enables targets to adapt their pass pipeline to the register allocator in use. For example, with the AArch64 backend, using PBQP with the cortex-a57, the FPLoadBalancing pass is no longer necessary. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220321 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
2256b352be
commit
de246de958
@ -178,6 +178,10 @@ public:
|
||||
/// Return true if the optimized regalloc pipeline is enabled.
|
||||
bool getOptimizeRegAlloc() const;
|
||||
|
||||
/// Return true if the default global register allocator is in use and
|
||||
/// has not be overriden on the command line with '-regalloc=...'
|
||||
bool usingDefaultRegAlloc() const;
|
||||
|
||||
/// Add common target configurable passes that perform LLVM IR to IR
|
||||
/// transforms following machine independent optimization.
|
||||
virtual void addIRPasses();
|
||||
|
@ -690,6 +690,12 @@ FunctionPass *TargetPassConfig::createRegAllocPass(bool Optimized) {
|
||||
return createTargetRegisterAllocator(Optimized);
|
||||
}
|
||||
|
||||
/// Return true if the default global register allocator is in use and
|
||||
/// has not be overriden on the command line with '-regalloc=...'
|
||||
bool TargetPassConfig::usingDefaultRegAlloc() const {
|
||||
return RegAlloc == &useDefaultRegisterAllocator;
|
||||
}
|
||||
|
||||
/// Add the minimum set of target-independent passes that are required for
|
||||
/// register allocation. No coalescing or scheduling.
|
||||
void TargetPassConfig::addFastRegAlloc(FunctionPass *RegAllocPass) {
|
||||
|
@ -75,11 +75,6 @@ EnableCondOpt("aarch64-condopt",
|
||||
cl::desc("Enable the condition optimizer pass"),
|
||||
cl::init(true), cl::Hidden);
|
||||
|
||||
static cl::opt<bool>
|
||||
EnablePBQP("aarch64-pbqp", cl::Hidden,
|
||||
cl::desc("Use PBQP register allocator (experimental)"),
|
||||
cl::init(false));
|
||||
|
||||
static cl::opt<bool>
|
||||
EnableA53Fix835769("aarch64-fix-cortex-a53-835769", cl::Hidden,
|
||||
cl::desc("Work around Cortex-A53 erratum 835769"),
|
||||
@ -101,14 +96,8 @@ AArch64TargetMachine::AArch64TargetMachine(const Target &T, StringRef TT,
|
||||
CodeGenOpt::Level OL,
|
||||
bool LittleEndian)
|
||||
: LLVMTargetMachine(T, TT, CPU, FS, Options, RM, CM, OL),
|
||||
Subtarget(TT, CPU, FS, *this, LittleEndian), isLittle(LittleEndian),
|
||||
usingPBQP(false) {
|
||||
Subtarget(TT, CPU, FS, *this, LittleEndian), isLittle(LittleEndian) {
|
||||
initAsmInfo();
|
||||
|
||||
if (EnablePBQP && Subtarget.isCortexA57() && OL != CodeGenOpt::None) {
|
||||
usingPBQP = true;
|
||||
RegisterRegAlloc::setDefault(createDefaultPBQPRegisterAllocator);
|
||||
}
|
||||
}
|
||||
|
||||
const AArch64Subtarget *
|
||||
@ -263,7 +252,7 @@ bool AArch64PassConfig::addPostRegAlloc() {
|
||||
addPass(createAArch64DeadRegisterDefinitions());
|
||||
if (TM->getOptLevel() != CodeGenOpt::None &&
|
||||
TM->getSubtarget<AArch64Subtarget>().isCortexA57() &&
|
||||
!static_cast<const AArch64TargetMachine *>(TM)->isPBQPUsed())
|
||||
usingDefaultRegAlloc())
|
||||
// Improve performance for some FP/SIMD code for A57.
|
||||
addPass(createAArch64A57FPLoadBalancing());
|
||||
return true;
|
||||
|
@ -43,12 +43,8 @@ public:
|
||||
/// \brief Register AArch64 analysis passes with a pass manager.
|
||||
void addAnalysisPasses(PassManagerBase &PM) override;
|
||||
|
||||
/// \brief Query if the PBQP register allocator is being used
|
||||
bool isPBQPUsed() const { return usingPBQP; }
|
||||
|
||||
private:
|
||||
bool isLittle;
|
||||
bool usingPBQP;
|
||||
};
|
||||
|
||||
// AArch64leTargetMachine - AArch64 little endian target machine.
|
||||
|
@ -1,9 +1,9 @@
|
||||
; RUN: llc -mtriple=aarch64-linux-gnu -mcpu=cortex-a57 -aarch64-pbqp -o - %s | FileCheck %s
|
||||
; RUN: llc -mtriple=aarch64-linux-gnu -mcpu=cortex-a57 -regalloc=pbqp -pbqp-coalescing -o - %s | FileCheck %s
|
||||
|
||||
define i32 @foo(i32 %a) {
|
||||
; CHECK-LABEL: foo:
|
||||
; CHECK: bl bar
|
||||
; CHECK-NEXT: bl baz
|
||||
; CHECK: bl baz
|
||||
%call = call i32 @bar(i32 %a)
|
||||
%call1 = call i32 @baz(i32 %call)
|
||||
ret i32 %call1
|
||||
|
Loading…
Reference in New Issue
Block a user