mips16/nomips16 attributes - please review
wendling at apple.com
Tue Mar 12 19:36:00 PDT 2013
On Mar 12, 2013, at 7:10 PM, Reed Kotler <rkotler at mips.com> wrote:
> On 03/12/2013 04:10 PM, Bill Wendling wrote:
>> 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 ...
> /// \brief Add attributes to the attribute set at the given index. Since
> /// attribute sets are immutable, this returns a new set.
> AttributeSet addAttribute(LLVMContext &C, unsigned Idx,
> StringRef Kind) const;
Yeah. This one and one you mentioned before (void addFnAttr(StringRef Kind)).
More information about the cfe-commits