search for: compare_numeric

Displaying 7 results from an estimated 7 matches for "compare_numeric".

2011 Sep 30
3
[LLVMdev] Tablegen: RegisterInfoEmitter.cpp
...aa23g. It was the map ordering operator that was the trouble, it seems, as the problem disappeared when I used std::string::compare() instead for the RegisterAliases map. struct LessRecord { bool operator()(const Record *Rec1, const Record *Rec2) const { return StringRef(Rec1->getName()).compare_numeric(Rec2->getName()) < 0; } }; struct LessRecordRegAliases{ bool operator()(const Record *Rec1, const Record *Rec2) const { return Rec1->getName().compare(Rec2->getName()) < 0; } }; The conclusion is that the StringRef::compare_numeric() is not deterministic and should not b...
2011 Sep 30
0
[LLVMdev] Tablegen: RegisterInfoEmitter.cpp
On Sep 30, 2011, at 8:29 AM, Jonas Paulsson wrote: > The conclusion is that the StringRef::compare_numeric() is not deterministic Thanks for tracking this down. I believe we have a bug in compare_numeric() causing it to be non-transitive sometimes. It is supposed to provide a total ordering of strings. Can you find the bug? /jakob -------------- next part -------------- An HTML attachment was scrubb...
2011 Oct 01
1
[LLVMdev] Tablegen: RegisterInfoEmitter.cpp
Hi, I understand the idea behind compare_numeric() is to compare strings containing digits in a special way: Do a normal string-compare up to the point where both string elemnts are numerical. Find then an outcome based on the number of consecutive digits in the strings while disregarding the value of the digits, eg a12b < a123. I guess then...
2011 Sep 06
3
[LLVMdev] bug in TableGen when generating RegisterInfo?
...tter.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...
2011 Sep 07
0
[LLVMdev] bug in TableGen when generating RegisterInfo?
...; 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 ....
2010 Sep 03
0
[LLVMdev] [LLVMDev] [Question] How do I get the number of machine registers.
...machine registers ordered internally? Can I index them off of a zero based array or do I have to create a map to have them be zero based? Registers are numbered from 1 to TRI::getNumRegs()-1. Reg 0 is not a register, but it is counted by getNumRegs. They are currently sorted by name by StringRef::compare_numeric(), but try to avoid depending on that. It could easily change, I have been experimenting with the performance impact of a topological order. /jakob
2010 Sep 03
4
[LLVMdev] [LLVMDev] [Question] How do I get the number of machine registers.
How do I get the total number of machine registers? I have currently a MachineFunction and some derivatives. How are the machine registers ordered internally? Can I index them off of a zero based array or do I have to create a map to have them be zero based? Thanks, Jeff Kunkel -------------- next part -------------- An HTML attachment was scrubbed... URL: