|
@@ -59,6 +59,7 @@ interface
|
|
|
procedure second_atomic_rmw_x_y(op: TAsmOp);
|
|
|
procedure second_atomic_rmw_x_y_z(op: TAsmOp);
|
|
|
procedure second_tls_get(const SymStr: string);
|
|
|
+ procedure second_set_base_pointer;
|
|
|
protected
|
|
|
function first_sqr_real: tnode; override;
|
|
|
public
|
|
@@ -72,12 +73,14 @@ interface
|
|
|
implementation
|
|
|
|
|
|
uses
|
|
|
+ procinfo,
|
|
|
ninl,ncal,compinnr,
|
|
|
aasmbase,aasmdata,aasmcpu,
|
|
|
cgbase,cgutils,
|
|
|
hlcgobj,hlcgcpu,
|
|
|
defutil,pass_2,verbose,
|
|
|
- symtype,symdef;
|
|
|
+ symtype,symdef,symcpu,
|
|
|
+ tgobj,tgcpu;
|
|
|
|
|
|
{*****************************************************************************
|
|
|
twasminlinenode
|
|
@@ -557,6 +560,24 @@ implementation
|
|
|
end;
|
|
|
|
|
|
|
|
|
+ procedure twasminlinenode.second_set_base_pointer;
|
|
|
+ var
|
|
|
+ pd: tcpuprocdef;
|
|
|
+ begin
|
|
|
+ location_reset(location,LOC_VOID,OS_NO);
|
|
|
+ secondpass(left);
|
|
|
+
|
|
|
+ hlcg.location_force_reg(current_asmdata.CurrAsmList,left.location,left.resultdef,left.resultdef,false);
|
|
|
+ thlcgwasm(hlcg).a_load_reg_stack(current_asmdata.CurrAsmList,left.resultdef,left.location.register);
|
|
|
+
|
|
|
+ pd:=tcpuprocdef(current_procinfo.procdef);
|
|
|
+ if pd.base_pointer_ref.base<>NR_LOCAL_STACK_POINTER_REG then
|
|
|
+ ttgwasm(tg).allocbasepointer(current_asmdata.CurrAsmList,pd.base_pointer_ref);
|
|
|
+ current_asmdata.CurrAsmList.Concat(taicpu.op_ref(a_local_set,pd.base_pointer_ref));
|
|
|
+ thlcgwasm(hlcg).decstack(current_asmdata.CurrAsmList,1);
|
|
|
+ end;
|
|
|
+
|
|
|
+
|
|
|
function twasminlinenode.first_sqr_real: tnode;
|
|
|
begin
|
|
|
expectloc:=LOC_FPUREGISTER;
|
|
@@ -568,6 +589,11 @@ implementation
|
|
|
begin
|
|
|
Result:=nil;
|
|
|
case inlinenumber of
|
|
|
+ in_wasm32_set_base_pointer:
|
|
|
+ begin
|
|
|
+ CheckParameters(1);
|
|
|
+ resultdef:=voidtype;
|
|
|
+ end;
|
|
|
in_wasm32_memory_size:
|
|
|
begin
|
|
|
CheckParameters(0);
|
|
@@ -730,6 +756,7 @@ implementation
|
|
|
in_wasm32_memory_size,
|
|
|
in_wasm32_memory_grow:
|
|
|
expectloc:=LOC_REGISTER;
|
|
|
+ in_wasm32_set_base_pointer,
|
|
|
in_wasm32_memory_fill,
|
|
|
in_wasm32_memory_copy,
|
|
|
in_wasm32_unreachable,
|
|
@@ -967,6 +994,8 @@ implementation
|
|
|
second_tls_get(TLS_ALIGN_SYM);
|
|
|
in_wasm32_tls_base:
|
|
|
second_tls_get(TLS_BASE_SYM);
|
|
|
+ in_wasm32_set_base_pointer:
|
|
|
+ second_set_base_pointer;
|
|
|
else
|
|
|
inherited pass_generate_code_cpu;
|
|
|
end;
|