m68k: a bunch of '000 related fixes and cleanups. generated source now compiles for '000 again, which was broken due to recent improvements conflicting with limitations of the original '000

git-svn-id: trunk@33809 -
This commit is contained in:
Károly Balogh 2016-05-26 10:33:29 +00:00
parent 62e0eab89b
commit aa63aa95bb
3 changed files with 30 additions and 28 deletions

View File

@ -388,7 +388,8 @@ implementation
cg.a_load_reg_reg(current_asmdata.CurrAsmlist,left.location.size,location.size,left.location.register,location.register);
if (location.size <> right.location.size) or
not (right.location.loc in [LOC_REGISTER,LOC_CREGISTER,LOC_CONSTANT,LOC_REFERENCE,LOC_CREFERENCE]) then
not (right.location.loc in [LOC_REGISTER,LOC_CREGISTER,LOC_CONSTANT,LOC_REFERENCE,LOC_CREFERENCE]) or
(not(CPUM68K_HAS_32BITMUL in cpu_capabilities[current_settings.cputype]) and (nodetype = muln)) then
hlcg.location_force_reg(current_asmdata.CurrAsmList,right.location,right.resultdef,right.resultdef,true);
case right.location.loc of
@ -441,7 +442,14 @@ implementation
end;
else
hlcg.location_force_reg(current_asmdata.CurrAsmList,left.location,left.resultdef,left.resultdef,true);
current_asmdata.CurrAsmList.concat(taicpu.op_reg(A_TST,opsize,left.location.register));
if (current_settings.cputype = cpu_mc68000) and isaddressregister(left.location.register) then
begin
tmpreg:=cg.getintregister(current_asmdata.CurrAsmList,opsize);
cg.a_load_reg_reg(current_asmdata.CurrAsmList,OS_ADDR,opsize,left.location.register,tmpreg);
end
else
tmpreg:=left.location.register;
current_asmdata.CurrAsmList.concat(taicpu.op_reg(A_TST,opsize,tmpreg));
end;
location.resflags := getresflags(unsigned);
exit;

View File

@ -46,7 +46,7 @@ implementation
ncon,ncal,
ncgutil,
cpubase,cpuinfo,aasmcpu,
rgobj,tgobj,cgobj,hlcgobj,cgutils,globtype,cgcpu;
rgobj,tgobj,cgobj,hlcgobj,cgutils,globtype,cgcpu,cutils;
{*****************************************************************************
@ -207,29 +207,10 @@ implementation
end
else
begin
{ can we optimize it, or do we need to fix the ref. ? }
if isvalidrefoffset(left.location.reference) then
begin
{ Coldfire cannot handle tst.l 123(dX) }
if (current_settings.cputype in (cpu_coldfire + [cpu_mc68000])) and
isintregister(left.location.reference.base) then
begin
tmpreference:=left.location.reference;
hreg2:=cg.getaddressregister(current_asmdata.CurrAsmList);
tmpreference.base:=hreg2;
current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_MOVE,S_L,left.location.reference.base,hreg2));
current_asmdata.CurrAsmList.concat(taicpu.op_ref(A_TST,TCGSize2OpSize[opsize],tmpreference));
end
else
current_asmdata.CurrAsmList.concat(taicpu.op_ref(A_TST,TCGSize2OpSize[opsize],left.location.reference));
end
else
begin
hreg2:=cg.getintregister(current_asmdata.CurrAsmList,opsize);
cg.a_load_ref_reg(current_asmdata.CurrAsmList,opsize,opsize,
left.location.reference,hreg2);
current_asmdata.CurrAsmList.concat(taicpu.op_reg(A_TST,TCGSize2OpSize[opsize],hreg2));
end;
//current_asmdata.CurrAsmList.concat(tai_comment.create(strpnew('typeconvnode second_int_to_bool')));
tmpreference:=left.location.reference;
tcg68k(cg).fixref(current_asmdata.CurrAsmList,tmpreference,false);
current_asmdata.CurrAsmList.concat(taicpu.op_ref(A_TST,TCGSize2OpSize[opsize],tmpreference));
end;
end;
LOC_REGISTER,LOC_CREGISTER :
@ -243,7 +224,13 @@ implementation
end
else
begin
hreg2:=left.location.register;
if (current_settings.cputype = cpu_mc68000) and isaddressregister(left.location.register) then
begin
hreg2:=cg.getintregister(current_asmdata.CurrAsmList,opsize);
cg.a_load_reg_reg(current_asmdata.CurrAsmList,OS_ADDR,opsize,left.location.register,hreg2);
end
else
hreg2:=left.location.register;
current_asmdata.CurrAsmList.concat(taicpu.op_reg(A_TST,TCGSize2OpSize[opsize],hreg2));
end;
end;

View File

@ -117,7 +117,14 @@ implementation
else
begin
hlcg.location_force_reg(current_asmdata.CurrAsmList,left.location,left.resultdef,resultdef,true);
current_asmdata.CurrAsmList.concat(taicpu.op_reg(A_TST,tcgsize2opsize[opsize],left.location.register));
if (current_settings.cputype = cpu_mc68000) and isaddressregister(left.location.register) then
begin
hreg:=cg.getintregister(current_asmdata.CurrAsmList,opsize);
cg.a_load_reg_reg(current_asmdata.CurrAsmList,OS_ADDR,opsize,left.location.register,hreg);
end
else
hreg:=left.location.register;
current_asmdata.CurrAsmList.concat(taicpu.op_reg(A_TST,tcgsize2opsize[opsize],hreg));
end;
location_reset(location,LOC_FLAGS,OS_NO);
location.resflags:=F_E;