return ret;
}
+/* Create a temporary variable and assign the given value to that
+ variable with a cast. Insert the assignment before the join point
+ and return the temporary value. */
+static tree
+insert_cast (tree val, tree cast_type, struct aop_joinpoint *jp)
+{
+ tree tmp;
+ tree cast;
+ gimple cast_assign;
+
+ tmp = create_tmp_var (cast_type, "ia_cast");
+ cast = build1 (CONVERT_EXPR, cast_type, val);
+
+ cast_assign = gimple_build_assign (tmp, cast);
+ jp->pc->insert_before (jp, cast_assign);
+
+ return tmp;
+}
+
/* Whenver InterAspect matches an "all signed" or "all unsigned"
value, it needs to cast it up to a long long before passing it. */
static tree
-cast_to_all_integer (tree val)
+cast_to_all_integer (tree val, struct aop_joinpoint *jp)
{
tree gcc_type;
HOST_WIDE_INT size;
tree cast_type = TYPE_UNSIGNED (gcc_type) ? long_long_unsigned_type_node
: long_long_integer_type_node;
- val = build1 (CONVERT_EXPR, cast_type, val);
- return val;
+ return insert_cast (val, cast_type, jp);
}
else
{
}
}
+/* Similar to cast_to_all_integer, above. */
static tree
-cast_to_all_fp (tree val)
+cast_to_all_fp (tree val, struct aop_joinpoint *jp)
{
tree gcc_type;
HOST_WIDE_INT size;
if (size != 8)
{
- val = build1 (CONVERT_EXPR, double_type_node, val);
- return val;
+ return insert_cast (val, double_type_node, jp);
}
else
{
val = dv->get_dynval (dv);
if (is_all_integer_type (dv->type))
- val = cast_to_all_integer (val);
+ val = cast_to_all_integer (val, dv->jp);
else if (is_all_fp_type (dv->type))
- val = cast_to_all_fp (val);
+ val = cast_to_all_fp (val, dv->jp);
return val;
}