Commit 8d1349cc by Dave Pitts Committed by Jeff Law

i370.c: Remove LONGEXTERNAL ifdef from alias_number.

        * i370.c: Remove LONGEXTERNAL ifdef from alias_number. Added hash
        routine constants.
        (mvs_hash_alias): New function.
        (mvs_add_alias): Change argument spacing.
        (mvs_need_alias): Change aliasing criteria. Added documentation.
        (mvs_get_alias): Change to use hashed name. The hashed name prevents
        CSECT name collisions.
        (mvs_check_alias): Likewise.
        (handle_pragma): Change documentation.
        * i370.md (mulsi3, divsi3, udivsi3, modsi3, umodsi3): Changed gen_rtx
        mode from SImode to DImode.
        (iorhi3): Changed LTORG size for insn.

From-SVN: r35282
parent 0aab2795
2000-07-26 Dave Pitts <dpitts@cozx.com>
* i370.c: Remove LONGEXTERNAL ifdef from alias_number. Added hash
routine constants.
(mvs_hash_alias): New function.
(mvs_add_alias): Change argument spacing.
(mvs_need_alias): Change aliasing criteria. Added documentation.
(mvs_get_alias): Change to use hashed name. The hashed name prevents
CSECT name collisions.
(mvs_check_alias): Likewise.
(handle_pragma): Change documentation.
* i370.md (mulsi3, divsi3, udivsi3, modsi3, umodsi3): Changed gen_rtx
mode from SImode to DImode.
(iorhi3): Changed LTORG size for insn.
Wed Jul 26 19:44:05 2000 Hans-Peter Nilsson <hp@axis.com>
* reload.c (find_reloads_toplev): Reload a paradoxical subreg of a
......
......@@ -101,6 +101,13 @@ static void i370_label_scan PARAMS ((void));
/* defines and functions specific to the HLASM assembler */
#ifdef TARGET_HLASM
#define MVS_HASH_PRIME 999983
#if defined(HOST_EBCDIC)
#define MVS_SET_SIZE 256
#else
#define MVS_SET_SIZE 128
#endif
#ifndef MAX_MVS_LABEL_SIZE
#define MAX_MVS_LABEL_SIZE 8
#endif
......@@ -124,9 +131,7 @@ alias_node_t;
static alias_node_t *alias_anchor = 0;
/* Alias number */
#ifdef LONGEXTERNAL
static int alias_number = 0;
#endif
/* Define the length of the internal MVS function table. */
#define MVS_FUNCTION_TABLE_LENGTH 32
......@@ -829,6 +834,22 @@ mvs_function_check (name)
return 0;
}
/* Generate a hash for a given key. */
static int
mvs_hash_alias (key)
char *key;
{
int h;
int i;
int l = strlen (key);
h = key[0];
for (i = 1; i < l; i++)
h = ((h * MVS_SET_SIZE) + key[i]) % MVS_HASH_PRIME;
return (h);
}
/* Add the alias to the current alias list. */
......@@ -836,7 +857,7 @@ void
mvs_add_alias (realname, aliasname, emitted)
const char *realname;
const char *aliasname;
int emitted;
int emitted;
{
alias_node_t *ap;
......@@ -848,18 +869,46 @@ mvs_add_alias (realname, aliasname, emitted)
alias_anchor = ap;
}
/* Check to see if the name needs aliasing */
/* Check to see if the name needs aliasing. ie. the name is either:
1. Longer than 8 characters
2. Contains an underscore
3. Is mixed case */
int
mvs_need_alias (realname)
const char *realname;
{
int i, j = strlen (realname);
if (mvs_function_check (realname))
return 0;
if (strlen (realname) > MAX_MVS_LABEL_SIZE)
#if 0
if (!strcmp (realname, "gccmain"))
return 0;
if (!strcmp (realname, "main"))
return 0;
#endif
if (j > MAX_MVS_LABEL_SIZE)
return 1;
if (strchr (realname, '_') != 0)
return 1;
if (isupper (realname[0]))
{
for (i = 1; i < j; i++)
{
if (islower (realname[i]))
return 1;
}
}
else
{
for (i = 1; i < j; i++)
{
if (isupper (realname[i]))
return 1;
}
}
return 0;
}
......@@ -884,7 +933,16 @@ mvs_get_alias (realname, aliasname)
}
if (mvs_need_alias (realname))
{
sprintf (aliasname, "ALS%05d", alias_number++);
char c1, c2;
c1 = realname[0];
c2 = realname[1];
if (islower (c1)) c1 = toupper (c1);
else if (c1 == '_') c1 = 'A';
if (islower (c2)) c2 = toupper (c2);
else if (c2 == '_' || c2 == '\0') c2 = '#';
sprintf (aliasname, "%c%c%06d", c1, c2, mvs_hash_alias (realname));
mvs_add_alias (realname, aliasname, 0);
return 1;
}
......@@ -922,7 +980,16 @@ mvs_check_alias (realname, aliasname)
}
if (mvs_need_alias (realname))
{
sprintf (aliasname, "ALS%05d", alias_number++);
char c1, c2;
c1 = realname[0];
c2 = realname[1];
if (islower (c1)) c1 = toupper (c1);
else if (c1 == '_') c1 = 'A';
if (islower (c2)) c2 = toupper (c2);
else if (c2 == '_' || c2 == '\0') c2 = '#';
sprintf (aliasname, "%c%c%06d", c1, c2, mvs_hash_alias (realname));
mvs_add_alias (realname, aliasname, 0);
alias_anchor->alias_emitted = 1;
return 2;
......@@ -939,8 +1006,9 @@ mvs_check_alias (realname, aliasname)
}
/* Called from check_newline via the macro HANDLE_PRAGMA.
FINPUT is the source file input stream.
NODE is the tree node for the token after the "pragma".
p_getc is a pointer to get character routine.
p_ungetc is a pointer to un-get character routine.
pname is the pointer to the name of the pragma to process.
The result is 1 if the pragma was handled. */
int
......
......@@ -2427,7 +2427,7 @@ check_label_emit ();
emit_insn (gen_rtx_SET (VOIDmode,
gen_rtx_SUBREG (SImode, r, 1), operands[1]));
emit_insn (gen_rtx_SET (VOIDmode, r,
gen_rtx_MULT (SImode, r, operands[2])));
gen_rtx_MULT (DImode, r, operands[2])));
emit_insn (gen_rtx_SET (VOIDmode, operands[0],
gen_rtx_SUBREG (SImode, r, 1)));
}
......@@ -2448,11 +2448,9 @@ check_label_emit ();
[(set_attr "length" "4")]
)
;; XXX see comments in mulsi above.
(define_insn ""
[(set (match_operand:DI 0 "register_operand" "=d")
(mult:DI (match_operand:DI 1 "general_operand" "%0")
;; XXX see above (match_operand:SI 2 "general_operand" "g")))]
(match_operand:SI 2 "general_operand" "di")))]
""
"*
......@@ -2534,7 +2532,7 @@ check_label_emit ();
emit_insn (gen_extendsidi2 (r, operands[1]));
emit_insn (gen_rtx_SET (VOIDmode, r,
gen_rtx_DIV (SImode, r, operands[2])));
gen_rtx_DIV (DImode, r, operands[2])));
emit_insn (gen_rtx_SET (VOIDmode, operands[0],
gen_rtx_SUBREG (SImode, r, 1)));
DONE;
......@@ -2563,7 +2561,7 @@ check_label_emit ();
{
emit_insn (gen_zero_extendsidi2 (dr, operands[1]));
emit_insn (gen_rtx_SET (VOIDmode, dr,
gen_rtx_DIV (SImode, dr, operands[2])));
gen_rtx_DIV (DImode, dr, operands[2])));
}
else
{
......@@ -2597,7 +2595,7 @@ check_label_emit ();
gen_rtx_LSHIFTRT (DImode, dr,
gen_rtx_CONST_INT (SImode, 32))));
emit_insn (gen_rtx_SET (VOIDmode, dr,
gen_rtx_DIV (SImode, dr, sr)));
gen_rtx_DIV (DImode, dr, sr)));
emit_jump_insn (gen_jump (label3));
emit_label (label1);
emit_insn (gen_rtx_SET (VOIDmode, dr_1, dr_0));
......@@ -2697,7 +2695,7 @@ check_label_emit ();
emit_insn (gen_extendsidi2 (r, operands[1]));
emit_insn (gen_rtx_SET (VOIDmode, r,
gen_rtx_MOD (SImode, r, operands[2])));
gen_rtx_MOD (DImode, r, operands[2])));
emit_insn (gen_rtx_SET (VOIDmode, operands[0],
gen_rtx_SUBREG (SImode, r, 0)));
DONE;
......@@ -2716,6 +2714,7 @@ check_label_emit ();
{
rtx dr = gen_reg_rtx (DImode);
rtx dr_0 = gen_rtx_SUBREG (SImode, dr, 0);
rtx dr_1 = gen_rtx_SUBREG (SImode, dr, 1);
emit_insn (gen_rtx_SET (VOIDmode, dr_0, operands[1]));
......@@ -2727,7 +2726,7 @@ check_label_emit ();
gen_rtx_LSHIFTRT (DImode, dr,
gen_rtx_CONST_INT (SImode, 32))));
emit_insn (gen_rtx_SET (VOIDmode, dr,
gen_rtx_MOD (SImode, dr, operands[2])));
gen_rtx_MOD (DImode, dr, operands[2])));
}
else
{
......@@ -2756,12 +2755,11 @@ check_label_emit ();
emit_jump_insn (gen_bgtu (label3));
emit_insn (gen_cmpsi (sr, const1_rtx));
emit_jump_insn (gen_blt (label2));
emit_insn (gen_cmpsi (sr, const1_rtx));
emit_jump_insn (gen_beq (label1));
emit_insn (gen_rtx_SET (VOIDmode, dr,
gen_rtx_LSHIFTRT (DImode, dr,
gen_rtx_CONST_INT (SImode, 32))));
emit_insn (gen_rtx_SET (VOIDmode, dr, gen_rtx_MOD (SImode, dr, sr)));
emit_insn (gen_rtx_SET (VOIDmode, dr, gen_rtx_MOD (DImode, dr, sr)));
emit_jump_insn (gen_jump (label3));
emit_label (label1);
emit_insn (gen_rtx_SET (VOIDmode, dr_0, const0_rtx));
......@@ -3085,7 +3083,7 @@ check_label_emit ();
}
if (GET_CODE (operands[2]) == CONST_INT)
{
mvs_check_page (0, 6, 0);
mvs_check_page (0, 6, 2);
return \"OC %O0(2,%R0),%H2\";
}
mvs_check_page (0, 6, 0);
......
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