aboutsummaryrefslogtreecommitdiff
path: root/lib/Target/Mips/MipsDelaySlotFiller.cpp
diff options
context:
space:
mode:
authorPetar Jovanovic <petar.jovanovic@rt-rk.com>2013-07-24 02:42:25 +0200
committerPetar Jovanovic <petar.jovanovic@rt-rk.com>2013-07-24 02:42:25 +0200
commitc7c01162adebb1df35707a8833ec6e0b1e5eaf6f (patch)
treef0a38ea80052fff8dbc21ac5ac28b891eb63ba51 /lib/Target/Mips/MipsDelaySlotFiller.cpp
parent2aa406809bb6875ff48fc5e3a68e48e6dd62258a (diff)
[MIPS] Fix LLVM merge issues
Several parts of the already in-place code have been omitted in the previous merge. These are: - missing lowering of Intrinsic::nacl_read_tp; - checks for forbidden instructiosn in branch-delay slots; - lowering operation for ISD::NACL_TP_TLS_OFFSET and ISD::NACL_TP_TDB_OFFSET. BUG= https://code.google.com/p/nativeclient/issues/detail?id=2275 TEST= run smoke tests R=eliben@chromium.org Review URL: https://codereview.chromium.org/19614006
Diffstat (limited to 'lib/Target/Mips/MipsDelaySlotFiller.cpp')
-rw-r--r--lib/Target/Mips/MipsDelaySlotFiller.cpp24
1 files changed, 22 insertions, 2 deletions
diff --git a/lib/Target/Mips/MipsDelaySlotFiller.cpp b/lib/Target/Mips/MipsDelaySlotFiller.cpp
index d07a595af3..f5bb945592 100644
--- a/lib/Target/Mips/MipsDelaySlotFiller.cpp
+++ b/lib/Target/Mips/MipsDelaySlotFiller.cpp
@@ -527,6 +527,11 @@ FunctionPass *llvm::createMipsDelaySlotFillerPass(MipsTargetMachine &tm) {
return new Filler(tm);
}
+// @LOCALMOD-START
+extern bool IsDangerousLoad(const MachineInstr &MI, int *AddrIdx);
+extern bool IsDangerousStore(const MachineInstr &MI, int *AddrIdx);
+// @LOCALMOD-END
+
template<typename IterTy>
bool Filler::searchRange(MachineBasicBlock &MBB, IterTy Begin, IterTy End,
RegDefsUses &RegDU, InspectMemInstr& IM,
@@ -536,8 +541,23 @@ bool Filler::searchRange(MachineBasicBlock &MBB, IterTy Begin, IterTy End,
if (I->isDebugValue())
continue;
- if (terminateSearch(*I))
- break;
+ // @LOCALMOD-START
+ // Don't put in delay slot instructions that could be masked.
+ // Should not allow:
+ // ERET, DERET or WAIT, PAUSE. Need to add these to instruction
+ // list. TBD.
+ if (Triple(TM.getTargetTriple()).isOSNaCl()) {
+ int Dummy;
+ if (terminateSearch(*I) || (IsDangerousLoad(*I, &Dummy)
+ || IsDangerousStore(*I, &Dummy)
+ || I->modifiesRegister(Mips::SP,
+ TM.getRegisterInfo())))
+ break;
+ } else {
+ if (terminateSearch(*I))
+ break;
+ }
+ // @LOCALMOD-END
assert((!I->isCall() && !I->isReturn() && !I->isBranch()) &&
"Cannot put calls, returns or branches in delay slot.");