[llvm] Add diagnostic help for inline asm operand constraint 'H' (PR #88248)

Jessica Clarke via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 10 11:16:02 PDT 2024


================
@@ -692,13 +692,32 @@ static bool printAsmVRegister(const MachineOperand &MO, char Mode,
   return false;
 }
 
+void X86AsmPrinter::diagnoseAsmOperandError(LLVMContext &C,
+                                            const AsmOperandErrorCode EC,
+                                            const char *AsmStr, uint64_t Loc) {
+  AsmPrinter::diagnoseAsmOperandError(C, EC, AsmStr, Loc);
+  std::string msg;
+  raw_string_ostream Msg(msg);
+  switch (EC) {
+  default:
+    break;
+  case AsmOperandErrorCode::CONSTRAINT_H_ERROR:
+    Msg << " 'H' modifier used on an operand that is a non-offsetable memory "
+           "reference.";
+    break;
+  }
+  C.emitError(Msg.str());
+}
 /// PrintAsmOperand - Print out an operand for an inline asm expression.
----------------
jrtc27 wrote:

```suggestion

/// PrintAsmOperand - Print out an operand for an inline asm expression.
```

https://github.com/llvm/llvm-project/pull/88248


More information about the llvm-commits mailing list