diff options
author | jonas <jonas@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2010-12-30 14:55:57 +0000 |
---|---|---|
committer | jonas <jonas@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2010-12-30 14:55:57 +0000 |
commit | 0a65dab52ffb66d61b0916b532b6c714622406fe (patch) | |
tree | d7f472d8cc9172edfc9bea33944dee20420a4602 | |
parent | 55444058ce5bbeba3d1be5ed312ae4be29c868ea (diff) | |
download | fpc-0a65dab52ffb66d61b0916b532b6c714622406fe.tar.gz |
* fixed and simplified tcgaddnode.second_addsmallset: don't modify
right.register for subn, because it may be constant
git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@16663 3ad0048d-3df7-0310-abae-a5850022a9f2
-rw-r--r-- | compiler/ncgadd.pas | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/compiler/ncgadd.pas b/compiler/ncgadd.pas index 7169aa5e97..affeb6e39d 100644 --- a/compiler/ncgadd.pas +++ b/compiler/ncgadd.pas @@ -269,7 +269,6 @@ interface procedure tcgaddnode.second_addsmallset; var - tmpreg : tregister; cgop : TOpCg; opdone : boolean; begin @@ -301,21 +300,16 @@ interface end; if opdone then begin + if (right.location.size<>left.location.size) or + (location.size<>left.location.size) then + internalerror(2010123001); + { make sure we don't modify left/right.location, because we told + force_reg_left_right above that they can be constant } + cg.a_op_reg_reg(current_asmdata.CurrAsmList,OP_NOT,location.size,right.location.register,location.register); if left.location.loc = LOC_CONSTANT then - begin - tmpreg := cg.getintregister(current_asmdata.CurrAsmList,location.size); - cg.a_load_const_reg(current_asmdata.CurrAsmList,location.size, - left.location.value,tmpreg); - cg.a_op_reg_reg(current_asmdata.CurrAsmList,OP_NOT,location.size,right.location.register,right.location.register); - cg.a_op_reg_reg(current_asmdata.CurrAsmList,OP_AND,location.size,right.location.register,tmpreg); - cg.a_load_reg_reg(current_asmdata.CurrAsmList,OS_INT,location.size,tmpreg,location.register); - end + cg.a_op_const_reg(current_asmdata.CurrAsmList,OP_AND,location.size,left.location.value,location.register) else - begin - cg.a_op_reg_reg(current_asmdata.CurrAsmList,OP_NOT,right.location.size,right.location.register,right.location.register); - cg.a_op_reg_reg(current_asmdata.CurrAsmList,OP_AND,left.location.size,right.location.register,left.location.register); - cg.a_load_reg_reg(current_asmdata.CurrAsmList,left.location.size,location.size,left.location.register,location.register); - end; + cg.a_op_reg_reg(current_asmdata.CurrAsmList,OP_AND,location.size,left.location.register,location.register); end; end; else |