aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog13
-rw-r--r--gcc/config/c4x/c4x.c61
-rw-r--r--gcc/config/c4x/c4x.h17
-rw-r--r--gcc/config/c4x/c4x.md16
4 files changed, 84 insertions, 23 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 4a59cac..cbd335b 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,4 +1,15 @@
-2000-01-27 Herman A.J. ten Brugge <Haj.Ten.Brugge@net.HCC.nl>
+2000-01-29 Herman A.J. ten Brugge <Haj.Ten.Brugge@net.HCC.nl>
+
+ * c4x.c (c4x_output_ascii): Restrict line length of output when TI
+ syntax is used.
+ (c4x_function_prologue): Use regnames intead of float_reg_names when
+ TI syntax is used.
+ (c4x_function_epilogue): Likewise.
+ (c4x_print_operand): Likewise.
+ * c4x.h (HOST_WIDE_INT_PRINT_HEX): Redefine.
+ * c4x.md (set_high): Disable for TARGET_TI.
+
+2000-01-29 Herman A.J. ten Brugge <Haj.Ten.Brugge@net.HCC.nl>
* c4x.h (PREFERRED_RELOAD_CLASS): Change to restrict the reloading
of framepointer + constant to ADDR_REGS class.
diff --git a/gcc/config/c4x/c4x.c b/gcc/config/c4x/c4x.c
index e1071f2..5072d23 100644
--- a/gcc/config/c4x/c4x.c
+++ b/gcc/config/c4x/c4x.c
@@ -266,7 +266,7 @@ c4x_output_ascii (stream, ptr, len)
int len;
{
char sbuf[C4X_ASCII_LIMIT + 1];
- int s, first, onlys;
+ int s, l, special, first, onlys;
if (len)
{
@@ -274,17 +274,18 @@ c4x_output_ascii (stream, ptr, len)
first = 1;
}
- for (s = 0; len > 0; --len, ++ptr)
+ for (s = l = 0; len > 0; --len, ++ptr)
{
onlys = 0;
/* Escape " and \ with a \". */
- if (*ptr == '\"' || *ptr == '\\')
- sbuf[s++] = '\\';
+ special = *ptr == '\"' || *ptr == '\\';
/* If printable - add to buff. */
- if (*ptr >= 0x20 && *ptr < 0x7f)
+ if ((! TARGET_TI || ! special) && *ptr >= 0x20 && *ptr < 0x7f)
{
+ if (special)
+ sbuf[s++] = '\\';
sbuf[s++] = *ptr;
if (s < C4X_ASCII_LIMIT - 1)
continue;
@@ -295,10 +296,21 @@ c4x_output_ascii (stream, ptr, len)
if (first)
first = 0;
else
- fputc (',', stream);
+ {
+ fputc (',', stream);
+ l++;
+ }
sbuf[s] = 0;
fprintf (stream, "\"%s\"", sbuf);
+ l += s + 2;
+ if (TARGET_TI && l >= 80 && len > 1)
+ {
+ fprintf (stream, "\n\t.byte\t");
+ first = 1;
+ l = 0;
+ }
+
s = 0;
}
if (onlys)
@@ -307,9 +319,19 @@ c4x_output_ascii (stream, ptr, len)
if (first)
first = 0;
else
- fputc (',', stream);
+ {
+ fputc (',', stream);
+ l++;
+ }
fprintf (stream, "%d", *ptr);
+ l += 3;
+ if (TARGET_TI && l >= 80 && len > 1)
+ {
+ fprintf (stream, "\n\t.byte\t");
+ first = 1;
+ l = 0;
+ }
}
if (s)
{
@@ -761,7 +783,9 @@ c4x_function_prologue (file, size)
{
fprintf (file, "\tpush\t%s\n", reg_names[regno]);
if (IS_EXT_REGNO (regno)) /* Save 32MSB of R0--R11. */
- fprintf (file, "\tpushf\t%s\n", float_reg_names[regno]);
+ fprintf (file, "\tpushf\t%s\n",
+ TARGET_TI ? reg_names[regno]
+ : float_reg_names[regno]);
}
}
/* We need to clear the repeat mode flag if the ISR is
@@ -840,7 +864,9 @@ c4x_function_prologue (file, size)
/* R6 and R7 are saved as floating point. */
if (TARGET_PRESERVE_FLOAT)
fprintf (file, "\tpush\t%s\n", reg_names[regno]);
- fprintf (file, "\tpushf\t%s\n", float_reg_names[regno]);
+ fprintf (file, "\tpushf\t%s\n",
+ TARGET_TI ? reg_names[regno]
+ : float_reg_names[regno]);
}
else if ((! dont_push_ar3) || (regno != AR3_REGNO))
{
@@ -894,7 +920,9 @@ c4x_function_epilogue (file, size)
if (! c4x_isr_reg_used_p (regno))
continue;
if (IS_EXT_REGNO (regno))
- fprintf (file, "\tpopf\t%s\n", float_reg_names[regno]);
+ fprintf (file, "\tpopf\t%s\n",
+ TARGET_TI ? reg_names[regno]
+ : float_reg_names[regno]);
fprintf (file, "\tpop\t%s\n", reg_names[regno]);
}
if (size)
@@ -991,7 +1019,9 @@ c4x_function_epilogue (file, size)
/* R6 and R7 are saved as floating point. */
if ((regno == R6_REGNO) || (regno == R7_REGNO))
{
- fprintf (file, "\tpopf\t%s\n", float_reg_names[regno]);
+ fprintf (file, "\tpopf\t%s\n",
+ TARGET_TI ? reg_names[regno]
+ : float_reg_names[regno]);
if (TARGET_PRESERVE_FLOAT)
{
restore_count--;
@@ -1745,7 +1775,7 @@ c4x_print_operand (file, op, letter)
switch (letter)
{
case 'A': /* Direct address. */
- if (code == CONST_INT || code == SYMBOL_REF)
+ if (code == CONST_INT || code == SYMBOL_REF || code == CONST)
asm_fprintf (file, "@");
break;
@@ -1779,7 +1809,7 @@ c4x_print_operand (file, op, letter)
op1 = XEXP (XEXP (op, 0), 1);
if (GET_CODE(op1) == CONST_INT || GET_CODE(op1) == SYMBOL_REF)
{
- asm_fprintf (file, "\t%s\t", TARGET_C3X ? "ldp" : "ldpk");
+ asm_fprintf (file, "\t%s\t@", TARGET_C3X ? "ldp" : "ldpk");
output_address (XEXP (adj_offsettable_operand (op, 1), 0));
asm_fprintf (file, "\n");
}
@@ -1792,7 +1822,7 @@ c4x_print_operand (file, op, letter)
&& (GET_CODE (XEXP (op, 0)) == CONST
|| GET_CODE (XEXP (op, 0)) == SYMBOL_REF))
{
- asm_fprintf (file, "%s\t", TARGET_C3X ? "ldp" : "ldpk");
+ asm_fprintf (file, "%s\t@", TARGET_C3X ? "ldp" : "ldpk");
output_address (XEXP (op, 0));
asm_fprintf (file, "\n\t");
}
@@ -1824,7 +1854,8 @@ c4x_print_operand (file, op, letter)
switch (code)
{
case REG:
- if (GET_MODE_CLASS (GET_MODE (op)) == MODE_FLOAT)
+ if (GET_MODE_CLASS (GET_MODE (op)) == MODE_FLOAT
+ && ! TARGET_TI)
fprintf (file, "%s", float_reg_names[REGNO (op)]);
else
fprintf (file, "%s", reg_names[REGNO (op)]);
diff --git a/gcc/config/c4x/c4x.h b/gcc/config/c4x/c4x.h
index c450188..8c8e981 100644
--- a/gcc/config/c4x/c4x.h
+++ b/gcc/config/c4x/c4x.h
@@ -21,6 +21,8 @@
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
+#include "hwint.h"
+
/* RUN-TIME TARGET SPECIFICATION. */
#define C4x 1
@@ -2056,6 +2058,21 @@ dtors_section () \
const_section (); \
}
+/* The TI assembler wants to have hex numbers this way. */
+
+#undef HOST_WIDE_INT_PRINT_HEX
+#ifndef HOST_WIDE_INT_PRINT_HEX
+# if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT
+# define HOST_WIDE_INT_PRINT_HEX "0%xh"
+# else
+# if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG
+# define HOST_WIDE_INT_PRINT_HEX "0%lxh"
+# else
+# define HOST_WIDE_INT_PRINT_HEX "0%llxh"
+# endif
+# endif
+#endif /* ! HOST_WIDE_INT_PRINT_HEX */
+
/* A C statement or statements to switch to the appropriate
section for output of RTX in mode MODE. RTX is some kind
of constant in RTL. The argument MODE is redundant except
diff --git a/gcc/config/c4x/c4x.md b/gcc/config/c4x/c4x.md
index 98b989a..07608c1 100644
--- a/gcc/config/c4x/c4x.md
+++ b/gcc/config/c4x/c4x.md
@@ -1109,7 +1109,7 @@
(define_insn "set_high"
[(set (match_operand:QI 0 "std_reg_operand" "=c")
(high:QI (match_operand:QI 1 "symbolic_address_operand" "")))]
- "! TARGET_C3X "
+ "! TARGET_C3X && ! TARGET_TI"
"ldhi\\t^%H1,%0"
[(set_attr "type" "unary")])
@@ -1117,14 +1117,14 @@
[(set (match_operand:QI 0 "std_reg_operand" "=c")
(lo_sum:QI (match_dup 0)
(match_operand:QI 1 "symbolic_address_operand" "")))]
- ""
+ "! TARGET_TI"
"or\\t#%H1,%0"
[(set_attr "type" "unary")])
(define_split
[(set (match_operand:QI 0 "std_reg_operand" "")
(match_operand:QI 1 "symbolic_address_operand" ""))]
- "! TARGET_C3X"
+ "! TARGET_C3X && ! TARGET_TI"
[(set (match_dup 0) (high:QI (match_dup 1)))
(set (match_dup 0) (lo_sum:QI (match_dup 0) (match_dup 1)))]
"")
@@ -1251,8 +1251,9 @@
[(set (match_operand:QI 0 "reg_operand" "")
(match_operand:QI 1 "symbolic_address_operand" ""))]
"! TARGET_SMALL
- && (TARGET_C3X || (reload_completed
- && ! std_reg_operand (operands[0], QImode)))"
+ && (TARGET_C3X || TARGET_TI
+ || (reload_completed
+ && ! std_reg_operand (operands[0], QImode)))"
[(set (match_dup 2) (high:QI (match_dup 3)))
(set (match_dup 0) (match_dup 4))
(use (match_dup 1))]
@@ -1273,8 +1274,9 @@
[(set (match_operand:QI 0 "reg_operand" "")
(match_operand:QI 1 "symbolic_address_operand" ""))]
"TARGET_SMALL
- && (TARGET_C3X || (reload_completed
- && ! std_reg_operand (operands[0], QImode)))"
+ && (TARGET_C3X || TARGET_TI
+ || (reload_completed
+ && ! std_reg_operand (operands[0], QImode)))"
[(set (match_dup 0) (match_dup 2))
(use (match_dup 1))]
"