diff options
author | Petar Jovanovic <petarj@mips.com> | 2012-10-23 14:24:03 -0700 |
---|---|---|
committer | Derek Schuff <dschuff@chromium.org> | 2012-10-23 14:24:03 -0700 |
commit | 56f8ef8fa45d5f444766f52cdeb956982578f1b5 (patch) | |
tree | e5d6a231a1db37cbdc86c3c7a8ad9cfcdd0dce38 /lib/Target/Mips/MipsDelaySlotFiller.cpp | |
parent | 4ce160aa277821da7b43fb457672a625facbad12 (diff) |
[MIPS] Update sandboxing changes for LLVM on MIPS.
This change
- resolves conflicts from previous merges;
- prevents delay slot filler to use instructions that could be masked;
- generates calls to __nacl_read_tp to access thread pointer;
- removes previous (now obsolete) sandboxing code of unaligned loads and stores;
- propagates relocation model to MipsELFObjectWriter, so that it can set
flag ELF::EF_MIPS_PIC (small hack).
BUG= http://code.google.com/p/nativeclient/issues/detail?id=2275
TEST= pnacl/build.sh all
Review URL: https://codereview.chromium.org/11115013
Patch from Petar Jovanovic <petarj@mips.com>.
Diffstat (limited to 'lib/Target/Mips/MipsDelaySlotFiller.cpp')
-rw-r--r-- | lib/Target/Mips/MipsDelaySlotFiller.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/Target/Mips/MipsDelaySlotFiller.cpp b/lib/Target/Mips/MipsDelaySlotFiller.cpp index e3c8ed75cf..d014ba1792 100644 --- a/lib/Target/Mips/MipsDelaySlotFiller.cpp +++ b/lib/Target/Mips/MipsDelaySlotFiller.cpp @@ -141,6 +141,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 + bool Filler::findDelayInstr(MachineBasicBlock &MBB, InstrIter slot, InstrIter &Filler) { @@ -160,11 +165,18 @@ bool Filler::findDelayInstr(MachineBasicBlock &MBB, // Convert to forward iterator. InstrIter FI(llvm::next(I).base()); + int Dummy; // @LOCALMOD if (I->hasUnmodeledSideEffects() || I->isInlineAsm() || I->isLabel() || FI == LastFiller || I->isPseudo() + // @LOCALMOD-START + // Don't put in delay slot instructions that could be masked. + || IsDangerousLoad(*FI, &Dummy) + || IsDangerousStore(*FI, &Dummy) + || FI->modifiesRegister(Mips::SP, TM.getRegisterInfo()) + // @LOCALMOD-END // // Should not allow: // ERET, DERET or WAIT, PAUSE. Need to add these to instruction |