From 42a268c241183877192c376d03bd9b6d527407c7 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Fri, 13 Feb 2015 12:51:55 -0800 Subject: tcg: Change translator-side labels to a pointer This is improved type checking for the translators -- it's no longer possible to accidentally swap arguments to the branch functions. Note that the code generating backends still manipulate labels as int. With notable exceptions, the scope of the change is just a few lines for each target, so it's not worth building extra machinery to do this change in per-target increments. Cc: Peter Maydell Cc: Edgar E. Iglesias Cc: Michael Walle Cc: Leon Alrae Cc: Anthony Green Cc: Jia Liu Cc: Alexander Graf Cc: Aurelien Jarno Cc: Blue Swirl Cc: Guan Xuetao Cc: Paolo Bonzini Cc: Max Filippov Reviewed-by: Bastian Koppelmann Signed-off-by: Richard Henderson --- tcg/tcg.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'tcg/tcg.c') diff --git a/tcg/tcg.c b/tcg/tcg.c index 3841e99..751545e 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -246,7 +246,7 @@ static void tcg_out_label(TCGContext *s, int label_index, tcg_insn_unit *ptr) l->u.value_ptr = ptr; } -int gen_new_label(void) +TCGLabel *gen_new_label(void) { TCGContext *s = &tcg_ctx; int idx; @@ -258,7 +258,8 @@ int gen_new_label(void) l = &s->labels[idx]; l->has_value = 0; l->u.first_reloc = NULL; - return idx; + + return l; } #include "tcg-target.c" -- cgit v1.1