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

via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 10 10:46:47 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:
----------------
mahesh-attarde wrote:

I did not understand comment.
>From Here, we are first printing some generic diagnostic present without this patch. e,g, regarding "invalid Operand with Src Location" , Since target can have constraint code specific to architecture, I used specialized `X86AsmPrinter::diagnoseAsmOperandError` to just provide helpful diagnostics for 'H;

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


More information about the llvm-commits mailing list