Re-clang-formatify gen/arrays.cpp

This commit is contained in:
David Nadlinger 2016-01-29 22:32:47 +01:00
parent e330ee5311
commit 77c29bc8c1

View file

@ -166,8 +166,9 @@ static void DtoArrayInit(Loc &loc, LLValue *ptr, LLValue *length,
LLValue *itr_val = DtoLoad(itr); LLValue *itr_val = DtoLoad(itr);
// assign array element value // assign array element value
DValue *arrayelem = new DVarValue( DValue *arrayelem =
dvalue->type->toBasetype(), DtoGEP1(ptr, itr_val, true, "arrayinit.arrayelem")); new DVarValue(dvalue->type->toBasetype(),
DtoGEP1(ptr, itr_val, true, "arrayinit.arrayelem"));
DtoAssign(loc, arrayelem, dvalue, op); DtoAssign(loc, arrayelem, dvalue, op);
// increment iterator // increment iterator
@ -199,8 +200,7 @@ static void copySlice(Loc &loc, LLValue *dstarr, LLValue *sz1, LLValue *srcarr,
const bool checksEnabled = const bool checksEnabled =
global.params.useAssert || gIR->emitArrayBoundsChecks(); global.params.useAssert || gIR->emitArrayBoundsChecks();
if (checksEnabled && !knownInBounds) { if (checksEnabled && !knownInBounds) {
LLValue *fn = LLValue *fn = getRuntimeFunction(loc, gIR->module, "_d_array_slice_copy");
getRuntimeFunction(loc, gIR->module, "_d_array_slice_copy");
gIR->CreateCallOrInvoke(fn, dstarr, sz1, srcarr, sz2); gIR->CreateCallOrInvoke(fn, dstarr, sz1, srcarr, sz2);
} else { } else {
// We might have dstarr == srcarr at compile time, but as long as // We might have dstarr == srcarr at compile time, but as long as
@ -284,8 +284,7 @@ void DtoArrayAssign(Loc &loc, DValue *lhs, DValue *rhs, int op,
copySlice(loc, lhsPtr, lhsSize, rhsPtr, rhsSize, knownInBounds); copySlice(loc, lhsPtr, lhsSize, rhsPtr, rhsSize, knownInBounds);
} }
} else if (isConstructing) { } else if (isConstructing) {
LLFunction *fn = LLFunction *fn = getRuntimeFunction(loc, gIR->module, "_d_arrayctor");
getRuntimeFunction(loc, gIR->module, "_d_arrayctor");
LLCallSite call = gIR->CreateCallOrInvoke(fn, DtoTypeInfoOf(elemType), LLCallSite call = gIR->CreateCallOrInvoke(fn, DtoTypeInfoOf(elemType),
DtoSlice(rhsPtr, rhsLength), DtoSlice(rhsPtr, rhsLength),
DtoSlice(lhsPtr, lhsLength)); DtoSlice(lhsPtr, lhsLength));
@ -316,9 +315,9 @@ void DtoArrayAssign(Loc &loc, DValue *lhs, DValue *rhs, int op,
LLValue *actualLength = gIR->ir->CreateExactUDiv(lhsSize, rhsSize); LLValue *actualLength = gIR->ir->CreateExactUDiv(lhsSize, rhsSize);
DtoArrayInit(loc, actualPtr, actualLength, rhs, op); DtoArrayInit(loc, actualPtr, actualLength, rhs, op);
} else { } else {
LLFunction *fn = getRuntimeFunction( LLFunction *fn = getRuntimeFunction(loc, gIR->module,
loc, gIR->module, isConstructing ? "_d_arraysetctor"
isConstructing ? "_d_arraysetctor" : "_d_arraysetassign"); : "_d_arraysetassign");
LLCallSite call = gIR->CreateCallOrInvoke( LLCallSite call = gIR->CreateCallOrInvoke(
fn, lhsPtr, DtoBitCast(makeLValue(loc, rhs), getVoidPtrType()), fn, lhsPtr, DtoBitCast(makeLValue(loc, rhs), getVoidPtrType()),
gIR->ir->CreateTruncOrBitCast(lhsLength, gIR->ir->CreateTruncOrBitCast(lhsLength,
@ -720,8 +719,8 @@ DSliceValue *DtoResizeDynArray(Loc &loc, Type *arrayType, DValue *array,
bool zeroInit = arrayType->toBasetype()->nextOf()->isZeroInit(); bool zeroInit = arrayType->toBasetype()->nextOf()->isZeroInit();
// call runtime // call runtime
LLFunction *fn = getRuntimeFunction(loc, gIR->module, LLFunction *fn =
zeroInit ? "_d_arraysetlengthT" getRuntimeFunction(loc, gIR->module, zeroInit ? "_d_arraysetlengthT"
: "_d_arraysetlengthiT"); : "_d_arraysetlengthiT");
LLValue *newArray = gIR->CreateCallOrInvoke( LLValue *newArray = gIR->CreateCallOrInvoke(
@ -749,8 +748,7 @@ void DtoCatAssignElement(Loc &loc, Type *arrayType, DValue *array,
// otherwise a ~= a[$-i] won't work correctly // otherwise a ~= a[$-i] won't work correctly
DValue *expVal = toElem(exp); DValue *expVal = toElem(exp);
LLFunction *fn = LLFunction *fn = getRuntimeFunction(loc, gIR->module, "_d_arrayappendcTX");
getRuntimeFunction(loc, gIR->module, "_d_arrayappendcTX");
LLValue *appendedArray = LLValue *appendedArray =
gIR->CreateCallOrInvoke( gIR->CreateCallOrInvoke(
fn, DtoTypeInfoOf(arrayType), fn, DtoTypeInfoOf(arrayType),
@ -773,8 +771,7 @@ DSliceValue *DtoCatAssignArray(Loc &loc, DValue *arr, Expression *exp) {
LOG_SCOPE; LOG_SCOPE;
Type *arrayType = arr->getType(); Type *arrayType = arr->getType();
LLFunction *fn = LLFunction *fn = getRuntimeFunction(loc, gIR->module, "_d_arrayappendT");
getRuntimeFunction(loc, gIR->module, "_d_arrayappendT");
// Call _d_arrayappendT(TypeInfo ti, byte[] *px, byte[] y) // Call _d_arrayappendT(TypeInfo ti, byte[] *px, byte[] y)
LLValue *newArray = LLValue *newArray =
gIR->CreateCallOrInvoke( gIR->CreateCallOrInvoke(
@ -980,8 +977,7 @@ LLValue *DtoArrayCastLength(Loc &loc, LLValue *len, LLType *elemty,
return len; return len;
} }
LLFunction *fn = LLFunction *fn = getRuntimeFunction(loc, gIR->module, "_d_array_cast_len");
getRuntimeFunction(loc, gIR->module, "_d_array_cast_len");
return gIR->CreateCallOrInvoke(fn, len, return gIR->CreateCallOrInvoke(fn, len,
LLConstantInt::get(DtoSize_t(), esz, false), LLConstantInt::get(DtoSize_t(), esz, false),
LLConstantInt::get(DtoSize_t(), nsz, false)) LLConstantInt::get(DtoSize_t(), nsz, false))