ARM: Define generic HINT instruction.

The NOP, WFE, WFI, SEV and YIELD instructions are all hints w/
a different immediate value in bits [7,0]. Define a generic HINT
instruction and refactor NOP, WFI, WFI, SEV and YIELD to be
assembly aliases of that.

rdar://11600518

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158674 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Jim Grosbach
2012-06-18 19:45:50 +00:00
parent 325bd661ff
commit 7e99a60857
6 changed files with 77 additions and 55 deletions
@@ -52,6 +52,27 @@ void ARMInstPrinter::printInst(const MCInst *MI, raw_ostream &O,
StringRef Annot) {
unsigned Opcode = MI->getOpcode();
// Check for HINT instructions w/ canonical names.
if (Opcode == ARM::HINT || Opcode == ARM::t2HINT) {
switch (MI->getOperand(0).getImm()) {
case 0: O << "\tnop"; break;
case 1: O << "\tyield"; break;
case 2: O << "\twfe"; break;
case 3: O << "\twfi"; break;
case 4: O << "\tsev"; break;
default:
// Anything else should just print normally.
printInstruction(MI, O);
printAnnotation(O, Annot);
return;
}
printPredicateOperand(MI, 1, O);
if (Opcode == ARM::t2HINT)
O << ".w";
printAnnotation(O, Annot);
return;
}
// Check for MOVs and print canonical forms, instead.
if (Opcode == ARM::MOVsr) {
// FIXME: Thumb variants?