[llvm-commits] [llvm] r146664 - in /llvm/trunk/lib/Target/PowerPC: PPCHazardRecognizers.cpp PPCHazardRecognizers.h
Hal Finkel
hfinkel at anl.gov
Thu Dec 15 09:54:01 PST 2011
Author: hfinkel
Date: Thu Dec 15 11:54:01 2011
New Revision: 146664
URL: http://llvm.org/viewvc/llvm-project?rev=146664&view=rev
Log:
Ensure that the nop that should follow a bl call in PPC64 ELF actually does
Modified:
llvm/trunk/lib/Target/PowerPC/PPCHazardRecognizers.cpp
llvm/trunk/lib/Target/PowerPC/PPCHazardRecognizers.h
Modified: llvm/trunk/lib/Target/PowerPC/PPCHazardRecognizers.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCHazardRecognizers.cpp?rev=146664&r1=146663&r2=146664&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCHazardRecognizers.cpp (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCHazardRecognizers.cpp Thu Dec 15 11:54:01 2011
@@ -61,6 +61,7 @@
PPCHazardRecognizer970::PPCHazardRecognizer970(const TargetInstrInfo &tii)
: TII(tii) {
+ LastWasBL8_ELF = false;
EndDispatchGroup();
}
@@ -132,6 +133,14 @@
unsigned Opcode = MI->getOpcode();
+ // If the last instruction was a BL8_ELF, then the NOP must follow it
+ // directly (this is strong requirement from the linker due to the ELF ABI).
+ // We return only Hazard (and not NoopHazard) because if the NOP is necessary
+ // then it will already be in the instruction stream (it is not always
+ // necessary; tail calls, for example, do not need it).
+ if (LastWasBL8_ELF && Opcode != PPC::NOP)
+ return Hazard;
+
bool isFirst, isSingle, isCracked, isLoad, isStore;
PPCII::PPC970_Unit InstrType =
GetInstrType(Opcode, isFirst, isSingle, isCracked,
@@ -190,6 +199,7 @@
return;
unsigned Opcode = MI->getOpcode();
+ LastWasBL8_ELF = (Opcode == PPC::BL8_ELF);
bool isFirst, isSingle, isCracked, isLoad, isStore;
PPCII::PPC970_Unit InstrType =
@@ -230,6 +240,7 @@
}
void PPCHazardRecognizer970::Reset() {
+ LastWasBL8_ELF = false;
EndDispatchGroup();
}
Modified: llvm/trunk/lib/Target/PowerPC/PPCHazardRecognizers.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCHazardRecognizers.h?rev=146664&r1=146663&r2=146664&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCHazardRecognizers.h (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCHazardRecognizers.h Thu Dec 15 11:54:01 2011
@@ -49,6 +49,9 @@
// HasCTRSet - If the CTR register is set in this group, disallow BCTRL.
bool HasCTRSet;
+ // Was the last instruction issued a BL8_ELF
+ bool LastWasBL8_ELF;
+
// StoredPtr - Keep track of the address of any store. If we see a load from
// the same address (or one that aliases it), disallow the store. We can have
// up to four stores in one dispatch group, hence we track up to 4.
More information about the llvm-commits
mailing list