remove all the "tmp" IR names

This commit is contained in:
Andreas Hollandt 2014-09-22 18:27:16 +02:00 committed by David Nadlinger
parent 7eb001f55d
commit 6db62ee8a9
12 changed files with 142 additions and 142 deletions

View file

@ -214,9 +214,9 @@ LLValue* DtoAAEquals(Loc& loc, TOK op, DValue* l, DValue* r)
LLValue* abval = DtoBitCast(r->getRVal(), funcTy->getParamType(2)); LLValue* abval = DtoBitCast(r->getRVal(), funcTy->getParamType(2));
LLValue* aaTypeInfo = DtoTypeInfoOf(t); LLValue* aaTypeInfo = DtoTypeInfoOf(t);
LLValue* res = gIR->CreateCallOrInvoke3(func, aaTypeInfo, aaval, abval, "aaEqRes").getInstruction(); LLValue* res = gIR->CreateCallOrInvoke3(func, aaTypeInfo, aaval, abval, "aaEqRes").getInstruction();
res = gIR->ir->CreateICmpNE(res, DtoConstInt(0), "tmp"); res = gIR->ir->CreateICmpNE(res, DtoConstInt(0));
if (op == TOKnotequal) if (op == TOKnotequal)
res = gIR->ir->CreateNot(res, "tmp"); res = gIR->ir->CreateNot(res);
return res; return res;
} }

View file

