Changeset 20 for branches/DelphiToC/UAssemblerSource.pas
- Timestamp:
- Sep 8, 2009, 2:01:55 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DelphiToC/UAssemblerSource.pas
r14 r20 28 28 procedure AddInstruction(LabelName, Instruction, Operand1, 29 29 Operand2: string); 30 procedure GenerateCommonBlock(CommonBlock: TCommonBlock; LabelPrefix: string);30 // procedure GenerateCommonBlock(CommonBlock: TCommonBlock; LabelPrefix: string); 31 31 procedure GenerateExpression(Expression: TExpression; LabelPrefix: string); 32 32 procedure GenerateProgram(ProgramBlock: TProgram); … … 114 114 end; 115 115 116 procedure TAssemblerProducer.GenerateCommonBlock(CommonBlock: TCommonBlock; LabelPrefix: string); 117 var 118 I: Integer; 119 LabelName: string; 120 begin 121 with CommonBlock do 122 for I := 0 to Operations.Count - 1 do 123 with TOperation(Operations[I]) do begin 124 if Referenced then LabelName := Name + '_L' + IntToStr(I) 125 else LabelName := ''; 126 case Instruction of 127 inJump: begin 128 AddInstruction(LabelName, 'JMP', Name + '_L' + IntToStr(GotoAddress), ''); 116 (* 117 procedure TAssemblerProducer.GenerateCommonBlock(CommonBlock: TCommonBlock; LabelPrefix: string); 118 var 119 I: Integer; 120 LabelName: string; 121 begin 122 with CommonBlock do 123 for I := 0 to Operations.Count - 1 do 124 with TOperation(Operations[I]) do begin 125 if Referenced then LabelName := Name + '_L' + IntToStr(I) 126 else LabelName := ''; 127 case Instruction of 128 inJump: begin 129 AddInstruction(LabelName, 'JMP', Name + '_L' + IntToStr(GotoAddress), ''); 130 end; 131 inConditionalJump: begin 132 GenerateExpression(ExpressionTree, LabelPrefix + '_L' + IntToStr(GotoAddress)); 133 AddInstruction(LabelName, 'BRCS', Name + '_L' + IntToStr(GotoAddress), ''); 134 end; 135 inExpressionEvaluation: begin 136 if LabelName <> '' then AddInstruction(LabelName, '', '', ''); 137 GenerateExpression(ExpressionTree, Name + '_L' + IntToStr(GotoAddress)); 138 end; 139 inReturn: 140 AddInstruction(LabelName, 'RET', '', ''); 129 141 end; 130 inConditionalJump: begin131 GenerateExpression(ExpressionTree, LabelPrefix + '_L' + IntToStr(GotoAddress));132 AddInstruction(LabelName, 'BRCS', Name + '_L' + IntToStr(GotoAddress), '');133 end;134 inExpressionEvaluation: begin135 if LabelName <> '' then AddInstruction(LabelName, '', '', '');136 GenerateExpression(ExpressionTree, Name + '_L' + IntToStr(GotoAddress));137 end;138 inReturn:139 AddInstruction(LabelName, 'RET', '', '');140 142 end; 141 143 end; 142 end; 144 *) 143 145 144 146 procedure TAssemblerProducer.GenerateExpression(Expression: TExpression; LabelPrefix: string); … … 180 182 I: Integer; 181 183 begin 182 with ProgramBlock do183 for I := 0 to Modules.Count - 1 do184 GenerateCommonBlock(TModule(Modules[I]), '');184 // with ProgramBlock do 185 // for I := 0 to Modules.Count - 1 do 186 // GenerateCommonBlock(TModule(Modules[I]), ''); 185 187 end; 186 188
Note:
See TracChangeset
for help on using the changeset viewer.