[llvm-commits] [llvm] r104737 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp

Bill Wendling isanbard at gmail.com
Wed May 26 14:03:42 PDT 2010


Should I remve savectx as well?

-bw

On May 26, 2010, at 1:48 PM, Evan Cheng wrote:

> Definitely not vfork. That's unnecessary. gcc is mistaken, we shouldn't follow it. Also, getcontext is such a generic name. It's a really bad idea to look for it.
> 
> Evan
> 
> On May 26, 2010, at 1:39 PM, Bill Wendling wrote:
> 
>> Author: void
>> Date: Wed May 26 15:39:00 2010
>> New Revision: 104737
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=104737&view=rev
>> Log:
>> Add "setjmp_syscall", "savectx", "qsetjmp", "vfork", "getcontext" to the list of
>> usual suspects that could "return twice".
>> 
>> Modified:
>>   llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
>> 
>> Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=104737&r1=104736&r2=104737&view=diff
>> ==============================================================================
>> --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original)
>> +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Wed May 26 15:39:00 2010
>> @@ -193,31 +193,34 @@
>> }
>> 
>> /// FunctionCallsSetJmp - Return true if the function has a call to setjmp or
>> -/// sigsetjmp. This is used to limit code-gen optimizations on the machine
>> -/// function.
>> +/// other function that gcc recognizes as "returning twice". This is used to
>> +/// limit code-gen optimizations on the machine function.
>> static bool FunctionCallsSetJmp(const Function *F) {
>>  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<CallInst>(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<CallInst>(I))
>> -        if (CI->getParent()->getParent() == F)
>> -          return true;
>> +  static const char *ReturnsTwiceFns[] = {
>> +    "setjmp",
>> +    "sigsetjmp",
>> +    "setjmp_syscall",
>> +    "savectx",
>> +    "qsetjmp",
>> +    "vfork",
>> +    "getcontext"
>> +  };
>> +#define NUM_RETURNS_TWICE_FNS sizeof(ReturnsTwiceFns) / sizeof(const char *)
>> +
>> +  for (unsigned I = 0; I < NUM_RETURNS_TWICE_FNS; ++I)
>> +    if (const Function *Callee = M->getFunction(ReturnsTwiceFns[I])) {
>> +      if (!Callee->use_empty())
>> +        for (Value::const_use_iterator
>> +               I = Callee->use_begin(), E = Callee->use_end();
>> +             I != E; ++I)
>> +          if (const CallInst *CI = dyn_cast<CallInst>(I))
>> +            if (CI->getParent()->getParent() == F)
>> +              return true;
>> +    }
>> 
>>  return false;
>> +#undef NUM_RETURNS_TWICE_FNS
>> }
>> 
>> bool SelectionDAGISel::runOnMachineFunction(MachineFunction &mf) {
>> 
>> 
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits





More information about the llvm-commits mailing list