@ -484,7 +484,7 @@ void initializeArrayLiteral(IRState* p, ArrayLiteralExp* ale, LLValue* dstMem)
{ {
DValue* e = toElem((*ale->elements)[i]); DValue* e = toElem((*ale->elements)[i]);
LLValue* elemAddr = DtoGEPi(dstMem, 0, i, "tmp", p->scopebb()); LLValue* elemAddr = DtoGEPi(dstMem, 0, i, "", p->scopebb());
DVarValue* vv = new DVarValue(e->type, elemAddr); DVarValue* vv = new DVarValue(e->type, elemAddr);
DtoAssign(ale->loc, vv, e); DtoAssign(ale->loc, vv, e);
} }
@ -496,7 +496,7 @@ static LLValue* get_slice_ptr(DSliceValue* e, LLValue*& sz)
{ {
assert(e->len != 0); assert(e->len != 0);
LLType* t = e->ptr->getType()->getContainedType(0); LLType* t = e->ptr->getType()->getContainedType(0);
sz = gIR->ir->CreateMul(DtoConstSize_t(getTypePaddedSize(t)), e->len, "tmp"); sz = gIR->ir->CreateMul(DtoConstSize_t(getTypePaddedSize(t)), e->len);
return DtoBitCast(e->ptr, getVoidPtrType()); return DtoBitCast(e->ptr, getVoidPtrType());
} }
@ -536,7 +536,7 @@ void DtoArrayCopyToSlice(Loc& loc, DSliceValue* dst, DValue* src)
LLValue* srcarr = DtoBitCast(DtoArrayPtr(src), getVoidPtrType()); LLValue* srcarr = DtoBitCast(DtoArrayPtr(src), getVoidPtrType());
LLType* arrayelemty = voidToI8(DtoType(src->getType()->nextOf()->toBasetype())); LLType* arrayelemty = voidToI8(DtoType(src->getType()->nextOf()->toBasetype()));
LLValue* sz2 = gIR->ir->CreateMul(DtoConstSize_t(getTypePaddedSize(arrayelemty)), DtoArrayLen(src), "tmp"); LLValue* sz2 = gIR->ir->CreateMul(DtoConstSize_t(getTypePaddedSize(arrayelemty)), DtoArrayLen(src));
copySlice(loc, dstarr, sz1, srcarr, sz2); copySlice(loc, dstarr, sz1, srcarr, sz2);
} }
@ -869,7 +869,7 @@ static LLValue* DtoArrayEqCmp_impl(Loc& loc, const char* func, DValue* l, DValue
args.push_back(DtoBitCast(tival, fn->getFunctionType()->getParamType(2))); args.push_back(DtoBitCast(tival, fn->getFunctionType()->getParamType(2)));
} }
LLCallSite call = gIR->CreateCallOrInvoke(fn, args, "tmp"); LLCallSite call = gIR->CreateCallOrInvoke(fn, args);
return call.getInstruction(); return call.getInstruction();
} }
@ -878,9 +878,9 @@ static LLValue* DtoArrayEqCmp_impl(Loc& loc, const char* func, DValue* l, DValue
LLValue* DtoArrayEquals(Loc& loc, TOK op, DValue* l, DValue* r) LLValue* DtoArrayEquals(Loc& loc, TOK op, DValue* l, DValue* r)
{ {
LLValue* res = DtoArrayEqCmp_impl(loc, _adEq, l, r, true); LLValue* res = DtoArrayEqCmp_impl(loc, _adEq, l, r, true);
res = gIR->ir->CreateICmpNE(res, DtoConstInt(0), "tmp"); res = gIR->ir->CreateICmpNE(res, DtoConstInt(0));
if (op == TOKnotequal) if (op == TOKnotequal)
res = gIR->ir->CreateNot(res, "tmp"); res = gIR->ir->CreateNot(res);
return res; return res;
} }
@ -899,7 +899,7 @@ LLValue* DtoArrayCompare(Loc& loc, TOK op, DValue* l, DValue* r)
res = DtoArrayEqCmp_impl(loc, "_adCmpChar", l, r, false); res = DtoArrayEqCmp_impl(loc, "_adCmpChar", l, r, false);
else else
res = DtoArrayEqCmp_impl(loc, _adCmp, l, r, true); res = DtoArrayEqCmp_impl(loc, _adCmp, l, r, true);
res = gIR->ir->CreateICmp(cmpop, res, DtoConstInt(0), "tmp"); res = gIR->ir->CreateICmp(cmpop, res, DtoConstInt(0));
} }
assert(res); assert(res);
@ -928,7 +928,7 @@ LLValue* DtoArrayCastLength(Loc& loc, LLValue* len, LLType* elemty, LLType* newe
}; };
LLFunction* fn = LLVM_D_GetRuntimeFunction(loc, gIR->module, "_d_array_cast_len"); LLFunction* fn = LLVM_D_GetRuntimeFunction(loc, gIR->module, "_d_array_cast_len");
return gIR->CreateCallOrInvoke(fn, args, "tmp").getInstruction(); return gIR->CreateCallOrInvoke(fn, args).getInstruction();
} }
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
@ -942,15 +942,15 @@ LLValue* DtoDynArrayIs(TOK op, DValue* l, DValue* r)
// compare lengths // compare lengths
len1 = DtoArrayLen(l); len1 = DtoArrayLen(l);
len2 = DtoArrayLen(r); len2 = DtoArrayLen(r);
LLValue* b1 = gIR->ir->CreateICmpEQ(len1,len2,"tmp"); LLValue* b1 = gIR->ir->CreateICmpEQ(len1,len2);
// compare pointers // compare pointers
ptr1 = DtoArrayPtr(l); ptr1 = DtoArrayPtr(l);
ptr2 = DtoArrayPtr(r); ptr2 = DtoArrayPtr(r);
LLValue* b2 = gIR->ir->CreateICmpEQ(ptr1,ptr2,"tmp"); LLValue* b2 = gIR->ir->CreateICmpEQ(ptr1,ptr2);
// combine // combine
LLValue* res = gIR->ir->CreateAnd(b1,b2,"tmp"); LLValue* res = gIR->ir->CreateAnd(b1,b2);
// return result // return result
return (op == TOKnotidentity) ? gIR->ir->CreateNot(res) : res; return (op == TOKnotidentity) ? gIR->ir->CreateNot(res) : res;
@ -1032,7 +1032,7 @@ DValue* DtoCastArray(Loc& loc, DValue* u, Type* to)
IF_LOG Logger::cout() << "to pointer" << '\n'; IF_LOG Logger::cout() << "to pointer" << '\n';
rval = DtoArrayPtr(u); rval = DtoArrayPtr(u);
if (rval->getType() != tolltype) if (rval->getType() != tolltype)
rval = gIR->ir->CreateBitCast(rval, tolltype, "tmp"); rval = gIR->ir->CreateBitCast(rval, tolltype);
} }
else if (totype->ty == Tarray) { else if (totype->ty == Tarray) {
IF_LOG Logger::cout() << "to array" << '\n'; IF_LOG Logger::cout() << "to array" << '\n';
@ -1104,7 +1104,7 @@ DValue* DtoCastArray(Loc& loc, DValue* u, Type* to)
// return (arr.ptr !is null) // return (arr.ptr !is null)
LLValue* ptr = DtoArrayPtr(u); LLValue* ptr = DtoArrayPtr(u);
LLConstant* nul = getNullPtr(ptr->getType()); LLConstant* nul = getNullPtr(ptr->getType());
rval = gIR->ir->CreateICmpNE(ptr, nul, "tmp"); rval = gIR->ir->CreateICmpNE(ptr, nul);
} }
else { else {
rval = DtoArrayPtr(u); rval = DtoArrayPtr(u);

View file

@ -27,9 +27,9 @@ DValue* DtoBinAdd(DValue* lhs, DValue* rhs)
LLValue* res; LLValue* res;
if (t->isfloating()) if (t->isfloating())
res = gIR->ir->CreateFAdd(l, r, "tmp"); res = gIR->ir->CreateFAdd(l, r);
else else
res = gIR->ir->CreateAdd(l, r, "tmp"); res = gIR->ir->CreateAdd(l, r);
return new DImValue( t, res ); return new DImValue( t, res );
} }
@ -45,9 +45,9 @@ DValue* DtoBinSub(DValue* lhs, DValue* rhs)
LLValue* res; LLValue* res;
if (t->isfloating()) if (t->isfloating())
res = gIR->ir->CreateFSub(l, r, "tmp"); res = gIR->ir->CreateFSub(l, r);
else else
res = gIR->ir->CreateSub(l, r, "tmp"); res = gIR->ir->CreateSub(l, r);
return new DImValue( t, res ); return new DImValue( t, res );
} }
@ -63,9 +63,9 @@ DValue* DtoBinMul(Type* targettype, DValue* lhs, DValue* rhs)
LLValue* res; LLValue* res;
if (t->isfloating()) if (t->isfloating())
res = gIR->ir->CreateFMul(l, r, "tmp"); res = gIR->ir->CreateFMul(l, r);
else else
res = gIR->ir->CreateMul(l, r, "tmp"); res = gIR->ir->CreateMul(l, r);
return new DImValue( targettype, res ); return new DImValue( targettype, res );
} }
@ -80,11 +80,11 @@ DValue* DtoBinDiv(Type* targettype, DValue* lhs, DValue* rhs)
LLValue* res; LLValue* res;
if (t->isfloating()) if (t->isfloating())
res = gIR->ir->CreateFDiv(l, r, "tmp"); res = gIR->ir->CreateFDiv(l, r);
else if (!isLLVMUnsigned(t)) else if (!isLLVMUnsigned(t))
res = gIR->ir->CreateSDiv(l, r, "tmp"); res = gIR->ir->CreateSDiv(l, r);
else else
res = gIR->ir->CreateUDiv(l, r, "tmp"); res = gIR->ir->CreateUDiv(l, r);
return new DImValue( targettype, res ); return new DImValue( targettype, res );
} }
@ -98,11 +98,11 @@ DValue* DtoBinRem(Type* targettype, DValue* lhs, DValue* rhs)
r = rhs->getRVal(); r = rhs->getRVal();
LLValue* res; LLValue* res;
if (t->isfloating()) if (t->isfloating())
res = gIR->ir->CreateFRem(l, r, "tmp"); res = gIR->ir->CreateFRem(l, r);
else if (!isLLVMUnsigned(t)) else if (!isLLVMUnsigned(t))
res = gIR->ir->CreateSRem(l, r, "tmp"); res = gIR->ir->CreateSRem(l, r);
else else
res = gIR->ir->CreateURem(l, r, "tmp"); res = gIR->ir->CreateURem(l, r);
return new DImValue( targettype, res ); return new DImValue( targettype, res );
} }
@ -138,9 +138,9 @@ LLValue* DtoBinFloatsEquals(Loc& loc, DValue* lhs, DValue* rhs, TOK op)
{ {
LLValue* res = 0; LLValue* res = 0;
if (op == TOKequal) { if (op == TOKequal) {
res = gIR->ir->CreateFCmpOEQ(lhs->getRVal(), rhs->getRVal(), "tmp"); res = gIR->ir->CreateFCmpOEQ(lhs->getRVal(), rhs->getRVal());
} else if (op == TOKnotequal) { } else if (op == TOKnotequal) {
res = gIR->ir->CreateFCmpUNE(lhs->getRVal(), rhs->getRVal(), "tmp"); res = gIR->ir->CreateFCmpUNE(lhs->getRVal(), rhs->getRVal());
} else { } else {
llvm::ICmpInst::Predicate cmpop; llvm::ICmpInst::Predicate cmpop;
if (op == TOKidentity) if (op == TOKidentity)
@ -150,7 +150,7 @@ LLValue* DtoBinFloatsEquals(Loc& loc, DValue* lhs, DValue* rhs, TOK op)
LLValue* sz = DtoConstSize_t(getTypeStoreSize(DtoType(lhs->getType()))); LLValue* sz = DtoConstSize_t(getTypeStoreSize(DtoType(lhs->getType())));
LLValue* val = DtoMemCmp(makeLValue(loc, lhs), makeLValue(loc, rhs), sz); LLValue* val = DtoMemCmp(makeLValue(loc, lhs), makeLValue(loc, rhs), sz);
res = gIR->ir->CreateICmp(cmpop, val, LLConstantInt::get(val->getType(), 0, false), "tmp"); res = gIR->ir->CreateICmp(cmpop, val, LLConstantInt::get(val->getType(), 0, false));
} }
assert(res); assert(res);
return res; return res;

View file

@ -120,7 +120,7 @@ DValue* DtoNewClass(Loc& loc, TypeClass* tc, NewExp* newexp)
DValue* thisval = toElem(newexp->thisexp); DValue* thisval = toElem(newexp->thisexp);
size_t idx = getIrField(tc->sym->vthis)->index; size_t idx = getIrField(tc->sym->vthis)->index;
LLValue* src = thisval->getRVal(); LLValue* src = thisval->getRVal();
LLValue* dst = DtoGEPi(mem,0,idx,"tmp"); LLValue* dst = DtoGEPi(mem, 0, idx);
IF_LOG Logger::cout() << "dst: " << *dst << "\nsrc: " << *src << '\n'; IF_LOG Logger::cout() << "dst: " << *dst << "\nsrc: " << *src << '\n';
DtoStore(src, DtoBitCast(dst, getPtrToType(src->getType()))); DtoStore(src, DtoBitCast(dst, getPtrToType(src->getType())));
} }
@ -171,12 +171,12 @@ void DtoInitClass(TypeClass* tc, LLValue* dst)
if (dataBytes == 0) if (dataBytes == 0)
return; return;
LLValue* dstarr = DtoGEPi(dst, 0, firstDataIdx, "tmp"); LLValue* dstarr = DtoGEPi(dst, 0, firstDataIdx);
// init symbols might not have valid types // init symbols might not have valid types
LLValue* initsym = getIrAggr(tc->sym)->getInitSymbol(); LLValue* initsym = getIrAggr(tc->sym)->getInitSymbol();
initsym = DtoBitCast(initsym, DtoType(tc)); initsym = DtoBitCast(initsym, DtoType(tc));
LLValue* srcarr = DtoGEPi(initsym, 0, firstDataIdx, "tmp"); LLValue* srcarr = DtoGEPi(initsym, 0, firstDataIdx);
DtoMemCpy(dstarr, srcarr, DtoConstSize_t(dataBytes)); DtoMemCpy(dstarr, srcarr, DtoConstSize_t(dataBytes));
} }
@ -216,7 +216,7 @@ DValue* DtoCastClass(Loc& loc, DValue* val, Type* _to)
IF_LOG Logger::println("to bool"); IF_LOG Logger::println("to bool");
LLValue* llval = val->getRVal(); LLValue* llval = val->getRVal();
LLValue* zero = LLConstant::getNullValue(llval->getType()); LLValue* zero = LLConstant::getNullValue(llval->getType());
return new DImValue(_to, gIR->ir->CreateICmpNE(llval, zero, "tmp")); return new DImValue(_to, gIR->ir->CreateICmpNE(llval, zero));
} }
// class -> integer // class -> integer
else if (to->isintegral()) { else if (to->isintegral()) {
@ -340,7 +340,7 @@ DValue* DtoDynamicCastObject(Loc& loc, DValue* val, Type* _to)
assert(funcTy->getParamType(1) == cinfo->getType()); assert(funcTy->getParamType(1) == cinfo->getType());
// call it // call it
LLValue* ret = gIR->CreateCallOrInvoke2(func, obj, cinfo, "tmp").getInstruction(); LLValue* ret = gIR->CreateCallOrInvoke2(func, obj, cinfo).getInstruction();
// cast return value // cast return value
ret = DtoBitCast(ret, DtoType(_to)); ret = DtoBitCast(ret, DtoType(_to));
@ -363,7 +363,7 @@ DValue* DtoCastInterfaceToObject(Loc& loc, DValue* val, Type* to)
tmp = DtoBitCast(tmp, funcTy->getParamType(0)); tmp = DtoBitCast(tmp, funcTy->getParamType(0));
// call it // call it
LLValue* ret = gIR->CreateCallOrInvoke(func, tmp, "tmp").getInstruction(); LLValue* ret = gIR->CreateCallOrInvoke(func, tmp).getInstruction();
// cast return value // cast return value
if (to != NULL) if (to != NULL)
@ -400,7 +400,7 @@ DValue* DtoDynamicCastInterface(Loc& loc, DValue* val, Type* _to)
cinfo = DtoBitCast(cinfo, funcTy->getParamType(1)); cinfo = DtoBitCast(cinfo, funcTy->getParamType(1));
// call it // call it
LLValue* ret = gIR->CreateCallOrInvoke2(func, ptr, cinfo, "tmp").getInstruction(); LLValue* ret = gIR->CreateCallOrInvoke2(func, ptr, cinfo).getInstruction();
// cast return value // cast return value
ret = DtoBitCast(ret, DtoType(_to)); ret = DtoBitCast(ret, DtoType(_to));
@ -473,7 +473,7 @@ LLValue* DtoVirtualFunctionPointer(DValue* inst, FuncDeclaration* fdecl, char* n
LLValue* funcval = vthis; LLValue* funcval = vthis;
// get the vtbl for objects // get the vtbl for objects
funcval = DtoGEPi(funcval, 0, 0, "tmp"); funcval = DtoGEPi(funcval, 0, 0);
// load vtbl ptr // load vtbl ptr
funcval = DtoLoad(funcval); funcval = DtoLoad(funcval);
// index vtbl // index vtbl

View file

@ -107,8 +107,8 @@ DValue* DtoComplex(Loc& loc, Type* to, DValue* val)
void DtoComplexSet(LLValue* c, LLValue* re, LLValue* im) void DtoComplexSet(LLValue* c, LLValue* re, LLValue* im)
{ {
DtoStore(re, DtoGEPi(c, 0, 0, "tmp")); DtoStore(re, DtoGEPi(c, 0, 0));
DtoStore(im, DtoGEPi(c, 0, 1, "tmp")); DtoStore(im, DtoGEPi(c, 0, 1));
} }
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
@ -192,14 +192,14 @@ DValue* DtoComplexAdd(Loc& loc, Type* type, DValue* lhs, DValue* rhs)
// add up // add up
if(lhs_re && rhs_re) if(lhs_re && rhs_re)
res_re = gIR->ir->CreateFAdd(lhs_re, rhs_re, "tmp"); res_re = gIR->ir->CreateFAdd(lhs_re, rhs_re);
else if(lhs_re) else if(lhs_re)
res_re = lhs_re; res_re = lhs_re;
else // either rhs_re or no re at all (then use any) else // either rhs_re or no re at all (then use any)
res_re = rhs_re; res_re = rhs_re;
if(lhs_im && rhs_im) if(lhs_im && rhs_im)
res_im = gIR->ir->CreateFAdd(lhs_im, rhs_im, "tmp"); res_im = gIR->ir->CreateFAdd(lhs_im, rhs_im);
else if(lhs_im) else if(lhs_im)
res_im = lhs_im; res_im = lhs_im;
else // either rhs_im or no im at all (then use any) else // either rhs_im or no im at all (then use any)
@ -222,14 +222,14 @@ DValue* DtoComplexSub(Loc& loc, Type* type, DValue* lhs, DValue* rhs)
// add up // add up
if(lhs_re && rhs_re) if(lhs_re && rhs_re)
res_re = gIR->ir->CreateFSub(lhs_re, rhs_re, "tmp"); res_re = gIR->ir->CreateFSub(lhs_re, rhs_re);
else if(lhs_re) else if(lhs_re)
res_re = lhs_re; res_re = lhs_re;
else // either rhs_re or no re at all (then use any) else // either rhs_re or no re at all (then use any)
res_re = gIR->ir->CreateFNeg(rhs_re, "neg"); res_re = gIR->ir->CreateFNeg(rhs_re, "neg");
if(lhs_im && rhs_im) if(lhs_im && rhs_im)
res_im = gIR->ir->CreateFSub(lhs_im, rhs_im, "tmp"); res_im = gIR->ir->CreateFSub(lhs_im, rhs_im);
else if(lhs_im) else if(lhs_im)
res_im = lhs_im; res_im = lhs_im;
else // either rhs_im or no im at all (then use any) else // either rhs_im or no im at all (then use any)
@ -373,8 +373,8 @@ DValue* DtoComplexRem(Loc& loc, Type* type, DValue* lhs, DValue* rhs)
assert((rhs_re != 0) ^ (rhs_im != 0)); assert((rhs_re != 0) ^ (rhs_im != 0));
divisor = rhs_re ? rhs_re : rhs_im; divisor = rhs_re ? rhs_re : rhs_im;
res_re = lhs_re ? gIR->ir->CreateFRem(lhs_re, divisor, "tmp") : lhs_re; res_re = lhs_re ? gIR->ir->CreateFRem(lhs_re, divisor) : lhs_re;
res_im = lhs_re ? gIR->ir->CreateFRem(lhs_im, divisor, "tmp") : lhs_im; res_im = lhs_re ? gIR->ir->CreateFRem(lhs_im, divisor) : lhs_im;
LLValue* res = DtoAggrPair(DtoType(type), res_re, res_im); LLValue* res = DtoAggrPair(DtoType(type), res_re, res_im);
return new DImValue(type, res); return new DImValue(type, res);
@ -391,8 +391,8 @@ DValue* DtoComplexNeg(Loc& loc, Type* type, DValue* val)
// neg up // neg up
assert(a && b); assert(a && b);
re = gIR->ir->CreateFNeg(a, "tmp"); re = gIR->ir->CreateFNeg(a);
im = gIR->ir->CreateFNeg(b, "tmp"); im = gIR->ir->CreateFNeg(b);
LLValue* res = DtoAggrPair(DtoType(type), re, im); LLValue* res = DtoAggrPair(DtoType(type), re, im);
return new DImValue(type, res); return new DImValue(type, res);
@ -416,9 +416,9 @@ LLValue* DtoComplexEquals(Loc& loc, TOK op, DValue* lhs, DValue* rhs)
LLValue* b2 = DtoBinFloatsEquals(loc, lhs_im, rhs_im, op); LLValue* b2 = DtoBinFloatsEquals(loc, lhs_im, rhs_im, op);
if (op == TOKequal) if (op == TOKequal)
return gIR->ir->CreateAnd(b1, b2, "tmp"); return gIR->ir->CreateAnd(b1, b2);
else else
return gIR->ir->CreateOr(b1, b2, "tmp"); return gIR->ir->CreateOr(b1, b2);
} }
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
@ -436,12 +436,12 @@ DValue* DtoCastComplex(Loc& loc, DValue* val, Type* _to)
LLType* toty = DtoComplexBaseType(to); LLType* toty = DtoComplexBaseType(to);
if (to->size() < vty->size()) { if (to->size() < vty->size()) {
re = gIR->ir->CreateFPTrunc(re, toty, "tmp"); re = gIR->ir->CreateFPTrunc(re, toty);
im = gIR->ir->CreateFPTrunc(im, toty, "tmp"); im = gIR->ir->CreateFPTrunc(im, toty);
} }
else { else {
re = gIR->ir->CreateFPExt(re, toty, "tmp"); re = gIR->ir->CreateFPExt(re, toty);
im = gIR->ir->CreateFPExt(im, toty, "tmp"); im = gIR->ir->CreateFPExt(im, toty);
} }
LLValue* pair = DtoAggrPair(DtoType(_to), re, im); LLValue* pair = DtoAggrPair(DtoType(_to), re, im);

View file

@ -550,19 +550,19 @@ DValue* DtoCastInt(Loc& loc, DValue* val, Type* _to)
if (to->ty == Tbool) { if (to->ty == Tbool) {
LLValue* zero = LLConstantInt::get(rval->getType(), 0, false); LLValue* zero = LLConstantInt::get(rval->getType(), 0, false);
rval = gIR->ir->CreateICmpNE(rval, zero, "tmp"); rval = gIR->ir->CreateICmpNE(rval, zero);
} }
else if (to->isintegral()) { else if (to->isintegral()) {
if (fromsz < tosz || from->ty == Tbool) { if (fromsz < tosz || from->ty == Tbool) {
IF_LOG Logger::cout() << "cast to: " << *tolltype << '\n'; IF_LOG Logger::cout() << "cast to: " << *tolltype << '\n';
if (isLLVMUnsigned(from) || from->ty == Tbool) { if (isLLVMUnsigned(from) || from->ty == Tbool) {
rval = new llvm::ZExtInst(rval, tolltype, "tmp", gIR->scopebb()); rval = new llvm::ZExtInst(rval, tolltype, "", gIR->scopebb());
} else { } else {
rval = new llvm::SExtInst(rval, tolltype, "tmp", gIR->scopebb()); rval = new llvm::SExtInst(rval, tolltype, "", gIR->scopebb());
} }
} }
else if (fromsz > tosz) { else if (fromsz > tosz) {
rval = new llvm::TruncInst(rval, tolltype, "tmp", gIR->scopebb()); rval = new llvm::TruncInst(rval, tolltype, "", gIR->scopebb());
} }
else { else {
rval = DtoBitCast(rval, tolltype); rval = DtoBitCast(rval, tolltype);
@ -573,15 +573,15 @@ DValue* DtoCastInt(Loc& loc, DValue* val, Type* _to)
} }
else if (to->isfloating()) { else if (to->isfloating()) {
if (from->isunsigned()) { if (from->isunsigned()) {
rval = new llvm::UIToFPInst(rval, tolltype, "tmp", gIR->scopebb()); rval = new llvm::UIToFPInst(rval, tolltype, "", gIR->scopebb());
} }
else { else {
rval = new llvm::SIToFPInst(rval, tolltype, "tmp", gIR->scopebb()); rval = new llvm::SIToFPInst(rval, tolltype, "", gIR->scopebb());
} }
} }
else if (to->ty == Tpointer) { else if (to->ty == Tpointer) {
IF_LOG Logger::cout() << "cast pointer: " << *tolltype << '\n'; IF_LOG Logger::cout() << "cast pointer: " << *tolltype << '\n';
rval = gIR->ir->CreateIntToPtr(rval, tolltype, "tmp"); rval = gIR->ir->CreateIntToPtr(rval, tolltype);
} }
else { else {
error(loc, "invalid cast from '%s' to '%s'", val->getType()->toChars(), _to->toChars()); error(loc, "invalid cast from '%s' to '%s'", val->getType()->toChars(), _to->toChars());
@ -612,10 +612,10 @@ DValue* DtoCastPtr(Loc& loc, DValue* val, Type* to)
else if (totype->ty == Tbool) { else if (totype->ty == Tbool) {
LLValue* src = val->getRVal(); LLValue* src = val->getRVal();
LLValue* zero = LLConstant::getNullValue(src->getType()); LLValue* zero = LLConstant::getNullValue(src->getType());
rval = gIR->ir->CreateICmpNE(src, zero, "tmp"); rval = gIR->ir->CreateICmpNE(src, zero);
} }
else if (totype->isintegral()) { else if (totype->isintegral()) {
rval = new llvm::PtrToIntInst(val->getRVal(), tolltype, "tmp", gIR->scopebb()); rval = new llvm::PtrToIntInst(val->getRVal(), tolltype, "", gIR->scopebb());
} }
else { else {
error(loc, "invalid cast from '%s' to '%s'", val->getType()->toChars(), to->toChars()); error(loc, "invalid cast from '%s' to '%s'", val->getType()->toChars(), to->toChars());
@ -644,7 +644,7 @@ DValue* DtoCastFloat(Loc& loc, DValue* val, Type* to)
if (totype->ty == Tbool) { if (totype->ty == Tbool) {
rval = val->getRVal(); rval = val->getRVal();
LLValue* zero = LLConstant::getNullValue(rval->getType()); LLValue* zero = LLConstant::getNullValue(rval->getType());
rval = gIR->ir->CreateFCmpUNE(rval, zero, "tmp"); rval = gIR->ir->CreateFCmpUNE(rval, zero);
} }
else if (totype->iscomplex()) { else if (totype->iscomplex()) {
return DtoComplex(loc, to, val); return DtoComplex(loc, to, val);
@ -655,10 +655,10 @@ DValue* DtoCastFloat(Loc& loc, DValue* val, Type* to)
assert(rval->getType() == tolltype); assert(rval->getType() == tolltype);
} }
else if (fromsz < tosz) { else if (fromsz < tosz) {
rval = new llvm::FPExtInst(val->getRVal(), tolltype, "tmp", gIR->scopebb()); rval = new llvm::FPExtInst(val->getRVal(), tolltype, "", gIR->scopebb());
} }
else if (fromsz > tosz) { else if (fromsz > tosz) {
rval = new llvm::FPTruncInst(val->getRVal(), tolltype, "tmp", gIR->scopebb()); rval = new llvm::FPTruncInst(val->getRVal(), tolltype, "", gIR->scopebb());
} }
else { else {
error(loc, "invalid cast from '%s' to '%s'", val->getType()->toChars(), to->toChars()); error(loc, "invalid cast from '%s' to '%s'", val->getType()->toChars(), to->toChars());
@ -667,10 +667,10 @@ DValue* DtoCastFloat(Loc& loc, DValue* val, Type* to)
} }
else if (totype->isintegral()) { else if (totype->isintegral()) {
if (totype->isunsigned()) { if (totype->isunsigned()) {
rval = new llvm::FPToUIInst(val->getRVal(), tolltype, "tmp", gIR->scopebb()); rval = new llvm::FPToUIInst(val->getRVal(), tolltype, "", gIR->scopebb());
} }
else { else {
rval = new llvm::FPToSIInst(val->getRVal(), tolltype, "tmp", gIR->scopebb()); rval = new llvm::FPToSIInst(val->getRVal(), tolltype, "", gIR->scopebb());
} }
} }
else { else {
@ -841,7 +841,7 @@ DValue* DtoPaintType(Loc& loc, DValue* val, Type* to)
len = DtoArrayLen(val); len = DtoArrayLen(val);
ptr = DtoArrayPtr(val); ptr = DtoArrayPtr(val);
ptr = DtoBitCast(ptr, DtoType(elem)); ptr = DtoBitCast(ptr, DtoType(elem));
return new DImValue(to, DtoAggrPair(len, ptr, "tmp")); return new DImValue(to, DtoAggrPair(len, ptr));
} }
} }
else if (from->ty == Tdelegate) else if (from->ty == Tdelegate)
@ -862,7 +862,7 @@ DValue* DtoPaintType(Loc& loc, DValue* val, Type* to)
LLValue* context = gIR->ir->CreateExtractValue(dg, 0, ".context"); LLValue* context = gIR->ir->CreateExtractValue(dg, 0, ".context");
LLValue* funcptr = gIR->ir->CreateExtractValue(dg, 1, ".funcptr"); LLValue* funcptr = gIR->ir->CreateExtractValue(dg, 1, ".funcptr");
funcptr = DtoBitCast(funcptr, DtoType(dgty)->getContainedType(1)); funcptr = DtoBitCast(funcptr, DtoType(dgty)->getContainedType(1));
LLValue* aggr = DtoAggrPair(context, funcptr, "tmp"); LLValue* aggr = DtoAggrPair(context, funcptr);
IF_LOG Logger::cout() << "dg: " << *aggr << '\n'; IF_LOG Logger::cout() << "dg: " << *aggr << '\n';
return new DImValue(to, aggr); return new DImValue(to, aggr);
} }
@ -1746,7 +1746,7 @@ DValue* DtoSymbolAddress(Loc& loc, Type* type, Declaration* decl)
LLType* vartype = DtoType(type); LLType* vartype = DtoType(type);
LLValue* m = getIrValue(tid); LLValue* m = getIrValue(tid);
if (m->getType() != getPtrToType(vartype)) if (m->getType() != getPtrToType(vartype))
m = gIR->ir->CreateBitCast(m, vartype, "tmp"); m = gIR->ir->CreateBitCast(m, vartype);
return new DImValue(type, m); return new DImValue(type, m);
} }
// nested variable // nested variable

View file

@ -97,7 +97,7 @@ static LLValue* call_string_switch_runtime(llvm::Value* table, Expression* e)
LLValue* llval = val->getRVal(); LLValue* llval = val->getRVal();
assert(llval->getType() == fn->getFunctionType()->getParamType(1)); assert(llval->getType() == fn->getFunctionType()->getParamType(1));
LLCallSite call = gIR->CreateCallOrInvoke2(fn, table, llval, "tmp"); LLCallSite call = gIR->CreateCallOrInvoke2(fn, table, llval);
return call.getInstruction(); return call.getInstruction();
} }
@ -449,7 +449,7 @@ public:
if (irs->topfunc() == irs->mainFunc) if (irs->topfunc() == irs->mainFunc)
v = LLConstant::getNullValue(irs->mainFunc->getReturnType()); v = LLConstant::getNullValue(irs->mainFunc->getReturnType());
else else
v = gIR->ir->CreateBitCast(v, irs->topfunc()->getReturnType(), "tmp"); v = gIR->ir->CreateBitCast(v, irs->topfunc()->getReturnType());
IF_LOG Logger::cout() << "return value after cast: " << *v << '\n'; IF_LOG Logger::cout() << "return value after cast: " << *v << '\n';
} }
@ -1457,11 +1457,11 @@ public:
LLValue* done = 0; LLValue* done = 0;
LLValue* load = DtoLoad(keyvar); LLValue* load = DtoLoad(keyvar);
if (stmt->op == TOKforeach) { if (stmt->op == TOKforeach) {
done = irs->ir->CreateICmpULT(load, niters, "tmp"); done = irs->ir->CreateICmpULT(load, niters);
} }
else if (stmt->op == TOKforeach_reverse) { else if (stmt->op == TOKforeach_reverse) {
done = irs->ir->CreateICmpUGT(load, zerokey, "tmp"); done = irs->ir->CreateICmpUGT(load, zerokey);
load = irs->ir->CreateSub(load, LLConstantInt::get(keytype, 1, false), "tmp"); load = irs->ir->CreateSub(load, LLConstantInt::get(keytype, 1, false));
DtoStore(load, keyvar); DtoStore(load, keyvar);
} }
llvm::BranchInst::Create(bodybb, endbb, done, irs->scopebb()); llvm::BranchInst::Create(bodybb, endbb, done, irs->scopebb());
@ -1470,7 +1470,7 @@ public:
irs->scope() = IRScope(bodybb, nextbb); irs->scope() = IRScope(bodybb, nextbb);
// get value for this iteration // get value for this iteration
LLValue* loadedKey = irs->ir->CreateLoad(keyvar, "tmp"); LLValue* loadedKey = irs->ir->CreateLoad(keyvar);
LLValue* gep = DtoGEP1(val, loadedKey); LLValue* gep = DtoGEP1(val, loadedKey);
if (!stmt->value->isRef() && !stmt->value->isOut()) { if (!stmt->value->isRef() && !stmt->value->isOut()) {
@ -1497,7 +1497,7 @@ public:
irs->scope() = IRScope(nextbb, endbb); irs->scope() = IRScope(nextbb, endbb);
if (stmt->op == TOKforeach) { if (stmt->op == TOKforeach) {
LLValue* load = DtoLoad(keyvar); LLValue* load = DtoLoad(keyvar);
load = irs->ir->CreateAdd(load, LLConstantInt::get(keytype, 1, false), "tmp"); load = irs->ir->CreateAdd(load, LLConstantInt::get(keytype, 1, false));
DtoStore(load, keyvar); DtoStore(load, keyvar);
} }
llvm::BranchInst::Create(condbb, irs->scopebb()); llvm::BranchInst::Create(condbb, irs->scopebb());

View file

@ -85,7 +85,7 @@ LLValue* DtoStructEquals(TOK op, DValue* lhs, DValue* rhs)
// call memcmp // call memcmp
size_t sz = getTypePaddedSize(DtoType(t)); size_t sz = getTypePaddedSize(DtoType(t));
LLValue* val = DtoMemCmp(lhs->getRVal(), rhs->getRVal(), DtoConstSize_t(sz)); LLValue* val = DtoMemCmp(lhs->getRVal(), rhs->getRVal(), DtoConstSize_t(sz));
return gIR->ir->CreateICmp(cmpop, val, LLConstantInt::get(val->getType(), 0, false), "tmp"); return gIR->ir->CreateICmp(cmpop, val, LLConstantInt::get(val->getType(), 0, false));
} }
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////

