source: scripts/patch/gcc/4.4.0/01-cloog-fixes.patch@ bcb91ad

clfs-1.2
Last change on this file since bcb91ad was 76c9fbb, checked in by Jim Gifford <clfs@…>, 15 years ago

Modifications to GCC to fix PPC Build Issues

  • Property mode set to 100644
File size: 6.4 KB
  • gcc/graphite.c

    2009-01-27  Jakub Jelinek  <jakub@redhat.com>
    
    	* Makefile.in (BACKENDLIBS): Link against -ldl instead of -lcloog -lppl.
    	(graphite.o): Force -O, remove -fkeep-inline-functions.
    	* graphite.c: Include <dlfcn.h>.  Reference libcloog and libppl symbols
    	through pointers in cloog_pointers variable.
    	(init_cloog_pointers): New function.
    	(gcc_type_for_iv_of_clast_loop): Rename stmt_for argument to stmt_fora.
    	(graphite_transform_loops): Call init_cloog_pointers.
    
    diff -Naur gcc-4.4.0.orig/gcc/graphite.c gcc-4.4.0/gcc/graphite.c
    old new  
    5959#include "cloog/cloog.h"
    6060#include "graphite.h"
    6161
     62#include <dlfcn.h>
     63#define DYNSYMS \
     64  DYNSYM (cloog_block_alloc); \
     65  DYNSYM (cloog_block_list_free); \
     66  DYNSYM (cloog_block_list_malloc); \
     67  DYNSYM (cloog_clast_create); \
     68  DYNSYM (cloog_clast_free); \
     69  DYNSYM (cloog_domain_free); \
     70  DYNSYM (cloog_domain_matrix2domain); \
     71  DYNSYM (cloog_initialize); \
     72  DYNSYM (cloog_loop_malloc); \
     73  DYNSYM (cloog_matrix_alloc); \
     74  DYNSYM (cloog_matrix_copy); \
     75  DYNSYM (cloog_matrix_free); \
     76  DYNSYM (cloog_matrix_print); \
     77  DYNSYM (cloog_names_malloc); \
     78  DYNSYM (cloog_names_scalarize); \
     79  DYNSYM (cloog_options_free); \
     80  DYNSYM (cloog_options_malloc); \
     81  DYNSYM (cloog_program_dump_cloog); \
     82  DYNSYM (cloog_program_extract_scalars); \
     83  DYNSYM (cloog_program_free); \
     84  DYNSYM (cloog_program_generate); \
     85  DYNSYM (cloog_program_malloc); \
     86  DYNSYM (cloog_program_print); \
     87  DYNSYM (cloog_program_scatter); \
     88  DYNSYM (cloog_statement_alloc); \
     89  DYNSYM (ppl_finalize); \
     90  DYNSYM (pprint); \
     91  DYNSYM (stmt_block); \
     92  DYNSYM (stmt_for); \
     93  DYNSYM (stmt_guard); \
     94  DYNSYM (stmt_root); \
     95  DYNSYM (stmt_user);
     96static struct
     97{
     98  bool inited;
     99  void *h;
     100#define DYNSYM(x) __typeof (x) *p_##x
     101  DYNSYMS
     102#undef DYNSYM
     103} cloog_pointers;
     104
     105#define cloog_block_alloc (*cloog_pointers.p_cloog_block_alloc)
     106#define cloog_block_list_free (*cloog_pointers.p_cloog_block_list_free)
     107#define cloog_block_list_malloc (*cloog_pointers.p_cloog_block_list_malloc)
     108#define cloog_clast_create (*cloog_pointers.p_cloog_clast_create)
     109#define cloog_clast_free (*cloog_pointers.p_cloog_clast_free)
     110#define cloog_domain_free (*cloog_pointers.p_cloog_domain_free)
     111#define cloog_domain_matrix2domain (*cloog_pointers.p_cloog_domain_matrix2domain)
     112#define cloog_initialize (*cloog_pointers.p_cloog_initialize)
     113#define cloog_loop_malloc (*cloog_pointers.p_cloog_loop_malloc)
     114#define cloog_matrix_alloc (*cloog_pointers.p_cloog_matrix_alloc)
     115#define cloog_matrix_copy (*cloog_pointers.p_cloog_matrix_copy)
     116#define cloog_matrix_free (*cloog_pointers.p_cloog_matrix_free)
     117#define cloog_matrix_print (*cloog_pointers.p_cloog_matrix_print)
     118#define cloog_names_malloc (*cloog_pointers.p_cloog_names_malloc)
     119#define cloog_names_scalarize (*cloog_pointers.p_cloog_names_scalarize)
     120#define cloog_options_free (*cloog_pointers.p_cloog_options_free)
     121#define cloog_options_malloc (*cloog_pointers.p_cloog_options_malloc)
     122#define cloog_program_dump_cloog (*cloog_pointers.p_cloog_program_dump_cloog)
     123#define cloog_program_extract_scalars (*cloog_pointers.p_cloog_program_extract_scalars)
     124#define cloog_program_free (*cloog_pointers.p_cloog_program_free)
     125#define cloog_program_generate (*cloog_pointers.p_cloog_program_generate)
     126#define cloog_program_malloc (*cloog_pointers.p_cloog_program_malloc)
     127#define cloog_program_print (*cloog_pointers.p_cloog_program_print)
     128#define cloog_program_scatter (*cloog_pointers.p_cloog_program_scatter)
     129#define cloog_statement_alloc (*cloog_pointers.p_cloog_statement_alloc)
     130#define ppl_finalize (*cloog_pointers.p_ppl_finalize)
     131#define pprint (*cloog_pointers.p_pprint)
     132#define stmt_block (*cloog_pointers.p_stmt_block)
     133#define stmt_for (*cloog_pointers.p_stmt_for)
     134#define stmt_guard (*cloog_pointers.p_stmt_guard)
     135#define stmt_root (*cloog_pointers.p_stmt_root)
     136#define stmt_user (*cloog_pointers.p_stmt_user)
     137
     138#define cloog_finalize (*cloog_pointers.p_ppl_finalize)
     139
     140static bool
     141init_cloog_pointers (void)
     142{
     143  void *h;
     144
     145  if (cloog_pointers.inited)
     146    return cloog_pointers.h != NULL;
     147  h = dlopen ("libcloog.so.0", RTLD_LAZY);
     148  cloog_pointers.h = h;
     149  if (h == NULL)
     150    return false;
     151#define DYNSYM(x) \
     152  do \
     153    { \
     154      union { __typeof (cloog_pointers.p_##x) p; void *q; } u; \
     155      u.q = dlsym (h, #x); \
     156      if (u.q == NULL) \
     157        return false; \
     158      cloog_pointers.p_##x = u.p; \
     159    } \
     160  while (0)
     161  DYNSYMS
     162#undef DYNSYM
     163  return true;
     164}
     165
    62166static VEC (scop_p, heap) *current_scops;
    63167
    64168/* Converts a GMP constant V to a tree and returns it.  */
     
    40754179   STMT.  */
    40764180
    40774181static tree
    4078 gcc_type_for_iv_of_clast_loop (struct clast_for *stmt_for)
     4182gcc_type_for_iv_of_clast_loop (struct clast_for *stmt_fora)
    40794183{
    4080   struct clast_user_stmt *stmt = clast_get_body_of_loop ((struct clast_stmt *) stmt_for);
    4081   const char *cloog_iv = stmt_for->iterator;
     4184  struct clast_user_stmt *stmt = clast_get_body_of_loop ((struct clast_stmt *) stmt_fora);
     4185  const char *cloog_iv = stmt_fora->iterator;
    40824186  CloogStatement *cs = stmt->statement;
    40834187  graphite_bb_p gbb = (graphite_bb_p) cloog_statement_usr (cs);
    40844188
     
    61096213  if (number_of_loops () <= 1)
    61106214    return;
    61116215
     6216  if (!init_cloog_pointers ())
     6217    {
     6218      sorry ("Graphite loop optimizations cannot be used");
     6219      return;
     6220    }
     6221
    61126222  current_scops = VEC_alloc (scop_p, heap, 3);
    61136223  recompute_all_dominators ();
    61146224
  • gcc/Makefile.in

    diff -Naur gcc-4.4.0.orig/gcc/Makefile.in gcc-4.4.0/gcc/Makefile.in
    old new  
    914914# How to link with both our special library facilities
    915915# and the system's installed libraries.
    916916LIBS = @LIBS@ $(CPPLIB) $(LIBINTL) $(LIBICONV) $(LIBIBERTY) $(LIBDECNUMBER)
    917 BACKENDLIBS = $(CLOOGLIBS) $(PPLLIBS) $(GMPLIBS)
     917BACKENDLIBS = $(GMPLIBS) $(if $(CLOOGLIBS),-ldl)
    918918# Any system libraries needed just for GNAT.
    919919SYSLIBS = @GNAT_LIBEXC@
    920920
     
    30613061        $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) \
    30623062                $(out_file) $(OUTPUT_OPTION)
    30633063
     3064graphite.o : \
     3065  ALL_CFLAGS := -O $(filter-out -fkeep-inline-functions, $(ALL_CFLAGS))
     3066
    30643067# Build auxiliary files that support ecoff format.
    30653068mips-tfile: mips-tfile.o version.o $(LIBDEPS)
    30663069        $(CC) $(CFLAGS) $(LDFLAGS) -o $@ mips-tfile.o version.o $(LIBS)
Note: See TracBrowser for help on using the repository browser.