14 #define DEBUG_TYPE "asm-printer"
30 cl::desc(
"Use full register names when printing assembly"));
32 #include "PPCGenAsmWriter.inc"
45 bool useSubstituteMnemonic =
false;
46 if (SH <= 31 && MB == 0 && ME == (31-SH)) {
47 O <<
"\tslwi "; useSubstituteMnemonic =
true;
49 if (SH <= 31 && MB == (32-SH) && ME == 31) {
50 O <<
"\tsrwi "; useSubstituteMnemonic =
true;
53 if (useSubstituteMnemonic) {
57 O <<
", " << (
unsigned int)SH;
83 O <<
", " << (
unsigned int)SH;
107 const char *Modifier) {
192 "Need to specify 'cc', 'pm' or 'reg' as predicate op modifier!");
199 Value = SignExtend32<5>(Value);
206 assert(Value <= 31 &&
"Invalid u5imm argument!");
207 O << (
unsigned int)Value;
213 assert(Value <= 63 &&
"Invalid u6imm argument!");
214 O << (
unsigned int)Value;
259 case PPC::CR0: RegNo = 0;
break;
260 case PPC::CR1: RegNo = 1;
break;
261 case PPC::CR2: RegNo = 2;
break;
262 case PPC::CR3: RegNo = 3;
break;
263 case PPC::CR4: RegNo = 4;
break;
264 case PPC::CR5: RegNo = 5;
break;
265 case PPC::CR6: RegNo = 6;
break;
266 case PPC::CR7: RegNo = 7;
break;
268 O << (0x80 >> RegNo);
310 switch (RegName[0]) {
313 case 'v':
return RegName + 1;
314 case 'c':
if (RegName[1] ==
'r')
return RegName + 2;
338 assert(Op.
isExpr() &&
"unknown operand kind in printOperand");
void printS16ImmOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O)
void printS5ImmOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O)
void printU16ImmOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O)
bool isDarwinSyntax() const
void printcrbitm(const MCInst *MI, unsigned OpNo, raw_ostream &O)
#define llvm_unreachable(msg)
void printPredicateOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O, const char *Modifier=0)
virtual void printRegName(raw_ostream &OS, unsigned RegNo) const
printRegName - Print the assembler register name.
unsigned getReg() const
getReg - Returns the register number.
void printAbsBranchOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O)
const MCExpr * getExpr() const
initializer< Ty > init(const Ty &Val)
static const char * getRegisterName(unsigned RegNo)
void printMemRegImm(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)
static const char * stripRegisterPrefix(const char *RegName)
Predicate
Predicate - These are "(BI << 5) | BO" for various predicates.
unsigned getOpcode() const
void printTLSCall(const MCInst *MI, unsigned OpNo, raw_ostream &O)
void printU6ImmOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O)
void printInstruction(const MCInst *MI, raw_ostream &O)
static cl::opt< bool > FullRegNames("ppc-asm-full-reg-names", cl::Hidden, cl::init(false), cl::desc("Use full register names when printing assembly"))
LLVM Value Representation.
void printAnnotation(raw_ostream &OS, StringRef Annot)
Utility function for printing annotations.
const MCOperand & getOperand(unsigned i) const
virtual void printInst(const MCInst *MI, raw_ostream &O, StringRef Annot)
void printU5ImmOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O)