mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-13 00:09:32 +02:00
[PATCH 082/188] writing out constant parameters
From f628b39868ab7547b215ee2fd92164484909e1b7 Mon Sep 17 00:00:00 2001 From: Dmitry Boyarintsev <skalogryz.lists@gmail.com> Date: Mon, 9 Mar 2020 10:59:49 -0400 git-svn-id: branches/wasm@46078 -
This commit is contained in:
parent
8117cba863
commit
4f7ba10fe1
@ -461,15 +461,35 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
procedure TBinWriter.WriteInstList(list: TWasmInstrList; ofsAddition: LongWord);
|
||||
var
|
||||
i : integer;
|
||||
ci : TWasmInstr;
|
||||
u32 : LongWord;
|
||||
i32 : LongWord;
|
||||
err : integer;
|
||||
|
||||
begin
|
||||
for i:=0 to list.Count-1 do begin
|
||||
ci :=list[i];
|
||||
dst.WriteByte(ci.code);
|
||||
case INST_FLAGS[ci.code].Param of
|
||||
ipi32: begin
|
||||
Val(ci.operandText, u32, err);
|
||||
if err = 0 then begin
|
||||
WriteU32(dst, u32);
|
||||
end else begin
|
||||
Val(ci.operandText, i32, err);
|
||||
if err = 0 then WriteU32(dst, i32);
|
||||
end;
|
||||
end;
|
||||
|
||||
ipi64, // signed Leb of maximum 8 bytes
|
||||
ipf32, // float point single
|
||||
ipf64, // float point double
|
||||
|
||||
|
||||
ipLeb:
|
||||
if INST_RELOC_FLAGS[ci.code].doReloc then begin
|
||||
AddReloc(INST_RELOC_FLAGS[ci.code].relocType, dst.Position+ofsAddition, ci.operandNum);
|
||||
|
@ -629,7 +629,7 @@ begin
|
||||
|
||||
INST_CALL:
|
||||
begin
|
||||
if (ci.operandIdx<>'') and ( ci.operandNum<0) then
|
||||
if (ci.operandIdx<>'') and (ci.operandNum<0) then
|
||||
ci.operandNum:=FindFunc(m,ci.operandIdx);
|
||||
end;
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user