Quellcode durchsuchen

* emit the current offset when flushing tasmsymbols in the
ttai_lowleveltypedconstbuilder
o set the offset to 0 in the llvm constbuilder before calling
the lowlevel one, because it incorporates this offset already
via getelementptr instructions

git-svn-id: branches/hlcgllvm@28136 -

Jonas Maebe vor 11 Jahren
Ursprung
Commit
a284902813
2 geänderte Dateien mit 12 neuen und 1 gelöschten Zeilen
  1. 1 1
      compiler/aasmcnst.pas
  2. 11 0
      compiler/llvm/nllvmtcon.pas

+ 1 - 1
compiler/aasmcnst.pas

@@ -562,7 +562,7 @@ implementation
        { getpointerdef, because "sym" represents the address of whatever the
          data is }
        def:=getpointerdef(def);
-       emit_tai(Tai_const.Create_sym(sym),def);
+       emit_tai(Tai_const.Create_sym_offset(sym,fqueue_offset),def);
        fqueue_offset:=low(fqueue_offset);
      end;
 

+ 11 - 0
compiler/llvm/nllvmtcon.pas

@@ -63,6 +63,7 @@ interface
       procedure queue_vecn(def: tdef; const index: tconstexprint); override;
       procedure queue_subscriptn(def: tabstractrecorddef; vs: tfieldvarsym); override;
       procedure queue_typeconvn(fromdef, todef: tdef); override;
+      procedure queue_emit_asmsym(sym: tasmsymbol; def: tdef); override;
     end;
 
 implementation
@@ -336,6 +337,16 @@ implementation
     end;
 
 
+  procedure tllvmtai_typedconstbuilder.queue_emit_asmsym(sym: tasmsymbol; def: tdef);
+    begin
+      { we've already incorporated the offset via the inserted operations above,
+        make sure it doesn't get emitted again as part of the tai_const for
+        the tasmsymbol }
+      fqueue_offset:=0;
+      inherited;
+    end;
+
+
 begin
   ctai_typedconstbuilder:=tllvmtai_typedconstbuilder;
 end.