mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-01-27 01:53:13 +01:00
Improve ABI conformance on x86 by passing the sret parameter in EAX if there's
no `this`.
This commit is contained in:
10
gen/abi.cpp
10
gen/abi.cpp
@@ -196,8 +196,16 @@ struct X86TargetABI : TargetABI
|
||||
Logger::println("Putting context ptr in register");
|
||||
fty.arg_nest->attrs = llvm::Attribute::InReg;
|
||||
}
|
||||
else if (IrFuncTyArg* sret = fty.arg_sret)
|
||||
{
|
||||
Logger::println("Putting sret ptr in register");
|
||||
// sret and inreg are incompatible, but the ABI requires the
|
||||
// sret parameter to be in EAX in this situation...
|
||||
sret->attrs = (sret->attrs | llvm::Attribute::InReg)
|
||||
& ~llvm::Attribute::StructRet;
|
||||
}
|
||||
// otherwise try to mark the last param inreg
|
||||
else if (!fty.arg_sret && !fty.args.empty())
|
||||
else if (!fty.args.empty())
|
||||
{
|
||||
// The last parameter is passed in EAX rather than being pushed on the stack if the following conditions are met:
|
||||
// * It fits in EAX.
|
||||
|
||||
Reference in New Issue
Block a user