Browse Source

Added leave and exit for procedures that are unchecked (replaces the trap at the end of a procedure when return is missing).
For code with implicit returns in assembly.

git-svn-id: https://svn.inf.ethz.ch/svn/lecturers/a2/trunk@6388 8c9fc860-2736-0410-a75d-ab315db34111

felixf 9 years ago
parent
commit
54380d44cd
1 changed files with 4 additions and 0 deletions
  1. 4 0
      source/FoxIntermediateBackend.Mod

+ 4 - 0
source/FoxIntermediateBackend.Mod

@@ -719,6 +719,10 @@ TYPE
 							ir.Emit(Exit(x.position,procedureType.pcOffset,cc));
 						ELSE
 							ir.Emit(Nop(x.position));
+							IF scope.body.isUnchecked OR backend.noRuntimeChecks THEN (* return from procedure in any case *)
+								implementationVisitor.EmitLeave(ir,x.position,cc);
+								ir.Emit(Exit(x.position,procedureType.pcOffset,cc));
+							END;
 						END;
 					END
 				END;