mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-17 08:19:22 +02:00
* write the WebAssembly procdefs in the standard way, instead of using the special JVM way
git-svn-id: branches/wasm@48251 -
This commit is contained in:
parent
91ee50679f
commit
8697fb4822
@ -40,8 +40,6 @@ interface
|
|||||||
|
|
||||||
TLLVMMachineCodePlaygroundAssembler=class(TGNUassembler)
|
TLLVMMachineCodePlaygroundAssembler=class(TGNUassembler)
|
||||||
protected
|
protected
|
||||||
procedure WriteProcDef(pd: tprocdef);
|
|
||||||
procedure WriteSymtableProcdefs(st: TSymtable);
|
|
||||||
procedure WriteImports;
|
procedure WriteImports;
|
||||||
|
|
||||||
function sectionname(atype:TAsmSectiontype;const aname:string;aorder:TAsmSectionOrder):string;override;
|
function sectionname(atype:TAsmSectiontype;const aname:string;aorder:TAsmSectionOrder):string;override;
|
||||||
@ -69,51 +67,6 @@ implementation
|
|||||||
{ TLLVMMachineCodePlaygroundAssembler }
|
{ TLLVMMachineCodePlaygroundAssembler }
|
||||||
|
|
||||||
|
|
||||||
procedure TLLVMMachineCodePlaygroundAssembler.WriteProcDef(pd: tprocdef);
|
|
||||||
begin
|
|
||||||
if not assigned(tcpuprocdef(pd).exprasmlist) and
|
|
||||||
not(po_abstractmethod in pd.procoptions) and
|
|
||||||
(pd.proctypeoption in [potype_unitinit,potype_unitfinalize]) then
|
|
||||||
exit;
|
|
||||||
|
|
||||||
writer.AsmWriteLn(asminfo^.comment+'WriteProcDef('+pd.mangledname+')');
|
|
||||||
WriteTree(tcpuprocdef(pd).exprasmlist);
|
|
||||||
writer.AsmWriteLn(asminfo^.comment+'WriteProcDef('+pd.mangledname+') done');
|
|
||||||
end;
|
|
||||||
|
|
||||||
|
|
||||||
procedure TLLVMMachineCodePlaygroundAssembler.WriteSymtableProcdefs(st: TSymtable);
|
|
||||||
var
|
|
||||||
i : longint;
|
|
||||||
def : tdef;
|
|
||||||
begin
|
|
||||||
if not assigned(st) then
|
|
||||||
exit;
|
|
||||||
for i:=0 to st.DefList.Count-1 do
|
|
||||||
begin
|
|
||||||
def:=tdef(st.DefList[i]);
|
|
||||||
case def.typ of
|
|
||||||
procdef :
|
|
||||||
begin
|
|
||||||
{ methods are also in the static/globalsymtable of the unit
|
|
||||||
-> make sure they are only written for the objectdefs that
|
|
||||||
own them }
|
|
||||||
if (not(st.symtabletype in [staticsymtable,globalsymtable]) or
|
|
||||||
(def.owner=st)) and
|
|
||||||
not(df_generic in def.defoptions) then
|
|
||||||
begin
|
|
||||||
WriteProcDef(tprocdef(def));
|
|
||||||
if assigned(tprocdef(def).localst) then
|
|
||||||
WriteSymtableProcdefs(tprocdef(def).localst);
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
else
|
|
||||||
;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
|
|
||||||
procedure TLLVMMachineCodePlaygroundAssembler.WriteImports;
|
procedure TLLVMMachineCodePlaygroundAssembler.WriteImports;
|
||||||
var
|
var
|
||||||
i : integer;
|
i : integer;
|
||||||
@ -182,8 +135,6 @@ implementation
|
|||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
{ print all global procedures/functions }
|
{ print all global procedures/functions }
|
||||||
WriteSymtableProcdefs(current_module.globalsymtable);
|
|
||||||
WriteSymtableProcdefs(current_module.localsymtable);
|
|
||||||
writer.AsmWriteLn(#9'.globaltype'#9+STACK_POINTER_SYM+', i32');
|
writer.AsmWriteLn(#9'.globaltype'#9+STACK_POINTER_SYM+', i32');
|
||||||
WriteImports;
|
WriteImports;
|
||||||
end;
|
end;
|
||||||
|
@ -102,8 +102,6 @@ uses
|
|||||||
procedure g_proc_entry(list : TAsmList;localsize : longint;nostackframe:boolean); override;
|
procedure g_proc_entry(list : TAsmList;localsize : longint;nostackframe:boolean); override;
|
||||||
procedure g_proc_exit(list : TAsmList;parasize:longint;nostackframe:boolean); override;
|
procedure g_proc_exit(list : TAsmList;parasize:longint;nostackframe:boolean); override;
|
||||||
|
|
||||||
procedure record_generated_code_for_procdef(pd: tprocdef; code, data: TAsmList); override;
|
|
||||||
|
|
||||||
procedure g_overflowcheck(list: TAsmList; const Loc: tlocation; def: tdef); override;
|
procedure g_overflowcheck(list: TAsmList; const Loc: tlocation; def: tdef); override;
|
||||||
procedure g_overflowCheck_loc(List:TAsmList;const Loc:TLocation;def:TDef;var ovloc : tlocation); override;
|
procedure g_overflowCheck_loc(List:TAsmList;const Loc:TLocation;def:TDef;var ovloc : tlocation); override;
|
||||||
|
|
||||||
@ -1567,21 +1565,6 @@ implementation
|
|||||||
list.concat(taicpu.op_none(a_end_function));
|
list.concat(taicpu.op_none(a_end_function));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure thlcgwasm.record_generated_code_for_procdef(pd: tprocdef; code, data: TAsmList);
|
|
||||||
begin
|
|
||||||
{ add something to the al_procedures list as well, because if all al_*
|
|
||||||
lists are empty, the assembler writer isn't called }
|
|
||||||
if not code.empty and
|
|
||||||
current_asmdata.asmlists[al_procedures].empty then
|
|
||||||
current_asmdata.asmlists[al_procedures].concat(tai_align.Create(4));
|
|
||||||
tcpuprocdef(pd).exprasmlist:=TAsmList.create;
|
|
||||||
new_section(tcpuprocdef(pd).exprasmlist,sec_code,lower(pd.mangledname),current_settings.alignment.procalign);
|
|
||||||
tcpuprocdef(pd).exprasmlist.concatlist(code);
|
|
||||||
if assigned(data) and
|
|
||||||
not data.empty then
|
|
||||||
internalerror(2010122801);
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure thlcgwasm.g_overflowcheck(list: TAsmList; const Loc: tlocation; def: tdef);
|
procedure thlcgwasm.g_overflowcheck(list: TAsmList; const Loc: tlocation; def: tdef);
|
||||||
begin
|
begin
|
||||||
{ not possible, need the original operands }
|
{ not possible, need the original operands }
|
||||||
|
Loading…
Reference in New Issue
Block a user