From: Marc Glisse <marc.glisse@inria.fr>
To: gcc-patches@gcc.gnu.org
Subject: extern "C" fixes for sunCC
Date: Tue, 11 Dec 2012 21:40:00 -0000 [thread overview]
Message-ID: <alpine.DEB.2.02.1212112220230.21043@stedding.saclay.inria.fr> (raw)
[-- Attachment #1: Type: TEXT/PLAIN, Size: 836 bytes --]
Hello,
this patch should help if we ever want to use sunCC to initiate a
bootstrap, though I didn't test with sunCC. Note that using gmp_fprintf
means we have to include stdio.h before gmp.h. I didn't investigate how,
but this seems to already be the case :-) The reallocator cast is just a
hack, but the point here is only to help sunCC, making gcc extern
"C"-clean is a larger task...
Passes bootstrap+testsuite on x86_64-linux using the system's gcc
(graphite is enabled, don't know if this particular code is exercised).
2012-12-12 Marc Glisse <marc.glisse@inria.fr>
PR bootstrap/50167
PR bootstrap/50177
libcpp/
* line-map.c (get_combined_adhoc_loc): Cast to extern "C" type.
gcc/
* graphite-interchange.c (pdr_stride_in_loop): Use gmp_fprintf.
* graphite-poly.c (debug_gmp_value): Likewise.
--
Marc Glisse
[-- Attachment #2: Type: TEXT/PLAIN, Size: 3389 bytes --]
Index: gcc/graphite-poly.c
===================================================================
--- gcc/graphite-poly.c (revision 194404)
+++ gcc/graphite-poly.c (working copy)
@@ -48,26 +48,21 @@ along with GCC; see the file COPYING3.
#include "graphite-poly.h"
#define OPENSCOP_MAX_STRING 256
/* Print to STDERR the GMP value VAL. */
DEBUG_FUNCTION void
debug_gmp_value (mpz_t val)
{
- char *str = mpz_get_str (0, 10, val);
- void (*gmp_free) (void *, size_t);
-
- fprintf (stderr, "%s", str);
- mp_get_memory_functions (NULL, NULL, &gmp_free);
- (*gmp_free) (str, strlen (str) + 1);
+ gmp_fprintf (stderr, "%Zd", val);
}
/* Return the maximal loop depth in SCOP. */
int
scop_max_loop_depth (scop_p scop)
{
int i;
poly_bb_p pbb;
int max_nb_loops = 0;
Index: gcc/graphite-interchange.c
===================================================================
--- gcc/graphite-interchange.c (revision 194404)
+++ gcc/graphite-interchange.c (working copy)
@@ -233,29 +233,22 @@ pdr_stride_in_loop (mpz_t stride, graphi
aff = isl_aff_set_coefficient_si (aff, isl_dim_in, offset + offset - 1, 1);
isl_int_init (islstride);
isl_set_max (set, aff, &islstride);
isl_int_get_gmp (islstride, stride);
isl_int_clear (islstride);
isl_aff_free (aff);
isl_set_free (set);
if (dump_file && (dump_flags & TDF_DETAILS))
{
- char *str;
- void (*gmp_free) (void *, size_t);
-
- fprintf (dump_file, "\nStride in BB_%d, DR_%d, depth %d:",
- pbb_index (pbb), PDR_ID (pdr), (int) depth);
- str = mpz_get_str (0, 10, stride);
- fprintf (dump_file, " %s ", str);
- mp_get_memory_functions (NULL, NULL, &gmp_free);
- (*gmp_free) (str, strlen (str) + 1);
+ gmp_fprintf (dump_file, "\nStride in BB_%d, DR_%d, depth %d: %Zd ",
+ pbb_index (pbb), PDR_ID (pdr), (int) depth, stride);
}
}
/* Sets STRIDES to the sum of all the strides of the data references
accessed in LOOP at DEPTH. */
static void
memory_strides_in_loop_1 (lst_p loop, graphite_dim_t depth, mpz_t strides)
{
int i, j;
Index: libcpp/line-map.c
===================================================================
--- libcpp/line-map.c (revision 194404)
+++ libcpp/line-map.c (working copy)
@@ -116,21 +116,22 @@ get_combined_adhoc_loc (struct line_maps
slot = (struct location_adhoc_data **)
htab_find_slot (set->location_adhoc_data_map.htab, &lb, INSERT);
if (*slot == NULL)
{
if (set->location_adhoc_data_map.curr_loc >=
set->location_adhoc_data_map.allocated)
{
char *orig_data = (char *) set->location_adhoc_data_map.data;
long long offset;
line_map_realloc reallocator
- = set->reallocator ? set->reallocator : xrealloc;
+ = set->reallocator ? set->reallocator
+ : (line_map_realloc) xrealloc;
if (set->location_adhoc_data_map.allocated == 0)
set->location_adhoc_data_map.allocated = 128;
else
set->location_adhoc_data_map.allocated *= 2;
set->location_adhoc_data_map.data = (struct location_adhoc_data *)
reallocator (set->location_adhoc_data_map.data,
set->location_adhoc_data_map.allocated
* sizeof (struct location_adhoc_data));
offset = (char *) (set->location_adhoc_data_map.data) - orig_data;
next reply other threads:[~2012-12-11 21:40 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-11 21:40 Marc Glisse [this message]
2013-01-02 13:45 ` Marc Glisse
2013-01-02 14:09 ` Richard Biener
2013-01-03 15:44 ` Tom Tromey
2013-01-03 16:12 ` Marc Glisse
2013-01-03 17:28 ` Tom Tromey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.DEB.2.02.1212112220230.21043@stedding.saclay.inria.fr \
--to=marc.glisse@inria.fr \
--cc=gcc-patches@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).