diff options
author | florian <florian@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2012-05-28 16:24:21 +0000 |
---|---|---|
committer | florian <florian@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2012-05-28 16:24:21 +0000 |
commit | cf7966316339e10a23829de56ff6f2f4d7cac96e (patch) | |
tree | b1272457689db808d5ed977f2c08ac50e698884c /compiler/mips/ncpuadd.pas | |
parent | c8f750382bb31ffd4f69778557cc73a03d7f9756 (diff) | |
download | fpc-cf7966316339e10a23829de56ff6f2f4d7cac96e.tar.gz |
+ tmipsaddnode.pass_1 setting expectloc correctly
git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@21420 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'compiler/mips/ncpuadd.pas')
-rw-r--r-- | compiler/mips/ncpuadd.pas | 40 |
1 files changed, 27 insertions, 13 deletions
diff --git a/compiler/mips/ncpuadd.pas b/compiler/mips/ncpuadd.pas index e1ba25794b..8d88ce49ca 100644 --- a/compiler/mips/ncpuadd.pas +++ b/compiler/mips/ncpuadd.pas @@ -29,6 +29,9 @@ uses node, ncgadd, cpubase, aasmbase, cgbase; type + + { tmipsaddnode } + tmipsaddnode = class(tcgaddnode) private function cmp64_lt(left_reg, right_reg: TRegister64): TRegister; @@ -41,6 +44,7 @@ type function GetRes_register(unsigned: boolean; this_reg, left_reg, right_reg: TRegister): TRegister; function GetRes64_register(unsigned: boolean; {this_reg,} left_reg, right_reg: TRegister64): TRegister; protected + function pass_1: tnode; override; procedure second_addfloat; override; procedure second_cmpfloat; override; procedure second_cmpboolean; override; @@ -341,6 +345,21 @@ begin end; end; + +function tmipsaddnode.pass_1 : tnode; + var + unsigned : boolean; + begin + result:=inherited pass_1; + + if not(assigned(result)) then + begin + if (nodetype in [ltn,lten,gtn,gten,equaln,unequaln]) then + expectloc:=LOC_REGISTER; + end; + end; + + procedure tmipsaddnode.second_addfloat; var op: TAsmOp; @@ -513,18 +532,15 @@ begin force_reg_left_right(True, True); tmp_right_reg := NR_NO; if right.location.loc = LOC_CONSTANT then - begin - tmp_right_reg := cg.GetIntRegister(current_asmdata.CurrAsmList, OS_INT); - current_asmdata.CurrAsmList.concat(taicpu.op_reg_const(A_LI, tmp_right_reg, right.location.Value)); - end + begin + tmp_right_reg := cg.GetIntRegister(current_asmdata.CurrAsmList, OS_INT); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_const(A_LI, tmp_right_reg, right.location.Value)); + end else - begin tmp_right_reg := right.location.Register; - end; location_reset(location, LOC_REGISTER, OS_INT); location.Register := GetRes_register(True, NR_TCR0, left.location.Register, tmp_right_reg); - end; @@ -581,14 +597,12 @@ begin tmp_right_reg := NR_NO; if right.location.loc = LOC_CONSTANT then - begin - tmp_right_reg := cg.GetIntRegister(current_asmdata.CurrAsmList, OS_INT); - current_asmdata.CurrAsmList.concat(taicpu.op_reg_const(A_LI, tmp_right_reg, right.location.Value)); - end + begin + tmp_right_reg := cg.GetIntRegister(current_asmdata.CurrAsmList, OS_INT); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_const(A_LI, tmp_right_reg, right.location.Value)); + end else - begin tmp_right_reg := right.location.Register; - end; location_reset(location, LOC_REGISTER, OS_INT); location.Register := getres_register(unsigned, NR_TCR0, left.location.Register, tmp_right_reg); end; |