|
@@ -82,8 +82,6 @@ CONST
|
|
StackLimitOffset* = BaseObjectTypeSize + 3;
|
|
StackLimitOffset* = BaseObjectTypeSize + 3;
|
|
QuantumOffset = BaseObjectTypeSize + 4;
|
|
QuantumOffset = BaseObjectTypeSize + 4;
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
(* flags for optimizations with small matricies and vectors (Alexey Morozov) *)
|
|
(* flags for optimizations with small matricies and vectors (Alexey Morozov) *)
|
|
SmallMatrixFlag = 3; (* flag for identification of a small matrix *)
|
|
SmallMatrixFlag = 3; (* flag for identification of a small matrix *)
|
|
SmallVectorFlag = 3; (* flag for identification of a small vector *)
|
|
SmallVectorFlag = 3; (* flag for identification of a small vector *)
|
|
@@ -111,7 +109,6 @@ CONST
|
|
SysvABI = {SyntaxTree.CCallingConvention};
|
|
SysvABI = {SyntaxTree.CCallingConvention};
|
|
SysvABIorWINAPI = {SyntaxTree.CCallingConvention, SyntaxTree.WinAPICallingConvention};
|
|
SysvABIorWINAPI = {SyntaxTree.CCallingConvention, SyntaxTree.WinAPICallingConvention};
|
|
|
|
|
|
-
|
|
|
|
TYPE
|
|
TYPE
|
|
Position=SyntaxTree.Position;
|
|
Position=SyntaxTree.Position;
|
|
SupportedInstructionProcedure* = PROCEDURE {DELEGATE} (CONST instr: IntermediateCode.Instruction; VAR moduleName,procedureName: ARRAY OF CHAR): BOOLEAN;
|
|
SupportedInstructionProcedure* = PROCEDURE {DELEGATE} (CONST instr: IntermediateCode.Instruction; VAR moduleName,procedureName: ARRAY OF CHAR): BOOLEAN;
|
|
@@ -131,7 +128,6 @@ TYPE
|
|
availability: WORD; (* index *)
|
|
availability: WORD; (* index *)
|
|
END;
|
|
END;
|
|
|
|
|
|
-
|
|
|
|
Fixup= POINTER TO RECORD
|
|
Fixup= POINTER TO RECORD
|
|
pc: LONGINT;
|
|
pc: LONGINT;
|
|
nextFixup: Fixup;
|
|
nextFixup: Fixup;
|
|
@@ -168,7 +164,6 @@ TYPE
|
|
|
|
|
|
END Label;
|
|
END Label;
|
|
|
|
|
|
-
|
|
|
|
ConditionalBranch = PROCEDURE {DELEGATE}(label: Label; op1,op2: IntermediateCode.Operand);
|
|
ConditionalBranch = PROCEDURE {DELEGATE}(label: Label; op1,op2: IntermediateCode.Operand);
|
|
|
|
|
|
DeclarationVisitor =OBJECT
|
|
DeclarationVisitor =OBJECT
|
|
@@ -313,7 +308,6 @@ TYPE
|
|
lastUpdated := offset + ToMemoryUnits(system, op.type.sizeInBits);
|
|
lastUpdated := offset + ToMemoryUnits(system, op.type.sizeInBits);
|
|
END SingleInitialize;
|
|
END SingleInitialize;
|
|
|
|
|
|
-
|
|
|
|
PROCEDURE Initialize(type: SyntaxTree.Type; initializer: SyntaxTree.Expression; offset:LONGINT);
|
|
PROCEDURE Initialize(type: SyntaxTree.Type; initializer: SyntaxTree.Expression; offset:LONGINT);
|
|
VAR op: Operand; baseType: SyntaxTree.Type; variable: SyntaxTree.Variable; i: LONGINT; size:LONGINT;
|
|
VAR op: Operand; baseType: SyntaxTree.Type; variable: SyntaxTree.Variable; i: LONGINT; size:LONGINT;
|
|
BEGIN
|
|
BEGIN
|
|
@@ -371,7 +365,6 @@ TYPE
|
|
END;
|
|
END;
|
|
END Initialize;
|
|
END Initialize;
|
|
|
|
|
|
-
|
|
|
|
BEGIN
|
|
BEGIN
|
|
IF x.externalName # NIL THEN RETURN END;
|
|
IF x.externalName # NIL THEN RETURN END;
|
|
IF (currentScope IS SyntaxTree.ModuleScope) OR (currentScope IS SyntaxTree.CellScope) & ~backend.cellsAreObjects THEN
|
|
IF (currentScope IS SyntaxTree.ModuleScope) OR (currentScope IS SyntaxTree.CellScope) & ~backend.cellsAreObjects THEN
|
|
@@ -457,7 +450,6 @@ TYPE
|
|
END;
|
|
END;
|
|
END Constant;
|
|
END Constant;
|
|
|
|
|
|
-
|
|
|
|
PROCEDURE Scope(x: SyntaxTree.Scope);
|
|
PROCEDURE Scope(x: SyntaxTree.Scope);
|
|
VAR procedure: SyntaxTree.Procedure;
|
|
VAR procedure: SyntaxTree.Procedure;
|
|
constant: SyntaxTree.Constant;
|
|
constant: SyntaxTree.Constant;
|
|
@@ -471,7 +463,6 @@ TYPE
|
|
currentScope := x;
|
|
currentScope := x;
|
|
(* constants treated in implementation visitor *)
|
|
(* constants treated in implementation visitor *)
|
|
|
|
|
|
-
|
|
|
|
WITH x: SyntaxTree.CellScope DO
|
|
WITH x: SyntaxTree.CellScope DO
|
|
cell := x.ownerCell;
|
|
cell := x.ownerCell;
|
|
parameter := cell.firstParameter;
|
|
parameter := cell.firstParameter;
|
|
@@ -884,8 +875,6 @@ TYPE
|
|
currentScope := prevScope;
|
|
currentScope := prevScope;
|
|
END Procedure;
|
|
END Procedure;
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
PROCEDURE AddBodyCallStub(bodyProcedure: SyntaxTree.Procedure); (* code that is only necessary for static linkers *)
|
|
PROCEDURE AddBodyCallStub(bodyProcedure: SyntaxTree.Procedure); (* code that is only necessary for static linkers *)
|
|
VAR procedure: SyntaxTree.Procedure; procedureScope: SyntaxTree.ProcedureScope; name: Basic.SegmentedName;
|
|
VAR procedure: SyntaxTree.Procedure; procedureScope: SyntaxTree.ProcedureScope; name: Basic.SegmentedName;
|
|
ir: IntermediateCode.Section; op: IntermediateCode.Operand;
|
|
ir: IntermediateCode.Section; op: IntermediateCode.Operand;
|
|
@@ -929,8 +918,6 @@ TYPE
|
|
ir.Emit(Mov(Basic.invalidPosition,implementationVisitor.sp,op));
|
|
ir.Emit(Mov(Basic.invalidPosition,implementationVisitor.sp,op));
|
|
END AddStackAllocation;
|
|
END AddStackAllocation;
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
(** entry function to visit a complete module *)
|
|
(** entry function to visit a complete module *)
|
|
PROCEDURE Module(x: SyntaxTree.Module; module: Sections.Module);
|
|
PROCEDURE Module(x: SyntaxTree.Module; module: Sections.Module);
|
|
VAR
|
|
VAR
|
|
@@ -972,7 +959,6 @@ TYPE
|
|
RETURN FALSE
|
|
RETURN FALSE
|
|
END ScopeNeedsInitialization;
|
|
END ScopeNeedsInitialization;
|
|
|
|
|
|
-
|
|
|
|
BEGIN
|
|
BEGIN
|
|
ASSERT(x # NIL); ASSERT(module # NIL);
|
|
ASSERT(x # NIL); ASSERT(module # NIL);
|
|
SELF.module := module;
|
|
SELF.module := module;
|
|
@@ -1147,7 +1133,6 @@ TYPE
|
|
nameIndex := 0;
|
|
nameIndex := 0;
|
|
END Clear;
|
|
END Clear;
|
|
|
|
|
|
-
|
|
|
|
PROCEDURE GetUID(): SyntaxTree.Identifier;
|
|
PROCEDURE GetUID(): SyntaxTree.Identifier;
|
|
VAR string: SyntaxTree.IdentifierString ;
|
|
VAR string: SyntaxTree.IdentifierString ;
|
|
BEGIN
|
|
BEGIN
|
|
@@ -1232,9 +1217,6 @@ TYPE
|
|
RETURN NIL
|
|
RETURN NIL
|
|
END GetFreeVariable;
|
|
END GetFreeVariable;
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
END Variables;
|
|
END Variables;
|
|
|
|
|
|
SymbolMap = POINTER TO RECORD
|
|
SymbolMap = POINTER TO RECORD
|
|
@@ -1270,7 +1252,6 @@ TYPE
|
|
|
|
|
|
END SymbolMapper;
|
|
END SymbolMapper;
|
|
|
|
|
|
-
|
|
|
|
ImplementationVisitor =OBJECT(SyntaxTree.Visitor)
|
|
ImplementationVisitor =OBJECT(SyntaxTree.Visitor)
|
|
VAR
|
|
VAR
|
|
system: Global.System;
|
|
system: Global.System;
|
|
@@ -1305,8 +1286,6 @@ TYPE
|
|
registerUsageCount: RegisterUsageCount;
|
|
registerUsageCount: RegisterUsageCount;
|
|
usedRegisters: RegisterEntry;
|
|
usedRegisters: RegisterEntry;
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
(* useful operands and types *)
|
|
(* useful operands and types *)
|
|
nil,one,fp,sp,ap,lr,true,false: IntermediateCode.Operand;
|
|
nil,one,fp,sp,ap,lr,true,false: IntermediateCode.Operand;
|
|
bool,addressType,setType, sizeType, lenType, byteType: IntermediateCode.Type;
|
|
bool,addressType,setType, sizeType, lenType, byteType: IntermediateCode.Type;
|
|
@@ -1466,7 +1445,6 @@ TYPE
|
|
Strings.Append(string, "]");
|
|
Strings.Append(string, "]");
|
|
END GetFingerprintString;
|
|
END GetFingerprintString;
|
|
|
|
|
|
-
|
|
|
|
(** get the name for the code section that represens a certain symbol
|
|
(** get the name for the code section that represens a certain symbol
|
|
(essentially the same as Global.GetSymbolName, apart from operators) **)
|
|
(essentially the same as Global.GetSymbolName, apart from operators) **)
|
|
PROCEDURE GetCodeSectionNameForSymbol(symbol: SyntaxTree.Symbol; VAR name: Basic.SegmentedName);
|
|
PROCEDURE GetCodeSectionNameForSymbol(symbol: SyntaxTree.Symbol; VAR name: Basic.SegmentedName);
|
|
@@ -1480,7 +1458,6 @@ TYPE
|
|
END
|
|
END
|
|
END GetCodeSectionNameForSymbol;
|
|
END GetCodeSectionNameForSymbol;
|
|
|
|
|
|
-
|
|
|
|
PROCEDURE TraceEnter(CONST s: ARRAY OF CHAR);
|
|
PROCEDURE TraceEnter(CONST s: ARRAY OF CHAR);
|
|
BEGIN
|
|
BEGIN
|
|
IF dump # NIL THEN
|
|
IF dump # NIL THEN
|
|
@@ -1495,7 +1472,6 @@ TYPE
|
|
END;
|
|
END;
|
|
END TraceExit;
|
|
END TraceExit;
|
|
|
|
|
|
-
|
|
|
|
PROCEDURE Emit(instruction: IntermediateCode.Instruction);
|
|
PROCEDURE Emit(instruction: IntermediateCode.Instruction);
|
|
VAR moduleName, procedureName: SyntaxTree.IdentifierString;
|
|
VAR moduleName, procedureName: SyntaxTree.IdentifierString;
|
|
|
|
|
|
@@ -2704,7 +2680,6 @@ TYPE
|
|
END;
|
|
END;
|
|
END CheckRegistersFree;
|
|
END CheckRegistersFree;
|
|
|
|
|
|
-
|
|
|
|
(* Reuse2: reuse src1 or src2 for ongoing computation if src1 or src2, respectively, is a register.
|
|
(* Reuse2: reuse src1 or src2 for ongoing computation if src1 or src2, respectively, is a register.
|
|
Otherwise allocate a new register.
|
|
Otherwise allocate a new register.
|
|
Does NOT necessarily keep the content of src1 or src2 in result! *)
|
|
Does NOT necessarily keep the content of src1 or src2 in result! *)
|
|
@@ -2780,7 +2755,6 @@ TYPE
|
|
END
|
|
END
|
|
END TransferToRegister;
|
|
END TransferToRegister;
|
|
|
|
|
|
-
|
|
|
|
(** labels and branches **)
|
|
(** labels and branches **)
|
|
PROCEDURE NewLabel(): Label;
|
|
PROCEDURE NewLabel(): Label;
|
|
VAR label: Label;
|
|
VAR label: Label;
|
|
@@ -3048,7 +3022,6 @@ TYPE
|
|
RETURN dim;
|
|
RETURN dim;
|
|
END Dimension;
|
|
END Dimension;
|
|
|
|
|
|
-
|
|
|
|
BEGIN
|
|
BEGIN
|
|
(*static math array not providing pointers anyway *)
|
|
(*static math array not providing pointers anyway *)
|
|
variable := GetTemporaryVariable(x.type, FALSE, FALSE (* untraced *));
|
|
variable := GetTemporaryVariable(x.type, FALSE, FALSE (* untraced *));
|
|
@@ -3110,8 +3083,6 @@ TYPE
|
|
IF Trace THEN TraceExit("VisitUnaryExpression") END;
|
|
IF Trace THEN TraceExit("VisitUnaryExpression") END;
|
|
END VisitUnaryExpression;
|
|
END VisitUnaryExpression;
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
(* test if e is of type type, side effect: result of evaluation of e stays in the operand *)
|
|
(* test if e is of type type, side effect: result of evaluation of e stays in the operand *)
|
|
PROCEDURE TypeTest(tag: IntermediateCode.Operand; type: SyntaxTree.Type; label: Label; reason: BOOLEAN; withPart: BOOLEAN);
|
|
PROCEDURE TypeTest(tag: IntermediateCode.Operand; type: SyntaxTree.Type; label: Label; reason: BOOLEAN; withPart: BOOLEAN);
|
|
VAR left,right: IntermediateCode.Operand; level,offset: LONGINT; repeatL,skip: Label; originalType: SyntaxTree.Type;
|
|
VAR left,right: IntermediateCode.Operand; level,offset: LONGINT; repeatL,skip: Label; originalType: SyntaxTree.Type;
|
|
@@ -3138,12 +3109,12 @@ TYPE
|
|
right := TypeDescriptorAdr(type);
|
|
right := TypeDescriptorAdr(type);
|
|
|
|
|
|
IF backend.cooperative THEN
|
|
IF backend.cooperative THEN
|
|
- repeatL := NewLabel();
|
|
|
|
- IF (originalType IS SyntaxTree.PointerType) & ~type(SyntaxTree.RecordType).isObject THEN
|
|
|
|
|
|
+ repeatL := NewLabel();
|
|
|
|
+ IF (originalType IS SyntaxTree.PointerType) & ~type(SyntaxTree.RecordType).isObject THEN
|
|
Emit(Mov(position,left,IntermediateCode.Memory(addressType,left,ToMemoryUnits(system,addressType.sizeInBits))));
|
|
Emit(Mov(position,left,IntermediateCode.Memory(addressType,left,ToMemoryUnits(system,addressType.sizeInBits))));
|
|
END;
|
|
END;
|
|
- SetLabel(repeatL);
|
|
|
|
- IF reason THEN
|
|
|
|
|
|
+ SetLabel(repeatL);
|
|
|
|
+ IF reason THEN
|
|
BreqL(label,left,right);
|
|
BreqL(label,left,right);
|
|
ELSE
|
|
ELSE
|
|
skip := NewLabel();
|
|
skip := NewLabel();
|
|
@@ -3313,7 +3284,6 @@ TYPE
|
|
Emit(Push(Basic.invalidPosition, lr));
|
|
Emit(Push(Basic.invalidPosition, lr));
|
|
END;
|
|
END;
|
|
|
|
|
|
-
|
|
|
|
variable := recordType.recordScope.firstVariable;
|
|
variable := recordType.recordScope.firstVariable;
|
|
WHILE variable # NIL DO
|
|
WHILE variable # NIL DO
|
|
IF variable.NeedsTrace() THEN
|
|
IF variable.NeedsTrace() THEN
|
|
@@ -3686,7 +3656,6 @@ TYPE
|
|
END;
|
|
END;
|
|
END CallResetProcedure;
|
|
END CallResetProcedure;
|
|
|
|
|
|
-
|
|
|
|
PROCEDURE ResetVariables (scope: SyntaxTree.ProcedureScope);
|
|
PROCEDURE ResetVariables (scope: SyntaxTree.ProcedureScope);
|
|
VAR variable: SyntaxTree.Variable; parameter: SyntaxTree.Parameter; previousScope: SyntaxTree.Scope; prevOffset: SIZE; pc: LONGINT;
|
|
VAR variable: SyntaxTree.Variable; parameter: SyntaxTree.Parameter; previousScope: SyntaxTree.Scope; prevOffset: SIZE; pc: LONGINT;
|
|
|
|
|
|
@@ -3806,11 +3775,9 @@ TYPE
|
|
|
|
|
|
END Reset;
|
|
END Reset;
|
|
|
|
|
|
-
|
|
|
|
PROCEDURE ResetVariables2 (scope: SyntaxTree.ProcedureScope; refer: BOOLEAN);
|
|
PROCEDURE ResetVariables2 (scope: SyntaxTree.ProcedureScope; refer: BOOLEAN);
|
|
VAR variable: SyntaxTree.Variable; parameter: SyntaxTree.Parameter; previousScope: SyntaxTree.Scope; pc: LONGINT; prevOffset: SIZE;
|
|
VAR variable: SyntaxTree.Variable; parameter: SyntaxTree.Parameter; previousScope: SyntaxTree.Scope; pc: LONGINT; prevOffset: SIZE;
|
|
|
|
|
|
-
|
|
|
|
BEGIN
|
|
BEGIN
|
|
previousScope := currentScope;
|
|
previousScope := currentScope;
|
|
currentScope := scope;
|
|
currentScope := scope;
|
|
@@ -3873,8 +3840,6 @@ TYPE
|
|
ELSE
|
|
ELSE
|
|
import := moduleScope.ImportByModuleName(SyntaxTree.NewIdentifier(moduleName),SyntaxTree.NewIdentifier("A2"));
|
|
import := moduleScope.ImportByModuleName(SyntaxTree.NewIdentifier(moduleName),SyntaxTree.NewIdentifier("A2"));
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
IF import = NIL THEN
|
|
IF import = NIL THEN
|
|
import := SyntaxTree.NewImport(Basic.invalidPosition,SyntaxTree.NewIdentifier(moduleName),SyntaxTree.NewIdentifier(moduleName),FALSE);
|
|
import := SyntaxTree.NewImport(Basic.invalidPosition,SyntaxTree.NewIdentifier(moduleName),SyntaxTree.NewIdentifier(moduleName),FALSE);
|
|
|
|
|
|
@@ -4035,7 +4000,6 @@ TYPE
|
|
RETURN GetDynamicSize(e.type, tag);
|
|
RETURN GetDynamicSize(e.type, tag);
|
|
END GetArrayOfBytesSize;
|
|
END GetArrayOfBytesSize;
|
|
|
|
|
|
-
|
|
|
|
(*
|
|
(*
|
|
to find imported symbol. not needed ?
|
|
to find imported symbol. not needed ?
|
|
PROCEDURE SymbolByName(CONST moduleName, symbolName: ARRAY OF CHAR): SyntaxTree.Symbol;
|
|
PROCEDURE SymbolByName(CONST moduleName, symbolName: ARRAY OF CHAR): SyntaxTree.Symbol;
|
|
@@ -4099,7 +4063,6 @@ TYPE
|
|
RETURN symbol
|
|
RETURN symbol
|
|
END GetTypeDescriptor;
|
|
END GetTypeDescriptor;
|
|
|
|
|
|
-
|
|
|
|
(* Call a runtime procedure. If numberParameters >= 0 then the procedure may be called without module import. Otherwise the signature has to be inferred from the import. *)
|
|
(* Call a runtime procedure. If numberParameters >= 0 then the procedure may be called without module import. Otherwise the signature has to be inferred from the import. *)
|
|
PROCEDURE CallThisChecked(position: Position; CONST moduleName, procedureName: ARRAY OF CHAR; numberParameters: LONGINT; checkNumParameters: BOOLEAN);
|
|
PROCEDURE CallThisChecked(position: Position; CONST moduleName, procedureName: ARRAY OF CHAR; numberParameters: LONGINT; checkNumParameters: BOOLEAN);
|
|
VAR procedure: SyntaxTree.Procedure; result: Operand; reg: IntermediateCode.Operand; source: IntermediateCode.Section;
|
|
VAR procedure: SyntaxTree.Procedure; result: Operand; reg: IntermediateCode.Operand; source: IntermediateCode.Section;
|
|
@@ -4595,7 +4558,6 @@ TYPE
|
|
|
|
|
|
END CountIndices;
|
|
END CountIndices;
|
|
|
|
|
|
-
|
|
|
|
BEGIN
|
|
BEGIN
|
|
ASSERT(tagsAvailable);
|
|
ASSERT(tagsAvailable);
|
|
|
|
|
|
@@ -5357,7 +5319,7 @@ TYPE
|
|
arrayDestinationTag := sp;
|
|
arrayDestinationTag := sp;
|
|
|
|
|
|
(* case 1b
|
|
(* case 1b
|
|
- P(...,A[a..b,c..d],...): push: push array range descriptor to stack
|
|
|
|
|
|
+ P(...,A[a..b,c..d],...): push: push array range descriptor to stack
|
|
*)
|
|
*)
|
|
IF expression IS SyntaxTree.IndexDesignator THEN
|
|
IF expression IS SyntaxTree.IndexDesignator THEN
|
|
ReuseCopy(arrayDestinationTag,arrayDestinationTag);
|
|
ReuseCopy(arrayDestinationTag,arrayDestinationTag);
|
|
@@ -5459,7 +5421,7 @@ TYPE
|
|
ELSIF (parameter.type.resolved(SyntaxTree.MathArrayType).form = SyntaxTree.Open) & (parameter.kind = SyntaxTree.VarParameter) THEN
|
|
ELSIF (parameter.type.resolved(SyntaxTree.MathArrayType).form = SyntaxTree.Open) & (parameter.kind = SyntaxTree.VarParameter) THEN
|
|
dim := SemanticChecker.Dimension(parameter.type.resolved,{SyntaxTree.Open});
|
|
dim := SemanticChecker.Dimension(parameter.type.resolved,{SyntaxTree.Open});
|
|
(* case 2b
|
|
(* case 2b
|
|
- P(...,A[a..b,c..d],...) pre: emit range and push array range descriptor, memorize stack position
|
|
|
|
|
|
+ P(...,A[a..b,c..d],...) pre: emit range and push array range descriptor, memorize stack position
|
|
push: push reference to pushed array descriptor
|
|
push: push reference to pushed array descriptor
|
|
post: remove array descriptor.
|
|
post: remove array descriptor.
|
|
*)
|
|
*)
|
|
@@ -5476,7 +5438,7 @@ TYPE
|
|
Pass((operand.tag));
|
|
Pass((operand.tag));
|
|
NeedDescriptor := FALSE;
|
|
NeedDescriptor := FALSE;
|
|
(* case 2a
|
|
(* case 2a
|
|
- P(...,A,...)
|
|
|
|
|
|
+ P(...,A,...)
|
|
push: push reference to array descriptor on stack
|
|
push: push reference to array descriptor on stack
|
|
*)
|
|
*)
|
|
ELSIF type.resolved(SyntaxTree.MathArrayType).form = SyntaxTree.Open THEN
|
|
ELSIF type.resolved(SyntaxTree.MathArrayType).form = SyntaxTree.Open THEN
|
|
@@ -5514,7 +5476,7 @@ TYPE
|
|
Pass((arrayDestinationTag));
|
|
Pass((arrayDestinationTag));
|
|
END;
|
|
END;
|
|
(* case 2d
|
|
(* case 2d
|
|
- P(...,T,...) push: emit dimension check, push T
|
|
|
|
|
|
+ P(...,T,...) push: emit dimension check, push T
|
|
*)
|
|
*)
|
|
ELSIF type.resolved(SyntaxTree.MathArrayType).form = SyntaxTree.Tensor THEN
|
|
ELSIF type.resolved(SyntaxTree.MathArrayType).form = SyntaxTree.Tensor THEN
|
|
Designate(expression,operand);
|
|
Designate(expression,operand);
|
|
@@ -5522,7 +5484,7 @@ TYPE
|
|
DimensionCheck(operand.tag, IntermediateCode.Immediate(sizeType,dim),BreqL);
|
|
DimensionCheck(operand.tag, IntermediateCode.Immediate(sizeType,dim),BreqL);
|
|
Pass((operand.tag));
|
|
Pass((operand.tag));
|
|
(* case 2f
|
|
(* case 2f
|
|
- P(...,S,...) pre: allocate array descriptor on stack and memorize stack position
|
|
|
|
|
|
+ P(...,S,...) pre: allocate array descriptor on stack and memorize stack position
|
|
push: push reference to pushed array descriptor
|
|
push: push reference to pushed array descriptor
|
|
post: remove array descriptor
|
|
post: remove array descriptor
|
|
*)
|
|
*)
|
|
@@ -5585,7 +5547,7 @@ TYPE
|
|
ELSIF (parameter.type.resolved(SyntaxTree.MathArrayType).form = SyntaxTree.Tensor) & (parameter.kind IN {SyntaxTree.ConstParameter,SyntaxTree.ValueParameter}) THEN
|
|
ELSIF (parameter.type.resolved(SyntaxTree.MathArrayType).form = SyntaxTree.Tensor) & (parameter.kind IN {SyntaxTree.ConstParameter,SyntaxTree.ValueParameter}) THEN
|
|
dim := SemanticChecker.Dimension(type,{SyntaxTree.Open,SyntaxTree.Static});
|
|
dim := SemanticChecker.Dimension(type,{SyntaxTree.Open,SyntaxTree.Static});
|
|
(* case 3b
|
|
(* case 3b
|
|
- P(...,A[a..b,c..d],...)
|
|
|
|
|
|
+ P(...,A[a..b,c..d],...)
|
|
*)
|
|
*)
|
|
IF (expression IS SyntaxTree.IndexDesignator) & (type.resolved(SyntaxTree.MathArrayType).form # SyntaxTree.Static) THEN
|
|
IF (expression IS SyntaxTree.IndexDesignator) & (type.resolved(SyntaxTree.MathArrayType).form # SyntaxTree.Static) THEN
|
|
IF type(SyntaxTree.MathArrayType).form = SyntaxTree.Tensor THEN (* indexer of form a[e,....,?] *)
|
|
IF type(SyntaxTree.MathArrayType).form = SyntaxTree.Tensor THEN (* indexer of form a[e,....,?] *)
|
|
@@ -5644,16 +5606,16 @@ TYPE
|
|
(* case 3d
|
|
(* case 3d
|
|
P(...,T,...)
|
|
P(...,T,...)
|
|
case 3e
|
|
case 3e
|
|
- P(...,PT(...),...)
|
|
|
|
|
|
+ P(...,PT(...),...)
|
|
*)
|
|
*)
|
|
ELSIF type.resolved(SyntaxTree.MathArrayType).form = SyntaxTree.Tensor THEN
|
|
ELSIF type.resolved(SyntaxTree.MathArrayType).form = SyntaxTree.Tensor THEN
|
|
Designate(expression,operand);
|
|
Designate(expression,operand);
|
|
Dereference(operand,type.resolved,FALSE);
|
|
Dereference(operand,type.resolved,FALSE);
|
|
Pass((operand.tag));
|
|
Pass((operand.tag));
|
|
(* case 3f
|
|
(* case 3f
|
|
- P(...,S,...)
|
|
|
|
- case 3g
|
|
|
|
- P(...,PS(...),...)
|
|
|
|
|
|
+ P(...,S,...)
|
|
|
|
+ case 3g
|
|
|
|
+ P(...,PS(...),...)
|
|
*)
|
|
*)
|
|
ELSIF type.resolved(SyntaxTree.MathArrayType).form = SyntaxTree.Static THEN
|
|
ELSIF type.resolved(SyntaxTree.MathArrayType).form = SyntaxTree.Static THEN
|
|
descriptorType := GetMathArrayDescriptorType(dim);
|
|
descriptorType := GetMathArrayDescriptorType(dim);
|
|
@@ -5998,7 +5960,6 @@ TYPE
|
|
ReleaseIntermediateOperand(result.op);
|
|
ReleaseIntermediateOperand(result.op);
|
|
END;
|
|
END;
|
|
|
|
|
|
-
|
|
|
|
END VisitStatementDesignator;
|
|
END VisitStatementDesignator;
|
|
|
|
|
|
PROCEDURE InlineProcedureCall(x: SyntaxTree.ProcedureCallDesignator): BOOLEAN;
|
|
PROCEDURE InlineProcedureCall(x: SyntaxTree.ProcedureCallDesignator): BOOLEAN;
|
|
@@ -6046,9 +6007,6 @@ TYPE
|
|
RETURN variableDesignator
|
|
RETURN variableDesignator
|
|
END GetTemp;
|
|
END GetTemp;
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
BEGIN
|
|
BEGIN
|
|
resultDesignator := procedureResultDesignator; procedureResultDesignator := NIL;
|
|
resultDesignator := procedureResultDesignator; procedureResultDesignator := NIL;
|
|
wasInline := currentIsInline;
|
|
wasInline := currentIsInline;
|
|
@@ -6227,7 +6185,7 @@ TYPE
|
|
IF left IS SyntaxTree.DereferenceDesignator THEN (* dereference, if required *)
|
|
IF left IS SyntaxTree.DereferenceDesignator THEN (* dereference, if required *)
|
|
left := left(SyntaxTree.Designator).left;
|
|
left := left(SyntaxTree.Designator).left;
|
|
END;
|
|
END;
|
|
- expression := checker.NewObjectOperatorCall(Basic.invalidPosition, left, 0, actualParameter.parameters, tempVariableDesignator);
|
|
|
|
|
|
+ expression := checker.NewObjectOperatorCall(Basic.invalidPosition, left, 0, actualParameter.parameters, tempVariableDesignator);
|
|
currentWriteBackCall.call := expression(SyntaxTree.ProcedureCallDesignator);
|
|
currentWriteBackCall.call := expression(SyntaxTree.ProcedureCallDesignator);
|
|
END;
|
|
END;
|
|
actualParameter := tempVariableDesignator;
|
|
actualParameter := tempVariableDesignator;
|
|
@@ -6248,7 +6206,6 @@ TYPE
|
|
END;
|
|
END;
|
|
END;
|
|
END;
|
|
|
|
|
|
-
|
|
|
|
resultDesignator := procedureResultDesignator; procedureResultDesignator := NIL;
|
|
resultDesignator := procedureResultDesignator; procedureResultDesignator := NIL;
|
|
procedureType := x.left.type.resolved(SyntaxTree.ProcedureType);
|
|
procedureType := x.left.type.resolved(SyntaxTree.ProcedureType);
|
|
callingConvention := procedureType.callingConvention;
|
|
callingConvention := procedureType.callingConvention;
|
|
@@ -6313,7 +6270,7 @@ TYPE
|
|
IntermediateCode.InitImmediate(mask,addressType,-alignment);
|
|
IntermediateCode.InitImmediate(mask,addressType,-alignment);
|
|
Emit(And(position,sp, sp, mask));
|
|
Emit(And(position,sp, sp, mask));
|
|
Emit(Add(position, sp, sp, IntermediateCode.Immediate(addressType, gap)));
|
|
Emit(Add(position, sp, sp, IntermediateCode.Immediate(addressType, gap)));
|
|
- Emit(Push(position,reg));
|
|
|
|
|
|
+ Emit(Push(position,reg));
|
|
ReleaseIntermediateOperand(reg);
|
|
ReleaseIntermediateOperand(reg);
|
|
END;
|
|
END;
|
|
|
|
|
|
@@ -6387,15 +6344,15 @@ TYPE
|
|
Designate(d,returnValue);
|
|
Designate(d,returnValue);
|
|
returnTypeSize := system.SizeOf(procedureType.returnType.resolved);
|
|
returnTypeSize := system.SizeOf(procedureType.returnType.resolved);
|
|
size := IntermediateCode.Immediate(addressType,ToMemoryUnits(system,returnTypeSize));
|
|
size := IntermediateCode.Immediate(addressType,ToMemoryUnits(system,returnTypeSize));
|
|
- Emit(Push(position,size));
|
|
|
|
- Emit(Push(position,returnValue.op));
|
|
|
|
- ReleaseOperand(returnValue);
|
|
|
|
|
|
+ Emit(Push(position,size));
|
|
|
|
+ Emit(Push(position,returnValue.op));
|
|
|
|
+ ReleaseOperand(returnValue);
|
|
ELSE*)
|
|
ELSE*)
|
|
PushParameter(d,procedureType.returnParameter,callingConvention, FALSE, dummy,-1)
|
|
PushParameter(d,procedureType.returnParameter,callingConvention, FALSE, dummy,-1)
|
|
(*
|
|
(*
|
|
- END;
|
|
|
|
- *)
|
|
|
|
- END;
|
|
|
|
|
|
+ END;
|
|
|
|
+ *)
|
|
|
|
+ END;
|
|
|
|
|
|
IF callingConvention # SyntaxTree.OberonCallingConvention THEN
|
|
IF callingConvention # SyntaxTree.OberonCallingConvention THEN
|
|
parameterRegisters := 0;
|
|
parameterRegisters := 0;
|
|
@@ -6462,7 +6419,6 @@ TYPE
|
|
parametersSize := ParametersSize(system,procedureType, FALSE);
|
|
parametersSize := ParametersSize(system,procedureType, FALSE);
|
|
END;
|
|
END;
|
|
|
|
|
|
-
|
|
|
|
IF isCallOfDynamicOperator & hasDynamicOperands THEN
|
|
IF isCallOfDynamicOperator & hasDynamicOperands THEN
|
|
(*
|
|
(*
|
|
dynamic operator overloading:
|
|
dynamic operator overloading:
|
|
@@ -6548,7 +6504,6 @@ TYPE
|
|
END
|
|
END
|
|
END;
|
|
END;
|
|
|
|
|
|
-
|
|
|
|
ReleaseParameterRegisters();
|
|
ReleaseParameterRegisters();
|
|
|
|
|
|
IF ~(symbol IS SyntaxTree.Procedure) & backend.trackLeave & ~isUnchecked & (callingConvention IN {SyntaxTree.WinAPICallingConvention, SyntaxTree.CCallingConvention}) THEN
|
|
IF ~(symbol IS SyntaxTree.Procedure) & backend.trackLeave & ~isUnchecked & (callingConvention IN {SyntaxTree.WinAPICallingConvention, SyntaxTree.CCallingConvention}) THEN
|
|
@@ -6619,7 +6574,6 @@ TYPE
|
|
Emit(Pop(position, ap));
|
|
Emit(Pop(position, ap));
|
|
END;
|
|
END;
|
|
|
|
|
|
-
|
|
|
|
IF firstWriteBackCall # NIL THEN
|
|
IF firstWriteBackCall # NIL THEN
|
|
SaveRegisters(); ReleaseUsedRegisters(saved2);
|
|
SaveRegisters(); ReleaseUsedRegisters(saved2);
|
|
(* perform all write-back calls in the list *)
|
|
(* perform all write-back calls in the list *)
|
|
@@ -6692,7 +6646,6 @@ TYPE
|
|
RETURN delegatePointerType
|
|
RETURN delegatePointerType
|
|
END GetDelegateType;
|
|
END GetDelegateType;
|
|
|
|
|
|
-
|
|
|
|
PROCEDURE GetBackendType(x: SyntaxTree.Type; VAR offset: LONGINT; VAR name: Basic.SegmentedName): SyntaxTree.Symbol;
|
|
PROCEDURE GetBackendType(x: SyntaxTree.Type; VAR offset: LONGINT; VAR name: Basic.SegmentedName): SyntaxTree.Symbol;
|
|
(* create anonymous type declaration for types that need a type descriptor but have been declared anonymously
|
|
(* create anonymous type declaration for types that need a type descriptor but have been declared anonymously
|
|
such as in VAR a: RECORD ... END;
|
|
such as in VAR a: RECORD ... END;
|
|
@@ -6761,7 +6714,6 @@ TYPE
|
|
make memory should be used when tag is used, not earlier
|
|
make memory should be used when tag is used, not earlier
|
|
*)
|
|
*)
|
|
|
|
|
|
-
|
|
|
|
RETURN res
|
|
RETURN res
|
|
END TypeDescriptorAdr;
|
|
END TypeDescriptorAdr;
|
|
|
|
|
|
@@ -6901,7 +6853,6 @@ TYPE
|
|
rightType := NIL
|
|
rightType := NIL
|
|
END;
|
|
END;
|
|
|
|
|
|
-
|
|
|
|
(* determine operator kind *)
|
|
(* determine operator kind *)
|
|
IF IsStrictlyPointerToRecord(leftType) THEN
|
|
IF IsStrictlyPointerToRecord(leftType) THEN
|
|
kind := {LhsIsPointer}
|
|
kind := {LhsIsPointer}
|
|
@@ -7085,7 +7036,6 @@ TYPE
|
|
END;
|
|
END;
|
|
END StringOperand;
|
|
END StringOperand;
|
|
|
|
|
|
-
|
|
|
|
PROCEDURE Ln;
|
|
PROCEDURE Ln;
|
|
BEGIN
|
|
BEGIN
|
|
IF GetProcedure("Ln") THEN
|
|
IF GetProcedure("Ln") THEN
|
|
@@ -7093,7 +7043,6 @@ TYPE
|
|
END;
|
|
END;
|
|
END Ln;
|
|
END Ln;
|
|
|
|
|
|
-
|
|
|
|
BEGIN
|
|
BEGIN
|
|
IF backend.traceModuleName = "" THEN RETURN END;
|
|
IF backend.traceModuleName = "" THEN RETURN END;
|
|
IF AddImport(backend.traceModuleName,traceModule,TRUE) THEN
|
|
IF AddImport(backend.traceModuleName,traceModule,TRUE) THEN
|
|
@@ -7169,7 +7118,6 @@ TYPE
|
|
END;
|
|
END;
|
|
END SystemTrace;
|
|
END SystemTrace;
|
|
|
|
|
|
-
|
|
|
|
PROCEDURE InitFields(type: SyntaxTree.Type; CONST adr: IntermediateCode.Operand; offset: LONGINT);
|
|
PROCEDURE InitFields(type: SyntaxTree.Type; CONST adr: IntermediateCode.Operand; offset: LONGINT);
|
|
VAR baseType: SyntaxTree.Type; imm,mem: IntermediateCode.Operand; dim,size: LONGINT;
|
|
VAR baseType: SyntaxTree.Type; imm,mem: IntermediateCode.Operand; dim,size: LONGINT;
|
|
variable: SyntaxTree.Variable; i: LONGINT; initializerOp: Operand;
|
|
variable: SyntaxTree.Variable; i: LONGINT; initializerOp: Operand;
|
|
@@ -7520,8 +7468,6 @@ TYPE
|
|
END;
|
|
END;
|
|
END MathArrayLenOrIncr;
|
|
END MathArrayLenOrIncr;
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
PROCEDURE ArrayLen(type: SyntaxTree.ArrayType; VAR operand: Operand; VAR dim: IntermediateCode.Operand; VAR result: Operand );
|
|
PROCEDURE ArrayLen(type: SyntaxTree.ArrayType; VAR operand: Operand; VAR dim: IntermediateCode.Operand; VAR result: Operand );
|
|
VAR val: LONGINT; res,res2: IntermediateCode.Operand; end,next: Label; t: SyntaxTree.Type; imm: IntermediateCode.Operand; hasDynamicPart: BOOLEAN;
|
|
VAR val: LONGINT; res,res2: IntermediateCode.Operand; end,next: Label; t: SyntaxTree.Type; imm: IntermediateCode.Operand; hasDynamicPart: BOOLEAN;
|
|
offset: LONGINT;
|
|
offset: LONGINT;
|
|
@@ -7615,7 +7561,6 @@ TYPE
|
|
variable.SetAccess(SyntaxTree.Hidden);
|
|
variable.SetAccess(SyntaxTree.Hidden);
|
|
variable.SetUntraced(untraced);
|
|
variable.SetUntraced(untraced);
|
|
|
|
|
|
-
|
|
|
|
IF v = NIL THEN
|
|
IF v = NIL THEN
|
|
temporaries.AddVariable(variable);
|
|
temporaries.AddVariable(variable);
|
|
|
|
|
|
@@ -7669,7 +7614,6 @@ TYPE
|
|
recordScope.AddVariable(variable);
|
|
recordScope.AddVariable(variable);
|
|
END AddVariable;
|
|
END AddVariable;
|
|
|
|
|
|
-
|
|
|
|
BEGIN
|
|
BEGIN
|
|
name := "@ArrayDescriptor";
|
|
name := "@ArrayDescriptor";
|
|
Basic.AppendNumber(name,dimensions);
|
|
Basic.AppendNumber(name,dimensions);
|
|
@@ -7750,10 +7694,9 @@ TYPE
|
|
ReleaseOperand(op);
|
|
ReleaseOperand(op);
|
|
END PushConstInteger;
|
|
END PushConstInteger;
|
|
|
|
|
|
-
|
|
|
|
PROCEDURE OpenInitializer(symbol: SyntaxTree.Symbol; scope: SyntaxTree.Scope): IntermediateCode.Section;
|
|
PROCEDURE OpenInitializer(symbol: SyntaxTree.Symbol; scope: SyntaxTree.Scope): IntermediateCode.Section;
|
|
VAR name: Basic.SegmentedName; procedure: SyntaxTree.Procedure; procedureScope: SyntaxTree.ProcedureScope;
|
|
VAR name: Basic.SegmentedName; procedure: SyntaxTree.Procedure; procedureScope: SyntaxTree.ProcedureScope;
|
|
- section: IntermediateCode.Section;
|
|
|
|
|
|
+ section: IntermediateCode.Section;
|
|
BEGIN
|
|
BEGIN
|
|
procedureScope := SyntaxTree.NewProcedureScope(scope);
|
|
procedureScope := SyntaxTree.NewProcedureScope(scope);
|
|
Global.GetSymbolSegmentedName(symbol, name);
|
|
Global.GetSymbolSegmentedName(symbol, name);
|
|
@@ -7934,8 +7877,6 @@ TYPE
|
|
|
|
|
|
END AddPorts;
|
|
END AddPorts;
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
PROCEDURE AddProperty(cellType: SyntaxTree.CellType; cell: SyntaxTree.Symbol; property: SyntaxTree.Property; value: SyntaxTree.Expression);
|
|
PROCEDURE AddProperty(cellType: SyntaxTree.CellType; cell: SyntaxTree.Symbol; property: SyntaxTree.Property; value: SyntaxTree.Expression);
|
|
VAR name: ARRAY 256 OF CHAR; op: Operand; left, d: SyntaxTree.Designator;
|
|
VAR name: ARRAY 256 OF CHAR; op: Operand; left, d: SyntaxTree.Designator;
|
|
BEGIN
|
|
BEGIN
|
|
@@ -8084,7 +8025,6 @@ TYPE
|
|
END;
|
|
END;
|
|
END AddPortProperties;
|
|
END AddPortProperties;
|
|
|
|
|
|
-
|
|
|
|
PROCEDURE PushPort(p: SyntaxTree.Expression);
|
|
PROCEDURE PushPort(p: SyntaxTree.Expression);
|
|
VAR op: Operand;
|
|
VAR op: Operand;
|
|
BEGIN
|
|
BEGIN
|
|
@@ -8125,7 +8065,7 @@ TYPE
|
|
x := x(SyntaxTree.Designator).left;
|
|
x := x(SyntaxTree.Designator).left;
|
|
END;
|
|
END;
|
|
RETURN x # NIL;
|
|
RETURN x # NIL;
|
|
- *)
|
|
|
|
|
|
+ *)
|
|
END OnHeap;
|
|
END OnHeap;
|
|
|
|
|
|
PROCEDURE VisitBuiltinCallDesignator*(x: SyntaxTree.BuiltinCallDesignator);
|
|
PROCEDURE VisitBuiltinCallDesignator*(x: SyntaxTree.BuiltinCallDesignator);
|
|
@@ -8207,7 +8147,6 @@ TYPE
|
|
END;
|
|
END;
|
|
END CallBodies;
|
|
END CallBodies;
|
|
|
|
|
|
-
|
|
|
|
PROCEDURE PushTD(type: SyntaxTree.Type);
|
|
PROCEDURE PushTD(type: SyntaxTree.Type);
|
|
VAR op: IntermediateCode.Operand;
|
|
VAR op: IntermediateCode.Operand;
|
|
BEGIN
|
|
BEGIN
|
|
@@ -8222,7 +8161,6 @@ TYPE
|
|
END
|
|
END
|
|
END PushTD;
|
|
END PushTD;
|
|
|
|
|
|
-
|
|
|
|
BEGIN
|
|
BEGIN
|
|
IF Trace THEN TraceEnter("VisitBuiltinCallDesignator") END;
|
|
IF Trace THEN TraceEnter("VisitBuiltinCallDesignator") END;
|
|
|
|
|
|
@@ -8640,7 +8578,6 @@ TYPE
|
|
(* call bodies *)
|
|
(* call bodies *)
|
|
CallBodies(pointer,type);
|
|
CallBodies(pointer,type);
|
|
|
|
|
|
-
|
|
|
|
SetLabel(exit);
|
|
SetLabel(exit);
|
|
needsTrace := p0.NeedsTrace();
|
|
needsTrace := p0.NeedsTrace();
|
|
IF needsTrace THEN ModifyAssignments(true) END;
|
|
IF needsTrace THEN ModifyAssignments(true) END;
|
|
@@ -8761,16 +8698,16 @@ TYPE
|
|
type := type(SyntaxTree.PointerType).pointerBase.resolved;
|
|
type := type(SyntaxTree.PointerType).pointerBase.resolved;
|
|
IF ~backend.cooperative THEN (* simpler version *)
|
|
IF ~backend.cooperative THEN (* simpler version *)
|
|
(*
|
|
(*
|
|
- push len0
|
|
|
|
- push len1
|
|
|
|
- push len2
|
|
|
|
- push len_size
|
|
|
|
- push len_adr
|
|
|
|
|
|
+ push len0
|
|
|
|
+ push len1
|
|
|
|
+ push len2
|
|
|
|
+ push len_size
|
|
|
|
+ push len_adr
|
|
|
|
|
|
push tag
|
|
push tag
|
|
- push static elements
|
|
|
|
- push element size
|
|
|
|
- push adr
|
|
|
|
|
|
+ push static elements
|
|
|
|
+ push element size
|
|
|
|
+ push adr
|
|
*)
|
|
*)
|
|
|
|
|
|
dim := 0;
|
|
dim := 0;
|
|
@@ -8796,7 +8733,6 @@ TYPE
|
|
|
|
|
|
openDim := dim;
|
|
openDim := dim;
|
|
|
|
|
|
-
|
|
|
|
staticLength := 1;
|
|
staticLength := 1;
|
|
IF type IS SyntaxTree.ArrayType THEN
|
|
IF type IS SyntaxTree.ArrayType THEN
|
|
WHILE (type IS SyntaxTree.ArrayType) DO (* static array *)
|
|
WHILE (type IS SyntaxTree.ArrayType) DO (* static array *)
|
|
@@ -8814,7 +8750,6 @@ TYPE
|
|
staticLength := ToMemoryUnits(system,system.AlignedSizeOf(type));
|
|
staticLength := ToMemoryUnits(system,system.AlignedSizeOf(type));
|
|
Emit(Push(position, IntermediateCode.Immediate(sizeType, staticLength))); (* element size *)
|
|
Emit(Push(position, IntermediateCode.Immediate(sizeType, staticLength))); (* element size *)
|
|
|
|
|
|
-
|
|
|
|
Designate(p0,l);
|
|
Designate(p0,l);
|
|
Emit(Push(position,l.op)); (* address *)
|
|
Emit(Push(position,l.op)); (* address *)
|
|
ReleaseOperand(l);
|
|
ReleaseOperand(l);
|
|
@@ -9071,15 +9006,15 @@ TYPE
|
|
*)
|
|
*)
|
|
ELSE
|
|
ELSE
|
|
(*
|
|
(*
|
|
- push len0
|
|
|
|
- push len1
|
|
|
|
- push len2
|
|
|
|
-
|
|
|
|
- push size
|
|
|
|
- push len_adr
|
|
|
|
- push element_size
|
|
|
|
- push tag
|
|
|
|
- push adr
|
|
|
|
|
|
+ push len0
|
|
|
|
+ push len1
|
|
|
|
+ push len2
|
|
|
|
+
|
|
|
|
+ push size
|
|
|
|
+ push len_adr
|
|
|
|
+ push element_size
|
|
|
|
+ push tag
|
|
|
|
+ push adr
|
|
*)
|
|
*)
|
|
|
|
|
|
dim := 0;
|
|
dim := 0;
|
|
@@ -9090,7 +9025,6 @@ TYPE
|
|
isTensor := FALSE;
|
|
isTensor := FALSE;
|
|
END;
|
|
END;
|
|
|
|
|
|
-
|
|
|
|
FOR i := x.parameters.Length()-1 TO firstPar BY -1 DO
|
|
FOR i := x.parameters.Length()-1 TO firstPar BY -1 DO
|
|
IF ~isTensor THEN
|
|
IF ~isTensor THEN
|
|
type := type(SyntaxTree.MathArrayType).arrayBase.resolved;
|
|
type := type(SyntaxTree.MathArrayType).arrayBase.resolved;
|
|
@@ -9121,7 +9055,6 @@ TYPE
|
|
baseType := SemanticChecker.ArrayBase(type,openDim);
|
|
baseType := SemanticChecker.ArrayBase(type,openDim);
|
|
END;
|
|
END;
|
|
|
|
|
|
-
|
|
|
|
staticLength := ToMemoryUnits(system,system.AlignedSizeOf(baseType));
|
|
staticLength := ToMemoryUnits(system,system.AlignedSizeOf(baseType));
|
|
Emit(Push(position, IntermediateCode.Immediate(sizeType, staticLength)));
|
|
Emit(Push(position, IntermediateCode.Immediate(sizeType, staticLength)));
|
|
|
|
|
|
@@ -9193,14 +9126,12 @@ TYPE
|
|
(* allocate *)
|
|
(* allocate *)
|
|
CallThis(position,"ActiveCellsRuntime","Allocate",7);
|
|
CallThis(position,"ActiveCellsRuntime","Allocate",7);
|
|
|
|
|
|
-
|
|
|
|
Symbol(temporaryVariable,l); (*Designate(temporaryVariable,l)*)
|
|
Symbol(temporaryVariable,l); (*Designate(temporaryVariable,l)*)
|
|
(* l.op contains address of pointer to record *)
|
|
(* l.op contains address of pointer to record *)
|
|
ToMemory(l.op,addressType,0);
|
|
ToMemory(l.op,addressType,0);
|
|
(* l.op contains value of pointer to record *)
|
|
(* l.op contains value of pointer to record *)
|
|
InitFields(baseType, l.op,0);
|
|
InitFields(baseType, l.op,0);
|
|
|
|
|
|
-
|
|
|
|
(* add capabilities *)
|
|
(* add capabilities *)
|
|
modifier := p0(SyntaxTree.Designator).modifiers;
|
|
modifier := p0(SyntaxTree.Designator).modifiers;
|
|
|
|
|
|
@@ -9219,7 +9150,6 @@ TYPE
|
|
*)
|
|
*)
|
|
AddModifiers(baseType(SyntaxTree.CellType), temporaryVariable, modifier);
|
|
AddModifiers(baseType(SyntaxTree.CellType), temporaryVariable, modifier);
|
|
|
|
|
|
-
|
|
|
|
Symbol(temporaryVariable,l); (*Designate(temporaryVariable,l)*)
|
|
Symbol(temporaryVariable,l); (*Designate(temporaryVariable,l)*)
|
|
(* l.op contains address of pointer to record *)
|
|
(* l.op contains address of pointer to record *)
|
|
ToMemory(l.op,addressType,0);
|
|
ToMemory(l.op,addressType,0);
|
|
@@ -9228,7 +9158,6 @@ TYPE
|
|
ReleaseOperand(l);
|
|
ReleaseOperand(l);
|
|
CallThis(position,"ActiveCellsRuntime","FinishedProperties",1);
|
|
CallThis(position,"ActiveCellsRuntime","FinishedProperties",1);
|
|
|
|
|
|
-
|
|
|
|
prevScope := currentScope;
|
|
prevScope := currentScope;
|
|
init := OpenInitializer(temporaryVariable, baseType(SyntaxTree.CellType).cellScope);
|
|
init := OpenInitializer(temporaryVariable, baseType(SyntaxTree.CellType).cellScope);
|
|
previous := section;
|
|
previous := section;
|
|
@@ -9630,7 +9559,6 @@ TYPE
|
|
Emit(Push(position,s2.op));
|
|
Emit(Push(position,s2.op));
|
|
END;
|
|
END;
|
|
|
|
|
|
-
|
|
|
|
(*
|
|
(*
|
|
Emit(Push(position,IntermediateCode.Immediate(addressType,size)));
|
|
Emit(Push(position,IntermediateCode.Immediate(addressType,size)));
|
|
*)
|
|
*)
|
|
@@ -10637,7 +10565,6 @@ TYPE
|
|
RETURN i;
|
|
RETURN i;
|
|
END GetAvailability;
|
|
END GetAvailability;
|
|
|
|
|
|
-
|
|
|
|
PROCEDURE VisitVariable*(x: SyntaxTree.Variable);
|
|
PROCEDURE VisitVariable*(x: SyntaxTree.Variable);
|
|
VAR symbol: Sections.Section; type: SyntaxTree.Type; recordType: SyntaxTree.RecordType; name: Basic.SegmentedName; temp: IntermediateCode.Operand; reg: LONGINT;
|
|
VAR symbol: Sections.Section; type: SyntaxTree.Type; recordType: SyntaxTree.RecordType; name: Basic.SegmentedName; temp: IntermediateCode.Operand; reg: LONGINT;
|
|
BEGIN
|
|
BEGIN
|
|
@@ -10964,7 +10891,6 @@ TYPE
|
|
VExpression(x.expression);
|
|
VExpression(x.expression);
|
|
END VisitAlias;
|
|
END VisitAlias;
|
|
|
|
|
|
-
|
|
|
|
(** statements *)
|
|
(** statements *)
|
|
|
|
|
|
PROCEDURE VisitProcedureCallStatement*(x: SyntaxTree.ProcedureCallStatement);
|
|
PROCEDURE VisitProcedureCallStatement*(x: SyntaxTree.ProcedureCallStatement);
|
|
@@ -11435,7 +11361,6 @@ TYPE
|
|
END;
|
|
END;
|
|
END VisitCommunicationStatement;
|
|
END VisitCommunicationStatement;
|
|
|
|
|
|
-
|
|
|
|
PROCEDURE VisitIfStatement*(x: SyntaxTree.IfStatement);
|
|
PROCEDURE VisitIfStatement*(x: SyntaxTree.IfStatement);
|
|
VAR end: Label; i,elsifs: LONGINT; elsif: SyntaxTree.IfPart; escape: BOOLEAN;
|
|
VAR end: Label; i,elsifs: LONGINT; elsif: SyntaxTree.IfPart; escape: BOOLEAN;
|
|
|
|
|
|
@@ -11643,7 +11568,6 @@ TYPE
|
|
IF Trace THEN TraceExit("VisitCaseStatement") END;
|
|
IF Trace THEN TraceExit("VisitCaseStatement") END;
|
|
END VisitCaseStatement;
|
|
END VisitCaseStatement;
|
|
|
|
|
|
-
|
|
|
|
PROCEDURE VisitWhileStatement*(x: SyntaxTree.WhileStatement);
|
|
PROCEDURE VisitWhileStatement*(x: SyntaxTree.WhileStatement);
|
|
VAR startL,falseL: Label;
|
|
VAR startL,falseL: Label;
|
|
BEGIN
|
|
BEGIN
|
|
@@ -11688,7 +11612,6 @@ TYPE
|
|
temporaryVariableDesignator := SyntaxTree.NewSymbolDesignator(Basic.invalidPosition, NIL, temporaryVariable);
|
|
temporaryVariableDesignator := SyntaxTree.NewSymbolDesignator(Basic.invalidPosition, NIL, temporaryVariable);
|
|
temporaryVariableDesignator.SetType(x.variable.type.resolved);
|
|
temporaryVariableDesignator.SetType(x.variable.type.resolved);
|
|
|
|
|
|
-
|
|
|
|
Assign(temporaryVariableDesignator,x.to);
|
|
Assign(temporaryVariableDesignator,x.to);
|
|
IF x.by = NIL THEN by := 1 ELSE by := x.by.resolved(SyntaxTree.IntegerValue).value END;
|
|
IF x.by = NIL THEN by := 1 ELSE by := x.by.resolved(SyntaxTree.IntegerValue).value END;
|
|
IF by > 0 THEN
|
|
IF by > 0 THEN
|
|
@@ -12236,7 +12159,6 @@ TYPE
|
|
RETURN ProcedureParametersSize(system, procedure);
|
|
RETURN ProcedureParametersSize(system, procedure);
|
|
END ProcParametersSize;
|
|
END ProcParametersSize;
|
|
|
|
|
|
-
|
|
|
|
PROCEDURE ParameterCopies(x: SyntaxTree.ProcedureType);
|
|
PROCEDURE ParameterCopies(x: SyntaxTree.ProcedureType);
|
|
VAR parameter: SyntaxTree.Parameter; type, base: SyntaxTree.Type;
|
|
VAR parameter: SyntaxTree.Parameter; type, base: SyntaxTree.Type;
|
|
op: Operand; temp,size,par,dst, length,null: IntermediateCode.Operand;
|
|
op: Operand; temp,size,par,dst, length,null: IntermediateCode.Operand;
|
|
@@ -12349,7 +12271,6 @@ TYPE
|
|
END;
|
|
END;
|
|
END GetFingerprint;
|
|
END GetFingerprint;
|
|
|
|
|
|
-
|
|
|
|
PROCEDURE Body(x: SyntaxTree.Body; scope: SyntaxTree.Scope; ir: IntermediateCode.Section; moduleBody: BOOLEAN);
|
|
PROCEDURE Body(x: SyntaxTree.Body; scope: SyntaxTree.Scope; ir: IntermediateCode.Section; moduleBody: BOOLEAN);
|
|
VAR prevScope: SyntaxTree.Scope; procedureType: SyntaxTree.ProcedureType; procedure: SyntaxTree.Procedure;
|
|
VAR prevScope: SyntaxTree.Scope; procedureType: SyntaxTree.ProcedureType; procedure: SyntaxTree.Procedure;
|
|
cellScope: SyntaxTree.CellScope; op: Operand; string: SyntaxTree.IdentifierString;
|
|
cellScope: SyntaxTree.CellScope; op: Operand; string: SyntaxTree.IdentifierString;
|
|
@@ -12371,7 +12292,6 @@ TYPE
|
|
dump := NIL;
|
|
dump := NIL;
|
|
END;
|
|
END;
|
|
|
|
|
|
-
|
|
|
|
prevScope := currentScope;
|
|
prevScope := currentScope;
|
|
currentScope := scope;
|
|
currentScope := scope;
|
|
|
|
|
|
@@ -12409,7 +12329,6 @@ TYPE
|
|
|
|
|
|
InitVariables(scope);
|
|
InitVariables(scope);
|
|
|
|
|
|
-
|
|
|
|
IF backend.preciseGC & (x.code = NIL) & (~procedureType.noPAF) & ~procedure.isEntry & ~procedure.isExit THEN
|
|
IF backend.preciseGC & (x.code = NIL) & (~procedureType.noPAF) & ~procedure.isEntry & ~procedure.isExit THEN
|
|
GetCodeSectionNameForSymbol(procedure, name);
|
|
GetCodeSectionNameForSymbol(procedure, name);
|
|
Basic.SuffixSegmentedName (name, Basic.MakeString ("@Descriptor"));
|
|
Basic.SuffixSegmentedName (name, Basic.MakeString ("@Descriptor"));
|
|
@@ -12464,12 +12383,12 @@ TYPE
|
|
declarationVisitor: DeclarationVisitor;
|
|
declarationVisitor: DeclarationVisitor;
|
|
module: Sections.Module;
|
|
module: Sections.Module;
|
|
moduleName: ARRAY 128 OF CHAR;
|
|
moduleName: ARRAY 128 OF CHAR;
|
|
- moduleNamePool: Basic.HashTableInt;
|
|
|
|
- moduleNamePoolSection: IntermediateCode.Section;
|
|
|
|
- modulePointerSection: IntermediateCode.Section;
|
|
|
|
- modulePointerSizePC: LONGINT;
|
|
|
|
- modulePointerSectionOffset: LONGINT;
|
|
|
|
- modulePointers: LONGINT;
|
|
|
|
|
|
+ moduleNamePool: Basic.HashTableInt;
|
|
|
|
+ moduleNamePoolSection: IntermediateCode.Section;
|
|
|
|
+ modulePointerSection: IntermediateCode.Section;
|
|
|
|
+ modulePointerSizePC: LONGINT;
|
|
|
|
+ modulePointerSectionOffset: LONGINT;
|
|
|
|
+ modulePointers: LONGINT;
|
|
|
|
|
|
simple: BOOLEAN; (* simple = no module loading, no reflection *)
|
|
simple: BOOLEAN; (* simple = no module loading, no reflection *)
|
|
|
|
|
|
@@ -12484,7 +12403,6 @@ TYPE
|
|
CONST
|
|
CONST
|
|
EmptyBlockOffset = 2;
|
|
EmptyBlockOffset = 2;
|
|
|
|
|
|
-
|
|
|
|
PROCEDURE &InitMetaDataGenerator(implementationVisitor: ImplementationVisitor; declarationVisitor: DeclarationVisitor; simple: BOOLEAN);
|
|
PROCEDURE &InitMetaDataGenerator(implementationVisitor: ImplementationVisitor; declarationVisitor: DeclarationVisitor; simple: BOOLEAN);
|
|
BEGIN
|
|
BEGIN
|
|
IF implementationVisitor.backend.cooperative THEN
|
|
IF implementationVisitor.backend.cooperative THEN
|
|
@@ -12634,7 +12552,6 @@ TYPE
|
|
section.Emit(Data(Basic.invalidPosition,op));
|
|
section.Emit(Data(Basic.invalidPosition,op));
|
|
END Size;
|
|
END Size;
|
|
|
|
|
|
-
|
|
|
|
PROCEDURE Set(section: IntermediateCode.Section; value: Basic.Set);
|
|
PROCEDURE Set(section: IntermediateCode.Section; value: Basic.Set);
|
|
VAR op: IntermediateCode.Operand;
|
|
VAR op: IntermediateCode.Operand;
|
|
BEGIN
|
|
BEGIN
|
|
@@ -12714,7 +12631,6 @@ TYPE
|
|
String(section, s);
|
|
String(section, s);
|
|
END String0;
|
|
END String0;
|
|
|
|
|
|
-
|
|
|
|
PROCEDURE NamedSymbol(section: IntermediateCode.Section; name: Basic.SegmentedName; symbol: SyntaxTree.Symbol; virtualOffset, realOffset: LONGINT);
|
|
PROCEDURE NamedSymbol(section: IntermediateCode.Section; name: Basic.SegmentedName; symbol: SyntaxTree.Symbol; virtualOffset, realOffset: LONGINT);
|
|
VAR op: IntermediateCode.Operand;
|
|
VAR op: IntermediateCode.Operand;
|
|
BEGIN
|
|
BEGIN
|
|
@@ -12731,7 +12647,6 @@ TYPE
|
|
section.EmitAt(pc, Data(Basic.invalidPosition,op));
|
|
section.EmitAt(pc, Data(Basic.invalidPosition,op));
|
|
END NamedSymbolAt;
|
|
END NamedSymbolAt;
|
|
|
|
|
|
-
|
|
|
|
PROCEDURE Symbol(section: IntermediateCode.Section; symbol: Sections.Section; virtualOffset, realOffset: LONGINT);
|
|
PROCEDURE Symbol(section: IntermediateCode.Section; symbol: Sections.Section; virtualOffset, realOffset: LONGINT);
|
|
BEGIN
|
|
BEGIN
|
|
IF symbol= NIL THEN
|
|
IF symbol= NIL THEN
|
|
@@ -12911,8 +12826,6 @@ TYPE
|
|
RETURN section
|
|
RETURN section
|
|
END NamedBlock;
|
|
END NamedBlock;
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
PROCEDURE Block(CONST mName, typeName, suffix: ARRAY OF CHAR; VAR offset: LONGINT): IntermediateCode.Section;
|
|
PROCEDURE Block(CONST mName, typeName, suffix: ARRAY OF CHAR; VAR offset: LONGINT): IntermediateCode.Section;
|
|
VAR name: ARRAY 128 OF CHAR; pooledName: Basic.SegmentedName;
|
|
VAR name: ARRAY 128 OF CHAR; pooledName: Basic.SegmentedName;
|
|
BEGIN
|
|
BEGIN
|
|
@@ -13082,7 +12995,6 @@ TYPE
|
|
scopes[0].section := source;
|
|
scopes[0].section := source;
|
|
scopes[0].arraySizePC := MIN(LONGINT);
|
|
scopes[0].arraySizePC := MIN(LONGINT);
|
|
|
|
|
|
-
|
|
|
|
FOR s := 0 TO LEN(sections)-1 DO
|
|
FOR s := 0 TO LEN(sections)-1 DO
|
|
symbol := sections[s];
|
|
symbol := sections[s];
|
|
IF (symbol # NIL) & (implementationVisitor.backend.cooperative) & (symbol.symbol = NIL) OR (symbol.symbol # NIL) & (symbol.type # Sections.InitCodeSection) & (symbol.type # Sections.EntryCodeSection) & (symbol.type # Sections.ExitCodeSection) & (symbol.type # Sections.InlineCodeSection) THEN
|
|
IF (symbol # NIL) & (implementationVisitor.backend.cooperative) & (symbol.symbol = NIL) OR (symbol.symbol # NIL) & (symbol.type # Sections.InitCodeSection) & (symbol.type # Sections.EntryCodeSection) & (symbol.type # Sections.ExitCodeSection) & (symbol.type # Sections.InlineCodeSection) THEN
|
|
@@ -13175,7 +13087,6 @@ TYPE
|
|
Export(sectionArray^);
|
|
Export(sectionArray^);
|
|
END ExportDesc;
|
|
END ExportDesc;
|
|
|
|
|
|
-
|
|
|
|
PROCEDURE ExceptionArray(source: IntermediateCode.Section);
|
|
PROCEDURE ExceptionArray(source: IntermediateCode.Section);
|
|
VAR
|
|
VAR
|
|
p: Sections.Section; finallyPC, sizePC, size, i: LONGINT;
|
|
p: Sections.Section; finallyPC, sizePC, size, i: LONGINT;
|
|
@@ -13277,7 +13188,7 @@ TYPE
|
|
sfScopeBegin = 0F0X;
|
|
sfScopeBegin = 0F0X;
|
|
sfScopeEnd = 0F1X;
|
|
sfScopeEnd = 0F1X;
|
|
sfProcedure = 0F2X;
|
|
sfProcedure = 0F2X;
|
|
- sfVariable = 0F3X;
|
|
|
|
|
|
+ sfVariable = 0F3X;
|
|
sfTypeDeclaration = 0F4X;
|
|
sfTypeDeclaration = 0F4X;
|
|
sfModule = 0FFX;
|
|
sfModule = 0FFX;
|
|
|
|
|
|
@@ -13287,7 +13198,6 @@ TYPE
|
|
sizePC, startPC, lastOffset: LONGINT;
|
|
sizePC, startPC, lastOffset: LONGINT;
|
|
indirectTypes: Basic.HashTable;
|
|
indirectTypes: Basic.HashTable;
|
|
|
|
|
|
-
|
|
|
|
PROCEDURE CurrentIndex(): LONGINT;
|
|
PROCEDURE CurrentIndex(): LONGINT;
|
|
VAR i: LONGINT;
|
|
VAR i: LONGINT;
|
|
BEGIN
|
|
BEGIN
|
|
@@ -13783,8 +13693,6 @@ TYPE
|
|
Char(section, sfScopeEnd); (* scope ends *)
|
|
Char(section, sfScopeEnd); (* scope ends *)
|
|
END NScope;
|
|
END NScope;
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
BEGIN
|
|
BEGIN
|
|
NEW(indirectTypes, 32);
|
|
NEW(indirectTypes, 32);
|
|
ArrayBlock(section,sizePC,"", FALSE);
|
|
ArrayBlock(section,sizePC,"", FALSE);
|
|
@@ -14056,7 +13964,6 @@ TYPE
|
|
PatchArray(section, sizePC, numberProcs);
|
|
PatchArray(section, sizePC, numberProcs);
|
|
END ProcedureDescriptorArray;
|
|
END ProcedureDescriptorArray;
|
|
|
|
|
|
-
|
|
|
|
(*
|
|
(*
|
|
Module* = OBJECT (Heaps.RootObject) (* cf. Linker0 & Heaps.WriteType *)
|
|
Module* = OBJECT (Heaps.RootObject) (* cf. Linker0 & Heaps.WriteType *)
|
|
VAR
|
|
VAR
|
|
@@ -14333,7 +14240,6 @@ TYPE
|
|
END;
|
|
END;
|
|
END PatchCRC;
|
|
END PatchCRC;
|
|
|
|
|
|
-
|
|
|
|
PROCEDURE PointerArray(source: IntermediateCode.Section; scope: SyntaxTree.Scope; VAR numberPointers: LONGINT);
|
|
PROCEDURE PointerArray(source: IntermediateCode.Section; scope: SyntaxTree.Scope; VAR numberPointers: LONGINT);
|
|
VAR variable: SyntaxTree.Variable; pc: LONGINT; symbol: Sections.Section; parameter: SyntaxTree.Parameter; parametersSize: LONGINT;
|
|
VAR variable: SyntaxTree.Variable; pc: LONGINT; symbol: Sections.Section; parameter: SyntaxTree.Parameter; parametersSize: LONGINT;
|
|
BEGIN
|
|
BEGIN
|
|
@@ -14611,7 +14517,6 @@ TYPE
|
|
source.SetExported(IsExported(td));
|
|
source.SetExported(IsExported(td));
|
|
END;
|
|
END;
|
|
|
|
|
|
-
|
|
|
|
Info(source, "parent");
|
|
Info(source, "parent");
|
|
IF baseRecord # NIL THEN
|
|
IF baseRecord # NIL THEN
|
|
Global.GetSymbolSegmentedName(baseTD,name);
|
|
Global.GetSymbolSegmentedName(baseTD,name);
|
|
@@ -14661,7 +14566,7 @@ TYPE
|
|
---
|
|
---
|
|
TypeDesc = TypeInfoAdr
|
|
TypeDesc = TypeInfoAdr
|
|
---
|
|
---
|
|
- td adr ---> rec size
|
|
|
|
|
|
+ td adr ---> rec size
|
|
----
|
|
----
|
|
pointer offsets
|
|
pointer offsets
|
|
----
|
|
----
|
|
@@ -14755,7 +14660,6 @@ TYPE
|
|
|
|
|
|
END MetaDataGenerator;
|
|
END MetaDataGenerator;
|
|
|
|
|
|
-
|
|
|
|
IntermediateBackend*= OBJECT (IntermediateCode.IntermediateBackend)
|
|
IntermediateBackend*= OBJECT (IntermediateCode.IntermediateBackend)
|
|
VAR
|
|
VAR
|
|
trace-: BOOLEAN;
|
|
trace-: BOOLEAN;
|
|
@@ -14773,8 +14677,6 @@ TYPE
|
|
preciseGC, trackLeave, writeBarriers: BOOLEAN;
|
|
preciseGC, trackLeave, writeBarriers: BOOLEAN;
|
|
experiment: BOOLEAN;
|
|
experiment: BOOLEAN;
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
PROCEDURE &InitIntermediateBackend*;
|
|
PROCEDURE &InitIntermediateBackend*;
|
|
BEGIN
|
|
BEGIN
|
|
simpleMetaData := FALSE;
|
|
simpleMetaData := FALSE;
|
|
@@ -14927,25 +14829,18 @@ TYPE
|
|
BEGIN RETURN SymbolFileFormat.Get()
|
|
BEGIN RETURN SymbolFileFormat.Get()
|
|
END DefaultSymbolFileFormat;
|
|
END DefaultSymbolFileFormat;
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
END IntermediateBackend;
|
|
END IntermediateBackend;
|
|
|
|
|
|
-
|
|
|
|
(* ----------------------------------- register allocation ------------------------------------- *)
|
|
(* ----------------------------------- register allocation ------------------------------------- *)
|
|
|
|
|
|
-
|
|
|
|
(* register mapping scheme
|
|
(* register mapping scheme
|
|
- virtual register number --> register mapping = part(0) --> ticket <--> physical register
|
|
|
|
|
|
+ virtual register number --> register mapping = part(0) --> ticket <--> physical register
|
|
spill offset
|
|
spill offset
|
|
|
|
|
|
part(n) --> ticket <--> physical register
|
|
part(n) --> ticket <--> physical register
|
|
spill offset
|
|
spill offset
|
|
*)
|
|
*)
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
VAR int8-, int16-, int32-, int64-, uint8-, uint16-, uint32-, uint64-, float32-, float64-: IntermediateCode.Type;
|
|
VAR int8-, int16-, int32-, int64-, uint8-, uint16-, uint32-, uint64-, float32-, float64-: IntermediateCode.Type;
|
|
emptyOperand: IntermediateCode.Operand;
|
|
emptyOperand: IntermediateCode.Operand;
|
|
systemCalls: ARRAY NumberSystemCalls OF SyntaxTree.Symbol;
|
|
systemCalls: ARRAY NumberSystemCalls OF SyntaxTree.Symbol;
|
|
@@ -14981,7 +14876,6 @@ TYPE
|
|
statCoopTraceModule)
|
|
statCoopTraceModule)
|
|
END Statistics;
|
|
END Statistics;
|
|
|
|
|
|
-
|
|
|
|
PROCEDURE GCD(a,b: LONGINT): LONGINT;
|
|
PROCEDURE GCD(a,b: LONGINT): LONGINT;
|
|
VAR h: LONGINT;
|
|
VAR h: LONGINT;
|
|
BEGIN
|
|
BEGIN
|
|
@@ -15272,7 +15166,6 @@ TYPE
|
|
RETURN (type IS SyntaxTree.ArrayType) & (type(SyntaxTree.ArrayType).form = SyntaxTree.SemiDynamic);
|
|
RETURN (type IS SyntaxTree.ArrayType) & (type(SyntaxTree.ArrayType).form = SyntaxTree.SemiDynamic);
|
|
END IsSemiDynamicArray;
|
|
END IsSemiDynamicArray;
|
|
|
|
|
|
-
|
|
|
|
PROCEDURE IsStaticArray(type: SyntaxTree.Type): BOOLEAN;
|
|
PROCEDURE IsStaticArray(type: SyntaxTree.Type): BOOLEAN;
|
|
BEGIN
|
|
BEGIN
|
|
IF type = NIL THEN RETURN FALSE END;
|
|
IF type = NIL THEN RETURN FALSE END;
|
|
@@ -15401,7 +15294,6 @@ TYPE
|
|
parSize := parSize + (-parSize) MOD system.addressSize;
|
|
parSize := parSize + (-parSize) MOD system.addressSize;
|
|
END;
|
|
END;
|
|
|
|
|
|
-
|
|
|
|
parameter :=procedureType.lastParameter;
|
|
parameter :=procedureType.lastParameter;
|
|
WHILE (parameter # NIL) DO
|
|
WHILE (parameter # NIL) DO
|
|
IF procedureType.callingConvention IN SysvABIorWINAPI THEN
|
|
IF procedureType.callingConvention IN SysvABIorWINAPI THEN
|
|
@@ -15413,7 +15305,6 @@ TYPE
|
|
parameter := parameter.prevParameter;
|
|
parameter := parameter.prevParameter;
|
|
END;
|
|
END;
|
|
|
|
|
|
-
|
|
|
|
IF procedureType.selfParameter # NIL THEN
|
|
IF procedureType.selfParameter # NIL THEN
|
|
parameter := procedureType.selfParameter;
|
|
parameter := procedureType.selfParameter;
|
|
INC(parSize,system.SizeOfParameter(parameter));
|
|
INC(parSize,system.SizeOfParameter(parameter));
|
|
@@ -15486,7 +15377,6 @@ TYPE
|
|
RETURN instruction
|
|
RETURN instruction
|
|
END Conv;
|
|
END Conv;
|
|
|
|
|
|
-
|
|
|
|
PROCEDURE Call*(position: Basic.Position;op: IntermediateCode.Operand; parSize: LONGINT): IntermediateCode.Instruction;
|
|
PROCEDURE Call*(position: Basic.Position;op: IntermediateCode.Operand; parSize: LONGINT): IntermediateCode.Instruction;
|
|
VAR instruction: IntermediateCode.Instruction;
|
|
VAR instruction: IntermediateCode.Instruction;
|
|
BEGIN
|
|
BEGIN
|
|
@@ -15520,7 +15410,7 @@ TYPE
|
|
END Result;
|
|
END Result;
|
|
|
|
|
|
PROCEDURE Trap(position: Basic.Position;nr: LONGINT): IntermediateCode.Instruction;
|
|
PROCEDURE Trap(position: Basic.Position;nr: LONGINT): IntermediateCode.Instruction;
|
|
- VAR op1: IntermediateCode.Operand;
|
|
|
|
|
|
+ VAR op1: IntermediateCode.Operand;
|
|
VAR instruction: IntermediateCode.Instruction;
|
|
VAR instruction: IntermediateCode.Instruction;
|
|
BEGIN
|
|
BEGIN
|
|
IntermediateCode.InitNumber(op1,nr);
|
|
IntermediateCode.InitNumber(op1,nr);
|
|
@@ -15733,7 +15623,6 @@ TYPE
|
|
RETURN instruction
|
|
RETURN instruction
|
|
END SpecialInstruction;
|
|
END SpecialInstruction;
|
|
|
|
|
|
-
|
|
|
|
PROCEDURE Reserve(position: Basic.Position;units: LONGINT): IntermediateCode.Instruction;
|
|
PROCEDURE Reserve(position: Basic.Position;units: LONGINT): IntermediateCode.Instruction;
|
|
VAR op1: IntermediateCode.Operand;
|
|
VAR op1: IntermediateCode.Operand;
|
|
VAR instruction: IntermediateCode.Instruction;
|
|
VAR instruction: IntermediateCode.Instruction;
|
|
@@ -15786,7 +15675,6 @@ TYPE
|
|
RETURN pc
|
|
RETURN pc
|
|
END EnterImmediate;
|
|
END EnterImmediate;
|
|
|
|
|
|
-
|
|
|
|
PROCEDURE Init;
|
|
PROCEDURE Init;
|
|
VAR i: LONGINT; name: SyntaxTree.IdentifierString;
|
|
VAR i: LONGINT; name: SyntaxTree.IdentifierString;
|
|
BEGIN
|
|
BEGIN
|
|
@@ -15815,14 +15703,11 @@ TYPE
|
|
RETURN (symbol # NIL) & symbol.NeedsSection();
|
|
RETURN (symbol # NIL) & symbol.NeedsSection();
|
|
END IsExported;
|
|
END IsExported;
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
BEGIN
|
|
BEGIN
|
|
Init;
|
|
Init;
|
|
|
|
|
|
END FoxIntermediateBackend.
|
|
END FoxIntermediateBackend.
|
|
|
|
|
|
-
|
|
|
|
Compiler.Compile -p=Win32 FoxIntermediateBackend.Mod ~
|
|
Compiler.Compile -p=Win32 FoxIntermediateBackend.Mod ~
|
|
|
|
|
|
# Release.Build --path="/temp/obg/" Win32 ~
|
|
# Release.Build --path="/temp/obg/" Win32 ~
|