From 2480a3a0a20c69f9da531e9d68c711e3b9e8a227 Mon Sep 17 00:00:00 2001 From: John van Groningen Date: Tue, 6 Dec 2005 11:13:52 +0000 Subject: add pushLc instruction for pushing the value of a label, with a '_' or '.' added at the beginning if this is specified in the c ABI for this platform --- cgcode.c | 29 +++++++++++++++++++++++++++++ cgcodep.h | 1 + cginput.c | 1 + 3 files changed, 31 insertions(+) diff --git a/cgcode.c b/cgcode.c index bdad684..4b72a1c 100644 --- a/cgcode.c +++ b/cgcode.c @@ -4931,6 +4931,35 @@ void code_pushL (char *label_name) s_push_b (graph_1); } +void code_pushLc (char *c_function_name) +{ + INSTRUCTION_GRAPH graph_1; + LABEL *label; + +#if (defined (sparc) && !defined (SOLARIS)) || (defined (I486) && !defined (LINUX_ELF)) || (defined (G_POWER) && !defined (LINUX_ELF)) || defined (MACH_O) + char label_name [202]; + +# if defined (G_POWER) && !defined (MACH_O) + label_name[0]='.'; +# else + label_name[0]='_'; +# endif + strcpy (&label_name[1],c_function_name); + + label=enter_label (label_name,0); +#else + label=enter_label (c_function_name,0); +#endif + + graph_1=g_lea (label); + +#ifndef M68000 + --graph_1->instruction_d_min_a_cost; +#endif + + s_push_b (graph_1); +} + void code_pushR (double v) { INSTRUCTION_GRAPH graph_1,graph_2,graph_3; diff --git a/cgcodep.h b/cgcodep.h index 88b3a05..0f4a663 100644 --- a/cgcodep.h +++ b/cgcodep.h @@ -211,6 +211,7 @@ void code_pushF_a (int a_offset); void code_pushI (LONG i); void code_pushI_a (int a_offset); void code_pushL (char *label_name); +void code_pushLc (char *c_function_name); void code_pushR (double r); void code_pushR_a (int a_offset); void code_pushzs (char *string,int length); diff --git a/cginput.c b/cginput.c index 15d5568..82c7da7 100644 --- a/cginput.c +++ b/cginput.c @@ -1922,6 +1922,7 @@ static void put_instructions_in_table2 (void) put_instruction_name ("pushI", parse_instruction_i, code_pushI ); put_instruction_name ("pushI_a", parse_instruction_n, code_pushI_a ); put_instruction_name ("pushL", parse_instruction_l, code_pushL ); + put_instruction_name ("pushLc", parse_instruction_l, code_pushLc ); put_instruction_name ("pushR", parse_instruction_r, code_pushR ); put_instruction_name ("pushR_a", parse_instruction_n, code_pushR_a ); put_instruction_name ("pushzs", parse_instruction_s, code_pushzs ); -- cgit v1.2.3