*** avr.c Thu Apr 17 23:40:05 2008 --- avr_4.2.3_hack.c Sat Apr 19 11:50:37 2008 *************** *** 48,53 **** --- 48,55 ---- #define MAX_LD_OFFSET(MODE) (64 - (signed)GET_MODE_SIZE (MODE)) static int avr_naked_function_p (tree); + /* Ruuds hack: bikini function */ + static int bikini_function_p (tree func); static int interrupt_function_p (tree); static int signal_function_p (tree); static int avr_regs_to_save (HARD_REG_SET *); *************** *** 404,409 **** --- 406,425 ---- return a != NULL_TREE; } + /* Ruuds hack: return nonzero if FUNC is a bikini function. + implying a naked function with room for a framepointer. */ + + static int + bikini_function_p (tree func) + { + tree a; + + gcc_assert (TREE_CODE (func) == FUNCTION_DECL); + + a = lookup_attribute ("bikini", TYPE_ATTRIBUTES (TREE_TYPE (func))); + return a != NULL_TREE; + } + /* Return nonzero if FUNC is an interrupt function as specified by the "interrupt" attribute. */ *************** *** 501,506 **** --- 517,523 ---- && ! interrupt_function_p (current_function_decl) && ! signal_function_p (current_function_decl) && ! avr_naked_function_p (current_function_decl) + && ! bikini_function_p (current_function_decl) /*Ruud: added bikini */ && ! MAIN_NAME_P (DECL_NAME (current_function_decl)) && ! TREE_THIS_VOLATILE (current_function_decl)); } *************** *** 693,698 **** --- 710,738 ---- minimize = (TARGET_CALL_PROLOGUES && !interrupt_func_p && !signal_func_p && live_seq); + /* Ruud: hack to incorporate the keyword bikini + This generates a naked function except that the framepointer is setup + */ + if (bikini_function_p (current_function_decl)) + { + fputs ("/* prologue: bikini */\n", file); + if (frame_pointer_needed) + { + fprintf (file, "\t" + AS2 (in,r28,__SP_L__) CR_TAB + AS2 (in,r29,__SP_H__) "\n"); + prologue_size += 2; + if (size) + { + fputs ("\t", file); + prologue_size += out_adj_frame_ptr (file, size); + prologue_size += out_set_stack_ptr (file, -1, -1); + } + } + goto out; + } + /* End of Ruud's hack */ + if (interrupt_func_p) { fprintf (file,"\tsei\n"); *************** *** 827,832 **** --- 867,879 ---- goto out; } + /* Ruud: bikini hack, see prolog */ + if (bikini_function_p (current_function_decl)) + { + fputs ("/* epilogue: bikini */\n", file); + goto out; + } + interrupt_func_p = interrupt_function_p (current_function_decl); signal_func_p = signal_function_p (current_function_decl); main_p = MAIN_NAME_P (DECL_NAME (current_function_decl)); *************** *** 4650,4655 **** --- 4697,4704 ---- Only `progmem' attribute valid for type. */ + /* Ruud: added the registration for the bikini function type declaration */ + const struct attribute_spec avr_attribute_table[] = { /* { name, min_len, max_len, decl_req, type_req, fn_type_req, handler } */ *************** *** 4657,4662 **** --- 4706,4712 ---- { "signal", 0, 0, true, false, false, avr_handle_fndecl_attribute }, { "interrupt", 0, 0, true, false, false, avr_handle_fndecl_attribute }, { "naked", 0, 0, false, true, true, avr_handle_fntype_attribute }, + { "bikini", 0, 0, false, true, true, avr_handle_fntype_attribute }, { NULL, 0, 0, false, false, false, NULL } };