diff options
author | Derek Schuff <dschuff@chromium.org> | 2013-02-04 10:44:25 -0800 |
---|---|---|
committer | Derek Schuff <dschuff@chromium.org> | 2013-02-04 10:44:25 -0800 |
commit | 334e37be3e88c1d125bc833531a7d3056cc606a9 (patch) | |
tree | cd83c10664d0282d2dfb3148686f3a0f14e5476e | |
parent | 80abe0746cec97dd07ba74db157e85f6e83487a2 (diff) | |
parent | 8bdbdf71c987b7604a178c1ebabfab3d22c0e85b (diff) |
Merge remote-tracking branch 'origin/master'
-rw-r--r-- | include/llvm/CodeGen/LexicalScopes.h | 2 | ||||
-rw-r--r-- | include/llvm/Support/ValueHandle.h | 8 | ||||
-rw-r--r-- | lib/Target/ARM/ARMNaClRewritePass.cpp | 68 | ||||
-rw-r--r-- | lib/Target/X86/X86InstrInfo.cpp | 1 | ||||
-rw-r--r-- | lib/Target/X86/X86NaClRewritePass.cpp | 32 |
5 files changed, 61 insertions, 50 deletions
diff --git a/include/llvm/CodeGen/LexicalScopes.h b/include/llvm/CodeGen/LexicalScopes.h index 30f167d8f4..04710bc448 100644 --- a/include/llvm/CodeGen/LexicalScopes.h +++ b/include/llvm/CodeGen/LexicalScopes.h @@ -164,8 +164,10 @@ public: #endif // @LOCALMOD-BEGIN -- Hack for bug // http://code.google.com/p/nativeclient/issues/detail?id=2786 +#ifndef NDEBUG Desc.make_weak(); InlinedAtLocation.make_weak(); +#endif // @LOCALMOD-END if (Parent) diff --git a/include/llvm/Support/ValueHandle.h b/include/llvm/Support/ValueHandle.h index 97ce6f6957..7019c417e8 100644 --- a/include/llvm/Support/ValueHandle.h +++ b/include/llvm/Support/ValueHandle.h @@ -240,10 +240,16 @@ public: // @LOCALMOD-BEGIN -- Hack for bug: // http://code.google.com/p/nativeclient/issues/detail?id=2786 // This allows us to weaken the Asserting Value Handle in LexicalScopes.h, - // for Debug info only. + // for Debug info only. FIXME: check if this is fixed by some upstream + // changes, e.g., r174084. Test by building the full ARM IRT w/ debug + // info, and dosbox with full debug info. +#ifndef NDEBUG + // Only enable for !defined(NDEBUG), since this only inherits from + // ValueHandleBase when !defined(NDEBUG). void make_weak() { setKind(Weak); } +#endif // @LOCALMOD-END ValueTy *operator->() const { return getValPtr(); } diff --git a/lib/Target/ARM/ARMNaClRewritePass.cpp b/lib/Target/ARM/ARMNaClRewritePass.cpp index 317b84a5da..497baebec8 100644 --- a/lib/Target/ARM/ARMNaClRewritePass.cpp +++ b/lib/Target/ARM/ARMNaClRewritePass.cpp @@ -121,23 +121,28 @@ static bool IsDirectCall(const MachineInstr &MI) { } static void DumpInstructionVerbose(const MachineInstr &MI) { - dbgs() << MI; - dbgs() << MI.getNumOperands() << " operands:" << "\n"; - for (unsigned i = 0; i < MI.getNumOperands(); ++i) { - const MachineOperand& op = MI.getOperand(i); - dbgs() << " " << i << "(" << op.getType() << "):" << op << "\n"; - } - dbgs() << "\n"; + DEBUG({ + dbgs() << MI; + dbgs() << MI.getNumOperands() << " operands:" << "\n"; + for (unsigned i = 0; i < MI.getNumOperands(); ++i) { + const MachineOperand& op = MI.getOperand(i); + dbgs() << " " << i << "(" << op.getType() << "):" << op << "\n"; + } + dbgs() << "\n"; + }); } static void DumpBasicBlockVerbose(const MachineBasicBlock &MBB) { - dbgs() << "\n<<<<< DUMP BASIC BLOCK START\n"; - for (MachineBasicBlock::const_iterator MBBI = MBB.begin(), MBBE = MBB.end(); - MBBI != MBBE; - ++MBBI) { - DumpInstructionVerbose(*MBBI); - } - dbgs() << "<<<<< DUMP BASIC BLOCK END\n\n"; + DEBUG({ + dbgs() << "\n<<<<< DUMP BASIC BLOCK START\n"; + for (MachineBasicBlock::const_iterator + MBBI = MBB.begin(), MBBE = MBB.end(); + MBBI != MBBE; + ++MBBI) { + DumpInstructionVerbose(*MBBI); + } + dbgs() << "<<<<< DUMP BASIC BLOCK END\n\n"; + }); } /**********************************************************************/ @@ -301,25 +306,24 @@ void ARMNaClRewritePass::getAnalysisUsage(AnalysisUsage &AU) const { * E.g., it could be used along with bugpoint to reduce a bitcode file. */ void ARMNaClRewritePass::LightweightVerify(MachineFunction &MF) { - - for (MachineFunction::iterator MFI = MF.begin(), MFE = MF.end(); - MFI != MFE; - ++MFI) { - MachineBasicBlock &MBB = *MFI; - for (MachineBasicBlock::iterator MBBI = MBB.begin(), MBBE = MBB.end(); - MBBI != MBBE; - ++MBBI) { - MachineInstr &MI = *MBBI; - - if (ARM_SFI::NeedSandboxStackChange(MI, TRI)) { - dbgs() << "LightWeightVerify for function: " - << MF.getFunction()->getName() << " (BAD STACK CHANGE)\n"; - DumpInstructionVerbose(MI); - DumpBasicBlockVerbose(MBB); - // assert(false && "LightweightVerify Failed"); + DEBUG({ + for (MachineFunction::iterator MFI = MF.begin(), MFE = MF.end(); + MFI != MFE; + ++MFI) { + MachineBasicBlock &MBB = *MFI; + for (MachineBasicBlock::iterator MBBI = MBB.begin(), MBBE = MBB.end(); + MBBI != MBBE; + ++MBBI) { + MachineInstr &MI = *MBBI; + if (ARM_SFI::NeedSandboxStackChange(MI, TRI)) { + dbgs() << "LightWeightVerify for function: " + << MF.getFunction()->getName() << " (BAD STACK CHANGE)\n"; + DumpInstructionVerbose(MI); + DumpBasicBlockVerbose(MBB); + } + } } - } - } + }); } void ARMNaClRewritePass::SandboxStackChange(MachineBasicBlock &MBB, diff --git a/lib/Target/X86/X86InstrInfo.cpp b/lib/Target/X86/X86InstrInfo.cpp index 0e833ffb73..4469e1a929 100644 --- a/lib/Target/X86/X86InstrInfo.cpp +++ b/lib/Target/X86/X86InstrInfo.cpp @@ -2901,7 +2901,6 @@ void X86InstrInfo::copyPhysReg(MachineBasicBlock &MBB, DEBUG(dbgs() << "Cannot copy " << RI.getName(SrcReg) << " to " << RI.getName(DestReg) << '\n'); - MBB.dump(); llvm_unreachable("Cannot emit physreg copy instruction"); } diff --git a/lib/Target/X86/X86NaClRewritePass.cpp b/lib/Target/X86/X86NaClRewritePass.cpp index 7310dcd77a..846c72f452 100644 --- a/lib/Target/X86/X86NaClRewritePass.cpp +++ b/lib/Target/X86/X86NaClRewritePass.cpp @@ -79,7 +79,6 @@ namespace { bool ApplyControlSFI(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI); - void PassLightWeightValidator(MachineBasicBlock &MBB); bool AlignJumpTableTargets(MachineFunction &MF); }; @@ -87,7 +86,17 @@ namespace { } -static void DumpInstructionVerbose(const MachineInstr &MI); +static void DumpInstructionVerbose(const MachineInstr &MI) { + DEBUG({ + dbgs() << MI; + dbgs() << MI.getNumOperands() << " operands:" << "\n"; + for (unsigned i = 0; i < MI.getNumOperands(); ++i) { + const MachineOperand& op = MI.getOperand(i); + dbgs() << " " << i << "(" << op.getType() << "):" << op << "\n"; + } + dbgs() << "\n"; + }); +} static bool IsPushPop(MachineInstr &MI) { const unsigned Opcode = MI.getOpcode(); @@ -204,7 +213,8 @@ void X86NaClRewritePass::TraceLog(const char *func, const MachineBasicBlock &MBB, const MachineBasicBlock::iterator MBBI) const { - DEBUG(dbgs() << "@" << func << "(" << MBB.getName() << ", " << (*MBBI) << ")\n"); + DEBUG(dbgs() << "@" << func + << "(" << MBB.getName() << ", " << (*MBBI) << ")\n"); } bool X86NaClRewritePass::ApplyStackSFI(MachineBasicBlock &MBB, @@ -303,7 +313,7 @@ bool X86NaClRewritePass::ApplyStackSFI(MachineBasicBlock &MBB, return true; } - DumpInstructionVerbose(MI); + DEBUG(DumpInstructionVerbose(MI)); llvm_unreachable("Unhandled Stack SFI"); } @@ -389,7 +399,7 @@ bool X86NaClRewritePass::ApplyFrameSFI(MachineBasicBlock &MBB, return true; } - DumpInstructionVerbose(MI); + DEBUG(DumpInstructionVerbose(MI)); llvm_unreachable("Unhandled Frame SFI"); } @@ -480,7 +490,7 @@ bool X86NaClRewritePass::ApplyControlSFI(MachineBasicBlock &MBB, return true; } - DumpInstructionVerbose(MI); + DEBUG(DumpInstructionVerbose(MI)); llvm_unreachable("Unhandled Control SFI"); } @@ -744,16 +754,6 @@ bool X86NaClRewritePass::runOnMachineBasicBlock(MachineBasicBlock &MBB) { return Modified; } -static void DumpInstructionVerbose(const MachineInstr &MI) { - dbgs() << MI; - dbgs() << MI.getNumOperands() << " operands:" << "\n"; - for (unsigned i = 0; i < MI.getNumOperands(); ++i) { - const MachineOperand& op = MI.getOperand(i); - dbgs() << " " << i << "(" << op.getType() << "):" << op << "\n"; - } - dbgs() << "\n"; -} - /// createX86NaClRewritePassPass - returns an instance of the pass. namespace llvm { FunctionPass* createX86NaClRewritePass() { |