Browse Source

Allow for RESULT designator in inline procedures
allow for standard arrays for vector registers
arrays of 4 characters are currently not supported -- yet unclear mapping

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

felixf 8 years ago
parent
commit
2aebb9f0d5
2 changed files with 22 additions and 1 deletions
  1. 12 1
      source/FoxIntermediateBackend.Mod
  2. 10 0
      source/FoxIntermediateCode.Mod

+ 12 - 1
source/FoxIntermediateBackend.Mod

@@ -9083,12 +9083,23 @@ TYPE
 		END VisitSelfDesignator;
 
 		PROCEDURE VisitResultDesignator(x: SyntaxTree.ResultDesignator);
-		VAR procedure: SyntaxTree.Procedure; procedureType: SyntaxTree.ProcedureType; parameter: SyntaxTree.Parameter;
+		VAR procedure: SyntaxTree.Procedure; procedureType: SyntaxTree.ProcedureType; parameter: SyntaxTree.Parameter; map: SymbolMap;
 		BEGIN
 			IF Trace THEN TraceEnter("VisitResultDesignator") END;
 			procedure := currentScope(SyntaxTree.ProcedureScope).ownerProcedure;
 			procedureType := procedure.type(SyntaxTree.ProcedureType);
 			parameter := procedureType.returnParameter;
+			
+			IF currentIsInline THEN
+				map := currentMapper.Get(NIL);
+				IF map # NIL THEN
+					Designate(map.to, result);
+				ELSE
+					HALT(200);
+				END;
+				RETURN;
+			END;
+			
 			VisitParameter(parameter);
 			IF Trace THEN TraceExit("VisitResultDesignator") END;
 		END VisitResultDesignator;

+ 10 - 0
source/FoxIntermediateCode.Mod

@@ -1205,6 +1205,16 @@ TYPE
 			RETURN GetType(system,system.addressType);
 		ELSIF (type IS SyntaxTree.ArrayType) & (type(SyntaxTree.ArrayType).form = SyntaxTree.SemiDynamic) THEN
 			RETURN GetType(system,system.addressType);
+		ELSIF type IS SyntaxTree.ArrayType THEN
+			WITH type: SyntaxTree.ArrayType DO
+				IF type.form = SyntaxTree.Static THEN
+					t := GetType(system, type.arrayBase);
+					ASSERT(t.length = 1);
+					ToVectorType(t, type.staticLength);
+					RETURN t
+				END;
+			END;		
+			RETURN GetType(system,system.addressType);
 		ELSIF type IS SyntaxTree.PortType THEN
 			RETURN GetType(system, system.addressType);
 		ELSIF type IS SyntaxTree.CellType THEN