aboutsummaryrefslogtreecommitdiff
path: root/gas/config/tc-ppc.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2003-07-10 16:46:38 +0000
committerJakub Jelinek <jakub@redhat.com>2003-07-10 16:46:38 +0000
commit75e21f08dc057f373ed4b9c76ddc54b2e3a0ee9d (patch)
treecf79f4f416894f9a845e34c59453f1e463fba3ed /gas/config/tc-ppc.c
parenteff26f7814f8020f59ea8819f2cb836c4dba2f84 (diff)
downloadgdb-75e21f08dc057f373ed4b9c76ddc54b2e3a0ee9d.zip
gdb-75e21f08dc057f373ed4b9c76ddc54b2e3a0ee9d.tar.gz
gdb-75e21f08dc057f373ed4b9c76ddc54b2e3a0ee9d.tar.bz2
* config/tc-ppc.h (DWARF2_LINE_MIN_INSN_LENGTH): Define always.
(TARGET_USE_CFIPOP, tc_cfi_frame_initial_instructions, tc_regname_to_dw2regnum, DWARF2_DEFAULT_RETURN_COLUMN, DWARF2_CIE_DATA_ALIGNMENT): Define. (ppc_cfi_frame_initial_instructions, tc_ppc_regname_to_dw2regnum): New prototypes. (ppc_cie_data_alignment): Declare. * config/tc-ppc.c: Include dw2gencfi.h. (ppc_cie_data_alignment): Define. (md_begin): Initialize ppc_cie_data_alignment. (ppc_cfi_frame_initial_instructions, tc_ppc_regname_to_dw2regnum): New functions. * config/tc-s390.h (DWARF2_LINE_MIN_INSN_LENGTH): Define always. (TARGET_USE_CFIPOP, tc_cfi_frame_initial_instructions, tc_regname_to_dw2regnum, DWARF2_DEFAULT_RETURN_COLUMN, DWARF2_CIE_DATA_ALIGNMENT): Define. (s390_cfi_frame_initial_instructions, tc_s390_regname_to_dw2regnum): New prototypes. (s390_cie_data_alignment): Declare. * config/tc-s390.c: Include dw2gencfi.h. (s390_cie_data_alignment): Define. (md_begin): Initialize s390_cie_data_alignment. (s390_cfi_frame_initial_instructions, tc_s390_regname_to_dw2regnum): New functions. * gas/cfi/cfi-ppc-1.s: New test. * gas/cfi/cfi-ppc-1.d: New test. * gas/cfi/cfi-s390-1.s: New test. * gas/cfi/cfi-s390-1.s: New test. * gas/cfi/cfi-s390x-1.s: New test. * gas/cfi/cfi-s390x-1.s: New test. * gas/cfi/cfi.exp: Run them.
Diffstat (limited to 'gas/config/tc-ppc.c')
-rw-r--r--gas/config/tc-ppc.c53
1 files changed, 52 insertions, 1 deletions
diff --git a/gas/config/tc-ppc.c b/gas/config/tc-ppc.c
index 8b9ffef..f3b5472 100644
--- a/gas/config/tc-ppc.c
+++ b/gas/config/tc-ppc.c
@@ -24,7 +24,7 @@
#include "as.h"
#include "safe-ctype.h"
#include "subsegs.h"
-
+#include "dw2gencfi.h"
#include "opcode/ppc.h"
#ifdef OBJ_ELF
@@ -186,6 +186,9 @@ const char FLT_CHARS[] = "dD";
/* '+' and '-' can be used as postfix predicate predictors for conditional
branches. So they need to be accepted as symbol characters. */
const char ppc_symbol_chars[] = "+-";
+
+/* The dwarf2 data alignment, adjusted for 32 or 64 bit. */
+int ppc_cie_data_alignment;
/* The target specific pseudo-ops which we support. */
@@ -1208,6 +1211,8 @@ md_begin ()
ppc_set_cpu ();
+ ppc_cie_data_alignment = ppc_obj64 ? -8 : -4;
+
#ifdef OBJ_ELF
/* Set the ELF flags if desired. */
if (ppc_flags && !msolaris)
@@ -5919,3 +5924,49 @@ tc_gen_reloc (seg, fixp)
return reloc;
}
+
+void
+ppc_cfi_frame_initial_instructions ()
+{
+ cfi_add_CFA_def_cfa (1, 0);
+}
+
+int
+tc_ppc_regname_to_dw2regnum (const char *regname)
+{
+ unsigned int regnum = -1;
+ unsigned int i;
+ const char *p;
+ char *q;
+ static struct { char *name; int dw2regnum; } regnames[] =
+ {
+ { "sp", 1 }, { "r.sp", 1 }, { "rtoc", 2 }, { "r.toc", 2 },
+ { "mq", 64 }, { "lr", 65 }, { "ctr", 66 }, { "ap", 67 },
+ { "cc", 68 }, { "xer", 76 }, { "vrsave", 109 }, { "vscr", 110 },
+ { "spe_acc", 111 }, { "spefscr", 112 }
+ };
+
+ for (i = 0; i < ARRAY_SIZE (regnames); ++i)
+ if (strcmp (regnames[i].name, regname) == 0)
+ return regnames[i].dw2regnum;
+
+ if (regname[0] == 'r' || regname[0] == 'f' || regname[0] == 'v')
+ {
+ p = regname + 1 + (regname[1] == '.');
+ regnum = strtoul (p, &q, 10);
+ if (p == q || *q || regnum >= 32)
+ return -1;
+ if (regname[0] == 'f')
+ regnum += 32;
+ else if (regname[0] == 'v')
+ regnum += 77;
+ }
+ else if (regname[0] == 'c' && regname[1] == 'r')
+ {
+ p = regname + 2 + (regname[2] == '.');
+ if (p[0] < '0' || p[0] > '7' || p[1])
+ return -1;
+ regnum = p[0] - '0' + 68;
+ }
+ return regnum;
+}