projects
/
libfirm
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
don't fail when printing Sel with entity==NULL
[libfirm]
/
ir
/
ir
/
irargs.c
diff --git
a/ir/ir/irargs.c
b/ir/ir/irargs.c
index
9d54ed2
..
db95186
100644
(file)
--- a/
ir/ir/irargs.c
+++ b/
ir/ir/irargs.c
@@
-1,5
+1,5
@@
/*
/*
- * Copyright (C) 1995-20
08
University of Karlsruhe. All right reserved.
+ * Copyright (C) 1995-20
11
University of Karlsruhe. All right reserved.
*
* This file is part of libFirm.
*
*
* This file is part of libFirm.
*
@@
-21,7
+21,6
@@
* @file
* @brief Support for libcore IR object output.
* @author Sebastian Hack
* @file
* @brief Support for libcore IR object output.
* @author Sebastian Hack
- * @version $Id$
*/
#include "config.h"
*/
#include "config.h"
@@
-37,6
+36,7
@@
#include "irloop_t.h"
#include "tv_t.h"
#include "dbginfo_t.h"
#include "irloop_t.h"
#include "tv_t.h"
#include "dbginfo_t.h"
+#include "util.h"
/**
* identify a firm object type
/**
* identify a firm object type
@@
-66,7
+66,7
@@
static int bitset_emit(lc_appendable_t *app,
{
int res = 2;
bitset_t *b = (bitset_t*)arg->v_ptr;
{
int res = 2;
bitset_t *b = (bitset_t*)arg->v_ptr;
-
unsigned
p;
+
size_t
p;
char buf[32];
const char *prefix = "";
char buf[32];
const char *prefix = "";
@@
-118,7
+118,7
@@
static int firm_emit(lc_appendable_t *app,
void *X = (void*)arg->v_ptr;
firm_kind *obj = (firm_kind*)X;
void *X = (void*)arg->v_ptr;
firm_kind *obj = (firm_kind*)X;
-
in
t i, n;
+
size_
t i, n;
ir_node *block;
char add[64];
char buf[256];
ir_node *block;
char add[64];
char buf[256];
@@
-140,7
+140,7
@@
static int firm_emit(lc_appendable_t *app,
case k_entity: {
ir_entity *entity = (ir_entity*)X;
snprintf(buf, sizeof(buf), "%s%s", A("ent"),
case k_entity: {
ir_entity *entity = (ir_entity*)X;
snprintf(buf, sizeof(buf), "%s%s", A("ent"),
- isupper(occ->conversion) ? get_entity_ld_name_ex(entity): get_entity_name(entity));
+ isupper(
(unsigned char)
occ->conversion) ? get_entity_ld_name_ex(entity): get_entity_name(entity));
snprintf(add, sizeof(add), "[%ld]", get_entity_nr(entity));
break;
}
snprintf(add, sizeof(add), "[%ld]", get_entity_nr(entity));
break;
}
@@
-187,8
+187,15
@@
static int firm_emit(lc_appendable_t *app,
snprintf(buf, sizeof(buf), "%s%s %s[%s]", A("irn"), get_irn_opname(node),
get_mode_name(get_irn_mode(node)), get_entity_name(get_SymConst_entity(node)));
} else if (is_Sel(node)) {
snprintf(buf, sizeof(buf), "%s%s %s[%s]", A("irn"), get_irn_opname(node),
get_mode_name(get_irn_mode(node)), get_entity_name(get_SymConst_entity(node)));
} else if (is_Sel(node)) {
+ ir_entity *entity = get_Sel_entity(node);
+ const char *entity_name = "(null)";
+ if (entity != NULL)
+ entity_name = get_entity_name(entity);
snprintf(buf, sizeof(buf), "%s%s %s[%s]", A("irn"), get_irn_opname(node),
snprintf(buf, sizeof(buf), "%s%s %s[%s]", A("irn"), get_irn_opname(node),
- get_mode_name(get_irn_mode(node)), get_entity_name(get_Sel_entity(node)));
+ get_mode_name(get_irn_mode(node)), entity_name);
+ } else if (is_Cmp(node)) {
+ ir_relation relation = get_Cmp_relation(node);
+ snprintf(buf, sizeof(buf), "%s%s %s", A("irn"), get_irn_opname(node), get_relation_string(relation));
} else {
snprintf(buf, sizeof(buf), "%s%s %s", A("irn"), get_irn_opname(node),
get_mode_name(get_irn_mode(node)));
} else {
snprintf(buf, sizeof(buf), "%s%s %s", A("irn"), get_irn_opname(node),
get_mode_name(get_irn_mode(node)));
@@
-210,7
+217,7
@@
static int firm_emit(lc_appendable_t *app,
}
case k_ir_loop: {
ir_loop *loop = (ir_loop*)X;
}
case k_ir_loop: {
ir_loop *loop = (ir_loop*)X;
- snprintf(buf, sizeof(buf), "loop[%
d:%d
]", get_loop_loop_nr(loop), get_loop_depth(loop));
+ snprintf(buf, sizeof(buf), "loop[%
ld:%u
]", get_loop_loop_nr(loop), get_loop_depth(loop));
break;
}
case k_ir_op: {
break;
}
case k_ir_op: {
@@
-228,7
+235,7
@@
static int firm_emit(lc_appendable_t *app,
strncat(buf, ".", sizeof(buf)-1);
strncat(buf, get_entity_name(ent), sizeof(buf)-1);
if (is_Array_type(get_entity_owner(ent))) {
strncat(buf, ".", sizeof(buf)-1);
strncat(buf, get_entity_name(ent), sizeof(buf)-1);
if (is_Array_type(get_entity_owner(ent))) {
- snprintf(add, sizeof(add), "[%d]",
+ snprintf(add, sizeof(add), "[%
l
d]",
get_compound_graph_path_array_index(path, i));
strncat(buf, add, sizeof(buf)-1);
}
get_compound_graph_path_array_index(path, i));
strncat(buf, add, sizeof(buf)-1);
}
@@
-290,7
+297,7
@@
static int firm_emit_pnc(lc_appendable_t *app,
const lc_arg_occ_t *occ, const lc_arg_value_t *arg)
{
int value = arg->v_int;
const lc_arg_occ_t *occ, const lc_arg_value_t *arg)
{
int value = arg->v_int;
- const char *p = get_
pnc
_string(value);
+ const char *p = get_
relation
_string(value);
return lc_arg_append(app, occ, p, strlen(p));
}
return lc_arg_append(app, occ, p, strlen(p));
}
@@
-330,7
+337,7
@@
lc_arg_env_t *firm_get_arg_env(void)
lc_arg_add_std(env);
lc_arg_register(env, "firm", 'F', &firm_handler);
lc_arg_add_std(env);
lc_arg_register(env, "firm", 'F', &firm_handler);
- for (i = 0; i
< sizeof(args)/sizeof(args[0]
); ++i)
+ for (i = 0; i
!= ARRAY_SIZE(args
); ++i)
lc_arg_register(env, args[i].name, args[i].letter, &firm_handler);
lc_arg_register(env, "firm:ident", 'I', &ident_handler);
lc_arg_register(env, args[i].name, args[i].letter, &firm_handler);
lc_arg_register(env, "firm:ident", 'I', &ident_handler);