From 0c3bfd3fb06e39578a98d9a60acb60cb3293d6e6 Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Wed, 26 May 2010 19:46:12 +0000 Subject: Move the check for "calls setjmp" to SelectionDAGISel so that it can be used by more than just the stack slot coloring algorithm. llvm-svn: 104722 --- llvm/lib/CodeGen/StackSlotColoring.cpp | 33 +-------------------------------- 1 file changed, 1 insertion(+), 32 deletions(-) (limited to 'llvm/lib/CodeGen/StackSlotColoring.cpp') diff --git a/llvm/lib/CodeGen/StackSlotColoring.cpp b/llvm/lib/CodeGen/StackSlotColoring.cpp index 80435563498..7f3b452f0a5 100644 --- a/llvm/lib/CodeGen/StackSlotColoring.cpp +++ b/llvm/lib/CodeGen/StackSlotColoring.cpp @@ -162,34 +162,6 @@ namespace { }; } -/// CheckForSetJmpCall - Return true if there's a call to setjmp/sigsetjmp in -/// this function. -bool StackSlotColoring::CheckForSetJmpCall(const MachineFunction &MF) const { - const Function *F = MF.getFunction(); - const Module *M = F->getParent(); - const Function *SetJmp = M->getFunction("setjmp"); - const Function *SigSetJmp = M->getFunction("sigsetjmp"); - - if (!SetJmp && !SigSetJmp) - return false; - - if (SetJmp && !SetJmp->use_empty()) - for (Value::const_use_iterator - I = SetJmp->use_begin(), E = SetJmp->use_end(); I != E; ++I) - if (const CallInst *CI = dyn_cast(I)) - if (CI->getParent()->getParent() == F) - return true; - - if (SigSetJmp && !SigSetJmp->use_empty()) - for (Value::const_use_iterator - I = SigSetJmp->use_begin(), E = SigSetJmp->use_end(); I != E; ++I) - if (const CallInst *CI = dyn_cast(I)) - if (CI->getParent()->getParent() == F) - return true; - - return false; -} - /// ScanForSpillSlotRefs - Scan all the machine instructions for spill slot /// references and update spill slot weights. void StackSlotColoring::ScanForSpillSlotRefs(MachineFunction &MF) { @@ -757,10 +729,7 @@ bool StackSlotColoring::runOnMachineFunction(MachineFunction &MF) { // coloring. The stack could be modified before the longjmp is executed, // resulting in the wrong value being used afterwards. (See // .) - // - // FIXME: This goes beyond the setjmp/sigsetjmp functions. Ideally, we should - // check for the GCC "returns twice" attribute. - if (CheckForSetJmpCall(MF)) + if (MF.callsSetJmp()) return false; // Gather spill slot references -- cgit v1.2.3