Commit 19d2d16f by Michael Meissner

Use simpler functions instead of printf. INT_TYPE_SIZE is always 32. For NT,…

Use simpler functions instead of printf.  INT_TYPE_SIZE is always 32.  For NT, do not emit .extern for builtin functions

From-SVN: r10704
parent 8282721e
......@@ -2028,7 +2028,7 @@ print_operand (file, x, code)
the left. */
if (val < 0 && (val & 1) == 0)
{
fprintf (file, "0");
putc ('0', file);
return;
}
else if (val >= 0)
......@@ -2997,9 +2997,9 @@ output_prolog (file, size)
if (TARGET_RELOCATABLE)
{
ASM_GENERATE_INTERNAL_LABEL (buf, "LCF", rs6000_pic_labelno);
fprintf (file, "\tbl ");
fputs ("\tbl ", file);
assemble_name (file, buf);
fprintf (file, "\n");
putc ('\n', file);
ASM_OUTPUT_INTERNAL_LABEL (file, "LCF", rs6000_pic_labelno);
fprintf (file, "\tmflr %s\n", reg_names[30]);
......@@ -3008,7 +3008,7 @@ output_prolog (file, size)
fprintf (file, " %s,(", reg_names[0]);
ASM_GENERATE_INTERNAL_LABEL (buf, "LCL", rs6000_pic_labelno);
assemble_name (file, buf);
fprintf (file, "-");
putc ('-', file);
ASM_GENERATE_INTERNAL_LABEL (buf, "LCF", rs6000_pic_labelno);
assemble_name (file, buf);
fprintf (file, ")(%s)\n", reg_names[30]);
......@@ -3197,10 +3197,10 @@ output_epilog (file, size)
/* An all-zero word flags the start of the tbtab, for debuggers
that have to find it by searching forward from the entry
point or from the current pc. */
fprintf (file, "\t.long 0\n");
fputs ("\t.long 0\n", file);
/* Tbtab format type. Use format type 0. */
fprintf (file, "\t.byte 0,");
fputs ("\t.byte 0,", file);
/* Language type. Unfortunately, there doesn't seem to be any
official way to get this info, so we use language_string. C
......@@ -3322,12 +3322,12 @@ output_epilog (file, size)
fprintf (file, "\t.long %d\n", parm_info);
/* Offset from start of code to tb table. */
fprintf (file, "\t.long ");
fputs ("\t.long ", file);
ASM_OUTPUT_INTERNAL_LABEL_PREFIX (file, "LT");
RS6000_OUTPUT_BASENAME (file, fname);
fprintf (file, "-.");
fputs ("-.", file);
RS6000_OUTPUT_BASENAME (file, fname);
fprintf (file, "\n");
putc ('\n', file);
/* Interrupt handler mask. */
/* Omit this long, since we never set the interrupt handler bit
......@@ -3348,7 +3348,7 @@ output_epilog (file, size)
/* Register for alloca automatic storage; this is always reg 31.
Only emit this if the alloca bit was set above. */
if (frame_pointer_needed)
fprintf (file, "\t.byte 31\n");
fputs ("\t.byte 31\n", file);
}
/* Reset varargs and save TOC indicator */
......@@ -3397,7 +3397,7 @@ output_toc (file, x, labelno)
ASM_OUTPUT_INTERNAL_LABEL_PREFIX (file, "LC");
fprintf (file, "%d = .-", labelno);
ASM_OUTPUT_INTERNAL_LABEL_PREFIX (file, "LCTOC");
fprintf (file, "1\n");
fputs ("1\n", file);
}
else
ASM_OUTPUT_INTERNAL_LABEL (file, "LC", labelno);
......@@ -3452,7 +3452,7 @@ output_toc (file, x, labelno)
abort ();
if (TARGET_MINIMAL_TOC)
fprintf (file, "\t.long ");
fputs ("\t.long ", file);
else
{
STRIP_NAME_ENCODING (real_name, name);
......@@ -3463,10 +3463,10 @@ output_toc (file, x, labelno)
else if (offset)
fprintf (file, ".P%d", offset);
fprintf (file, "[TC],");
fputs ("[TC],", file);
}
output_addr_const (file, x);
fprintf (file, "\n");
putc ('\n', file);
}
/* Output an assembler pseudo-op to write an ASCII string of N characters
......@@ -3615,17 +3615,17 @@ output_function_profiler (file, labelno)
ASM_GENERATE_INTERNAL_LABEL (buf, "LP", labelno);
if (TARGET_MINIMAL_TOC)
{
fprintf (file, "\t.long ");
fputs ("\t.long ", file);
assemble_name (file, buf);
fprintf (file, "\n");
putc ('\n', file);
}
else
{
fprintf (file, "\t.tc\t");
fputs ("\t.tc\t", file);
assemble_name (file, buf);
fprintf (file, "[TC],");
fputs ("[TC],", file);
assemble_name (file, buf);
fprintf (file, "\n");
putc ('\n', file);
}
text_section ();
......@@ -3642,19 +3642,19 @@ output_function_profiler (file, labelno)
it might be set up as the frame pointer. */
for (i = 3, j = 30; i <= last_parm_reg; i++, j--)
fprintf (file, "\tai %d,%d,0\n", j, i);
asm_fprintf (file, "\tmr %d,%d\n", j, i);
/* Load location address into r3, and call mcount. */
ASM_GENERATE_INTERNAL_LABEL (buf, "LPC", labelno);
fprintf (file, "\tl 3,");
asm_fprintf (file, "\t{l|lwz} %s,", reg_names[3]);
assemble_name (file, buf);
fprintf (file, "(2)\n\tbl .mcount\n");
asm_fprintf (file, "(%s)\n\tbl .mcount\n", reg_names[2]);
/* Restore parameter registers. */
for (i = 3, j = 30; i <= last_parm_reg; i++, j--)
fprintf (file, "\tai %d,%d,0\n", i, j);
asm_fprintf (file, "\tmr %d,%d\n", i, j);
}
/* Adjust the cost of a scheduling dependency. Return the new cost of
......
......@@ -404,8 +404,7 @@ extern char *rs6000_cpu_string;
/* A C expression for the size in bits of the type `int' on the
target machine. If you don't define this, the default is one
word. */
#define INT_TYPE_SIZE (TARGET_64BIT ? 64 : 32)
#define MAX_INT_TYPE_SIZE 64
#define INT_TYPE_SIZE 32
/* A C expression for the size in bits of the type `long' on the
target machine. If you don't define this, the default is one
......@@ -1914,7 +1913,7 @@ extern int rs6000_trunc_used;
private_data_section (); \
text_section (); \
if (profile_flag) \
fprintf (FILE, "\t.extern .mcount\n"); \
fputs ("\t.extern .mcount\n", FILE); \
}
/* Output at end of assembler file.
......@@ -1924,9 +1923,9 @@ extern int rs6000_trunc_used;
#define ASM_FILE_END(FILE) \
{ \
text_section (); \
fprintf (FILE, "_section_.text:\n"); \
fputs ("_section_.text:\n", FILE); \
data_section (); \
fprintf (FILE, "\t.long _section_.text\n"); \
fputs ("\t.long _section_.text\n", FILE); \
}
/* We define this to prevent the name mangler from putting dollar signs into
......@@ -2021,18 +2020,18 @@ toc_section () \
in each file. */ \
if (! toc_initialized) \
{ \
fprintf (asm_out_file, ".toc\nLCTOC..0:\n"); \
fprintf (asm_out_file, "\t.tc toc_table[TC],toc_table[RW]\n"); \
fputs (".toc\nLCTOC..0:\n", asm_out_file); \
fputs ("\t.tc toc_table[TC],toc_table[RW]\n", asm_out_file); \
toc_initialized = 1; \
} \
\
if (in_section != toc) \
fprintf (asm_out_file, ".csect toc_table[RW]\n"); \
fputs (".csect toc_table[RW]\n", asm_out_file); \
} \
else \
{ \
if (in_section != toc) \
fprintf (asm_out_file, ".toc\n"); \
fputs (".toc\n", asm_out_file); \
} \
in_section = toc; \
}
......@@ -2050,27 +2049,27 @@ toc_section () \
#define ASM_DECLARE_FUNCTION_NAME(FILE,NAME,DECL) \
{ if (TREE_PUBLIC (DECL)) \
{ \
fprintf (FILE, "\t.globl ."); \
fputs ("\t.globl .", FILE); \
RS6000_OUTPUT_BASENAME (FILE, NAME); \
fprintf (FILE, "\n"); \
putc ('\n', FILE); \
} \
else \
{ \
fprintf (FILE, "\t.lglobl ."); \
fputs ("\t.lglobl .", FILE); \
RS6000_OUTPUT_BASENAME (FILE, NAME); \
fprintf (FILE, "\n"); \
putc ('\n', FILE); \
} \
fprintf (FILE, ".csect "); \
fputs (".csect ", FILE); \
RS6000_OUTPUT_BASENAME (FILE, NAME); \
fprintf (FILE, "[DS]\n"); \
fputs ("[DS]\n", FILE); \
RS6000_OUTPUT_BASENAME (FILE, NAME); \
fprintf (FILE, ":\n"); \
fprintf (FILE, "\t.long ."); \
fputs (":\n", FILE); \
fputs ("\t.long .", FILE); \
RS6000_OUTPUT_BASENAME (FILE, NAME); \
fprintf (FILE, ", TOC[tc0], 0\n"); \
fprintf (FILE, ".csect .text[PR]\n."); \
fputs (", TOC[tc0], 0\n", FILE); \
fputs (".csect .text[PR]\n.", FILE); \
RS6000_OUTPUT_BASENAME (FILE, NAME); \
fprintf (FILE, ":\n"); \
fputs (":\n", FILE); \
if (write_symbols == XCOFF_DEBUG) \
xcoffout_declare_function (FILE, DECL, NAME); \
}
......@@ -2200,23 +2199,23 @@ toc_section () \
strcat (_name, TREE_CODE (DECL) == FUNCTION_DECL ? "[DS]" : "[RW]"); \
XSTR (_symref, 0) = _name; \
} \
fprintf (FILE, "\t.extern "); \
fputs ("\t.extern ", FILE); \
assemble_name (FILE, XSTR (_symref, 0)); \
if (TREE_CODE (DECL) == FUNCTION_DECL) \
{ \
fprintf (FILE, "\n\t.extern ."); \
fputs ("\n\t.extern .", FILE); \
RS6000_OUTPUT_BASENAME (FILE, XSTR (_symref, 0)); \
} \
fprintf (FILE, "\n"); \
putc ('\n', FILE); \
}
/* Similar, but for libcall. We only have to worry about the function name,
not that of the descriptor. */
#define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \
{ fprintf (FILE, "\t.extern ."); \
{ fputs ("\t.extern .", FILE); \
assemble_name (FILE, XSTR (FUN, 0)); \
fprintf (FILE, "\n"); \
putc ('\n', FILE); \
}
/* Output to assembler file text saying following lines
......@@ -2374,21 +2373,21 @@ toc_section () \
/* This is how to output an assembler line defining an `int' constant. */
#define ASM_OUTPUT_INT(FILE,VALUE) \
( fprintf (FILE, "\t.long "), \
( fputs ("\t.long ", FILE), \
output_addr_const (FILE, (VALUE)), \
fprintf (FILE, "\n"))
putc ('\n', FILE))
/* Likewise for `char' and `short' constants. */
#define ASM_OUTPUT_SHORT(FILE,VALUE) \
( fprintf (FILE, "\t.short "), \
( fputs ("\t.short ", FILE), \
output_addr_const (FILE, (VALUE)), \
fprintf (FILE, "\n"))
putc ('\n', FILE))
#define ASM_OUTPUT_CHAR(FILE,VALUE) \
( fprintf (FILE, "\t.byte "), \
( fputs ("\t.byte ", FILE), \
output_addr_const (FILE, (VALUE)), \
fprintf (FILE, "\n"))
putc ('\n', FILE))
/* This is how to output an assembler line for a numeric constant byte. */
......@@ -2427,23 +2426,23 @@ do { \
#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
do { char buf[100]; \
fprintf (FILE, "\t.long "); \
fputs ("\t.long ", FILE); \
ASM_GENERATE_INTERNAL_LABEL (buf, "L", VALUE); \
assemble_name (FILE, buf); \
fprintf (FILE, "\n"); \
putc ('\n', FILE); \
} while (0)
/* This is how to output an element of a case-vector that is relative. */
#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \
do { char buf[100]; \
fprintf (FILE, "\t.long "); \
fputs ("\t.long ", FILE); \
ASM_GENERATE_INTERNAL_LABEL (buf, "L", VALUE); \
assemble_name (FILE, buf); \
fprintf (FILE, "-"); \
putc ('-', FILE); \
ASM_GENERATE_INTERNAL_LABEL (buf, "L", REL); \
assemble_name (FILE, buf); \
fprintf (FILE, "\n"); \
putc ('\n', FILE); \
} while (0)
/* This is how to output an assembler line
......
......@@ -325,25 +325,34 @@ toc_section () \
#undef ASM_OUTPUT_EXTERNAL
#define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME) \
{ rtx _symref = XEXP (DECL_RTL (DECL), 0); \
if ((TREE_CODE (DECL) == VAR_DECL \
|| TREE_CODE (DECL) == FUNCTION_DECL) \
&& (NAME)[0] != '*' \
&& (NAME)[strlen (NAME) - 1] != ']') \
{ \
char *_name = (char *) permalloc (strlen (XSTR (_symref, 0)) + 5); \
strcpy (_name, XSTR (_symref, 0)); \
XSTR (_symref, 0) = _name; \
} \
fprintf (FILE, "\t.extern "); \
assemble_name (FILE, XSTR (_symref, 0)); \
if (TREE_CODE (DECL) == FUNCTION_DECL) \
{ \
fprintf (FILE, "\n\t.extern .."); \
assemble_name (FILE, XSTR (_symref, 0)); \
} \
fprintf (FILE, "\n"); \
#define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME) \
{ \
char *_name; \
rtx _symref = XEXP (DECL_RTL (DECL), 0); \
if ((TREE_CODE (DECL) == VAR_DECL \
|| TREE_CODE (DECL) == FUNCTION_DECL) \
&& (NAME)[0] != '*' \
&& (NAME)[strlen (NAME) - 1] != ']') \
{ \
_name = (char *) permalloc (strlen (XSTR (_symref, 0)) + 5); \
strcpy (_name, XSTR (_symref, 0)); \
XSTR (_symref, 0) = _name; \
} \
else \
_name = XSTR (_symref, 0); \
\
if (DECL_FUNCTION_CODE (DECL) == 0) \
{ \
fputs ("\t.extern ", FILE); \
assemble_name (FILE, _name); \
putc ('\n', FILE); \
if (TREE_CODE (DECL) == FUNCTION_DECL) \
{ \
fputs ("\t.extern ..", FILE); \
assemble_name (FILE, _name); \
putc ('\n', FILE); \
} \
} \
}
/* Similar, but for libcall. We only have to worry about the function name,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment