From 581d7f8ebfac75e64bfdfa0b1df3a037e6919fe8 Mon Sep 17 00:00:00 2001 From: Christoph Mallon Date: Mon, 21 Sep 2009 13:24:29 +0000 Subject: [PATCH] When using only %esp in AM, which must use a SIB byte, set the index to esp, too, which means no index. [r26565] --- ir/be/ia32/ia32_emitter.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ir/be/ia32/ia32_emitter.c b/ir/be/ia32/ia32_emitter.c index 35511371b..8909df278 100644 --- a/ir/be/ia32/ia32_emitter.c +++ b/ir/be/ia32/ia32_emitter.c @@ -2493,9 +2493,10 @@ static void bemit_mod_am(unsigned reg, const ir_node *node) } else if (has_base) { const arch_register_t *reg = arch_get_irn_register(base); if (reg->index == REG_ESP) { - /* for the above reason we are forced to emit a sib - when base is ESP. Only the base is used */ - sib = ENC_BASE(0x04); + /* for the above reason we are forced to emit a sib when base is + * ESP. Only the base is used, index must be ESP too, which means no + * index. */ + sib = ENC_BASE(0x04) | ENC_INDEX(0x04); emitsib = true; /* we are forced to emit a 8bit offset as EBP base without -- 2.20.1