-- SaffronStatementCompileImpl.mesa -- Copyright Ó 1987 by Xerox Corporation. All rights reserved. -- Generated by Rauen.pa at September 1, 1988 3:00:30 pm PDT -- using ThreeCasabaFour [1.2] of June 1, 1987 6:00:00 pm PDT DIRECTORY SaffronPGDef, SaffronAG4Def, ThreeC4Support, SaffronBaseDef, SaffronATDef; SaffronStatementCompileImpl: CEDAR PROGRAM IMPORTS SaffronPGDef, ThreeC4Support, SaffronBaseDef, SaffronATDef EXPORTS SaffronAG4Def= BEGIN OPEN SaffronPGDef, SaffronAG4Def, ThreeC4Support, SaffronBaseDef, SaffronATDef; StatementListemptyProdCompile: PUBLIC PROC[ref: REF ANY, contextTree: ContextTreeNode, pg: ProgramGraphNode, cs: CompilerStateNode] RETURNS[temp0: ContextTreeNode, temp1: ProgramFragmentNode, temp2: ProgramGraphNode] = BEGIN tree: StatementListNode_ NARROW[ref]; BEGIN ENABLE ThreeC4Support.GetSourceInfo => RESUME[tree.position, tree.length]; temp2 _ FakeDamageProgramGraph[pg]; temp1 _ MakePGNoOp[]; temp0 _ FakeDamageContextTree[contextTree]; END END; StatementListmoreProdCompile: PUBLIC PROC[ref: REF ANY, contextTree: ContextTreeNode, pg: ProgramGraphNode, cs: CompilerStateNode] RETURNS[temp0: ContextTreeNode, temp1: ProgramFragmentNode, temp2: ProgramGraphNode] = BEGIN tree: StatementListNode_ NARROW[ref]; BEGIN ENABLE ThreeC4Support.GetSourceInfo => RESUME[tree.position, tree.length]; treeData: StatementListmoreProdData _ NARROW[tree.data]; BEGIN pf3: ProgramFragmentNode; contextTree2: ContextTreeNode; pf2: ProgramFragmentNode; pg2: ProgramGraphNode; contextTree1: ContextTreeNode; pf1: ProgramFragmentNode; pg1: ProgramGraphNode; [contextTree1, pf1, pg1] _ treeData.StatementList.procs.Compile[treeData.StatementList, contextTree, pg, cs]; [contextTree2, pf2, pg2] _ treeData.Statement.procs.Compile[treeData.Statement, contextTree1, pg1, cs]; pf3 _ ConcatProgramFragments[pf1, pf2]; temp2 _ pg2; temp1 _ pf3; temp0 _ contextTree2; END; END END; StatementifthenProdCompile: PUBLIC PROC[ref: REF ANY, contextTree: ContextTreeNode, pg: ProgramGraphNode, cs: CompilerStateNode] RETURNS[temp0: ContextTreeNode, temp1: ProgramFragmentNode, temp2: ProgramGraphNode] = BEGIN tree: StatementNode_ NARROW[ref]; BEGIN ENABLE ThreeC4Support.GetSourceInfo => RESUME[tree.position, tree.length]; treeData: StatementifthenProdData _ NARROW[tree.data]; BEGIN code: ProgramFragmentNode; ifFalseCode: ProgramFragmentNode; contextTree2: ContextTreeNode; ifTrueCode: ProgramFragmentNode; pg1: ProgramGraphNode; testValue: ValueNode; contextTree1: ContextTreeNode; booleanType: TypeGraphNodeNode; booleanType _ GetIntrinsicBooleanType[cs]; [testValue, contextTree1] _ CompileAndTypeCheckExpression[treeData.Exp, contextTree, cs, booleanType]; [contextTree2, ifTrueCode, pg1] _ treeData.Statement.procs.Compile[treeData.Statement, contextTree1, pg, cs]; ifFalseCode _ MakePGNoOp[]; code _ MakePGTest[Code[testValue], ifTrueCode, ifFalseCode]; temp2 _ pg1; temp1 _ code; temp0 _ contextTree2; END; END END; StatementifthenelseProdCompile: PUBLIC PROC[ref: REF ANY, contextTree: ContextTreeNode, pg: ProgramGraphNode, cs: CompilerStateNode] RETURNS[temp0: ContextTreeNode, temp1: ProgramFragmentNode, temp2: ProgramGraphNode] = BEGIN tree: StatementNode_ NARROW[ref]; BEGIN ENABLE ThreeC4Support.GetSourceInfo => RESUME[tree.position, tree.length]; treeData: StatementifthenelseProdData _ NARROW[tree.data]; BEGIN code: ProgramFragmentNode; contextTree3: ContextTreeNode; ifFalseCode: ProgramFragmentNode; pg2: ProgramGraphNode; contextTree2: ContextTreeNode; ifTrueCode: ProgramFragmentNode; pg1: ProgramGraphNode; testCode: ProgramFragmentNode; testValue: ValueNode; contextTree1: ContextTreeNode; booleanType: TypeGraphNodeNode; booleanType _ GetIntrinsicBooleanType[cs]; [testValue, contextTree1] _ CompileAndTypeCheckExpression[treeData.Exp, contextTree, cs, booleanType]; testCode _ Code[testValue]; [contextTree2, ifTrueCode, pg1] _ treeData.Statementthenpart.procs.Compile[treeData.Statementthenpart, contextTree1, pg, cs]; [contextTree3, ifFalseCode, pg2] _ treeData.Statementelsepart.procs.Compile[treeData.Statementelsepart, contextTree2, pg1, cs]; code _ MakePGTest[testCode, ifTrueCode, ifFalseCode]; temp2 _ pg2; temp1 _ code; temp0 _ contextTree3; END; END END; StatementselectProdCompile: PUBLIC PROC[ref: REF ANY, contextTree: ContextTreeNode, pg: ProgramGraphNode, cs: CompilerStateNode] RETURNS[temp0: ContextTreeNode, temp1: ProgramFragmentNode, temp2: ProgramGraphNode] = BEGIN tree: StatementNode_ NARROW[ref]; BEGIN ENABLE ThreeC4Support.GetSourceInfo => RESUME[tree.position, tree.length]; treeData: StatementselectProdData _ NARROW[tree.data]; BEGIN err: BOOLEAN; err _ Error["Compile for Statement.select not implemented yet."]; temp2 _ FakeDamageProgramGraph[pg]; temp1 _ MakePGNoOp[]; temp0 _ FakeDamageContextTree[contextTree]; END; END END; StatementexpProdCompile: PUBLIC PROC[ref: REF ANY, contextTree: ContextTreeNode, pg: ProgramGraphNode, cs: CompilerStateNode] RETURNS[temp0: ContextTreeNode, temp1: ProgramFragmentNode, temp2: ProgramGraphNode] = BEGIN tree: StatementNode_ NARROW[ref]; BEGIN ENABLE ThreeC4Support.GetSourceInfo => RESUME[tree.position, tree.length]; treeData: StatementexpProdData _ NARROW[tree.data]; BEGIN err: BOOLEAN; err _ Error["Compile for Statement.exp not implemented yet."]; temp2 _ FakeDamageProgramGraph[pg]; temp1 _ MakePGNoOp[]; temp0 _ FakeDamageContextTree[contextTree]; END; END END; StatementassignProdCompile: PUBLIC PROC[ref: REF ANY, contextTree: ContextTreeNode, pg: ProgramGraphNode, cs: CompilerStateNode] RETURNS[temp0: ContextTreeNode, temp1: ProgramFragmentNode, temp2: ProgramGraphNode] = BEGIN tree: StatementNode_ NARROW[ref]; BEGIN ENABLE ThreeC4Support.GetSourceInfo => RESUME[tree.position, tree.length]; treeData: StatementassignProdData _ NARROW[tree.data]; BEGIN code: ProgramFragmentNode; storeTOS: ProgramFragmentNode; rhsValue: ValueNode; contextTree1: ContextTreeNode; lvalue: ParameterizedFieldDescriptorNode; tgn: TypeGraphNodeNode; [lvalue, tgn] _ treeData.Explhs.procs.CompileLValue[treeData.Explhs, contextTree, cs]; [rhsValue, contextTree1] _ CompileAndTypeCheckExpression[treeData.Exprhs, contextTree, cs, tgn]; IF PFDIsLocal[lvalue] THEN {storeTOS _ MakePGStoreLocal[lvalue]; } ELSE {storeTOS _ MakePGStoreIndirect[lvalue]; }; code _ ConcatProgramFragments[Code[rhsValue], storeTOS]; temp2 _ FakeDamageProgramGraph[pg]; temp1 _ code; temp0 _ contextTree1; END; END END; StatementmultiassignProdCompile: PUBLIC PROC[ref: REF ANY, contextTree: ContextTreeNode, pg: ProgramGraphNode, cs: CompilerStateNode] RETURNS[temp0: ContextTreeNode, temp1: ProgramFragmentNode, temp2: ProgramGraphNode] = BEGIN tree: StatementNode_ NARROW[ref]; BEGIN ENABLE ThreeC4Support.GetSourceInfo => RESUME[tree.position, tree.length]; treeData: StatementmultiassignProdData _ NARROW[tree.data]; BEGIN err: BOOLEAN; err _ Error["Compile for Statement.multiassign not implemented yet."]; temp2 _ FakeDamageProgramGraph[pg]; temp1 _ MakePGNoOp[]; temp0 _ FakeDamageContextTree[contextTree]; END; END END; StatementblockProdCompile: PUBLIC PROC[ref: REF ANY, contextTree: ContextTreeNode, pg: ProgramGraphNode, cs: CompilerStateNode] RETURNS[temp0: ContextTreeNode, temp1: ProgramFragmentNode, temp2: ProgramGraphNode] = BEGIN tree: StatementNode_ NARROW[ref]; BEGIN ENABLE ThreeC4Support.GetSourceInfo => RESUME[tree.position, tree.length]; treeData: StatementblockProdData _ NARROW[tree.data]; [temp0, temp1, temp2] _ treeData.Block.procs.Compile[treeData.Block, contextTree, pg, cs]; END END; StatementloopcontrolProdCompile: PUBLIC PROC[ref: REF ANY, contextTree: ContextTreeNode, pg: ProgramGraphNode, cs: CompilerStateNode] RETURNS[temp0: ContextTreeNode, temp1: ProgramFragmentNode, temp2: ProgramGraphNode] = BEGIN tree: StatementNode_ NARROW[ref]; BEGIN ENABLE ThreeC4Support.GetSourceInfo => RESUME[tree.position, tree.length]; treeData: StatementloopcontrolProdData _ NARROW[tree.data]; BEGIN err: BOOLEAN; err _ Error["Compile for Statement.loopcontrol not implemented yet."]; temp2 _ FakeDamageProgramGraph[pg]; temp1 _ MakePGNoOp[]; temp0 _ FakeDamageContextTree[contextTree]; END; END END; StatementexitProdCompile: PUBLIC PROC[ref: REF ANY, contextTree: ContextTreeNode, pg: ProgramGraphNode, cs: CompilerStateNode] RETURNS[temp0: ContextTreeNode, temp1: ProgramFragmentNode, temp2: ProgramGraphNode] = BEGIN tree: StatementNode_ NARROW[ref]; BEGIN ENABLE ThreeC4Support.GetSourceInfo => RESUME[tree.position, tree.length]; BEGIN err: BOOLEAN; err _ Error["Compile for Statement.exit not implemented yet."]; temp2 _ FakeDamageProgramGraph[pg]; temp1 _ MakePGNoOp[]; temp0 _ FakeDamageContextTree[contextTree]; END; END END; StatementloopProdCompile: PUBLIC PROC[ref: REF ANY, contextTree: ContextTreeNode, pg: ProgramGraphNode, cs: CompilerStateNode] RETURNS[temp0: ContextTreeNode, temp1: ProgramFragmentNode, temp2: ProgramGraphNode] = BEGIN tree: StatementNode_ NARROW[ref]; BEGIN ENABLE ThreeC4Support.GetSourceInfo => RESUME[tree.position, tree.length]; BEGIN err: BOOLEAN; err _ Error["Compile for Statement.loop not implemented yet."]; temp2 _ FakeDamageProgramGraph[pg]; temp1 _ MakePGNoOp[]; temp0 _ FakeDamageContextTree[contextTree]; END; END END; StatementgotoProdCompile: PUBLIC PROC[ref: REF ANY, contextTree: ContextTreeNode, pg: ProgramGraphNode, cs: CompilerStateNode] RETURNS[temp0: ContextTreeNode, temp1: ProgramFragmentNode, temp2: ProgramGraphNode] = BEGIN tree: StatementNode_ NARROW[ref]; BEGIN ENABLE ThreeC4Support.GetSourceInfo => RESUME[tree.position, tree.length]; treeData: StatementgotoProdData _ NARROW[tree.data]; BEGIN err: BOOLEAN; err _ Error["Compile for Statement.goto not implemented yet."]; temp2 _ FakeDamageProgramGraph[pg]; temp1 _ MakePGNoOp[]; temp0 _ FakeDamageContextTree[contextTree]; END; END END; StatementreturnProdCompile: PUBLIC PROC[ref: REF ANY, contextTree: ContextTreeNode, pg: ProgramGraphNode, cs: CompilerStateNode] RETURNS[temp0: ContextTreeNode, temp1: ProgramFragmentNode, temp2: ProgramGraphNode] = BEGIN tree: StatementNode_ NARROW[ref]; BEGIN ENABLE ThreeC4Support.GetSourceInfo => RESUME[tree.position, tree.length]; treeData: StatementreturnProdData _ NARROW[tree.data]; BEGIN err: BOOLEAN; err _ Error["Compile for Statement.return not implemented yet."]; temp2 _ FakeDamageProgramGraph[pg]; temp1 _ MakePGNoOp[]; temp0 _ FakeDamageContextTree[contextTree]; END; END END; StatementtransferProdCompile: PUBLIC PROC[ref: REF ANY, contextTree: ContextTreeNode, pg: ProgramGraphNode, cs: CompilerStateNode] RETURNS[temp0: ContextTreeNode, temp1: ProgramFragmentNode, temp2: ProgramGraphNode] = BEGIN tree: StatementNode_ NARROW[ref]; BEGIN ENABLE ThreeC4Support.GetSourceInfo => RESUME[tree.position, tree.length]; treeData: StatementtransferProdData _ NARROW[tree.data]; BEGIN err: BOOLEAN; err _ Error["Compile for Statement.transfer not implemented yet."]; temp2 _ FakeDamageProgramGraph[pg]; temp1 _ MakePGNoOp[]; temp0 _ FakeDamageContextTree[contextTree]; END; END END; StatementfreeProdCompile: PUBLIC PROC[ref: REF ANY, contextTree: ContextTreeNode, pg: ProgramGraphNode, cs: CompilerStateNode] RETURNS[temp0: ContextTreeNode, temp1: ProgramFragmentNode, temp2: ProgramGraphNode] = BEGIN tree: StatementNode_ NARROW[ref]; BEGIN ENABLE ThreeC4Support.GetSourceInfo => RESUME[tree.position, tree.length]; treeData: StatementfreeProdData _ NARROW[tree.data]; BEGIN err: BOOLEAN; err _ Error["Compile for Statement.free not implemented yet."]; temp2 _ FakeDamageProgramGraph[pg]; temp1 _ MakePGNoOp[]; temp0 _ FakeDamageContextTree[contextTree]; END; END END; StatementwaitProdCompile: PUBLIC PROC[ref: REF ANY, contextTree: ContextTreeNode, pg: ProgramGraphNode, cs: CompilerStateNode] RETURNS[temp0: ContextTreeNode, temp1: ProgramFragmentNode, temp2: ProgramGraphNode] = BEGIN tree: StatementNode_ NARROW[ref]; BEGIN ENABLE ThreeC4Support.GetSourceInfo => RESUME[tree.position, tree.length]; treeData: StatementwaitProdData _ NARROW[tree.data]; BEGIN err: BOOLEAN; err _ Error["Compile for Statement.wait not implemented yet."]; temp2 _ FakeDamageProgramGraph[pg]; temp1 _ MakePGNoOp[]; temp0 _ FakeDamageContextTree[contextTree]; END; END END; StatementerrorProdCompile: PUBLIC PROC[ref: REF ANY, contextTree: ContextTreeNode, pg: ProgramGraphNode, cs: CompilerStateNode] RETURNS[temp0: ContextTreeNode, temp1: ProgramFragmentNode, temp2: ProgramGraphNode] = BEGIN tree: StatementNode_ NARROW[ref]; BEGIN ENABLE ThreeC4Support.GetSourceInfo => RESUME[tree.position, tree.length]; BEGIN err: BOOLEAN; err _ Error["Compile for Statement.error not implemented yet."]; temp2 _ FakeDamageProgramGraph[pg]; temp1 _ MakePGNoOp[]; temp0 _ FakeDamageContextTree[contextTree]; END; END END; StatementstopProdCompile: PUBLIC PROC[ref: REF ANY, contextTree: ContextTreeNode, pg: ProgramGraphNode, cs: CompilerStateNode] RETURNS[temp0: ContextTreeNode, temp1: ProgramFragmentNode, temp2: ProgramGraphNode] = BEGIN tree: StatementNode_ NARROW[ref]; BEGIN ENABLE ThreeC4Support.GetSourceInfo => RESUME[tree.position, tree.length]; BEGIN err: BOOLEAN; err _ Error["Compile for Statement.stop not implemented yet."]; temp2 _ FakeDamageProgramGraph[pg]; temp1 _ MakePGNoOp[]; temp0 _ FakeDamageContextTree[contextTree]; END; END END; StatementnullProdCompile: PUBLIC PROC[ref: REF ANY, contextTree: ContextTreeNode, pg: ProgramGraphNode, cs: CompilerStateNode] RETURNS[temp0: ContextTreeNode, temp1: ProgramFragmentNode, temp2: ProgramGraphNode] = BEGIN tree: StatementNode_ NARROW[ref]; BEGIN ENABLE ThreeC4Support.GetSourceInfo => RESUME[tree.position, tree.length]; temp2 _ FakeDamageProgramGraph[pg]; temp1 _ MakePGNoOp[]; temp0 _ FakeDamageContextTree[contextTree]; END END; StatementresumeProdCompile: PUBLIC PROC[ref: REF ANY, contextTree: ContextTreeNode, pg: ProgramGraphNode, cs: CompilerStateNode] RETURNS[temp0: ContextTreeNode, temp1: ProgramFragmentNode, temp2: ProgramGraphNode] = BEGIN tree: StatementNode_ NARROW[ref]; BEGIN ENABLE ThreeC4Support.GetSourceInfo => RESUME[tree.position, tree.length]; treeData: StatementresumeProdData _ NARROW[tree.data]; BEGIN err: BOOLEAN; err _ Error["Compile for Statement.resume not implemented yet."]; temp2 _ FakeDamageProgramGraph[pg]; temp1 _ MakePGNoOp[]; temp0 _ FakeDamageContextTree[contextTree]; END; END END; StatementrejectProdCompile: PUBLIC PROC[ref: REF ANY, contextTree: ContextTreeNode, pg: ProgramGraphNode, cs: CompilerStateNode] RETURNS[temp0: ContextTreeNode, temp1: ProgramFragmentNode, temp2: ProgramGraphNode] = BEGIN tree: StatementNode_ NARROW[ref]; BEGIN ENABLE ThreeC4Support.GetSourceInfo => RESUME[tree.position, tree.length]; temp2 _ FakeDamageProgramGraph[pg]; temp1 _ MakePGNoOp[]; temp0 _ FakeDamageContextTree[contextTree]; END END; StatementcontinueProdCompile: PUBLIC PROC[ref: REF ANY, contextTree: ContextTreeNode, pg: ProgramGraphNode, cs: CompilerStateNode] RETURNS[temp0: ContextTreeNode, temp1: ProgramFragmentNode, temp2: ProgramGraphNode] = BEGIN tree: StatementNode_ NARROW[ref]; BEGIN ENABLE ThreeC4Support.GetSourceInfo => RESUME[tree.position, tree.length]; BEGIN err: BOOLEAN; err _ Error["Compile for Statement.continue not implemented yet."]; temp2 _ FakeDamageProgramGraph[pg]; temp1 _ MakePGNoOp[]; temp0 _ FakeDamageContextTree[contextTree]; END; END END; StatementretryProdCompile: PUBLIC PROC[ref: REF ANY, contextTree: ContextTreeNode, pg: ProgramGraphNode, cs: CompilerStateNode] RETURNS[temp0: ContextTreeNode, temp1: ProgramFragmentNode, temp2: ProgramGraphNode] = BEGIN tree: StatementNode_ NARROW[ref]; BEGIN ENABLE ThreeC4Support.GetSourceInfo => RESUME[tree.position, tree.length]; BEGIN err: BOOLEAN; err _ Error["Compile for Statement.retry not implemented yet."]; temp2 _ FakeDamageProgramGraph[pg]; temp1 _ MakePGNoOp[]; temp0 _ FakeDamageContextTree[contextTree]; END; END END; StatementgetstateProdCompile: PUBLIC PROC[ref: REF ANY, contextTree: ContextTreeNode, pg: ProgramGraphNode, cs: CompilerStateNode] RETURNS[temp0: ContextTreeNode, temp1: ProgramFragmentNode, temp2: ProgramGraphNode] = BEGIN tree: StatementNode_ NARROW[ref]; BEGIN ENABLE ThreeC4Support.GetSourceInfo => RESUME[tree.position, tree.length]; treeData: StatementgetstateProdData _ NARROW[tree.data]; BEGIN err: BOOLEAN; err _ Error["Compile for Statement.getstate not implemented yet."]; temp2 _ FakeDamageProgramGraph[pg]; temp1 _ MakePGNoOp[]; temp0 _ FakeDamageContextTree[contextTree]; END; END END; StatementsetstateProdCompile: PUBLIC PROC[ref: REF ANY, contextTree: ContextTreeNode, pg: ProgramGraphNode, cs: CompilerStateNode] RETURNS[temp0: ContextTreeNode, temp1: ProgramFragmentNode, temp2: ProgramGraphNode] = BEGIN tree: StatementNode_ NARROW[ref]; BEGIN ENABLE ThreeC4Support.GetSourceInfo => RESUME[tree.position, tree.length]; treeData: StatementsetstateProdData _ NARROW[tree.data]; BEGIN err: BOOLEAN; err _ Error["Compile for Statement.setstate not implemented yet."]; temp2 _ FakeDamageProgramGraph[pg]; temp1 _ MakePGNoOp[]; temp0 _ FakeDamageContextTree[contextTree]; END; END END; END..