From 3496129f79e5dda9d27035cdcf7962f99f95895d Mon Sep 17 00:00:00 2001 From: Jonas Maebe Date: Sun, 19 Apr 2015 21:37:49 +0000 Subject: [PATCH] * only handle a_load_const_ref() directly when storing ordinals, as in case of pointers llvm only supports 0 (as null, which we don't generate either) git-svn-id: trunk@30676 - --- compiler/llvm/hlcgllvm.pas | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/compiler/llvm/hlcgllvm.pas b/compiler/llvm/hlcgllvm.pas index 2096e1bd4c..5e430feaed 100644 --- a/compiler/llvm/hlcgllvm.pas +++ b/compiler/llvm/hlcgllvm.pas @@ -473,8 +473,16 @@ implementation var sref: treference; begin - sref:=make_simple_ref(list,ref,tosize); - list.concat(taillvm.op_size_const_size_ref(la_store,tosize,a,getpointerdef(tosize),sref)) + { llvm instructions do not support pointer constants -> only directly + encode for integers; a_load_const_reg() handles pointers properly } + if is_ordinal(tosize) or + is_64bit(tosize) then + begin + sref:=make_simple_ref(list,ref,tosize); + list.concat(taillvm.op_size_const_size_ref(la_store,tosize,a,getpointerdef(tosize),sref)) + end + else + inherited; end;