* tcg.translate_register: check that reg.allocator is not nil before calling its method (in case of "assembler nostackframe" function returning an x87 float compiler tries to translate NR_ST which is used for function result).

* tcg.a_reg_dealloc: ignore NR_NO, prevents creating useless deallocations of NR_DEFAULTFLAGS on MIPS targets which have NR_DEFAULTFLAGS=NR_NO.

git-svn-id: trunk@29242 -
This commit is contained in:
sergei 2014-12-10 07:13:14 +00:00
parent fe49a4b60c
commit 8f4430e795

View File

@ -815,8 +815,15 @@ implementation
procedure tcg.translate_register(var reg : tregister);
var
rt: tregistertype;
begin
rg[getregtype(reg)].translate_register(reg);
{ Getting here without assigned rg is possible for an "assembler nostackframe"
function returning x87 float, compiler tries to translate NR_ST which is used for
result. }
rt:=getregtype(reg);
if assigned(rg[rt]) then
rg[rt].translate_register(reg);
end;
@ -828,7 +835,8 @@ implementation
procedure tcg.a_reg_dealloc(list : TAsmList;r : tregister);
begin
list.concat(tai_regalloc.dealloc(r,nil));
if (r<>NR_NO) then
list.concat(tai_regalloc.dealloc(r,nil));
end;