}
/*@=unqualifiedtrans =nullderef -nullstate -onlytrans@*/
+/*@-unqualifiedtrans -nullderef -nullstate -onlytrans@*/
+const floatnum *
+expr_get_floatnum(expr **ep)
+{
+ *ep = expr_simplify(*ep);
+
+ if ((*ep)->op == EXPR_IDENT && (*ep)->terms[0].type == EXPR_FLOAT)
+ return (*ep)->terms[0].data.flt;
+ else
+ return (floatnum *)NULL;
+}
+/*@=unqualifiedtrans =nullderef -nullstate -onlytrans@*/
+
/*@-unqualifiedtrans -nullderef -nullstate -onlytrans@*/
const symrec *
expr_get_symrec(expr **ep, int simplify)
*/
/*@dependent@*/ /*@null@*/ const intnum *expr_get_intnum(expr **ep);
+/* Gets the float value of e if the expression is just an float. If the
+ * expression is more complex (contains anything other than floats, ie
+ * integers, non-valued labels, registers), returns NULL.
+ */
+/*@dependent@*/ /*@null@*/ const floatnum *expr_get_floatnum(expr **ep);
+
/* Gets the symrec value of e if the expression is just an symbol. If the
* expression is more complex, returns NULL. Simplifies the expr first if
* simplify is nonzero.
}
/*@=unqualifiedtrans =nullderef -nullstate -onlytrans@*/
+/*@-unqualifiedtrans -nullderef -nullstate -onlytrans@*/
+const floatnum *
+expr_get_floatnum(expr **ep)
+{
+ *ep = expr_simplify(*ep);
+
+ if ((*ep)->op == EXPR_IDENT && (*ep)->terms[0].type == EXPR_FLOAT)
+ return (*ep)->terms[0].data.flt;
+ else
+ return (floatnum *)NULL;
+}
+/*@=unqualifiedtrans =nullderef -nullstate -onlytrans@*/
+
/*@-unqualifiedtrans -nullderef -nullstate -onlytrans@*/
const symrec *
expr_get_symrec(expr **ep, int simplify)
*/
/*@dependent@*/ /*@null@*/ const intnum *expr_get_intnum(expr **ep);
+/* Gets the float value of e if the expression is just an float. If the
+ * expression is more complex (contains anything other than floats, ie
+ * integers, non-valued labels, registers), returns NULL.
+ */
+/*@dependent@*/ /*@null@*/ const floatnum *expr_get_floatnum(expr **ep);
+
/* Gets the symrec value of e if the expression is just an symbol. If the
* expression is more complex, returns NULL. Simplifies the expr first if
* simplify is nonzero.