* improved symbol alias handling (pass in old sym instead of name, add

pointer add end of aliased procdef)

git-svn-id: branches/hlcgllvm@27008 -
This commit is contained in:
Jonas Maebe 2014-03-06 21:41:56 +00:00
parent abee66b611
commit dad45d63b1
3 changed files with 14 additions and 10 deletions

View File

@ -128,7 +128,7 @@ interface
linkage: tllvmlinkage; linkage: tllvmlinkage;
oldsym, newsym: TAsmSymbol; oldsym, newsym: TAsmSymbol;
def: tdef; 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; end;
{ start of a procedure } { start of a procedure }
@ -160,10 +160,11 @@ uses
{ taillvmalias } { 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 begin
inherited Create; inherited Create;
oldsym:=current_asmdata.RefAsmSymbol(oldname,AT_FUNCTION); typ:=ait_llvmalias;
oldsym:=_oldsym;
newsym:=current_asmdata.DefineAsmSymbol(newname,AB_GLOBAL,AT_FUNCTION); newsym:=current_asmdata.DefineAsmSymbol(newname,AB_GLOBAL,AT_FUNCTION);
def:=_def; def:=_def;
vis:=_vis; vis:=_vis;

View File

@ -617,14 +617,16 @@ implementation
end; end;
ait_llvmalias: ait_llvmalias:
begin begin
asmwrite(taillvmalias(hp).newsym.name); asmwrite('@'+taillvmalias(hp).newsym.name);
asmwrite(' = '); asmwrite(' = alias ');
if taillvmalias(hp).linkage<>lll_default then if taillvmalias(hp).linkage<>lll_default then
begin begin
str(taillvmalias(hp).linkage,s); str(taillvmalias(hp).linkage,s);
asmwrite(copy(s,length('lll_'),255)); asmwrite(copy(s,length('lll_'),255));
asmwrite(' '); asmwrite(' ');
end; end
else
asmwrite('external ');
if taillvmalias(hp).vis<>llv_default then if taillvmalias(hp).vis<>llv_default then
begin begin
str(taillvmalias(hp).vis,s); str(taillvmalias(hp).vis,s);
@ -632,7 +634,7 @@ implementation
asmwrite(' '); asmwrite(' ');
end; end;
asmwrite(llvmencodetype(taillvmalias(hp).def)); asmwrite(llvmencodetype(taillvmalias(hp).def));
asmwrite(' '); asmwrite('* ');
asmwriteln(taillvmalias(hp).oldsym.name); asmwriteln(taillvmalias(hp).oldsym.name);
end; end;
{$ifdef arm} {$ifdef arm}

View File

@ -690,6 +690,7 @@ implementation
var var
item: TCmdStrListItem; item: TCmdStrListItem;
mangledname: TSymStr; mangledname: TSymStr;
asmsym: tasmsymbol;
begin begin
item:=TCmdStrListItem(current_procinfo.procdef.aliasnames.first); item:=TCmdStrListItem(current_procinfo.procdef.aliasnames.first);
mangledname:=current_procinfo.procdef.mangledname; mangledname:=current_procinfo.procdef.mangledname;
@ -697,13 +698,13 @@ implementation
refer to the symbol and get the binding correct } refer to the symbol and get the binding correct }
if (cs_profile in current_settings.moduleswitches) or if (cs_profile in current_settings.moduleswitches) or
(po_global in current_procinfo.procdef.procoptions) then (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 else
current_asmdata.DefineAsmSymbol(mangledname,AB_LOCAL,AT_FUNCTION); asmsym:=current_asmdata.DefineAsmSymbol(mangledname,AB_LOCAL,AT_FUNCTION);
while assigned(item) do while assigned(item) do
begin begin
if mangledname<>item.Str then 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); item:=TCmdStrListItem(item.next);
end; end;
list.concat(taillvmprocdef.create(current_procinfo.procdef)); list.concat(taillvmprocdef.create(current_procinfo.procdef));