[PATCH] JIT: Print debug location of inline asm and ignore DBG_VALUE instructions
Yaron Keren
yaron.keren at gmail.com
Fri Apr 18 00:17:47 PDT 2014
Two small enhancements for the JIT.
When JITting a large project such as Boost it's quite hard to figure out the problematic inline asm without debug location. This patch provides debug location printout before the JIT aborts due to inline asm. printDebugLoc() was exposed from MachineInstr.cpp and reused here.
If the JIT run with debug info, don't bomb on DBG_VALUE but ignore them.
http://reviews.llvm.org/D3416
Files:
lib/Target/X86/X86CodeEmitter.cpp
include/llvm/CodeGen/MachineInstr.h
lib/CodeGen/MachineInstr.cpp
Index: lib/Target/X86/X86CodeEmitter.cpp
===================================================================
--- lib/Target/X86/X86CodeEmitter.cpp
+++ lib/Target/X86/X86CodeEmitter.cpp
@@ -1112,9 +1112,18 @@
case TargetOpcode::INLINEASM:
// We allow inline assembler nodes with empty bodies - they can
// implicitly define registers, which is ok for JIT.
- if (MI.getOperand(0).getSymbolName()[0])
+ if (MI.getOperand(0).getSymbolName()[0]) {
+ DebugLoc DL = MI.getDebugLoc();
+ if (const MachineBasicBlock *MBB = MI.getParent()) {
+ if (const MachineFunction *MF = MBB->getParent()) {
+ printDebugLoc(DL, MF, llvm::errs());
+ llvm::errs() << '\n';
+ }
+ }
report_fatal_error("JIT does not support inline asm!");
+ }
break;
+ case TargetOpcode::DBG_VALUE:
case TargetOpcode::CFI_INSTRUCTION:
break;
case TargetOpcode::GC_LABEL:
Index: include/llvm/CodeGen/MachineInstr.h
===================================================================
--- include/llvm/CodeGen/MachineInstr.h
+++ include/llvm/CodeGen/MachineInstr.h
@@ -1171,6 +1171,9 @@
return OS;
}
+void printDebugLoc(DebugLoc DL, const MachineFunction *MF,
+ raw_ostream &CommentOS);
+
} // End llvm namespace
#endif
Index: lib/CodeGen/MachineInstr.cpp
===================================================================
--- lib/CodeGen/MachineInstr.cpp
+++ lib/CodeGen/MachineInstr.cpp
@@ -1450,7 +1450,8 @@
#endif
}
-static void printDebugLoc(DebugLoc DL, const MachineFunction *MF,
+namespace llvm {
+void printDebugLoc(DebugLoc DL, const MachineFunction *MF,
raw_ostream &CommentOS) {
const LLVMContext &Ctx = MF->getFunction()->getContext();
if (!DL.isUnknown()) { // Print source line info.
@@ -1473,6 +1474,7 @@
}
}
}
+}
void MachineInstr::print(raw_ostream &OS, const TargetMachine *TM,
bool SkipOpers) const {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D3416.1.patch
Type: text/x-patch
Size: 2018 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140418/36861fc7/attachment.bin>
More information about the llvm-commits
mailing list