mips16/nomips16 attributes - please review

Bill Wendling wendling at apple.com
Tue Mar 12 16:10:46 PDT 2013


Hi Reed,

This is a lot of code just to add one function attribute (not your fault, but mine). Instead of generating an AttrBuilder etc., could you add a convenience function to the Function and AttributeSet objects that add a string attribute --- it would be very similar to how Attribute::AttrKinds are currently added. That would clean up this code quite nicely. Of course, if you end up adding a lot of attributes in this method, then you'll want to revert to using the "AttrBuilder" for that.

As for the code itself, you might want to use an early exit like this:

  const FunctionDecl *FD = dyn_cast<FunctionDecl>(D);
  if (!FD) return;

  // Code that sets the attributes ...

-bw

On Mar 12, 2013, at 1:44 PM, Reed Kotler <rkotler at mips.com> wrote:

> Use the new attribute scheme to pass mips16/nomips16 attributes from clang to llvm
> 
> 
> <mips16_attrn.txt>




More information about the cfe-commits mailing list