From dad45d63b17366d98e6e640c67213f877eba7bfb Mon Sep 17 00:00:00 2001 From: Jonas Maebe Date: Thu, 6 Mar 2014 21:41:56 +0000 Subject: [PATCH] * improved symbol alias handling (pass in old sym instead of name, add pointer add end of aliased procdef) git-svn-id: branches/hlcgllvm@27008 - --- compiler/llvm/aasmllvm.pas | 7 ++++--- compiler/llvm/agllvm.pas | 10 ++++++---- compiler/llvm/hlcgllvm.pas | 7 ++++--- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/compiler/llvm/aasmllvm.pas b/compiler/llvm/aasmllvm.pas index b0fb476908..157766910f 100644 --- a/compiler/llvm/aasmllvm.pas +++ b/compiler/llvm/aasmllvm.pas @@ -128,7 +128,7 @@ interface linkage: tllvmlinkage; oldsym, newsym: TAsmSymbol; def: tdef; - constructor Create(const oldname, newname: TSymStr; _def: tdef; _vis: tllvmvisibility; _linkage: tllvmlinkage); + constructor create(_oldsym: tasmsymbol; const newname: TSymStr; _def: tdef; _vis: tllvmvisibility; _linkage: tllvmlinkage); end; { start of a procedure } @@ -160,10 +160,11 @@ uses { taillvmalias } - constructor taillvmalias.Create(const oldname, newname: TSymStr; _def: tdef; _vis: tllvmvisibility; _linkage: tllvmlinkage); + constructor taillvmalias.create(_oldsym: tasmsymbol; const newname: TSymStr; _def: tdef; _vis: tllvmvisibility; _linkage: tllvmlinkage); begin inherited Create; - oldsym:=current_asmdata.RefAsmSymbol(oldname,AT_FUNCTION); + typ:=ait_llvmalias; + oldsym:=_oldsym; newsym:=current_asmdata.DefineAsmSymbol(newname,AB_GLOBAL,AT_FUNCTION); def:=_def; vis:=_vis; diff --git a/compiler/llvm/agllvm.pas b/compiler/llvm/agllvm.pas index 2beee5df26..b8a23253dd 100644 --- a/compiler/llvm/agllvm.pas +++ b/compiler/llvm/agllvm.pas @@ -617,14 +617,16 @@ implementation end; ait_llvmalias: begin - asmwrite(taillvmalias(hp).newsym.name); - asmwrite(' = '); + asmwrite('@'+taillvmalias(hp).newsym.name); + asmwrite(' = alias '); if taillvmalias(hp).linkage<>lll_default then begin str(taillvmalias(hp).linkage,s); asmwrite(copy(s,length('lll_'),255)); asmwrite(' '); - end; + end + else + asmwrite('external '); if taillvmalias(hp).vis<>llv_default then begin str(taillvmalias(hp).vis,s); @@ -632,7 +634,7 @@ implementation asmwrite(' '); end; asmwrite(llvmencodetype(taillvmalias(hp).def)); - asmwrite(' '); + asmwrite('* '); asmwriteln(taillvmalias(hp).oldsym.name); end; {$ifdef arm} diff --git a/compiler/llvm/hlcgllvm.pas b/compiler/llvm/hlcgllvm.pas index c8ee9741f3..ea59b47a7d 100644 --- a/compiler/llvm/hlcgllvm.pas +++ b/compiler/llvm/hlcgllvm.pas @@ -690,6 +690,7 @@ implementation var item: TCmdStrListItem; mangledname: TSymStr; + asmsym: tasmsymbol; begin item:=TCmdStrListItem(current_procinfo.procdef.aliasnames.first); mangledname:=current_procinfo.procdef.mangledname; @@ -697,13 +698,13 @@ implementation refer to the symbol and get the binding correct } if (cs_profile in current_settings.moduleswitches) or (po_global in current_procinfo.procdef.procoptions) then - current_asmdata.DefineAsmSymbol(mangledname,AB_GLOBAL,AT_FUNCTION) + asmsym:=current_asmdata.DefineAsmSymbol(mangledname,AB_GLOBAL,AT_FUNCTION) else - current_asmdata.DefineAsmSymbol(mangledname,AB_LOCAL,AT_FUNCTION); + asmsym:=current_asmdata.DefineAsmSymbol(mangledname,AB_LOCAL,AT_FUNCTION); while assigned(item) do begin if mangledname<>item.Str then - list.concat(taillvmalias.Create(mangledname,item.str,current_procinfo.procdef,llv_default,lll_default)); + list.concat(taillvmalias.create(asmsym,item.str,current_procinfo.procdef,llv_default,lll_default)); item:=TCmdStrListItem(item.next); end; list.concat(taillvmprocdef.create(current_procinfo.procdef));