View file

@ -88,7 +88,7 @@ DValue* DtoVaArg(Loc& loc, Type* type, Expression* valistArg)
) )
warning(loc, "va_arg for C variadic functions is probably broken for anything but x86 and ppc64"); warning(loc, "va_arg for C variadic functions is probably broken for anything but x86 and ppc64");
// done // done
return new DImValue(type, gIR->ir->CreateVAArg(expelem->getLVal(), llt, "tmp")); return new DImValue(type, gIR->ir->CreateVAArg(expelem->getLVal(), llt));
} }
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
@ -308,7 +308,7 @@ void DtoBuildDVarArgList(std::vector<LLValue*>& args,
} }
++argidx; ++argidx;
args.push_back(gIR->ir->CreateBitCast(mem, getPtrToType(LLType::getInt8Ty(gIR->context())), "tmp")); args.push_back(gIR->ir->CreateBitCast(mem, getPtrToType(LLType::getInt8Ty(gIR->context()))));
if (HAS_ATTRIBUTES(irFty.arg_argptr->attrs)) { if (HAS_ATTRIBUTES(irFty.arg_argptr->attrs)) {
addToAttributes(attrs, argidx, irFty.arg_argptr->attrs); addToAttributes(attrs, argidx, irFty.arg_argptr->attrs);
} }

