Browse Source

+ support references with only index reg, and no base reg in thlcgwasm.prepare_stack_for_ref

git-svn-id: branches/wasm@48179 -
nickysn 4 years ago
parent
commit
af41eee9d1
1 changed files with 6 additions and 0 deletions
  1. 6 0
      compiler/wasm32/hlcgcpu.pas

+ 6 - 0
compiler/wasm32/hlcgcpu.pas

@@ -998,6 +998,12 @@ implementation
       if (ref.base=NR_EVAL_STACK_BASE) or (ref.base=NR_LOCAL_STACK_POINTER_REG) then
       if (ref.base=NR_EVAL_STACK_BASE) or (ref.base=NR_LOCAL_STACK_POINTER_REG) then
         exit;
         exit;
 
 
+      if (ref.base=NR_NO) and (ref.index<>NR_NO) and (ref.scalefactor<=1) then
+        begin
+          ref.base:=ref.index;
+          ref.index:=NR_NO;
+        end;
+
       // setting up memory offset
       // setting up memory offset
       if assigned(ref.symbol) and (ref.base=NR_NO) and (ref.index=NR_NO) then
       if assigned(ref.symbol) and (ref.base=NR_NO) and (ref.index=NR_NO) then
         begin
         begin