mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-04 17:11:44 +03:00
Add IF_LOG to more logging statements.
Evaluating arguments which call toChars() or toPrettyChars() are much more expensive then checking Logger::enabled().
This commit is contained in:
parent
d5684b25c7
commit
2b6dbb03f4
17 changed files with 331 additions and 387 deletions
12
gen/aa.cpp
12
gen/aa.cpp
|
@ -132,13 +132,11 @@ DValue* DtoAAIn(Loc& loc, Type* type, DValue* aa, DValue* key)
|
|||
llvm::Function* func = LLVM_D_GetRuntimeFunction(gIR->module, "_aaInX");
|
||||
LLFunctionType* funcTy = func->getFunctionType();
|
||||
|
||||
if (Logger::enabled())
|
||||
Logger::cout() << "_aaIn = " << *func << '\n';
|
||||
IF_LOG Logger::cout() << "_aaIn = " << *func << '\n';
|
||||
|
||||
// aa param
|
||||
LLValue* aaval = aa->getRVal();
|
||||
if (Logger::enabled())
|
||||
{
|
||||
IF_LOG {
|
||||
Logger::cout() << "aaval: " << *aaval << '\n';
|
||||
Logger::cout() << "totype: " << *funcTy->getParamType(0) << '\n';
|
||||
}
|
||||
|
@ -179,13 +177,11 @@ DValue *DtoAARemove(Loc& loc, DValue* aa, DValue* key)
|
|||
llvm::Function* func = LLVM_D_GetRuntimeFunction(gIR->module, "_aaDelX");
|
||||
LLFunctionType* funcTy = func->getFunctionType();
|
||||
|
||||
if (Logger::enabled())
|
||||
Logger::cout() << "_aaDel = " << *func << '\n';
|
||||
IF_LOG Logger::cout() << "_aaDel = " << *func << '\n';
|
||||
|
||||
// aa param
|
||||
LLValue* aaval = aa->getRVal();
|
||||
if (Logger::enabled())
|
||||
{
|
||||
IF_LOG {
|
||||
Logger::cout() << "aaval: " << *aaval << '\n';
|
||||
Logger::cout() << "totype: " << *funcTy->getParamType(0) << '\n';
|
||||
}
|
||||
|
|
|
@ -137,8 +137,7 @@ namespace {
|
|||
};
|
||||
|
||||
void classifyType(Classification& accum, Type* ty, d_uns64 offset) {
|
||||
if (Logger::enabled())
|
||||
Logger::cout() << "Classifying " << ty->toChars() << " @ " << offset << '\n';
|
||||
IF_LOG Logger::cout() << "Classifying " << ty->toChars() << " @ " << offset << '\n';
|
||||
|
||||
ty = ty->toBasetype();
|
||||
|
||||
|
@ -182,8 +181,7 @@ namespace {
|
|||
classifyType(accum, fields[i]->type, offset + fields[i]->offset);
|
||||
}
|
||||
} else {
|
||||
if (Logger::enabled())
|
||||
Logger::cout() << "x86-64 ABI: Implicitly handled type: "
|
||||
IF_LOG Logger::cout() << "x86-64 ABI: Implicitly handled type: "
|
||||
<< ty->toChars() << '\n';
|
||||
// arrays, delegates, etc. (pointer-sized fields, <= 16 bytes)
|
||||
assert((offset == 0 || offset == 8)
|
||||
|
@ -707,16 +705,14 @@ void X86_64TargetABI::rewriteFunctionType(TypeFunction* tf, IrFuncTy &fty) {
|
|||
for (IrFuncTy::ArgIter I = fty.args.begin(), E = fty.args.end(); I != E; ++I) {
|
||||
IrFuncTyArg& arg = **I;
|
||||
|
||||
if (Logger::enabled())
|
||||
Logger::cout() << "Arg: " << arg.type->toChars() << '\n';
|
||||
IF_LOG Logger::cout() << "Arg: " << arg.type->toChars() << '\n';
|
||||
|
||||
// Arguments that are in memory are of no interest to us.
|
||||
if (arg.byref)
|
||||
continue;
|
||||
|
||||
fixup(arg);
|
||||
if (Logger::enabled())
|
||||
Logger::cout() << "New arg type: " << *arg.ltype << '\n';
|
||||
IF_LOG Logger::cout() << "New arg type: " << *arg.ltype << '\n';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -153,8 +153,7 @@ struct IntrinsicABI : TargetABI
|
|||
for (IrFuncTy::ArgIter I = fty.args.begin(), E = fty.args.end(); I != E; ++I) {
|
||||
IrFuncTyArg& arg = **I;
|
||||
|
||||
if (Logger::enabled())
|
||||
Logger::cout() << "Arg: " << arg.type->toChars() << '\n';
|
||||
IF_LOG Logger::cout() << "Arg: " << arg.type->toChars() << '\n';
|
||||
|
||||
// Arguments that are in memory are of no interest to us.
|
||||
if (arg.byref)
|
||||
|
@ -164,8 +163,7 @@ struct IntrinsicABI : TargetABI
|
|||
if (ty->ty == Tstruct)
|
||||
fixup(arg);
|
||||
|
||||
if (Logger::enabled())
|
||||
Logger::cout() << "New arg type: " << *arg.ltype << '\n';
|
||||
IF_LOG Logger::cout() << "New arg type: " << *arg.ltype << '\n';
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -93,7 +93,7 @@ LLArrayType* DtoStaticArrayType(Type* t)
|
|||
|
||||
void DtoSetArrayToNull(LLValue* v)
|
||||
{
|
||||
Logger::println("DtoSetArrayToNull");
|
||||
IF_LOG Logger::println("DtoSetArrayToNull");
|
||||
LOG_SCOPE;
|
||||
|
||||
assert(isaPointer(v));
|
||||
|
@ -106,7 +106,7 @@ void DtoSetArrayToNull(LLValue* v)
|
|||
|
||||
void DtoArrayInit(Loc& loc, DValue* array, DValue* value, int op)
|
||||
{
|
||||
Logger::println("DtoArrayInit");
|
||||
IF_LOG Logger::println("DtoArrayInit");
|
||||
LOG_SCOPE;
|
||||
|
||||
if (op != -1 && op != TOKblit && arrayNeedsPostblit(array->type))
|
||||
|
@ -201,7 +201,7 @@ bool arrayNeedsPostblit(Type *t)
|
|||
// Does array assignment (or initialization) from another array of the same element type.
|
||||
void DtoArrayAssign(DValue *array, DValue *value, int op)
|
||||
{
|
||||
Logger::println("DtoArrayAssign");
|
||||
IF_LOG Logger::println("DtoArrayAssign");
|
||||
LOG_SCOPE;
|
||||
|
||||
assert(value && array);
|
||||
|
@ -228,7 +228,7 @@ void DtoArrayAssign(DValue *array, DValue *value, int op)
|
|||
// otherwise, does assignment to an array.
|
||||
void DtoArraySetAssign(Loc &loc, DValue *array, DValue *value, int op)
|
||||
{
|
||||
Logger::println("DtoArraySetAssign");
|
||||
IF_LOG Logger::println("DtoArraySetAssign");
|
||||
LOG_SCOPE;
|
||||
|
||||
assert(array && value);
|
||||
|
@ -253,7 +253,7 @@ void DtoArraySetAssign(Loc &loc, DValue *array, DValue *value, int op)
|
|||
|
||||
void DtoSetArray(DValue* array, LLValue* dim, LLValue* ptr)
|
||||
{
|
||||
Logger::println("SetArray");
|
||||
IF_LOG Logger::println("SetArray");
|
||||
LLValue *arr = array->getLVal();
|
||||
assert(isaStruct(arr->getType()->getContainedType(0)));
|
||||
DtoStore(dim, DtoGEPi(arr,0,0));
|
||||
|
@ -264,7 +264,7 @@ void DtoSetArray(DValue* array, LLValue* dim, LLValue* ptr)
|
|||
|
||||
LLConstant* DtoConstArrayInitializer(ArrayInitializer* arrinit)
|
||||
{
|
||||
Logger::println("DtoConstArrayInitializer: %s | %s", arrinit->toChars(), arrinit->type->toChars());
|
||||
IF_LOG Logger::println("DtoConstArrayInitializer: %s | %s", arrinit->toChars(), arrinit->type->toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
assert(arrinit->value.dim == arrinit->index.dim);
|
||||
|
@ -518,7 +518,7 @@ static void copySlice(LLValue* dstarr, LLValue* sz1, LLValue* srcarr, LLValue* s
|
|||
|
||||
void DtoArrayCopySlices(DSliceValue* dst, DSliceValue* src)
|
||||
{
|
||||
Logger::println("ArrayCopySlices");
|
||||
IF_LOG Logger::println("ArrayCopySlices");
|
||||
|
||||
LLValue *sz1,*sz2;
|
||||
LLValue* dstarr = get_slice_ptr(dst,sz1);
|
||||
|
@ -529,7 +529,7 @@ void DtoArrayCopySlices(DSliceValue* dst, DSliceValue* src)
|
|||
|
||||
void DtoArrayCopyToSlice(DSliceValue* dst, DValue* src)
|
||||
{
|
||||
Logger::println("ArrayCopyToSlice");
|
||||
IF_LOG Logger::println("ArrayCopyToSlice");
|
||||
|
||||
LLValue* sz1;
|
||||
LLValue* dstarr = get_slice_ptr(dst,sz1);
|
||||
|
@ -544,7 +544,7 @@ void DtoArrayCopyToSlice(DSliceValue* dst, DValue* src)
|
|||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
void DtoStaticArrayCopy(LLValue* dst, LLValue* src)
|
||||
{
|
||||
Logger::println("StaticArrayCopy");
|
||||
IF_LOG Logger::println("StaticArrayCopy");
|
||||
|
||||
size_t n = getTypePaddedSize(dst->getType()->getContainedType(0));
|
||||
DtoMemCpy(dst, src, DtoConstSize_t(n));
|
||||
|
@ -571,7 +571,7 @@ static bool isInitialized(Type* et) {
|
|||
}
|
||||
// If it's a typedef with "= void" initializer then don't initialize.
|
||||
if (et->ty == Ttypedef) {
|
||||
Logger::println("Typedef: %s", et->toChars());
|
||||
IF_LOG Logger::println("Typedef: %s", et->toChars());
|
||||
TypedefDeclaration* tdd = static_cast<TypeTypedef*>(et)->sym;
|
||||
if (tdd && tdd->init && tdd->init->isVoidInitializer())
|
||||
return false;
|
||||
|
@ -599,7 +599,7 @@ static DSliceValue *getSlice(Type *arrayType, LLValue *array)
|
|||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
DSliceValue* DtoNewDynArray(Loc& loc, Type* arrayType, DValue* dim, bool defaultInit)
|
||||
{
|
||||
Logger::println("DtoNewDynArray : %s", arrayType->toChars());
|
||||
IF_LOG Logger::println("DtoNewDynArray : %s", arrayType->toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
// typeinfo arg
|
||||
|
@ -629,7 +629,7 @@ DSliceValue* DtoNewDynArray(Loc& loc, Type* arrayType, DValue* dim, bool default
|
|||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
DSliceValue* DtoNewMulDimDynArray(Loc& loc, Type* arrayType, DValue** dims, size_t ndims, bool defaultInit)
|
||||
{
|
||||
Logger::println("DtoNewMulDimDynArray : %s", arrayType->toChars());
|
||||
IF_LOG Logger::println("DtoNewMulDimDynArray : %s", arrayType->toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
// typeinfo arg
|
||||
|
@ -661,8 +661,7 @@ DSliceValue* DtoNewMulDimDynArray(Loc& loc, Type* arrayType, DValue** dims, size
|
|||
// call allocator
|
||||
LLValue* newptr = gIR->CreateCallOrInvoke(fn, args, ".gc_mem").getInstruction();
|
||||
|
||||
if (Logger::enabled())
|
||||
Logger::cout() << "final ptr = " << *newptr << '\n';
|
||||
IF_LOG Logger::cout() << "final ptr = " << *newptr << '\n';
|
||||
|
||||
return getSlice(arrayType, newptr);
|
||||
}
|
||||
|
@ -670,7 +669,7 @@ DSliceValue* DtoNewMulDimDynArray(Loc& loc, Type* arrayType, DValue** dims, size
|
|||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
DSliceValue* DtoResizeDynArray(Type* arrayType, DValue* array, LLValue* newdim)
|
||||
{
|
||||
Logger::println("DtoResizeDynArray : %s", arrayType->toChars());
|
||||
IF_LOG Logger::println("DtoResizeDynArray : %s", arrayType->toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
assert(array);
|
||||
|
@ -698,7 +697,7 @@ DSliceValue* DtoResizeDynArray(Type* arrayType, DValue* array, LLValue* newdim)
|
|||
|
||||
void DtoCatAssignElement(Loc& loc, Type* arrayType, DValue* array, Expression* exp)
|
||||
{
|
||||
Logger::println("DtoCatAssignElement");
|
||||
IF_LOG Logger::println("DtoCatAssignElement");
|
||||
LOG_SCOPE;
|
||||
|
||||
assert(array);
|
||||
|
@ -729,7 +728,7 @@ void DtoCatAssignElement(Loc& loc, Type* arrayType, DValue* array, Expression* e
|
|||
|
||||
DSliceValue* DtoCatAssignArray(DValue* arr, Expression* exp)
|
||||
{
|
||||
Logger::println("DtoCatAssignArray");
|
||||
IF_LOG Logger::println("DtoCatAssignArray");
|
||||
LOG_SCOPE;
|
||||
Type *arrayType = arr->getType();
|
||||
|
||||
|
@ -755,7 +754,7 @@ DSliceValue* DtoCatAssignArray(DValue* arr, Expression* exp)
|
|||
|
||||
DSliceValue* DtoCatArrays(Type* arrayType, Expression* exp1, Expression* exp2)
|
||||
{
|
||||
Logger::println("DtoCatAssignArray");
|
||||
IF_LOG Logger::println("DtoCatAssignArray");
|
||||
LOG_SCOPE;
|
||||
|
||||
std::vector<LLValue*> args;
|
||||
|
@ -827,7 +826,7 @@ DSliceValue* DtoAppendDChar(DValue* arr, Expression* exp, const char *func)
|
|||
|
||||
DSliceValue* DtoAppendDCharToString(DValue* arr, Expression* exp)
|
||||
{
|
||||
Logger::println("DtoAppendDCharToString");
|
||||
IF_LOG Logger::println("DtoAppendDCharToString");
|
||||
LOG_SCOPE;
|
||||
return DtoAppendDChar(arr, exp, "_d_arrayappendcd");
|
||||
}
|
||||
|
@ -836,7 +835,7 @@ DSliceValue* DtoAppendDCharToString(DValue* arr, Expression* exp)
|
|||
|
||||
DSliceValue* DtoAppendDCharToUnicodeString(DValue* arr, Expression* exp)
|
||||
{
|
||||
Logger::println("DtoAppendDCharToUnicodeString");
|
||||
IF_LOG Logger::println("DtoAppendDCharToUnicodeString");
|
||||
LOG_SCOPE;
|
||||
return DtoAppendDChar(arr, exp, "_d_arrayappendwd");
|
||||
}
|
||||
|
@ -845,7 +844,7 @@ DSliceValue* DtoAppendDCharToUnicodeString(DValue* arr, Expression* exp)
|
|||
// helper for eq and cmp
|
||||
static LLValue* DtoArrayEqCmp_impl(Loc& loc, const char* func, DValue* l, DValue* r, bool useti)
|
||||
{
|
||||
Logger::println("comparing arrays");
|
||||
IF_LOG Logger::println("comparing arrays");
|
||||
LLFunction* fn = LLVM_D_GetRuntimeFunction(gIR->module, func);
|
||||
assert(fn);
|
||||
|
||||
|
@ -910,7 +909,7 @@ LLValue* DtoArrayCompare(Loc& loc, TOK op, DValue* l, DValue* r)
|
|||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
LLValue* DtoArrayCastLength(LLValue* len, LLType* elemty, LLType* newelemty)
|
||||
{
|
||||
Logger::println("DtoArrayCastLength");
|
||||
IF_LOG Logger::println("DtoArrayCastLength");
|
||||
LOG_SCOPE;
|
||||
|
||||
assert(len);
|
||||
|
@ -960,7 +959,7 @@ LLValue* DtoDynArrayIs(TOK op, DValue* l, DValue* r)
|
|||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
LLValue* DtoArrayLen(DValue* v)
|
||||
{
|
||||
Logger::println("DtoArrayLen");
|
||||
IF_LOG Logger::println("DtoArrayLen");
|
||||
LOG_SCOPE;
|
||||
|
||||
Type* t = v->getType()->toBasetype();
|
||||
|
@ -986,7 +985,7 @@ LLValue* DtoArrayLen(DValue* v)
|
|||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
LLValue* DtoArrayPtr(DValue* v)
|
||||
{
|
||||
Logger::println("DtoArrayPtr");
|
||||
IF_LOG Logger::println("DtoArrayPtr");
|
||||
LOG_SCOPE;
|
||||
|
||||
Type* t = v->getType()->toBasetype();
|
||||
|
@ -1011,7 +1010,7 @@ LLValue* DtoArrayPtr(DValue* v)
|
|||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
DValue* DtoCastArray(Loc& loc, DValue* u, Type* to)
|
||||
{
|
||||
Logger::println("DtoCastArray");
|
||||
IF_LOG Logger::println("DtoCastArray");
|
||||
LOG_SCOPE;
|
||||
|
||||
LLType* tolltype = DtoType(to);
|
||||
|
@ -1027,19 +1026,16 @@ DValue* DtoCastArray(Loc& loc, DValue* u, Type* to)
|
|||
LLValue* rval2;
|
||||
bool isslice = false;
|
||||
|
||||
if (Logger::enabled())
|
||||
Logger::cout() << "from array or sarray" << '\n';
|
||||
IF_LOG Logger::cout() << "from array or sarray" << '\n';
|
||||
|
||||
if (totype->ty == Tpointer) {
|
||||
if (Logger::enabled())
|
||||
Logger::cout() << "to pointer" << '\n';
|
||||
IF_LOG Logger::cout() << "to pointer" << '\n';
|
||||
rval = DtoArrayPtr(u);
|
||||
if (rval->getType() != tolltype)
|
||||
rval = gIR->ir->CreateBitCast(rval, tolltype, "tmp");
|
||||
}
|
||||
else if (totype->ty == Tarray) {
|
||||
if (Logger::enabled())
|
||||
Logger::cout() << "to array" << '\n';
|
||||
IF_LOG Logger::cout() << "to array" << '\n';
|
||||
|
||||
LLType* ptrty = DtoArrayType(totype)->getContainedType(1);
|
||||
LLType* ety = voidToI8(DtoType(fromtype->nextOf()));
|
||||
|
@ -1047,8 +1043,7 @@ DValue* DtoCastArray(Loc& loc, DValue* u, Type* to)
|
|||
if (fromtype->ty == Tsarray) {
|
||||
LLValue* uval = u->getRVal();
|
||||
|
||||
if (Logger::enabled())
|
||||
Logger::cout() << "uvalTy = " << *uval->getType() << '\n';
|
||||
IF_LOG Logger::cout() << "uvalTy = " << *uval->getType() << '\n';
|
||||
|
||||
assert(isaPointer(uval->getType()));
|
||||
LLArrayType* arrty = isaArray(uval->getType()->getContainedType(0));
|
||||
|
@ -1076,16 +1071,14 @@ DValue* DtoCastArray(Loc& loc, DValue* u, Type* to)
|
|||
isslice = true;
|
||||
}
|
||||
else if (totype->ty == Tsarray) {
|
||||
if (Logger::enabled())
|
||||
Logger::cout() << "to sarray" << '\n';
|
||||
IF_LOG Logger::cout() << "to sarray" << '\n';
|
||||
|
||||
size_t tosize = static_cast<TypeSArray*>(totype)->dim->toInteger();
|
||||
|
||||
if (fromtype->ty == Tsarray) {
|
||||
LLValue* uval = u->getRVal();
|
||||
|
||||
if (Logger::enabled())
|
||||
Logger::cout() << "uvalTy = " << *uval->getType() << '\n';
|
||||
IF_LOG Logger::cout() << "uvalTy = " << *uval->getType() << '\n';
|
||||
|
||||
assert(isaPointer(uval->getType()));
|
||||
|
||||
|
|
|
@ -218,7 +218,7 @@ int AsmStatement::blockExit(bool mustNotThrow)
|
|||
void
|
||||
AsmStatement_toIR(AsmStatement *stmt, IRState * irs)
|
||||
{
|
||||
Logger::println("AsmStatement::toIR(): %s", stmt->loc.toChars());
|
||||
IF_LOG Logger::println("AsmStatement::toIR(): %s", stmt->loc.toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
// sanity check
|
||||
|
@ -369,7 +369,7 @@ AsmStatement_toIR(AsmStatement *stmt, IRState * irs)
|
|||
}
|
||||
|
||||
typedef std::vector<std::string>::iterator It;
|
||||
if (Logger::enabled()) {
|
||||
IF_LOG {
|
||||
Logger::cout() << "final asm: " << code->insnTemplate << '\n';
|
||||
std::ostringstream ss;
|
||||
|
||||
|
@ -435,7 +435,7 @@ AsmStatement_toIR(AsmStatement *stmt, IRState * irs)
|
|||
asmblock->clobs.insert(clobstr);
|
||||
}
|
||||
|
||||
if (Logger::enabled()) {
|
||||
IF_LOG {
|
||||
typedef std::vector<LLValue*>::iterator It;
|
||||
{
|
||||
Logger::println("Output values:");
|
||||
|
@ -535,7 +535,7 @@ LLValue* DtoAggrPairSwap(LLValue* aggr);
|
|||
|
||||
void AsmBlockStatement_toIR(AsmBlockStatement *stmt, IRState* p)
|
||||
{
|
||||
Logger::println("AsmBlockStatement::toIR(): %s", stmt->loc.toChars());
|
||||
IF_LOG Logger::println("AsmBlockStatement::toIR(): %s", stmt->loc.toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
// disable inlining by default
|
||||
|
@ -614,7 +614,7 @@ void AsmBlockStatement_toIR(AsmBlockStatement *stmt, IRState* p)
|
|||
gotoToVal[a->isBranchToLabel] = n_goto;
|
||||
|
||||
// provide an in-asm target for the branch and set value
|
||||
Logger::println("statement '%s' references outer label '%s': creating forwarder", a->code.c_str(), a->isBranchToLabel->string);
|
||||
IF_LOG Logger::println("statement '%s' references outer label '%s': creating forwarder", a->code.c_str(), a->isBranchToLabel->string);
|
||||
printLabelName(code, fdmangle, a->isBranchToLabel->string);
|
||||
code << ":\n\t";
|
||||
code << "movl $<<in" << n_goto << ">>, $<<out0>>\n";
|
||||
|
@ -727,8 +727,10 @@ void AsmBlockStatement_toIR(AsmBlockStatement *stmt, IRState* p)
|
|||
if (!out_c.empty())
|
||||
out_c.resize(out_c.size()-1);
|
||||
|
||||
IF_LOG {
|
||||
Logger::println("code = \"%s\"", code.c_str());
|
||||
Logger::println("constraints = \"%s\"", out_c.c_str());
|
||||
}
|
||||
|
||||
// build return types
|
||||
LLType* retty;
|
||||
|
@ -742,14 +744,13 @@ void AsmBlockStatement_toIR(AsmBlockStatement *stmt, IRState* p)
|
|||
types.insert(types.end(), outtypes.begin(), outtypes.end());
|
||||
types.insert(types.end(), intypes.begin(), intypes.end());
|
||||
llvm::FunctionType* fty = llvm::FunctionType::get(retty, types, false);
|
||||
if (Logger::enabled())
|
||||
Logger::cout() << "function type = " << *fty << '\n';
|
||||
IF_LOG Logger::cout() << "function type = " << *fty << '\n';
|
||||
|
||||
std::vector<LLValue*> args;
|
||||
args.insert(args.end(), outargs.begin(), outargs.end());
|
||||
args.insert(args.end(), inargs.begin(), inargs.end());
|
||||
|
||||
if (Logger::enabled()) {
|
||||
IF_LOG {
|
||||
Logger::cout() << "Arguments:" << '\n';
|
||||
Logger::indent();
|
||||
for (std::vector<LLValue*>::iterator b = args.begin(), i = b, e = args.end(); i != e; ++i) {
|
||||
|
@ -766,8 +767,7 @@ void AsmBlockStatement_toIR(AsmBlockStatement *stmt, IRState* p)
|
|||
llvm::CallInst* call = p->ir->CreateCall(ia, args,
|
||||
retty == LLType::getVoidTy(gIR->context()) ? "" : "asm");
|
||||
|
||||
if (Logger::enabled())
|
||||
Logger::cout() << "Complete asm statement: " << *call << '\n';
|
||||
IF_LOG Logger::cout() << "Complete asm statement: " << *call << '\n';
|
||||
|
||||
// capture abi return value
|
||||
if (useabiret)
|
||||
|
@ -870,7 +870,7 @@ AsmBlockStatement* AsmBlockStatement::endsWithAsm()
|
|||
|
||||
void AsmStatement_toNakedIR(AsmStatement *stmt, IRState *irs)
|
||||
{
|
||||
Logger::println("AsmStatement::toNakedIR(): %s", stmt->loc.toChars());
|
||||
IF_LOG Logger::println("AsmStatement::toNakedIR(): %s", stmt->loc.toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
// is there code?
|
||||
|
|
|
@ -37,7 +37,7 @@ void DtoResolveClass(ClassDeclaration* cd)
|
|||
if (cd->ir.resolved) return;
|
||||
cd->ir.resolved = true;
|
||||
|
||||
Logger::println("DtoResolveClass(%s): %s", cd->toPrettyChars(), cd->loc.toChars());
|
||||
IF_LOG Logger::println("DtoResolveClass(%s): %s", cd->toPrettyChars(), cd->loc.toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
// make sure the base classes are processed first
|
||||
|
@ -123,8 +123,7 @@ DValue* DtoNewClass(Loc loc, TypeClass* tc, NewExp* newexp)
|
|||
size_t idx = tc->sym->vthis->ir.irField->index;
|
||||
LLValue* src = thisval->getRVal();
|
||||
LLValue* dst = DtoGEPi(mem,0,idx,"tmp");
|
||||
if (Logger::enabled())
|
||||
Logger::cout() << "dst: " << *dst << "\nsrc: " << *src << '\n';
|
||||
IF_LOG Logger::cout() << "dst: " << *dst << "\nsrc: " << *src << '\n';
|
||||
DtoStore(src, DtoBitCast(dst, getPtrToType(src->getType())));
|
||||
}
|
||||
// set the context for nested classes
|
||||
|
@ -202,7 +201,7 @@ void DtoFinalizeClass(LLValue* inst)
|
|||
|
||||
DValue* DtoCastClass(DValue* val, Type* _to)
|
||||
{
|
||||
Logger::println("DtoCastClass(%s, %s)", val->getType()->toChars(), _to->toChars());
|
||||
IF_LOG Logger::println("DtoCastClass(%s, %s)", val->getType()->toChars(), _to->toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
Type* to = _to->toBasetype();
|
||||
|
@ -270,8 +269,7 @@ DValue* DtoCastClass(DValue* val, Type* _to)
|
|||
LLValue* orig = v;
|
||||
v = DtoGEPi(v, 0, i_index);
|
||||
LLType* ifType = DtoType(_to);
|
||||
if (Logger::enabled())
|
||||
{
|
||||
IF_LOG {
|
||||
Logger::cout() << "V = " << *v << std::endl;
|
||||
Logger::cout() << "T = " << *ifType << std::endl;
|
||||
}
|
||||
|
@ -417,11 +415,10 @@ DValue* DtoDynamicCastInterface(DValue* val, Type* _to)
|
|||
|
||||
LLValue* DtoIndexClass(LLValue* src, ClassDeclaration* cd, VarDeclaration* vd)
|
||||
{
|
||||
Logger::println("indexing class field %s:", vd->toPrettyChars());
|
||||
IF_LOG Logger::println("indexing class field %s:", vd->toPrettyChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
if (Logger::enabled())
|
||||
Logger::cout() << "src: " << *src << '\n';
|
||||
IF_LOG Logger::cout() << "src: " << *src << '\n';
|
||||
|
||||
// make sure class is resolved
|
||||
DtoResolveClass(cd);
|
||||
|
@ -437,8 +434,7 @@ LLValue* DtoIndexClass(LLValue* src, ClassDeclaration* cd, VarDeclaration* vd)
|
|||
|
||||
// gep to the index
|
||||
#if 0
|
||||
if (Logger::enabled())
|
||||
{
|
||||
IF_LOG {
|
||||
Logger::cout() << "src2: " << *src << '\n';
|
||||
Logger::cout() << "index: " << field->index << '\n';
|
||||
Logger::cout() << "srctype: " << *src->getType() << '\n';
|
||||
|
@ -458,8 +454,7 @@ LLValue* DtoIndexClass(LLValue* src, ClassDeclaration* cd, VarDeclaration* vd)
|
|||
// cast it to the right type
|
||||
val = DtoBitCast(val, getPtrToType(i1ToI8(DtoType(vd->type))));
|
||||
|
||||
if (Logger::enabled())
|
||||
Logger::cout() << "value: " << *val << '\n';
|
||||
IF_LOG Logger::cout() << "value: " << *val << '\n';
|
||||
|
||||
return val;
|
||||
}
|
||||
|
@ -477,8 +472,7 @@ LLValue* DtoVirtualFunctionPointer(DValue* inst, FuncDeclaration* fdecl, char* n
|
|||
|
||||
// get instance
|
||||
LLValue* vthis = inst->getRVal();
|
||||
if (Logger::enabled())
|
||||
Logger::cout() << "vthis: " << *vthis << '\n';
|
||||
IF_LOG Logger::cout() << "vthis: " << *vthis << '\n';
|
||||
|
||||
LLValue* funcval = vthis;
|
||||
// get the vtbl for objects
|
||||
|
@ -492,8 +486,7 @@ LLValue* DtoVirtualFunctionPointer(DValue* inst, FuncDeclaration* fdecl, char* n
|
|||
// load funcptr
|
||||
funcval = DtoAlignedLoad(funcval);
|
||||
|
||||
if (Logger::enabled())
|
||||
Logger::cout() << "funcval: " << *funcval << '\n';
|
||||
IF_LOG Logger::cout() << "funcval: " << *funcval << '\n';
|
||||
|
||||
// cast to final funcptr type
|
||||
funcval = DtoBitCast(funcval, getPtrToType(DtoFunctionType(fdecl)));
|
||||
|
@ -501,8 +494,7 @@ LLValue* DtoVirtualFunctionPointer(DValue* inst, FuncDeclaration* fdecl, char* n
|
|||
// postpone naming until after casting to get the name in call instructions
|
||||
funcval->setName(name);
|
||||
|
||||
if (Logger::enabled())
|
||||
Logger::cout() << "funcval casted: " << *funcval << '\n';
|
||||
IF_LOG Logger::cout() << "funcval casted: " << *funcval << '\n';
|
||||
|
||||
return funcval;
|
||||
}
|
||||
|
@ -644,7 +636,7 @@ LLConstant* DtoDefineClassInfo(ClassDeclaration* cd)
|
|||
// TypeInfo typeinfo; // since dmd 1.045
|
||||
// }
|
||||
|
||||
Logger::println("DtoDefineClassInfo(%s)", cd->toChars());
|
||||
IF_LOG Logger::println("DtoDefineClassInfo(%s)", cd->toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
assert(cd->type->ty == Tclass);
|
||||
|
|
|
@ -276,8 +276,7 @@ public:
|
|||
if (decl->nakedUse)
|
||||
irs->usedArray.push_back(DtoBitCast(gvar, getVoidPtrType()));
|
||||
|
||||
if (Logger::enabled())
|
||||
Logger::cout() << *gvar << '\n';
|
||||
IF_LOG Logger::cout() << *gvar << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -55,8 +55,7 @@ namespace llvm
|
|||
|
||||
llvm::FunctionType* DtoFunctionType(Type* type, IrFuncTy &irFty, Type* thistype, Type* nesttype, bool isMain, bool isCtor)
|
||||
{
|
||||
if (Logger::enabled())
|
||||
Logger::println("DtoFunctionType(%s)", type->toChars());
|
||||
IF_LOG Logger::println("DtoFunctionType(%s)", type->toChars());
|
||||
LOG_SCOPE
|
||||
|
||||
// sanity check
|
||||
|
@ -311,7 +310,7 @@ llvm::FunctionType* DtoFunctionType(Type* type, IrFuncTy &irFty, Type* thistype,
|
|||
|
||||
irFty.funcType = LLFunctionType::get(irFty.ret->ltype, argtypes, irFty.c_vararg);
|
||||
|
||||
Logger::cout() << "Final function type: " << *irFty.funcType << "\n";
|
||||
IF_LOG Logger::cout() << "Final function type: " << *irFty.funcType << "\n";
|
||||
|
||||
return irFty.funcType;
|
||||
}
|
||||
|
@ -456,7 +455,7 @@ llvm::FunctionType* DtoFunctionType(FuncDeclaration* fdecl)
|
|||
} else
|
||||
if (fdecl->needThis()) {
|
||||
if (AggregateDeclaration* ad = fdecl->isMember2()) {
|
||||
Logger::println("isMember = this is: %s", ad->type->toChars());
|
||||
IF_LOG Logger::println("isMember = this is: %s", ad->type->toChars());
|
||||
dthis = ad->type;
|
||||
LLType* thisty = DtoType(dthis);
|
||||
//Logger::cout() << "this llvm type: " << *thisty << '\n';
|
||||
|
@ -464,7 +463,7 @@ llvm::FunctionType* DtoFunctionType(FuncDeclaration* fdecl)
|
|||
thisty = getPtrToType(thisty);
|
||||
}
|
||||
else {
|
||||
Logger::println("chars: %s type: %s kind: %s", fdecl->toChars(), fdecl->type->toChars(), fdecl->kind());
|
||||
IF_LOG Logger::println("chars: %s type: %s kind: %s", fdecl->toChars(), fdecl->type->toChars(), fdecl->kind());
|
||||
llvm_unreachable("needThis, but invalid parent declaration.");
|
||||
}
|
||||
}
|
||||
|
@ -501,7 +500,7 @@ static llvm::Function* DtoDeclareVaFunction(FuncDeclaration* fdecl)
|
|||
void DtoResolveFunction(FuncDeclaration* fdecl)
|
||||
{
|
||||
if ((!global.params.useUnitTests || !fdecl->type) && fdecl->isUnitTestDeclaration()) {
|
||||
Logger::println("Ignoring unittest %s", fdecl->toPrettyChars());
|
||||
IF_LOG Logger::println("Ignoring unittest %s", fdecl->toPrettyChars());
|
||||
return; // ignore declaration completely
|
||||
}
|
||||
|
||||
|
@ -576,7 +575,7 @@ void DtoResolveFunction(FuncDeclaration* fdecl)
|
|||
|
||||
DtoFunctionType(fdecl);
|
||||
|
||||
Logger::println("DtoResolveFunction(%s): %s", fdecl->toPrettyChars(), fdecl->loc.toChars());
|
||||
IF_LOG Logger::println("DtoResolveFunction(%s): %s", fdecl->toPrettyChars(), fdecl->loc.toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
// queue declaration unless the function is abstract without body
|
||||
|
@ -739,7 +738,7 @@ void DtoDeclareFunction(FuncDeclaration* fdecl)
|
|||
if (fdecl->ir.declared) return;
|
||||
fdecl->ir.declared = true;
|
||||
|
||||
Logger::println("DtoDeclareFunction(%s): %s", fdecl->toPrettyChars(), fdecl->loc.toChars());
|
||||
IF_LOG Logger::println("DtoDeclareFunction(%s): %s", fdecl->toPrettyChars(), fdecl->loc.toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
if (fdecl->isUnitTestDeclaration() && !global.params.useUnitTests)
|
||||
|
@ -810,8 +809,7 @@ void DtoDeclareFunction(FuncDeclaration* fdecl)
|
|||
|
||||
func->setCallingConv(gABI->callingConv(link));
|
||||
|
||||
if (Logger::enabled())
|
||||
Logger::cout() << "func = " << *func << std::endl;
|
||||
IF_LOG Logger::cout() << "func = " << *func << std::endl;
|
||||
|
||||
// add func to IRFunc
|
||||
fdecl->ir.irFunc->func = func;
|
||||
|
@ -922,8 +920,7 @@ void DtoDeclareFunction(FuncDeclaration* fdecl)
|
|||
|
||||
void DtoDefineFunction(FuncDeclaration* fd)
|
||||
{
|
||||
if (Logger::enabled())
|
||||
Logger::println("DtoDefineFunction(%s): %s", fd->toPrettyChars(), fd->loc.toChars());
|
||||
IF_LOG Logger::println("DtoDefineFunction(%s): %s", fd->toPrettyChars(), fd->loc.toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
if (fd->ir.defined) return;
|
||||
|
@ -1037,7 +1034,7 @@ void DtoDefineFunction(FuncDeclaration* fd)
|
|||
if (fd->fbody == NULL)
|
||||
return;
|
||||
|
||||
Logger::println("Doing function body for: %s", fd->toChars());
|
||||
IF_LOG Logger::println("Doing function body for: %s", fd->toChars());
|
||||
assert(fd->ir.irFunc);
|
||||
IrFunction* irfunction = fd->ir.irFunc;
|
||||
gIR->functions.push_back(irfunction);
|
||||
|
@ -1278,7 +1275,7 @@ llvm::FunctionType* DtoBaseFunctionType(FuncDeclaration* fdecl)
|
|||
|
||||
DValue* DtoArgument(Parameter* fnarg, Expression* argexp)
|
||||
{
|
||||
Logger::println("DtoArgument");
|
||||
IF_LOG Logger::println("DtoArgument");
|
||||
LOG_SCOPE;
|
||||
|
||||
DValue* arg = argexp->toElem(gIR);
|
||||
|
@ -1312,7 +1309,7 @@ DValue* DtoArgument(Parameter* fnarg, Expression* argexp)
|
|||
|
||||
void DtoVariadicArgument(Expression* argexp, LLValue* dst)
|
||||
{
|
||||
Logger::println("DtoVariadicArgument");
|
||||
IF_LOG Logger::println("DtoVariadicArgument");
|
||||
LOG_SCOPE;
|
||||
DVarValue vv(argexp->type, dst);
|
||||
DtoAssign(argexp->loc, &vv, argexp->toElem(gIR));
|
||||
|
|
|
@ -378,7 +378,7 @@ void DtoLeaveMonitor(LLValue* v)
|
|||
|
||||
void DtoAssign(Loc& loc, DValue* lhs, DValue* rhs, int op, bool canSkipPostblit)
|
||||
{
|
||||
Logger::println("DtoAssign()");
|
||||
IF_LOG Logger::println("DtoAssign()");
|
||||
LOG_SCOPE;
|
||||
|
||||
Type* t = lhs->getType()->toBasetype();
|
||||
|
@ -463,7 +463,7 @@ void DtoAssign(Loc& loc, DValue* lhs, DValue* rhs, int op, bool canSkipPostblit)
|
|||
else if (t->ty == Tdelegate) {
|
||||
LLValue* l = lhs->getLVal();
|
||||
LLValue* r = rhs->getRVal();
|
||||
if (Logger::enabled()) {
|
||||
IF_LOG {
|
||||
Logger::cout() << "lhs: " << *l << '\n';
|
||||
Logger::cout() << "rhs: " << *r << '\n';
|
||||
}
|
||||
|
@ -473,8 +473,7 @@ void DtoAssign(Loc& loc, DValue* lhs, DValue* rhs, int op, bool canSkipPostblit)
|
|||
assert(t2->ty == Tclass);
|
||||
LLValue* l = lhs->getLVal();
|
||||
LLValue* r = rhs->getRVal();
|
||||
if (Logger::enabled())
|
||||
{
|
||||
IF_LOG {
|
||||
Logger::cout() << "l : " << *l << '\n';
|
||||
Logger::cout() << "r : " << *r << '\n';
|
||||
}
|
||||
|
@ -489,14 +488,14 @@ void DtoAssign(Loc& loc, DValue* lhs, DValue* rhs, int op, bool canSkipPostblit)
|
|||
else {
|
||||
LLValue* l = lhs->getLVal();
|
||||
LLValue* r = rhs->getRVal();
|
||||
if (Logger::enabled()) {
|
||||
IF_LOG {
|
||||
Logger::cout() << "lhs: " << *l << '\n';
|
||||
Logger::cout() << "rhs: " << *r << '\n';
|
||||
}
|
||||
LLType* lit = l->getType()->getContainedType(0);
|
||||
if (r->getType() != lit) {
|
||||
r = DtoCast(loc, rhs, lhs->getType())->getRVal();
|
||||
if (Logger::enabled()) {
|
||||
IF_LOG {
|
||||
Logger::println("Type mismatch, really assigning:");
|
||||
LOG_SCOPE
|
||||
Logger::cout() << "lhs: " << *l << '\n';
|
||||
|
@ -585,8 +584,7 @@ DValue* DtoCastInt(Loc& loc, DValue* val, Type* _to)
|
|||
}
|
||||
else if (to->isintegral()) {
|
||||
if (fromsz < tosz || from->ty == Tbool) {
|
||||
if (Logger::enabled())
|
||||
Logger::cout() << "cast to: " << *tolltype << '\n';
|
||||
IF_LOG Logger::cout() << "cast to: " << *tolltype << '\n';
|
||||
if (isLLVMUnsigned(from) || from->ty == Tbool) {
|
||||
rval = new llvm::ZExtInst(rval, tolltype, "tmp", gIR->scopebb());
|
||||
} else {
|
||||
|
@ -612,8 +610,7 @@ DValue* DtoCastInt(Loc& loc, DValue* val, Type* _to)
|
|||
}
|
||||
}
|
||||
else if (to->ty == Tpointer) {
|
||||
if (Logger::enabled())
|
||||
Logger::cout() << "cast pointer: " << *tolltype << '\n';
|
||||
IF_LOG Logger::cout() << "cast pointer: " << *tolltype << '\n';
|
||||
rval = gIR->ir->CreateIntToPtr(rval, tolltype, "tmp");
|
||||
}
|
||||
else {
|
||||
|
@ -636,8 +633,7 @@ DValue* DtoCastPtr(Loc& loc, DValue* val, Type* to)
|
|||
|
||||
if (totype->ty == Tpointer || totype->ty == Tclass) {
|
||||
LLValue* src = val->getRVal();
|
||||
if (Logger::enabled())
|
||||
{
|
||||
IF_LOG {
|
||||
Logger::cout() << "src: " << *src << '\n';
|
||||
Logger::cout() << "to type: " << *tolltype << '\n';
|
||||
}
|
||||
|
@ -739,15 +735,13 @@ DValue* DtoCastNull(Loc& loc, DValue* val, Type* to)
|
|||
|
||||
if (totype->ty == Tpointer || totype->ty == Tclass)
|
||||
{
|
||||
if (Logger::enabled())
|
||||
Logger::cout() << "cast null to pointer/class: " << *tolltype << '\n';
|
||||
IF_LOG Logger::cout() << "cast null to pointer/class: " << *tolltype << '\n';
|
||||
LLValue *rval = DtoBitCast(val->getRVal(), tolltype);
|
||||
return new DImValue(to, rval);
|
||||
}
|
||||
if (totype->ty == Tarray)
|
||||
{
|
||||
if (Logger::enabled())
|
||||
Logger::cout() << "cast null to array: " << *tolltype << '\n';
|
||||
IF_LOG Logger::cout() << "cast null to array: " << *tolltype << '\n';
|
||||
LLValue *rval = val->getRVal();
|
||||
rval = DtoBitCast(rval, DtoType(to->nextOf()->pointerTo()));
|
||||
rval = DtoAggrPair(DtoConstSize_t(0), rval, "null_array");
|
||||
|
@ -784,21 +778,15 @@ DValue* DtoCastVector(Loc& loc, DValue* val, Type* to)
|
|||
if (val->isLVal())
|
||||
{
|
||||
LLValue* vector = val->getLVal();
|
||||
if (Logger::enabled())
|
||||
{
|
||||
Logger::cout() << "src: " << *vector << "to type: " <<
|
||||
*tolltype << " (casting address)\n";
|
||||
}
|
||||
IF_LOG Logger::cout() << "src: " << *vector << "to type: "
|
||||
<< *tolltype << " (casting address)\n";
|
||||
return new DVarValue(to, DtoBitCast(vector, getPtrToType(tolltype)));
|
||||
}
|
||||
else
|
||||
{
|
||||
LLValue* vector = val->getRVal();
|
||||
if (Logger::enabled())
|
||||
{
|
||||
Logger::cout() << "src: " << *vector << "to type: " <<
|
||||
*tolltype << " (creating temporary)\n";
|
||||
}
|
||||
IF_LOG Logger::cout() << "src: " << *vector << "to type: "
|
||||
<< *tolltype << " (creating temporary)\n";
|
||||
LLValue *array = DtoAlloca(to);
|
||||
|
||||
TypeSArray *st = static_cast<TypeSArray*>(totype);
|
||||
|
@ -857,7 +845,7 @@ DValue* DtoCast(Loc& loc, DValue* val, Type* to)
|
|||
if (fromtype->equals(totype))
|
||||
return val;
|
||||
|
||||
Logger::println("Casting from '%s' to '%s'", fromtype->toChars(), to->toChars());
|
||||
IF_LOG Logger::println("Casting from '%s' to '%s'", fromtype->toChars(), to->toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
if (fromtype->ty == Tvector) {
|
||||
|
@ -900,7 +888,7 @@ DValue* DtoCast(Loc& loc, DValue* val, Type* to)
|
|||
DValue* DtoPaintType(Loc& loc, DValue* val, Type* to)
|
||||
{
|
||||
Type* from = val->getType()->toBasetype();
|
||||
Logger::println("repainting from '%s' to '%s'", from->toChars(), to->toChars());
|
||||
IF_LOG Logger::println("repainting from '%s' to '%s'", from->toChars(), to->toChars());
|
||||
|
||||
if (from->ty == Tarray)
|
||||
{
|
||||
|
@ -935,8 +923,7 @@ DValue* DtoPaintType(Loc& loc, DValue* val, Type* to)
|
|||
LLValue* ptr = val->getLVal();
|
||||
assert(isaPointer(ptr));
|
||||
ptr = DtoBitCast(ptr, getPtrToType(DtoType(dgty)));
|
||||
if (Logger::enabled())
|
||||
Logger::cout() << "dg ptr: " << *ptr << '\n';
|
||||
IF_LOG Logger::cout() << "dg ptr: " << *ptr << '\n';
|
||||
return new DVarValue(to, ptr);
|
||||
}
|
||||
else
|
||||
|
@ -946,8 +933,7 @@ DValue* DtoPaintType(Loc& loc, DValue* val, Type* to)
|
|||
LLValue* funcptr = gIR->ir->CreateExtractValue(dg, 1, ".funcptr");
|
||||
funcptr = DtoBitCast(funcptr, DtoType(dgty)->getContainedType(1));
|
||||
LLValue* aggr = DtoAggrPair(context, funcptr, "tmp");
|
||||
if (Logger::enabled())
|
||||
Logger::cout() << "dg: " << *aggr << '\n';
|
||||
IF_LOG Logger::cout() << "dg: " << *aggr << '\n';
|
||||
return new DImValue(to, aggr);
|
||||
}
|
||||
}
|
||||
|
@ -1083,8 +1069,7 @@ void DtoResolveVariable(VarDeclaration* vd)
|
|||
if (vd->alignment != STRUCTALIGN_DEFAULT)
|
||||
gvar->setAlignment(vd->alignment);
|
||||
|
||||
if (Logger::enabled())
|
||||
Logger::cout() << *gvar << '\n';
|
||||
IF_LOG Logger::cout() << *gvar << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1099,12 +1084,12 @@ void DtoVarDeclaration(VarDeclaration* vd)
|
|||
assert(!vd->isDataseg() && "Statics/globals are handled in DtoDeclarationExp.");
|
||||
assert(!vd->aliassym && "Aliases are handled in DtoDeclarationExp.");
|
||||
|
||||
Logger::println("vdtype = %s", vd->type->toChars());
|
||||
IF_LOG Logger::println("vdtype = %s", vd->type->toChars());
|
||||
LOG_SCOPE
|
||||
|
||||
if (vd->nestedrefs.dim)
|
||||
{
|
||||
Logger::println("has nestedref set (referenced by nested function/delegate)");
|
||||
IF_LOG Logger::println("has nestedref set (referenced by nested function/delegate)");
|
||||
assert(vd->ir.irLocal && "irLocal is expected to be already set by DtoCreateNestedContext");
|
||||
}
|
||||
|
||||
|
@ -1184,8 +1169,7 @@ void DtoVarDeclaration(VarDeclaration* vd)
|
|||
gIR->DBuilder.EmitLocalVariable(allocainst, vd);
|
||||
}
|
||||
|
||||
if (Logger::enabled())
|
||||
Logger::cout() << "llvm value for decl: " << *vd->ir.irLocal->value << '\n';
|
||||
IF_LOG Logger::cout() << "llvm value for decl: " << *vd->ir.irLocal->value << '\n';
|
||||
|
||||
if (vd->init)
|
||||
{
|
||||
|
@ -1200,7 +1184,7 @@ void DtoVarDeclaration(VarDeclaration* vd)
|
|||
|
||||
DValue* DtoDeclarationExp(Dsymbol* declaration)
|
||||
{
|
||||
Logger::print("DtoDeclarationExp: %s\n", declaration->toChars());
|
||||
IF_LOG Logger::print("DtoDeclarationExp: %s\n", declaration->toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
// variable declaration
|
||||
|
@ -1363,7 +1347,7 @@ LLConstant* DtoConstInitializer(Loc loc, Type* type, Initializer* init)
|
|||
LLConstant* _init = 0; // may return zero
|
||||
if (!init)
|
||||
{
|
||||
Logger::println("const default initializer for %s", type->toChars());
|
||||
IF_LOG Logger::println("const default initializer for %s", type->toChars());
|
||||
Expression *initExp = type->defaultInit();
|
||||
if (type->ty == Ttypedef)
|
||||
initExp->type = type; // This carries the typedef type into toConstElem.
|
||||
|
@ -1389,7 +1373,7 @@ LLConstant* DtoConstInitializer(Loc loc, Type* type, Initializer* init)
|
|||
{
|
||||
// StructInitializer is no longer suposed to make it to the glue layer
|
||||
// in DMD 2.064.
|
||||
Logger::println("unsupported const initializer: %s", init->toChars());
|
||||
IF_LOG Logger::println("unsupported const initializer: %s", init->toChars());
|
||||
}
|
||||
return _init;
|
||||
}
|
||||
|
@ -1499,12 +1483,14 @@ LLConstant* DtoTypeInfoOf(Type* type, bool base)
|
|||
|
||||
void DtoOverloadedIntrinsicName(TemplateInstance* ti, TemplateDeclaration* td, std::string& name)
|
||||
{
|
||||
Logger::println("DtoOverloadedIntrinsicName");
|
||||
IF_LOG Logger::println("DtoOverloadedIntrinsicName");
|
||||
LOG_SCOPE;
|
||||
|
||||
IF_LOG {
|
||||
Logger::println("template instance: %s", ti->toChars());
|
||||
Logger::println("template declaration: %s", td->toChars());
|
||||
Logger::println("intrinsic name: %s", td->intrinsicName.c_str());
|
||||
}
|
||||
|
||||
// for now use the size in bits of the first template param in the instance
|
||||
assert(ti->tdtypes.dim == 1);
|
||||
|
@ -1548,7 +1534,7 @@ void DtoOverloadedIntrinsicName(TemplateInstance* ti, TemplateDeclaration* td, s
|
|||
}
|
||||
}
|
||||
|
||||
Logger::println("final intrinsic name: %s", name.c_str());
|
||||
IF_LOG Logger::println("final intrinsic name: %s", name.c_str());
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -1850,8 +1836,10 @@ DValue* DtoSymbolAddress(const Loc& loc, Type* type, Declaration* decl)
|
|||
// function parameter
|
||||
else if (vd->isParameter())
|
||||
{
|
||||
IF_LOG {
|
||||
Logger::println("function param");
|
||||
Logger::println("type: %s", vd->type->toChars());
|
||||
}
|
||||
FuncDeclaration* fd = vd->toParent2()->isFuncDeclaration();
|
||||
if (fd && fd != gIR->func()->decl)
|
||||
{
|
||||
|
@ -1927,7 +1915,7 @@ DValue* DtoSymbolAddress(const Loc& loc, Type* type, Declaration* decl)
|
|||
{
|
||||
// this seems to be the static initialiser for structs
|
||||
Type* sdecltype = sdecl->type->toBasetype();
|
||||
Logger::print("Sym: type=%s\n", sdecltype->toChars());
|
||||
IF_LOG Logger::print("Sym: type=%s\n", sdecltype->toChars());
|
||||
assert(sdecltype->ty == Tstruct);
|
||||
TypeStruct* ts = static_cast<TypeStruct*>(sdecltype);
|
||||
assert(ts->sym);
|
||||
|
|
|
@ -510,7 +510,7 @@ llvm::Module* Module::genLLVMModule(llvm::LLVMContext& context)
|
|||
Logger::enable();
|
||||
}
|
||||
|
||||
Logger::println("Generating module: %s", (md ? md->toChars() : toChars()));
|
||||
IF_LOG Logger::println("Generating module: %s", (md ? md->toChars() : toChars()));
|
||||
LOG_SCOPE;
|
||||
|
||||
if (global.params.verbose_cg)
|
||||
|
@ -548,8 +548,7 @@ llvm::Module* Module::genLLVMModule(llvm::LLVMContext& context)
|
|||
|
||||
// set final data layout
|
||||
ir.module->setDataLayout(gDataLayout->getStringRepresentation());
|
||||
if (Logger::enabled())
|
||||
Logger::cout() << "Final data layout: " << ir.module->getDataLayout() << '\n';
|
||||
IF_LOG Logger::cout() << "Final data layout: " << ir.module->getDataLayout() << '\n';
|
||||
|
||||
// allocate the target abi
|
||||
gABI = TargetABI::getTarget();
|
||||
|
@ -722,15 +721,15 @@ void Module::genmoduleinfo()
|
|||
|
||||
if (cd->isInterfaceDeclaration())
|
||||
{
|
||||
Logger::println("skipping interface '%s' in moduleinfo", cd->toPrettyChars());
|
||||
IF_LOG Logger::println("skipping interface '%s' in moduleinfo", cd->toPrettyChars());
|
||||
continue;
|
||||
}
|
||||
else if (cd->sizeok != SIZEOKdone)
|
||||
{
|
||||
Logger::println("skipping opaque class declaration '%s' in moduleinfo", cd->toPrettyChars());
|
||||
IF_LOG Logger::println("skipping opaque class declaration '%s' in moduleinfo", cd->toPrettyChars());
|
||||
continue;
|
||||
}
|
||||
Logger::println("class: %s", cd->toPrettyChars());
|
||||
IF_LOG Logger::println("class: %s", cd->toPrettyChars());
|
||||
LLConstant *c = DtoBitCast(cd->ir.irAggr->getClassInfoSymbol(), classinfoTy);
|
||||
classInits.push_back(c);
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ public:
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void visit(AsmBlockStatement *stmt) LLVM_OVERRIDE {
|
||||
Logger::println("AsmBlockStatement::toNakedIR(): %s", stmt->loc.toChars());
|
||||
IF_LOG Logger::println("AsmBlockStatement::toNakedIR(): %s", stmt->loc.toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
for (Statements::iterator I = stmt->statements->begin(),
|
||||
|
@ -71,7 +71,7 @@ public:
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void visit(CompoundStatement *stmt) LLVM_OVERRIDE {
|
||||
Logger::println("CompoundStatement::toNakedIR(): %s", stmt->loc.toChars());
|
||||
IF_LOG Logger::println("CompoundStatement::toNakedIR(): %s", stmt->loc.toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
if (stmt->statements)
|
||||
|
@ -87,7 +87,7 @@ public:
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void visit(ExpStatement *stmt) LLVM_OVERRIDE {
|
||||
Logger::println("ExpStatement::toNakedIR(): %s", stmt->loc.toChars());
|
||||
IF_LOG Logger::println("ExpStatement::toNakedIR(): %s", stmt->loc.toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
// only expstmt supported in declarations
|
||||
|
@ -129,7 +129,7 @@ public:
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void visit(LabelStatement *stmt) LLVM_OVERRIDE {
|
||||
Logger::println("LabelStatement::toNakedIR(): %s", stmt->loc.toChars());
|
||||
IF_LOG Logger::println("LabelStatement::toNakedIR(): %s", stmt->loc.toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
printLabelName(irs->nakedAsm, irs->func()->decl->mangleExact(), stmt->ident->toChars());
|
||||
|
@ -144,7 +144,7 @@ public:
|
|||
|
||||
void DtoDefineNakedFunction(FuncDeclaration* fd)
|
||||
{
|
||||
Logger::println("DtoDefineNakedFunction(%s)", fd->mangleExact());
|
||||
IF_LOG Logger::println("DtoDefineNakedFunction(%s)", fd->mangleExact());
|
||||
LOG_SCOPE;
|
||||
|
||||
assert(fd->ir.irFunc);
|
||||
|
@ -259,7 +259,7 @@ void DtoDefineNakedFunction(FuncDeclaration* fd)
|
|||
|
||||
void emitABIReturnAsmStmt(IRAsmBlock* asmblock, Loc loc, FuncDeclaration* fdecl)
|
||||
{
|
||||
Logger::println("emitABIReturnAsmStmt(%s)", fdecl->mangleExact());
|
||||
IF_LOG Logger::println("emitABIReturnAsmStmt(%s)", fdecl->mangleExact());
|
||||
LOG_SCOPE;
|
||||
|
||||
IRAsmStmt* as = new IRAsmStmt;
|
||||
|
@ -416,7 +416,7 @@ void emitABIReturnAsmStmt(IRAsmBlock* asmblock, Loc loc, FuncDeclaration* fdecl)
|
|||
|
||||
DValue * DtoInlineAsmExpr(Loc loc, FuncDeclaration * fd, Expressions * arguments)
|
||||
{
|
||||
Logger::println("DtoInlineAsmExpr @ %s", loc.toChars());
|
||||
IF_LOG Logger::println("DtoInlineAsmExpr @ %s", loc.toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
TemplateInstance* ti = fd->toParent()->isTemplateInstance();
|
||||
|
@ -426,7 +426,7 @@ DValue * DtoInlineAsmExpr(Loc loc, FuncDeclaration * fd, Expressions * arguments
|
|||
|
||||
// get code param
|
||||
Expression* e = static_cast<Expression*>(arguments->data[0]);
|
||||
Logger::println("code exp: %s", e->toChars());
|
||||
IF_LOG Logger::println("code exp: %s", e->toChars());
|
||||
StringExp* se = static_cast<StringExp*>(e);
|
||||
if (e->op != TOKstring || se->sz != 1)
|
||||
{
|
||||
|
@ -437,7 +437,7 @@ DValue * DtoInlineAsmExpr(Loc loc, FuncDeclaration * fd, Expressions * arguments
|
|||
|
||||
// get constraints param
|
||||
e = static_cast<Expression*>(arguments->data[1]);
|
||||
Logger::println("constraint exp: %s", e->toChars());
|
||||
IF_LOG Logger::println("constraint exp: %s", e->toChars());
|
||||
se = static_cast<StringExp*>(e);
|
||||
if (e->op != TOKstring || se->sz != 1)
|
||||
{
|
||||
|
|
|
@ -44,7 +44,7 @@ static void DtoCreateNestedContextType(FuncDeclaration* fd);
|
|||
|
||||
DValue* DtoNestedVariable(Loc loc, Type* astype, VarDeclaration* vd, bool byref)
|
||||
{
|
||||
Logger::println("DtoNestedVariable for %s @ %s", vd->toChars(), loc.toChars());
|
||||
IF_LOG Logger::println("DtoNestedVariable for %s @ %s", vd->toChars(), loc.toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
////////////////////////////////////
|
||||
|
@ -107,32 +107,36 @@ DValue* DtoNestedVariable(Loc loc, Type* astype, VarDeclaration* vd, bool byref)
|
|||
// Extract variable from nested context
|
||||
|
||||
LLValue* val = DtoBitCast(ctx, LLPointerType::getUnqual(irfunc->frameType));
|
||||
IF_LOG {
|
||||
Logger::cout() << "Context: " << *val << '\n';
|
||||
Logger::cout() << "of type: " << *irfunc->frameType << '\n';
|
||||
}
|
||||
|
||||
unsigned vardepth = vd->ir.irLocal->nestedDepth;
|
||||
unsigned funcdepth = irfunc->depth;
|
||||
|
||||
IF_LOG {
|
||||
Logger::cout() << "Variable: " << vd->toChars() << '\n';
|
||||
Logger::cout() << "Variable depth: " << vardepth << '\n';
|
||||
Logger::cout() << "Function: " << irfunc->decl->toChars() << '\n';
|
||||
Logger::cout() << "Function depth: " << funcdepth << '\n';
|
||||
}
|
||||
|
||||
if (vardepth == funcdepth) {
|
||||
// This is not always handled above because functions without
|
||||
// variables accessed by nested functions don't create new frames.
|
||||
Logger::println("Same depth");
|
||||
IF_LOG Logger::println("Same depth");
|
||||
} else {
|
||||
// Load frame pointer and index that...
|
||||
if (dwarfValue && global.params.symdebug) {
|
||||
gIR->DBuilder.OpOffset(dwarfAddr, val, vd->ir.irLocal->nestedDepth);
|
||||
gIR->DBuilder.OpDeref(dwarfAddr);
|
||||
}
|
||||
Logger::println("Lower depth");
|
||||
IF_LOG Logger::println("Lower depth");
|
||||
val = DtoGEPi(val, 0, vd->ir.irLocal->nestedDepth);
|
||||
Logger::cout() << "Frame index: " << *val << '\n';
|
||||
IF_LOG Logger::cout() << "Frame index: " << *val << '\n';
|
||||
val = DtoAlignedLoad(val, (std::string(".frame.") + vdparent->toChars()).c_str());
|
||||
Logger::cout() << "Frame: " << *val << '\n';
|
||||
IF_LOG Logger::cout() << "Frame: " << *val << '\n';
|
||||
}
|
||||
|
||||
int idx = vd->ir.irLocal->nestedIndex;
|
||||
|
@ -142,14 +146,18 @@ DValue* DtoNestedVariable(Loc loc, Type* astype, VarDeclaration* vd, bool byref)
|
|||
gIR->DBuilder.OpOffset(dwarfAddr, val, idx);
|
||||
|
||||
val = DtoGEPi(val, 0, idx, vd->toChars());
|
||||
IF_LOG {
|
||||
Logger::cout() << "Addr: " << *val << '\n';
|
||||
Logger::cout() << "of type: " << *val->getType() << '\n';
|
||||
}
|
||||
if (byref || (vd->isParameter() && vd->ir.irParam->arg->byref)) {
|
||||
val = DtoAlignedLoad(val);
|
||||
//dwarfOpDeref(dwarfAddr);
|
||||
IF_LOG {
|
||||
Logger::cout() << "Was byref, now: " << *val << '\n';
|
||||
Logger::cout() << "of type: " << *val->getType() << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
if (dwarfValue && global.params.symdebug)
|
||||
gIR->DBuilder.EmitLocalVariable(dwarfValue, vd, dwarfAddr);
|
||||
|
@ -159,7 +167,7 @@ DValue* DtoNestedVariable(Loc loc, Type* astype, VarDeclaration* vd, bool byref)
|
|||
|
||||
void DtoResolveNestedContext(Loc loc, AggregateDeclaration *decl, LLValue *value)
|
||||
{
|
||||
Logger::println("Resolving nested context");
|
||||
IF_LOG Logger::println("Resolving nested context");
|
||||
LOG_SCOPE;
|
||||
|
||||
// get context
|
||||
|
@ -183,7 +191,7 @@ void DtoResolveNestedContext(Loc loc, AggregateDeclaration *decl, LLValue *value
|
|||
|
||||
LLValue* DtoNestedContext(Loc loc, Dsymbol* sym)
|
||||
{
|
||||
Logger::println("DtoNestedContext for %s", sym->toPrettyChars());
|
||||
IF_LOG Logger::println("DtoNestedContext for %s", sym->toPrettyChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
// The function we are currently in, and the constructed object/called
|
||||
|
@ -243,25 +251,27 @@ LLValue* DtoNestedContext(Loc loc, Dsymbol* sym)
|
|||
}
|
||||
|
||||
if (frameToPass) {
|
||||
Logger::println("Parent frame is from %s", frameToPass->toChars());
|
||||
IF_LOG Logger::println("Parent frame is from %s", frameToPass->toChars());
|
||||
FuncDeclaration* ctxfd = irfunc->decl;
|
||||
Logger::println("Current function is %s", ctxfd->toChars());
|
||||
IF_LOG Logger::println("Current function is %s", ctxfd->toChars());
|
||||
if (fromParent) {
|
||||
ctxfd = getParentFunc(ctxfd, true);
|
||||
assert(ctxfd && "Context from outer function, but no outer function?");
|
||||
}
|
||||
Logger::println("Context is from %s", ctxfd->toChars());
|
||||
IF_LOG Logger::println("Context is from %s", ctxfd->toChars());
|
||||
|
||||
unsigned neededDepth = frameToPass->ir.irFunc->depth;
|
||||
unsigned ctxDepth = ctxfd->ir.irFunc->depth;
|
||||
|
||||
IF_LOG {
|
||||
Logger::cout() << "Needed depth: " << neededDepth << '\n';
|
||||
Logger::cout() << "Context depth: " << ctxDepth << '\n';
|
||||
}
|
||||
|
||||
if (neededDepth >= ctxDepth) {
|
||||
// assert(neededDepth <= ctxDepth + 1 && "How are we going more than one nesting level up?");
|
||||
// fd needs the same context as we do, so all is well
|
||||
Logger::println("Calling sibling function or directly nested function");
|
||||
IF_LOG Logger::println("Calling sibling function or directly nested function");
|
||||
} else {
|
||||
val = DtoBitCast(val, LLPointerType::getUnqual(ctxfd->ir.irFunc->frameType));
|
||||
val = DtoGEPi(val, 0, neededDepth);
|
||||
|
@ -270,13 +280,15 @@ LLValue* DtoNestedContext(Loc loc, Dsymbol* sym)
|
|||
}
|
||||
}
|
||||
|
||||
IF_LOG {
|
||||
Logger::cout() << "result = " << *val << '\n';
|
||||
Logger::cout() << "of type " << *val->getType() << '\n';
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
||||
static void DtoCreateNestedContextType(FuncDeclaration* fd) {
|
||||
Logger::println("DtoCreateNestedContextType for %s", fd->toChars());
|
||||
IF_LOG Logger::println("DtoCreateNestedContextType for %s", fd->toChars());
|
||||
LOG_SCOPE
|
||||
|
||||
DtoDeclareFunction(fd);
|
||||
|
@ -311,7 +323,7 @@ static void DtoCreateNestedContextType(FuncDeclaration* fd) {
|
|||
}
|
||||
fd->ir.irFunc->depth = ++depth;
|
||||
|
||||
Logger::cout() << "Function " << fd->toChars() << " has depth " << depth << '\n';
|
||||
IF_LOG Logger::cout() << "Function " << fd->toChars() << " has depth " << depth << '\n';
|
||||
|
||||
typedef std::vector<LLType*> TypeVec;
|
||||
TypeVec types;
|
||||
|
@ -367,16 +379,14 @@ static void DtoCreateNestedContextType(FuncDeclaration* fd) {
|
|||
} else {
|
||||
types.push_back(i1ToI8(DtoType(vd->type)));
|
||||
}
|
||||
if (Logger::enabled()) {
|
||||
Logger::cout() << "Nested var '" << vd->toChars() <<
|
||||
"' of type " << *types.back() << "\n";
|
||||
}
|
||||
IF_LOG Logger::cout() << "Nested var '" << vd->toChars()
|
||||
<< "' of type " << *types.back() << "\n";
|
||||
}
|
||||
|
||||
LLStructType* frameType = LLStructType::create(gIR->context(), types,
|
||||
std::string("nest.") + fd->toChars());
|
||||
|
||||
Logger::cout() << "frameType = " << *frameType << '\n';
|
||||
IF_LOG Logger::cout() << "frameType = " << *frameType << '\n';
|
||||
|
||||
// Store type in IrFunction
|
||||
fd->ir.irFunc->frameType = frameType;
|
||||
|
@ -390,7 +400,7 @@ static void DtoCreateNestedContextType(FuncDeclaration* fd) {
|
|||
|
||||
|
||||
void DtoCreateNestedContext(FuncDeclaration* fd) {
|
||||
Logger::println("DtoCreateNestedContext for %s", fd->toChars());
|
||||
IF_LOG Logger::println("DtoCreateNestedContext for %s", fd->toChars());
|
||||
LOG_SCOPE
|
||||
|
||||
DtoCreateNestedContextType(fd);
|
||||
|
@ -457,7 +467,7 @@ void DtoCreateNestedContext(FuncDeclaration* fd) {
|
|||
|
||||
LLValue* gep = DtoGEPi(frame, 0, vd->ir.irLocal->nestedIndex, vd->toChars());
|
||||
if (vd->isParameter()) {
|
||||
Logger::println("nested param: %s", vd->toChars());
|
||||
IF_LOG Logger::println("nested param: %s", vd->toChars());
|
||||
LOG_SCOPE
|
||||
IrParameter* parm = vd->ir.irParam;
|
||||
|
||||
|
@ -476,7 +486,7 @@ void DtoCreateNestedContext(FuncDeclaration* fd) {
|
|||
parm->value = gep;
|
||||
}
|
||||
} else {
|
||||
Logger::println("nested var: %s", vd->toChars());
|
||||
IF_LOG Logger::println("nested var: %s", vd->toChars());
|
||||
assert(!vd->ir.irLocal->value);
|
||||
vd->ir.irLocal->value = gep;
|
||||
}
|
||||
|
|
|
@ -87,8 +87,7 @@ static LLValue* call_string_switch_runtime(llvm::Value* table, Expression* e)
|
|||
|
||||
llvm::Function* fn = LLVM_D_GetRuntimeFunction(gIR->module, fname);
|
||||
|
||||
if (Logger::enabled())
|
||||
{
|
||||
IF_LOG {
|
||||
Logger::cout() << *table->getType() << '\n';
|
||||
Logger::cout() << *fn->getFunctionType()->getParamType(0) << '\n';
|
||||
}
|
||||
|
@ -119,7 +118,7 @@ public:
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void visit(CompoundStatement *stmt) LLVM_OVERRIDE {
|
||||
Logger::println("CompoundStatement::toIR(): %s", stmt->loc.toChars());
|
||||
IF_LOG Logger::println("CompoundStatement::toIR(): %s", stmt->loc.toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
for (Statements::iterator I = stmt->statements->begin(),
|
||||
|
@ -136,7 +135,7 @@ public:
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void visit(ReturnStatement *stmt) LLVM_OVERRIDE {
|
||||
Logger::println("ReturnStatement::toIR(): %s", stmt->loc.toChars());
|
||||
IF_LOG Logger::println("ReturnStatement::toIR(): %s", stmt->loc.toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
// emit dwarf stop point
|
||||
|
@ -197,8 +196,7 @@ public:
|
|||
v = irs->func()->decl->irFty.putRet(stmt->exp->type, dval);
|
||||
}
|
||||
|
||||
if (Logger::enabled())
|
||||
Logger::cout() << "return value is '" <<*v << "'\n";
|
||||
IF_LOG Logger::cout() << "return value is '" <<*v << "'\n";
|
||||
|
||||
IrFunction* f = irs->func();
|
||||
// Hack around LDC assuming structs and static arrays are in memory:
|
||||
|
@ -228,8 +226,7 @@ public:
|
|||
else
|
||||
v = gIR->ir->CreateBitCast(v, irs->topfunc()->getReturnType(), "tmp");
|
||||
|
||||
if (Logger::enabled())
|
||||
Logger::cout() << "return value after cast: " << *v << '\n';
|
||||
IF_LOG Logger::cout() << "return value after cast: " << *v << '\n';
|
||||
}
|
||||
|
||||
// emit scopes
|
||||
|
@ -257,7 +254,7 @@ public:
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void visit(ExpStatement *stmt) LLVM_OVERRIDE {
|
||||
Logger::println("ExpStatement::toIR(): %s", stmt->loc.toChars());
|
||||
IF_LOG Logger::println("ExpStatement::toIR(): %s", stmt->loc.toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
// emit dwarf stop point
|
||||
|
@ -301,7 +298,7 @@ public:
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void visit(IfStatement *stmt) LLVM_OVERRIDE {
|
||||
Logger::println("IfStatement::toIR(): %s", stmt->loc.toChars());
|
||||
IF_LOG Logger::println("IfStatement::toIR(): %s", stmt->loc.toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
// start a dwarf lexical block
|
||||
|
@ -319,8 +316,7 @@ public:
|
|||
llvm::BasicBlock* elsebb = stmt->elsebody ? llvm::BasicBlock::Create(gIR->context(), "else", gIR->topfunc(), endbb) : endbb;
|
||||
|
||||
if (cond_val->getType() != LLType::getInt1Ty(gIR->context())) {
|
||||
if (Logger::enabled())
|
||||
Logger::cout() << "if conditional: " << *cond_val << '\n';
|
||||
IF_LOG Logger::cout() << "if conditional: " << *cond_val << '\n';
|
||||
cond_val = DtoCast(stmt->loc, cond_e, Type::tbool)->getRVal();
|
||||
}
|
||||
llvm::BranchInst::Create(ifbb, elsebb, cond_val, gIR->scopebb());
|
||||
|
@ -359,7 +355,7 @@ public:
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void visit(ScopeStatement *stmt) LLVM_OVERRIDE {
|
||||
Logger::println("ScopeStatement::toIR(): %s", stmt->loc.toChars());
|
||||
IF_LOG Logger::println("ScopeStatement::toIR(): %s", stmt->loc.toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
/*llvm::BasicBlock* oldend = p->scopeend();
|
||||
|
@ -397,7 +393,7 @@ public:
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void visit(WhileStatement *stmt) LLVM_OVERRIDE {
|
||||
Logger::println("WhileStatement::toIR(): %s", stmt->loc.toChars());
|
||||
IF_LOG Logger::println("WhileStatement::toIR(): %s", stmt->loc.toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
// start a dwarf lexical block
|
||||
|
@ -447,7 +443,7 @@ public:
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void visit(DoStatement *stmt) LLVM_OVERRIDE {
|
||||
Logger::println("DoStatement::toIR(): %s", stmt->loc.toChars());
|
||||
IF_LOG Logger::println("DoStatement::toIR(): %s", stmt->loc.toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
// start a dwarf lexical block
|
||||
|
@ -494,7 +490,7 @@ public:
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void visit(ForStatement *stmt) LLVM_OVERRIDE {
|
||||
Logger::println("ForStatement::toIR(): %s", stmt->loc.toChars());
|
||||
IF_LOG Logger::println("ForStatement::toIR(): %s", stmt->loc.toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
// start new dwarf lexical block
|
||||
|
@ -580,7 +576,7 @@ public:
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void visit(BreakStatement *stmt) LLVM_OVERRIDE {
|
||||
Logger::println("BreakStatement::toIR(): %s", stmt->loc.toChars());
|
||||
IF_LOG Logger::println("BreakStatement::toIR(): %s", stmt->loc.toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
// don't emit two terminators in a row
|
||||
|
@ -592,7 +588,7 @@ public:
|
|||
gIR->DBuilder.EmitStopPoint(stmt->loc.linnum);
|
||||
|
||||
if (stmt->ident != 0) {
|
||||
Logger::println("ident = %s", stmt->ident->toChars());
|
||||
IF_LOG Logger::println("ident = %s", stmt->ident->toChars());
|
||||
|
||||
DtoEnclosingHandlers(stmt->loc, stmt->target);
|
||||
|
||||
|
@ -646,14 +642,14 @@ public:
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void visit(ContinueStatement *stmt) LLVM_OVERRIDE {
|
||||
Logger::println("ContinueStatement::toIR(): %s", stmt->loc.toChars());
|
||||
IF_LOG Logger::println("ContinueStatement::toIR(): %s", stmt->loc.toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
// emit dwarf stop point
|
||||
gIR->DBuilder.EmitStopPoint(stmt->loc.linnum);
|
||||
|
||||
if (stmt->ident != 0) {
|
||||
Logger::println("ident = %s", stmt->ident->toChars());
|
||||
IF_LOG Logger::println("ident = %s", stmt->ident->toChars());
|
||||
|
||||
DtoEnclosingHandlers(stmt->loc, stmt->target);
|
||||
|
||||
|
@ -700,7 +696,7 @@ public:
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void visit(OnScopeStatement *stmt) LLVM_OVERRIDE {
|
||||
Logger::println("OnScopeStatement::toIR(): %s", stmt->loc.toChars());
|
||||
IF_LOG Logger::println("OnScopeStatement::toIR(): %s", stmt->loc.toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
assert(stmt->statement);
|
||||
|
@ -710,7 +706,7 @@ public:
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void visit(TryFinallyStatement *stmt) LLVM_OVERRIDE {
|
||||
Logger::println("TryFinallyStatement::toIR(): %s", stmt->loc.toChars());
|
||||
IF_LOG Logger::println("TryFinallyStatement::toIR(): %s", stmt->loc.toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
// emit dwarf stop point
|
||||
|
@ -802,7 +798,7 @@ public:
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void visit(TryCatchStatement *stmt) LLVM_OVERRIDE {
|
||||
Logger::println("TryCatchStatement::toIR(): %s", stmt->loc.toChars());
|
||||
IF_LOG Logger::println("TryCatchStatement::toIR(): %s", stmt->loc.toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
// emit dwarf stop point
|
||||
|
@ -859,7 +855,7 @@ public:
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void visit(ThrowStatement *stmt) LLVM_OVERRIDE {
|
||||
Logger::println("ThrowStatement::toIR(): %s", stmt->loc.toChars());
|
||||
IF_LOG Logger::println("ThrowStatement::toIR(): %s", stmt->loc.toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
// emit dwarf stop point
|
||||
|
@ -886,7 +882,7 @@ public:
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void visit(SwitchStatement *stmt) LLVM_OVERRIDE {
|
||||
Logger::println("SwitchStatement::toIR(): %s", stmt->loc.toChars());
|
||||
IF_LOG Logger::println("SwitchStatement::toIR(): %s", stmt->loc.toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
// emit dwarf stop point
|
||||
|
@ -1049,7 +1045,7 @@ public:
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void visit(CaseStatement *stmt) LLVM_OVERRIDE {
|
||||
Logger::println("CaseStatement::toIR(): %s", stmt->loc.toChars());
|
||||
IF_LOG Logger::println("CaseStatement::toIR(): %s", stmt->loc.toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
llvm::BasicBlock* nbb = llvm::BasicBlock::Create(gIR->context(), "case", irs->topfunc(), irs->scopeend());
|
||||
|
@ -1079,7 +1075,7 @@ public:
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void visit(DefaultStatement *stmt) LLVM_OVERRIDE {
|
||||
Logger::println("DefaultStatement::toIR(): %s", stmt->loc.toChars());
|
||||
IF_LOG Logger::println("DefaultStatement::toIR(): %s", stmt->loc.toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
assert(stmt->bodyBB);
|
||||
|
@ -1106,7 +1102,7 @@ public:
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void visit(UnrolledLoopStatement *stmt) LLVM_OVERRIDE {
|
||||
Logger::println("UnrolledLoopStatement::toIR(): %s", stmt->loc.toChars());
|
||||
IF_LOG Logger::println("UnrolledLoopStatement::toIR(): %s", stmt->loc.toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
// if no statements, there's nothing to do
|
||||
|
@ -1178,7 +1174,7 @@ public:
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void visit(ForeachStatement *stmt) LLVM_OVERRIDE {
|
||||
Logger::println("ForeachStatement::toIR(): %s", stmt->loc.toChars());
|
||||
IF_LOG Logger::println("ForeachStatement::toIR(): %s", stmt->loc.toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
// start a dwarf lexical block
|
||||
|
@ -1192,7 +1188,7 @@ public:
|
|||
//Argument* arg = static_cast<Argument*>(arguments->data[0]);
|
||||
//Logger::println("Argument is %s", arg->toChars());
|
||||
|
||||
Logger::println("aggr = %s", stmt->aggr->toChars());
|
||||
IF_LOG Logger::println("aggr = %s", stmt->aggr->toChars());
|
||||
|
||||
// key
|
||||
LLType* keytype = stmt->key ? DtoType(stmt->key->type) : DtoSize_t();
|
||||
|
@ -1204,7 +1200,7 @@ public:
|
|||
LLValue* zerokey = LLConstantInt::get(keytype, 0, false);
|
||||
|
||||
// value
|
||||
Logger::println("value = %s", stmt->value->toPrettyChars());
|
||||
IF_LOG Logger::println("value = %s", stmt->value->toPrettyChars());
|
||||
LLValue* valvar = NULL;
|
||||
if (!stmt->value->isRef() && !stmt->value->isOut()) {
|
||||
// Create a local variable to serve as the value.
|
||||
|
@ -1307,7 +1303,7 @@ public:
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void visit(ForeachRangeStatement *stmt) LLVM_OVERRIDE {
|
||||
Logger::println("ForeachRangeStatement::toIR(): %s", stmt->loc.toChars());
|
||||
IF_LOG Logger::println("ForeachRangeStatement::toIR(): %s", stmt->loc.toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
// start a dwarf lexical block
|
||||
|
@ -1410,7 +1406,7 @@ public:
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void visit(LabelStatement *stmt) LLVM_OVERRIDE {
|
||||
Logger::println("LabelStatement::toIR(): %s", stmt->loc.toChars());
|
||||
IF_LOG Logger::println("LabelStatement::toIR(): %s", stmt->loc.toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
// if it's an inline asm label, we don't create a basicblock, just emit it in the asm
|
||||
|
@ -1455,7 +1451,7 @@ public:
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void visit(GotoStatement *stmt) LLVM_OVERRIDE {
|
||||
Logger::println("GotoStatement::toIR(): %s", stmt->loc.toChars());
|
||||
IF_LOG Logger::println("GotoStatement::toIR(): %s", stmt->loc.toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
gIR->DBuilder.EmitStopPoint(stmt->loc.linnum);
|
||||
|
@ -1471,7 +1467,7 @@ public:
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void visit(GotoDefaultStatement *stmt) LLVM_OVERRIDE {
|
||||
Logger::println("GotoDefaultStatement::toIR(): %s", stmt->loc.toChars());
|
||||
IF_LOG Logger::println("GotoDefaultStatement::toIR(): %s", stmt->loc.toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
gIR->DBuilder.EmitStopPoint(stmt->loc.linnum);
|
||||
|
@ -1491,7 +1487,7 @@ public:
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void visit(GotoCaseStatement *stmt) LLVM_OVERRIDE {
|
||||
Logger::println("GotoCaseStatement::toIR(): %s", stmt->loc.toChars());
|
||||
IF_LOG Logger::println("GotoCaseStatement::toIR(): %s", stmt->loc.toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
gIR->DBuilder.EmitStopPoint(stmt->loc.linnum);
|
||||
|
@ -1514,7 +1510,7 @@ public:
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void visit(WithStatement *stmt) LLVM_OVERRIDE {
|
||||
Logger::println("WithStatement::toIR(): %s", stmt->loc.toChars());
|
||||
IF_LOG Logger::println("WithStatement::toIR(): %s", stmt->loc.toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
gIR->DBuilder.EmitBlockStart(stmt->loc);
|
||||
|
@ -1544,7 +1540,7 @@ public:
|
|||
}
|
||||
|
||||
void visit(SynchronizedStatement *stmt) LLVM_OVERRIDE {
|
||||
Logger::println("SynchronizedStatement::toIR(): %s", stmt->loc.toChars());
|
||||
IF_LOG Logger::println("SynchronizedStatement::toIR(): %s", stmt->loc.toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
// emit dwarf stop point
|
||||
|
@ -1582,7 +1578,7 @@ public:
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void visit(SwitchErrorStatement *stmt) LLVM_OVERRIDE {
|
||||
Logger::println("SwitchErrorStatement::toIR(): %s", stmt->loc.toChars());
|
||||
IF_LOG Logger::println("SwitchErrorStatement::toIR(): %s", stmt->loc.toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
llvm::Function* fn = LLVM_D_GetRuntimeFunction(gIR->module, "_d_switch_error");
|
||||
|
|
|
@ -39,7 +39,7 @@ void DtoResolveStruct(StructDeclaration* sd, Loc& callerLoc)
|
|||
if (sd->ir.resolved) return;
|
||||
sd->ir.resolved = true;
|
||||
|
||||
Logger::println("Resolving struct type: %s (%s)", sd->toChars(), sd->loc.toChars());
|
||||
IF_LOG Logger::println("Resolving struct type: %s (%s)", sd->toChars(), sd->loc.toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
// make sure type exists
|
||||
|
@ -93,7 +93,7 @@ LLValue* DtoStructEquals(TOK op, DValue* lhs, DValue* rhs)
|
|||
|
||||
LLValue* DtoIndexStruct(LLValue* src, StructDeclaration* sd, VarDeclaration* vd)
|
||||
{
|
||||
Logger::println("indexing struct field %s:", vd->toPrettyChars());
|
||||
IF_LOG Logger::println("indexing struct field %s:", vd->toPrettyChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
DtoResolveStruct(sd);
|
||||
|
@ -123,8 +123,7 @@ LLValue* DtoIndexStruct(LLValue* src, StructDeclaration* sd, VarDeclaration* vd)
|
|||
// cast it to the right type
|
||||
val = DtoBitCast(val, getPtrToType(i1ToI8(DtoType(vd->type))));
|
||||
|
||||
if (Logger::enabled())
|
||||
Logger::cout() << "value: " << *val << '\n';
|
||||
IF_LOG Logger::cout() << "value: " << *val << '\n';
|
||||
|
||||
return val;
|
||||
}
|
||||
|
|
|
@ -133,7 +133,7 @@ LLFunctionType* DtoExtractFunctionType(LLType* type)
|
|||
static LLValue *fixArgument(DValue *argval, IrFuncTy &irFty, LLType *callableArgType, size_t argIndex)
|
||||
{
|
||||
#if 0
|
||||
if (Logger::enabled()) {
|
||||
IF_LOG {
|
||||
Logger::cout() << "Argument before ABI: " << *argval->getRVal() << '\n';
|
||||
Logger::cout() << "Argument type before ABI: " << *DtoType(argval->getType()) << '\n';
|
||||
}
|
||||
|
@ -143,7 +143,7 @@ static LLValue *fixArgument(DValue *argval, IrFuncTy &irFty, LLType *callableArg
|
|||
LLValue* arg = irFty.putParam(argval->getType(), argIndex, argval);
|
||||
|
||||
#if 0
|
||||
if (Logger::enabled()) {
|
||||
IF_LOG {
|
||||
Logger::cout() << "Argument after ABI: " << *arg << '\n';
|
||||
Logger::cout() << "Argument type after ABI: " << *arg->getType() << '\n';
|
||||
}
|
||||
|
@ -164,8 +164,7 @@ static LLValue *fixArgument(DValue *argval, IrFuncTy &irFty, LLType *callableArg
|
|||
if (arg->getType() != callableArgType)
|
||||
{
|
||||
#if 1
|
||||
if (Logger::enabled())
|
||||
{
|
||||
IF_LOG {
|
||||
Logger::cout() << "arg: " << *arg << '\n';
|
||||
Logger::cout() << "of type: " << *arg->getType() << '\n';
|
||||
Logger::cout() << "expects: " << *callableArgType << '\n';
|
||||
|
@ -210,14 +209,14 @@ void DtoBuildDVarArgList(std::vector<LLValue*>& args,
|
|||
Expressions* arguments, size_t argidx,
|
||||
LLFunctionType* callableTy)
|
||||
{
|
||||
Logger::println("doing d-style variadic arguments");
|
||||
IF_LOG Logger::println("doing d-style variadic arguments");
|
||||
LOG_SCOPE
|
||||
|
||||
std::vector<LLType*> vtypes;
|
||||
|
||||
// number of non variadic args
|
||||
int begin = Parameter::dim(tf->parameters);
|
||||
Logger::println("num non vararg params = %d", begin);
|
||||
IF_LOG Logger::println("num non vararg params = %d", begin);
|
||||
|
||||
// get n args in arguments list
|
||||
size_t n_arguments = arguments ? arguments->dim : 0;
|
||||
|
@ -254,8 +253,7 @@ void DtoBuildDVarArgList(std::vector<LLValue*>& args,
|
|||
}
|
||||
LLStructType* vtype = LLStructType::get(gIR->context(), vtypes);
|
||||
|
||||
if (Logger::enabled())
|
||||
Logger::cout() << "d-variadic argument struct type:\n" << *vtype << '\n';
|
||||
IF_LOG Logger::cout() << "d-variadic argument struct type:\n" << *vtype << '\n';
|
||||
|
||||
LLValue* mem = DtoRawAlloca(vtype, 0, "_argptr_storage");
|
||||
|
||||
|
@ -274,8 +272,7 @@ void DtoBuildDVarArgList(std::vector<LLValue*>& args,
|
|||
|
||||
llvm::GlobalVariable* typeinfomem =
|
||||
new llvm::GlobalVariable(*gIR->module, typeinfoarraytype, true, llvm::GlobalValue::InternalLinkage, NULL, "._arguments.storage");
|
||||
if (Logger::enabled())
|
||||
Logger::cout() << "_arguments storage: " << *typeinfomem << '\n';
|
||||
IF_LOG Logger::cout() << "_arguments storage: " << *typeinfomem << '\n';
|
||||
|
||||
std::vector<LLConstant*> vtypeinfos;
|
||||
vtypeinfos.reserve(n_arguments);
|
||||
|
@ -331,9 +328,7 @@ void DtoBuildDVarArgList(std::vector<LLValue*>& args,
|
|||
|
||||
DValue* DtoCallFunction(Loc& loc, Type* resulttype, DValue* fnval, Expressions* arguments)
|
||||
{
|
||||
if (Logger::enabled()) {
|
||||
Logger::println("DtoCallFunction()");
|
||||
}
|
||||
IF_LOG Logger::println("DtoCallFunction()");
|
||||
LOG_SCOPE
|
||||
|
||||
// the callee D type
|
||||
|
@ -366,8 +361,7 @@ DValue* DtoCallFunction(Loc& loc, Type* resulttype, DValue* fnval, Expressions*
|
|||
LLFunctionType* callableTy = DtoExtractFunctionType(callable->getType());
|
||||
assert(callableTy);
|
||||
|
||||
// if (Logger::enabled())
|
||||
// Logger::cout() << "callable: " << *callable << '\n';
|
||||
// IF_LOG Logger::cout() << "callable: " << *callable << '\n';
|
||||
|
||||
// get n arguments
|
||||
size_t n_arguments = arguments ? arguments->dim : 0;
|
||||
|
@ -516,7 +510,7 @@ DValue* DtoCallFunction(Loc& loc, Type* resulttype, DValue* fnval, Expressions*
|
|||
else
|
||||
{
|
||||
Logger::println("doing normal arguments");
|
||||
if (Logger::enabled()) {
|
||||
IF_LOG {
|
||||
Logger::println("Arguments so far: (%d)", static_cast<int>(args.size()));
|
||||
Logger::indent();
|
||||
for (size_t i = 0; i < args.size(); i++) {
|
||||
|
@ -610,8 +604,7 @@ DValue* DtoCallFunction(Loc& loc, Type* resulttype, DValue* fnval, Expressions*
|
|||
}
|
||||
|
||||
#if 0
|
||||
if (Logger::enabled())
|
||||
{
|
||||
IF_LOG {
|
||||
Logger::println("%lu params passed", args.size());
|
||||
for (int i=0; i<args.size(); ++i) {
|
||||
assert(args[i]);
|
||||
|
@ -626,8 +619,7 @@ DValue* DtoCallFunction(Loc& loc, Type* resulttype, DValue* fnval, Expressions*
|
|||
varname = "tmp";
|
||||
|
||||
#if 0
|
||||
if (Logger::enabled())
|
||||
Logger::cout() << "Calling: " << *callable << '\n';
|
||||
IF_LOG Logger::cout() << "Calling: " << *callable << '\n';
|
||||
#endif
|
||||
|
||||
// call the function
|
||||
|
@ -666,7 +658,7 @@ DValue* DtoCallFunction(Loc& loc, Type* resulttype, DValue* fnval, Expressions*
|
|||
Type* nextbase = stripModifiers(tf->nextOf()->toBasetype());
|
||||
if (!rbase->equals(nextbase))
|
||||
{
|
||||
Logger::println("repainting return value from '%s' to '%s'", tf->nextOf()->toChars(), rbase->toChars());
|
||||
IF_LOG Logger::println("repainting return value from '%s' to '%s'", tf->nextOf()->toChars(), rbase->toChars());
|
||||
switch(rbase->ty)
|
||||
{
|
||||
case Tarray:
|
||||
|
@ -744,8 +736,7 @@ DValue* DtoCallFunction(Loc& loc, Type* resulttype, DValue* fnval, Expressions*
|
|||
Logger::println("Unknown return mismatch type, ignoring.");
|
||||
break;
|
||||
}
|
||||
if (Logger::enabled())
|
||||
Logger::cout() << "final return value: " << *retllval << '\n';
|
||||
IF_LOG Logger::cout() << "final return value: " << *retllval << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
181
gen/toir.cpp
181
gen/toir.cpp
|
@ -93,7 +93,7 @@ static int searchVarsWithDesctructors(Expression *exp, void *edtors)
|
|||
|
||||
DValue *Expression::toElemDtor(IRState *p)
|
||||
{
|
||||
Logger::println("Expression::toElemDtor(): %s", toChars());
|
||||
IF_LOG Logger::println("Expression::toElemDtor(): %s", toChars());
|
||||
LOG_SCOPE
|
||||
|
||||
class CallDestructors : public IRLandingPadCatchFinallyInfo {
|
||||
|
@ -159,7 +159,7 @@ DValue *Expression::toElemDtor(IRState *p)
|
|||
|
||||
DValue* DeclarationExp::toElem(IRState* p)
|
||||
{
|
||||
Logger::print("DeclarationExp::toElem: %s | T=%s\n", toChars(), type->toChars());
|
||||
IF_LOG Logger::print("DeclarationExp::toElem: %s | T=%s\n", toChars(), type->toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
return DtoDeclarationExp(declaration);
|
||||
|
@ -169,14 +169,14 @@ DValue* DeclarationExp::toElem(IRState* p)
|
|||
|
||||
void VarExp::cacheLvalue(IRState* p)
|
||||
{
|
||||
Logger::println("Caching l-value of %s", toChars());
|
||||
IF_LOG Logger::println("Caching l-value of %s", toChars());
|
||||
LOG_SCOPE;
|
||||
cachedLvalue = toElem(p)->getLVal();
|
||||
}
|
||||
|
||||
DValue* VarExp::toElem(IRState* p)
|
||||
{
|
||||
Logger::print("VarExp::toElem: %s @ %s\n", toChars(), type->toChars());
|
||||
IF_LOG Logger::print("VarExp::toElem: %s @ %s\n", toChars(), type->toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
assert(var);
|
||||
|
@ -194,14 +194,14 @@ DValue* VarExp::toElem(IRState* p)
|
|||
|
||||
LLConstant* VarExp::toConstElem(IRState* p)
|
||||
{
|
||||
Logger::print("VarExp::toConstElem: %s @ %s\n", toChars(), type->toChars());
|
||||
IF_LOG Logger::print("VarExp::toConstElem: %s @ %s\n", toChars(), type->toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
if (SymbolDeclaration* sdecl = var->isSymbolDeclaration())
|
||||
{
|
||||
// this seems to be the static initialiser for structs
|
||||
Type* sdecltype = sdecl->type->toBasetype();
|
||||
Logger::print("Sym: type=%s\n", sdecltype->toChars());
|
||||
IF_LOG Logger::print("Sym: type=%s\n", sdecltype->toChars());
|
||||
assert(sdecltype->ty == Tstruct);
|
||||
TypeStruct* ts = static_cast<TypeStruct*>(sdecltype);
|
||||
DtoResolveStruct(ts->sym);
|
||||
|
@ -241,7 +241,7 @@ LLConstant* VarExp::toConstElem(IRState* p)
|
|||
|
||||
DValue* IntegerExp::toElem(IRState* p)
|
||||
{
|
||||
Logger::print("IntegerExp::toElem: %s @ %s\n", toChars(), type->toChars());
|
||||
IF_LOG Logger::print("IntegerExp::toElem: %s @ %s\n", toChars(), type->toChars());
|
||||
LOG_SCOPE;
|
||||
LLConstant* c = toConstElem(p);
|
||||
return new DConstValue(type, c);
|
||||
|
@ -251,7 +251,7 @@ DValue* IntegerExp::toElem(IRState* p)
|
|||
|
||||
LLConstant* IntegerExp::toConstElem(IRState* p)
|
||||
{
|
||||
Logger::print("IntegerExp::toConstElem: %s @ %s\n", toChars(), type->toChars());
|
||||
IF_LOG Logger::print("IntegerExp::toConstElem: %s @ %s\n", toChars(), type->toChars());
|
||||
LOG_SCOPE;
|
||||
LLType* t = DtoType(type);
|
||||
if (isaPointer(t)) {
|
||||
|
@ -262,8 +262,7 @@ LLConstant* IntegerExp::toConstElem(IRState* p)
|
|||
assert(llvm::isa<LLIntegerType>(t));
|
||||
LLConstant* c = LLConstantInt::get(t,(uint64_t)value,!type->isunsigned());
|
||||
assert(c);
|
||||
if (Logger::enabled())
|
||||
Logger::cout() << "value = " << *c << '\n';
|
||||
IF_LOG Logger::cout() << "value = " << *c << '\n';
|
||||
return c;
|
||||
}
|
||||
|
||||
|
@ -271,7 +270,7 @@ LLConstant* IntegerExp::toConstElem(IRState* p)
|
|||
|
||||
DValue* RealExp::toElem(IRState* p)
|
||||
{
|
||||
Logger::print("RealExp::toElem: %s @ %s\n", toChars(), type->toChars());
|
||||
IF_LOG Logger::print("RealExp::toElem: %s @ %s\n", toChars(), type->toChars());
|
||||
LOG_SCOPE;
|
||||
LLConstant* c = toConstElem(p);
|
||||
return new DConstValue(type, c);
|
||||
|
@ -281,7 +280,7 @@ DValue* RealExp::toElem(IRState* p)
|
|||
|
||||
LLConstant* RealExp::toConstElem(IRState* p)
|
||||
{
|
||||
Logger::print("RealExp::toConstElem: %s @ %s | %La\n", toChars(), type->toChars(), value);
|
||||
IF_LOG Logger::print("RealExp::toConstElem: %s @ %s | %La\n", toChars(), type->toChars(), value);
|
||||
LOG_SCOPE;
|
||||
Type* t = type->toBasetype();
|
||||
return DtoConstFP(t, value);
|
||||
|
@ -291,7 +290,7 @@ LLConstant* RealExp::toConstElem(IRState* p)
|
|||
|
||||
DValue* NullExp::toElem(IRState* p)
|
||||
{
|
||||
Logger::print("NullExp::toElem(type=%s): %s\n", type->toChars(),toChars());
|
||||
IF_LOG Logger::print("NullExp::toElem(type=%s): %s\n", type->toChars(),toChars());
|
||||
LOG_SCOPE;
|
||||
LLConstant* c = toConstElem(p);
|
||||
return new DNullValue(type, c);
|
||||
|
@ -301,7 +300,7 @@ DValue* NullExp::toElem(IRState* p)
|
|||
|
||||
LLConstant* NullExp::toConstElem(IRState* p)
|
||||
{
|
||||
Logger::print("NullExp::toConstElem(type=%s): %s\n", type->toChars(),toChars());
|
||||
IF_LOG Logger::print("NullExp::toConstElem(type=%s): %s\n", type->toChars(),toChars());
|
||||
LOG_SCOPE;
|
||||
LLType* t = DtoType(type);
|
||||
if (type->ty == Tarray) {
|
||||
|
@ -319,7 +318,7 @@ LLConstant* NullExp::toConstElem(IRState* p)
|
|||
|
||||
DValue* ComplexExp::toElem(IRState* p)
|
||||
{
|
||||
Logger::print("ComplexExp::toElem(): %s @ %s\n", toChars(), type->toChars());
|
||||
IF_LOG Logger::print("ComplexExp::toElem(): %s @ %s\n", toChars(), type->toChars());
|
||||
LOG_SCOPE;
|
||||
LLConstant* c = toConstElem(p);
|
||||
LLValue* res;
|
||||
|
@ -344,7 +343,7 @@ DValue* ComplexExp::toElem(IRState* p)
|
|||
|
||||
LLConstant* ComplexExp::toConstElem(IRState* p)
|
||||
{
|
||||
Logger::print("ComplexExp::toConstElem(): %s @ %s\n", toChars(), type->toChars());
|
||||
IF_LOG Logger::print("ComplexExp::toConstElem(): %s @ %s\n", toChars(), type->toChars());
|
||||
LOG_SCOPE;
|
||||
return DtoConstComplex(type, value.re, value.im);
|
||||
}
|
||||
|
@ -353,7 +352,7 @@ LLConstant* ComplexExp::toConstElem(IRState* p)
|
|||
|
||||
DValue* StringExp::toElem(IRState* p)
|
||||
{
|
||||
Logger::print("StringExp::toElem: %s @ %s\n", toChars(), type->toChars());
|
||||
IF_LOG Logger::print("StringExp::toElem: %s @ %s\n", toChars(), type->toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
Type* dtype = type->toBasetype();
|
||||
|
@ -380,8 +379,7 @@ DValue* StringExp::toElem(IRState* p)
|
|||
}
|
||||
|
||||
llvm::GlobalValue::LinkageTypes _linkage = llvm::GlobalValue::InternalLinkage;
|
||||
if (Logger::enabled())
|
||||
{
|
||||
IF_LOG {
|
||||
Logger::cout() << "type: " << *at << '\n';
|
||||
Logger::cout() << "init: " << *_init << '\n';
|
||||
}
|
||||
|
@ -412,7 +410,7 @@ DValue* StringExp::toElem(IRState* p)
|
|||
|
||||
LLConstant* StringExp::toConstElem(IRState* p)
|
||||
{
|
||||
Logger::print("StringExp::toConstElem: %s @ %s\n", toChars(), type->toChars());
|
||||
IF_LOG Logger::print("StringExp::toConstElem: %s @ %s\n", toChars(), type->toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
Type* t = type->toBasetype();
|
||||
|
@ -468,7 +466,7 @@ LLConstant* StringExp::toConstElem(IRState* p)
|
|||
|
||||
DValue* AssignExp::toElem(IRState* p)
|
||||
{
|
||||
Logger::print("AssignExp::toElem: %s | (%s)(%s = %s)\n", toChars(), type->toChars(), e1->type->toChars(), e2->type ? e2->type->toChars() : 0);
|
||||
IF_LOG Logger::print("AssignExp::toElem: %s | (%s)(%s = %s)\n", toChars(), type->toChars(), e1->type->toChars(), e2->type ? e2->type->toChars() : 0);
|
||||
LOG_SCOPE;
|
||||
|
||||
if (e1->op == TOKarraylength)
|
||||
|
@ -584,7 +582,7 @@ static Expression* findLvalue(IRState* irs, Expression* exp)
|
|||
#define BIN_ASSIGN(X) \
|
||||
DValue* X##AssignExp::toElem(IRState* p) \
|
||||
{ \
|
||||
Logger::print(#X"AssignExp::toElem: %s @ %s\n", toChars(), type->toChars()); \
|
||||
IF_LOG Logger::print(#X"AssignExp::toElem: %s @ %s\n", toChars(), type->toChars()); \
|
||||
LOG_SCOPE; \
|
||||
X##Exp e3(loc, e1, e2); \
|
||||
e3.type = e1->type; \
|
||||
|
@ -733,7 +731,7 @@ static DValue* emitPointerOffset(IRState* p, Loc loc, DValue* base,
|
|||
|
||||
DValue* AddExp::toElem(IRState* p)
|
||||
{
|
||||
Logger::print("AddExp::toElem: %s @ %s\n", toChars(), type->toChars());
|
||||
IF_LOG Logger::print("AddExp::toElem: %s @ %s\n", toChars(), type->toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
DValue* l = e1->toElem(p);
|
||||
|
@ -775,7 +773,7 @@ LLConstant* MinExp::toConstElem(IRState* p)
|
|||
|
||||
DValue* MinExp::toElem(IRState* p)
|
||||
{
|
||||
Logger::print("MinExp::toElem: %s @ %s\n", toChars(), type->toChars());
|
||||
IF_LOG Logger::print("MinExp::toElem: %s @ %s\n", toChars(), type->toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
DValue* l = e1->toElem(p);
|
||||
|
@ -789,8 +787,7 @@ DValue* MinExp::toElem(IRState* p)
|
|||
if (t1->ty == Tpointer && t2->ty == Tpointer) {
|
||||
LLValue* lv = l->getRVal();
|
||||
LLValue* rv = e2->toElem(p)->getRVal();
|
||||
if (Logger::enabled())
|
||||
Logger::cout() << "lv: " << *lv << " rv: " << *rv << '\n';
|
||||
IF_LOG Logger::cout() << "lv: " << *lv << " rv: " << *rv << '\n';
|
||||
lv = p->ir->CreatePtrToInt(lv, DtoSize_t(), "tmp");
|
||||
rv = p->ir->CreatePtrToInt(rv, DtoSize_t(), "tmp");
|
||||
LLValue* diff = p->ir->CreateSub(lv,rv,"tmp");
|
||||
|
@ -815,7 +812,7 @@ DValue* MinExp::toElem(IRState* p)
|
|||
|
||||
DValue* MulExp::toElem(IRState* p)
|
||||
{
|
||||
Logger::print("MulExp::toElem: %s @ %s\n", toChars(), type->toChars());
|
||||
IF_LOG Logger::print("MulExp::toElem: %s @ %s\n", toChars(), type->toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
DValue* l = e1->toElem(p);
|
||||
|
@ -834,7 +831,7 @@ DValue* MulExp::toElem(IRState* p)
|
|||
|
||||
DValue* DivExp::toElem(IRState* p)
|
||||
{
|
||||
Logger::print("DivExp::toElem: %s @ %s\n", toChars(), type->toChars());
|
||||
IF_LOG Logger::print("DivExp::toElem: %s @ %s\n", toChars(), type->toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
DValue* l = e1->toElem(p);
|
||||
|
@ -853,7 +850,7 @@ DValue* DivExp::toElem(IRState* p)
|
|||
|
||||
DValue* ModExp::toElem(IRState* p)
|
||||
{
|
||||
Logger::print("ModExp::toElem: %s @ %s\n", toChars(), type->toChars());
|
||||
IF_LOG Logger::print("ModExp::toElem: %s @ %s\n", toChars(), type->toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
DValue* l = e1->toElem(p);
|
||||
|
@ -872,7 +869,7 @@ DValue* ModExp::toElem(IRState* p)
|
|||
|
||||
void CallExp::cacheLvalue(IRState* p)
|
||||
{
|
||||
Logger::println("Caching l-value of %s", toChars());
|
||||
IF_LOG Logger::println("Caching l-value of %s", toChars());
|
||||
LOG_SCOPE;
|
||||
cachedLvalue = toElem(p)->getLVal();
|
||||
}
|
||||
|
@ -881,7 +878,7 @@ void CallExp::cacheLvalue(IRState* p)
|
|||
|
||||
DValue* CallExp::toElem(IRState* p)
|
||||
{
|
||||
Logger::print("CallExp::toElem: %s @ %s\n", toChars(), type->toChars());
|
||||
IF_LOG Logger::print("CallExp::toElem: %s @ %s\n", toChars(), type->toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
if (cachedLvalue)
|
||||
|
@ -1166,7 +1163,7 @@ DValue* CallExp::toElem(IRState* p)
|
|||
|
||||
DValue* CastExp::toElem(IRState* p)
|
||||
{
|
||||
Logger::print("CastExp::toElem: %s @ %s\n", toChars(), type->toChars());
|
||||
IF_LOG Logger::print("CastExp::toElem: %s @ %s\n", toChars(), type->toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
// get the value to cast
|
||||
|
@ -1193,7 +1190,7 @@ DValue* CastExp::toElem(IRState* p)
|
|||
|
||||
LLConstant* CastExp::toConstElem(IRState* p)
|
||||
{
|
||||
Logger::print("CastExp::toConstElem: %s @ %s\n", toChars(), type->toChars());
|
||||
IF_LOG Logger::print("CastExp::toConstElem: %s @ %s\n", toChars(), type->toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
LLConstant* res;
|
||||
|
@ -1269,7 +1266,7 @@ Lerr:
|
|||
|
||||
DValue* SymOffExp::toElem(IRState* p)
|
||||
{
|
||||
Logger::print("SymOffExp::toElem: %s @ %s\n", toChars(), type->toChars());
|
||||
IF_LOG Logger::print("SymOffExp::toElem: %s @ %s\n", toChars(), type->toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
DValue* base = DtoSymbolAddress(loc, var->type, var);
|
||||
|
@ -1334,7 +1331,7 @@ llvm::Constant* SymOffExp::toConstElem(IRState* p)
|
|||
const unsigned elemSize = gDataLayout->getTypeStoreSize(
|
||||
base->getType()->getContainedType(0));
|
||||
|
||||
Logger::println("adding offset: %u (elem size: %u)", offset, elemSize);
|
||||
IF_LOG Logger::println("adding offset: %u (elem size: %u)", offset, elemSize);
|
||||
|
||||
if (offset % elemSize == 0)
|
||||
{
|
||||
|
@ -1410,8 +1407,7 @@ DValue* AddrExp::toElem(IRState* p)
|
|||
DtoStore(rval, lval);
|
||||
}
|
||||
|
||||
if (Logger::enabled())
|
||||
Logger::cout() << "lval: " << *lval << '\n';
|
||||
IF_LOG Logger::cout() << "lval: " << *lval << '\n';
|
||||
|
||||
return new DImValue(type, DtoBitCast(lval, DtoType(type)));
|
||||
}
|
||||
|
@ -1464,7 +1460,7 @@ LLConstant* AddrExp::toConstElem(IRState* p)
|
|||
|
||||
if (se->globalVar)
|
||||
{
|
||||
Logger::cout() << "Returning existing global: " << *se->globalVar << '\n';
|
||||
IF_LOG Logger::cout() << "Returning existing global: " << *se->globalVar << '\n';
|
||||
return se->globalVar;
|
||||
}
|
||||
|
||||
|
@ -1506,14 +1502,14 @@ LLConstant* AddrExp::toConstElem(IRState* p)
|
|||
|
||||
void PtrExp::cacheLvalue(IRState* p)
|
||||
{
|
||||
Logger::println("Caching l-value of %s", toChars());
|
||||
IF_LOG Logger::println("Caching l-value of %s", toChars());
|
||||
LOG_SCOPE;
|
||||
cachedLvalue = e1->toElem(p)->getRVal();
|
||||
}
|
||||
|
||||
DValue* PtrExp::toElem(IRState* p)
|
||||
{
|
||||
Logger::println("PtrExp::toElem: %s @ %s", toChars(), type->toChars());
|
||||
IF_LOG Logger::println("PtrExp::toElem: %s @ %s", toChars(), type->toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
// function pointers are special
|
||||
|
@ -1568,14 +1564,14 @@ DValue* PtrExp::toElem(IRState* p)
|
|||
|
||||
void DotVarExp::cacheLvalue(IRState* p)
|
||||
{
|
||||
Logger::println("Caching l-value of %s", toChars());
|
||||
IF_LOG Logger::println("Caching l-value of %s", toChars());
|
||||
LOG_SCOPE;
|
||||
cachedLvalue = toElem(p)->getLVal();
|
||||
}
|
||||
|
||||
DValue* DotVarExp::toElem(IRState* p)
|
||||
{
|
||||
Logger::print("DotVarExp::toElem: %s @ %s\n", toChars(), type->toChars());
|
||||
IF_LOG Logger::print("DotVarExp::toElem: %s @ %s\n", toChars(), type->toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
if (cachedLvalue)
|
||||
|
@ -1681,7 +1677,7 @@ DValue* DotVarExp::toElem(IRState* p)
|
|||
|
||||
DValue* ThisExp::toElem(IRState* p)
|
||||
{
|
||||
Logger::print("ThisExp::toElem: %s @ %s\n", toChars(), type->toChars());
|
||||
IF_LOG Logger::print("ThisExp::toElem: %s @ %s\n", toChars(), type->toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
// regular this expr
|
||||
|
@ -1714,14 +1710,14 @@ DValue* ThisExp::toElem(IRState* p)
|
|||
|
||||
void IndexExp::cacheLvalue(IRState* p)
|
||||
{
|
||||
Logger::println("Caching l-value of %s", toChars());
|
||||
IF_LOG Logger::println("Caching l-value of %s", toChars());
|
||||
LOG_SCOPE;
|
||||
cachedLvalue = toElem(p)->getLVal();
|
||||
}
|
||||
|
||||
DValue* IndexExp::toElem(IRState* p)
|
||||
{
|
||||
Logger::print("IndexExp::toElem: %s @ %s\n", toChars(), type->toChars());
|
||||
IF_LOG Logger::print("IndexExp::toElem: %s @ %s\n", toChars(), type->toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
if (cachedLvalue)
|
||||
|
@ -1759,7 +1755,7 @@ DValue* IndexExp::toElem(IRState* p)
|
|||
return DtoAAIndex(loc, type, l, r, modifiable);
|
||||
}
|
||||
else {
|
||||
Logger::println("e1type: %s", e1type->toChars());
|
||||
IF_LOG Logger::println("e1type: %s", e1type->toChars());
|
||||
llvm_unreachable("Unknown IndexExp target.");
|
||||
}
|
||||
return new DVarValue(type, arrptr);
|
||||
|
@ -1769,7 +1765,7 @@ DValue* IndexExp::toElem(IRState* p)
|
|||
|
||||
DValue* SliceExp::toElem(IRState* p)
|
||||
{
|
||||
Logger::print("SliceExp::toElem: %s @ %s\n", toChars(), type->toChars());
|
||||
IF_LOG Logger::print("SliceExp::toElem: %s @ %s\n", toChars(), type->toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
// this is the new slicing code, it's different in that a full slice will no longer retain the original pointer.
|
||||
|
@ -1850,7 +1846,7 @@ DValue* SliceExp::toElem(IRState* p)
|
|||
|
||||
DValue* CmpExp::toElem(IRState* p)
|
||||
{
|
||||
Logger::print("CmpExp::toElem: %s @ %s\n", toChars(), type->toChars());
|
||||
IF_LOG Logger::print("CmpExp::toElem: %s @ %s\n", toChars(), type->toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
DValue* l = e1->toElem(p);
|
||||
|
@ -1869,8 +1865,7 @@ DValue* CmpExp::toElem(IRState* p)
|
|||
{
|
||||
LLValue* a = l->getRVal();
|
||||
LLValue* b = r->getRVal();
|
||||
if (Logger::enabled())
|
||||
{
|
||||
IF_LOG {
|
||||
Logger::cout() << "type 1: " << *a << '\n';
|
||||
Logger::cout() << "type 2: " << *b << '\n';
|
||||
}
|
||||
|
@ -1979,7 +1974,7 @@ DValue* CmpExp::toElem(IRState* p)
|
|||
|
||||
DValue* EqualExp::toElem(IRState* p)
|
||||
{
|
||||
Logger::print("EqualExp::toElem: %s @ %s\n", toChars(), type->toChars());
|
||||
IF_LOG Logger::print("EqualExp::toElem: %s @ %s\n", toChars(), type->toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
DValue* l = e1->toElem(p);
|
||||
|
@ -2011,8 +2006,7 @@ DValue* EqualExp::toElem(IRState* p)
|
|||
if (rv->getType() != lv->getType()) {
|
||||
rv = DtoBitCast(rv, lv->getType());
|
||||
}
|
||||
if (Logger::enabled())
|
||||
{
|
||||
IF_LOG {
|
||||
Logger::cout() << "lv: " << *lv << '\n';
|
||||
Logger::cout() << "rv: " << *rv << '\n';
|
||||
}
|
||||
|
@ -2055,7 +2049,7 @@ DValue* EqualExp::toElem(IRState* p)
|
|||
|
||||
DValue* PostExp::toElem(IRState* p)
|
||||
{
|
||||
Logger::print("PostExp::toElem: %s @ %s\n", toChars(), type->toChars());
|
||||
IF_LOG Logger::print("PostExp::toElem: %s @ %s\n", toChars(), type->toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
DValue* l = e1->toElem(p);
|
||||
|
@ -2109,7 +2103,7 @@ DValue* PostExp::toElem(IRState* p)
|
|||
|
||||
DValue* NewExp::toElem(IRState* p)
|
||||
{
|
||||
Logger::print("NewExp::toElem: %s @ %s\n", toChars(), type->toChars());
|
||||
IF_LOG Logger::print("NewExp::toElem: %s @ %s\n", toChars(), type->toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
assert(newtype);
|
||||
|
@ -2123,7 +2117,7 @@ DValue* NewExp::toElem(IRState* p)
|
|||
// new dynamic array
|
||||
else if (ntype->ty == Tarray)
|
||||
{
|
||||
Logger::println("new dynamic array: %s", newtype->toChars());
|
||||
IF_LOG Logger::println("new dynamic array: %s", newtype->toChars());
|
||||
// get dim
|
||||
assert(arguments);
|
||||
assert(arguments->dim >= 1);
|
||||
|
@ -2151,7 +2145,7 @@ DValue* NewExp::toElem(IRState* p)
|
|||
// new struct
|
||||
else if (ntype->ty == Tstruct)
|
||||
{
|
||||
Logger::println("new struct on heap: %s\n", newtype->toChars());
|
||||
IF_LOG Logger::println("new struct on heap: %s\n", newtype->toChars());
|
||||
// allocate
|
||||
LLValue* mem = 0;
|
||||
if (allocator)
|
||||
|
@ -2214,7 +2208,7 @@ DValue* NewExp::toElem(IRState* p)
|
|||
|
||||
DValue* DeleteExp::toElem(IRState* p)
|
||||
{
|
||||
Logger::print("DeleteExp::toElem: %s @ %s\n", toChars(), type->toChars());
|
||||
IF_LOG Logger::print("DeleteExp::toElem: %s @ %s\n", toChars(), type->toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
DValue* dval = e1->toElem(p);
|
||||
|
@ -2272,7 +2266,7 @@ DValue* DeleteExp::toElem(IRState* p)
|
|||
|
||||
DValue* ArrayLengthExp::toElem(IRState* p)
|
||||
{
|
||||
Logger::print("ArrayLengthExp::toElem: %s @ %s\n", toChars(), type->toChars());
|
||||
IF_LOG Logger::print("ArrayLengthExp::toElem: %s @ %s\n", toChars(), type->toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
DValue* u = e1->toElem(p);
|
||||
|
@ -2283,7 +2277,7 @@ DValue* ArrayLengthExp::toElem(IRState* p)
|
|||
|
||||
DValue* AssertExp::toElem(IRState* p)
|
||||
{
|
||||
Logger::print("AssertExp::toElem: %s\n", toChars());
|
||||
IF_LOG Logger::print("AssertExp::toElem: %s\n", toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
if(!global.params.useAssert)
|
||||
|
@ -2361,7 +2355,7 @@ DValue* AssertExp::toElem(IRState* p)
|
|||
|
||||
DValue* NotExp::toElem(IRState* p)
|
||||
{
|
||||
Logger::print("NotExp::toElem: %s @ %s\n", toChars(), type->toChars());
|
||||
IF_LOG Logger::print("NotExp::toElem: %s @ %s\n", toChars(), type->toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
DValue* u = e1->toElem(p);
|
||||
|
@ -2378,7 +2372,7 @@ DValue* NotExp::toElem(IRState* p)
|
|||
|
||||
DValue* AndAndExp::toElem(IRState* p)
|
||||
{
|
||||
Logger::print("AndAndExp::toElem: %s @ %s\n", toChars(), type->toChars());
|
||||
IF_LOG Logger::print("AndAndExp::toElem: %s @ %s\n", toChars(), type->toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
DValue* u = e1->toElem(p);
|
||||
|
@ -2425,7 +2419,7 @@ DValue* AndAndExp::toElem(IRState* p)
|
|||
|
||||
DValue* OrOrExp::toElem(IRState* p)
|
||||
{
|
||||
Logger::print("OrOrExp::toElem: %s @ %s\n", toChars(), type->toChars());
|
||||
IF_LOG Logger::print("OrOrExp::toElem: %s @ %s\n", toChars(), type->toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
DValue* u = e1->toElem(p);
|
||||
|
@ -2473,7 +2467,7 @@ DValue* OrOrExp::toElem(IRState* p)
|
|||
#define BinBitExp(X,Y) \
|
||||
DValue* X##Exp::toElem(IRState* p) \
|
||||
{ \
|
||||
Logger::print("%sExp::toElem: %s @ %s\n", #X, toChars(), type->toChars()); \
|
||||
IF_LOG Logger::print("%sExp::toElem: %s @ %s\n", #X, toChars(), type->toChars()); \
|
||||
LOG_SCOPE; \
|
||||
DValue* u = e1->toElem(p); \
|
||||
DValue* v = e2->toElem(p); \
|
||||
|
@ -2490,7 +2484,7 @@ BinBitExp(Ushr,LShr)
|
|||
|
||||
DValue* ShrExp::toElem(IRState* p)
|
||||
{
|
||||
Logger::print("ShrExp::toElem: %s @ %s\n", toChars(), type->toChars());
|
||||
IF_LOG Logger::print("ShrExp::toElem: %s @ %s\n", toChars(), type->toChars());
|
||||
LOG_SCOPE;
|
||||
DValue* u = e1->toElem(p);
|
||||
DValue* v = e2->toElem(p);
|
||||
|
@ -2506,7 +2500,7 @@ DValue* ShrExp::toElem(IRState* p)
|
|||
|
||||
DValue* HaltExp::toElem(IRState* p)
|
||||
{
|
||||
Logger::print("HaltExp::toElem: %s\n", toChars());
|
||||
IF_LOG Logger::print("HaltExp::toElem: %s\n", toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
p->ir->CreateCall(GET_INTRINSIC_DECL(trap), "");
|
||||
|
@ -2526,7 +2520,7 @@ DValue* HaltExp::toElem(IRState* p)
|
|||
|
||||
DValue* DelegateExp::toElem(IRState* p)
|
||||
{
|
||||
Logger::print("DelegateExp::toElem: %s @ %s\n", toChars(), type->toChars());
|
||||
IF_LOG Logger::print("DelegateExp::toElem: %s @ %s\n", toChars(), type->toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
if(func->isStatic())
|
||||
|
@ -2558,12 +2552,11 @@ DValue* DelegateExp::toElem(IRState* p)
|
|||
uval = src->getRVal();
|
||||
}
|
||||
|
||||
if (Logger::enabled())
|
||||
Logger::cout() << "context = " << *uval << '\n';
|
||||
IF_LOG Logger::cout() << "context = " << *uval << '\n';
|
||||
|
||||
LLValue* castcontext = DtoBitCast(uval, int8ptrty);
|
||||
|
||||
Logger::println("func: '%s'", func->toPrettyChars());
|
||||
IF_LOG Logger::println("func: '%s'", func->toPrettyChars());
|
||||
|
||||
LLValue* castfptr;
|
||||
|
||||
|
@ -2602,7 +2595,7 @@ DValue* DelegateExp::toElem(IRState* p)
|
|||
|
||||
DValue* IdentityExp::toElem(IRState* p)
|
||||
{
|
||||
Logger::print("IdentityExp::toElem: %s @ %s\n", toChars(), type->toChars());
|
||||
IF_LOG Logger::print("IdentityExp::toElem: %s @ %s\n", toChars(), type->toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
DValue* l = e1->toElem(p);
|
||||
|
@ -2660,7 +2653,7 @@ DValue* IdentityExp::toElem(IRState* p)
|
|||
|
||||
DValue* CommaExp::toElem(IRState* p)
|
||||
{
|
||||
Logger::print("CommaExp::toElem: %s @ %s\n", toChars(), type->toChars());
|
||||
IF_LOG Logger::print("CommaExp::toElem: %s @ %s\n", toChars(), type->toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
if (cachedLvalue)
|
||||
|
@ -2680,7 +2673,7 @@ DValue* CommaExp::toElem(IRState* p)
|
|||
|
||||
void CommaExp::cacheLvalue(IRState* p)
|
||||
{
|
||||
Logger::println("Caching l-value of %s", toChars());
|
||||
IF_LOG Logger::println("Caching l-value of %s", toChars());
|
||||
LOG_SCOPE;
|
||||
cachedLvalue = toElem(p)->getLVal();
|
||||
}
|
||||
|
@ -2689,7 +2682,7 @@ void CommaExp::cacheLvalue(IRState* p)
|
|||
|
||||
DValue* CondExp::toElem(IRState* p)
|
||||
{
|
||||
Logger::print("CondExp::toElem: %s @ %s\n", toChars(), type->toChars());
|
||||
IF_LOG Logger::print("CondExp::toElem: %s @ %s\n", toChars(), type->toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
Type* dtype = type->toBasetype();
|
||||
|
@ -2733,7 +2726,7 @@ DValue* CondExp::toElem(IRState* p)
|
|||
|
||||
DValue* ComExp::toElem(IRState* p)
|
||||
{
|
||||
Logger::print("ComExp::toElem: %s @ %s\n", toChars(), type->toChars());
|
||||
IF_LOG Logger::print("ComExp::toElem: %s @ %s\n", toChars(), type->toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
DValue* u = e1->toElem(p);
|
||||
|
@ -2749,7 +2742,7 @@ DValue* ComExp::toElem(IRState* p)
|
|||
|
||||
DValue* NegExp::toElem(IRState* p)
|
||||
{
|
||||
Logger::print("NegExp::toElem: %s @ %s\n", toChars(), type->toChars());
|
||||
IF_LOG Logger::print("NegExp::toElem: %s @ %s\n", toChars(), type->toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
DValue* l = e1->toElem(p);
|
||||
|
@ -2772,7 +2765,7 @@ DValue* NegExp::toElem(IRState* p)
|
|||
|
||||
DValue* CatExp::toElem(IRState* p)
|
||||
{
|
||||
Logger::print("CatExp::toElem: %s @ %s\n", toChars(), type->toChars());
|
||||
IF_LOG Logger::print("CatExp::toElem: %s @ %s\n", toChars(), type->toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
return DtoCatArrays(type, e1, e2);
|
||||
|
@ -2782,7 +2775,7 @@ DValue* CatExp::toElem(IRState* p)
|
|||
|
||||
DValue* CatAssignExp::toElem(IRState* p)
|
||||
{
|
||||
Logger::print("CatAssignExp::toElem: %s @ %s\n", toChars(), type->toChars());
|
||||
IF_LOG Logger::print("CatAssignExp::toElem: %s @ %s\n", toChars(), type->toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
DValue* l = e1->toElem(p);
|
||||
|
@ -2819,7 +2812,7 @@ DValue* CatAssignExp::toElem(IRState* p)
|
|||
|
||||
DValue* FuncExp::toElem(IRState* p)
|
||||
{
|
||||
Logger::print("FuncExp::toElem: %s @ %s\n", toChars(), type->toChars());
|
||||
IF_LOG Logger::print("FuncExp::toElem: %s @ %s\n", toChars(), type->toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
assert(fd);
|
||||
|
@ -2890,7 +2883,7 @@ DValue* FuncExp::toElem(IRState* p)
|
|||
|
||||
LLConstant* FuncExp::toConstElem(IRState* p)
|
||||
{
|
||||
Logger::print("FuncExp::toConstElem: %s @ %s\n", toChars(), type->toChars());
|
||||
IF_LOG Logger::print("FuncExp::toConstElem: %s @ %s\n", toChars(), type->toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
assert(fd);
|
||||
|
@ -2925,7 +2918,7 @@ LLConstant* FuncExp::toConstElem(IRState* p)
|
|||
|
||||
DValue* ArrayLiteralExp::toElem(IRState* p)
|
||||
{
|
||||
Logger::print("ArrayLiteralExp::toElem: %s @ %s\n", toChars(), type->toChars());
|
||||
IF_LOG Logger::print("ArrayLiteralExp::toElem: %s @ %s\n", toChars(), type->toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
// D types
|
||||
|
@ -2939,14 +2932,12 @@ DValue* ArrayLiteralExp::toElem(IRState* p)
|
|||
|
||||
// llvm target type
|
||||
LLType* llType = DtoType(arrayType);
|
||||
if (Logger::enabled())
|
||||
Logger::cout() << (dyn?"dynamic":"static") << " array literal with length " << len << " of D type: '" << arrayType->toChars() << "' has llvm type: '" << *llType << "'\n";
|
||||
IF_LOG Logger::cout() << (dyn?"dynamic":"static") << " array literal with length " << len << " of D type: '" << arrayType->toChars() << "' has llvm type: '" << *llType << "'\n";
|
||||
|
||||
// llvm storage type
|
||||
LLType* llElemType = i1ToI8(voidToI8(DtoType(elemType)));
|
||||
LLType* llStoType = LLArrayType::get(llElemType, len);
|
||||
if (Logger::enabled())
|
||||
Logger::cout() << "llvm storage type: '" << *llStoType << "'\n";
|
||||
IF_LOG Logger::cout() << "llvm storage type: '" << *llStoType << "'\n";
|
||||
|
||||
// don't allocate storage for zero length dynamic array literals
|
||||
if (dyn && len == 0)
|
||||
|
@ -2989,7 +2980,7 @@ DValue* ArrayLiteralExp::toElem(IRState* p)
|
|||
|
||||
LLConstant* ArrayLiteralExp::toConstElem(IRState* p)
|
||||
{
|
||||
Logger::print("ArrayLiteralExp::toConstElem: %s @ %s\n", toChars(), type->toChars());
|
||||
IF_LOG Logger::print("ArrayLiteralExp::toConstElem: %s @ %s\n", toChars(), type->toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
// extract D types
|
||||
|
@ -3046,7 +3037,7 @@ DValue* StructLiteralExp::toElem(IRState* p)
|
|||
{
|
||||
// Copied from VarExp::toElem, need to clean this mess up.
|
||||
Type* sdecltype = sinit->type->toBasetype();
|
||||
Logger::print("Sym: type = %s\n", sdecltype->toChars());
|
||||
IF_LOG Logger::print("Sym: type = %s\n", sdecltype->toChars());
|
||||
assert(sdecltype->ty == Tstruct);
|
||||
TypeStruct* ts = static_cast<TypeStruct*>(sdecltype);
|
||||
assert(ts->sym);
|
||||
|
@ -3159,7 +3150,7 @@ DValue* StructLiteralExp::toElem(IRState* p)
|
|||
assert(implicitPadding >= 0);
|
||||
if (implicitPadding > 0)
|
||||
{
|
||||
Logger::println("zeroing %d padding bytes", implicitPadding);
|
||||
IF_LOG Logger::println("zeroing %d padding bytes", implicitPadding);
|
||||
voidptr = write_zeroes(voidptr, offset - implicitPadding, offset);
|
||||
}
|
||||
}
|
||||
|
@ -3186,7 +3177,7 @@ LLConstant* StructLiteralExp::toConstElem(IRState* p)
|
|||
{
|
||||
// Copied from VarExp::toConstElem, need to clean this mess up.
|
||||
Type* sdecltype = sinit->type->toBasetype();
|
||||
Logger::print("Sym: type=%s\n", sdecltype->toChars());
|
||||
IF_LOG Logger::print("Sym: type=%s\n", sdecltype->toChars());
|
||||
assert(sdecltype->ty == Tstruct);
|
||||
TypeStruct* ts = static_cast<TypeStruct*>(sdecltype);
|
||||
DtoResolveStruct(ts->sym);
|
||||
|
@ -3317,7 +3308,7 @@ llvm::Constant* ClassReferenceExp::toConstElem(IRState *p)
|
|||
|
||||
DValue* InExp::toElem(IRState* p)
|
||||
{
|
||||
Logger::print("InExp::toElem: %s @ %s\n", toChars(), type->toChars());
|
||||
IF_LOG Logger::print("InExp::toElem: %s @ %s\n", toChars(), type->toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
DValue* key = e1->toElem(p);
|
||||
|
@ -3328,7 +3319,7 @@ DValue* InExp::toElem(IRState* p)
|
|||
|
||||
DValue* RemoveExp::toElem(IRState* p)
|
||||
{
|
||||
Logger::print("RemoveExp::toElem: %s\n", toChars());
|
||||
IF_LOG Logger::print("RemoveExp::toElem: %s\n", toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
DValue* aa = e1->toElem(p);
|
||||
|
@ -3371,7 +3362,7 @@ static llvm::Constant* arrayConst(std::vector<llvm::Constant*>& vals,
|
|||
|
||||
DValue* AssocArrayLiteralExp::toElem(IRState* p)
|
||||
{
|
||||
Logger::print("AssocArrayLiteralExp::toElem: %s @ %s\n", toChars(), type->toChars());
|
||||
IF_LOG Logger::print("AssocArrayLiteralExp::toElem: %s @ %s\n", toChars(), type->toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
assert(keys);
|
||||
|
@ -3401,7 +3392,7 @@ DValue* AssocArrayLiteralExp::toElem(IRState* p)
|
|||
{
|
||||
Expression* ekey = keys->tdata()[i];
|
||||
Expression* eval = values->tdata()[i];
|
||||
Logger::println("(%zu) aa[%s] = %s", i, ekey->toChars(), eval->toChars());
|
||||
IF_LOG Logger::println("(%zu) aa[%s] = %s", i, ekey->toChars(), eval->toChars());
|
||||
unsigned errors = global.startGagging();
|
||||
LLConstant *ekeyConst = ekey->toConstElem(p);
|
||||
LLConstant *evalConst = eval->toConstElem(p);
|
||||
|
@ -3460,7 +3451,7 @@ LruntimeInit:
|
|||
Expression* ekey = static_cast<Expression*>(keys->data[i]);
|
||||
Expression* eval = static_cast<Expression*>(values->data[i]);
|
||||
|
||||
Logger::println("(%zu) aa[%s] = %s", i, ekey->toChars(), eval->toChars());
|
||||
IF_LOG Logger::println("(%zu) aa[%s] = %s", i, ekey->toChars(), eval->toChars());
|
||||
|
||||
// index
|
||||
DValue* key = ekey->toElem(p);
|
||||
|
@ -3584,7 +3575,7 @@ DValue* VectorExp::toElem(IRState* p)
|
|||
|
||||
llvm::Constant* VectorExp::toConstElem(IRState* p)
|
||||
{
|
||||
Logger::print("VectorExp::toConstElem: %s @ %s\n", toChars(), type->toChars());
|
||||
IF_LOG Logger::print("VectorExp::toConstElem: %s @ %s\n", toChars(), type->toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
TypeVector *tv = static_cast<TypeVector*>(to->toBasetype());
|
||||
|
|
|
@ -330,15 +330,14 @@ void DtoResolveTypeInfo(TypeInfoDeclaration* tid)
|
|||
|
||||
void TypeInfoDeclaration_codegen(TypeInfoDeclaration *decl, IRState* p)
|
||||
{
|
||||
Logger::println("TypeInfoDeclaration::codegen(%s)", decl->toPrettyChars());
|
||||
IF_LOG Logger::println("TypeInfoDeclaration::codegen(%s)", decl->toPrettyChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
if (decl->ir.defined) return;
|
||||
decl->ir.defined = true;
|
||||
|
||||
std::string mangled(decl->mangle());
|
||||
if (Logger::enabled())
|
||||
{
|
||||
IF_LOG {
|
||||
Logger::println("type = '%s'", decl->tinfo->toChars());
|
||||
Logger::println("typeinfo mangle: %s", mangled.c_str());
|
||||
}
|
||||
|
@ -375,7 +374,7 @@ void TypeInfoDeclaration_codegen(TypeInfoDeclaration *decl, IRState* p)
|
|||
|
||||
void TypeInfoDeclaration::llvmDefine()
|
||||
{
|
||||
Logger::println("TypeInfoDeclaration::llvmDefine() %s", toChars());
|
||||
IF_LOG Logger::println("TypeInfoDeclaration::llvmDefine() %s", toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
RTTIBuilder b(Type::dtypeinfo);
|
||||
|
@ -386,7 +385,7 @@ void TypeInfoDeclaration::llvmDefine()
|
|||
|
||||
void TypeInfoTypedefDeclaration::llvmDefine()
|
||||
{
|
||||
Logger::println("TypeInfoTypedefDeclaration::llvmDefine() %s", toChars());
|
||||
IF_LOG Logger::println("TypeInfoTypedefDeclaration::llvmDefine() %s", toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
RTTIBuilder b(Type::typeinfotypedef);
|
||||
|
@ -424,7 +423,7 @@ void TypeInfoTypedefDeclaration::llvmDefine()
|
|||
|
||||
void TypeInfoEnumDeclaration::llvmDefine()
|
||||
{
|
||||
Logger::println("TypeInfoEnumDeclaration::llvmDefine() %s", toChars());
|
||||
IF_LOG Logger::println("TypeInfoEnumDeclaration::llvmDefine() %s", toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
RTTIBuilder b(Type::typeinfoenum);
|
||||
|
@ -471,7 +470,7 @@ void TypeInfoEnumDeclaration::llvmDefine()
|
|||
|
||||
void TypeInfoPointerDeclaration::llvmDefine()
|
||||
{
|
||||
Logger::println("TypeInfoPointerDeclaration::llvmDefine() %s", toChars());
|
||||
IF_LOG Logger::println("TypeInfoPointerDeclaration::llvmDefine() %s", toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
RTTIBuilder b(Type::typeinfopointer);
|
||||
|
@ -485,7 +484,7 @@ void TypeInfoPointerDeclaration::llvmDefine()
|
|||
|
||||
void TypeInfoArrayDeclaration::llvmDefine()
|
||||
{
|
||||
Logger::println("TypeInfoArrayDeclaration::llvmDefine() %s", toChars());
|
||||
IF_LOG Logger::println("TypeInfoArrayDeclaration::llvmDefine() %s", toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
RTTIBuilder b(Type::typeinfoarray);
|
||||
|
@ -499,7 +498,7 @@ void TypeInfoArrayDeclaration::llvmDefine()
|
|||
|
||||
void TypeInfoStaticArrayDeclaration::llvmDefine()
|
||||
{
|
||||
Logger::println("TypeInfoStaticArrayDeclaration::llvmDefine() %s", toChars());
|
||||
IF_LOG Logger::println("TypeInfoStaticArrayDeclaration::llvmDefine() %s", toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
assert(tinfo->ty == Tsarray);
|
||||
|
@ -521,7 +520,7 @@ void TypeInfoStaticArrayDeclaration::llvmDefine()
|
|||
|
||||
void TypeInfoAssociativeArrayDeclaration::llvmDefine()
|
||||
{
|
||||
Logger::println("TypeInfoAssociativeArrayDeclaration::llvmDefine() %s", toChars());
|
||||
IF_LOG Logger::println("TypeInfoAssociativeArrayDeclaration::llvmDefine() %s", toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
assert(tinfo->ty == Taarray);
|
||||
|
@ -546,7 +545,7 @@ void TypeInfoAssociativeArrayDeclaration::llvmDefine()
|
|||
|
||||
void TypeInfoFunctionDeclaration::llvmDefine()
|
||||
{
|
||||
Logger::println("TypeInfoFunctionDeclaration::llvmDefine() %s", toChars());
|
||||
IF_LOG Logger::println("TypeInfoFunctionDeclaration::llvmDefine() %s", toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
RTTIBuilder b(Type::typeinfofunction);
|
||||
|
@ -562,7 +561,7 @@ void TypeInfoFunctionDeclaration::llvmDefine()
|
|||
|
||||
void TypeInfoDelegateDeclaration::llvmDefine()
|
||||
{
|
||||
Logger::println("TypeInfoDelegateDeclaration::llvmDefine() %s", toChars());
|
||||
IF_LOG Logger::println("TypeInfoDelegateDeclaration::llvmDefine() %s", toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
assert(tinfo->ty == Tdelegate);
|
||||
|
@ -581,7 +580,7 @@ void TypeInfoDelegateDeclaration::llvmDefine()
|
|||
|
||||
void TypeInfoStructDeclaration::llvmDefine()
|
||||
{
|
||||
Logger::println("TypeInfoStructDeclaration::llvmDefine() %s", toChars());
|
||||
IF_LOG Logger::println("TypeInfoStructDeclaration::llvmDefine() %s", toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
// make sure struct is resolved
|
||||
|
@ -729,7 +728,7 @@ void TypeInfoClassDeclaration::llvmDefine()
|
|||
|
||||
void TypeInfoInterfaceDeclaration::llvmDefine()
|
||||
{
|
||||
Logger::println("TypeInfoInterfaceDeclaration::llvmDefine() %s", toChars());
|
||||
IF_LOG Logger::println("TypeInfoInterfaceDeclaration::llvmDefine() %s", toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
// make sure interface is resolved
|
||||
|
@ -750,7 +749,7 @@ void TypeInfoInterfaceDeclaration::llvmDefine()
|
|||
|
||||
void TypeInfoTupleDeclaration::llvmDefine()
|
||||
{
|
||||
Logger::println("TypeInfoTupleDeclaration::llvmDefine() %s", toChars());
|
||||
IF_LOG Logger::println("TypeInfoTupleDeclaration::llvmDefine() %s", toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
// create elements array
|
||||
|
@ -786,7 +785,7 @@ void TypeInfoTupleDeclaration::llvmDefine()
|
|||
|
||||
void TypeInfoConstDeclaration::llvmDefine()
|
||||
{
|
||||
Logger::println("TypeInfoConstDeclaration::llvmDefine() %s", toChars());
|
||||
IF_LOG Logger::println("TypeInfoConstDeclaration::llvmDefine() %s", toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
RTTIBuilder b(Type::typeinfoconst);
|
||||
|
@ -800,7 +799,7 @@ void TypeInfoConstDeclaration::llvmDefine()
|
|||
|
||||
void TypeInfoInvariantDeclaration::llvmDefine()
|
||||
{
|
||||
Logger::println("TypeInfoInvariantDeclaration::llvmDefine() %s", toChars());
|
||||
IF_LOG Logger::println("TypeInfoInvariantDeclaration::llvmDefine() %s", toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
RTTIBuilder b(Type::typeinfoinvariant);
|
||||
|
@ -814,7 +813,7 @@ void TypeInfoInvariantDeclaration::llvmDefine()
|
|||
|
||||
void TypeInfoSharedDeclaration::llvmDefine()
|
||||
{
|
||||
Logger::println("TypeInfoSharedDeclaration::llvmDefine() %s", toChars());
|
||||
IF_LOG Logger::println("TypeInfoSharedDeclaration::llvmDefine() %s", toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
RTTIBuilder b(Type::typeinfoshared);
|
||||
|
@ -828,7 +827,7 @@ void TypeInfoSharedDeclaration::llvmDefine()
|
|||
|
||||
void TypeInfoWildDeclaration::llvmDefine()
|
||||
{
|
||||
Logger::println("TypeInfoWildDeclaration::llvmDefine() %s", toChars());
|
||||
IF_LOG Logger::println("TypeInfoWildDeclaration::llvmDefine() %s", toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
RTTIBuilder b(Type::typeinfowild);
|
||||
|
@ -842,7 +841,7 @@ void TypeInfoWildDeclaration::llvmDefine()
|
|||
|
||||
void TypeInfoVectorDeclaration::llvmDefine()
|
||||
{
|
||||
Logger::println("TypeInfoVectorDeclaration::llvmDefine() %s", toChars());
|
||||
IF_LOG Logger::println("TypeInfoVectorDeclaration::llvmDefine() %s", toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
assert(tinfo->ty == Tvector);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue