// Check for legal use of solo insns.
bool HexagonMCChecker::checkSolo() {
- if (HexagonMCInstrInfo::isBundle(MCB) &&
- HexagonMCInstrInfo::bundleSize(MCB) > 1) {
+ if (HexagonMCInstrInfo::bundleSize(MCB) > 1)
for (auto const &I : HexagonMCInstrInfo::bundleInstructions(MCB)) {
if (llvm::HexagonMCInstrInfo::isSolo(MCII, *I.getInst())) {
- reportError(
- "instruction cannot appear in packet with other instructions");
+ SMLoc Loc = I.getInst()->getLoc();
+ reportError(Loc, "Instruction is marked `isSolo' and "
+ "cannot have other instructions in "
+ "the same packet");
return false;
}
}
- }
return true;
}
}
void HexagonMCChecker::reportError(llvm::Twine const &Msg) {
+ reportError(MCB.getLoc(), Msg);
+}
+
+void HexagonMCChecker::reportError(SMLoc Loc, llvm::Twine const &Msg) {
if (ReportErrors)
- Context.reportError(MCB.getLoc(), Msg);
+ Context.reportError(Loc, Msg);
}
void HexagonMCChecker::reportWarning(llvm::Twine const &Msg) {
bool checkSolo();
bool checkShuffle();
bool checkSlots();
- bool checkSize();
static void compoundRegisterMap(unsigned &);
bool check(bool FullCheck = true);
void reportErrorRegisters(unsigned Register);
void reportErrorNewValue(unsigned Register);
+ void reportError(SMLoc Loc, llvm::Twine const &Msg);
void reportError(llvm::Twine const &Msg);
void reportWarning(llvm::Twine const &Msg);
};
--- /dev/null
+# RUN: not llvm-mc -arch=hexagon -filetype=asm %s 2> %t; FileCheck %s < %t
+#
+
+{
+ if (!p0) r0=r1;
+ if (!p0) r0=r2;
+ trap0(#15);
+}
+# CHECK: error: register `R0' modified more than once
+# CHECK: error: Instruction is marked `isSolo' and cannot have other instructions in the same packet