[clang] [clang][CodeGen] Return RValue from `EmitVAArg` (PR #94635)
John McCall via cfe-commits
cfe-commits at lists.llvm.org
Fri Jun 7 09:45:48 PDT 2024
rjmccall wrote:
> > I was hoping that you might push this down into the target code — if you make emitVoidPtrVAArg return an RValue, that'll handle about half of the targets. Most of the rest will just need an EmitLoadOfLValue at the end
>
> Ok, that seems doable, but I'm having trouble with `EmitLoadOfLValue`.
Oh, sorry, I should have looked closer — I didn't notice that this only handles the scalar case. You should probably still call it instead of just emitting your own load for scalars, but yeah, you'll need to switch over the evaluation kind and then call either `EmitLoadOfLValue`, `EmitLoadOfComplex`, or `EmitAggregateCopy`.
> In case target type is an aggregate, `EmitLoadOfLValue` still loads it as a scalar, so later `EmitFinalDestCopy` fails with an assertion because returned RValue is not aggregate. I could just return `RValue::getAggregate` when target type is aggregate but I will have to check each time (about 16 places where I inserted `EmitLoadOfLValue`, I suppose) which makes it fairly big amount of code. Am I doing something wrong?
Only to the extent that I mislead you. You can make a common function to call to do this, though.
https://github.com/llvm/llvm-project/pull/94635
More information about the cfe-commits
mailing list