[patch,gas,avr] PR21683: Add new pseudo instruction __gcc_isr

Georg-Johann Lay avr@gjlay.de
Wed Jun 28 13:06:00 GMT 2017


Hi, this adds a new pseudo-insn __gcc_ist to the GAS avr back-end.

It can be enabled by new -mgcc-isr GAS command line option.

The patch contains addition of the feature, documentation in 
doc/c-avr.texi and some test coverage in 3 new test cases.

The feature is supposed to work together with avr-gcc and help to 
generate more efficient code for interrupt service routines (ISRs).

The pseudo insn adds a fragment of type rs_machine_dependent to the 
fragment chain.  These fragments are transformed into ordinary rs_fill 
code frags once the exact code and size are worked out.  All this 
happens during md_assemble.

A sanity check is run by md_pre_output_hook; it will diagnose dangling 
situations that cannot be detected by md_assemble.

A new symbol is created if __gcc_isr.n_pushed is encountered.  It will 
be replaced by the number of pushes one that number has been worked out.


If this is ok, please apply.  Thanks


Johann

/
	PR gas/21683
	* include/opcode/avr.h (AVR_INSN): Add one for __gcc_isr.

gas/
	PR gas/21683
	* doc/c-avr.texi (AVR Options) <-mgcc-isr>: Document it.
	(AVR Pseudo Instructions): New node.

	* config/tc-avr.h (md_pre_output_hook): Define to avr_pre_output_hook.
	(md_undefined_symbol): Define to avr_undefined_symbol.
	(avr_pre_output_hook, avr_undefined_symbol): New protos.

	* config/tc-avr.c (struc-symbol.h): Include it.
	(ISR_CHUNK_Done, ISR_CHUNK_Prologue, ISR_CHUNK_Epilogue): New enums.
	(avr_isr, avr_gccisr_opcode)
	(avr_no_sreg_hash, avr_no_sreg): New static variables.
	(avr_opt_s) <have_gccisr>: Add field.
	(avr_opt): Add initializer for have_gccisr.
	(enum options) <OPTION_HAVE_GCCISR>: Add enum.
	(md_longopts) <"mgcc-isr">: Add entry.
	(md_show_usage): Document -mgcc-isr.
	(md_parse_option) [OPTION_HAVE_GCCISR]: Handle it.
	(md_undefined_symbol): Remove.
	(avr_undefined_symbol, avr_pre_output_hook): New fuctions.
	(md_begin) <avr_no_sreg_hash, avr_gccisr_opcode>: Initialize them.
	(avr_operand) <pregno>: Add argument and set *pregno if function
	is called for a register constraint.
	[N]: Handle constraint.
	(avr_operands) <avr_operand>: Pass 5th parameter to calls.
	[avr_opt.have_gccisr]: Call avr_update_gccisr.  Call
	avr_gccisr_operands instead of avr_operands.
	(avr_update_gccisr, avr_emit_insn, avr_patch_gccisr_frag)
	(avr_gccisr_operands, avr_check_gccisr_done): New static functions.

	* testsuite/gas/avr/gccisr-01.d: New test.
	* testsuite/gas/avr/gccisr-01.s: New test.
	* testsuite/gas/avr/gccisr-02.d: New test.
	* testsuite/gas/avr/gccisr-02.s: New test.
	* testsuite/gas/avr/gccisr-03.d: New test.
	* testsuite/gas/avr/gccisr-03.s: New test.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bin-pr21683-gccisr.diff
Type: text/x-patch
Size: 35502 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20170628/f9860ad4/attachment.bin>


More information about the Binutils mailing list