From 8057f671ea7f286a27e40bfe1aa45d85e0990cbe Mon Sep 17 00:00:00 2001 From: Christoph Mallon Date: Fri, 2 Nov 2012 15:18:39 +0100 Subject: [PATCH] Simplify x87_dump_stack(). --- ir/be/ia32/ia32_x87.c | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/ir/be/ia32/ia32_x87.c b/ir/be/ia32/ia32_x87.c index 24b1b2599..4019e5cf1 100644 --- a/ir/be/ia32/ia32_x87.c +++ b/ir/be/ia32/ia32_x87.c @@ -172,19 +172,6 @@ static int x87_get_st_reg(const x87_state *state, int pos) } #ifdef DEBUG_libfirm -/** - * Return the node at st(pos). - * - * @param state the x87 state - * @param pos a stack position - * - * @return the IR node that produced the value at st(pos) - */ -static ir_node *x87_get_st_node(const x87_state *state, int pos) -{ - return x87_get_entry((x87_state*)state, pos)->node; -} - /** * Dump the stack for debugging. * @@ -192,11 +179,9 @@ static ir_node *x87_get_st_node(const x87_state *state, int pos) */ static void x87_dump_stack(const x87_state *state) { - int i; - - for (i = state->depth - 1; i >= 0; --i) { - DB((dbg, LEVEL_2, "vf%d(%+F) ", x87_get_st_reg(state, i), - x87_get_st_node(state, i))); + for (int i = state->depth; i-- != 0;) { + st_entry const *const entry = x87_get_entry((x87_state*)state, i); + DB((dbg, LEVEL_2, "vf%d(%+F) ", entry->reg_idx, entry->node)); } DB((dbg, LEVEL_2, "<-- TOS\n")); } -- 2.20.1