[PATCH] D149867: [M68k] Add Clang support for the new M68k_RTD CC

Jessica Clarke via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun May 7 06:56:13 PDT 2023


jrtc27 added a comment.

So GCC gives me:

  warning: ‘stdcall’ attribute directive ignored [-Wattributes]

when trying to use `__attribute__((stdcall))` on m68k, which matches the fact it's only mentioned in the manage for the x86 option.

Interestingly it seems to ICE during expand when I use -mrtd though...



================
Comment at: clang/lib/Basic/Targets/M68k.cpp:258
+  // The M68k_RTD calling convention.
+  case CC_X86StdCall:
+    return CCCR_OK;
----------------
Uhh


================
Comment at: clang/lib/CodeGen/CGCall.cpp:51
   default: return llvm::CallingConv::C;
-  case CC_X86StdCall: return llvm::CallingConv::X86_StdCall;
+  case CC_X86StdCall:
+    return CGM.getTriple().getArch() == llvm::Triple::m68k
----------------
Ditto...


================
Comment at: clang/test/CodeGen/mrtd.c:4
 
-// CHECK: mrtd.c:10:3: warning: function with no prototype cannot use the stdcall calling convention
+// CHECK: mrtd.c:13:3: warning: function with no prototype cannot use the stdcall calling convention
 
----------------
Ew... this should be using -verify and `// expected-warning {{...}}`, then the line number is relative to the comment's location. Or, really, it should be in the Sema test...

Plus is it correct to call this stdcall on m68k? The GCC manpage only mentions it in the x86 option description, not the m68k one.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D149867/new/

https://reviews.llvm.org/D149867



More information about the cfe-commits mailing list