28 #define DEBUG_TYPE "asm-printer"
34 cl::desc(
"Use full register names when printing assembly"));
36 #define PRINT_ALIAS_INSTR
37 #include "PPCGenAsmWriter.inc"
41 if (RegName[0] ==
'q' ) {
45 std::string
RN(RegName);
63 bool useSubstituteMnemonic =
false;
64 if (SH <= 31 && MB == 0 && ME == (31-SH)) {
65 O <<
"\tslwi "; useSubstituteMnemonic =
true;
67 if (SH <= 31 && MB == (32-SH) && ME == 31) {
68 O <<
"\tsrwi "; useSubstituteMnemonic =
true;
71 if (useSubstituteMnemonic) {
75 O <<
", " << (
unsigned int)SH;
101 O <<
", " << (
unsigned int)SH;
125 if (IsBookE && TH != 0 && TH != 16)
126 O << (
unsigned int) TH <<
", ";
132 if (!IsBookE && TH != 0 && TH != 16)
133 O <<
", " << (
unsigned int) TH;
158 const char *Modifier) {
249 "Need to specify 'cc', 'pm' or 'reg' as predicate op modifier!");
256 assert(Value <= 1 &&
"Invalid u1imm argument!");
257 O << (
unsigned int)Value;
263 assert(Value <= 3 &&
"Invalid u2imm argument!");
264 O << (
unsigned int)Value;
270 assert(Value <= 8 &&
"Invalid u3imm argument!");
271 O << (
unsigned int)Value;
277 assert(Value <= 15 &&
"Invalid u4imm argument!");
278 O << (
unsigned int)Value;
284 Value = SignExtend32<5>(Value);
291 assert(Value <= 31 &&
"Invalid u5imm argument!");
292 O << (
unsigned int)Value;
298 assert(Value <= 63 &&
"Invalid u6imm argument!");
299 O << (
unsigned int)Value;
305 assert(Value <= 1023 &&
"Invalid u10imm argument!");
306 O << (
unsigned short)Value;
312 assert(Value <= 4095 &&
"Invalid u12imm argument!");
313 O << (
unsigned short)Value;
358 case PPC::CR0: RegNo = 0;
break;
359 case PPC::CR1: RegNo = 1;
break;
360 case PPC::CR2: RegNo = 2;
break;
361 case PPC::CR3: RegNo = 3;
break;
362 case PPC::CR4: RegNo = 4;
break;
363 case PPC::CR5: RegNo = 5;
break;
364 case PPC::CR6: RegNo = 6;
break;
365 case PPC::CR7: RegNo = 7;
break;
367 O << (0x80 >> RegNo);
415 switch (RegName[0]) {
420 if (RegName[1] ==
's')
423 case 'c':
if (RegName[1] ==
'r')
return RegName + 2;
447 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)
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)
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
void printU1ImmOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O)
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.
Instances of this class represent a single low-level machine instruction.
const MCExpr * getExpr() const
initializer< Ty > init(const Ty &Val)
void print(raw_ostream &OS, const MCAsmInfo *MAI) const
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)
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.
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"))
COPY_TO_REGCLASS - This instruction is a placeholder for a plain register-to-register copy into a spe...
MCSubtargetInfo - Generic base class for all target subtargets.
void printU10ImmOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O)
VariantKind getKind() const
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)