diff options
author | Alan Modra <amodra@gmail.com> | 2009-03-10 06:53:46 +0000 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2009-03-10 06:53:46 +0000 |
commit | 69fe9ce501f5fde501443648fe4243dc9fe8d5b1 (patch) | |
tree | d2d0b3599c1607f427ecb4fcb776604037f82568 /gas/config/tc-ppc.c | |
parent | 0691f7afbc8ec41ca26f21b5dafc4eeb4ca517eb (diff) | |
download | gdb-69fe9ce501f5fde501443648fe4243dc9fe8d5b1.zip gdb-69fe9ce501f5fde501443648fe4243dc9fe8d5b1.tar.gz gdb-69fe9ce501f5fde501443648fe4243dc9fe8d5b1.tar.bz2 |
include/opcode/
* ppc.h (ppc_parse_cpu): Declare.
opcodes/
* ppc-dis.c: Include "opintl.h".
(struct ppc_mopt, ppc_opts): New.
(ppc_parse_cpu): New function.
(powerpc_init_dialect): Use it.
(print_ppc_disassembler_options): Dump options from ppc_opts.
Internationalize message.
gas/
* config/tc-ppc.c (parse_cpu): Delete.
(md_parse_option, ppc_machine): Use ppc_parse_cpu.
gas/testsuite/
* gas/ppc/altivec_and_spe.d (objdump): Add -Maltivec.
* gas/ppc/common.d: Adjust for -Mcom not including -Mppc.
Diffstat (limited to 'gas/config/tc-ppc.c')
-rw-r--r-- | gas/config/tc-ppc.c | 159 |
1 files changed, 7 insertions, 152 deletions
diff --git a/gas/config/tc-ppc.c b/gas/config/tc-ppc.c index 8b5c662..691d943 100644 --- a/gas/config/tc-ppc.c +++ b/gas/config/tc-ppc.c @@ -1015,157 +1015,11 @@ const struct option md_longopts[] = { }; const size_t md_longopts_size = sizeof (md_longopts); - -/* Handle -m options that set cpu type, and .machine arg. */ - -static int -parse_cpu (const char *arg) -{ - ppc_cpu_t retain_flags = - ppc_cpu & (PPC_OPCODE_ALTIVEC | PPC_OPCODE_VSX | PPC_OPCODE_SPE); - - /* -mpwrx and -mpwr2 mean to assemble for the IBM POWER/2 - (RIOS2). */ - if (strcmp (arg, "pwrx") == 0 || strcmp (arg, "pwr2") == 0) - ppc_cpu = PPC_OPCODE_POWER | PPC_OPCODE_POWER2 | PPC_OPCODE_32; - /* -mpwr means to assemble for the IBM POWER (RIOS1). */ - else if (strcmp (arg, "pwr") == 0) - ppc_cpu = PPC_OPCODE_POWER | PPC_OPCODE_32; - /* -m601 means to assemble for the PowerPC 601, which includes - instructions that are holdovers from the Power. */ - else if (strcmp (arg, "601") == 0) - ppc_cpu = (PPC_OPCODE_PPC | PPC_OPCODE_CLASSIC - | PPC_OPCODE_601 | PPC_OPCODE_32); - /* -mppc, -mppc32, -m603, and -m604 mean to assemble for the - PowerPC 603/604. */ - else if (strcmp (arg, "ppc") == 0 - || strcmp (arg, "ppc32") == 0 - || strcmp (arg, "603") == 0 - || strcmp (arg, "604") == 0) - ppc_cpu = PPC_OPCODE_PPC | PPC_OPCODE_CLASSIC | PPC_OPCODE_32; - /* Do all PPC750s have paired single ops? */ - else if (strcmp (arg, "750cl") == 0) - ppc_cpu = PPC_OPCODE_PPC | PPC_OPCODE_PPCPS; - else if (strcmp (arg, "403") == 0) - ppc_cpu = (PPC_OPCODE_PPC | PPC_OPCODE_CLASSIC - | PPC_OPCODE_403 | PPC_OPCODE_32); - else if (strcmp (arg, "405") == 0) - ppc_cpu = (PPC_OPCODE_PPC | PPC_OPCODE_CLASSIC - | PPC_OPCODE_403 | PPC_OPCODE_405 | PPC_OPCODE_32); - else if (strcmp (arg, "440") == 0 - || strcmp (arg, "464") == 0) - ppc_cpu = (PPC_OPCODE_PPC | PPC_OPCODE_BOOKE | PPC_OPCODE_32 - | PPC_OPCODE_440 | PPC_OPCODE_ISEL | PPC_OPCODE_RFMCI); - else if (strcmp (arg, "7400") == 0 - || strcmp (arg, "7410") == 0 - || strcmp (arg, "7450") == 0 - || strcmp (arg, "7455") == 0) - ppc_cpu = (PPC_OPCODE_PPC | PPC_OPCODE_CLASSIC - | PPC_OPCODE_ALTIVEC | PPC_OPCODE_32); - else if (strcmp (arg, "e300") == 0) - ppc_cpu = (PPC_OPCODE_PPC | PPC_OPCODE_CLASSIC | PPC_OPCODE_32 - | PPC_OPCODE_E300); - else if (strcmp (arg, "altivec") == 0) - { - if (ppc_cpu == 0) - ppc_cpu = PPC_OPCODE_PPC | PPC_OPCODE_CLASSIC; - - retain_flags |= PPC_OPCODE_ALTIVEC; - } - else if (strcmp (arg, "vsx") == 0) - { - if (ppc_cpu == 0) - ppc_cpu = PPC_OPCODE_PPC | PPC_OPCODE_CLASSIC; - - retain_flags |= PPC_OPCODE_VSX; - } - else if (strcmp (arg, "e500") == 0 || strcmp (arg, "e500x2") == 0) - { - ppc_cpu = (PPC_OPCODE_PPC | PPC_OPCODE_BOOKE | PPC_OPCODE_SPE - | PPC_OPCODE_ISEL | PPC_OPCODE_EFS | PPC_OPCODE_BRLOCK - | PPC_OPCODE_PMR | PPC_OPCODE_CACHELCK - | PPC_OPCODE_RFMCI | PPC_OPCODE_E500MC); - } - else if (strcmp (arg, "e500mc") == 0) - { - ppc_cpu = (PPC_OPCODE_PPC | PPC_OPCODE_BOOKE | PPC_OPCODE_ISEL - | PPC_OPCODE_PMR | PPC_OPCODE_CACHELCK - | PPC_OPCODE_RFMCI | PPC_OPCODE_E500MC); - } - else if (strcmp (arg, "spe") == 0) - { - if (ppc_cpu == 0) - ppc_cpu = PPC_OPCODE_PPC | PPC_OPCODE_EFS; - - retain_flags |= PPC_OPCODE_SPE; - } - /* -mppc64 and -m620 mean to assemble for the 64-bit PowerPC - 620. */ - else if (strcmp (arg, "ppc64") == 0 || strcmp (arg, "620") == 0) - { - ppc_cpu = PPC_OPCODE_PPC | PPC_OPCODE_CLASSIC | PPC_OPCODE_64; - } - else if (strcmp (arg, "ppc64bridge") == 0) - { - ppc_cpu = (PPC_OPCODE_PPC | PPC_OPCODE_CLASSIC - | PPC_OPCODE_64_BRIDGE | PPC_OPCODE_64); - } - /* -mbooke/-mbooke32 mean enable 32-bit BookE support. */ - else if (strcmp (arg, "booke") == 0 || strcmp (arg, "booke32") == 0) - { - ppc_cpu = PPC_OPCODE_PPC | PPC_OPCODE_BOOKE | PPC_OPCODE_32; - } - else if (strcmp (arg, "power4") == 0) - { - ppc_cpu = (PPC_OPCODE_PPC | PPC_OPCODE_CLASSIC - | PPC_OPCODE_64 | PPC_OPCODE_POWER4); - } - else if (strcmp (arg, "power5") == 0) - { - ppc_cpu = (PPC_OPCODE_PPC | PPC_OPCODE_CLASSIC - | PPC_OPCODE_64 | PPC_OPCODE_POWER4 - | PPC_OPCODE_POWER5); - } - else if (strcmp (arg, "power6") == 0) - { - ppc_cpu = (PPC_OPCODE_PPC | PPC_OPCODE_CLASSIC - | PPC_OPCODE_64 | PPC_OPCODE_POWER4 - | PPC_OPCODE_POWER5 | PPC_OPCODE_POWER6 - | PPC_OPCODE_ALTIVEC); - } - else if (strcmp (arg, "power7") == 0) - { - ppc_cpu = (PPC_OPCODE_PPC | PPC_OPCODE_CLASSIC - | PPC_OPCODE_ISEL | PPC_OPCODE_64 - | PPC_OPCODE_POWER4 | PPC_OPCODE_POWER5 - | PPC_OPCODE_POWER6 | PPC_OPCODE_POWER7 - | PPC_OPCODE_ALTIVEC | PPC_OPCODE_VSX); - } - else if (strcmp (arg, "cell") == 0) - { - ppc_cpu = (PPC_OPCODE_PPC | PPC_OPCODE_CLASSIC - | PPC_OPCODE_64 | PPC_OPCODE_POWER4 - | PPC_OPCODE_CELL | PPC_OPCODE_ALTIVEC); - } - /* -mcom means assemble for the common intersection between Power - and PowerPC. At present, we just allow the union, rather - than the intersection. */ - else if (strcmp (arg, "com") == 0) - ppc_cpu = PPC_OPCODE_COMMON | PPC_OPCODE_32; - /* -many means to assemble for any architecture (PWR/PWRX/PPC). */ - else if (strcmp (arg, "any") == 0) - ppc_cpu |= PPC_OPCODE_ANY; - else - return 0; - - /* Make sure the the Altivec, VSX and SPE bits are not lost. */ - ppc_cpu |= retain_flags; - return 1; -} - int md_parse_option (int c, char *arg) { + ppc_cpu_t new_cpu; + switch (c) { case 'u': @@ -1228,8 +1082,8 @@ md_parse_option (int c, char *arg) break; case 'm': - if (parse_cpu (arg)) - ; + if ((new_cpu = ppc_parse_cpu (ppc_cpu, arg)) != 0) + ppc_cpu = new_cpu; else if (strcmp (arg, "regnames") == 0) reg_names_p = TRUE; @@ -4427,6 +4281,7 @@ ppc_machine (int ignore ATTRIBUTE_UNUSED) if (cpu_string != NULL) { ppc_cpu_t old_cpu = ppc_cpu; + ppc_cpu_t new_cpu; char *p; for (p = cpu_string; *p != 0; p++) @@ -4449,8 +4304,8 @@ ppc_machine (int ignore ATTRIBUTE_UNUSED) else ppc_cpu = cpu_history[--curr_hist]; } - else if (parse_cpu (cpu_string)) - ; + else if ((new_cpu = ppc_parse_cpu (ppc_cpu, cpu_string)) != 0) + ppc_cpu = new_cpu; else as_bad (_("invalid machine `%s'"), cpu_string); |