* also use blx instead of bl for direct calls on ARMv5+, since the target

may be thumb(2) (mantis #19896)
  * don't conditionalize "blx <imm target>", because that's not a valid
    encoding

git-svn-id: trunk@18984 -
This commit is contained in:
Jonas Maebe 2011-09-05 20:33:15 +00:00
parent 16859976da
commit 852ae48cb7
2 changed files with 15 additions and 4 deletions

View File

@ -51,7 +51,11 @@ Implementation
function CanBeCond(p : tai) : boolean;
begin
result:=(p.typ=ait_instruction) and (taicpu(p).condition=C_None);
result:=
(p.typ=ait_instruction) and
(taicpu(p).condition=C_None) and
((taicpu(p).opcode<>A_BLX) or
(taicpu(p).oper[0]^.typ=top_reg));
end;

View File

@ -510,14 +510,21 @@ unit cgcpu;
procedure tcgarm.a_call_name(list : TAsmList;const s : string; weak: boolean);
var
branchopcode: tasmop;
begin
{ check not really correct: should only be used for non-Thumb cpus }
if (current_settings.cputype<cpu_armv5) then
branchopcode:=A_BL
else
branchopcode:=A_BLX;
if target_info.system<>system_arm_darwin then
if not weak then
list.concat(taicpu.op_sym(A_BL,current_asmdata.RefAsmSymbol(s)))
list.concat(taicpu.op_sym(branchopcode,current_asmdata.RefAsmSymbol(s)))
else
list.concat(taicpu.op_sym(A_BL,current_asmdata.WeakRefAsmSymbol(s)))
list.concat(taicpu.op_sym(branchopcode,current_asmdata.WeakRefAsmSymbol(s)))
else
list.concat(taicpu.op_sym(A_BL,get_darwin_call_stub(s,weak)));
list.concat(taicpu.op_sym(branchopcode,get_darwin_call_stub(s,weak)));
{
the compiler does not properly set this flag anymore in pass 1, and
for now we only need it after pass 2 (I hope) (JM)