View file

@ -659,7 +659,7 @@ public:
{ {
if (negateOffset) noStrideInc = p->ir->CreateNeg(noStrideInc); if (negateOffset) noStrideInc = p->ir->CreateNeg(noStrideInc);
return new DImValue(base->type, return new DImValue(base->type,
DtoGEP1(base->getRVal(), noStrideInc, 0, p->scopebb())); DtoGEP1(base->getRVal(), noStrideInc, "", p->scopebb()));
} }
// This might not actually be generated by the frontend, just to be // This might not actually be generated by the frontend, just to be
@ -714,11 +714,11 @@ public:
LLValue* lv = l->getRVal(); LLValue* lv = l->getRVal();
LLValue* rv = toElem(e->e2)->getRVal(); LLValue* rv = toElem(e->e2)->getRVal();
IF_LOG Logger::cout() << "lv: " << *lv << " rv: " << *rv << '\n'; IF_LOG Logger::cout() << "lv: " << *lv << " rv: " << *rv << '\n';
lv = p->ir->CreatePtrToInt(lv, DtoSize_t(), "tmp"); lv = p->ir->CreatePtrToInt(lv, DtoSize_t());
rv = p->ir->CreatePtrToInt(rv, DtoSize_t(), "tmp"); rv = p->ir->CreatePtrToInt(rv, DtoSize_t());
LLValue* diff = p->ir->CreateSub(lv,rv,"tmp"); LLValue* diff = p->ir->CreateSub(lv,rv);
if (diff->getType() != DtoType(e->type)) if (diff->getType() != DtoType(e->type))
diff = p->ir->CreateIntToPtr(diff, DtoType(e->type), "tmp"); diff = p->ir->CreateIntToPtr(diff, DtoType(e->type));
result = new DImValue(e->type, diff); result = new DImValue(e->type, diff);
} }
else if (t1->ty == Tpointer && t2->isintegral()) else if (t1->ty == Tpointer && t2->isintegral())
@ -925,7 +925,7 @@ public:
fatal(); fatal();
} }
llvm::StoreInst* ret = gIR->ir->CreateStore(val, ptr, "tmp"); llvm::StoreInst* ret = gIR->ir->CreateStore(val, ptr);
ret->setAtomic(llvm::AtomicOrdering(atomicOrdering)); ret->setAtomic(llvm::AtomicOrdering(atomicOrdering));
ret->setAlignment(getTypeAllocSize(val->getType())); ret->setAlignment(getTypeAllocSize(val->getType()));
return; return;
@ -948,7 +948,7 @@ public:
fatal(); fatal();
} }
llvm::LoadInst* val = gIR->ir->CreateLoad(ptr, "tmp"); llvm::LoadInst* val = gIR->ir->CreateLoad(ptr);
val->setAlignment(getTypeAllocSize(val->getType())); val->setAlignment(getTypeAllocSize(val->getType()));
val->setAtomic(llvm::AtomicOrdering(atomicOrdering)); val->setAtomic(llvm::AtomicOrdering(atomicOrdering));
result = new DImValue(retType, val); result = new DImValue(retType, val);
@ -1523,7 +1523,7 @@ public:
eptr = DtoGEP1(eptr, vlo); eptr = DtoGEP1(eptr, vlo);
// adjust length // adjust length
elen = p->ir->CreateSub(vup, vlo, "tmp"); elen = p->ir->CreateSub(vup, vlo);
} }
// no bounds or full slice -> just convert to slice // no bounds or full slice -> just convert to slice
else else
@ -1584,7 +1584,7 @@ public:
} }
if (a->getType() != b->getType()) if (a->getType() != b->getType())
b = DtoBitCast(b, a->getType()); b = DtoBitCast(b, a->getType());
eval = p->ir->CreateICmp(icmpPred, a, b, "tmp"); eval = p->ir->CreateICmp(icmpPred, a, b);
} }
} }
else if (t->isfloating()) else if (t->isfloating())
@ -1620,7 +1620,7 @@ public:
default: default:
llvm_unreachable("Unsupported floating point comparison operator."); llvm_unreachable("Unsupported floating point comparison operator.");
} }
eval = p->ir->CreateFCmp(cmpop, l->getRVal(), r->getRVal(), "tmp"); eval = p->ir->CreateFCmp(cmpop, l->getRVal(), r->getRVal());
} }
else if (t->ty == Tsarray || t->ty == Tarray) else if (t->ty == Tsarray || t->ty == Tarray)
{ {
@ -1723,7 +1723,7 @@ public:
Logger::cout() << "lv: " << *lv << '\n'; Logger::cout() << "lv: " << *lv << '\n';
Logger::cout() << "rv: " << *rv << '\n'; Logger::cout() << "rv: " << *rv << '\n';
} }
eval = p->ir->CreateICmp(cmpop, lv, rv, "tmp"); eval = p->ir->CreateICmp(cmpop, lv, rv);
} }
else if (t->isfloating()) // includes iscomplex else if (t->isfloating()) // includes iscomplex
{ {
@ -1779,10 +1779,10 @@ public:
assert(e2type->isintegral()); assert(e2type->isintegral());
LLValue* one = LLConstantInt::get(val->getType(), 1, !e2type->isunsigned()); LLValue* one = LLConstantInt::get(val->getType(), 1, !e2type->isunsigned());
if (e->op == TOKplusplus) { if (e->op == TOKplusplus) {
post = llvm::BinaryOperator::CreateAdd(val, one, "tmp", p->scopebb()); post = llvm::BinaryOperator::CreateAdd(val, one, "", p->scopebb());
} }
else if (e->op == TOKminusminus) { else if (e->op == TOKminusminus) {
post = llvm::BinaryOperator::CreateSub(val, one, "tmp", p->scopebb()); post = llvm::BinaryOperator::CreateSub(val, one, "", p->scopebb());
} }
} }
else if (e1type->ty == Tpointer) else if (e1type->ty == Tpointer)
@ -1791,17 +1791,17 @@ public:
LLConstant* minusone = LLConstantInt::get(DtoSize_t(), static_cast<uint64_t>(-1), true); LLConstant* minusone = LLConstantInt::get(DtoSize_t(), static_cast<uint64_t>(-1), true);
LLConstant* plusone = LLConstantInt::get(DtoSize_t(), static_cast<uint64_t>(1), false); LLConstant* plusone = LLConstantInt::get(DtoSize_t(), static_cast<uint64_t>(1), false);
LLConstant* whichone = (e->op == TOKplusplus) ? plusone : minusone; LLConstant* whichone = (e->op == TOKplusplus) ? plusone : minusone;
post = llvm::GetElementPtrInst::Create(val, whichone, "tmp", p->scopebb()); post = llvm::GetElementPtrInst::Create(val, whichone, "", p->scopebb());
} }
else if (e1type->isfloating()) else if (e1type->isfloating())
{ {
assert(e2type->isfloating()); assert(e2type->isfloating());
LLValue* one = DtoConstFP(e1type, ldouble(1.0)); LLValue* one = DtoConstFP(e1type, ldouble(1.0));
if (e->op == TOKplusplus) { if (e->op == TOKplusplus) {
post = llvm::BinaryOperator::CreateFAdd(val,one,"tmp",p->scopebb()); post = llvm::BinaryOperator::CreateFAdd(val,one, "", p->scopebb());
} }
else if (e->op == TOKminusminus) { else if (e->op == TOKminusminus) {
post = llvm::BinaryOperator::CreateFSub(val,one,"tmp",p->scopebb()); post = llvm::BinaryOperator::CreateFSub(val,one, "", p->scopebb());
} }
} }
else else
@ -2207,7 +2207,7 @@ public:
DValue* v = toElem(e->e2); \ DValue* v = toElem(e->e2); \
errorOnIllegalArrayOp(e, e->e1, e->e2); \ errorOnIllegalArrayOp(e, e->e1, e->e2); \
v = DtoCast(e->loc, v, e->e1->type); \ v = DtoCast(e->loc, v, e->e1->type); \
LLValue* x = llvm::BinaryOperator::Create(llvm::Instruction::Y, u->getRVal(), v->getRVal(), "tmp", p->scopebb()); \ LLValue* x = llvm::BinaryOperator::Create(llvm::Instruction::Y, u->getRVal(), v->getRVal(), "", p->scopebb()); \
result = new DImValue(e->type, x); \ result = new DImValue(e->type, x); \
} }
@ -2226,9 +2226,9 @@ public:
v = DtoCast(e->loc, v, e->e1->type); v = DtoCast(e->loc, v, e->e1->type);
LLValue* x; LLValue* x;
if (isLLVMUnsigned(e->e1->type)) if (isLLVMUnsigned(e->e1->type))
x = p->ir->CreateLShr(u->getRVal(), v->getRVal(), "tmp"); x = p->ir->CreateLShr(u->getRVal(), v->getRVal());
else else
x = p->ir->CreateAShr(u->getRVal(), v->getRVal(), "tmp"); x = p->ir->CreateAShr(u->getRVal(), v->getRVal());
result = new DImValue(e->type, x); result = new DImValue(e->type, x);
} }
@ -2375,14 +2375,14 @@ public:
rv = DtoBitCast(rv, lv->getType()); rv = DtoBitCast(rv, lv->getType());
} }
eval = (e->op == TOKidentity) eval = (e->op == TOKidentity)
? p->ir->CreateICmpEQ(lv, rv, "tmp") ? p->ir->CreateICmpEQ(lv, rv)
: p->ir->CreateICmpNE(lv, rv, "tmp"); : p->ir->CreateICmpNE(lv, rv);
} }
else { else {
assert(lv->getType() == rv->getType()); assert(lv->getType() == rv->getType());
eval = (e->op == TOKidentity) eval = (e->op == TOKidentity)
? p->ir->CreateICmpEQ(lv, rv, "tmp") ? p->ir->CreateICmpEQ(lv, rv)
: p->ir->CreateICmpNE(lv, rv, "tmp"); : p->ir->CreateICmpNE(lv, rv);
} }
result = new DImValue(e->type, eval); result = new DImValue(e->type, eval);
} }
@ -2461,7 +2461,7 @@ public:
LLValue* value = u->getRVal(); LLValue* value = u->getRVal();
LLValue* minusone = LLConstantInt::get(value->getType(), static_cast<uint64_t>(-1), true); LLValue* minusone = LLConstantInt::get(value->getType(), static_cast<uint64_t>(-1), true);
value = llvm::BinaryOperator::Create(llvm::Instruction::Xor, value, minusone, "tmp", p->scopebb()); value = llvm::BinaryOperator::Create(llvm::Instruction::Xor, value, minusone, "", p->scopebb());
result = new DImValue(e->type, value); result = new DImValue(e->type, value);
} }

