diff options
author | Sean Silva <silvas@purdue.edu> | 2012-09-19 01:47:03 +0000 |
---|---|---|
committer | Sean Silva <silvas@purdue.edu> | 2012-09-19 01:47:03 +0000 |
commit | 835139bfe41e66580e3e2a64f63ef0dee0519eb8 (patch) | |
tree | 4d5ac14f2451398533d7c25628f9991c15575d14 /llvm/utils | |
parent | c8f5657f91974efc0a59721a0545194264669c04 (diff) | |
download | bcm5719-llvm-835139bfe41e66580e3e2a64f63ef0dee0519eb8.tar.gz bcm5719-llvm-835139bfe41e66580e3e2a64f63ef0dee0519eb8.zip |
Iterate deterministicaly over ClassInfo*'s
Fixes an observed instance of nondeterministic TableGen output.
Review by Jakob.
llvm-svn: 164191
Diffstat (limited to 'llvm/utils')
-rw-r--r-- | llvm/utils/TableGen/AsmMatcherEmitter.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/llvm/utils/TableGen/AsmMatcherEmitter.cpp b/llvm/utils/TableGen/AsmMatcherEmitter.cpp index b8deba384b9..fa4987f43be 100644 --- a/llvm/utils/TableGen/AsmMatcherEmitter.cpp +++ b/llvm/utils/TableGen/AsmMatcherEmitter.cpp @@ -279,6 +279,15 @@ public: } }; +namespace { +/// Sort ClassInfo pointers independently of pointer value. +struct LessClassInfoPtr { + bool operator()(const ClassInfo *LHS, const ClassInfo *RHS) const { + return *LHS < *RHS; + } +}; +} + /// MatchableInfo - Helper class for storing the necessary information for an /// instruction or alias which is capable of being matched. struct MatchableInfo { @@ -1240,7 +1249,8 @@ void AsmMatcherInfo::buildOperandMatchInfo() { /// Map containing a mask with all operands indices that can be found for /// that class inside a instruction. - std::map<ClassInfo*, unsigned> OpClassMask; + typedef std::map<ClassInfo*, unsigned, LessClassInfoPtr> OpClassMaskTy; + OpClassMaskTy OpClassMask; for (std::vector<MatchableInfo*>::const_iterator it = Matchables.begin(), ie = Matchables.end(); @@ -1259,7 +1269,7 @@ void AsmMatcherInfo::buildOperandMatchInfo() { } // Generate operand match info for each mnemonic/operand class pair. - for (std::map<ClassInfo*, unsigned>::iterator iit = OpClassMask.begin(), + for (OpClassMaskTy::iterator iit = OpClassMask.begin(), iie = OpClassMask.end(); iit != iie; ++iit) { unsigned OpMask = iit->second; ClassInfo *CI = iit->first; |