comparison gen/CodeGen.d @ 98:7f9240d4ddc1 new_gen

Fixed tests - forgot some stuff in codegen.
author Anders Johnsen <skabet@gmail.com>
date Tue, 06 May 2008 21:55:29 +0200
parents 438e6ed4cda1
children fea8d61a2451
comparison
equal deleted inserted replaced
97:198ad05f3ace 98:7f9240d4ddc1
319 args ~= v; 319 args ~= v;
320 320
321 } 321 }
322 // BUG: doesn't do implicit type-conversion 322 // BUG: doesn't do implicit type-conversion
323 if(callExp.sret) 323 if(callExp.sret)
324 return b.buildCall(m.getNamedFunction(id.get), args, ""); 324 return b.buildCall(m.getNamedFunction(id.getMangled), args, "");
325 return b.buildCall(m.getNamedFunction(id.get), args, ".call"); 325 return b.buildCall(m.getNamedFunction(id.getMangled), args, ".call");
326 case ExpType.CastExp: 326 case ExpType.CastExp:
327 auto castExp = cast(CastExp)exp; 327 auto castExp = cast(CastExp)exp;
328 auto value = genExpression(castExp.exp); 328 auto value = genExpression(castExp.exp);
329 329
330 if(!castExp.type.hasImplicitConversionTo(castExp.type)) 330 if(!castExp.type.hasImplicitConversionTo(castExp.type))
407 if (cond.type !is Type.Int1) 407 if (cond.type !is Type.Int1)
408 { 408 {
409 Value False = ConstantInt.GetS(cond.type, 0); 409 Value False = ConstantInt.GetS(cond.type, 0);
410 cond = b.buildICmp(IntPredicate.NE, cond, False, ".cond"); 410 cond = b.buildICmp(IntPredicate.NE, cond, False, ".cond");
411 } 411 }
412 auto func_name = stmt.env.parentFunction().identifier.get; 412 auto func_name = stmt.env.parentFunction().identifier.getMangled;
413 Function func = m.getNamedFunction(func_name); 413 Function func = m.getNamedFunction(func_name);
414 bool has_else = (ifStmt.else_body !is null); 414 bool has_else = (ifStmt.else_body !is null);
415 415
416 auto thenBB = func.appendBasicBlock("then"); 416 auto thenBB = func.appendBasicBlock("then");
417 auto elseBB = has_else? func.appendBasicBlock("else") : null; 417 auto elseBB = has_else? func.appendBasicBlock("else") : null;