29 #define DEBUG_TYPE "asm-printer"
35 cl::desc(
"Use full register names when printing assembly"));
40 cl::desc(
"Prints full register names with vs{31-63} as v{0-31}"));
42 #define PRINT_ALIAS_INSTR
43 #include "PPCGenAsmWriter.inc"
47 if (RegName[0] ==
'q' ) {
51 std::string
RN(RegName);
69 bool useSubstituteMnemonic =
false;
70 if (SH <= 31 && MB == 0 && ME == (31-SH)) {
71 O <<
"\tslwi "; useSubstituteMnemonic =
true;
73 if (SH <= 31 && MB == (32-SH) && ME == 31) {
74 O <<
"\tsrwi "; useSubstituteMnemonic =
true;
77 if (useSubstituteMnemonic) {
81 O <<
", " << (
unsigned int)SH;
107 O <<
", " << (
unsigned int)SH;
131 if (IsBookE && TH != 0 && TH != 16)
132 O << (
unsigned int) TH <<
", ";
138 if (!IsBookE && TH != 0 && TH != 16)
139 O <<
", " << (
unsigned int) TH;
147 if (!L || L == 1 || L == 3) {
149 if (L == 1 || L == 3)
172 const char *Modifier) {
263 "Need to specify 'cc', 'pm' or 'reg' as predicate op modifier!");
279 assert(Value <= 1 &&
"Invalid u1imm argument!");
280 O << (
unsigned int)Value;
286 assert(Value <= 3 &&
"Invalid u2imm argument!");
287 O << (
unsigned int)Value;
293 assert(Value <= 8 &&
"Invalid u3imm argument!");
294 O << (
unsigned int)Value;
300 assert(Value <= 15 &&
"Invalid u4imm argument!");
301 O << (
unsigned int)Value;
307 Value = SignExtend32<5>(Value);
314 assert(Value <= 31 &&
"Invalid u5imm argument!");
315 O << (
unsigned int)Value;
321 assert(Value <= 63 &&
"Invalid u6imm argument!");
322 O << (
unsigned int)Value;
328 assert(Value <= 127 &&
"Invalid u7imm argument!");
329 O << (
unsigned int)Value;
338 O << (
unsigned int)Value;
344 assert(Value <= 1023 &&
"Invalid u10imm argument!");
345 O << (
unsigned short)Value;
351 assert(Value <= 4095 &&
"Invalid u12imm argument!");
352 O << (
unsigned short)Value;
397 case PPC::CR0: RegNo = 0;
break;
398 case PPC::CR1: RegNo = 1;
break;
399 case PPC::CR2: RegNo = 2;
break;
400 case PPC::CR3: RegNo = 3;
break;
401 case PPC::CR4: RegNo = 4;
break;
402 case PPC::CR5: RegNo = 5;
break;
403 case PPC::CR6: RegNo = 6;
break;
404 case PPC::CR7: RegNo = 7;
break;
406 O << (0x80 >> RegNo);
454 switch (RegName[0]) {
459 if (RegName[1] ==
's')
462 case 'c':
if (RegName[1] ==
'r')
return RegName + 2;
484 Reg = PPC::VSX32 + (Reg - PPC::V0);
486 Reg = PPC::VSX32 + (Reg - PPC::VF0);
503 assert(Op.
isExpr() &&
"unknown operand kind in printOperand");
void printS16ImmOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O)
void printU2ImmOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O)
void printATBitsAsHint(const MCInst *MI, unsigned OpNo, raw_ostream &O)
const MCSymbol & getSymbol() const
void printS5ImmOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O)
void printU4ImmOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O)
void printU16ImmOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O)
void printRegName(raw_ostream &OS, unsigned RegNo) const override
Print the assembler register name.
bool isDarwinSyntax() const
void printcrbitm(const MCInst *MI, unsigned OpNo, raw_ostream &O)
static bool isVRRegister(unsigned Reg)
void printU1ImmOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O)
Reg
All possible values of the reg field in the ModR/M byte.
Represent a reference to a symbol from inside an expression.
unsigned getReg() const
Returns the register number.
void printU12ImmOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O)
void printAbsBranchOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O)
void printInst(const MCInst *MI, raw_ostream &O, StringRef Annot, const MCSubtargetInfo &STI) override
Print the specified MCInst to the specified raw_ostream.
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}"))
Instances of this class represent a single low-level machine instruction.
const MCExpr * getExpr() const
initializer< Ty > init(const Ty &Val)
The VSX instruction that uses VSX register (vs0-vs63), instead of VMX register (v0-v31).
static ManagedStatic< OptionRegistry > OR
static const char * getRegisterName(unsigned RegNo)
void printMemRegImm(const MCInst *MI, unsigned OpNo, raw_ostream &O)
void printU3ImmOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O)
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
const MCInstrDesc & get(unsigned Opcode) const
Return the machine instruction descriptor that corresponds to the specified instruction opcode...
void printMemRegReg(const MCInst *MI, unsigned OpNo, raw_ostream &O)
void printOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O)
void printBranchOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O)
void printPredicateOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O, const char *Modifier=nullptr)
static const char * stripRegisterPrefix(const char *RegName)
stripRegisterPrefix - This method strips the character prefix from a register name so that only the n...
Predicate
Predicate - These are "(BI << 5) | BO" for various predicates.
const FeatureBitset & getFeatureBits() const
getFeatureBits - Return the feature bits.
static bool isVFRegister(unsigned Reg)
void printU8ImmOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O)
unsigned getOpcode() const
void printTLSCall(const MCInst *MI, unsigned OpNo, raw_ostream &O)
void printU6ImmOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O)
bool printAliasInstr(const MCInst *MI, raw_ostream &OS)
void printInstruction(const MCInst *MI, raw_ostream &O)
StringRef getName() const
getName - Get the symbol name.
static cl::opt< bool > FullRegNames("ppc-asm-full-reg-names", cl::Hidden, cl::init(false), cl::desc("Use full register names when printing assembly"))
MCSubtargetInfo - Generic base class for all target subtargets.
void printU10ImmOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O)
void print(raw_ostream &OS, const MCAsmInfo *MAI, bool InParens=false) const
VariantKind getKind() const
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
void printU7ImmOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O)
LLVM Value Representation.
void printAnnotation(raw_ostream &OS, StringRef Annot)
Utility function for printing annotations.
This class implements an extremely fast bulk output stream that can only output to a stream...
StringRef - Represent a constant reference to a string, i.e.
Instances of this class represent operands of the MCInst class.
static StringRef getVariantKindName(VariantKind Kind)
const MCOperand & getOperand(unsigned i) const
void printU5ImmOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O)