[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] Trouble with adding TCG branch instructions
From: |
Soumyadeep Ghosh |
Subject: |
Re: [Qemu-devel] Trouble with adding TCG branch instructions |
Date: |
Sat, 16 Mar 2013 08:55:40 -0400 |
Thanks a lot! The problem was with using dead temporaries. The ts->val_type
assertion failed because the value of val_type for these instructions was
TEMP_VAL_DEAD.
Deep
On Mar 16, 2013, at 5:44 AM, Peter Maydell <address@hidden> wrote:
> On 15 March 2013 18:59, Soumyadeep Ghosh <address@hidden> wrote:
>> int label_rn = gen_new_label();
>> int label_done = gen_new_label();
>> tcg_gen_brcond_tl (TCG_cond_LT, tmp2, tmp, label_rn); // If tmp2
>> < tmp, branch to label_rn
>> store_reg (s, 20, tmp2);
>> // Store tmp2 in one of the newly added registers
>> tcg_gen_br (label_done);
>> // Branch to end
>> gen_set_label (label_rn);
>> // Set label_rn to the current code location
>> store_reg (s, 20, tmp);
>> // Store tmp in one of the newly added registers
>> gen_set_label (label_done);
>> // Set label_done to the current code location
>> // Rest of the program
>
> The TCG README says that a TCG temporary is live only in a basic
> block, and that a basic block is terminated by a branch instruction.
> You're trying to use a temporary across a branch instruction,
> which isn't going to work (the temporary is dead at the end
> of the block).
>
>> When I try to emulate my ARM program using the compiled version of
>> the modified emulator, I get an error (Uncaught signal 11). Debugging
>> with gdb tells me that the following assertion on line 1885 of
>> tcg/tcg.c (the function tcg_reg_alloc_op) raises the signal:
>>
>> assert (ts->val_type == TEMP_VAL_REG);
>>
>> Does anyone have any insight into what is causing the problem?
>
> I haven't checked, but this is probably the register allocator
> complaining because it's trying to handle the operand to an
> op and it's dead/doesn't exist (because of the problem above).
>
> -- PMM