mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-11-23 00:20:25 +00:00
Generate PPC early conditional returns
PowerPC has a conditional branch to the link register (return) instruction: BCLR. This should be used any time when we'd otherwise have a conditional branch to a return. This adds a small pass, PPCEarlyReturn, which runs just prior to the branch selection pass (and, importantly, after block placement) to generate these conditional returns when possible. It will also eliminate unconditional branches to returns (these happen rarely; most of the time these have already been tail duplicated by the time PPCEarlyReturn is invoked). This is a nice optimization for small functions that do not maintain a stack frame. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@179026 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -124,6 +124,8 @@ bool PPCPassConfig::addInstSelector() {
|
||||
}
|
||||
|
||||
bool PPCPassConfig::addPreEmitPass() {
|
||||
if (getOptLevel() != CodeGenOpt::None)
|
||||
addPass(createPPCEarlyReturnPass());
|
||||
// Must run branch selection immediately preceding the asm printer.
|
||||
addPass(createPPCBranchSelectionPass());
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user