X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fexternal%2Fread.c;h=af14486cc6e1aaefdc1f65472c95904c34210714;hb=1629ad7acb2059c293675da448cc4b2e70ad70e6;hp=7b950e8f4034941aba340c3f6b5344b060df6d55;hpb=ed5876aea11b7cc1f804587cdb8088660492a239;p=libfirm diff --git a/ir/external/read.c b/ir/external/read.c index 7b950e8f4..af14486cc 100644 --- a/ir/external/read.c +++ b/ir/external/read.c @@ -1,5 +1,6 @@ /* -*- c -*- */ + /* * Project: libFIRM * File name: ir/external/read.c @@ -730,7 +731,7 @@ parseEffect (xmlDocPtr doc, xmlNodePtr effelm) static -void read_extern (const char *filename) +int read_extern (const char *filename) { /* xmlNsPtr ns = NULL; */ /* no namespace for us */ xmlDocPtr doc; /* whole document */ @@ -743,7 +744,8 @@ void read_extern (const char *filename) LIBXML_TEST_VERSION xmlKeepBlanksDefault (0); VERBOSE_PRINT((stdout, "read file %s\n", filename)); doc = xmlParseFile (filename); - CHECK (doc, "xmlParseFile"); + if (! doc) + return 0; cur = xmlDocGetRootElement (doc); CHECK (cur, "xmlDocGetRootElement"); @@ -793,6 +795,8 @@ void read_extern (const char *filename) module -> next = modules; modules = module; + + return 1; } /********************************************************************/ @@ -1054,7 +1058,7 @@ static void create_abstract_arg(ir_graph *irg, proc_t *proc, eff_t *eff) ir_node *arg; entity *ent; ir_mode *mode; - type *typ; + ir_type *typ; int num; VERBOSE_PRINT((stdout, "create effect:arg %d in %s\n", @@ -1163,7 +1167,7 @@ static void create_abstract_store(ir_graph *irg, proc_t *proc, eff_t *eff) static void create_abstract_alloc(ir_graph *irg, proc_t *proc, eff_t *eff) { - type *ftype; + ir_type *ftype; ir_node *alloc; type_t *xtype; symconst_symbol sym; @@ -1176,7 +1180,7 @@ static void create_abstract_alloc(ir_graph *irg, proc_t *proc, eff_t *eff) ftype = xtype -> f_tp; sym.type_p = ftype; - alloc = new_Alloc(get_store(), new_SymConst(sym, symconst_size), ftype, + alloc = new_Alloc(get_store(), new_SymConst(sym, symconst_type_size), ftype, heap_alloc); set_store(new_Proj(alloc, mode_M, 0)); eff -> firmnode = new_Proj(alloc, mode_P, 2); @@ -1206,7 +1210,7 @@ static void create_abstract_call(ir_graph *irg, proc_t *proc, eff_t *eff) eff_t *addr; ir_node **irns; int i, num; - type *mtype; + ir_type *mtype; int mik; /* is method somehow known? */ VERBOSE_PRINT((stdout, "create call in %s\n", @@ -1223,7 +1227,7 @@ static void create_abstract_call(ir_graph *irg, proc_t *proc, eff_t *eff) addr = find_valueid_in_proc_effects(eff -> effect.call.valrefid, proc); assert(addr && "no address for load"); - /* if addr is Unknown, set propper mode */ + /* if addr is Unknown, set proper mode */ if(iro_Unknown == get_irn_opcode(addr -> firmnode)) { set_irn_mode(addr -> firmnode, mode_P); } @@ -1231,16 +1235,16 @@ static void create_abstract_call(ir_graph *irg, proc_t *proc, eff_t *eff) if(ent) { /* the address */ sel = new_simpleSel(get_store(), addr -> firmnode, ent); - /* mthod type */ + /* method type */ mtype = get_entity_type(ent); - mik = true; + mik = 1; } else { /* the address */ sel = addr -> firmnode; - /* mthod type */ + /* method type */ mtype = get_unknown_type(); - mik = false; + mik = 0; } /* the args */ @@ -1474,7 +1478,7 @@ static void assign_firm_entity(module_t *module, entity_t *xmlent) { int i, num; type_t *typ; - type *type; + ir_type *type; entity *ent; VERBOSE_PRINT((stdout, "assign entity %s to typeid %s\n", @@ -1508,7 +1512,7 @@ static void assign_firm_entity(module_t *module, entity_t *xmlent) static void assign_firm_type(type_t *xmltype) { int i; - type *typ = NULL; + ir_type *typ = NULL; int num; VERBOSE_PRINT((stdout, "assign firm type to type %s\n", @@ -1541,7 +1545,7 @@ static void create_abstract_proc_effect(module_t *module, proc_t *proc) { int i, num; - type *class_typ = NULL; + ir_type *class_typ = NULL; type_t *type; entity *fent; @@ -1635,12 +1639,13 @@ void create_abstract_module(module_t *module) } -void create_abstraction(const char *filename) +int create_abstraction(const char *filename) { module_t *module; /* read and parse XML file */ - read_extern(filename); + if (! read_extern(filename)) + return 0; /* finished reading and parsing here */ /* build FIRM graphs */ @@ -1659,6 +1664,8 @@ void create_abstraction(const char *filename) entities = NULL; procs = NULL; modules = NULL; + + return 1; } @@ -1677,6 +1684,16 @@ void free_abstraction(void) { /* * $Log$ + * Revision 1.25 2006/06/09 11:26:35 firm + * renamed type to ir_type + * + * Revision 1.24 2006/05/29 13:34:49 beck + * renamed symconst_size to symconst_type_size + * + * Revision 1.22 2005/08/16 10:18:35 beck + * create_abstraction() now returns an error code if the file could not + * be opened. + * * Revision 1.21 2005/03/10 10:05:38 goetz * chanmged method name *