[LLVMdev] bug in TableGen when generating RegisterInfo?

Alexandru Dura alexdura at gmail.com
Tue Sep 6 06:34:51 PDT 2011

Hi everyone,

I found some peculiar behavior of TableGen when generating
[TARGET]GenRegisterInfo.inc. Some register overlaps are generated twice in
this file, leading to a compilation error. I think this is because in
RegisterInfoEmitter.cpp, RegisterAliases are declared as "std::map<Record*,
std::set<Record*>, LessRecord>"

and a requirement for std::map is that the comparison function
("LessRecord") should correspond to a strict weak ordering; in this case
this points to :

   "StringRef1.compare_numeric(StringRef2) < 0"

which does not behave like strict weak ordering predicate on the set of
strings. I have attached an example built upon snippets from StringRef.cpp,
compiled with gcc version 4.4.5 (Debian 4.4.5-8) (I also saw that there is a
workaround for gcc 4.x ...).

Please tell me if I am doing something wrong or this is a real bug.

Thank you,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110906/88ed25a7/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_StringRef.cpp
Type: text/x-c++src
Size: 2416 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110906/88ed25a7/attachment.cpp>

More information about the llvm-dev mailing list