Clean up dwarf2out.c
Richard Guenther
richard.guenther@gmail.com
Fri Apr 30 09:41:00 GMT 2010
2010/4/29 Anatoly Sokolov <aesok@post.ru>:
> Hi,
>
> This patch add rtx_to_double_int functions in the GCC and do clean up
> dwarf2out.c.
>
> Bootstrapped/regtested on x86_64-unknown-linux-gnu, OK for mainline?
Ok with ...
> * double-int.h (rtx_to_double_int): Declare.
> * double-int.c: Include rtl.h.
> (rtx_to_double_int): New function.
> * Makefile.in (double-int.o): Depend on $(RTL_BASE_H).
> * rtl.h (CONST_DOUBLE_P): Define.
> * dwarf2out.c (insert_double): New function.
> (loc_descriptor, add_const_value_attribute): Clean up, use
> rtx_to_double_int and insert_double functions.
>
>
> Index: gcc/double-int.c
> ===================================================================
> --- gcc/double-int.c (revision 158906)
> +++ gcc/double-int.c (working copy)
> @@ -22,6 +22,7 @@
> #include "coretypes.h"
> #include "tm.h"
> #include "tree.h"
> +#include "rtl.h"
>
> /* We know that A1 + B1 = SUM1, using 2's complement arithmetic and ignoring
> overflow. Suppose A, B and SUM have the same respective signs as A1, B1,
> @@ -1073,6 +1074,26 @@
> return double_int_equal_p (cst, ext);
> }
>
> +/* Constructs double_int from rtx CST. */
> +
> +double_int
> +rtx_to_double_int (const_rtx cst)
> +{
> + double_int r;
> +
> + if (CONST_INT_P (cst))
> + r = shwi_to_double_int (INTVAL (cst));
> + else if (CONST_DOUBLE_P (cst))
&& GET_MODE (cst) == VOIDmode
> Index: gcc/rtl.h
> ===================================================================
> --- gcc/rtl.h (revision 158906)
> +++ gcc/rtl.h (working copy)
> @@ -375,6 +375,9 @@
> /* Predicate yielding nonzero iff X is an rtx for a constant integer. */
> #define CONST_INT_P(X) (GET_CODE (X) == CONST_INT)
>
> +/* Predicate yielding true iff X is an rtx for a floating point constant. */
... for a double-int or floating point constant. */
Thanks,
Richard.
> +#define CONST_DOUBLE_P(X) (GET_CODE (X) == CONST_DOUBLE)
> +
> /* Predicate yielding nonzero iff X is a label insn. */
> #define LABEL_P(X) (GET_CODE (X) == CODE_LABEL)
>
> Index: gcc/Makefile.in
> ===================================================================
> --- gcc/Makefile.in (revision 158906)
> +++ gcc/Makefile.in (working copy)
> @@ -2213,7 +2213,8 @@
> convert.o: convert.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
> $(FLAGS_H) convert.h $(TOPLEV_H) langhooks.h $(REAL_H) fixed-value.h
>
> -double-int.o: double-int.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H)
> +double-int.o: double-int.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
> + $(RTL_BASE_H)
>
> # lto-compress.o needs $(ZLIBINC) added to the include flags.
> lto-compress.o: lto-compress.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
>
>
> Anatoly.
>
>
More information about the Gcc-patches
mailing list