RCU via llvm-dev
2015-Dec-29 22:54 UTC
[llvm-dev] TableGen - cryptic error messages (~feature request)
Hello. I started implementing a back end in LLVM (and I'm writing some hints I consider useful at https://sites.google.com/site/alexsusu/home/backend-llvm ). 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. The most cryptic error message was when compiling with TableGen, with the option -gen-asm-matcher . Here I got the following error message: 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. [...] Stack dump: 0. Program arguments: ~/llvm/build3/bin/llvm-tblgen -gen-asm-matcher -I ~/llvm/include Connex.td ./run_tblgen.sh: line 13: 27011 Aborted (core dumped) ~/llvm/build3/bin/llvm-tblgen -gen-asm-matcher -I ~/llvm/include Connex.td > ConnexGenAsmMatcher.inc 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:: EmitStringMatcherForChar() some printing that explained more clearly why the error happens. Therefore I have this IMPORTANT question: would you feel it is useful to make TableGen give more detailed error messages? I personally recommend this. Thank you, Alex
David Blaikie via llvm-dev
2016-Jan-07 17:50 UTC
[llvm-dev] TableGen - cryptic error messages (~feature request)
On Tue, Dec 29, 2015 at 2:54 PM, RCU via llvm-dev <llvm-dev at lists.llvm.org> wrote:> Hello. > I started implementing a back end in LLVM (and I'm writing some hints > I consider useful at > https://sites.google.com/site/alexsusu/home/backend-llvm ). > 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. > > The most cryptic error message was when compiling with TableGen, with > the option -gen-asm-matcher . Here I got the following error message: > 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. > [...] > Stack dump: > 0. Program arguments: ~/llvm/build3/bin/llvm-tblgen -gen-asm-matcher > -I ~/llvm/include Connex.td > ./run_tblgen.sh: line 13: 27011 Aborted (core dumped) > ~/llvm/build3/bin/llvm-tblgen -gen-asm-matcher -I ~/llvm/include Connex.td > > ConnexGenAsmMatcher.inc > > 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:: > EmitStringMatcherForChar() some printing that explained more clearly why > the error happens. > > Therefore I have this IMPORTANT question: would you feel it is useful > to make TableGen give more detailed error messages? I personally recommend > this. >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? - Dave> > > Thank you, > Alex > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160107/bd0196c2/attachment.html>
James Grosbach via llvm-dev
2016-Jan-07 19:22 UTC
[llvm-dev] TableGen - cryptic error messages (~feature request)
> On Jan 7, 2016, at 9:50 AM, David Blaikie via llvm-dev <llvm-dev at lists.llvm.org> wrote: > > > > On Tue, Dec 29, 2015 at 2:54 PM, RCU via llvm-dev <llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>> wrote: > Hello. > I started implementing a back end in LLVM (and I'm writing some hints I consider useful at https://sites.google.com/site/alexsusu/home/backend-llvm <https://sites.google.com/site/alexsusu/home/backend-llvm> ). > 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. > > The most cryptic error message was when compiling with TableGen, with the option -gen-asm-matcher . Here I got the following error message: > 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. > [...] > Stack dump: > 0. Program arguments: ~/llvm/build3/bin/llvm-tblgen -gen-asm-matcher -I ~/llvm/include Connex.td > ./run_tblgen.sh: line 13: 27011 Aborted (core dumped) ~/llvm/build3/bin/llvm-tblgen -gen-asm-matcher -I ~/llvm/include Connex.td > ConnexGenAsmMatcher.inc > > 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:: > EmitStringMatcherForChar() some printing that explained more clearly why the error happens. > > Therefore I have this IMPORTANT question: would you feel it is useful to make TableGen give more detailed error messages? I personally recommend this. > > 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?It definitely aspires to, yeah. An assert() for a user error is not a great experience. Patches making that aspiration a bit closer to the reality are very welcome. -jim> > - Dave > > > > Thank you, > Alex > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org> > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev <http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev> > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org> > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev <http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev>-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160107/f2c6d379/attachment.html>
Possibly Parallel Threads
- [LLVMdev] (MC) Register parsing for AsmParser (standalone assembler)
- [LLVMdev] (MC) Register parsing for AsmParser (standalone assembler)
- [LLVMdev] (MC) Register parsing for AsmParser (standalone assembler)
- LLVM back end for the research Connex SIMD processor
- [GSoC] Supporting Efficiently the Shift-vector Instructions of the Connex Vector Processor