View file

@ -293,16 +293,16 @@ LLValue* DtoDelegateEquals(TOK op, LLValue* lhs, LLValue* rhs)
LLValue* l = gIR->ir->CreateExtractValue(lhs, 0); LLValue* l = gIR->ir->CreateExtractValue(lhs, 0);
LLValue* r = gIR->ir->CreateExtractValue(rhs, 0); LLValue* r = gIR->ir->CreateExtractValue(rhs, 0);
b1 = gIR->ir->CreateICmp(llvm::ICmpInst::ICMP_EQ,l,r,"tmp"); b1 = gIR->ir->CreateICmp(llvm::ICmpInst::ICMP_EQ,l,r);
l = gIR->ir->CreateExtractValue(lhs, 1); l = gIR->ir->CreateExtractValue(lhs, 1);
r = gIR->ir->CreateExtractValue(rhs, 1); r = gIR->ir->CreateExtractValue(rhs, 1);
b2 = gIR->ir->CreateICmp(llvm::ICmpInst::ICMP_EQ,l,r,"tmp"); b2 = gIR->ir->CreateICmp(llvm::ICmpInst::ICMP_EQ,l,r);
LLValue* b = gIR->ir->CreateAnd(b1,b2,"tmp"); LLValue* b = gIR->ir->CreateAnd(b1,b2);
if (op == TOKnotequal || op == TOKnotidentity) if (op == TOKnotequal || op == TOKnotidentity)
return gIR->ir->CreateNot(b,"tmp"); return gIR->ir->CreateNot(b);
return b; return b;
} }
@ -500,7 +500,7 @@ LLIntegerType* DtoSize_t()
LLValue* DtoGEP1(LLValue* ptr, LLValue* i0, const char* var, llvm::BasicBlock* bb) LLValue* DtoGEP1(LLValue* ptr, LLValue* i0, const char* var, llvm::BasicBlock* bb)
{ {
return llvm::GetElementPtrInst::Create(ptr, i0, var?var:"tmp", bb?bb:gIR->scopebb()); return llvm::GetElementPtrInst::Create(ptr, i0, var, bb ? bb : gIR->scopebb());
} }
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
@ -508,14 +508,14 @@ LLValue* DtoGEP1(LLValue* ptr, LLValue* i0, const char* var, llvm::BasicBlock* b
LLValue* DtoGEP(LLValue* ptr, LLValue* i0, LLValue* i1, const char* var, llvm::BasicBlock* bb) LLValue* DtoGEP(LLValue* ptr, LLValue* i0, LLValue* i1, const char* var, llvm::BasicBlock* bb)
{ {
LLValue* v[] = { i0, i1 }; LLValue* v[] = { i0, i1 };
return llvm::GetElementPtrInst::Create(ptr, v, var?var:"tmp", bb?bb:gIR->scopebb()); return llvm::GetElementPtrInst::Create(ptr, v, var, bb ? bb : gIR->scopebb());
} }
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
LLValue* DtoGEPi1(LLValue* ptr, unsigned i, const char* var, llvm::BasicBlock* bb) LLValue* DtoGEPi1(LLValue* ptr, unsigned i, const char* var, llvm::BasicBlock* bb)
{ {
return llvm::GetElementPtrInst::Create(ptr, DtoConstUint(i), var?var:"tmp", bb?bb:gIR->scopebb()); return llvm::GetElementPtrInst::Create(ptr, DtoConstUint(i), var, bb ? bb : gIR->scopebb());
} }
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
@ -523,7 +523,7 @@ LLValue* DtoGEPi1(LLValue* ptr, unsigned i, const char* var, llvm::BasicBlock* b
LLValue* DtoGEPi(LLValue* ptr, unsigned i0, unsigned i1, const char* var, llvm::BasicBlock* bb) LLValue* DtoGEPi(LLValue* ptr, unsigned i0, unsigned i1, const char* var, llvm::BasicBlock* bb)
{ {
LLValue* v[] = { DtoConstUint(i0), DtoConstUint(i1) }; LLValue* v[] = { DtoConstUint(i0), DtoConstUint(i1) };
return llvm::GetElementPtrInst::Create(ptr, v, var?var:"tmp", bb?bb:gIR->scopebb()); return llvm::GetElementPtrInst::Create(ptr, v, var, bb ? bb : gIR->scopebb());
} }
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
@ -583,7 +583,7 @@ LLValue* DtoMemCmp(LLValue* lhs, LLValue* rhs, LLValue* nbytes)
lhs = DtoBitCast(lhs, VoidPtrTy); lhs = DtoBitCast(lhs, VoidPtrTy);
rhs = DtoBitCast(rhs, VoidPtrTy); rhs = DtoBitCast(rhs, VoidPtrTy);
return gIR->ir->CreateCall3(fn, lhs, rhs, nbytes, "tmp"); return gIR->ir->CreateCall3(fn, lhs, rhs, nbytes);
} }
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
@ -678,7 +678,7 @@ LLValue* DtoLoad(LLValue* src, const char* name)
{ {
// if (Logger::enabled()) // if (Logger::enabled())
// Logger::cout() << "loading " << *src << '\n'; // Logger::cout() << "loading " << *src << '\n';
llvm::LoadInst* ld = gIR->ir->CreateLoad(src, name ? name : "tmp"); llvm::LoadInst* ld = gIR->ir->CreateLoad(src, name);
//ld->setVolatile(gIR->func()->inVolatile); //ld->setVolatile(gIR->func()->inVolatile);
return ld; return ld;
} }
@ -686,7 +686,7 @@ LLValue* DtoLoad(LLValue* src, const char* name)
// Like DtoLoad, but the pointer is guaranteed to be aligned appropriately for the type. // Like DtoLoad, but the pointer is guaranteed to be aligned appropriately for the type.
LLValue* DtoAlignedLoad(LLValue* src, const char* name) LLValue* DtoAlignedLoad(LLValue* src, const char* name)
{ {
llvm::LoadInst* ld = gIR->ir->CreateLoad(src, name ? name : "tmp"); llvm::LoadInst* ld = gIR->ir->CreateLoad(src, name);
ld->setAlignment(getABITypeAlign(ld->getType())); ld->setAlignment(getABITypeAlign(ld->getType()));
return ld; return ld;
} }
@ -726,7 +726,7 @@ LLValue* DtoBitCast(LLValue* v, LLType* t, const char* name)
if (v->getType() == t) if (v->getType() == t)
return v; return v;
assert(!isaStruct(t)); assert(!isaStruct(t));
return gIR->ir->CreateBitCast(v, t, name ? name : "tmp"); return gIR->ir->CreateBitCast(v, t, name);
} }
LLConstant* DtoBitCast(LLConstant* v, LLType* t) LLConstant* DtoBitCast(LLConstant* v, LLType* t)
@ -740,24 +740,24 @@ LLConstant* DtoBitCast(LLConstant* v, LLType* t)
LLValue* DtoInsertValue(LLValue* aggr, LLValue* v, unsigned idx, const char* name) LLValue* DtoInsertValue(LLValue* aggr, LLValue* v, unsigned idx, const char* name)
{ {
return gIR->ir->CreateInsertValue(aggr, v, idx, name ? name : "tmp"); return gIR->ir->CreateInsertValue(aggr, v, idx, name);
} }
LLValue* DtoExtractValue(LLValue* aggr, unsigned idx, const char* name) LLValue* DtoExtractValue(LLValue* aggr, unsigned idx, const char* name)
{ {
return gIR->ir->CreateExtractValue(aggr, idx, name ? name : "tmp"); return gIR->ir->CreateExtractValue(aggr, idx, name);
} }
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
LLValue* DtoInsertElement(LLValue* vec, LLValue* v, LLValue *idx, const char* name) LLValue* DtoInsertElement(LLValue* vec, LLValue* v, LLValue *idx, const char* name)
{ {
return gIR->ir->CreateInsertElement(vec, v, idx, name ? name : "tmp"); return gIR->ir->CreateInsertElement(vec, v, idx, name);
} }
LLValue* DtoExtractElement(LLValue* vec, LLValue *idx, const char* name) LLValue* DtoExtractElement(LLValue* vec, LLValue *idx, const char* name)
{ {
return gIR->ir->CreateExtractElement(vec, idx, name ? name : "tmp"); return gIR->ir->CreateExtractElement(vec, idx, name);
} }
LLValue* DtoInsertElement(LLValue* vec, LLValue* v, unsigned idx, const char* name) LLValue* DtoInsertElement(LLValue* vec, LLValue* v, unsigned idx, const char* name)
@ -1013,8 +1013,8 @@ LLStructType* DtoModuleReferenceType()
LLValue* DtoAggrPair(LLType* type, LLValue* V1, LLValue* V2, const char* name) LLValue* DtoAggrPair(LLType* type, LLValue* V1, LLValue* V2, const char* name)
{ {
LLValue* res = llvm::UndefValue::get(type); LLValue* res = llvm::UndefValue::get(type);
res = gIR->ir->CreateInsertValue(res, V1, 0, "tmp"); res = gIR->ir->CreateInsertValue(res, V1, 0);
return gIR->ir->CreateInsertValue(res, V2, 1, name?name:"tmp"); return gIR->ir->CreateInsertValue(res, V2, 1, name);
} }
LLValue* DtoAggrPair(LLValue* V1, LLValue* V2, const char* name) LLValue* DtoAggrPair(LLValue* V1, LLValue* V2, const char* name)
@ -1031,13 +1031,13 @@ LLValue* DtoAggrPaint(LLValue* aggr, LLType* as)
LLValue* res = llvm::UndefValue::get(as); LLValue* res = llvm::UndefValue::get(as);
LLValue* V = gIR->ir->CreateExtractValue(aggr, 0, "tmp");; LLValue* V = gIR->ir->CreateExtractValue(aggr, 0);
V = DtoBitCast(V, as->getContainedType(0)); V = DtoBitCast(V, as->getContainedType(0));
res = gIR->ir->CreateInsertValue(res, V, 0, "tmp"); res = gIR->ir->CreateInsertValue(res, V, 0);
V = gIR->ir->CreateExtractValue(aggr, 1, "tmp");; V = gIR->ir->CreateExtractValue(aggr, 1);
V = DtoBitCast(V, as->getContainedType(1)); V = DtoBitCast(V, as->getContainedType(1));
return gIR->ir->CreateInsertValue(res, V, 1, "tmp"); return gIR->ir->CreateInsertValue(res, V, 1);
} }
LLValue* DtoAggrPairSwap(LLValue* aggr) LLValue* DtoAggrPairSwap(LLValue* aggr)

