From 730f02076462ea347ce60278f16191cf42960fe0 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Mon, 6 Dec 1999 20:53:38 +0100 Subject: [PATCH] sparc.h (ASM_DECLARE_REGISTER_GLOBAL): Document .register declaration. * config/sparc/sparc.h (ASM_DECLARE_REGISTER_GLOBAL): Document .register declaration. Don't use variables with __ prefixes. From-SVN: r30810 --- gcc/ChangeLog | 3 +++ gcc/config/sparc/sparc.h | 33 +++++++++++++++++++++++---------- 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 119a1dbabc2..2932e8c7781 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -23,6 +23,9 @@ information after SUBREGs are eliminated by optimizations in this pass if PROMOTE_FUNCTION_RETURN. + * config/sparc/sparc.h (ASM_DECLARE_REGISTER_GLOBAL): Document + .register declaration. Don't use variables with __ prefixes. + Mon Dec 6 12:24:52 1999 Richard Kenner * fold-const.c (optimize_bit_field_compare): Only use one mode diff --git a/gcc/config/sparc/sparc.h b/gcc/config/sparc/sparc.h index 28371f48691..ade328a0b97 100644 --- a/gcc/config/sparc/sparc.h +++ b/gcc/config/sparc/sparc.h @@ -1834,25 +1834,38 @@ do { \ } while (0) /* Output the special assembly code needed to tell the assembler some - register is used as global register variable. */ + register is used as global register variable. + + SPARC 64bit psABI declares registers %g2 and %g3 as application + registers and %g6 and %g7 as OS registers. Any object using them + should declare (for %g2/%g3 has to, for %g6/%g7 can) that it uses them + and how they are used (scratch or some global variable). + Linker will then refuse to link together objects which use those + registers incompatibly. + + Unless the registers are used for scratch, two different global + registers cannot be declared to the same name, so in the unlikely + case of a global register variable occupying more than one register + we prefix the second and following registers with .gnu.part1. etc. */ + +extern char sparc_hard_reg_printed[8]; #ifdef HAVE_AS_REGISTER_PSEUDO_OP #define ASM_DECLARE_REGISTER_GLOBAL(FILE, DECL, REGNO, NAME) \ do { \ if (TARGET_ARCH64) \ { \ - int __end = HARD_REGNO_NREGS ((REGNO), DECL_MODE (decl)) + (REGNO); \ - int __reg; \ - extern char sparc_hard_reg_printed[8]; \ - for (__reg = (REGNO); __reg < 8 && __reg < __end; __reg++) \ - if ((__reg & ~1) == 2 || (__reg & ~1) == 6) \ + int end = HARD_REGNO_NREGS ((REGNO), DECL_MODE (decl)) + (REGNO); \ + int reg; \ + for (reg = (REGNO); reg < 8 && reg < end; reg++) \ + if ((reg & ~1) == 2 || (reg & ~1) == 6) \ { \ - if (__reg == (REGNO)) \ - fprintf ((FILE), "\t.register\t%%g%d, %s\n", __reg, (NAME)); \ + if (reg == (REGNO)) \ + fprintf ((FILE), "\t.register\t%%g%d, %s\n", reg, (NAME)); \ else \ fprintf ((FILE), "\t.register\t%%g%d, .gnu.part%d.%s\n", \ - __reg, __reg - (REGNO), (NAME)); \ - sparc_hard_reg_printed[__reg] = 1; \ + reg, reg - (REGNO), (NAME)); \ + sparc_hard_reg_printed[reg] = 1; \ } \ } \ } while (0) -- 2.30.2