mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-02-28 17:43:14 +01:00
Move calling convention conversion into TargetABI.
The code is tightly coupled to TargetABI (the transformations there only make sense knowing that the right CC is selected).
This commit is contained in:
23
gen/abi.cpp
23
gen/abi.cpp
@@ -38,6 +38,24 @@ void ABIRewrite::getL(Type* dty, DValue* v, llvm::Value* lval)
|
||||
// Some reasonable defaults for when we don't know what ABI to use.
|
||||
struct UnknownTargetABI : TargetABI
|
||||
{
|
||||
llvm::CallingConv::ID callingConv(LINK l)
|
||||
{
|
||||
switch (l)
|
||||
{
|
||||
case LINKc:
|
||||
case LINKcpp:
|
||||
case LINKintrinsic:
|
||||
case LINKpascal:
|
||||
case LINKwindows:
|
||||
return llvm::CallingConv::C;
|
||||
case LINKd:
|
||||
case LINKdefault:
|
||||
return llvm::CallingConv::Fast;
|
||||
default:
|
||||
llvm_unreachable("Unhandled D linkage type.");
|
||||
}
|
||||
}
|
||||
|
||||
bool returnInArg(TypeFunction* tf)
|
||||
{
|
||||
#if DMDV2
|
||||
@@ -91,6 +109,11 @@ struct IntrinsicABI : TargetABI
|
||||
{
|
||||
RemoveStructPadding remove_padding;
|
||||
|
||||
llvm::CallingConv::ID callingConv(LINK l)
|
||||
{
|
||||
return llvm::CallingConv::C;
|
||||
}
|
||||
|
||||
bool returnInArg(TypeFunction* tf)
|
||||
{
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user