From: Jan Hubicka Date: Wed, 26 Apr 2017 09:57:38 +0000 (+0200) Subject: sreal.c: Include backend.h, tree.h, gimple.h, cgraph.h and data-streamer.h X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8a267096506388a0165d869daa42607b8bf96583;p=gcc.git sreal.c: Include backend.h, tree.h, gimple.h, cgraph.h and data-streamer.h * sreal.c: Include backend.h, tree.h, gimple.h, cgraph.h and data-streamer.h (sreal::stream_out, sreal::stream_in): New. * sreal.h (sreal::stream_out, sreal::stream_in): Declare. From-SVN: r247276 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 91f81aaec4c..41df066dae7 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2017-04-25 Jan Hubicka + + * sreal.c: Include backend.h, tree.h, gimple.h, cgraph.h and + data-streamer.h + (sreal::stream_out, sreal::stream_in): New. + * sreal.h (sreal::stream_out, sreal::stream_in): Declare. + 2017-04-25 Jakub Jelinek * Makefile.in (s-options): Invoke opt-gather.awk with LC_ALL=C in the diff --git a/gcc/sreal.c b/gcc/sreal.c index 72d5891b6d1..3993e27e6bf 100644 --- a/gcc/sreal.c +++ b/gcc/sreal.c @@ -53,6 +53,11 @@ along with GCC; see the file COPYING3. If not see #include "coretypes.h" #include "sreal.h" #include "selftest.h" +#include "backend.h" +#include "tree.h" +#include "gimple.h" +#include "cgraph.h" +#include "data-streamer.h" /* Print the content of struct sreal. */ @@ -236,6 +241,26 @@ sreal::operator/ (const sreal &other) const return r; } +/* Stream sreal value to OB. */ + +void +sreal::stream_out (struct output_block *ob) +{ + streamer_write_hwi (ob, m_sig); + streamer_write_hwi (ob, m_exp); +} + +/* Read sreal value from IB. */ + +sreal +sreal::stream_in (struct lto_input_block *ib) +{ + sreal val; + val.m_sig = streamer_read_hwi (ib); + val.m_exp = streamer_read_hwi (ib); + return val; +} + #if CHECKING_P namespace selftest { diff --git a/gcc/sreal.h b/gcc/sreal.h index 917ce3ebac9..18a454c5017 100644 --- a/gcc/sreal.h +++ b/gcc/sreal.h @@ -34,6 +34,9 @@ along with GCC; see the file COPYING3. If not see #define SREAL_SIGN(v) (v < 0 ? -1: 1) #define SREAL_ABS(v) (v < 0 ? -v: v) +struct output_block; +struct lto_input_block; + /* Structure for holding a simple real number. */ class sreal { @@ -50,6 +53,8 @@ public: void dump (FILE *) const; int64_t to_int () const; double to_double () const; + void stream_out (struct output_block *); + static sreal stream_in (struct lto_input_block *); sreal operator+ (const sreal &other) const; sreal operator- (const sreal &other) const; sreal operator* (const sreal &other) const;