From c1e7c9de0279a859880fc1b57558d2e1d8d1663c Mon Sep 17 00:00:00 2001 From: Jonas Maebe Date: Sat, 7 Mar 2015 21:43:57 +0000 Subject: [PATCH] * 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 - --- compiler/aasmcnst.pas | 8 ++++++++ compiler/llvm/nllvmtcon.pas | 10 ++++++++++ 2 files changed, 18 insertions(+) diff --git a/compiler/aasmcnst.pas b/compiler/aasmcnst.pas index 725e80bd4d..658328aa43 100644 --- a/compiler/aasmcnst.pas +++ b/compiler/aasmcnst.pas @@ -281,6 +281,8 @@ type procedure queue_emit_const(cs: tconstsym); virtual; { ... asmsym/asmlabel } 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. This asmlist will be freed when the builder is destroyed, so add its @@ -1266,6 +1268,12 @@ implementation fqueue_offset:=low(fqueue_offset); 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 diff --git a/compiler/llvm/nllvmtcon.pas b/compiler/llvm/nllvmtcon.pas index 44e386363b..e0b4ddc894 100644 --- a/compiler/llvm/nllvmtcon.pas +++ b/compiler/llvm/nllvmtcon.pas @@ -79,6 +79,7 @@ interface procedure queue_typeconvn(fromdef, todef: tdef); override; procedure queue_emit_staticvar(vs: tstaticvarsym); 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; end; @@ -487,6 +488,15 @@ implementation 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; begin { LLVM does not support labels in the middle of a declaration }