View file

@ -71,11 +71,11 @@ LLStructType* DtoMutexType();
LLStructType* DtoModuleReferenceType(); LLStructType* DtoModuleReferenceType();
// getelementptr helpers // getelementptr helpers
LLValue* DtoGEP1(LLValue* ptr, LLValue* i0, const char* var=0, llvm::BasicBlock* bb=NULL); LLValue* DtoGEP1(LLValue* ptr, LLValue* i0, const char* name = "", llvm::BasicBlock* bb = NULL);
LLValue* DtoGEP(LLValue* ptr, LLValue* i0, LLValue* i1, const char* var=0, llvm::BasicBlock* bb=NULL); LLValue* DtoGEP(LLValue* ptr, LLValue* i0, LLValue* i1, const char* name = "", llvm::BasicBlock* bb = NULL);
LLValue* DtoGEPi1(LLValue* ptr, unsigned i0, const char* var=0, llvm::BasicBlock* bb=NULL); LLValue* DtoGEPi1(LLValue* ptr, unsigned i0, const char* name = "", llvm::BasicBlock* bb = NULL);
LLValue* DtoGEPi(LLValue* ptr, unsigned i0, unsigned i1, const char* var=0, llvm::BasicBlock* bb=NULL); LLValue* DtoGEPi(LLValue* ptr, unsigned i0, unsigned i1, const char* name = "", llvm::BasicBlock* bb = NULL);
LLConstant* DtoGEPi(LLConstant* ptr, unsigned i0, unsigned i1); LLConstant* DtoGEPi(LLConstant* ptr, unsigned i0, unsigned i1);
// to constant helpers // to constant helpers
@ -89,19 +89,19 @@ LLConstant* DtoConstString(const char*);
LLConstant* DtoConstBool(bool); LLConstant* DtoConstBool(bool);
// llvm wrappers // llvm wrappers
LLValue* DtoLoad(LLValue* src, const char* name=0); LLValue* DtoLoad(LLValue* src, const char* name = "");
LLValue* DtoAlignedLoad(LLValue* src, const char* name=0); LLValue* DtoAlignedLoad(LLValue* src, const char* name = "");
void DtoStore(LLValue* src, LLValue* dst); void DtoStore(LLValue* src, LLValue* dst);
void DtoStoreZextI8(LLValue* src, LLValue* dst); void DtoStoreZextI8(LLValue* src, LLValue* dst);
void DtoAlignedStore(LLValue* src, LLValue* dst); void DtoAlignedStore(LLValue* src, LLValue* dst);
LLValue* DtoBitCast(LLValue* v, LLType* t, const char* name=0); LLValue* DtoBitCast(LLValue* v, LLType* t, const char* name = "");
LLConstant* DtoBitCast(LLConstant* v, LLType* t); LLConstant* DtoBitCast(LLConstant* v, LLType* t);
LLValue* DtoInsertValue(LLValue* aggr, LLValue* v, unsigned idx, const char* name=0); LLValue* DtoInsertValue(LLValue* aggr, LLValue* v, unsigned idx, const char* name = "");
LLValue* DtoExtractValue(LLValue* aggr, unsigned idx, const char* name=0); LLValue* DtoExtractValue(LLValue* aggr, unsigned idx, const char* name = "");
LLValue* DtoInsertElement(LLValue* vec, LLValue* v, LLValue *idx, const char* name=0); LLValue* DtoInsertElement(LLValue* vec, LLValue* v, LLValue *idx, const char* name = "");
LLValue* DtoExtractElement(LLValue* vec, LLValue *idx, const char* name=0); LLValue* DtoExtractElement(LLValue* vec, LLValue *idx, const char* name = "");
LLValue* DtoInsertElement(LLValue* vec, LLValue* v, unsigned idx, const char* name=0); LLValue* DtoInsertElement(LLValue* vec, LLValue* v, unsigned idx, const char* name = "");
LLValue* DtoExtractElement(LLValue* vec, unsigned idx, const char* name=0); LLValue* DtoExtractElement(LLValue* vec, unsigned idx, const char* name = "");
// llvm::dyn_cast wrappers // llvm::dyn_cast wrappers
LLPointerType* isaPointer(LLValue* v); LLPointerType* isaPointer(LLValue* v);
@ -133,8 +133,8 @@ size_t getTypeAllocSize(LLType* t);
unsigned char getABITypeAlign(LLType* t); unsigned char getABITypeAlign(LLType* t);
// pair type helpers // pair type helpers
LLValue* DtoAggrPair(LLType* type, LLValue* V1, LLValue* V2, const char* name = 0); LLValue* DtoAggrPair(LLType* type, LLValue* V1, LLValue* V2, const char* name = "");
LLValue* DtoAggrPair(LLValue* V1, LLValue* V2, const char* name = 0); LLValue* DtoAggrPair(LLValue* V1, LLValue* V2, const char* name = "");
LLValue* DtoAggrPaint(LLValue* aggr, LLType* as); LLValue* DtoAggrPaint(LLValue* aggr, LLType* as);
LLValue* DtoAggrPairSwap(LLValue* aggr); LLValue* DtoAggrPairSwap(LLValue* aggr);