X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fir%2Firdumptxt.c;h=56873979130bc726b30b0b894c7eb6d0e8a5aa96;hb=5d194aeb1895dc34cc9088068e1528a6a67bd696;hp=7d0bab1e7f907d6187c3f112001c1a05fa84dcd2;hpb=699974f39edc05c411e327959a20b7ded17ec5ba;p=libfirm diff --git a/ir/ir/irdumptxt.c b/ir/ir/irdumptxt.c index 7d0bab1e7..568739791 100644 --- a/ir/ir/irdumptxt.c +++ b/ir/ir/irdumptxt.c @@ -6,7 +6,7 @@ * Modified by: Goetz Lindenmaier, Hubert Schmidt * Created: * CVS-ID: $Id$ - * Copyright: (c) 1998-2003 Universität Karlsruhe + * Copyright: (c) 1998-2006 Universität Karlsruhe * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE. */ #ifdef HAVE_CONFIG_H @@ -38,15 +38,17 @@ #define MY_SIZE 1024 /* Size of an array that actually should be computed. */ -/* Just opens a file, mangling a file name. +/** + * Just opens a file, mangling a file name. * - * The name consists of the following parts: - * - * @arg basename The basis of the name telling about the content. - * @arg + * The file name results from the concatenation of the following parts: * + * @param basename The basis of the name telling about the content. + * @param suffix1 The first suffix. + * @param suffix2 The second suffix. + * @param suffix3 The third suffix. */ -static FILE *text_open (const char *basename, const char * suffix1, const char *suffix2, const char *suffix3) { +static FILE *text_open(const char *basename, const char * suffix1, const char *suffix2, const char *suffix3) { FILE *F; int len = strlen(basename), i, j; char *fname; /* filename to put the vcg information in */ @@ -57,7 +59,7 @@ static FILE *text_open (const char *basename, const char * suffix1, const char * if (!suffix3) suffix3 = ".txt"; /* open file for vcg graph */ - fname = malloc (strlen(basename)*2 + strlen(suffix1) + strlen(suffix2) + 5); /* *2: space for excapes. */ + fname = xmalloc(strlen(basename)*2 + strlen(suffix1) + strlen(suffix2) + 5); /* *2: space for escapes. */ j = 0; for (i = 0; i < len; ++i) { /* replace '/' in the name: escape by @. */ @@ -70,12 +72,13 @@ static FILE *text_open (const char *basename, const char * suffix1, const char * } } fname[j] = '\0'; - strcat (fname, suffix1); /* append file suffix */ - strcat (fname, suffix2); /* append file suffix */ - strcat (fname, suffix3); /* append the .txt suffix */ + strcat(fname, suffix1); /* append file suffix */ + strcat(fname, suffix2); /* append file suffix */ + strcat(fname, suffix3); /* append the .txt suffix */ - F = fopen (fname, "w"); /* open file for writing */ + F = fopen(fname, "w"); /* open file for writing */ if (!F) { + perror(fname); assert(0); } free(fname); @@ -299,6 +302,10 @@ int dump_irnode_to_file(FILE *F, ir_node *n) { fprintf(F, " type: "); dump_type_to_file(F, get_SymConst_type(n), dump_verbosity_onlynames); break; + case symconst_enum_const: + fprintf(F, " kind: enumeration\n"); + fprintf(F, " name: %s\n", get_enumeration_name(get_SymConst_enum(n))); + break; } fprintf(F, " type of value: %s \n", get_type_name_ex(get_SymConst_value_type(n), &bad)); } break; @@ -424,7 +431,7 @@ static void dump_node_list(FILE *F, firm_kind *k, char *prefix, fprintf(F, "%s %s (%d):", prefix, name, n_nodes); for (i = 0; i < n_nodes; ++i) { int rem; - if (i > 7 && !(i & 7)) { /* line break every eigth node. */ + if (i > 7 && !(i & 7)) { /* line break every eight node. */ fprintf(F, ",\n%s ", prefix); comma = ""; } @@ -453,7 +460,7 @@ static void dump_type_list(FILE *F, ir_type *tp, char *prefix, fprintf(F, "%s %s (%d):", prefix, name, n_nodes); for (i = 0; i < n_nodes; ++i) { - if (i > 7 && !(i & 7)) { /* line break every eigth node. */ + if (i > 7 && !(i & 7)) { /* line break every eight node. */ fprintf(F, ",\n%s ", prefix); comma = ""; } @@ -464,7 +471,6 @@ static void dump_type_list(FILE *F, ir_type *tp, char *prefix, fprintf(F, "\n"); } -#define X(a) case a: fprintf(F, #a); break void dump_entity_to_file_prefix (FILE *F, entity *ent, char *prefix, unsigned verbosity) { int i, j; ir_type *owner, *type; @@ -524,28 +530,9 @@ void dump_entity_to_file_prefix (FILE *F, entity *ent, char *prefix, unsigned } } - fprintf(F, "%s allocation: ", prefix); - switch (get_entity_allocation(ent)) { - X(allocation_dynamic); - X(allocation_automatic); - X(allocation_static); - X(allocation_parameter); - } - - fprintf(F, "\n%s visibility: ", prefix); - switch (get_entity_visibility(ent)) { - X(visibility_local); - X(visibility_external_visible); - X(visibility_external_allocated); - } - - fprintf(F, "\n%s variability: ", prefix); - switch (get_entity_variability(ent)) { - X(variability_uninitialized); - X(variability_initialized); - X(variability_part_constant); - X(variability_constant); - } + fprintf(F, "%s allocation: %s", prefix, get_allocation_name(get_entity_allocation(ent))); + fprintf(F, "\n%s visibility: %s", prefix, get_visibility_name(get_entity_visibility(ent))); + fprintf(F, "\n%s variability: %s", prefix, get_variability_name(get_entity_variability(ent))); if (is_Method_type(get_entity_type(ent))) { unsigned mask = get_entity_additional_properties(ent); @@ -622,13 +609,8 @@ void dump_entity_to_file_prefix (FILE *F, entity *ent, char *prefix, unsigned } if (verbosity & dump_verbosity_entattrs) { - fprintf(F, "%s volatility: ", prefix); - switch (get_entity_volatility(ent)) { - X(volatility_non_volatile); - X(volatility_is_volatile); - } - - fprintf(F, "\n%s peculiarity: %s", prefix, get_peculiarity_string(get_entity_peculiarity(ent))); + fprintf(F, "%s volatility: %s", prefix, get_volatility_name(get_entity_volatility(ent))); + fprintf(F, "\n%s peculiarity: %s", prefix, get_peculiarity_name(get_entity_peculiarity(ent))); fprintf(F, "\n%s ld_name: %s", prefix, ent->ld_name ? get_entity_ld_name(ent) : "no yet set"); fprintf(F, "\n%s offset: %d bits, %d bytes", prefix, get_entity_offset_bits(ent), get_entity_offset_bytes(ent)); if (is_Method_type(get_entity_type(ent))) { @@ -768,7 +750,6 @@ void dump_entity_to_file_prefix (FILE *F, entity *ent, char *prefix, unsigned } } -#undef X void dump_entity_to_file (FILE *F, entity *ent, unsigned verbosity) { dump_entity_to_file_prefix (F, ent, "", verbosity); @@ -879,7 +860,7 @@ void dump_entitycsv_to_file_prefix (FILE *F, entity *ent, char *prefix, unsig } } -/* A fast hack to dump a csv. */ +/* A fast hack to dump a CSV-file. */ void dump_typecsv_to_file(FILE *F, ir_type *tp, dump_verbosity verbosity, const char *comma) { int i; char buf[1024 + 10]; @@ -1023,8 +1004,15 @@ void dump_type_to_file (FILE *F, ir_type *tp, dump_verbosity verbosity) { } } - fprintf(F, "\n peculiarity: %s\n", get_peculiarity_string(get_class_peculiarity(tp))); - + fprintf(F, "\n peculiarity: %s\n", get_peculiarity_name(get_class_peculiarity(tp))); + fprintf(F, "\n flags: "); + if (is_class_final(tp)) + fprintf(F, "final, "); + if (is_class_interface(tp)) + fprintf(F, "interface, "); + if (is_class_abstract(tp)) + fprintf(F, "abstract, "); + fprintf(F, "\n"); } break;