Files
ldc/gen/abi-ppc64.cpp
David Nadlinger 3392f70a4e 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).
2013-02-26 00:20:45 +01:00

78 lines
2.0 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
//===-- abi-x86-64.cpp ----------------------------------------------------===//
//
// LDC the LLVM D compiler
//
// This file is distributed under the BSD-style LDC license. See the LICENSE
// file for details.
//
//===----------------------------------------------------------------------===//
//
// The PowerOpen 64bit ABI can be found here:
// http://refspecs.linuxfoundation.org/ELF/ppc64/PPC-elf64abi-1.9.html
//
//===----------------------------------------------------------------------===//
#include "gen/abi-ppc64.h"
#include "gen/abi.h"
#include "gen/dvalue.h"
#include "gen/irstate.h"
#include "gen/llvmhelpers.h"
#include "gen/tollvm.h"
struct PPC64TargetABI : 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.");
}
}
void newFunctionType(TypeFunction* tf)
{
}
bool returnInArg(TypeFunction* tf)
{
#if DMDV2
if (tf->isref)
return false;
#endif
// Return structs and static arrays on the stack. The latter is needed
// because otherwise LLVM tries to actually return the array in a number
// of physical registers, which leads, depending on the target, to
// either horrendous codegen or backend crashes.
Type* rt = tf->next->toBasetype();
return (rt->ty == Tstruct || rt->ty == Tsarray);
}
bool passByVal(Type* t)
{
return t->toBasetype()->ty == Tstruct;
}
void doneWithFunctionType()
{
}
void rewriteFunctionType(TypeFunction* tf)
{
}
};
// The public getter for abi.cpp
TargetABI* getPPC64TargetABI()
{
return new PPC64TargetABI();
}