[PATCH] New option for automatically generating IT blocks

Daniel Gutson dgutson@codesourcery.com
Fri May 29 20:03:00 GMT 2009


Hi Richard,
	in this new version of the patch, the IT FSM data is stored in the section, so changing sections in the middle of IT blocks generates the right code.

You might want to look at the test cases (arm-it-auto-*).

Please commit this for me if it's OK, since I don't have write access, or let me know any other concern.

Thanks,
	Daniel.

	gas/
	* config/tc-arm.c (do_automatic_it): New variable.
	(it_instruction_type): New enum.
	(arm_it): New field.
	(it_state): New enum.
	(now_it): New macro.
	(now_it_compatible): New function.
	(conditional_insn): New function.
	(set_it_insn_type): New macro.
	(set_it_insn_type_last): New macro.
	(do_t_add_sub): Call automatic IT machinery functions.
	(do_t_arit3): Likewise.
	(do_t_arit3c): Likewise.
	(do_t_blx): Likewise.
	(do_t_branch): Likewise.
	(do_t_bkpt): Likewise.
	(do_t_branch23): Likewise.
	(do_t_bx): Likewise.
	(do_t_bxj): Likewise.
	(do_t_cps): Likewise.
	(do_t_cpsi): Likewise.
	(do_t_cbz): Likewise.
	(do_t_it): Likewise.
	(encode_thumb2_ldmstm): Likewise.
	(do_t_ldst): Likewise.
	(do_t_mov_cmp): Likewise.
	(do_t_mvn_tst): Likewise.
	(do_t_mul): Likewise.
	(do_t_neg): Likewise.
	(do_t_setend): Likewise.
	(do_t_shift): Likewise.
	(do_t_tb): Likewise.
	(output_it_inst): New function.
	(new_automatic_it_block): New function.
	(close_automatic_it_block): New function.
	(now_it_add_mask): New function.
	(it_fsm_pre_encode): New function.
	(handle_it_state): New function.
	(it_fsm_post_encode): New function.
	(force_automatic_it_block_close): New function.
	(in_it_block): New function.
	(md_assemble): Call automatic IT block machinery functions.
	(arm_frob_label): Likewise.
	(arm_opts): New element.
	* config/tc-arm.h (it_state): New enum.
	(current_it): New struct.
	(arm_segment_info_type): New member added.
	* doc/c-arm.texi: New option -mauto-it.

	gas/testsuite/
	* gas/arm/arm-it-auto.d: New test.
	* gas/arm/arm-it-auto.s: New file.
	* gas/arm/arm-it-auto-2.d: New test case.
	* gas/arm/arm-it-auto-2.s: New file.
	* gas/arm/arm-it-auto-3.d: New test case.
	* gas/arm/arm-it-auto-3.s: New file.
	* gas/arm/thumb2_it_auto.d: New test.
	* gas/arm/thumb2_it_bad.l: Error message updated.
	* gas/arm/thumb2_it_bad_auto.d: New test.
	* gas/arm/thumb2_it.d: Comment added.
	* gas/arm/thumb2_it_bad.d: Comment added.


Richard Earnshaw wrote:
> On Fri, 2009-05-08 at 16:29 -0300, Daniel Gutson wrote:
>> Hi,
>>   apologies again, this is the current version of the patch.
>>
>> As I mentioned in the original post, with this patch the assembler allows use of conditional Thumb-2 instructions without requiring explicit IT instructions.
>>
>> The patch adds the -mauto-it command-line option to enable this automatic generation of IT instructions. When not specified, the original behavior takes place.
>>
>> I tested this by running the gas testsuite, plus the test cases I added. 
>>
>> Please commit it for me if accepted, since I don't have write access.
>>
> 
> Looks generally ok, but I've a couple of questions about dark corners
> that I can't spot immediate answers to when reading the code.
> 
> What happens if the user writes
> 
> 	.text
> 	cmp	r0, #0
> 	addeq	r1, #2
> 	.data
> 	.word	33
> 	.text
> 	addne	r1, #3
> 
> Do we get one or two IT instructions?  If the user puts an explicit ITE
> instruction in the sequence does this get verified against both parts.
> 
> What happens if we replace the .data section with a different code
> section?  What if that also includes an IT block?
> 
> R.
> 
> 
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: auto_it.patch
Type: text/x-diff
Size: 44371 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20090529/d75968f8/attachment.bin>


More information about the Binutils mailing list