[PATCH] D22045: [X86] Support of no_caller_saved_registers attribute (Clang part)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 11 13:18:26 PDT 2016


aaron.ballman added inline comments.

================
Comment at: include/clang/Basic/Attr.td:1657
@@ +1656,3 @@
+                                   TargetSpecificAttr<TargetAnyX86> {
+  let Spellings = [GNU<"no_caller_saved_registers">];
+  let Subjects = SubjectList<[FunctionLike], WarnDiag, "ExpectedFunction">;
----------------
Any particular reason this isn't (also) a C++-style attribute under the clang namespace?

================
Comment at: include/clang/Basic/AttrDocs.td:2177
@@ +2176,3 @@
+Use this attribute to indicate that the specified function has no
+caller-saved registers.  That is, all registers are callee-saved.
+The compiler generates proper function entry and exit sequences to
----------------
How does this interact with calling convention attributes? For instance, if I have a function that is explicitly marked cdecl and has this attribute, what is the behavior for EAX, ECX, and EDX?

Also, why is this an attribute rather than a calling convention? I'm wondering how this works through function pointers, for instance (whether it is intended to work or not).

================
Comment at: test/SemaCXX/attr-x86-no_caller_saved_registers.cpp:15
@@ +14,3 @@
+__attribute__((no_caller_saved_registers)) void foo(int *) {}
+
+int main(int argc, char **argv) {
----------------
Should also have a sema test that this attribute accepts no arguments.


http://reviews.llvm.org/D22045





More information about the cfe-commits mailing list