aboutsummaryrefslogtreecommitdiff
path: root/gcc/config
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2003-04-17 03:24:59 -0700
committerRichard Henderson <rth@gcc.gnu.org>2003-04-17 03:24:59 -0700
commit675ff4c7643263e605889ff424c2c9cc595b06ac (patch)
tree2488a95bf923daee8de90ff7dae47397b029784a /gcc/config
parent114278e7115aac1d32cd465a272f27e80a0e4dff (diff)
downloadgcc-675ff4c7643263e605889ff424c2c9cc595b06ac.zip
gcc-675ff4c7643263e605889ff424c2c9cc595b06ac.tar.gz
gcc-675ff4c7643263e605889ff424c2c9cc595b06ac.tar.bz2
sh.c (gen_datalabel_ref): Don't add SH_DATALABEL_ENCODING.
* config/sh/sh.c (gen_datalabel_ref): Don't add SH_DATALABEL_ENCODING. (tls_symbolic_operand): Use SYMBOL_REF_TLS_MODEL. (legitimize_pic_address): Use SYMBOL_REF_LOCAL_P. (sh_encode_section_info): Remove. (sh_strip_name_encoding): Remove. * config/sh/sh.h (SH_DATALABEL_ENCODING): Remove. (DATALABEL_SYMNAME_P, STRIP_DATALABEL_ENCODING): Remove. (SH_TLS_ENCODING, TLS_SYMNAME_P, STRIP_TLS_ENCODING): Remove. (ASM_OUTPUT_LABELREF): Remove. (ASM_OUTPUT_SYMBOL_REF): Use SYMBOL_REF_FUNCTION_P. * config/sh/sh.md (*): Use SYMBOL_REF_LOCAL_P. From-SVN: r65735
Diffstat (limited to 'gcc/config')
-rw-r--r--gcc/config/sh/sh.c129
-rw-r--r--gcc/config/sh/sh.h48
-rw-r--r--gcc/config/sh/sh.md28
3 files changed, 17 insertions, 188 deletions
diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c
index 23461ab..6cd8c11 100644
--- a/gcc/config/sh/sh.c
+++ b/gcc/config/sh/sh.c
@@ -209,8 +209,6 @@ static bool sh_function_ok_for_sibcall PARAMS ((tree, tree));
static bool sh_cannot_modify_jumps_p PARAMS ((void));
static bool sh_ms_bitfield_layout_p PARAMS ((tree));
-static void sh_encode_section_info PARAMS ((tree, int));
-static const char *sh_strip_name_encoding PARAMS ((const char *));
static void sh_init_builtins PARAMS ((void));
static void sh_media_init_builtins PARAMS ((void));
static rtx sh_expand_builtin PARAMS ((tree, rtx, rtx, enum machine_mode, int));
@@ -270,11 +268,6 @@ static int sh_address_cost PARAMS ((rtx));
#undef TARGET_MS_BITFIELD_LAYOUT_P
#define TARGET_MS_BITFIELD_LAYOUT_P sh_ms_bitfield_layout_p
-#undef TARGET_ENCODE_SECTION_INFO
-#define TARGET_ENCODE_SECTION_INFO sh_encode_section_info
-#undef TARGET_STRIP_NAME_ENCODING
-#define TARGET_STRIP_NAME_ENCODING sh_strip_name_encoding
-
#undef TARGET_INIT_BUILTINS
#define TARGET_INIT_BUILTINS sh_init_builtins
#undef TARGET_EXPAND_BUILTIN
@@ -2479,8 +2472,6 @@ gen_datalabel_ref (sym)
if (GET_CODE (sym) != SYMBOL_REF)
abort ();
- XSTR (sym, 0) = concat (SH_DATALABEL_ENCODING, XSTR (sym, 0), NULL);
-
return sym;
}
@@ -6556,28 +6547,9 @@ tls_symbolic_operand (op, mode)
rtx op;
enum machine_mode mode ATTRIBUTE_UNUSED;
{
- const char *str;
-
if (GET_CODE (op) != SYMBOL_REF)
return 0;
-
- str = XSTR (op, 0);
- STRIP_DATALABEL_ENCODING(str, str);
- if (! TLS_SYMNAME_P (str))
- return 0;
-
- switch (str[1])
- {
- case 'G':
- return TLS_MODEL_GLOBAL_DYNAMIC;
- case 'L':
- return TLS_MODEL_LOCAL_DYNAMIC;
- case 'i':
- return TLS_MODEL_INITIAL_EXEC;
- case 'l':
- return TLS_MODEL_LOCAL_EXEC;
- }
- return 0;
+ return SYMBOL_REF_TLS_MODEL (op);
}
int
@@ -7360,10 +7332,7 @@ legitimize_pic_address (orig, mode, reg)
return orig;
if (GET_CODE (orig) == LABEL_REF
- || (GET_CODE (orig) == SYMBOL_REF
- && (CONSTANT_POOL_ADDRESS_P (orig)
- /* SYMBOL_REF_FLAG is set on static symbols. */
- || SYMBOL_REF_FLAG (orig))))
+ || (GET_CODE (orig) == SYMBOL_REF && SYMBOL_REF_LOCAL_P (orig)))
{
if (reg == 0)
reg = gen_reg_rtx (Pmode);
@@ -7687,100 +7656,6 @@ sh_ms_bitfield_layout_p (record_type)
{
return TARGET_SH5;
}
-
-/* If using PIC, mark a SYMBOL_REF for a non-global symbol so that we
- may access it using GOTOFF instead of GOT. */
-
-static void
-sh_encode_section_info (decl, first)
- tree decl;
- int first;
-{
- rtx rtl, symbol;
-
- if (DECL_P (decl))
- rtl = DECL_RTL (decl);
- else
- rtl = TREE_CST_RTL (decl);
- if (GET_CODE (rtl) != MEM)
- return;
- symbol = XEXP (rtl, 0);
- if (GET_CODE (symbol) != SYMBOL_REF)
- return;
-
- if (flag_pic)
- SYMBOL_REF_FLAG (symbol) = (*targetm.binds_local_p) (decl);
-
- if (TREE_CODE (decl) == VAR_DECL && DECL_THREAD_LOCAL (decl))
- {
- const char *symbol_str, *orig_str;
- bool is_local;
- enum tls_model kind;
- char encoding;
- char *newstr;
- size_t len, dlen;
-
- orig_str = XSTR (symbol, 0);
- is_local = (*targetm.binds_local_p) (decl);
-
- if (! flag_pic)
- {
- if (is_local)
- kind = TLS_MODEL_LOCAL_EXEC;
- else
- kind = TLS_MODEL_INITIAL_EXEC;
- }
- else if (is_local)
- kind = TLS_MODEL_LOCAL_DYNAMIC;
- else
- kind = TLS_MODEL_GLOBAL_DYNAMIC;
- if (kind < flag_tls_default)
- kind = flag_tls_default;
-
- STRIP_DATALABEL_ENCODING (symbol_str, orig_str);
- dlen = symbol_str - orig_str;
-
- encoding = " GLil"[kind];
- if (TLS_SYMNAME_P (symbol_str))
- {
- if (encoding == symbol_str[1])
- return;
- /* Handle the changes from initial-exec to local-exec and
- from global-dynamic to local-dynamic. */
- if ((encoding == 'l' && symbol_str[1] == 'i')
- || (encoding == 'L' && symbol_str[1] == 'G'))
- symbol_str += 2;
- else
- abort ();
- }
-
- len = strlen (symbol_str);
- newstr = alloca (dlen + len + 3);
- if (dlen)
- memcpy (newstr, orig_str, dlen);
- newstr[dlen + 0] = SH_TLS_ENCODING[0];
- newstr[dlen + 1] = encoding;
- memcpy (newstr + dlen + 2, symbol_str, len + 1);
-
- XSTR (symbol, 0) = ggc_alloc_string (newstr, dlen + len + 2);
- }
-
- if (TARGET_SH5 && first && TREE_CODE (decl) != FUNCTION_DECL)
- XEXP (rtl, 0) = gen_datalabel_ref (symbol);
-}
-
-/* Undo the effects of the above. */
-
-static const char *
-sh_strip_name_encoding (str)
- const char *str;
-{
- STRIP_DATALABEL_ENCODING (str, str);
- STRIP_TLS_ENCODING (str, str);
- str += *str == '*';
- return str;
-}
-
/*
On the SH1..SH4, the trampoline looks like
diff --git a/gcc/config/sh/sh.h b/gcc/config/sh/sh.h
index 35fa7c6..29688cf 100644
--- a/gcc/config/sh/sh.h
+++ b/gcc/config/sh/sh.h
@@ -2761,21 +2761,6 @@ while (0)
/* Position Independent Code. */
-/* The prefix used to mark SYMBOL_REFs that refer to data symbols. */
-#define SH_DATALABEL_ENCODING "#"
-
-/* Return true if SYM_NAME starts with SH_DATALABEL_ENCODING. */
-#define DATALABEL_SYMNAME_P(SYM_NAME) \
- (SH_DATALABEL_ENCODING[1] ? (abort (), 0) : \
- (SYM_NAME)[0] == SH_DATALABEL_ENCODING[0])
-
-/* Skip an optional SH_DATALABEL_ENCODING in the beginning of
- SYM_NAME. Then, remove a leading *, like the default definition in
- output.h. */
-#define STRIP_DATALABEL_ENCODING(VAR, SYM_NAME) \
- (VAR) = (SYM_NAME) + (DATALABEL_SYMNAME_P (SYM_NAME) \
- ? strlen (SH_DATALABEL_ENCODING) : 0)
-
/* We can't directly access anything that contains a symbol,
nor can we indirect via the constant pool. */
#define LEGITIMATE_PIC_OPERAND_P(X) \
@@ -2788,20 +2773,6 @@ while (0)
((GET_CODE (X) == SYMBOL_REF || GET_CODE (X) == LABEL_REF) \
&& nonpic_symbol_mentioned_p (X))
-/* TLS. */
-
-/* The prefix used to mark SYMBOL_REFs that refer to TLS symbols. */
-#define SH_TLS_ENCODING "@"
-
-/* Return true if SYM_NAME starts with SH_TLS_ENCODING. */
-#define TLS_SYMNAME_P(SYM_NAME) \
- ((SYM_NAME)[0] == SH_TLS_ENCODING[0])
-
-/* Skip an optional SH_TLS_ENCODING in the beginning of SYM_NAME. */
-#define STRIP_TLS_ENCODING(VAR, SYM_NAME) \
- (VAR) = (SYM_NAME) + (TLS_SYMNAME_P (SYM_NAME) \
- ? strlen (SH_TLS_ENCODING) + 1 : 0)
-
/* Compute extra cost of moving data between one register class
and another. */
@@ -2958,29 +2929,12 @@ while (0)
? (TARGET_SH5 ? 244 : 23) \
: -1)
-/* This is how to output a reference to a user-level label named NAME. */
-#define ASM_OUTPUT_LABELREF(FILE, NAME) \
- do \
- { \
- const char * lname; \
- \
- STRIP_DATALABEL_ENCODING (lname, (NAME)); \
- STRIP_TLS_ENCODING (lname, lname); \
- if (lname[0] == '*') \
- fputs (lname + 1, (FILE)); \
- else \
- asm_fprintf ((FILE), "%U%s", lname); \
- } \
- while (0)
-
/* This is how to output a reference to a symbol_ref. On SH5,
references to non-code symbols must be preceded by `datalabel'. */
#define ASM_OUTPUT_SYMBOL_REF(FILE,SYM) \
do \
{ \
- if (TARGET_SH5 \
- && (DATALABEL_SYMNAME_P (XSTR ((SYM), 0)) \
- || CONSTANT_POOL_ADDRESS_P (SYM))) \
+ if (TARGET_SH5 && !SYMBOL_REF_FUNCTION_P (SYM)) \
fputs ("datalabel ", (FILE)); \
assemble_name ((FILE), XSTR ((SYM), 0)); \
} \
diff --git a/gcc/config/sh/sh.md b/gcc/config/sh/sh.md
index 47d7ae8..f440eec 100644
--- a/gcc/config/sh/sh.md
+++ b/gcc/config/sh/sh.md
@@ -5572,7 +5572,7 @@
{
rtx lab = PATTERN (gen_call_site ());
- if (SYMBOL_REF_FLAG (operands[0]))
+ if (SYMBOL_REF_LOCAL_P (operands[0]))
emit_insn (gen_sym_label2reg (operands[2], operands[0], lab));
else
emit_insn (gen_symPLT_label2reg (operands[2], operands[0], lab));
@@ -5672,7 +5672,7 @@
{
rtx lab = PATTERN (gen_call_site ());
- if (SYMBOL_REF_FLAG (operands[1]))
+ if (SYMBOL_REF_LOCAL_P (operands[1]))
emit_insn (gen_sym_label2reg (operands[3], operands[1], lab));
else
emit_insn (gen_symPLT_label2reg (operands[3], operands[1], lab));
@@ -5744,7 +5744,7 @@
operands[0] = XEXP (operands[0], 0);
if (flag_pic && GET_CODE (operands[0]) == SYMBOL_REF)
{
- if (! SYMBOL_REF_FLAG (operands[0]))
+ if (! SYMBOL_REF_LOCAL_P (operands[0]))
{
rtx reg = gen_reg_rtx (Pmode);
@@ -5787,7 +5787,7 @@
if (flag_pic)
{
- if (GET_CODE (func) == SYMBOL_REF && ! SYMBOL_REF_FLAG (func))
+ if (GET_CODE (func) == SYMBOL_REF && ! SYMBOL_REF_LOCAL_P (func))
{
rtx reg = gen_reg_rtx (Pmode);
@@ -5831,7 +5831,7 @@
}
else if (TARGET_SHCOMPACT && flag_pic
&& GET_CODE (XEXP (operands[0], 0)) == SYMBOL_REF
- && ! SYMBOL_REF_FLAG (XEXP (operands[0], 0)))
+ && ! SYMBOL_REF_LOCAL_P (XEXP (operands[0], 0)))
{
rtx reg = gen_reg_rtx (Pmode);
@@ -5907,7 +5907,7 @@
if (flag_pic)
{
- if (GET_CODE (func) == SYMBOL_REF && ! SYMBOL_REF_FLAG (func))
+ if (GET_CODE (func) == SYMBOL_REF && ! SYMBOL_REF_LOCAL_P (func))
{
rtx reg = gen_reg_rtx (Pmode);
@@ -5968,7 +5968,7 @@
operands[1] = XEXP (operands[1], 0);
if (flag_pic && GET_CODE (operands[1]) == SYMBOL_REF)
{
- if (! SYMBOL_REF_FLAG (operands[1]))
+ if (! SYMBOL_REF_LOCAL_P (operands[1]))
{
rtx reg = gen_reg_rtx (Pmode);
@@ -6012,7 +6012,7 @@
if (flag_pic)
{
- if (GET_CODE (func) == SYMBOL_REF && ! SYMBOL_REF_FLAG (func))
+ if (GET_CODE (func) == SYMBOL_REF && ! SYMBOL_REF_LOCAL_P (func))
{
rtx reg = gen_reg_rtx (Pmode);
@@ -6058,7 +6058,7 @@
}
else if (TARGET_SHCOMPACT && flag_pic
&& GET_CODE (XEXP (operands[1], 0)) == SYMBOL_REF
- && ! SYMBOL_REF_FLAG (XEXP (operands[1], 0)))
+ && ! SYMBOL_REF_LOCAL_P (XEXP (operands[1], 0)))
{
rtx reg = gen_reg_rtx (Pmode);
@@ -6176,7 +6176,7 @@
operands[0] = XEXP (operands[0], 0);
if (flag_pic && GET_CODE (operands[0]) == SYMBOL_REF)
{
- if (! SYMBOL_REF_FLAG (operands[0]))
+ if (! SYMBOL_REF_LOCAL_P (operands[0]))
{
rtx reg = gen_reg_rtx (Pmode);
@@ -6222,7 +6222,7 @@
if (flag_pic)
{
- if (GET_CODE (func) == SYMBOL_REF && ! SYMBOL_REF_FLAG (func))
+ if (GET_CODE (func) == SYMBOL_REF && ! SYMBOL_REF_LOCAL_P (func))
{
rtx reg = gen_reg_rtx (Pmode);
@@ -6277,7 +6277,7 @@
}
else if (TARGET_SHCOMPACT && flag_pic
&& GET_CODE (XEXP (operands[0], 0)) == SYMBOL_REF
- && ! SYMBOL_REF_FLAG (XEXP (operands[0], 0)))
+ && ! SYMBOL_REF_LOCAL_P (XEXP (operands[0], 0)))
{
rtx reg = gen_reg_rtx (Pmode);
@@ -6290,7 +6290,7 @@
/* The PLT needs the PIC register, but the epilogue would have
to restore it, so we can only use PC-relative PIC calls for
static functions. */
- && SYMBOL_REF_FLAG (XEXP (operands[0], 0)))
+ && SYMBOL_REF_LOCAL_P (XEXP (operands[0], 0)))
{
emit_call_insn (gen_sibcall_pcrel (XEXP (operands[0], 0), operands[1]));
DONE;
@@ -6372,7 +6372,7 @@
if (flag_pic)
{
- if (GET_CODE (func) == SYMBOL_REF && ! SYMBOL_REF_FLAG (func))
+ if (GET_CODE (func) == SYMBOL_REF && ! SYMBOL_REF_LOCAL_P (func))
{
rtx reg = gen_reg_rtx (Pmode);