mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-02 08:01:11 +03:00
arrays.cpp: Move copySlice to avoid forward decl
This commit is contained in:
parent
68c0df413e
commit
7c40e12a40
1 changed files with 18 additions and 19 deletions
|
@ -25,7 +25,6 @@
|
|||
#include "ir/irmodule.h"
|
||||
|
||||
static void DtoSetArray(DValue* array, LLValue* dim, LLValue* ptr);
|
||||
static void copySlice(Loc& loc, LLValue* dstarr, LLValue* sz1, LLValue* srcarr, LLValue* sz2);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -202,6 +201,24 @@ static Type *DtoArrayElementType(Type *arrayType)
|
|||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static void copySlice(Loc& loc, LLValue* dstarr, LLValue* sz1, LLValue* srcarr, LLValue* sz2)
|
||||
{
|
||||
if (global.params.useAssert || gIR->emitArrayBoundsChecks())
|
||||
{
|
||||
LLValue* fn = LLVM_D_GetRuntimeFunction(loc, gIR->module, "_d_array_slice_copy");
|
||||
gIR->CreateCallOrInvoke4(fn, dstarr, sz1, srcarr, sz2);
|
||||
}
|
||||
else
|
||||
{
|
||||
// We might have dstarr == srcarr at compile time, but as long as
|
||||
// sz1 == 0 at runtime, this would probably still be legal (the C spec
|
||||
// is unclear here).
|
||||
DtoMemCpy(dstarr, srcarr, sz1);
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Determine whether t is an array of structs that need a postblit.
|
||||
static bool arrayNeedsPostblit(Type *t)
|
||||
{
|
||||
|
@ -563,24 +580,6 @@ void initializeArrayLiteral(IRState* p, ArrayLiteralExp* ale, LLValue* dstMem)
|
|||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static void copySlice(Loc& loc, LLValue* dstarr, LLValue* sz1, LLValue* srcarr, LLValue* sz2)
|
||||
{
|
||||
if (global.params.useAssert || gIR->emitArrayBoundsChecks())
|
||||
{
|
||||
LLValue* fn = LLVM_D_GetRuntimeFunction(loc, gIR->module, "_d_array_slice_copy");
|
||||
gIR->CreateCallOrInvoke4(fn, dstarr, sz1, srcarr, sz2);
|
||||
}
|
||||
else
|
||||
{
|
||||
// We might have dstarr == srcarr at compile time, but as long as
|
||||
// sz1 == 0 at runtime, this would probably still be legal (the C spec
|
||||
// is unclear here).
|
||||
DtoMemCpy(dstarr, srcarr, sz1);
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
LLConstant* DtoConstSlice(LLConstant* dim, LLConstant* ptr, Type *type)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue