Proper compile time processing of arithmetic right shift
Handle arithmetic right shift during compile time. This comes up with both the operands are constant expressions. the compiler is able to evaluate this down to a constant to replace the expression. Signed-off-by: Stephen Williams <steve@icarus.com>
This commit is contained in:
parent
05a6e69d2d
commit
bab9c7adba
11
eval_tree.cc
11
eval_tree.cc
|
|
@ -16,9 +16,6 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: eval_tree.cc,v 1.77 2007/06/02 03:42:12 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
# include "compiler.h"
|
||||
|
|
@ -1075,9 +1072,13 @@ NetEConst* NetEBShift::eval_tree(int prune_to_width)
|
|||
wid = prune_to_width;
|
||||
|
||||
assert(wid);
|
||||
verinum nv (verinum::V0, wid, lv.has_len());
|
||||
verinum::V pad = verinum::V0;
|
||||
if (op() == 'R' && has_sign()) {
|
||||
pad = lv[lv.len()-1];
|
||||
}
|
||||
verinum nv (pad, wid, lv.has_len());
|
||||
|
||||
if (op() == 'r') {
|
||||
if (op() == 'r' || op() == 'R') {
|
||||
unsigned cnt = wid;
|
||||
if (cnt > nv.len())
|
||||
cnt = nv.len();
|
||||
|
|
|
|||
|
|
@ -16,9 +16,6 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: pform_dump.cc,v 1.101 2007/06/04 02:19:07 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
||||
|
|
@ -243,6 +240,9 @@ void PEBinary::dump(ostream&out) const
|
|||
case 'N':
|
||||
out << "!==";
|
||||
break;
|
||||
case 'R':
|
||||
out << ">>>";
|
||||
break;
|
||||
case 'r':
|
||||
out << ">>";
|
||||
break;
|
||||
|
|
|
|||
Loading…
Reference in New Issue