std::pair<const char *, uint64_t> SystemZInstPrinter::getMnemonic(const MCInst *MI) { … }
LLVM_NO_PROFILE_INSTRUMENT_FUNCTION
void SystemZInstPrinter::printInstruction(const MCInst *MI, uint64_t Address, raw_ostream &O) { … }
const char *SystemZInstPrinter::getRegisterName(MCRegister Reg) { … }
#ifdef PRINT_ALIAS_INSTR
#undef PRINT_ALIAS_INSTR
bool SystemZInstPrinter::printAliasInstr(const MCInst *MI, uint64_t Address, raw_ostream &OS) {
static const PatternsForOpcode OpToPatterns[] = {
{SystemZ::IILF, 0, 1 },
{SystemZ::LLILF, 1, 1 },
{SystemZ::LLILL, 2, 1 },
{SystemZ::VFAE, 3, 1 },
{SystemZ::VFAEB, 4, 1 },
{SystemZ::VFAEBS, 5, 1 },
{SystemZ::VFAEF, 6, 1 },
{SystemZ::VFAEFS, 7, 1 },
{SystemZ::VFAEH, 8, 1 },
{SystemZ::VFAEHS, 9, 1 },
{SystemZ::VFAEZB, 10, 1 },
{SystemZ::VFAEZBS, 11, 1 },
{SystemZ::VFAEZF, 12, 1 },
{SystemZ::VFAEZFS, 13, 1 },
{SystemZ::VFAEZH, 14, 1 },
{SystemZ::VFAEZHS, 15, 1 },
{SystemZ::VFEE, 16, 1 },
{SystemZ::VFEEB, 17, 1 },
{SystemZ::VFEEF, 18, 1 },
{SystemZ::VFEEH, 19, 1 },
{SystemZ::VFENE, 20, 1 },
{SystemZ::VFENEB, 21, 1 },
{SystemZ::VFENEF, 22, 1 },
{SystemZ::VFENEH, 23, 1 },
{SystemZ::VISTR, 24, 1 },
{SystemZ::VISTRB, 25, 1 },
{SystemZ::VISTRF, 26, 1 },
{SystemZ::VISTRH, 27, 1 },
{SystemZ::VSTRC, 28, 1 },
{SystemZ::VSTRCB, 29, 1 },
{SystemZ::VSTRCBS, 30, 1 },
{SystemZ::VSTRCF, 31, 1 },
{SystemZ::VSTRCFS, 32, 1 },
{SystemZ::VSTRCH, 33, 1 },
{SystemZ::VSTRCHS, 34, 1 },
{SystemZ::VSTRCZB, 35, 1 },
{SystemZ::VSTRCZBS, 36, 1 },
{SystemZ::VSTRCZF, 37, 1 },
{SystemZ::VSTRCZFS, 38, 1 },
{SystemZ::VSTRCZH, 39, 1 },
{SystemZ::VSTRCZHS, 40, 1 },
{SystemZ::VSTRS, 41, 1 },
{SystemZ::VSTRSB, 42, 1 },
{SystemZ::VSTRSF, 43, 1 },
{SystemZ::VSTRSH, 44, 1 },
};
static const AliasPattern Patterns[] = {
{0, 0, 2, 1 },
{13, 1, 2, 1 },
{28, 2, 2, 1 },
{43, 3, 5, 5 },
{65, 8, 4, 4 },
{82, 12, 4, 4 },
{100, 16, 4, 4 },
{117, 20, 4, 4 },
{135, 24, 4, 4 },
{152, 28, 4, 4 },
{170, 32, 4, 4 },
{188, 36, 4, 4 },
{207, 40, 4, 4 },
{225, 44, 4, 4 },
{244, 48, 4, 4 },
{262, 52, 4, 4 },
{281, 56, 5, 5 },
{303, 61, 4, 4 },
{320, 65, 4, 4 },
{337, 69, 4, 4 },
{354, 73, 5, 5 },
{377, 78, 4, 4 },
{395, 82, 4, 4 },
{413, 86, 4, 4 },
{431, 90, 4, 4 },
{450, 94, 3, 3 },
{464, 97, 3, 3 },
{478, 100, 3, 3 },
{492, 103, 6, 6 },
{519, 109, 5, 5 },
{541, 114, 5, 5 },
{564, 119, 5, 5 },
{586, 124, 5, 5 },
{609, 129, 5, 5 },
{631, 134, 5, 5 },
{654, 139, 5, 5 },
{677, 144, 5, 5 },
{701, 149, 5, 5 },
{724, 154, 5, 5 },
{748, 159, 5, 5 },
{771, 164, 5, 5 },
{795, 169, 6, 6 },
{822, 175, 5, 5 },
{844, 180, 5, 5 },
{866, 185, 5, 5 },
};
static const AliasPatternCond Conds[] = {
{AliasPatternCond::K_RegClass, SystemZ::GR32BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::GR64BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::GR64BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_Ignore, 0},
{AliasPatternCond::K_Imm, uint32_t(0)},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_Imm, uint32_t(0)},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_Imm, uint32_t(0)},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_Imm, uint32_t(0)},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_Imm, uint32_t(0)},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_Imm, uint32_t(0)},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_Imm, uint32_t(0)},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_Imm, uint32_t(0)},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_Imm, uint32_t(0)},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_Imm, uint32_t(0)},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_Imm, uint32_t(0)},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_Imm, uint32_t(0)},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_Imm, uint32_t(0)},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_Ignore, 0},
{AliasPatternCond::K_Imm, uint32_t(0)},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_Imm, uint32_t(0)},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_Imm, uint32_t(0)},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_Imm, uint32_t(0)},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_Ignore, 0},
{AliasPatternCond::K_Imm, uint32_t(0)},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_Imm, uint32_t(0)},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_Imm, uint32_t(0)},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_Imm, uint32_t(0)},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_Ignore, 0},
{AliasPatternCond::K_Imm, uint32_t(0)},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_Imm, uint32_t(0)},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_Imm, uint32_t(0)},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_Imm, uint32_t(0)},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_Ignore, 0},
{AliasPatternCond::K_Imm, uint32_t(0)},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_Imm, uint32_t(0)},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_Imm, uint32_t(0)},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_Imm, uint32_t(0)},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_Imm, uint32_t(0)},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_Imm, uint32_t(0)},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_Imm, uint32_t(0)},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_Imm, uint32_t(0)},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_Imm, uint32_t(0)},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_Imm, uint32_t(0)},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_Imm, uint32_t(0)},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_Imm, uint32_t(0)},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_Imm, uint32_t(0)},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_Ignore, 0},
{AliasPatternCond::K_Imm, uint32_t(0)},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_Imm, uint32_t(0)},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_Imm, uint32_t(0)},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_RegClass, SystemZ::VR128BitRegClassID},
{AliasPatternCond::K_Imm, uint32_t(0)},
};
static const char AsmStrings[] =
"lfi $\x01, $\xFF\x02\x01\0"
"llgfi $\x01, $\xFF\x02\x01\0"
"llghi $\x01, $\xFF\x02\x02\0"
"vfae $\x01, $\x02, $\x03, $\xFF\x04\x03\0"
"vfaeb $\x01, $\x02, $\x03\0"
"vfaebs $\x01, $\x02, $\x03\0"
"vfaef $\x01, $\x02, $\x03\0"
"vfaefs $\x01, $\x02, $\x03\0"
"vfaeh $\x01, $\x02, $\x03\0"
"vfaehs $\x01, $\x02, $\x03\0"
"vfaezb $\x01, $\x02, $\x03\0"
"vfaezbs $\x01, $\x02, $\x03\0"
"vfaezf $\x01, $\x02, $\x03\0"
"vfaezfs $\x01, $\x02, $\x03\0"
"vfaezh $\x01, $\x02, $\x03\0"
"vfaezhs $\x01, $\x02, $\x03\0"
"vfee $\x01, $\x02, $\x03, $\xFF\x04\x03\0"
"vfeeb $\x01, $\x02, $\x03\0"
"vfeef $\x01, $\x02, $\x03\0"
"vfeeh $\x01, $\x02, $\x03\0"
"vfene $\x01, $\x02, $\x03, $\xFF\x04\x03\0"
"vfeneb $\x01, $\x02, $\x03\0"
"vfenef $\x01, $\x02, $\x03\0"
"vfeneh $\x01, $\x02, $\x03\0"
"vistr $\x01, $\x02, $\xFF\x03\x03\0"
"vistrb $\x01, $\x02\0"
"vistrf $\x01, $\x02\0"
"vistrh $\x01, $\x02\0"
"vstrc $\x01, $\x02, $\x03, $\x04, $\xFF\x05\x03\0"
"vstrcb $\x01, $\x02, $\x03, $\x04\0"
"vstrcbs $\x01, $\x02, $\x03, $\x04\0"
"vstrcf $\x01, $\x02, $\x03, $\x04\0"
"vstrcfs $\x01, $\x02, $\x03, $\x04\0"
"vstrch $\x01, $\x02, $\x03, $\x04\0"
"vstrchs $\x01, $\x02, $\x03, $\x04\0"
"vstrczb $\x01, $\x02, $\x03, $\x04\0"
"vstrczbs $\x01, $\x02, $\x03, $\x04\0"
"vstrczf $\x01, $\x02, $\x03, $\x04\0"
"vstrczfs $\x01, $\x02, $\x03, $\x04\0"
"vstrczh $\x01, $\x02, $\x03, $\x04\0"
"vstrczhs $\x01, $\x02, $\x03, $\x04\0"
"vstrs $\x01, $\x02, $\x03, $\x04, $\xFF\x05\x03\0"
"vstrsb $\x01, $\x02, $\x03, $\x04\0"
"vstrsf $\x01, $\x02, $\x03, $\x04\0"
"vstrsh $\x01, $\x02, $\x03, $\x04\0"
;
#ifndef NDEBUG
static struct SortCheck {
SortCheck(ArrayRef<PatternsForOpcode> OpToPatterns) {
assert(std::is_sorted(
OpToPatterns.begin(), OpToPatterns.end(),
[](const PatternsForOpcode &L, const PatternsForOpcode &R) {
return L.Opcode < R.Opcode;
}) &&
"tablegen failed to sort opcode patterns");
}
} sortCheckVar(OpToPatterns);
#endif
AliasMatchingData M {
ArrayRef(OpToPatterns),
ArrayRef(Patterns),
ArrayRef(Conds),
StringRef(AsmStrings, std::size(AsmStrings)),
nullptr,
};
const char *AsmString = matchAliasPatterns(MI, nullptr, M);
if (!AsmString) return false;
unsigned I = 0;
while (AsmString[I] != ' ' && AsmString[I] != '\t' &&
AsmString[I] != '$' && AsmString[I] != '\0')
++I;
OS << '\t' << StringRef(AsmString, I);
if (AsmString[I] != '\0') {
if (AsmString[I] == ' ' || AsmString[I] == '\t') {
OS << '\t';
++I;
}
do {
if (AsmString[I] == '$') {
++I;
if (AsmString[I] == (char)0xff) {
++I;
int OpIdx = AsmString[I++] - 1;
int PrintMethodIdx = AsmString[I++] - 1;
printCustomAliasOperand(MI, Address, OpIdx, PrintMethodIdx, OS);
} else
printOperand(MI, unsigned(AsmString[I++]) - 1, OS);
} else {
OS << AsmString[I++];
}
} while (AsmString[I] != '\0');
}
return true;
}
void SystemZInstPrinter::printCustomAliasOperand(
const MCInst *MI, uint64_t Address, unsigned OpIdx,
unsigned PrintMethodIdx,
raw_ostream &OS) {
switch (PrintMethodIdx) {
default:
llvm_unreachable("Unknown PrintMethod kind");
break;
case 0:
printU32ImmOperand(MI, OpIdx, OS);
break;
case 1:
printU16ImmOperand(MI, OpIdx, OS);
break;
case 2:
printU4ImmOperand(MI, OpIdx, OS);
break;
}
}
#endif