On Feb 16, 2008, at 12:56 PM, Duncan Sands wrote:
> Remove any 'nest' parameter attributes if the function
> is not passed as an argument to a trampoline intrinsic.

Nice.  Out of curiousity, how does nest do to codegen?

> +static const ParamAttrsList *StripNest(const ParamAttrsList *Attrs) {
> +  if (Attrs) {
> +    for (unsigned i = 0, e = Attrs->size(); i != e; ++i) {
> +      uint16_t A = Attrs->getParamAttrsAtIndex(i);
> +      if (A & ParamAttr::Nest) {

How about:
   if ((A & ParamAttr::Nest) == 0) continue;

To avoid indentation in the loop.  Alternatively, maybe ParamAttrsList  
should have a 'find attribute' function that returns the first  
argument that has the specified attribute?

> +static void RemoveNestAttribute(Function *F) {
> +  F->setParamAttrs(StripNest(F->getParamAttrs()));
> +  for (Value::use_iterator UI = F->use_begin(), E = F->use_end();  
> UI != E;++UI){
> +    Instruction *User = cast<Instruction>(*UI);

> +    if (CallInst *CI = dyn_cast<CallInst>(User)) {

Please use CallSite to handle CallInst/Invoke uniformly.

Thanks Duncan!

-Chris
_______________________________________________
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

Reply via email to