attributes

I need to add two function attributes to clang that I can subsequently process in llvm.

void __attribute__((mips16)) foo16 ();
void __attribute__((nomips16)) foo32 ();

int main() {
   foo16();
   foo32();
}

Does anyone know offhand where this gets added to clang and where the hook for processing
in llc is?

I think that this code has changed recently.

These options mimick those of gcc.

Tia.

Reed

There's <http://clang.llvm.org/docs/InternalsManual.html#how-to-add-an-attribute&gt;\.
If that's not up to date please let me know.

-- Sean Silva

Thanks.

Not sure I understand the purpose of InheritableAttr .

InheritableAttr is related to our behavior for testcases like the following:

__attribute((fastcall)) int f(void);
int f(void);

(More generally, it looks like your attributes are very similar to the
fastcall attribute; just do what we do for the fastcall attribute, and
it'll be roughly correct.)

-Eli

Cool.

What about let Subjects = [Function]; ???
is this what we want??

That's not on things like fastcall or naked ..

Please do add Subjects = [Function], but it will not affect anything
-- this is just for documentation purposes now. You have to do the
relevant checks yourself in semantic analysis for the attribute (in
HandleZZZ function).

(Maybe in future, when someone has time to rewrite attribute semantic
analysis, these checks can be generated automatically.)

Dmitri