2010-11-15 03:40:38 +08:00
|
|
|
//===-- PPCInstPrinter.cpp - Convert PPC MCInst to assembly syntax --------===//
|
|
|
|
//
|
2019-01-19 16:50:56 +08:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2010-11-15 03:40:38 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This class prints an PPC MCInst to a .s file.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2019-05-11 10:33:18 +08:00
|
|
|
#include "MCTargetDesc/PPCInstPrinter.h"
|
2013-03-27 04:08:20 +08:00
|
|
|
#include "MCTargetDesc/PPCMCTargetDesc.h"
|
2011-07-26 08:24:13 +08:00
|
|
|
#include "MCTargetDesc/PPCPredicates.h"
|
2017-06-06 19:49:48 +08:00
|
|
|
#include "PPCInstrInfo.h"
|
2017-11-17 09:07:10 +08:00
|
|
|
#include "llvm/CodeGen/TargetOpcodes.h"
|
2010-11-15 04:02:39 +08:00
|
|
|
#include "llvm/MC/MCExpr.h"
|
2010-11-15 03:40:38 +08:00
|
|
|
#include "llvm/MC/MCInst.h"
|
2012-04-02 15:01:04 +08:00
|
|
|
#include "llvm/MC/MCInstrInfo.h"
|
2015-05-16 05:58:42 +08:00
|
|
|
#include "llvm/MC/MCRegisterInfo.h"
|
|
|
|
#include "llvm/MC/MCSubtargetInfo.h"
|
2014-07-26 01:47:22 +08:00
|
|
|
#include "llvm/MC/MCSymbol.h"
|
2013-11-11 22:58:40 +08:00
|
|
|
#include "llvm/Support/CommandLine.h"
|
2010-11-15 03:40:38 +08:00
|
|
|
#include "llvm/Support/raw_ostream.h"
|
|
|
|
using namespace llvm;
|
|
|
|
|
2014-04-22 10:41:26 +08:00
|
|
|
#define DEBUG_TYPE "asm-printer"
|
|
|
|
|
2013-11-11 22:58:40 +08:00
|
|
|
// FIXME: Once the integrated assembler supports full register names, tie this
|
|
|
|
// to the verbose-asm setting.
|
|
|
|
static cl::opt<bool>
|
|
|
|
FullRegNames("ppc-asm-full-reg-names", cl::Hidden, cl::init(false),
|
|
|
|
cl::desc("Use full register names when printing assembly"));
|
|
|
|
|
2016-09-22 17:52:19 +08:00
|
|
|
// Useful for testing purposes. Prints vs{31-63} as v{0-31} respectively.
|
|
|
|
static cl::opt<bool>
|
|
|
|
ShowVSRNumsAsVR("ppc-vsr-nums-as-vr", cl::Hidden, cl::init(false),
|
|
|
|
cl::desc("Prints full register names with vs{31-63} as v{0-31}"));
|
|
|
|
|
2017-11-30 07:05:56 +08:00
|
|
|
// Prints full register names with percent symbol.
|
|
|
|
static cl::opt<bool>
|
|
|
|
FullRegNamesWithPercent("ppc-reg-with-percent-prefix", cl::Hidden,
|
|
|
|
cl::init(false),
|
|
|
|
cl::desc("Prints full register names with percent"));
|
|
|
|
|
2015-04-24 02:30:38 +08:00
|
|
|
#define PRINT_ALIAS_INSTR
|
2010-11-15 03:40:38 +08:00
|
|
|
#include "PPCGenAsmWriter.inc"
|
|
|
|
|
2011-06-02 10:34:55 +08:00
|
|
|
void PPCInstPrinter::printRegName(raw_ostream &OS, unsigned RegNo) const {
|
[PowerPC] Add support for the QPX vector instruction set
This adds support for the QPX vector instruction set, which is used by the
enhanced A2 cores on the IBM BG/Q supercomputers. QPX vectors are 256 bytes
wide, holding 4 double-precision floating-point values. Boolean values, modeled
here as <4 x i1> are actually also represented as floating-point values
(essentially { -1, 1 } for { false, true }). QPX shares many features with
Altivec and VSX, but is distinct from both of them. One major difference is
that, instead of adding completely-separate vector registers, QPX vector
registers are extensions of the scalar floating-point registers (lane 0 is the
corresponding scalar floating-point value). The operations supported on QPX
vectors mirrors that supported on the scalar floating-point values (with some
additional ones for permutations and logical/comparison operations).
I've been maintaining this support out-of-tree, as part of the bgclang project,
for several years. This is not the entire bgclang patch set, but is most of the
subset that can be cleanly integrated into LLVM proper at this time. Adding
this to the LLVM backend is part of my efforts to rebase bgclang to the current
LLVM trunk, but is independently useful (especially for codes that use LLVM as
a JIT in library form).
The assembler/disassembler test coverage is complete. The CodeGen test coverage
is not, but I've included some tests, and more will be added as follow-up work.
llvm-svn: 230413
2015-02-25 09:06:45 +08:00
|
|
|
const char *RegName = getRegisterName(RegNo);
|
|
|
|
if (RegName[0] == 'q' /* QPX */) {
|
|
|
|
// The system toolchain on the BG/Q does not understand QPX register names
|
|
|
|
// in .cfi_* directives, so print the name of the floating-point
|
|
|
|
// subregister instead.
|
|
|
|
std::string RN(RegName);
|
|
|
|
|
|
|
|
RN[0] = 'f';
|
|
|
|
OS << RN;
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
OS << RegName;
|
2011-05-31 04:20:15 +08:00
|
|
|
}
|
2010-11-15 03:40:38 +08:00
|
|
|
|
2020-01-04 02:55:30 +08:00
|
|
|
void PPCInstPrinter::printInst(const MCInst *MI, uint64_t Address,
|
|
|
|
StringRef Annot, const MCSubtargetInfo &STI,
|
|
|
|
raw_ostream &O) {
|
2019-10-17 21:20:25 +08:00
|
|
|
// Customize printing of the addis instruction on AIX. When an operand is a
|
|
|
|
// symbol reference, the instruction syntax is changed to look like a load
|
|
|
|
// operation, i.e:
|
|
|
|
// Transform: addis $rD, $rA, $src --> addis $rD, $src($rA).
|
|
|
|
if (TT.isOSAIX() &&
|
|
|
|
(MI->getOpcode() == PPC::ADDIS8 || MI->getOpcode() == PPC::ADDIS) &&
|
|
|
|
MI->getOperand(2).isExpr()) {
|
|
|
|
assert((MI->getOperand(0).isReg() && MI->getOperand(1).isReg()) &&
|
|
|
|
"The first and the second operand of an addis instruction"
|
|
|
|
" should be registers.");
|
|
|
|
|
|
|
|
assert(isa<MCSymbolRefExpr>(MI->getOperand(2).getExpr()) &&
|
|
|
|
"The third operand of an addis instruction should be a symbol "
|
|
|
|
"reference expression if it is an expression at all.");
|
|
|
|
|
|
|
|
O << "\taddis ";
|
|
|
|
printOperand(MI, 0, O);
|
|
|
|
O << ", ";
|
|
|
|
printOperand(MI, 2, O);
|
|
|
|
O << "(";
|
|
|
|
printOperand(MI, 1, O);
|
|
|
|
O << ")";
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2010-11-15 05:39:51 +08:00
|
|
|
// Check for slwi/srwi mnemonics.
|
|
|
|
if (MI->getOpcode() == PPC::RLWINM) {
|
|
|
|
unsigned char SH = MI->getOperand(2).getImm();
|
|
|
|
unsigned char MB = MI->getOperand(3).getImm();
|
|
|
|
unsigned char ME = MI->getOperand(4).getImm();
|
|
|
|
bool useSubstituteMnemonic = false;
|
|
|
|
if (SH <= 31 && MB == 0 && ME == (31-SH)) {
|
|
|
|
O << "\tslwi "; useSubstituteMnemonic = true;
|
|
|
|
}
|
|
|
|
if (SH <= 31 && MB == (32-SH) && ME == 31) {
|
|
|
|
O << "\tsrwi "; useSubstituteMnemonic = true;
|
|
|
|
SH = 32-SH;
|
|
|
|
}
|
|
|
|
if (useSubstituteMnemonic) {
|
|
|
|
printOperand(MI, 0, O);
|
|
|
|
O << ", ";
|
|
|
|
printOperand(MI, 1, O);
|
|
|
|
O << ", " << (unsigned int)SH;
|
2011-09-16 07:38:46 +08:00
|
|
|
|
2011-09-22 01:58:45 +08:00
|
|
|
printAnnotation(O, Annot);
|
2010-11-15 05:39:51 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2017-07-26 02:26:35 +08:00
|
|
|
|
2010-11-15 05:39:51 +08:00
|
|
|
if ((MI->getOpcode() == PPC::OR || MI->getOpcode() == PPC::OR8) &&
|
|
|
|
MI->getOperand(1).getReg() == MI->getOperand(2).getReg()) {
|
|
|
|
O << "\tmr ";
|
|
|
|
printOperand(MI, 0, O);
|
|
|
|
O << ", ";
|
|
|
|
printOperand(MI, 1, O);
|
2011-09-22 01:58:45 +08:00
|
|
|
printAnnotation(O, Annot);
|
2010-11-15 05:39:51 +08:00
|
|
|
return;
|
|
|
|
}
|
2017-07-26 02:26:35 +08:00
|
|
|
|
2017-05-12 00:54:23 +08:00
|
|
|
if (MI->getOpcode() == PPC::RLDICR ||
|
|
|
|
MI->getOpcode() == PPC::RLDICR_32) {
|
2010-11-15 05:39:51 +08:00
|
|
|
unsigned char SH = MI->getOperand(2).getImm();
|
|
|
|
unsigned char ME = MI->getOperand(3).getImm();
|
|
|
|
// rldicr RA, RS, SH, 63-SH == sldi RA, RS, SH
|
|
|
|
if (63-SH == ME) {
|
|
|
|
O << "\tsldi ";
|
|
|
|
printOperand(MI, 0, O);
|
|
|
|
O << ", ";
|
|
|
|
printOperand(MI, 1, O);
|
|
|
|
O << ", " << (unsigned int)SH;
|
2011-09-22 01:58:45 +08:00
|
|
|
printAnnotation(O, Annot);
|
2010-11-15 05:39:51 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2015-04-24 06:47:57 +08:00
|
|
|
|
|
|
|
// dcbt[st] is printed manually here because:
|
|
|
|
// 1. The assembly syntax is different between embedded and server targets
|
|
|
|
// 2. We must print the short mnemonics for TH == 0 because the
|
|
|
|
// embedded/server syntax default will not be stable across assemblers
|
|
|
|
// The syntax for dcbt is:
|
|
|
|
// dcbt ra, rb, th [server]
|
|
|
|
// dcbt th, ra, rb [embedded]
|
|
|
|
// where th can be omitted when it is 0. dcbtst is the same.
|
|
|
|
if (MI->getOpcode() == PPC::DCBT || MI->getOpcode() == PPC::DCBTST) {
|
|
|
|
unsigned char TH = MI->getOperand(0).getImm();
|
|
|
|
O << "\tdcbt";
|
|
|
|
if (MI->getOpcode() == PPC::DCBTST)
|
|
|
|
O << "st";
|
|
|
|
if (TH == 16)
|
|
|
|
O << "t";
|
|
|
|
O << " ";
|
|
|
|
|
2015-05-26 18:47:10 +08:00
|
|
|
bool IsBookE = STI.getFeatureBits()[PPC::FeatureBookE];
|
2015-04-24 06:47:57 +08:00
|
|
|
if (IsBookE && TH != 0 && TH != 16)
|
|
|
|
O << (unsigned int) TH << ", ";
|
|
|
|
|
|
|
|
printOperand(MI, 1, O);
|
|
|
|
O << ", ";
|
|
|
|
printOperand(MI, 2, O);
|
|
|
|
|
|
|
|
if (!IsBookE && TH != 0 && TH != 16)
|
|
|
|
O << ", " << (unsigned int) TH;
|
|
|
|
|
|
|
|
printAnnotation(O, Annot);
|
|
|
|
return;
|
|
|
|
}
|
2016-09-03 07:41:54 +08:00
|
|
|
|
|
|
|
if (MI->getOpcode() == PPC::DCBF) {
|
|
|
|
unsigned char L = MI->getOperand(0).getImm();
|
|
|
|
if (!L || L == 1 || L == 3) {
|
|
|
|
O << "\tdcbf";
|
|
|
|
if (L == 1 || L == 3)
|
|
|
|
O << "l";
|
|
|
|
if (L == 3)
|
|
|
|
O << "p";
|
|
|
|
O << " ";
|
|
|
|
|
|
|
|
printOperand(MI, 1, O);
|
|
|
|
O << ", ";
|
|
|
|
printOperand(MI, 2, O);
|
|
|
|
|
|
|
|
printAnnotation(O, Annot);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2017-07-26 02:26:35 +08:00
|
|
|
|
2015-04-24 02:30:38 +08:00
|
|
|
if (!printAliasInstr(MI, O))
|
|
|
|
printInstruction(MI, O);
|
2011-09-22 01:58:45 +08:00
|
|
|
printAnnotation(O, Annot);
|
2010-11-15 03:40:38 +08:00
|
|
|
}
|
|
|
|
|
2010-11-15 05:51:37 +08:00
|
|
|
void PPCInstPrinter::printPredicateOperand(const MCInst *MI, unsigned OpNo,
|
2018-07-31 03:41:25 +08:00
|
|
|
raw_ostream &O,
|
2010-11-15 05:51:37 +08:00
|
|
|
const char *Modifier) {
|
|
|
|
unsigned Code = MI->getOperand(OpNo).getImm();
|
2012-06-23 07:10:08 +08:00
|
|
|
|
2010-11-15 05:51:37 +08:00
|
|
|
if (StringRef(Modifier) == "cc") {
|
|
|
|
switch ((PPC::Predicate)Code) {
|
2013-06-25 00:52:04 +08:00
|
|
|
case PPC::PRED_LT_MINUS:
|
|
|
|
case PPC::PRED_LT_PLUS:
|
|
|
|
case PPC::PRED_LT:
|
|
|
|
O << "lt";
|
|
|
|
return;
|
|
|
|
case PPC::PRED_LE_MINUS:
|
|
|
|
case PPC::PRED_LE_PLUS:
|
|
|
|
case PPC::PRED_LE:
|
|
|
|
O << "le";
|
|
|
|
return;
|
|
|
|
case PPC::PRED_EQ_MINUS:
|
|
|
|
case PPC::PRED_EQ_PLUS:
|
|
|
|
case PPC::PRED_EQ:
|
|
|
|
O << "eq";
|
|
|
|
return;
|
|
|
|
case PPC::PRED_GE_MINUS:
|
|
|
|
case PPC::PRED_GE_PLUS:
|
|
|
|
case PPC::PRED_GE:
|
|
|
|
O << "ge";
|
|
|
|
return;
|
|
|
|
case PPC::PRED_GT_MINUS:
|
|
|
|
case PPC::PRED_GT_PLUS:
|
|
|
|
case PPC::PRED_GT:
|
|
|
|
O << "gt";
|
|
|
|
return;
|
|
|
|
case PPC::PRED_NE_MINUS:
|
|
|
|
case PPC::PRED_NE_PLUS:
|
|
|
|
case PPC::PRED_NE:
|
|
|
|
O << "ne";
|
|
|
|
return;
|
|
|
|
case PPC::PRED_UN_MINUS:
|
|
|
|
case PPC::PRED_UN_PLUS:
|
|
|
|
case PPC::PRED_UN:
|
|
|
|
O << "un";
|
|
|
|
return;
|
|
|
|
case PPC::PRED_NU_MINUS:
|
|
|
|
case PPC::PRED_NU_PLUS:
|
|
|
|
case PPC::PRED_NU:
|
|
|
|
O << "nu";
|
|
|
|
return;
|
Add CR-bit tracking to the PowerPC backend for i1 values
This change enables tracking i1 values in the PowerPC backend using the
condition register bits. These bits can be treated on PowerPC as separate
registers; individual bit operations (and, or, xor, etc.) are supported.
Tracking booleans in CR bits has several advantages:
- Reduction in register pressure (because we no longer need GPRs to store
boolean values).
- Logical operations on booleans can be handled more efficiently; we used to
have to move all results from comparisons into GPRs, perform promoted
logical operations in GPRs, and then move the result back into condition
register bits to be used by conditional branches. This can be very
inefficient, because the throughput of these CR <-> GPR moves have high
latency and low throughput (especially when other associated instructions
are accounted for).
- On the POWER7 and similar cores, we can increase total throughput by using
the CR bits. CR bit operations have a dedicated functional unit.
Most of this is more-or-less mechanical: Adjustments were needed in the
calling-convention code, support was added for spilling/restoring individual
condition-register bits, and conditional branch instruction definitions taking
specific CR bits were added (plus patterns and code for generating bit-level
operations).
This is enabled by default when running at -O2 and higher. For -O0 and -O1,
where the ability to debug is more important, this feature is disabled by
default. Individual CR bits do not have assigned DWARF register numbers,
and storing values in CR bits makes them invisible to the debugger.
It is critical, however, that we don't move i1 values that have been promoted
to larger values (such as those passed as function arguments) into bit
registers only to quickly turn around and move the values back into GPRs (such
as happens when values are returned by functions). A pair of target-specific
DAG combines are added to remove the trunc/extends in:
trunc(binary-ops(binary-ops(zext(x), zext(y)), ...)
and:
zext(binary-ops(binary-ops(trunc(x), trunc(y)), ...)
In short, we only want to use CR bits where some of the i1 values come from
comparisons or are used by conditional branches or selects. To put it another
way, if we can do the entire i1 computation in GPRs, then we probably should
(on the POWER7, the GPR-operation throughput is higher, and for all cores, the
CR <-> GPR moves are expensive).
POWER7 test-suite performance results (from 10 runs in each configuration):
SingleSource/Benchmarks/Misc/mandel-2: 35% speedup
MultiSource/Benchmarks/Prolangs-C++/city/city: 21% speedup
MultiSource/Benchmarks/MiBench/automotive-susan: 23% speedup
SingleSource/Benchmarks/CoyoteBench/huffbench: 13% speedup
SingleSource/Benchmarks/Misc-C++/Large/sphereflake: 13% speedup
SingleSource/Benchmarks/Misc-C++/mandel-text: 10% speedup
SingleSource/Benchmarks/Misc-C++-EH/spirit: 10% slowdown
MultiSource/Applications/lemon/lemon: 8% slowdown
llvm-svn: 202451
2014-02-28 08:27:01 +08:00
|
|
|
case PPC::PRED_BIT_SET:
|
|
|
|
case PPC::PRED_BIT_UNSET:
|
|
|
|
llvm_unreachable("Invalid use of bit predicate code");
|
2013-06-25 00:52:04 +08:00
|
|
|
}
|
2013-06-25 01:03:25 +08:00
|
|
|
llvm_unreachable("Invalid predicate code");
|
2013-06-25 00:52:04 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (StringRef(Modifier) == "pm") {
|
|
|
|
switch ((PPC::Predicate)Code) {
|
|
|
|
case PPC::PRED_LT:
|
|
|
|
case PPC::PRED_LE:
|
|
|
|
case PPC::PRED_EQ:
|
|
|
|
case PPC::PRED_GE:
|
|
|
|
case PPC::PRED_GT:
|
|
|
|
case PPC::PRED_NE:
|
|
|
|
case PPC::PRED_UN:
|
|
|
|
case PPC::PRED_NU:
|
|
|
|
return;
|
|
|
|
case PPC::PRED_LT_MINUS:
|
|
|
|
case PPC::PRED_LE_MINUS:
|
|
|
|
case PPC::PRED_EQ_MINUS:
|
|
|
|
case PPC::PRED_GE_MINUS:
|
|
|
|
case PPC::PRED_GT_MINUS:
|
|
|
|
case PPC::PRED_NE_MINUS:
|
|
|
|
case PPC::PRED_UN_MINUS:
|
|
|
|
case PPC::PRED_NU_MINUS:
|
|
|
|
O << "-";
|
|
|
|
return;
|
|
|
|
case PPC::PRED_LT_PLUS:
|
|
|
|
case PPC::PRED_LE_PLUS:
|
|
|
|
case PPC::PRED_EQ_PLUS:
|
|
|
|
case PPC::PRED_GE_PLUS:
|
|
|
|
case PPC::PRED_GT_PLUS:
|
|
|
|
case PPC::PRED_NE_PLUS:
|
|
|
|
case PPC::PRED_UN_PLUS:
|
|
|
|
case PPC::PRED_NU_PLUS:
|
|
|
|
O << "+";
|
|
|
|
return;
|
Add CR-bit tracking to the PowerPC backend for i1 values
This change enables tracking i1 values in the PowerPC backend using the
condition register bits. These bits can be treated on PowerPC as separate
registers; individual bit operations (and, or, xor, etc.) are supported.
Tracking booleans in CR bits has several advantages:
- Reduction in register pressure (because we no longer need GPRs to store
boolean values).
- Logical operations on booleans can be handled more efficiently; we used to
have to move all results from comparisons into GPRs, perform promoted
logical operations in GPRs, and then move the result back into condition
register bits to be used by conditional branches. This can be very
inefficient, because the throughput of these CR <-> GPR moves have high
latency and low throughput (especially when other associated instructions
are accounted for).
- On the POWER7 and similar cores, we can increase total throughput by using
the CR bits. CR bit operations have a dedicated functional unit.
Most of this is more-or-less mechanical: Adjustments were needed in the
calling-convention code, support was added for spilling/restoring individual
condition-register bits, and conditional branch instruction definitions taking
specific CR bits were added (plus patterns and code for generating bit-level
operations).
This is enabled by default when running at -O2 and higher. For -O0 and -O1,
where the ability to debug is more important, this feature is disabled by
default. Individual CR bits do not have assigned DWARF register numbers,
and storing values in CR bits makes them invisible to the debugger.
It is critical, however, that we don't move i1 values that have been promoted
to larger values (such as those passed as function arguments) into bit
registers only to quickly turn around and move the values back into GPRs (such
as happens when values are returned by functions). A pair of target-specific
DAG combines are added to remove the trunc/extends in:
trunc(binary-ops(binary-ops(zext(x), zext(y)), ...)
and:
zext(binary-ops(binary-ops(trunc(x), trunc(y)), ...)
In short, we only want to use CR bits where some of the i1 values come from
comparisons or are used by conditional branches or selects. To put it another
way, if we can do the entire i1 computation in GPRs, then we probably should
(on the POWER7, the GPR-operation throughput is higher, and for all cores, the
CR <-> GPR moves are expensive).
POWER7 test-suite performance results (from 10 runs in each configuration):
SingleSource/Benchmarks/Misc/mandel-2: 35% speedup
MultiSource/Benchmarks/Prolangs-C++/city/city: 21% speedup
MultiSource/Benchmarks/MiBench/automotive-susan: 23% speedup
SingleSource/Benchmarks/CoyoteBench/huffbench: 13% speedup
SingleSource/Benchmarks/Misc-C++/Large/sphereflake: 13% speedup
SingleSource/Benchmarks/Misc-C++/mandel-text: 10% speedup
SingleSource/Benchmarks/Misc-C++-EH/spirit: 10% slowdown
MultiSource/Applications/lemon/lemon: 8% slowdown
llvm-svn: 202451
2014-02-28 08:27:01 +08:00
|
|
|
case PPC::PRED_BIT_SET:
|
|
|
|
case PPC::PRED_BIT_UNSET:
|
|
|
|
llvm_unreachable("Invalid use of bit predicate code");
|
2010-11-15 05:51:37 +08:00
|
|
|
}
|
2013-06-25 01:03:25 +08:00
|
|
|
llvm_unreachable("Invalid predicate code");
|
2010-11-15 05:51:37 +08:00
|
|
|
}
|
2017-07-26 02:26:35 +08:00
|
|
|
|
2010-11-15 05:51:37 +08:00
|
|
|
assert(StringRef(Modifier) == "reg" &&
|
2013-06-25 00:52:04 +08:00
|
|
|
"Need to specify 'cc', 'pm' or 'reg' as predicate op modifier!");
|
2010-11-15 05:51:37 +08:00
|
|
|
printOperand(MI, OpNo+1, O);
|
|
|
|
}
|
|
|
|
|
[PowerPC] Support asm parsing for bc[l][a][+-] mnemonics
PowerPC assembly code in the wild, so it seems, has things like this:
bc+ 12, 28, .L9
This is a bit odd because the '+' here becomes part of the BO field, and the BO
field is otherwise the first operand. Nevertheless, the ISA specification does
clearly say that the +- hint syntax applies to all conditional-branch mnemonics
(that test either CTR or a condition register, although not the forms which
check both), both basic and extended, so this is supposed to be valid.
This introduces some asm-parser-only definitions which take only the upper
three bits from the specified BO value, and the lower two bits are implied by
the +- suffix (via some associated aliases).
Fixes PR23646.
llvm-svn: 280571
2016-09-03 10:31:44 +08:00
|
|
|
void PPCInstPrinter::printATBitsAsHint(const MCInst *MI, unsigned OpNo,
|
|
|
|
raw_ostream &O) {
|
|
|
|
unsigned Code = MI->getOperand(OpNo).getImm();
|
|
|
|
if (Code == 2)
|
|
|
|
O << "-";
|
|
|
|
else if (Code == 3)
|
|
|
|
O << "+";
|
|
|
|
}
|
|
|
|
|
2015-03-05 04:44:33 +08:00
|
|
|
void PPCInstPrinter::printU1ImmOperand(const MCInst *MI, unsigned OpNo,
|
|
|
|
raw_ostream &O) {
|
|
|
|
unsigned int Value = MI->getOperand(OpNo).getImm();
|
|
|
|
assert(Value <= 1 && "Invalid u1imm argument!");
|
|
|
|
O << (unsigned int)Value;
|
|
|
|
}
|
|
|
|
|
[PowerPC] Initial support for the VSX instruction set
VSX is an ISA extension supported on the POWER7 and later cores that enhances
floating-point vector and scalar capabilities. Among other things, this adds
<2 x double> support and generally helps to reduce register pressure.
The interesting part of this ISA feature is the register configuration: there
are 64 new 128-bit vector registers, the 32 of which are super-registers of the
existing 32 scalar floating-point registers, and the second 32 of which overlap
with the 32 Altivec vector registers. This makes things like vector insertion
and extraction tricky: this can be free but only if we force a restriction to
the right register subclass when needed. A new "minipass" PPCVSXCopy takes care
of this (although it could do a more-optimal job of it; see the comment about
unnecessary copies below).
Please note that, currently, VSX is not enabled by default when targeting
anything because it is not yet ready for that. The assembler and disassembler
are fully implemented and tested. However:
- CodeGen support causes miscompiles; test-suite runtime failures:
MultiSource/Benchmarks/FreeBench/distray/distray
MultiSource/Benchmarks/McCat/08-main/main
MultiSource/Benchmarks/Olden/voronoi/voronoi
MultiSource/Benchmarks/mafft/pairlocalalign
MultiSource/Benchmarks/tramp3d-v4/tramp3d-v4
SingleSource/Benchmarks/CoyoteBench/almabench
SingleSource/Benchmarks/Misc/matmul_f64_4x4
- The lowering currently falls back to using Altivec instructions far more
than it should. Worse, there are some things that are scalarized through the
stack that shouldn't be.
- A lot of unnecessary copies make it past the optimizers, and this needs to
be fixed.
- Many more regression tests are needed.
Normally, I'd fix these things prior to committing, but there are some
students and other contributors who would like to work this, and so it makes
sense to move this development process upstream where it can be subject to the
regular code-review procedures.
llvm-svn: 203768
2014-03-13 15:58:58 +08:00
|
|
|
void PPCInstPrinter::printU2ImmOperand(const MCInst *MI, unsigned OpNo,
|
|
|
|
raw_ostream &O) {
|
|
|
|
unsigned int Value = MI->getOperand(OpNo).getImm();
|
|
|
|
assert(Value <= 3 && "Invalid u2imm argument!");
|
|
|
|
O << (unsigned int)Value;
|
|
|
|
}
|
|
|
|
|
2015-03-26 03:36:23 +08:00
|
|
|
void PPCInstPrinter::printU3ImmOperand(const MCInst *MI, unsigned OpNo,
|
|
|
|
raw_ostream &O) {
|
|
|
|
unsigned int Value = MI->getOperand(OpNo).getImm();
|
|
|
|
assert(Value <= 8 && "Invalid u3imm argument!");
|
|
|
|
O << (unsigned int)Value;
|
|
|
|
}
|
|
|
|
|
2014-07-30 06:21:57 +08:00
|
|
|
void PPCInstPrinter::printU4ImmOperand(const MCInst *MI, unsigned OpNo,
|
|
|
|
raw_ostream &O) {
|
|
|
|
unsigned int Value = MI->getOperand(OpNo).getImm();
|
|
|
|
assert(Value <= 15 && "Invalid u4imm argument!");
|
|
|
|
O << (unsigned int)Value;
|
|
|
|
}
|
|
|
|
|
2010-11-15 04:11:21 +08:00
|
|
|
void PPCInstPrinter::printS5ImmOperand(const MCInst *MI, unsigned OpNo,
|
|
|
|
raw_ostream &O) {
|
2012-10-09 02:59:53 +08:00
|
|
|
int Value = MI->getOperand(OpNo).getImm();
|
2012-08-25 07:29:28 +08:00
|
|
|
Value = SignExtend32<5>(Value);
|
2010-11-15 04:11:21 +08:00
|
|
|
O << (int)Value;
|
|
|
|
}
|
|
|
|
|
|
|
|
void PPCInstPrinter::printU5ImmOperand(const MCInst *MI, unsigned OpNo,
|
|
|
|
raw_ostream &O) {
|
2012-10-09 02:59:53 +08:00
|
|
|
unsigned int Value = MI->getOperand(OpNo).getImm();
|
2010-11-15 04:11:21 +08:00
|
|
|
assert(Value <= 31 && "Invalid u5imm argument!");
|
|
|
|
O << (unsigned int)Value;
|
|
|
|
}
|
|
|
|
|
|
|
|
void PPCInstPrinter::printU6ImmOperand(const MCInst *MI, unsigned OpNo,
|
|
|
|
raw_ostream &O) {
|
2012-10-09 02:59:53 +08:00
|
|
|
unsigned int Value = MI->getOperand(OpNo).getImm();
|
2010-11-15 04:11:21 +08:00
|
|
|
assert(Value <= 63 && "Invalid u6imm argument!");
|
|
|
|
O << (unsigned int)Value;
|
|
|
|
}
|
|
|
|
|
[Power9] Implement new vsx instructions: insert, extract, test data class, min/max, reverse, permute, splat
This change implements the following vsx instructions:
- Scalar Insert/Extract
xsiexpdp xsiexpqp xsxexpdp xsxsigdp xsxexpqp xsxsigqp
- Vector Insert/Extract
xviexpdp xviexpsp xvxexpdp xvxexpsp xvxsigdp xvxsigsp
xxextractuw xxinsertw
- Scalar/Vector Test Data Class
xststdcdp xststdcsp xststdcqp
xvtstdcdp xvtstdcsp
- Maximum/Minimum
xsmaxcdp xsmaxjdp
xsmincdp xsminjdp
- Vector Byte-Reverse/Permute/Splat
xxbrd xxbrh xxbrq xxbrw
xxperm xxpermr
xxspltib
30 instructions
Thanks Nemanja for invaluable discussion! Thanks Kit's great help!
Reviewers: hal, nemanja, kbarton, tjablin, amehsan
http://reviews.llvm.org/D16842
llvm-svn: 264567
2016-03-28 16:34:28 +08:00
|
|
|
void PPCInstPrinter::printU7ImmOperand(const MCInst *MI, unsigned OpNo,
|
|
|
|
raw_ostream &O) {
|
|
|
|
unsigned int Value = MI->getOperand(OpNo).getImm();
|
|
|
|
assert(Value <= 127 && "Invalid u7imm argument!");
|
|
|
|
O << (unsigned int)Value;
|
|
|
|
}
|
|
|
|
|
2016-09-23 21:25:31 +08:00
|
|
|
// Operands of BUILD_VECTOR are signed and we use this to print operands
|
|
|
|
// of XXSPLTIB which are unsigned. So we simply truncate to 8 bits and
|
|
|
|
// print as unsigned.
|
[Power9] Implement new vsx instructions: insert, extract, test data class, min/max, reverse, permute, splat
This change implements the following vsx instructions:
- Scalar Insert/Extract
xsiexpdp xsiexpqp xsxexpdp xsxsigdp xsxexpqp xsxsigqp
- Vector Insert/Extract
xviexpdp xviexpsp xvxexpdp xvxexpsp xvxsigdp xvxsigsp
xxextractuw xxinsertw
- Scalar/Vector Test Data Class
xststdcdp xststdcsp xststdcqp
xvtstdcdp xvtstdcsp
- Maximum/Minimum
xsmaxcdp xsmaxjdp
xsmincdp xsminjdp
- Vector Byte-Reverse/Permute/Splat
xxbrd xxbrh xxbrq xxbrw
xxperm xxpermr
xxspltib
30 instructions
Thanks Nemanja for invaluable discussion! Thanks Kit's great help!
Reviewers: hal, nemanja, kbarton, tjablin, amehsan
http://reviews.llvm.org/D16842
llvm-svn: 264567
2016-03-28 16:34:28 +08:00
|
|
|
void PPCInstPrinter::printU8ImmOperand(const MCInst *MI, unsigned OpNo,
|
|
|
|
raw_ostream &O) {
|
2016-09-23 21:25:31 +08:00
|
|
|
unsigned char Value = MI->getOperand(OpNo).getImm();
|
[Power9] Implement new vsx instructions: insert, extract, test data class, min/max, reverse, permute, splat
This change implements the following vsx instructions:
- Scalar Insert/Extract
xsiexpdp xsiexpqp xsxexpdp xsxsigdp xsxexpqp xsxsigqp
- Vector Insert/Extract
xviexpdp xviexpsp xvxexpdp xvxexpsp xvxsigdp xvxsigsp
xxextractuw xxinsertw
- Scalar/Vector Test Data Class
xststdcdp xststdcsp xststdcqp
xvtstdcdp xvtstdcsp
- Maximum/Minimum
xsmaxcdp xsmaxjdp
xsmincdp xsminjdp
- Vector Byte-Reverse/Permute/Splat
xxbrd xxbrh xxbrq xxbrw
xxperm xxpermr
xxspltib
30 instructions
Thanks Nemanja for invaluable discussion! Thanks Kit's great help!
Reviewers: hal, nemanja, kbarton, tjablin, amehsan
http://reviews.llvm.org/D16842
llvm-svn: 264567
2016-03-28 16:34:28 +08:00
|
|
|
O << (unsigned int)Value;
|
|
|
|
}
|
|
|
|
|
2015-05-23 00:44:10 +08:00
|
|
|
void PPCInstPrinter::printU10ImmOperand(const MCInst *MI, unsigned OpNo,
|
|
|
|
raw_ostream &O) {
|
|
|
|
unsigned short Value = MI->getOperand(OpNo).getImm();
|
|
|
|
assert(Value <= 1023 && "Invalid u10imm argument!");
|
|
|
|
O << (unsigned short)Value;
|
|
|
|
}
|
|
|
|
|
[PowerPC] Add support for the QPX vector instruction set
This adds support for the QPX vector instruction set, which is used by the
enhanced A2 cores on the IBM BG/Q supercomputers. QPX vectors are 256 bytes
wide, holding 4 double-precision floating-point values. Boolean values, modeled
here as <4 x i1> are actually also represented as floating-point values
(essentially { -1, 1 } for { false, true }). QPX shares many features with
Altivec and VSX, but is distinct from both of them. One major difference is
that, instead of adding completely-separate vector registers, QPX vector
registers are extensions of the scalar floating-point registers (lane 0 is the
corresponding scalar floating-point value). The operations supported on QPX
vectors mirrors that supported on the scalar floating-point values (with some
additional ones for permutations and logical/comparison operations).
I've been maintaining this support out-of-tree, as part of the bgclang project,
for several years. This is not the entire bgclang patch set, but is most of the
subset that can be cleanly integrated into LLVM proper at this time. Adding
this to the LLVM backend is part of my efforts to rebase bgclang to the current
LLVM trunk, but is independently useful (especially for codes that use LLVM as
a JIT in library form).
The assembler/disassembler test coverage is complete. The CodeGen test coverage
is not, but I've included some tests, and more will be added as follow-up work.
llvm-svn: 230413
2015-02-25 09:06:45 +08:00
|
|
|
void PPCInstPrinter::printU12ImmOperand(const MCInst *MI, unsigned OpNo,
|
|
|
|
raw_ostream &O) {
|
|
|
|
unsigned short Value = MI->getOperand(OpNo).getImm();
|
|
|
|
assert(Value <= 4095 && "Invalid u12imm argument!");
|
|
|
|
O << (unsigned short)Value;
|
|
|
|
}
|
|
|
|
|
2010-11-15 04:11:21 +08:00
|
|
|
void PPCInstPrinter::printS16ImmOperand(const MCInst *MI, unsigned OpNo,
|
|
|
|
raw_ostream &O) {
|
2013-05-24 06:26:41 +08:00
|
|
|
if (MI->getOperand(OpNo).isImm())
|
|
|
|
O << (short)MI->getOperand(OpNo).getImm();
|
|
|
|
else
|
|
|
|
printOperand(MI, OpNo, O);
|
2010-11-15 04:11:21 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void PPCInstPrinter::printU16ImmOperand(const MCInst *MI, unsigned OpNo,
|
|
|
|
raw_ostream &O) {
|
2013-06-26 21:49:15 +08:00
|
|
|
if (MI->getOperand(OpNo).isImm())
|
|
|
|
O << (unsigned short)MI->getOperand(OpNo).getImm();
|
|
|
|
else
|
|
|
|
printOperand(MI, OpNo, O);
|
2010-11-15 04:11:21 +08:00
|
|
|
}
|
|
|
|
|
2010-11-15 05:20:46 +08:00
|
|
|
void PPCInstPrinter::printBranchOperand(const MCInst *MI, unsigned OpNo,
|
|
|
|
raw_ostream &O) {
|
|
|
|
if (!MI->getOperand(OpNo).isImm())
|
|
|
|
return printOperand(MI, OpNo, O);
|
|
|
|
|
|
|
|
// Branches can take an immediate operand. This is used by the branch
|
2013-05-04 03:53:04 +08:00
|
|
|
// selection pass to print .+8, an eight byte displacement from the PC.
|
2019-02-13 01:48:22 +08:00
|
|
|
O << ".";
|
2019-02-13 04:03:04 +08:00
|
|
|
int32_t Imm = SignExtend32<32>((unsigned)MI->getOperand(OpNo).getImm() << 2);
|
2019-02-13 01:48:22 +08:00
|
|
|
if (Imm >= 0)
|
|
|
|
O << "+";
|
|
|
|
O << Imm;
|
2010-11-15 05:20:46 +08:00
|
|
|
}
|
|
|
|
|
2013-06-24 19:03:33 +08:00
|
|
|
void PPCInstPrinter::printAbsBranchOperand(const MCInst *MI, unsigned OpNo,
|
|
|
|
raw_ostream &O) {
|
|
|
|
if (!MI->getOperand(OpNo).isImm())
|
|
|
|
return printOperand(MI, OpNo, O);
|
|
|
|
|
2014-09-03 01:38:34 +08:00
|
|
|
O << SignExtend32<32>((unsigned)MI->getOperand(OpNo).getImm() << 2);
|
2010-11-15 05:51:37 +08:00
|
|
|
}
|
2010-11-15 05:20:46 +08:00
|
|
|
|
|
|
|
|
2010-11-15 04:22:56 +08:00
|
|
|
void PPCInstPrinter::printcrbitm(const MCInst *MI, unsigned OpNo,
|
|
|
|
raw_ostream &O) {
|
|
|
|
unsigned CCReg = MI->getOperand(OpNo).getReg();
|
|
|
|
unsigned RegNo;
|
|
|
|
switch (CCReg) {
|
2012-02-07 10:50:20 +08:00
|
|
|
default: llvm_unreachable("Unknown CR register");
|
2010-11-15 04:22:56 +08:00
|
|
|
case PPC::CR0: RegNo = 0; break;
|
|
|
|
case PPC::CR1: RegNo = 1; break;
|
|
|
|
case PPC::CR2: RegNo = 2; break;
|
|
|
|
case PPC::CR3: RegNo = 3; break;
|
|
|
|
case PPC::CR4: RegNo = 4; break;
|
|
|
|
case PPC::CR5: RegNo = 5; break;
|
|
|
|
case PPC::CR6: RegNo = 6; break;
|
|
|
|
case PPC::CR7: RegNo = 7; break;
|
|
|
|
}
|
|
|
|
O << (0x80 >> RegNo);
|
|
|
|
}
|
|
|
|
|
|
|
|
void PPCInstPrinter::printMemRegImm(const MCInst *MI, unsigned OpNo,
|
|
|
|
raw_ostream &O) {
|
2013-05-24 06:26:41 +08:00
|
|
|
printS16ImmOperand(MI, OpNo, O);
|
2010-11-15 04:22:56 +08:00
|
|
|
O << '(';
|
2010-11-15 11:51:13 +08:00
|
|
|
if (MI->getOperand(OpNo+1).getReg() == PPC::R0)
|
2010-11-15 04:22:56 +08:00
|
|
|
O << "0";
|
|
|
|
else
|
|
|
|
printOperand(MI, OpNo+1, O);
|
|
|
|
O << ')';
|
|
|
|
}
|
|
|
|
|
|
|
|
void PPCInstPrinter::printMemRegReg(const MCInst *MI, unsigned OpNo,
|
|
|
|
raw_ostream &O) {
|
|
|
|
// When used as the base register, r0 reads constant zero rather than
|
|
|
|
// the value contained in the register. For this reason, the darwin
|
|
|
|
// assembler requires that we print r0 as 0 (no r) when used as the base.
|
|
|
|
if (MI->getOperand(OpNo).getReg() == PPC::R0)
|
|
|
|
O << "0";
|
|
|
|
else
|
|
|
|
printOperand(MI, OpNo, O);
|
|
|
|
O << ", ";
|
|
|
|
printOperand(MI, OpNo+1, O);
|
|
|
|
}
|
|
|
|
|
2013-07-03 05:31:04 +08:00
|
|
|
void PPCInstPrinter::printTLSCall(const MCInst *MI, unsigned OpNo,
|
|
|
|
raw_ostream &O) {
|
2014-07-26 01:47:22 +08:00
|
|
|
// On PPC64, VariantKind is VK_None, but on PPC32, it's VK_PLT, and it must
|
|
|
|
// come at the _end_ of the expression.
|
|
|
|
const MCOperand &Op = MI->getOperand(OpNo);
|
2019-03-06 23:00:10 +08:00
|
|
|
const MCSymbolRefExpr *RefExp = nullptr;
|
|
|
|
const MCConstantExpr *ConstExp = nullptr;
|
|
|
|
if (const MCBinaryExpr *BinExpr = dyn_cast<MCBinaryExpr>(Op.getExpr())) {
|
|
|
|
RefExp = cast<MCSymbolRefExpr>(BinExpr->getLHS());
|
|
|
|
ConstExp = cast<MCConstantExpr>(BinExpr->getRHS());
|
|
|
|
} else
|
|
|
|
RefExp = cast<MCSymbolRefExpr>(Op.getExpr());
|
|
|
|
|
|
|
|
O << RefExp->getSymbol().getName();
|
2013-07-03 05:31:04 +08:00
|
|
|
O << '(';
|
|
|
|
printOperand(MI, OpNo+1, O);
|
|
|
|
O << ')';
|
2019-03-06 23:00:10 +08:00
|
|
|
if (RefExp->getKind() != MCSymbolRefExpr::VK_None)
|
|
|
|
O << '@' << MCSymbolRefExpr::getVariantKindName(RefExp->getKind());
|
|
|
|
if (ConstExp != nullptr)
|
|
|
|
O << '+' << ConstExp->getValue();
|
2013-07-03 05:31:04 +08:00
|
|
|
}
|
2010-11-15 04:22:56 +08:00
|
|
|
|
2017-11-30 07:05:56 +08:00
|
|
|
/// showRegistersWithPercentPrefix - Check if this register name should be
|
|
|
|
/// printed with a percentage symbol as prefix.
|
|
|
|
bool PPCInstPrinter::showRegistersWithPercentPrefix(const char *RegName) const {
|
|
|
|
if (!FullRegNamesWithPercent || TT.isOSDarwin() || TT.getOS() == Triple::AIX)
|
|
|
|
return false;
|
2010-11-15 04:11:21 +08:00
|
|
|
|
2017-11-30 07:05:56 +08:00
|
|
|
switch (RegName[0]) {
|
|
|
|
default:
|
|
|
|
return false;
|
|
|
|
case 'r':
|
|
|
|
case 'f':
|
|
|
|
case 'q':
|
|
|
|
case 'v':
|
|
|
|
case 'c':
|
|
|
|
return true;
|
2017-07-26 02:26:35 +08:00
|
|
|
}
|
2017-11-30 07:05:56 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/// getVerboseConditionalRegName - This method expands the condition register
|
|
|
|
/// when requested explicitly or targetting Darwin.
|
|
|
|
const char *PPCInstPrinter::getVerboseConditionRegName(unsigned RegNum,
|
|
|
|
unsigned RegEncoding)
|
|
|
|
const {
|
|
|
|
if (!TT.isOSDarwin() && !FullRegNames)
|
|
|
|
return nullptr;
|
|
|
|
if (RegNum < PPC::CR0EQ || RegNum > PPC::CR7UN)
|
|
|
|
return nullptr;
|
|
|
|
const char *CRBits[] = {
|
|
|
|
"lt", "gt", "eq", "un",
|
|
|
|
"4*cr1+lt", "4*cr1+gt", "4*cr1+eq", "4*cr1+un",
|
|
|
|
"4*cr2+lt", "4*cr2+gt", "4*cr2+eq", "4*cr2+un",
|
|
|
|
"4*cr3+lt", "4*cr3+gt", "4*cr3+eq", "4*cr3+un",
|
|
|
|
"4*cr4+lt", "4*cr4+gt", "4*cr4+eq", "4*cr4+un",
|
|
|
|
"4*cr5+lt", "4*cr5+gt", "4*cr5+eq", "4*cr5+un",
|
|
|
|
"4*cr6+lt", "4*cr6+gt", "4*cr6+eq", "4*cr6+un",
|
|
|
|
"4*cr7+lt", "4*cr7+gt", "4*cr7+eq", "4*cr7+un"
|
|
|
|
};
|
|
|
|
return CRBits[RegEncoding];
|
|
|
|
}
|
2013-11-11 22:58:40 +08:00
|
|
|
|
2017-11-30 07:05:56 +08:00
|
|
|
// showRegistersWithPrefix - This method determines whether registers
|
|
|
|
// should be number-only or include the prefix.
|
|
|
|
bool PPCInstPrinter::showRegistersWithPrefix() const {
|
|
|
|
if (TT.getOS() == Triple::AIX)
|
|
|
|
return false;
|
|
|
|
return TT.isOSDarwin() || FullRegNamesWithPercent || FullRegNames;
|
|
|
|
}
|
|
|
|
|
2010-11-15 04:02:39 +08:00
|
|
|
void PPCInstPrinter::printOperand(const MCInst *MI, unsigned OpNo,
|
|
|
|
raw_ostream &O) {
|
|
|
|
const MCOperand &Op = MI->getOperand(OpNo);
|
|
|
|
if (Op.isReg()) {
|
2016-10-04 14:59:23 +08:00
|
|
|
unsigned Reg = Op.getReg();
|
2018-09-27 19:49:47 +08:00
|
|
|
if (!ShowVSRNumsAsVR)
|
|
|
|
Reg = PPCInstrInfo::getRegNumForOperand(MII.get(MI->getOpcode()),
|
|
|
|
Reg, OpNo);
|
2016-10-04 14:59:23 +08:00
|
|
|
|
2017-11-30 07:05:56 +08:00
|
|
|
const char *RegName;
|
|
|
|
RegName = getVerboseConditionRegName(Reg, MRI.getEncodingValue(Reg));
|
|
|
|
if (RegName == nullptr)
|
|
|
|
RegName = getRegisterName(Reg);
|
|
|
|
if (showRegistersWithPercentPrefix(RegName))
|
|
|
|
O << "%";
|
|
|
|
if (!showRegistersWithPrefix())
|
2018-09-27 19:49:47 +08:00
|
|
|
RegName = PPCRegisterInfo::stripRegisterPrefix(RegName);
|
2017-07-26 02:26:35 +08:00
|
|
|
|
2010-11-15 04:02:39 +08:00
|
|
|
O << RegName;
|
|
|
|
return;
|
|
|
|
}
|
2017-07-26 02:26:35 +08:00
|
|
|
|
2010-11-15 04:02:39 +08:00
|
|
|
if (Op.isImm()) {
|
|
|
|
O << Op.getImm();
|
|
|
|
return;
|
|
|
|
}
|
2017-07-26 02:26:35 +08:00
|
|
|
|
2010-11-15 04:02:39 +08:00
|
|
|
assert(Op.isExpr() && "unknown operand kind in printOperand");
|
2015-06-09 08:31:39 +08:00
|
|
|
Op.getExpr()->print(O, &MAI);
|
2010-11-15 04:02:39 +08:00
|
|
|
}
|
2010-11-15 05:54:34 +08:00
|
|
|
|