| 4448 | } |
| 4449 | |
| 4450 | void PrintFor(ForInstruction * instr) |
| 4451 | { |
| 4452 | int HeaderBlockLabel = ++ctx.CurrentID; |
| 4453 | int ConditionBlockLabel = ++ctx.CurrentID; |
| 4454 | int BodyBlockLabel = ++ctx.CurrentID; |
| 4455 | int UpdateBlockLabel = ++ctx.CurrentID; |
| 4456 | int MergeBlockLabel = ++ctx.CurrentID; |
| 4457 | |
| 4458 | ctx.AddInstrBranch(HeaderBlockLabel); |
| 4459 | |
| 4460 | ctx.AddInstrLabel_AtFunctionBody(HeaderBlockLabel); |
| 4461 | ctx.AddInstrLoopMerge(MergeBlockLabel, UpdateBlockLabel); |
| 4462 | ctx.AddInstrBranch(ConditionBlockLabel); |
| 4463 | |
| 4464 | // condition block |
| 4465 | ctx.PushScope(); |
| 4466 | ctx.AddInstrLabel_AtFunctionBody(ConditionBlockLabel); |
| 4467 | GenerateCode(instr->ConditionCode.Ptr(), ConditionBlockLabel); |
| 4468 | int conditionID = GetOperandValue(instr->ConditionCode->GetLastInstruction()); |
| 4469 | conditionID = ctx.ConvertBasicType( |
| 4470 | conditionID, |
| 4471 | ctx.IDInfos[conditionID]().GetILType(), |
| 4472 | GetTypeFromString("bool")); |
| 4473 | ctx.AddInstrBranchConditional(conditionID, BodyBlockLabel, MergeBlockLabel); |
| 4474 | ctx.PopScope(); |
| 4475 | |
| 4476 | // body block |
| 4477 | ctx.PushScope(); |
| 4478 | ctx.AddInstrLabel_AtFunctionBody(BodyBlockLabel); |
| 4479 | ctx.StackMergeBlock.Add(MergeBlockLabel); |
| 4480 | ctx.StackContinueBlock.Add(UpdateBlockLabel); |
| 4481 | GenerateCode(instr->BodyCode.Ptr(), BodyBlockLabel); |
| 4482 | ctx.StackMergeBlock.RemoveAt(ctx.StackMergeBlock.Count() - 1); |
| 4483 | ctx.StackContinueBlock.RemoveAt(ctx.StackContinueBlock.Count() - 1); |
| 4484 | ctx.AddInstrBranch(UpdateBlockLabel); |
| 4485 | ctx.PopScope(); |
| 4486 | |
| 4487 | // update block |
| 4488 | ctx.PushScope(); |
| 4489 | ctx.AddInstrLabel_AtFunctionBody(UpdateBlockLabel); |
| 4490 | GenerateCode(instr->SideEffectCode.Ptr(), UpdateBlockLabel); |
| 4491 | ctx.AddInstrBranch(HeaderBlockLabel); |
| 4492 | ctx.PopScope(); |
| 4493 | |
| 4494 | // merge block |
| 4495 | ctx.AddInstrLabel_AtFunctionBody(MergeBlockLabel); |
| 4496 | } |
| 4497 | |
| 4498 | void PrintWhileDo(WhileInstruction * instr) |
| 4499 | { |
nothing calls this directly
no test coverage detected