diff --git a/gen/aa.cpp b/gen/aa.cpp index 0bcd06ed..384547df 100644 --- a/gen/aa.cpp +++ b/gen/aa.cpp @@ -190,7 +190,15 @@ LLValue* DtoAAEquals(Loc& loc, TOK op, DValue* l, DValue* r) { Type* t = l->getType()->toBasetype(); assert(t == r->getType()->toBasetype() && "aa equality is only defined for aas of same type"); +#if DMDV2 + llvm::Function* func = LLVM_D_GetRuntimeFunction(gIR->module, "_aaEqual"); + const llvm::FunctionType* funcTy = func->getFunctionType(); + LLValue* aaval = DtoBitCast(l->getRVal(), funcTy->getParamType(1)); + LLValue* abval = DtoBitCast(r->getRVal(), funcTy->getParamType(2)); + LLValue* aaTypeInfo = DtoTypeInfoOf(t); + LLValue* res = gIR->CreateCallOrInvoke3(func, aaTypeInfo, aaval, abval, "aaEqRes").getInstruction(); +#else llvm::Function* func = LLVM_D_GetRuntimeFunction(gIR->module, "_aaEq"); const llvm::FunctionType* funcTy = func->getFunctionType(); @@ -198,7 +206,7 @@ LLValue* DtoAAEquals(Loc& loc, TOK op, DValue* l, DValue* r) LLValue* abval = DtoBitCast(r->getRVal(), funcTy->getParamType(1)); LLValue* aaTypeInfo = DtoTypeInfoOf(t); LLValue* res = gIR->CreateCallOrInvoke3(func, aaval, abval, aaTypeInfo, "aaEqRes").getInstruction(); - +#endif res = gIR->ir->CreateICmpNE(res, DtoConstInt(0), "tmp"); if (op == TOKnotequal) res = gIR->ir->CreateNot(res, "tmp"); diff --git a/gen/runtime.cpp b/gen/runtime.cpp index 30d90899..b9531cde 100644 --- a/gen/runtime.cpp +++ b/gen/runtime.cpp @@ -839,6 +839,19 @@ static void LLVM_D_BuildRuntimeModule() ->setAttributes(Attr_1_NoCapture); } +#if DMDV2 + // int _aaEqual(TypeInfo_AssociativeArray ti, AA e1, AA e2) + { + llvm::StringRef fname("_aaEqual"); + std::vector types; + types.push_back(typeInfoTy); + types.push_back(aaTy); + types.push_back(aaTy); + const llvm::FunctionType* fty = llvm::FunctionType::get(intTy, types, false); + llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M) + ->setAttributes(Attr_1_2_NoCapture); + } +#else // int _aaEq(AA aa, AA ab, TypeInfo_AssociativeArray ti) { llvm::StringRef fname("_aaEq"); @@ -850,6 +863,7 @@ static void LLVM_D_BuildRuntimeModule() llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M) ->setAttributes(Attr_1_2_NoCapture); } +#endif ///////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////