mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-03 16:41:06 +03:00
Ignore the ABI some more for intrinsics
This commit is contained in:
parent
c5c0a01044
commit
0182641f85
1 changed files with 24 additions and 18 deletions
|
@ -37,8 +37,10 @@ const llvm::FunctionType* DtoFunctionType(Type* type, Type* thistype, Type* nest
|
||||||
return llvm::cast<llvm::FunctionType>(type->ir.type->get());
|
return llvm::cast<llvm::FunctionType>(type->ir.type->get());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tell the ABI we're resolving a new function type
|
if (f->linkage != LINKintrinsic) {
|
||||||
gABI->newFunctionType(f);
|
// Tell the ABI we're resolving a new function type
|
||||||
|
gABI->newFunctionType(f);
|
||||||
|
}
|
||||||
|
|
||||||
// start new ir funcTy
|
// start new ir funcTy
|
||||||
f->fty.reset();
|
f->fty.reset();
|
||||||
|
@ -57,17 +59,18 @@ const llvm::FunctionType* DtoFunctionType(Type* type, Type* thistype, Type* nest
|
||||||
Type* rt = f->next;
|
Type* rt = f->next;
|
||||||
unsigned a = 0;
|
unsigned a = 0;
|
||||||
// sret return
|
// sret return
|
||||||
if (gABI->returnInArg(f))
|
if (f->linkage != LINKintrinsic)
|
||||||
{
|
if (gABI->returnInArg(f))
|
||||||
f->fty.arg_sret = new IrFuncTyArg(rt, true, llvm::Attribute::StructRet);
|
{
|
||||||
rt = Type::tvoid;
|
f->fty.arg_sret = new IrFuncTyArg(rt, true, llvm::Attribute::StructRet);
|
||||||
lidx++;
|
rt = Type::tvoid;
|
||||||
}
|
lidx++;
|
||||||
// sext/zext return
|
}
|
||||||
else if (unsigned se = DtoShouldExtend(rt))
|
// sext/zext return
|
||||||
{
|
else if (unsigned se = DtoShouldExtend(rt))
|
||||||
a = se;
|
{
|
||||||
}
|
a = se;
|
||||||
|
}
|
||||||
f->fty.ret = new IrFuncTyArg(rt, false, a);
|
f->fty.ret = new IrFuncTyArg(rt, false, a);
|
||||||
}
|
}
|
||||||
lidx++;
|
lidx++;
|
||||||
|
@ -145,7 +148,8 @@ const llvm::FunctionType* DtoFunctionType(Type* type, Type* thistype, Type* nest
|
||||||
argtype = ltd;
|
argtype = ltd;
|
||||||
}
|
}
|
||||||
// byval
|
// byval
|
||||||
else if (gABI->passByVal(argtype))
|
else if (f->linkage != LINKintrinsic
|
||||||
|
&& gABI->passByVal(argtype))
|
||||||
{
|
{
|
||||||
if (!byref) a |= llvm::Attribute::ByVal;
|
if (!byref) a |= llvm::Attribute::ByVal;
|
||||||
byref = true;
|
byref = true;
|
||||||
|
@ -160,11 +164,13 @@ const llvm::FunctionType* DtoFunctionType(Type* type, Type* thistype, Type* nest
|
||||||
lidx++;
|
lidx++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// let the abi rewrite the types as necesary
|
if (f->linkage != LINKintrinsic) {
|
||||||
gABI->rewriteFunctionType(f);
|
// let the abi rewrite the types as necesary
|
||||||
|
gABI->rewriteFunctionType(f);
|
||||||
|
|
||||||
// Tell the ABI we're done with this function type
|
// Tell the ABI we're done with this function type
|
||||||
gABI->doneWithFunctionType();
|
gABI->doneWithFunctionType();
|
||||||
|
}
|
||||||
|
|
||||||
// build the function type
|
// build the function type
|
||||||
std::vector<const LLType*> argtypes;
|
std::vector<const LLType*> argtypes;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue