]> granicus.if.org Git - llvm/commitdiff
[AVR] Support zero-sized arguments in defined methods
authorDylan McKay <dylanmckay34@gmail.com>
Sun, 5 Feb 2017 09:53:45 +0000 (09:53 +0000)
committerDylan McKay <dylanmckay34@gmail.com>
Sun, 5 Feb 2017 09:53:45 +0000 (09:53 +0000)
It is sufficient to skip emission of these arguments as we have nothing
to actually pass through the function call.

The AVR-GCC reference has nothing to say about zero-sized arguments,
presumably because C/C++ doesn't support them. This means we don't have
to worry about ABI differences.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294119 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/AVR/AVRISelLowering.cpp

index 07fc3f6890b8dc097d6aa57903ffac092eab4794..fa2a391820636141c58edcf11e3328ce475b3d96 100644 (file)
@@ -932,6 +932,12 @@ static void analyzeStandardArguments(TargetLowering::CallLoweringInfo *CLI,
   bool UsesStack = false;
   for (unsigned i = 0, pos = 0, e = Args.size(); i != e; ++i) {
     unsigned Size = Args[i];
+
+    // If we have a zero-sized argument, don't attempt to lower it.
+    // AVR-GCC does not support zero-sized arguments and so we need not
+    // worry about ABI compatibility.
+    if (Size == 0) continue;
+
     MVT LocVT = (IsCall) ? (*Outs)[pos].VT : (*Ins)[pos].VT;
 
     // If we have plenty of regs to pass the whole argument do it.