Browse Source

* support for flushing a ttai_typedconstbuilder queue with an ordinal
constant at the end (in case of e.g. ordinal -> pointer type
conversions)

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

Jonas Maebe 10 years ago
parent
commit
c1e7c9de02
2 changed files with 18 additions and 0 deletions
  1. 8 0
      compiler/aasmcnst.pas
  2. 10 0
      compiler/llvm/nllvmtcon.pas

+ 8 - 0
compiler/aasmcnst.pas

@@ -281,6 +281,8 @@ type
      procedure queue_emit_const(cs: tconstsym); virtual;
      procedure queue_emit_const(cs: tconstsym); virtual;
      { ... asmsym/asmlabel }
      { ... asmsym/asmlabel }
      procedure queue_emit_asmsym(sym: tasmsymbol; def: tdef); virtual;
      procedure queue_emit_asmsym(sym: tasmsymbol; def: tdef); virtual;
+     { ... an ordinal constant }
+     procedure queue_emit_ordconst(value: int64; def: tdef); virtual;
 
 
      { finalize the internal asmlist (if necessary) and return it.
      { finalize the internal asmlist (if necessary) and return it.
        This asmlist will be freed when the builder is destroyed, so add its
        This asmlist will be freed when the builder is destroyed, so add its
@@ -1266,6 +1268,12 @@ implementation
        fqueue_offset:=low(fqueue_offset);
        fqueue_offset:=low(fqueue_offset);
      end;
      end;
 
 
+   procedure ttai_typedconstbuilder.queue_emit_ordconst(value: int64; def: tdef);
+     begin
+       emit_ord_const(value,def);
+       fqueue_offset:=low(fqueue_offset);
+     end;
+
 
 
 {****************************************************************************
 {****************************************************************************
                            tai_abstracttypedconst
                            tai_abstracttypedconst

+ 10 - 0
compiler/llvm/nllvmtcon.pas

@@ -79,6 +79,7 @@ interface
       procedure queue_typeconvn(fromdef, todef: tdef); override;
       procedure queue_typeconvn(fromdef, todef: tdef); override;
       procedure queue_emit_staticvar(vs: tstaticvarsym); override;
       procedure queue_emit_staticvar(vs: tstaticvarsym); override;
       procedure queue_emit_asmsym(sym: tasmsymbol; def: tdef); override;
       procedure queue_emit_asmsym(sym: tasmsymbol; def: tdef); override;
+      procedure queue_emit_ordconst(value: int64; def: tdef); override;
 
 
       class function get_string_symofs(typ: tstringtype; winlikewidestring: boolean): pint; override;
       class function get_string_symofs(typ: tstringtype; winlikewidestring: boolean): pint; override;
     end;
     end;
@@ -487,6 +488,15 @@ implementation
     end;
     end;
 
 
 
 
+  procedure tllvmtai_typedconstbuilder.queue_emit_ordconst(value: int64; def: tdef);
+    begin
+      { no offset into an ordinal constant }
+      if fqueue_offset<>0 then
+        internalerror(2015030702);
+      inherited;
+    end;
+
+
   class function tllvmtai_typedconstbuilder.get_string_symofs(typ: tstringtype; winlikewidestring: boolean): pint;
   class function tllvmtai_typedconstbuilder.get_string_symofs(typ: tstringtype; winlikewidestring: boolean): pint;
     begin
     begin
       { LLVM does not support labels in the middle of a declaration }
       { LLVM does not support labels in the middle of a declaration }