When alias are emitter the priority is ignored. Only priority = 0 (do not emit) is handled.
Because of this we can not decide, which alias should be emitted in case of a collision.
E.g.
bta eq, 0x400 ; Emitter
beqa 0x400 ; Should be emitter
Possibly it is enough to sort the AliasMap before adding each alias to the IAPrinter:
|
typedef std::set<std::pair<CodeGenInstAlias, int>, AliasPriorityComparator> |
|
AliasWithPriority; |
|
std::map<std::string, AliasWithPriority> AliasMap; |
|
for (Record *R : AllInstAliases) { |
|
int Priority = R->getValueAsInt("EmitPriority"); |
|
if (Priority < 1) |
|
continue; // Aliases with priority 0 are never emitted. |
|
|
|
const DagInit *DI = R->getValueAsDag("ResultInst"); |
|
AliasMap[getQualifiedName(DI->getOperatorAsDef(R->getLoc()))].insert( |
|
std::make_pair(CodeGenInstAlias(R, Target), Priority)); |
|
} |
|
|
|
// A map of which conditions need to be met for each instruction operand |
|
// before it can be matched to the mnemonic. |
|
std::map<std::string, std::vector<IAPrinter>> IAPrinterMap; |
|
|
|
std::vector<std::pair<std::string, bool>> PrintMethods; |
|
|
|
// A list of MCOperandPredicates for all operands in use, and the reverse map |
|
std::vector<const Record*> MCOpPredicates; |
|
DenseMap<const Record*, unsigned> MCOpPredicateMap; |
|
|
|
for (auto &Aliases : AliasMap) { |
|
// Collection of instruction alias rules. May contain ambiguous rules. |
|
std::vector<IAPrinter> IAPs; |
When alias are emitter the priority is ignored. Only
priority = 0(do not emit) is handled.Because of this we can not decide, which alias should be emitted in case of a collision.
E.g.
Possibly it is enough to sort the
AliasMapbefore adding each alias to the IAPrinter:llvm-capstone/llvm/utils/TableGen/AsmWriterEmitter.cpp
Lines 620 to 645 in 86fea00