Fix for stubborn compiler.

This commit is contained in:
steve 2005-11-27 17:01:56 +00:00
parent 6161904bf8
commit 8ed504b064
4 changed files with 34 additions and 22 deletions

21
PExpr.h
View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#ifdef HAVE_CVS_IDENT #ifdef HAVE_CVS_IDENT
#ident "$Id: PExpr.h,v 1.73 2005/11/27 05:56:20 steve Exp $" #ident "$Id: PExpr.h,v 1.74 2005/11/27 17:01:56 steve Exp $"
#endif #endif
# include <string> # include <string>
@ -96,7 +96,7 @@ class PExpr : public LineInfo {
// This attempts to evaluate a constant expression, and return // This attempts to evaluate a constant expression, and return
// a verinum as a result. If the expression cannot be // a verinum as a result. If the expression cannot be
// evaluated, return 0. // evaluated, return 0.
virtual verinum* eval_const(const Design*des, const NetScope*sc) const; virtual verinum* eval_const(const Design*des, NetScope*sc) const;
// This method returns true if that expression is the same as // This method returns true if that expression is the same as
// this expression. This method is used for comparing // this expression. This method is used for comparing
@ -187,7 +187,7 @@ class PEFNumber : public PExpr {
/* The eval_const method as applied to a floating point number /* The eval_const method as applied to a floating point number
gets the *integer* value of the number. This accounts for gets the *integer* value of the number. This accounts for
any rounding that is needed to get the value. */ any rounding that is needed to get the value. */
virtual verinum* eval_const(const Design*des, const NetScope*sc) const; virtual verinum* eval_const(const Design*des, NetScope*sc) const;
/* A PEFNumber is a constant, so this returns true. */ /* A PEFNumber is a constant, so this returns true. */
virtual bool is_constant(Module*) const; virtual bool is_constant(Module*) const;
@ -247,7 +247,7 @@ class PEIdent : public PExpr {
NetNet* elaborate_port(Design*des, NetScope*sc) const; NetNet* elaborate_port(Design*des, NetScope*sc) const;
virtual bool is_constant(Module*) const; virtual bool is_constant(Module*) const;
verinum* eval_const(const Design*des, const NetScope*sc) const; verinum* eval_const(const Design*des, NetScope*sc) const;
const hname_t& path() const; const hname_t& path() const;
@ -343,7 +343,7 @@ class PENumber : public PExpr {
NetScope*scope, NetScope*scope,
bool is_force) const; bool is_force) const;
virtual verinum* eval_const(const Design*des, const NetScope*sc) const; virtual verinum* eval_const(const Design*des, NetScope*sc) const;
virtual bool is_the_same(const PExpr*that) const; virtual bool is_the_same(const PExpr*that) const;
virtual bool is_constant(Module*) const; virtual bool is_constant(Module*) const;
@ -377,7 +377,7 @@ class PEString : public PExpr {
virtual NetEConst*elaborate_expr(Design*des, NetScope*, virtual NetEConst*elaborate_expr(Design*des, NetScope*,
bool sys_task_arg =false) const; bool sys_task_arg =false) const;
virtual NetEConst*elaborate_pexpr(Design*des, NetScope*sc) const; virtual NetEConst*elaborate_pexpr(Design*des, NetScope*sc) const;
verinum* PEString::eval_const(const Design*, const NetScope*) const; verinum* PEString::eval_const(const Design*, NetScope*) const;
virtual bool is_constant(Module*) const; virtual bool is_constant(Module*) const;
@ -402,7 +402,7 @@ class PEUnary : public PExpr {
virtual NetExpr*elaborate_expr(Design*des, NetScope*, virtual NetExpr*elaborate_expr(Design*des, NetScope*,
bool sys_task_arg =false) const; bool sys_task_arg =false) const;
virtual NetExpr*elaborate_pexpr(Design*des, NetScope*sc) const; virtual NetExpr*elaborate_pexpr(Design*des, NetScope*sc) const;
virtual verinum* eval_const(const Design*des, const NetScope*sc) const; virtual verinum* eval_const(const Design*des, NetScope*sc) const;
virtual bool is_constant(Module*) const; virtual bool is_constant(Module*) const;
@ -430,7 +430,7 @@ class PEBinary : public PExpr {
virtual NetEBinary*elaborate_expr(Design*des, NetScope*, virtual NetEBinary*elaborate_expr(Design*des, NetScope*,
bool sys_task_arg =false) const; bool sys_task_arg =false) const;
virtual NetExpr*elaborate_pexpr(Design*des, NetScope*sc) const; virtual NetExpr*elaborate_pexpr(Design*des, NetScope*sc) const;
virtual verinum* eval_const(const Design*des, const NetScope*sc) const; virtual verinum* eval_const(const Design*des, NetScope*sc) const;
private: private:
char op_; char op_;
@ -504,7 +504,7 @@ class PETernary : public PExpr {
virtual NetETernary*elaborate_expr(Design*des, NetScope*, virtual NetETernary*elaborate_expr(Design*des, NetScope*,
bool sys_task_arg =false) const; bool sys_task_arg =false) const;
virtual NetETernary*elaborate_pexpr(Design*des, NetScope*sc) const; virtual NetETernary*elaborate_pexpr(Design*des, NetScope*sc) const;
virtual verinum* eval_const(const Design*des, const NetScope*sc) const; virtual verinum* eval_const(const Design*des, NetScope*sc) const;
private: private:
PExpr*expr_; PExpr*expr_;
@ -545,6 +545,9 @@ class PECallFunction : public PExpr {
/* /*
* $Log: PExpr.h,v $ * $Log: PExpr.h,v $
* Revision 1.74 2005/11/27 17:01:56 steve
* Fix for stubborn compiler.
*
* Revision 1.73 2005/11/27 05:56:20 steve * Revision 1.73 2005/11/27 05:56:20 steve
* Handle bit select of parameter with ranges. * Handle bit select of parameter with ranges.
* *

21
eval.cc
View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#ifdef HAVE_CVS_IDENT #ifdef HAVE_CVS_IDENT
#ident "$Id: eval.cc,v 1.37 2005/11/27 05:56:20 steve Exp $" #ident "$Id: eval.cc,v 1.38 2005/11/27 17:01:57 steve Exp $"
#endif #endif
# include "config.h" # include "config.h"
@ -29,12 +29,12 @@
# include "netmisc.h" # include "netmisc.h"
# include "compiler.h" # include "compiler.h"
verinum* PExpr::eval_const(const Design*, const NetScope*) const verinum* PExpr::eval_const(const Design*, NetScope*) const
{ {
return 0; return 0;
} }
verinum* PEBinary::eval_const(const Design*des, const NetScope*scope) const verinum* PEBinary::eval_const(const Design*des, NetScope*scope) const
{ {
verinum*l = left_->eval_const(des, scope); verinum*l = left_->eval_const(des, scope);
if (l == 0) return 0; if (l == 0) return 0;
@ -149,7 +149,7 @@ verinum* PEBinary::eval_const(const Design*des, const NetScope*scope) const
* Evaluate an identifier as a constant expression. This is only * Evaluate an identifier as a constant expression. This is only
* possible if the identifier is that of a parameter. * possible if the identifier is that of a parameter.
*/ */
verinum* PEIdent::eval_const(const Design*des, const NetScope*scope) const verinum* PEIdent::eval_const(const Design*des, NetScope*scope) const
{ {
assert(scope); assert(scope);
//const NetExpr*expr = des->find_parameter(scope, path_); //const NetExpr*expr = des->find_parameter(scope, path_);
@ -180,23 +180,23 @@ verinum* PEIdent::eval_const(const Design*des, const NetScope*scope) const
return new verinum(eval->value()); return new verinum(eval->value());
} }
verinum* PEFNumber::eval_const(const Design*, const NetScope*) const verinum* PEFNumber::eval_const(const Design*, NetScope*) const
{ {
long val = value_->as_long(); long val = value_->as_long();
return new verinum(val); return new verinum(val);
} }
verinum* PENumber::eval_const(const Design*, const NetScope*) const verinum* PENumber::eval_const(const Design*, NetScope*) const
{ {
return new verinum(value()); return new verinum(value());
} }
verinum* PEString::eval_const(const Design*, const NetScope*) const verinum* PEString::eval_const(const Design*, NetScope*) const
{ {
return new verinum(string(text_)); return new verinum(string(text_));
} }
verinum* PETernary::eval_const(const Design*des, const NetScope*scope) const verinum* PETernary::eval_const(const Design*des, NetScope*scope) const
{ {
verinum*test = expr_->eval_const(des, scope); verinum*test = expr_->eval_const(des, scope);
if (test == 0) if (test == 0)
@ -216,7 +216,7 @@ verinum* PETernary::eval_const(const Design*des, const NetScope*scope) const
} }
} }
verinum* PEUnary::eval_const(const Design*des, const NetScope*scope) const verinum* PEUnary::eval_const(const Design*des, NetScope*scope) const
{ {
verinum*val = expr_->eval_const(des, scope); verinum*val = expr_->eval_const(des, scope);
if (val == 0) if (val == 0)
@ -247,6 +247,9 @@ verinum* PEUnary::eval_const(const Design*des, const NetScope*scope) const
/* /*
* $Log: eval.cc,v $ * $Log: eval.cc,v $
* Revision 1.38 2005/11/27 17:01:57 steve
* Fix for stubborn compiler.
*
* Revision 1.37 2005/11/27 05:56:20 steve * Revision 1.37 2005/11/27 05:56:20 steve
* Handle bit select of parameter with ranges. * Handle bit select of parameter with ranges.
* *

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#ifdef HAVE_CVS_IDENT #ifdef HAVE_CVS_IDENT
#ident "$Id: eval_attrib.cc,v 1.7 2004/02/20 18:53:35 steve Exp $" #ident "$Id: eval_attrib.cc,v 1.8 2005/11/27 17:01:57 steve Exp $"
#endif #endif
# include "config.h" # include "config.h"
@ -36,7 +36,7 @@
attrib_list_t* evaluate_attributes(const map<perm_string,PExpr*>&att, attrib_list_t* evaluate_attributes(const map<perm_string,PExpr*>&att,
unsigned&natt, unsigned&natt,
const Design*des, const Design*des,
const NetScope*scope) NetScope*scope)
{ {
natt = att.size(); natt = att.size();
if (natt == 0) if (natt == 0)
@ -74,6 +74,9 @@ attrib_list_t* evaluate_attributes(const map<perm_string,PExpr*>&att,
/* /*
* $Log: eval_attrib.cc,v $ * $Log: eval_attrib.cc,v $
* Revision 1.8 2005/11/27 17:01:57 steve
* Fix for stubborn compiler.
*
* Revision 1.7 2004/02/20 18:53:35 steve * Revision 1.7 2004/02/20 18:53:35 steve
* Addtrbute keys are perm_strings. * Addtrbute keys are perm_strings.
* *

7
util.h
View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#ifdef HAVE_CVS_IDENT #ifdef HAVE_CVS_IDENT
#ident "$Id: util.h,v 1.7 2004/02/20 18:53:36 steve Exp $" #ident "$Id: util.h,v 1.8 2005/11/27 17:01:57 steve Exp $"
#endif #endif
# include <map> # include <map>
@ -47,10 +47,13 @@ struct attrib_list_t {
extern attrib_list_t* evaluate_attributes(const map<perm_string,PExpr*>&att, extern attrib_list_t* evaluate_attributes(const map<perm_string,PExpr*>&att,
unsigned&natt, unsigned&natt,
const Design*des, const Design*des,
const NetScope*scope); NetScope*scope);
/* /*
* $Log: util.h,v $ * $Log: util.h,v $
* Revision 1.8 2005/11/27 17:01:57 steve
* Fix for stubborn compiler.
*
* Revision 1.7 2004/02/20 18:53:36 steve * Revision 1.7 2004/02/20 18:53:36 steve
* Addtrbute keys are perm_strings. * Addtrbute keys are perm_strings.
* *