}
/*@=unqualifiedtrans =nullderef -nullstate -onlytrans@*/
+/*@-unqualifiedtrans -nullderef -nullstate -onlytrans@*/
+const symrec *
+expr_get_symrec(expr **ep, int simplify)
+{
+ if (simplify)
+ *ep = expr_simplify(*ep);
+
+ if ((*ep)->op == EXPR_IDENT && (*ep)->terms[0].type == EXPR_SYM)
+ return (*ep)->terms[0].data.sym;
+ else
+ return (symrec *)NULL;
+}
+/*@=unqualifiedtrans =nullderef -nullstate -onlytrans@*/
+
void
expr_print(expr *e)
{
*/
/*@dependent@*/ /*@null@*/ const intnum *expr_get_intnum(expr **ep);
+/* Gets the symrec value of e if the expression is just an integer. If the
+ * expression is more complex, returns NULL. Simplifies the expr first if
+ * simplify is nonzero.
+ */
+/*@dependent@*/ /*@null@*/ const symrec *expr_get_symrec(expr **ep,
+ int simplify);
+
void expr_print(expr *);
#endif
}
/*@=unqualifiedtrans =nullderef -nullstate -onlytrans@*/
+/*@-unqualifiedtrans -nullderef -nullstate -onlytrans@*/
+const symrec *
+expr_get_symrec(expr **ep, int simplify)
+{
+ if (simplify)
+ *ep = expr_simplify(*ep);
+
+ if ((*ep)->op == EXPR_IDENT && (*ep)->terms[0].type == EXPR_SYM)
+ return (*ep)->terms[0].data.sym;
+ else
+ return (symrec *)NULL;
+}
+/*@=unqualifiedtrans =nullderef -nullstate -onlytrans@*/
+
void
expr_print(expr *e)
{
*/
/*@dependent@*/ /*@null@*/ const intnum *expr_get_intnum(expr **ep);
+/* Gets the symrec value of e if the expression is just an integer. If the
+ * expression is more complex, returns NULL. Simplifies the expr first if
+ * simplify is nonzero.
+ */
+/*@dependent@*/ /*@null@*/ const symrec *expr_get_symrec(expr **ep,
+ int simplify);
+
void expr_print(expr *);
#endif