[PATCH] D78785: Fix x86/x86_64 calling convention for _ExtInt

Erich Keane via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 27 06:25:10 PDT 2020


erichkeane marked an inline comment as done.
erichkeane added inline comments.


================
Comment at: clang/lib/CodeGen/TargetInfo.cpp:2980
 
-    return (Ty->isPromotableIntegerType() ? ABIArgInfo::getExtend(Ty)
-                                          : ABIArgInfo::getDirect());
+    if (!Ty->isExtIntType())
+      return (Ty->isPromotableIntegerType() ? ABIArgInfo::getExtend(Ty)
----------------
rjmccall wrote:
> erichkeane wrote:
> > rjmccall wrote:
> > > Presumably *some* `ExtInt` types should be returned directly.
> > Right, and they are.  This is only for cases where we request an 'indirect result', so cases where we've already decided that it cannot be passed direct.
> > 
> > At this point, the 'classify' step has already been done, which would have decided that <=128 bit values are passed 'direct', and we've requested an indirect.  At least as far as I can tell from this code/debugging.
> Oh, I see.  So the current code is intentionally using a direct IR return in some cases and then allowing LLVM to lower it as an indirect return?  I didn't think we ever did that, and I'm really not sure it's a good idea, so I definitely agree with not doing it for ExtInt types.
Right, exactly :)  FWIW, this is my 3rd time looking into this TargetInfo code, and it is particularly convoluted. If I understood the calling conventions sufficiently, I'd take a run at trying to figure out how to make this not so messy.


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

https://reviews.llvm.org/D78785





More information about the cfe-commits mailing list