Run the x87 simulator when a graph contains Calls, which return floats.
authorChristoph Mallon <christoph.mallon@gmx.de>
Fri, 22 Aug 2008 14:22:33 +0000 (14:22 +0000)
committerChristoph Mallon <christoph.mallon@gmx.de>
Fri, 22 Aug 2008 14:22:33 +0000 (14:22 +0000)
[r21352]

ir/be/ia32/ia32_transform.c

index bf8b48d..682868c 100644 (file)
@@ -4318,8 +4318,21 @@ static ir_node *gen_Proj_Quot(ir_node *node) {
 
 static ir_node *gen_be_Call(ir_node *node) {
        ir_node *res = be_duplicate_node(node);
+       ir_type *call_tp;
+
        be_node_add_flags(res, -1, arch_irn_flags_modify_flags);
 
+       /* Run the x87 simulator if the call returns a float value */
+       call_tp = be_Call_get_type(node);
+       if (get_method_n_ress(call_tp) > 0) {
+               ir_type *const res_type = get_method_res_type(call_tp, 0);
+               ir_mode *const res_mode = get_type_mode(res_type);
+
+               if (res_mode != NULL && mode_is_float(res_mode)) {
+                       env_cg->do_x87_sim = 1;
+               }
+       }
+
        return res;
 }