This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[vta] expand_debug conversions from/to/between float modes
- From: Alexandre Oliva <aoliva at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 09 Jan 2008 07:06:18 -0200
- Subject: [vta] expand_debug conversions from/to/between float modes
I'd only handled conversions between non-float modes in
expand_debug_expr(). Oops. I noticed an odd (subreg:SF (reg:DF))
while looking into another problem, and figured I'd fix it, even
though I very much doubt debug info will ever be able to represent
such conversions reliably. If anything, this reduces memory use:
subregs take up one more operand than unary conversion operators ;-)
Installing in the vta branch.
for gcc/ChangeLog.vta
from Alexandre Oliva <aoliva@redhat.com>
* cfgexpand.c (expand_debug_expr): Handle conversion
from/to/between float modes.
Index: gcc/cfgexpand.c
===================================================================
--- gcc/cfgexpand.c.orig 2008-01-07 12:48:18.000000000 -0200
+++ gcc/cfgexpand.c 2008-01-07 17:12:52.000000000 -0200
@@ -1707,10 +1707,37 @@ expand_debug_expr (tree exp)
return op0;
if (inner_mode == VOIDmode)
- inner_mode = TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0)));
+ {
+ inner_mode = TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0)));
+ if (mode == inner_mode)
+ return op0;
+ }
- if (CONSTANT_P (op0)
- || GET_MODE_BITSIZE (mode) <= GET_MODE_BITSIZE (GET_MODE (op0)))
+ if (FLOAT_MODE_P (mode) && FLOAT_MODE_P (inner_mode))
+ {
+ if (GET_MODE_BITSIZE (mode) == GET_MODE_BITSIZE (inner_mode))
+ op0 = simplify_gen_subreg (mode, op0, inner_mode, 0);
+ else if (GET_MODE_BITSIZE (mode) < GET_MODE_BITSIZE (inner_mode))
+ op0 = simplify_gen_unary (FLOAT_TRUNCATE, mode, op0, inner_mode);
+ else
+ op0 = simplify_gen_unary (FLOAT_EXTEND, mode, op0, inner_mode);
+ }
+ else if (FLOAT_MODE_P (mode))
+ {
+ if (TYPE_UNSIGNED (TREE_TYPE (TREE_OPERAND (exp, 0))))
+ op0 = simplify_gen_unary (UNSIGNED_FLOAT, mode, op0, inner_mode);
+ else
+ op0 = simplify_gen_unary (FLOAT, mode, op0, inner_mode);
+ }
+ else if (FLOAT_MODE_P (inner_mode))
+ {
+ if (unsignedp)
+ op0 = simplify_gen_unary (UNSIGNED_FIX, mode, op0, inner_mode);
+ else
+ op0 = simplify_gen_unary (FIX, mode, op0, inner_mode);
+ }
+ else if (CONSTANT_P (op0)
+ || GET_MODE_BITSIZE (mode) <= GET_MODE_BITSIZE (inner_mode))
op0 = simplify_gen_subreg (mode, op0, inner_mode,
subreg_lowpart_offset (mode,
inner_mode));
--
Alexandre Oliva http://www.lsd.ic.unicamp.br/~oliva/
FSF Latin America Board Member http://www.fsfla.org/
Red Hat Compiler Engineer aoliva@{redhat.com, gcc.gnu.org}
Free Software Evangelist oliva@{lsd.ic.unicamp.br, gnu.org}