<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Dec 29, 2015 at 2:54 PM, RCU via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">  Hello.<br>
    I started implementing a back end in LLVM (and I'm writing some hints I consider useful at <a href="https://sites.google.com/site/alexsusu/home/backend-llvm" rel="noreferrer" target="_blank">https://sites.google.com/site/alexsusu/home/backend-llvm</a> ).<br>
    Unfortunately, I hit quite a few times very cryptic error messages when compiling with TableGen, which required a few good hours of debugging the TableGen program.<br>
<br>
    The most cryptic error message was when compiling with TableGen, with the option -gen-asm-matcher . Here I got the following error message:<br>
llvm-tblgen: ~/llvm/lib/TableGen/StringMatcher.cpp:52: bool llvm::StringMatcher::EmitStringMatcherForChar(const std::vector<const std::pair<std::basic_string<char>, std::basic_string<char> >*>&, unsigned int, unsigned int) const: Assertion `Matches.size() == 1 && "Had duplicate keys to match on"' failed.<br>
[...]<br>
Stack dump:<br>
0.      Program arguments: ~/llvm/build3/bin/llvm-tblgen -gen-asm-matcher -I ~/llvm/include Connex.td<br>
./run_tblgen.sh: line 13: 27011 Aborted                 (core dumped) ~/llvm/build3/bin/llvm-tblgen -gen-asm-matcher -I ~/llvm/include Connex.td > ConnexGenAsmMatcher.inc<br>
<br>
    It took me quite a few hours to find the source of the error, namely the fact I had defined two registers with the SAME ASM name (string) - so the disassembly (ASM matcher) info had conflicts. I actually sped up my debugging by editing the file ~/llvm/lib/TableGen/StringMatcher.cpp and adding in StringMatcher::<br>
EmitStringMatcherForChar() some printing that explained more clearly why the error happens.<br>
<br>
    Therefore I have this IMPORTANT question: would you feel it is useful to make TableGen give more detailed error messages? I personally recommend this.<br></blockquote><div><br></div><div>Seems reasonable to add some extra text to the assertion (and possibly use better error handling - not sure if tblgen aspires to be assertion-free on unbounded table inputs, but it probably should be... ). Perhaps you could send a patch to llvm-commits to discuss the specifics there?<br><br>- Dave</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<br>
  Thank you,<br>
    Alex<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div><br></div></div>