Add support for interrupt function attribute
From-SVN: r38134
This commit is contained in:
parent
2bff3fd527
commit
6d3d91336c
|
@ -1,3 +1,58 @@
|
|||
2000-12-08 Nick Clifton <nickc@redhat.com>
|
||||
|
||||
* extend.texi: Document ARM "interrupt" function attribute.
|
||||
Mention that the ARM also support the "naked" function
|
||||
attribute.
|
||||
|
||||
* config/arm/arm-protos.h (arm_current_func_type): Add
|
||||
prototype.
|
||||
|
||||
* config/arm/arm.h (EXCEPTION_LR_REGNUM): Define.
|
||||
(struct machine_function): Add 'func_type' field.
|
||||
Define bit values for 'func_type' field.
|
||||
(ARM_FUNC_TYPE): New macro.
|
||||
(IS_INTERRUPT): New macro.
|
||||
(IS_VOLATILE): New macro.
|
||||
(IS_NAKED): New macro.
|
||||
(IS_NESTED): New macro.
|
||||
(ARM_INITIAL_ELIMINATION_OFFSET): Use IS_VOLATILE.
|
||||
|
||||
* config/arm/arm.c (isr_attribute_args): New Structure. A
|
||||
list of "interrupt" function attribute modifiers.
|
||||
(arm_isr_value): New Function: Returns the type of the current
|
||||
interrupt function.
|
||||
(arm_compute_func_type): New Function: Computes the type of
|
||||
the current function.
|
||||
(arm_current_func_type): New Function: Returns the type of the
|
||||
current function.
|
||||
(use_return_insn): Use arm_current_func_type.
|
||||
(arm_valid_type_attribute_p): Accept "interrupt" function
|
||||
attribute.
|
||||
(arm_comp_type_attributes): Check "interrupt" attributes.
|
||||
(arm_valid_machine_decl): Accept "interrupt" function
|
||||
attribute.
|
||||
(arm_function_ok_for_sibcall): Do not allow interrupt
|
||||
functions to use sibcalls.
|
||||
(arm_naked_function_p): Delete.
|
||||
(print_multi_reg): Remove redundant parameter 'hat'.
|
||||
(arm_compute_save_reg_mask): New Function: Compute a bit mask
|
||||
of registers saved during the current function's prologue.
|
||||
(output_arm_return_instruction): Use arm_current_func_type.
|
||||
Generate return instruction when LR is not poppsed off the
|
||||
stack.
|
||||
(arm_volatile_func): Delete.
|
||||
(output_arm_prologue): Use arm_current_func_type and
|
||||
arm_compute_save_reg_mask.
|
||||
Note presernce of interrupt functions.
|
||||
(arm_output_epilogue): Use arm_current_func_type and
|
||||
arm_compute_save_reg_mask.
|
||||
(arm_expand_prologue): Use arm_current_func_type and
|
||||
arm_compute_save_reg_mask.
|
||||
(arm_init_machine_status): Initialise func_type field, if
|
||||
necessary.
|
||||
(thumb_expand_prologue): Use arm_current_func_type.
|
||||
(output_thumb_prologue): Use arm_current_func_type.
|
||||
|
||||
2000-12-08 Brad Lucier <lucier@math.purdue.edu>
|
||||
|
||||
* tradcpp.c (do_include): Make pointer differences 64-bit clean.
|
||||
|
|
|
@ -34,6 +34,7 @@ extern void arm_expand_prologue PARAMS ((void));
|
|||
/* Used in arm.md, but defined in output.c. */
|
||||
extern void assemble_align PARAMS ((int));
|
||||
extern const char * arm_strip_name_encoding PARAMS ((const char *));
|
||||
extern unsigned long arm_current_func_type PARAMS ((void));
|
||||
|
||||
#ifdef TREE_CODE
|
||||
extern int arm_return_in_memory PARAMS ((tree));
|
||||
|
|
1045
gcc/config/arm/arm.c
1045
gcc/config/arm/arm.c
File diff suppressed because it is too large
Load Diff
|
@ -903,7 +903,10 @@ extern const char * structure_size_string;
|
|||
#define LAST_ARG_REGNUM ARG_REGISTER (NUM_ARG_REGS)
|
||||
|
||||
/* The number of the last "lo" register (thumb). */
|
||||
#define LAST_LO_REGNUM 7
|
||||
#define LAST_LO_REGNUM 7
|
||||
|
||||
/* The register that holds the return address in exception handlers. */
|
||||
#define EXCEPTION_LR_REGNUM 2
|
||||
|
||||
/* The native (Norcroft) Pascal compiler for the ARM passes the static chain
|
||||
as an invisible last argument (possible since varargs don't exist in
|
||||
|
@ -1394,9 +1397,44 @@ enum reg_class
|
|||
#define CALL_LONG 0x00000001 /* Always call indirect. */
|
||||
#define CALL_SHORT 0x00000002 /* Never call indirect. */
|
||||
|
||||
/* A C structure for machine-specific, per-function data. This is added
|
||||
to the cfun structure. */
|
||||
struct machine_function
|
||||
/* These bits describe the different types of function supported
|
||||
by the ARM backend. They are exclusive. ie a function cannot be both a
|
||||
normal function and an interworked function, for example. Knowing the
|
||||
type of a function is important for determining its prologue and
|
||||
epilogue sequences.
|
||||
Note value 7 is currently unassigned. Also note that the interrupt
|
||||
function types all have bit 2 set, so that they can be tested for easily.
|
||||
Note that 0 is deliberately chosen for ARM_FT_UNKNOWN so that when the
|
||||
machine_function structure is initialised (to zero) func_type will
|
||||
default to unknown. This will force the first use of arm_current_func_type
|
||||
to call arm_compute_func_type. */
|
||||
#define ARM_FT_UNKNOWN 0 /* Type has not yet been determined. */
|
||||
#define ARM_FT_NORMAL 1 /* Your normal, straightforward function. */
|
||||
#define ARM_FT_INTERWORKED 2 /* A function that supports interworking. */
|
||||
#define ARM_FT_EXCEPTION_HANDLER 3 /* A C++ exception handler. */
|
||||
#define ARM_FT_ISR 4 /* An interrupt service routine. */
|
||||
#define ARM_FT_FIQ 5 /* A fast interrupt service routine. */
|
||||
#define ARM_FT_EXCEPTION 6 /* An ARM exception handler (subcase of ISR). */
|
||||
|
||||
#define ARM_FT_TYPE_MASK ((1 << 3) - 1)
|
||||
|
||||
/* In addition functions can have several type modifiers,
|
||||
outlined by these bit masks: */
|
||||
#define ARM_FT_INTERRUPT (1 << 2) /* Note overlap with FT_ISR and above. */
|
||||
#define ARM_FT_NAKED (1 << 3) /* No prologue or epilogue. */
|
||||
#define ARM_FT_VOLATILE (1 << 4) /* Does not return. */
|
||||
#define ARM_FT_NESTED (1 << 5) /* Embedded inside another func. */
|
||||
|
||||
/* Some macros to test these flags. */
|
||||
#define ARM_FUNC_TYPE(t) (t & ARM_FT_TYPE_MASK)
|
||||
#define IS_INTERRUPT(t) (t & ARM_FT_INTERRUPT)
|
||||
#define IS_VOLATILE(t) (t & ARM_FT_VOLATILE)
|
||||
#define IS_NAKED(t) (t & ARM_FT_NAKED)
|
||||
#define IS_NESTED(t) (t & ARM_FT_NESTED)
|
||||
|
||||
/* A C structure for machine-specific, per-function data.
|
||||
This is added to the cfun structure. */
|
||||
typedef struct machine_function
|
||||
{
|
||||
/* Records __builtin_return address. */
|
||||
struct rtx_def *ra_rtx;
|
||||
|
@ -1406,7 +1444,10 @@ struct machine_function
|
|||
int far_jump_used;
|
||||
/* Records if ARG_POINTER was ever live. */
|
||||
int arg_pointer_live;
|
||||
};
|
||||
/* Records the type of the current function. */
|
||||
unsigned long func_type;
|
||||
}
|
||||
machine_function;
|
||||
|
||||
/* A C type for declaring a variable that is used as the first argument of
|
||||
`FUNCTION_ARG' and other related values. For some target machines, the
|
||||
|
@ -1615,7 +1656,7 @@ typedef struct
|
|||
other its replacement, at the start of a routine. */
|
||||
#define ARM_INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
|
||||
{ \
|
||||
int volatile_func = arm_volatile_func (); \
|
||||
int volatile_func = IS_VOLATILE (arm_current_func_type ()); \
|
||||
if ((FROM) == ARG_POINTER_REGNUM && (TO) == HARD_FRAME_POINTER_REGNUM)\
|
||||
{ \
|
||||
if (! current_function_needs_context || ! frame_pointer_needed) \
|
||||
|
|
|
@ -1760,6 +1760,27 @@ function is an interrupt handler. The compiler will generate function
|
|||
entry and exit sequences suitable for use in an interrupt handler when this
|
||||
attribute is present.
|
||||
|
||||
@item interrupt
|
||||
@cindex interrupt handler functions
|
||||
Use this option on the ARM, AVR and M32R/D ports to indicate that the
|
||||
specified function is an interrupt handler. The compiler will generate
|
||||
function entry and exit sequences suitable for use in an interrupt
|
||||
handler when this attribute is present.
|
||||
|
||||
Note, interrupt handlers for ther H8/300 and H8/300H processors can be
|
||||
specified via the @code{interrupt_handler} attribute.
|
||||
|
||||
Note, on the AVR interrupts will be enabled inside the function.
|
||||
|
||||
Note, for the ARM you can specify the kind of interrupt to be handled by
|
||||
adding an optional parameter to the interrupt attribute like this:
|
||||
|
||||
@smallexample
|
||||
void f () __attribute__ ((interrupt ("IRQ")));
|
||||
@end smallexample
|
||||
|
||||
Permissable values for this parameter are: IRQ, FIQ, SWI, ABORT and UNDEF.
|
||||
|
||||
@item eightbit_data
|
||||
@cindex eight bit data on the H8/300 and H8/300H
|
||||
Use this option on the H8/300 and H8/300H to indicate that the specified
|
||||
|
@ -1779,19 +1800,6 @@ The compiler will generate more efficient code for loads and stores
|
|||
on data in the tiny data section. Note the tiny data area is limited to
|
||||
slightly under 32kbytes of data.
|
||||
|
||||
@item interrupt
|
||||
@cindex interrupt handlers on the M32R/D
|
||||
Use this option on the M32R/D to indicate that the specified
|
||||
function is an interrupt handler. The compiler will generate function
|
||||
entry and exit sequences suitable for use in an interrupt handler when this
|
||||
attribute is present.
|
||||
|
||||
Interrupt handler functions on the AVR processors
|
||||
Use this option on the AVR to indicate that the specified
|
||||
function is an interrupt handler. The compiler will generate function
|
||||
entry and exit sequences suitable for use in an interrupt handler when this
|
||||
attribute is present. Interrupts will be enabled inside function.
|
||||
|
||||
@item signal
|
||||
@cindex signal handler functions on the AVR processors
|
||||
Use this option on the AVR to indicate that the specified
|
||||
|
@ -1800,10 +1808,10 @@ entry and exit sequences suitable for use in an signal handler when this
|
|||
attribute is present. Interrupts will be disabled inside function.
|
||||
|
||||
@item naked
|
||||
@cindex function without a prologue/epilogue code on the AVR processors
|
||||
Use this option on the AVR to indicate that the specified
|
||||
function don't have a prologue/epilogue. The compiler don't generate
|
||||
function entry and exit sequences.
|
||||
@cindex function without a prologue/epilogue code
|
||||
Use this option on the ARM or AVR ports to indicate that the specified
|
||||
function do not need prologue/epilogue sequences generated by the
|
||||
compiler. It is up to the programmer to provide these sequences.
|
||||
|
||||
@item model (@var{model-name})
|
||||
@cindex function addressability on the M32R/D
|
||||
|
|
Loading…
Reference in New Issue