MCPcopy Create free account
hub / github.com/HaxeFoundation/hxcpp / genSetter

Function genSetter

src/hx/cppia/Cppia.cpp:3693–3826  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3691}
3692
3693void genSetter(CppiaCompiler *compiler, const JitVal &ioValue, ExprType exprType, AssignOp inOp, CppiaExpr *inExpr)
3694{
3695 switch(inOp)
3696 {
3697 case aoMult:
3698 if (exprType==etInt)
3699 {
3700 inExpr->genCode(compiler, sJitTemp0, etInt);
3701 compiler->mult(ioValue, sJitTemp0, ioValue,false);
3702 }
3703 else
3704 {
3705 inExpr->genCode(compiler, sJitTempF0, etFloat);
3706 if (exprType==etFloat)
3707 compiler->mult(ioValue, sJitTempF0, ioValue,true);
3708 else
3709 {
3710 JitTemp fval(compiler, jtFloat);
3711 compiler->convert(ioValue, exprType, fval, etFloat);
3712 compiler->mult(sJitTempF0, sJitTempF0, fval, true);
3713 compiler->convert(sJitTempF0, etFloat, ioValue, exprType);
3714 }
3715 }
3716 break;
3717
3718
3719 case aoMod:
3720 {
3721 JitTemp fval(compiler, jtFloat);
3722 inExpr->genCode(compiler, fval, etFloat);
3723 if (exprType==etInt)
3724 {
3725 compiler->callNative( (void *)modIntFloat, ioValue, fval );
3726 compiler->move(ioValue, sJitReturnReg.as(jtInt) );
3727 }
3728 else if (exprType==etFloat)
3729 {
3730 compiler->callNative( (void *)modFloatFloat, ioValue, fval );
3731 }
3732 else if (exprType==etObject)
3733 {
3734 compiler->callNative( (void *)modObjectFloat, ioValue, fval );
3735 compiler->move(ioValue, sJitReturnReg);
3736 }
3737 }
3738 break;
3739
3740 case aoAdd:
3741 if (exprType==etInt)
3742 {
3743 inExpr->genCode(compiler, sJitTemp0, etInt);
3744 compiler->add(ioValue, sJitTemp0, ioValue);
3745 }
3746 else if (exprType==etFloat)
3747 {
3748 inExpr->genCode(compiler, sJitTempF0, etFloat);
3749 compiler->add(ioValue, sJitTempF0, ioValue);
3750 }

Callers 1

genCodeMethod · 0.85

Calls 12

genBitOpSetFunction · 0.85
multMethod · 0.80
convertMethod · 0.80
callNativeMethod · 0.80
moveMethod · 0.80
asMethod · 0.80
checkExceptionMethod · 0.80
fdivMethod · 0.80
genCodeMethod · 0.45
addMethod · 0.45
getTypeMethod · 0.45
subMethod · 0.45

Tested by

no test coverage detected