mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-02 08:01:11 +03:00
Merge branch 'master' into merge-2.062
Conflicts: runtime/druntime
This commit is contained in:
commit
b13f3d3164
20 changed files with 236 additions and 196 deletions
|
@ -807,7 +807,7 @@ void buildCommandLine(std::vector<const char*>& r, const Params& p)
|
|||
if (p.logTlsUse) warning("-vtls not yet supported by LDC.");
|
||||
if (p.warnings == Warnings::asErrors) r.push_back("-w");
|
||||
else if (p.warnings == Warnings::informational) r.push_back("-wi");
|
||||
if (p.optimize) r.push_back("-O2");
|
||||
if (p.optimize) r.push_back("-O3");
|
||||
if (p.noObj) r.push_back("-o-");
|
||||
if (p.objDir) r.push_back(concat("-od=", p.objDir));
|
||||
if (p.objName) r.push_back(concat("-of=", p.objName));
|
||||
|
|
16
gen/aa.cpp
16
gen/aa.cpp
|
@ -93,16 +93,15 @@ DValue* DtoAAIndex(Loc& loc, Type* type, DValue* aa, DValue* key, bool lvalue)
|
|||
|
||||
gIR->scope() = IRScope(failbb, okbb);
|
||||
|
||||
std::vector<LLValue*> args;
|
||||
|
||||
// module param
|
||||
LLValue *moduleInfoSymbol = gIR->func()->decl->getModule()->moduleInfoSymbol();
|
||||
LLType *moduleInfoType = DtoType(Module::moduleinfo->type);
|
||||
args.push_back(DtoBitCast(moduleInfoSymbol, getPtrToType(moduleInfoType)));
|
||||
|
||||
LLValue* args[] = {
|
||||
// module param
|
||||
DtoBitCast(moduleInfoSymbol, getPtrToType(moduleInfoType)),
|
||||
// line param
|
||||
LLConstant* c = DtoConstUint(loc.linnum);
|
||||
args.push_back(c);
|
||||
DtoConstUint(loc.linnum)
|
||||
};
|
||||
|
||||
// call
|
||||
llvm::Function* errorfn = LLVM_D_GetRuntimeFunction(gIR->module, "_d_array_bounds");
|
||||
|
@ -201,10 +200,7 @@ DValue *DtoAARemove(Loc& loc, DValue* aa, DValue* key)
|
|||
pkey = DtoBitCast(pkey, funcTy->getParamType(2));
|
||||
|
||||
// build arg vector
|
||||
LLSmallVector<LLValue*, 3> args;
|
||||
args.push_back(aaval);
|
||||
args.push_back(keyti);
|
||||
args.push_back(pkey);
|
||||
LLValue* args[] = { aaval, keyti, pkey };
|
||||
|
||||
// call runtime
|
||||
LLCallSite call = gIR->CreateCallOrInvoke(func, args);
|
||||
|
|
|
@ -215,10 +215,11 @@ void DtoArrayAssign(DValue *array, DValue *value, int op)
|
|||
Type *elemType = t->nextOf()->toBasetype();
|
||||
|
||||
LLFunction* fn = LLVM_D_GetRuntimeFunction(gIR->module, op == TOKconstruct ? "_d_arrayctor" : "_d_arrayassign");
|
||||
LLSmallVector<LLValue*,3> args;
|
||||
args.push_back(DtoTypeInfoOf(elemType));
|
||||
args.push_back(DtoAggrPaint(DtoSlice(value), fn->getFunctionType()->getParamType(1)));
|
||||
args.push_back(DtoAggrPaint(DtoSlice(array), fn->getFunctionType()->getParamType(2)));
|
||||
LLValue* args[] = {
|
||||
DtoTypeInfoOf(elemType),
|
||||
DtoAggrPaint(DtoSlice(value), fn->getFunctionType()->getParamType(1)),
|
||||
DtoAggrPaint(DtoSlice(array), fn->getFunctionType()->getParamType(2))
|
||||
};
|
||||
|
||||
LLCallSite call = gIR->CreateCallOrInvoke(fn, args, ".array");
|
||||
call.setCallingConv(llvm::CallingConv::C);
|
||||
|
@ -238,11 +239,12 @@ void DtoArraySetAssign(Loc &loc, DValue *array, DValue *value, int op)
|
|||
LLValue *len = DtoArrayLen(array);
|
||||
|
||||
LLFunction* fn = LLVM_D_GetRuntimeFunction(gIR->module, op == TOKconstruct ? "_d_arraysetctor" : "_d_arraysetassign");
|
||||
LLSmallVector<LLValue*,4> args;
|
||||
args.push_back(DtoBitCast(ptr, getVoidPtrType()));
|
||||
args.push_back(DtoBitCast(makeLValue(loc, value), getVoidPtrType()));
|
||||
args.push_back(len);
|
||||
args.push_back(DtoTypeInfoOf(array->type->toBasetype()->nextOf()->toBasetype()));
|
||||
LLValue* args[] = {
|
||||
DtoBitCast(ptr, getVoidPtrType()),
|
||||
DtoBitCast(makeLValue(loc, value), getVoidPtrType()),
|
||||
len,
|
||||
DtoTypeInfoOf(array->type->toBasetype()->nextOf()->toBasetype())
|
||||
};
|
||||
|
||||
LLCallSite call = gIR->CreateCallOrInvoke(fn, args, ".newptr");
|
||||
call.setCallingConv(llvm::CallingConv::C);
|
||||
|
@ -614,6 +616,7 @@ DSliceValue* DtoNewMulDimDynArray(Loc& loc, Type* arrayType, DValue** dims, size
|
|||
LLFunction* fn = LLVM_D_GetRuntimeFunction(gIR->module, fnname);
|
||||
|
||||
std::vector<LLValue*> args;
|
||||
args.reserve(ndims+2);
|
||||
args.push_back(arrayTypeInfo);
|
||||
args.push_back(DtoConstSize_t(ndims));
|
||||
|
||||
|
@ -647,11 +650,11 @@ DSliceValue* DtoResizeDynArray(Type* arrayType, DValue* array, LLValue* newdim)
|
|||
// call runtime
|
||||
LLFunction* fn = LLVM_D_GetRuntimeFunction(gIR->module, zeroInit ? "_d_arraysetlengthT" : "_d_arraysetlengthiT" );
|
||||
|
||||
LLSmallVector<LLValue*,4> args;
|
||||
args.push_back(DtoTypeInfoOf(arrayType));
|
||||
args.push_back(newdim);
|
||||
|
||||
args.push_back(DtoBitCast(array->getLVal(), fn->getFunctionType()->getParamType(2)));
|
||||
LLValue* args[] = {
|
||||
DtoTypeInfoOf(arrayType),
|
||||
newdim,
|
||||
DtoBitCast(array->getLVal(), fn->getFunctionType()->getParamType(2))
|
||||
};
|
||||
LLValue* newArray = gIR->CreateCallOrInvoke(fn, args, ".gc_mem").getInstruction();
|
||||
|
||||
return getSlice(arrayType, newArray);
|
||||
|
@ -673,10 +676,11 @@ void DtoCatAssignElement(Loc& loc, Type* arrayType, DValue* array, Expression* e
|
|||
DValue *expVal = exp->toElem(gIR);
|
||||
|
||||
LLFunction* fn = LLVM_D_GetRuntimeFunction(gIR->module, "_d_arrayappendcTX");
|
||||
LLSmallVector<LLValue*,3> args;
|
||||
args.push_back(DtoTypeInfoOf(arrayType));
|
||||
args.push_back(DtoBitCast(array->getLVal(), fn->getFunctionType()->getParamType(1)));
|
||||
args.push_back(DtoConstSize_t(1));
|
||||
LLValue* args[] = {
|
||||
DtoTypeInfoOf(arrayType),
|
||||
DtoBitCast(array->getLVal(), fn->getFunctionType()->getParamType(1)),
|
||||
DtoConstSize_t(1)
|
||||
};
|
||||
|
||||
LLValue* appendedArray = gIR->CreateCallOrInvoke(fn, args, ".appendedArray").getInstruction();
|
||||
appendedArray = DtoAggrPaint(appendedArray, DtoType(arrayType));
|
||||
|
@ -772,11 +776,12 @@ DSliceValue* DtoAppendDChar(DValue* arr, Expression* exp, const char *func)
|
|||
|
||||
// Prepare arguments
|
||||
LLFunction* fn = LLVM_D_GetRuntimeFunction(gIR->module, func);
|
||||
LLSmallVector<LLValue*,2> args;
|
||||
LLValue* args[] = {
|
||||
// ref string x
|
||||
args.push_back(DtoBitCast(arr->getLVal(), fn->getFunctionType()->getParamType(0)));
|
||||
DtoBitCast(arr->getLVal(), fn->getFunctionType()->getParamType(0)),
|
||||
// dchar c
|
||||
args.push_back(DtoBitCast(valueToAppend->getRVal(), fn->getFunctionType()->getParamType(1)));
|
||||
DtoBitCast(valueToAppend->getRVal(), fn->getFunctionType()->getParamType(1))
|
||||
};
|
||||
|
||||
// Call function
|
||||
LLValue* newArray = gIR->CreateCallOrInvoke(fn, args, ".appendedArray").getInstruction();
|
||||
|
@ -818,16 +823,11 @@ static LLValue* DtoArrayEqCmp_impl(Loc& loc, const char* func, DValue* l, DValue
|
|||
l = DtoCastArray(loc, l, commonType);
|
||||
r = DtoCastArray(loc, r, commonType);
|
||||
|
||||
LLValue* lmem;
|
||||
LLValue* rmem;
|
||||
LLSmallVector<LLValue*, 3> args;
|
||||
|
||||
// get values, reinterpret cast to void[]
|
||||
lmem = DtoAggrPaint(l->getRVal(), DtoArrayType(LLType::getInt8Ty(gIR->context())));
|
||||
args.push_back(lmem);
|
||||
|
||||
rmem = DtoAggrPaint(r->getRVal(), DtoArrayType(LLType::getInt8Ty(gIR->context())));
|
||||
args.push_back(rmem);
|
||||
args.push_back(DtoAggrPaint(l->getRVal(), DtoArrayType(LLType::getInt8Ty(gIR->context()))));
|
||||
args.push_back(DtoAggrPaint(r->getRVal(), DtoArrayType(LLType::getInt8Ty(gIR->context()))));
|
||||
|
||||
// pass array typeinfo ?
|
||||
if (useti) {
|
||||
|
@ -896,10 +896,11 @@ LLValue* DtoArrayCastLength(LLValue* len, LLType* elemty, LLType* newelemty)
|
|||
if (esz == nsz)
|
||||
return len;
|
||||
|
||||
LLSmallVector<LLValue*, 3> args;
|
||||
args.push_back(len);
|
||||
args.push_back(LLConstantInt::get(DtoSize_t(), esz, false));
|
||||
args.push_back(LLConstantInt::get(DtoSize_t(), nsz, false));
|
||||
LLValue* args[] = {
|
||||
len,
|
||||
LLConstantInt::get(DtoSize_t(), esz, false),
|
||||
LLConstantInt::get(DtoSize_t(), nsz, false)
|
||||
};
|
||||
|
||||
LLFunction* fn = LLVM_D_GetRuntimeFunction(gIR->module, "_d_array_cast_len");
|
||||
return gIR->CreateCallOrInvoke(fn, args, "tmp").getInstruction();
|
||||
|
|
|
@ -10,6 +10,12 @@
|
|||
// Parses "DMD-style" x86/x86_64 inline assembly blocks and converts them to
|
||||
// GDC/LLVM inline assembler syntax.
|
||||
//
|
||||
// This file is designed to be included twice, once with the ASM_X86_64 define
|
||||
// set to get the 64 bit asm parser, and once without to get the 32 bit one.
|
||||
// This is a direct result of merging two disparate but largely identical
|
||||
// implementations, and should be refactored to just use a runtime parameter
|
||||
// for choosing the architecture.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "id.h"
|
||||
|
|
|
@ -522,7 +522,6 @@ void AsmBlockStatement::toIR(IRState* p)
|
|||
{
|
||||
Logger::println("AsmBlockStatement::toIR(): %s", loc.toChars());
|
||||
LOG_SCOPE;
|
||||
Logger::println("BEGIN ASM");
|
||||
|
||||
// disable inlining by default
|
||||
if (!p->func()->decl->allowInlining)
|
||||
|
@ -768,7 +767,6 @@ void AsmBlockStatement::toIR(IRState* p)
|
|||
}
|
||||
|
||||
p->asmBlock = NULL;
|
||||
Logger::println("END ASM");
|
||||
|
||||
// if asm contained external branches, emit goto forwarder code
|
||||
if(!gotoToVal.empty())
|
||||
|
|
|
@ -232,8 +232,9 @@ void DtoFinalizeClass(LLValue* inst)
|
|||
// get runtime function
|
||||
llvm::Function* fn = LLVM_D_GetRuntimeFunction(gIR->module, "_d_callfinalizer");
|
||||
// build args
|
||||
LLSmallVector<LLValue*,1> arg;
|
||||
arg.push_back(DtoBitCast(inst, fn->getFunctionType()->getParamType(0), ".tmp"));
|
||||
LLValue* arg[] = {
|
||||
DtoBitCast(inst, fn->getFunctionType()->getParamType(0), ".tmp")
|
||||
};
|
||||
// call
|
||||
gIR->CreateCallOrInvoke(fn, arg, "");
|
||||
}
|
||||
|
@ -369,8 +370,6 @@ DValue* DtoDynamicCastObject(DValue* val, Type* _to)
|
|||
llvm::Function* func = LLVM_D_GetRuntimeFunction(gIR->module, "_d_dynamic_cast");
|
||||
LLFunctionType* funcTy = func->getFunctionType();
|
||||
|
||||
std::vector<LLValue*> args;
|
||||
|
||||
// Object o
|
||||
LLValue* obj = val->getRVal();
|
||||
obj = DtoBitCast(obj, funcTy->getParamType(0));
|
||||
|
@ -434,8 +433,6 @@ DValue* DtoDynamicCastInterface(DValue* val, Type* _to)
|
|||
llvm::Function* func = LLVM_D_GetRuntimeFunction(gIR->module, "_d_interface_cast");
|
||||
LLFunctionType* funcTy = func->getFunctionType();
|
||||
|
||||
std::vector<LLValue*> args;
|
||||
|
||||
// void* p
|
||||
LLValue* ptr = val->getRVal();
|
||||
ptr = DtoBitCast(ptr, funcTy->getParamType(0));
|
||||
|
|
|
@ -23,10 +23,8 @@ llvm::StructType* DtoComplexType(Type* type)
|
|||
{
|
||||
Type* t = type->toBasetype();
|
||||
LLType* base = DtoComplexBaseType(t);
|
||||
llvm::SmallVector<LLType*, 2> types;
|
||||
types.push_back(base);
|
||||
types.push_back(base);
|
||||
return llvm::StructType::get(gIR->context(), types);
|
||||
LLType* types[] = { base, base };
|
||||
return llvm::StructType::get(gIR->context(), types, false);
|
||||
}
|
||||
|
||||
LLType* DtoComplexBaseType(Type* t)
|
||||
|
@ -62,11 +60,10 @@ LLConstant* DtoConstComplex(Type* _ty, longdouble re, longdouble im)
|
|||
case Tcomplex80: base = Type::tfloat80; break;
|
||||
}
|
||||
|
||||
std::vector<LLConstant*> inits;
|
||||
inits.push_back(DtoConstFP(base, re));
|
||||
inits.push_back(DtoConstFP(base, im));
|
||||
LLConstant * inits[] = { DtoConstFP(base, re), DtoConstFP(base, im) };
|
||||
|
||||
return llvm::ConstantStruct::get(DtoComplexType(_ty), inits);
|
||||
return llvm::ConstantStruct::get(DtoComplexType(_ty),
|
||||
llvm::ArrayRef<LLConstant *>(inits));
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -143,39 +143,28 @@ LLCallSite IRState::CreateCallOrInvoke(LLValue* Callee, const char* Name)
|
|||
|
||||
LLCallSite IRState::CreateCallOrInvoke(LLValue* Callee, LLValue* Arg1, const char* Name)
|
||||
{
|
||||
LLSmallVector<LLValue*, 1> args;
|
||||
args.push_back(Arg1);
|
||||
LLValue* args[] = { Arg1 };
|
||||
return CreateCallOrInvoke(Callee, args, Name);
|
||||
}
|
||||
|
||||
LLCallSite IRState::CreateCallOrInvoke2(LLValue* Callee, LLValue* Arg1, LLValue* Arg2, const char* Name)
|
||||
{
|
||||
LLSmallVector<LLValue*, 2> args;
|
||||
args.push_back(Arg1);
|
||||
args.push_back(Arg2);
|
||||
LLValue* args[] = { Arg1, Arg2 };
|
||||
return CreateCallOrInvoke(Callee, args, Name);
|
||||
}
|
||||
|
||||
LLCallSite IRState::CreateCallOrInvoke3(LLValue* Callee, LLValue* Arg1, LLValue* Arg2, LLValue* Arg3, const char* Name)
|
||||
{
|
||||
LLSmallVector<LLValue*, 3> args;
|
||||
args.push_back(Arg1);
|
||||
args.push_back(Arg2);
|
||||
args.push_back(Arg3);
|
||||
LLValue* args[] = { Arg1, Arg2, Arg3 };
|
||||
return CreateCallOrInvoke(Callee, args, Name);
|
||||
}
|
||||
|
||||
LLCallSite IRState::CreateCallOrInvoke4(LLValue* Callee, LLValue* Arg1, LLValue* Arg2, LLValue* Arg3, LLValue* Arg4, const char* Name)
|
||||
{
|
||||
LLSmallVector<LLValue*, 4> args;
|
||||
args.push_back(Arg1);
|
||||
args.push_back(Arg2);
|
||||
args.push_back(Arg3);
|
||||
args.push_back(Arg4);
|
||||
LLValue* args[] = { Arg1, Arg2, Arg3, Arg4 };
|
||||
return CreateCallOrInvoke(Callee, args, Name);
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
IRBuilder<>* IRBuilderHelper::operator->()
|
||||
|
|
|
@ -59,8 +59,7 @@ void DtoDeleteMemory(LLValue* ptr)
|
|||
// get runtime function
|
||||
llvm::Function* fn = LLVM_D_GetRuntimeFunction(gIR->module, "_d_delmemory");
|
||||
// build args
|
||||
LLSmallVector<LLValue*,1> arg;
|
||||
arg.push_back(DtoBitCast(ptr, getVoidPtrType(), ".tmp"));
|
||||
LLValue* arg[] = { DtoBitCast(ptr, getVoidPtrType(), ".tmp") };
|
||||
// call
|
||||
gIR->CreateCallOrInvoke(fn, arg);
|
||||
}
|
||||
|
@ -69,13 +68,14 @@ void DtoDeleteClass(LLValue* inst)
|
|||
{
|
||||
// get runtime function
|
||||
llvm::Function* fn = LLVM_D_GetRuntimeFunction(gIR->module, "_d_delclass");
|
||||
// build args
|
||||
LLSmallVector<LLValue*,1> arg;
|
||||
// druntime wants a pointer to object
|
||||
LLValue *ptr = DtoRawAlloca(inst->getType(), 0, "objectPtr");
|
||||
DtoStore(inst, ptr);
|
||||
inst = ptr;
|
||||
arg.push_back(DtoBitCast(inst, fn->getFunctionType()->getParamType(0), ".tmp"));
|
||||
// build args
|
||||
LLValue* arg[] = {
|
||||
DtoBitCast(inst, fn->getFunctionType()->getParamType(0), ".tmp")
|
||||
};
|
||||
// call
|
||||
gIR->CreateCallOrInvoke(fn, arg);
|
||||
}
|
||||
|
@ -85,8 +85,9 @@ void DtoDeleteInterface(LLValue* inst)
|
|||
// get runtime function
|
||||
llvm::Function* fn = LLVM_D_GetRuntimeFunction(gIR->module, "_d_delinterface");
|
||||
// build args
|
||||
LLSmallVector<LLValue*,1> arg;
|
||||
arg.push_back(DtoBitCast(inst, fn->getFunctionType()->getParamType(0), ".tmp"));
|
||||
LLValue* arg[] = {
|
||||
DtoBitCast(inst, fn->getFunctionType()->getParamType(0), ".tmp")
|
||||
};
|
||||
// call
|
||||
gIR->CreateCallOrInvoke(fn, arg);
|
||||
}
|
||||
|
@ -97,9 +98,10 @@ void DtoDeleteArray(DValue* arr)
|
|||
llvm::Function* fn = LLVM_D_GetRuntimeFunction(gIR->module, "_d_delarray_t");
|
||||
|
||||
// build args
|
||||
LLSmallVector<LLValue*,2> arg;
|
||||
arg.push_back(DtoBitCast(arr->getLVal(), fn->getFunctionType()->getParamType(0)));
|
||||
arg.push_back(DtoBitCast(DtoTypeInfoOf(arr->type->nextOf()), fn->getFunctionType()->getParamType(1)));
|
||||
LLValue* arg[] = {
|
||||
DtoBitCast(arr->getLVal(), fn->getFunctionType()->getParamType(0)),
|
||||
DtoBitCast(DtoTypeInfoOf(arr->type->nextOf()), fn->getFunctionType()->getParamType(1))
|
||||
};
|
||||
|
||||
// call
|
||||
gIR->CreateCallOrInvoke(fn, arg);
|
||||
|
@ -155,12 +157,13 @@ LLValue* DtoGcMalloc(LLType* lltype, const char* name)
|
|||
|
||||
void DtoAssert(Module* M, Loc loc, DValue* msg)
|
||||
{
|
||||
std::vector<LLValue*> args;
|
||||
|
||||
// func
|
||||
const char* fname = msg ? "_d_assert_msg" : "_d_assert";
|
||||
llvm::Function* fn = LLVM_D_GetRuntimeFunction(gIR->module, fname);
|
||||
|
||||
// Arguments
|
||||
llvm::SmallVector<LLValue*, 3> args;
|
||||
|
||||
// msg param
|
||||
if (msg)
|
||||
{
|
||||
|
@ -182,8 +185,7 @@ void DtoAssert(Module* M, Loc loc, DValue* msg)
|
|||
}
|
||||
|
||||
// line param
|
||||
LLConstant* c = DtoConstUint(loc.linnum);
|
||||
args.push_back(c);
|
||||
args.push_back(DtoConstUint(loc.linnum));
|
||||
|
||||
// call
|
||||
gIR->CreateCallOrInvoke(fn, args);
|
||||
|
|
|
@ -172,10 +172,11 @@ static LLFunction* build_module_reference_and_ctor(LLConstant* moduleinfo)
|
|||
|
||||
// provide the default initializer
|
||||
LLStructType* modulerefTy = DtoModuleReferenceType();
|
||||
std::vector<LLConstant*> mrefvalues;
|
||||
mrefvalues.push_back(LLConstant::getNullValue(modulerefTy->getContainedType(0)));
|
||||
mrefvalues.push_back(llvm::ConstantExpr::getBitCast(moduleinfo, modulerefTy->getContainedType(1)));
|
||||
LLConstant* thismrefinit = LLConstantStruct::get(modulerefTy, mrefvalues);
|
||||
LLConstant* mrefvalues[] = {
|
||||
LLConstant::getNullValue(modulerefTy->getContainedType(0)),
|
||||
llvm::ConstantExpr::getBitCast(moduleinfo, modulerefTy->getContainedType(1))
|
||||
};
|
||||
LLConstant* thismrefinit = LLConstantStruct::get(modulerefTy, llvm::ArrayRef<LLConstant*>(mrefvalues));
|
||||
|
||||
// create the ModuleReference node for this module
|
||||
std::string thismrefname = "_D";
|
||||
|
|
|
@ -47,7 +47,7 @@ static cl::opt<signed char> optimizeLevel(
|
|||
cl::desc("Setting the optimization level:"),
|
||||
cl::ZeroOrMore,
|
||||
cl::values(
|
||||
clEnumValN(2, "O", "Equivalent to -O2"),
|
||||
clEnumValN(3, "O", "Equivalent to -O3"),
|
||||
clEnumValN(0, "O0", "No optimizations (default)"),
|
||||
clEnumValN(1, "O1", "Simple optimizations"),
|
||||
clEnumValN(2, "O2", "Good optimizations"),
|
||||
|
|
|
@ -165,8 +165,10 @@ void RTTIBuilder::finalize(LLType* type, LLValue* value)
|
|||
|
||||
// set struct body
|
||||
if (st->isOpaque()) {
|
||||
const int n = inits.size();
|
||||
std::vector<LLType*> types;
|
||||
for (int i = 0, n = inits.size(); i < n; ++i)
|
||||
types.reserve(n);
|
||||
for (int i = 0; i < n; ++i)
|
||||
types.push_back(inits[i]->getType());
|
||||
st->setBody(types);
|
||||
}
|
||||
|
|
|
@ -938,7 +938,7 @@ void SwitchStatement::toIR(IRState* p)
|
|||
// first sort it
|
||||
caseArray.sort();
|
||||
// iterate and add indices to cases
|
||||
std::vector<LLConstant*> inits(caseArray.dim);
|
||||
std::vector<LLConstant*> inits(caseArray.dim, 0);
|
||||
for (size_t i=0; i<caseArray.dim; ++i)
|
||||
{
|
||||
Case* c = static_cast<Case*>(caseArray.data[i]);
|
||||
|
@ -956,14 +956,10 @@ void SwitchStatement::toIR(IRState* p)
|
|||
LLConstant* arrPtr = llvm::ConstantExpr::getBitCast(arr, elemPtrTy);
|
||||
|
||||
// build the static table
|
||||
std::vector<LLType*> types;
|
||||
types.push_back(DtoSize_t());
|
||||
types.push_back(elemPtrTy);
|
||||
LLStructType* sTy = llvm::StructType::get(gIR->context(), types);
|
||||
std::vector<LLConstant*> sinits;
|
||||
sinits.push_back(DtoConstSize_t(inits.size()));
|
||||
sinits.push_back(arrPtr);
|
||||
switchTable = llvm::ConstantStruct::get(sTy, sinits);
|
||||
LLType* types[] = { DtoSize_t(), elemPtrTy };
|
||||
LLStructType* sTy = llvm::StructType::get(gIR->context(), types, false);
|
||||
LLConstant* sinits[] = { DtoConstSize_t(inits.size()), arrPtr };
|
||||
switchTable = llvm::ConstantStruct::get(sTy, llvm::ArrayRef<LLConstant*>(sinits));
|
||||
}
|
||||
|
||||
// condition var
|
||||
|
@ -1609,16 +1605,15 @@ void SwitchErrorStatement::toIR(IRState* p)
|
|||
|
||||
llvm::Function* fn = LLVM_D_GetRuntimeFunction(gIR->module, "_d_switch_error");
|
||||
|
||||
std::vector<LLValue*> args;
|
||||
|
||||
// module param
|
||||
LLValue *moduleInfoSymbol = gIR->func()->decl->getModule()->moduleInfoSymbol();
|
||||
LLType *moduleInfoType = DtoType(Module::moduleinfo->type);
|
||||
args.push_back(DtoBitCast(moduleInfoSymbol, getPtrToType(moduleInfoType)));
|
||||
|
||||
LLValue* args[] = {
|
||||
// module param
|
||||
DtoBitCast(moduleInfoSymbol, getPtrToType(moduleInfoType)),
|
||||
// line param
|
||||
LLConstant* c = DtoConstUint(loc.linnum);
|
||||
args.push_back(c);
|
||||
DtoConstUint(loc.linnum)
|
||||
};
|
||||
|
||||
// call
|
||||
LLCallSite call = gIR->CreateCallOrInvoke(fn, args);
|
||||
|
|
|
@ -328,6 +328,7 @@ LLType* DtoUnpaddedStructType(Type* dty) {
|
|||
Array& fields = sty->sym->fields;
|
||||
|
||||
std::vector<LLType*> types;
|
||||
types.reserve(fields.dim);
|
||||
|
||||
for (unsigned i = 0; i < fields.dim; i++) {
|
||||
VarDeclaration* vd = static_cast<VarDeclaration*>(fields.data[i]);
|
||||
|
|
|
@ -259,6 +259,7 @@ void DtoBuildDVarArgList(std::vector<LLValue*>& args,
|
|||
Logger::cout() << "_arguments storage: " << *typeinfomem << '\n';
|
||||
|
||||
std::vector<LLConstant*> vtypeinfos;
|
||||
vtypeinfos.reserve(n_arguments);
|
||||
for (size_t i=begin; i<n_arguments; i++)
|
||||
{
|
||||
Expression* argexp = static_cast<Expression*>(arguments->data[i]);
|
||||
|
@ -270,11 +271,12 @@ void DtoBuildDVarArgList(std::vector<LLValue*>& args,
|
|||
typeinfomem->setInitializer(tiinits);
|
||||
|
||||
// put data in d-array
|
||||
std::vector<LLConstant*> pinits;
|
||||
pinits.push_back(DtoConstSize_t(vtype->getNumElements()));
|
||||
pinits.push_back(llvm::ConstantExpr::getBitCast(typeinfomem, getPtrToType(typeinfotype)));
|
||||
LLConstant* pinits[] = {
|
||||
DtoConstSize_t(vtype->getNumElements()),
|
||||
llvm::ConstantExpr::getBitCast(typeinfomem, getPtrToType(typeinfotype))
|
||||
};
|
||||
LLType* tiarrty = DtoType(Type::typeinfo->type->arrayOf());
|
||||
tiinits = LLConstantStruct::get(isaStruct(tiarrty), pinits);
|
||||
tiinits = LLConstantStruct::get(isaStruct(tiarrty), llvm::ArrayRef<LLConstant*>(pinits));
|
||||
LLValue* typeinfoarrayparam = new llvm::GlobalVariable(*gIR->module, tiarrty,
|
||||
true, llvm::GlobalValue::InternalLinkage, tiinits, "._arguments.array");
|
||||
|
||||
|
@ -507,6 +509,7 @@ DValue* DtoCallFunction(Loc& loc, Type* resulttype, DValue* fnval, Expressions*
|
|||
|
||||
size_t n = Parameter::dim(tf->parameters);
|
||||
std::vector<DValue*> argvals;
|
||||
argvals.reserve(n);
|
||||
if (dfnval && dfnval->func->isArrayOp) {
|
||||
// slightly different approach for array operators
|
||||
for (int i=n-1; i>=0; --i) {
|
||||
|
|
127
gen/todebug.cpp
127
gen/todebug.cpp
|
@ -84,28 +84,56 @@ static llvm::DIType dwarfBasicType(Type* type)
|
|||
LLType* T = DtoType(type);
|
||||
|
||||
// find encoding
|
||||
unsigned id;
|
||||
if (t->isintegral())
|
||||
unsigned Encoding;
|
||||
switch (t->ty)
|
||||
{
|
||||
if (type->isunsigned())
|
||||
id = DW_ATE_unsigned;
|
||||
else
|
||||
id = DW_ATE_signed;
|
||||
}
|
||||
else if (t->isfloating())
|
||||
{
|
||||
id = DW_ATE_float;
|
||||
}
|
||||
else
|
||||
{
|
||||
llvm_unreachable("unsupported basic type for debug info");
|
||||
case Tbool:
|
||||
Encoding = DW_ATE_boolean;
|
||||
break;
|
||||
case Tchar:
|
||||
case Twchar:
|
||||
case Tdchar:
|
||||
Encoding = type->isunsigned() ? DW_ATE_unsigned_char
|
||||
: DW_ATE_signed_char;
|
||||
break;
|
||||
case Tint8:
|
||||
case Tint16:
|
||||
case Tint32:
|
||||
case Tint64:
|
||||
case Tint128:
|
||||
Encoding = DW_ATE_signed;
|
||||
break;
|
||||
case Tuns8:
|
||||
case Tuns16:
|
||||
case Tuns32:
|
||||
case Tuns64:
|
||||
case Tuns128:
|
||||
Encoding = DW_ATE_unsigned;
|
||||
break;
|
||||
case Tfloat32:
|
||||
case Tfloat64:
|
||||
case Tfloat80:
|
||||
Encoding = DW_ATE_float;
|
||||
break;
|
||||
case Timaginary32:
|
||||
case Timaginary64:
|
||||
case Timaginary80:
|
||||
Encoding = DW_ATE_imaginary_float;
|
||||
break;
|
||||
case Tcomplex32:
|
||||
case Tcomplex64:
|
||||
case Tcomplex80:
|
||||
Encoding = DW_ATE_complex_float;
|
||||
break;
|
||||
default:
|
||||
llvm_unreachable("Unsupported basic type for debug info");
|
||||
}
|
||||
|
||||
return gIR->dibuilder.createBasicType(
|
||||
type->toChars(), // name
|
||||
getTypeBitSize(T), // size (bits)
|
||||
getABITypeAlign(T)*8, // align (bits)
|
||||
id
|
||||
Encoding
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -188,16 +216,6 @@ static llvm::DIType dwarfCompositeType(Type* type)
|
|||
LLType* T = DtoType(type);
|
||||
Type* t = type->toBasetype();
|
||||
|
||||
// defaults
|
||||
llvm::StringRef name;
|
||||
unsigned linnum = 0;
|
||||
llvm::DIFile file;
|
||||
|
||||
// elements
|
||||
std::vector<llvm::Value*> elems;
|
||||
|
||||
llvm::DIType derivedFrom;
|
||||
|
||||
assert((t->ty == Tstruct || t->ty == Tclass) &&
|
||||
"unsupported type for dwarfCompositeType");
|
||||
AggregateDeclaration* sd;
|
||||
|
@ -226,12 +244,29 @@ static llvm::DIType dwarfCompositeType(Type* type)
|
|||
if (static_cast<llvm::MDNode*>(ir->diCompositeType) != 0)
|
||||
return ir->diCompositeType;
|
||||
|
||||
name = sd->toChars();
|
||||
linnum = sd->loc.linnum;
|
||||
file = DtoDwarfFile(sd->loc);
|
||||
// elements
|
||||
std::vector<llvm::Value*> elems;
|
||||
|
||||
// defaults
|
||||
llvm::StringRef name = sd->toChars();
|
||||
unsigned linnum = sd->loc.linnum;
|
||||
llvm::DIFile file = DtoDwarfFile(sd->loc);
|
||||
llvm::DIType derivedFrom;
|
||||
|
||||
// set diCompositeType to handle recursive types properly
|
||||
if (!ir->diCompositeType)
|
||||
if (!ir->diCompositeType) {
|
||||
#if LDC_LLVM_VER >= 301
|
||||
unsigned tag = (t->ty == Tstruct) ? llvm::dwarf::DW_TAG_structure_type
|
||||
: llvm::dwarf::DW_TAG_class_type;
|
||||
ir->diCompositeType = gIR->dibuilder.createForwardDecl(tag, name,
|
||||
#if LDC_LLVM_VER >= 302
|
||||
llvm::DIDescriptor(file),
|
||||
#endif
|
||||
file, linnum);
|
||||
#else
|
||||
ir->diCompositeType = gIR->dibuilder.createTemporaryType();
|
||||
#endif
|
||||
}
|
||||
|
||||
if (!ir->aggrdecl->isInterfaceDeclaration()) // plain interfaces don't have one
|
||||
{
|
||||
|
@ -301,7 +336,10 @@ static llvm::DIGlobalVariable dwarfGlobalVariable(LLGlobalVariable* ll, VarDecla
|
|||
assert(vd->isDataseg() || (vd->storage_class & (STCconst | STCimmutable) && vd->init));
|
||||
|
||||
return gIR->dibuilder.createGlobalVariable(
|
||||
vd->toChars(), // name TODO: mangle() or toPrettyChars() instead?
|
||||
vd->toChars(), // name
|
||||
#if LDC_LLVM_VER >= 303
|
||||
vd->mangle(), // linkage name
|
||||
#endif
|
||||
DtoDwarfFile(vd->loc), // file
|
||||
vd->loc.linnum, // line num
|
||||
dwarfTypeDescription_impl(vd->type, NULL), // type
|
||||
|
@ -328,9 +366,11 @@ static llvm::DIType dwarfArrayType(Type* type) {
|
|||
|
||||
llvm::DIFile file = DtoDwarfFile(Loc(gIR->dmodule, 0));
|
||||
|
||||
std::vector<llvm::Value*> elems;
|
||||
elems.push_back(dwarfMemberType(0, Type::tsize_t, file, "length", 0));
|
||||
elems.push_back(dwarfMemberType(0, t->nextOf()->pointerTo(), file, "ptr", global.params.is64bit?8:4));
|
||||
llvm::Value* elems[] = {
|
||||
dwarfMemberType(0, Type::tsize_t, file, "length", 0),
|
||||
dwarfMemberType(0, t->nextOf()->pointerTo(), file, "ptr",
|
||||
global.params.is64bit ? 8 : 4)
|
||||
};
|
||||
|
||||
return gIR->dibuilder.createStructType
|
||||
(
|
||||
|
@ -475,17 +515,26 @@ llvm::DISubprogram DtoDwarfSubProgram(FuncDeclaration* fd)
|
|||
Logger::println("D to dwarf subprogram");
|
||||
LOG_SCOPE;
|
||||
|
||||
llvm::DICompileUnit CU(gIR->dibuilder.getCU());
|
||||
assert(CU && CU.Verify() && "Compilation unit missing or corrupted");
|
||||
|
||||
llvm::DIFile file = DtoDwarfFile(fd->loc);
|
||||
Type *retType = static_cast<TypeFunction*>(fd->type)->next;
|
||||
|
||||
// Create "dummy" subroutine type for the return type
|
||||
llvm::SmallVector<llvm::Value*, 16> Elts;
|
||||
Elts.push_back(dwarfTypeDescription(retType, NULL));
|
||||
llvm::DIArray EltTypeArray = gIR->dibuilder.getOrCreateArray(Elts);
|
||||
llvm::DIType DIFnType = gIR->dibuilder.createSubroutineType(file, EltTypeArray);
|
||||
|
||||
// FIXME: duplicates ?
|
||||
return gIR->dibuilder.createFunction(
|
||||
llvm::DICompileUnit(file), // context
|
||||
CU, // context
|
||||
fd->toPrettyChars(), // name
|
||||
fd->mangle(), // linkage name
|
||||
file, // file
|
||||
fd->loc.linnum, // line no
|
||||
dwarfTypeDescription(retType, NULL), // type
|
||||
DIFnType, // type
|
||||
fd->protection == PROTprivate, // is local to unit
|
||||
gIR->dmodule == getDefinedModule(fd), // isdefinition
|
||||
#if LDC_LLVM_VER >= 301
|
||||
|
@ -509,6 +558,12 @@ llvm::DISubprogram DtoDwarfSubProgramInternal(const char* prettyname, const char
|
|||
|
||||
llvm::DIFile file(DtoDwarfFile(Loc(gIR->dmodule, 0)));
|
||||
|
||||
// Create "dummy" subroutine type for the return type
|
||||
llvm::SmallVector<llvm::Value*, 1> Elts;
|
||||
Elts.push_back(llvm::DIType(NULL));
|
||||
llvm::DIArray EltTypeArray = gIR->dibuilder.getOrCreateArray(Elts);
|
||||
llvm::DIType DIFnType = gIR->dibuilder.createSubroutineType(file, EltTypeArray);
|
||||
|
||||
// FIXME: duplicates ?
|
||||
return gIR->dibuilder.createFunction(
|
||||
llvm::DIDescriptor(file), // context
|
||||
|
@ -516,7 +571,7 @@ llvm::DISubprogram DtoDwarfSubProgramInternal(const char* prettyname, const char
|
|||
mangledname, // linkage name
|
||||
file, // file
|
||||
0, // line no
|
||||
llvm::DIType(NULL), // return type. TODO: fill it up
|
||||
DIFnType, // return type. TODO: fill it up
|
||||
true, // is local to unit
|
||||
true // isdefinition
|
||||
#if LDC_LLVM_VER >= 301
|
||||
|
|
|
@ -17,27 +17,22 @@
|
|||
#include "gen/irstate.h"
|
||||
#include "gen/tollvm.h"
|
||||
|
||||
void RegisterDwarfSymbols(llvm::Module* mod);
|
||||
|
||||
/**
|
||||
* Emit the Dwarf compile_unit global for a Module m.
|
||||
* @param m
|
||||
*/
|
||||
/// \brief Emit the Dwarf compile_unit global for a Module m.
|
||||
/// \param m Module to emit as compile unit.
|
||||
void DtoDwarfCompileUnit(Module* m);
|
||||
|
||||
/**
|
||||
* Emit the Dwarf subprogram global for a function declaration fd.
|
||||
* @param fd
|
||||
* @return the Dwarf subprogram global.
|
||||
*/
|
||||
/// \brief Emit the Dwarf subprogram global for a function declaration fd.
|
||||
/// \param fd Function declaration to emit as subprogram.
|
||||
/// \returns the Dwarf subprogram global.
|
||||
llvm::DISubprogram DtoDwarfSubProgram(FuncDeclaration* fd);
|
||||
|
||||
/**
|
||||
* Emit the Dwarf subprogram global for a internal function.
|
||||
* This is used for generated functions like moduleinfoctors,
|
||||
* module ctors/dtors and unittests.
|
||||
* @return the Dwarf subprogram global.
|
||||
*/
|
||||
/// \brief Emit the Dwarf subprogram global for a internal function.
|
||||
/// This is used for generated functions like moduleinfoctors,
|
||||
/// module ctors/dtors and unittests.
|
||||
/// \param prettyname The name as seen in the source.
|
||||
/// \param mangledname The mangled name in the object file.
|
||||
/// \returns the Dwarf subprogram global.
|
||||
llvm::DISubprogram DtoDwarfSubProgramInternal(const char* prettyname, const char* mangledname);
|
||||
|
||||
void DtoDwarfFuncStart(FuncDeclaration* fd);
|
||||
|
@ -49,20 +44,17 @@ void DtoDwarfStopPoint(unsigned ln);
|
|||
|
||||
void DtoDwarfValue(LLValue *val, VarDeclaration* vd);
|
||||
|
||||
/**
|
||||
* Emits all things necessary for making debug info for a local variable vd.
|
||||
* @param ll LLVM Value of the variable.
|
||||
* @param vd Variable declaration to emit debug info for.
|
||||
*/
|
||||
/// \brief Emits all things necessary for making debug info for a local variable vd.
|
||||
/// \param ll LLVM Value of the variable.
|
||||
/// \param vd Variable declaration to emit debug info for.
|
||||
/// \param addr An array of complex address operations.
|
||||
void DtoDwarfLocalVariable(LLValue* ll, VarDeclaration* vd,
|
||||
llvm::ArrayRef<LLValue*> addr = llvm::ArrayRef<LLValue*>());
|
||||
|
||||
/**
|
||||
* Emits all things necessary for making debug info for a global variable vd.
|
||||
* @param ll
|
||||
* @param vd
|
||||
* @return
|
||||
*/
|
||||
/// \brief Emits all things necessary for making debug info for a global variable vd.
|
||||
/// \param ll LLVM global variable
|
||||
/// \param vd Variable declaration to emit debug info for.
|
||||
/// \returns Created debug info
|
||||
llvm::DIGlobalVariable DtoDwarfGlobalVariable(LLGlobalVariable* ll, VarDeclaration* vd);
|
||||
|
||||
void DtoDwarfModuleEnd();
|
||||
|
|
23
gen/toir.cpp
23
gen/toir.cpp
|
@ -1950,9 +1950,10 @@ DValue* NewExp::toElem(IRState* p)
|
|||
else
|
||||
{
|
||||
size_t ndims = arguments->dim;
|
||||
std::vector<DValue*> dims(ndims);
|
||||
std::vector<DValue*> dims;
|
||||
dims.reserve(ndims);
|
||||
for (size_t i=0; i<ndims; ++i)
|
||||
dims[i] = static_cast<Expression*>(arguments->data[i])->toElem(p);
|
||||
dims.push_back(static_cast<Expression*>(arguments->data[i])->toElem(p));
|
||||
return DtoNewMulDimDynArray(loc, newtype, &dims[0], ndims, true);
|
||||
}
|
||||
}
|
||||
|
@ -2798,11 +2799,12 @@ LLConstant* ArrayLiteralExp::toConstElem(IRState* p)
|
|||
bool dyn = (bt->ty != Tsarray);
|
||||
|
||||
// build the initializer
|
||||
std::vector<LLConstant*> vals(elements->dim, NULL);
|
||||
std::vector<LLConstant*> vals;
|
||||
vals.reserve(elements->dim);
|
||||
for (unsigned i=0; i<elements->dim; ++i)
|
||||
{
|
||||
Expression* expr = static_cast<Expression*>(elements->data[i]);
|
||||
vals[i] = expr->toConstElem(p);
|
||||
vals.push_back(expr->toConstElem(p));
|
||||
}
|
||||
|
||||
// build the constant array initialize
|
||||
|
@ -2974,7 +2976,7 @@ LLConstant* StructLiteralExp::toConstElem(IRState* p)
|
|||
sd->codegen(Type::sir);
|
||||
|
||||
// get inits
|
||||
std::vector<LLConstant*> inits(sd->fields.dim, NULL);
|
||||
std::vector<LLConstant*> inits(sd->fields.dim, 0);
|
||||
|
||||
size_t nexprs = elements->dim;;
|
||||
Expression** exprs = (Expression**)elements->data;
|
||||
|
@ -2987,8 +2989,8 @@ LLConstant* StructLiteralExp::toConstElem(IRState* p)
|
|||
std::vector<LLConstant*> values = DtoStructLiteralValues(sd, inits);
|
||||
|
||||
// we know those values are constants.. cast them
|
||||
std::vector<LLConstant*> constvals(values.size(), NULL);
|
||||
std::vector<LLType*> types(values.size(), NULL);
|
||||
std::vector<LLConstant*> constvals(values.size(), 0);
|
||||
std::vector<LLType*> types(values.size(), 0);
|
||||
for (size_t i = 0; i < values.size(); ++i) {
|
||||
constvals[i] = llvm::cast<LLConstant>(values[i]);
|
||||
types[i] = values[i]->getType();
|
||||
|
@ -3059,6 +3061,8 @@ DValue* AssocArrayLiteralExp::toElem(IRState* p)
|
|||
|
||||
{
|
||||
std::vector<LLConstant*> keysInits, valuesInits;
|
||||
keysInits.reserve(keys->dim);
|
||||
valuesInits.reserve(keys->dim);
|
||||
for (size_t i = 0, n = keys->dim; i < n; ++i)
|
||||
{
|
||||
Expression* ekey = keys->tdata()[i];
|
||||
|
@ -3178,11 +3182,12 @@ DValue* TypeExp::toElem(IRState *p)
|
|||
DValue* TupleExp::toElem(IRState *p)
|
||||
{
|
||||
Logger::print("TupleExp::toElem() %s\n", toChars());
|
||||
std::vector<LLType*> types(exps->dim, NULL);
|
||||
std::vector<LLType*> types;
|
||||
types.reserve(exps->dim);
|
||||
for (size_t i = 0; i < exps->dim; i++)
|
||||
{
|
||||
Expression *el = static_cast<Expression *>(exps->data[i]);
|
||||
types[i] = DtoTypeNotVoid(el->type);
|
||||
types.push_back(DtoTypeNotVoid(el->type));
|
||||
}
|
||||
LLValue *val = DtoRawAlloca(LLStructType::get(gIR->context(), types),0, "tuple");
|
||||
for (size_t i = 0; i < exps->dim; i++)
|
||||
|
|
|
@ -492,7 +492,7 @@ LLValue* DtoGEP1(LLValue* ptr, LLValue* i0, const char* var, llvm::BasicBlock* b
|
|||
|
||||
LLValue* DtoGEP(LLValue* ptr, LLValue* i0, LLValue* i1, const char* var, llvm::BasicBlock* bb)
|
||||
{
|
||||
LLValue* v[2] = { i0, i1 };
|
||||
LLValue* v[] = { i0, i1 };
|
||||
return llvm::GetElementPtrInst::Create(ptr, v, var?var:"tmp", bb?bb:gIR->scopebb());
|
||||
}
|
||||
|
||||
|
@ -507,7 +507,7 @@ LLValue* DtoGEPi1(LLValue* ptr, unsigned i, const char* var, llvm::BasicBlock* b
|
|||
|
||||
LLValue* DtoGEPi(LLValue* ptr, unsigned i0, unsigned i1, const char* var, llvm::BasicBlock* bb)
|
||||
{
|
||||
LLValue* v[2] = { DtoConstUint(i0), DtoConstUint(i1) };
|
||||
LLValue* v[] = { DtoConstUint(i0), DtoConstUint(i1) };
|
||||
return llvm::GetElementPtrInst::Create(ptr, v, var?var:"tmp", bb?bb:gIR->scopebb());
|
||||
}
|
||||
|
||||
|
@ -515,7 +515,7 @@ LLValue* DtoGEPi(LLValue* ptr, unsigned i0, unsigned i1, const char* var, llvm::
|
|||
|
||||
LLConstant* DtoGEPi(LLConstant* ptr, unsigned i0, unsigned i1)
|
||||
{
|
||||
LLValue* v[2] = { DtoConstUint(i0), DtoConstUint(i1) };
|
||||
LLValue* v[] = { DtoConstUint(i0), DtoConstUint(i1) };
|
||||
return llvm::ConstantExpr::getGetElementPtr(ptr, v, true);
|
||||
}
|
||||
|
||||
|
@ -644,7 +644,7 @@ LLConstant* DtoConstFP(Type* t, longdouble value)
|
|||
if(llty == LLType::getFloatTy(gIR->context()) || llty == LLType::getDoubleTy(gIR->context()))
|
||||
return LLConstantFP::get(llty, value);
|
||||
else if(llty == LLType::getX86_FP80Ty(gIR->context())) {
|
||||
uint64_t bits[] = {0, 0};
|
||||
uint64_t bits[] = { 0, 0 };
|
||||
bits[0] = *reinterpret_cast<uint64_t*>(&value);
|
||||
bits[1] = *reinterpret_cast<uint16_t*>(reinterpret_cast<uint64_t*>(&value) + 1);
|
||||
#if LDC_LLVM_VER >= 303
|
||||
|
@ -678,7 +678,7 @@ LLConstant* DtoConstString(const char* str)
|
|||
#endif
|
||||
llvm::GlobalVariable* gvar = new llvm::GlobalVariable(
|
||||
*gIR->module, init->getType(), true, llvm::GlobalValue::InternalLinkage, init, ".str");
|
||||
LLConstant* idxs[2] = { DtoConstUint(0), DtoConstUint(0) };
|
||||
LLConstant* idxs[] = { DtoConstUint(0), DtoConstUint(0) };
|
||||
return DtoConstSlice(
|
||||
DtoConstSize_t(s.size()),
|
||||
llvm::ConstantExpr::getGetElementPtr(gvar, idxs, true),
|
||||
|
@ -697,7 +697,7 @@ LLConstant* DtoConstStringPtr(const char* str, const char* section)
|
|||
llvm::GlobalVariable* gvar = new llvm::GlobalVariable(
|
||||
*gIR->module, init->getType(), true, llvm::GlobalValue::InternalLinkage, init, ".str");
|
||||
if (section) gvar->setSection(section);
|
||||
LLConstant* idxs[2] = { DtoConstUint(0), DtoConstUint(0) };
|
||||
LLConstant* idxs[] = { DtoConstUint(0), DtoConstUint(0) };
|
||||
return llvm::ConstantExpr::getGetElementPtr(gvar, idxs, true);
|
||||
}
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit a2efaf9525894ccd0f649cc87fea269ff6263e4a
|
||||
Subproject commit 34f9dcf7aed758a3cce48cb77e4e77d7d877d676
|
Loading…
Add table
Add a link
Reference in a new issue