From d35b394f00763b5e4fa401817feb8cfe22241a36 Mon Sep 17 00:00:00 2001 From: redbrain Date: Tue, 14 Sep 2010 23:59:54 +0100 Subject: [PATCH] compiles again --- gcc/python/Make-lang.in | 2 +- gcc/python/py-stmt.c | 59 ++++++++++++------------------------------------- gcc/python/py-vec.c | 21 +++++++----------- 3 files changed, 23 insertions(+), 59 deletions(-) diff --git a/gcc/python/Make-lang.in b/gcc/python/Make-lang.in index 804e3b30c23..2f903a0aab9 100644 --- a/gcc/python/Make-lang.in +++ b/gcc/python/Make-lang.in @@ -78,7 +78,7 @@ GPY_OBJS = \ py-lexer.o \ py-lang.o \ py-stmt.o \ - py-tree.o \ + py-decl.o \ py-vec.o \ py-runtime.o diff --git a/gcc/python/py-stmt.c b/gcc/python/py-stmt.c index f46c6bc136d..f63324ff5c4 100644 --- a/gcc/python/py-stmt.c +++ b/gcc/python/py-stmt.c @@ -675,68 +675,37 @@ void gpy_write_globals( void ) } /* Need to generate table of gpy_callable_def_t[] and gpy_type_obj_def_t[] */ - VEC(constructor_elt,gc) *array_data = NULL; - - for( ;; ) - { - VEC(constructor_elt,gc) *struct_data; - const char * ident = NULL; - - CONSTRUCTOR_APPEND_ELT (struct_data, build_decl (BUILTINS_LOCATION, FIELD_DECL, - "ident", - ptr_type_node), - build_string(strlen(ident), ident) - ); - - CONSTRUCTOR_APPEND_ELT (struct_data, build_decl (BUILTINS_LOCATION, FIELD_DECL, - "n_args", - integer_type_node), - build_int_cst(integer_type_node, 0 ) - ); - - CONSTRUCTOR_APPEND_ELT (struct_data, build_decl (BUILTINS_LOCATION, FIELD_DECL, - "class", - boolean_type_node), - build_int_cst(boolean_type_node,0) - ); - - CONSTRUCTOR_APPEND_ELT (struct_data, build_decl (BUILTINS_LOCATION, FIELD_DECL, - "call", - ptr_type_node), - NULL_TREE - ); - - CONSTRUCTOR_APPEND_ELT (array_data, NULL_TREE, - build_constructor(gpy_build_callable_record_type(),struct_data)); - - } - VEC(constructor_elt,gc) *struct_data; - CONSTRUCTOR_APPEND_ELT (struct_data, build_decl (BUILTINS_LOCATION, FIELD_DECL, - "ident", + int table_len = 1; + + VEC(constructor_elt,gc) *struct_data_cons; + CONSTRUCTOR_APPEND_ELT (struct_data_cons, build_decl (BUILTINS_LOCATION, FIELD_DECL, + get_identifier("ident"), ptr_type_node), null_pointer_node ); - CONSTRUCTOR_APPEND_ELT (struct_data, build_decl (BUILTINS_LOCATION, FIELD_DECL, - "n_args", + CONSTRUCTOR_APPEND_ELT (struct_data_cons, build_decl (BUILTINS_LOCATION, FIELD_DECL, + get_identifier("n_args"), integer_type_node), build_int_cst(integer_type_node, 0 ) ); - CONSTRUCTOR_APPEND_ELT (struct_data, build_decl (BUILTINS_LOCATION, FIELD_DECL, - "class", + CONSTRUCTOR_APPEND_ELT (struct_data_cons, build_decl (BUILTINS_LOCATION, FIELD_DECL, + get_identifier("class"), boolean_type_node), build_int_cst(boolean_type_node,0) ); - CONSTRUCTOR_APPEND_ELT (struct_data, build_decl (BUILTINS_LOCATION, FIELD_DECL, - "call", + CONSTRUCTOR_APPEND_ELT (struct_data_cons, build_decl (BUILTINS_LOCATION, FIELD_DECL, + get_identifier("call"), ptr_type_node), null_pointer_node ); + + VEC(constructor_elt,gc) *array_data = NULL; CONSTRUCTOR_APPEND_ELT (array_data, NULL_TREE, - build_constructor(gpy_build_callable_record_type(),struct_data)); + build_constructor(gpy_build_callable_record_type(),struct_data_cons)); tree array_type = build_array_type( gpy_build_callable_record_type(), build_index_type( build_int_cst(integer_type_node,table_len) )); diff --git a/gcc/python/py-vec.c b/gcc/python/py-vec.c index caf3e41d543..6fcada055a9 100644 --- a/gcc/python/py-vec.c +++ b/gcc/python/py-vec.c @@ -30,7 +30,6 @@ along with GCC; see the file COPYING3. If not see #include "langhooks.h" #include "langhooks-def.h" #include "target.h" -#include "cgraph.h" #include #include @@ -38,11 +37,12 @@ along with GCC; see the file COPYING3. If not see #include "vec.h" #include "hashtab.h" -#include "gpy.h" -#include "opcodes.def" -#include "symbols.h" -#include "pypy-tree.h" -#include "runtime.h" +#include "gpython.h" +#include "py-dot-codes.def" +#include "py-dot.h" +#include "py-vec.h" +#include "py-tree.h" +#include "py-runtime.h" /* This is just a basic garbage collection to free all IR symbols @@ -260,15 +260,10 @@ void gpy_init_ctx_branch( gpy_context_branch * const * o ) { (*o)->var_decls = (gpy_hash_tab_t *) xmalloc( sizeof(gpy_hash_tab_t) ); - (*o)->fnc_decls = (gpy_hash_tab_t *) - xmalloc( sizeof(gpy_hash_tab_t) ); gpy_dd_hash_init_table( &((*o)->var_decls) ); - gpy_dd_hash_init_table( &((*o)->fnc_decls) ); (*o)->var_decl_t = VEC_alloc(gpy_ident,gc,0); - (*o)->fnc_decl_t = VEC_alloc(gpy_ident,gc,0); - (*o)->ctx_init = VEC_alloc(tree,gc,0); } } @@ -343,8 +338,8 @@ tree gpy_ctx_lookup_decl( VEC(gpy_ctx_t,gc) * context, const char * s, enum DECL if( T == VAR ) decl_table = it->var_decls; - else - decl_table = it->fnc_decls; + + else fatal_error("unhandled decl type!\n"); o = gpy_dd_hash_lookup_table( decl_table, h ); if( o ) -- 2.11.4.GIT