Skip to content

Commit e0ea633

Browse files
Addressing minor comments.
1 parent cd17a02 commit e0ea633

File tree

3 files changed

+9
-15
lines changed

3 files changed

+9
-15
lines changed

llvm/utils/TableGen/AsmMatcherEmitter.cpp

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,10 @@ class AsmVariantInfo {
375375
int AsmVariantNo;
376376
};
377377

378+
bool getPreferSmallerInstructions(CodeGenTarget const &Target) {
379+
return Target.getAsmParser()->getValueAsBit("PreferSmallerInstructions");
380+
}
381+
378382
/// MatchableInfo - Helper class for storing the necessary information for an
379383
/// instruction or alias which is capable of being matched.
380384
struct MatchableInfo {
@@ -620,9 +624,9 @@ struct MatchableInfo {
620624
if (int Cmp = Mnemonic.compare_insensitive(RHS.Mnemonic))
621625
return Cmp == -1;
622626

623-
// Sort by the resultant instuctions size, eg. for ARM instructions
624-
// we must choose the smallest matching instruction.
625-
if (Target.getPreferSmallerInstructions() && ResInstSize != RHS.ResInstSize)
627+
// (Optionally) Order by the resultant instuctions size.
628+
// eg. for ARM thumb instructions smaller encodings should be preferred.
629+
if (getPreferSmallerInstructions(Target) && ResInstSize != RHS.ResInstSize)
626630
return ResInstSize < RHS.ResInstSize;
627631

628632
if (AsmOperands.size() != RHS.AsmOperands.size())
@@ -673,8 +677,7 @@ struct MatchableInfo {
673677
if (AsmVariantID != RHS.AsmVariantID)
674678
return false;
675679

676-
// Sort by the resultant instuctions size, eg. for ARM instructions
677-
// we must choose the smallest matching instruction.
680+
// The size of instruction is unambiguous.
678681
if (Target.getPreferSmallerInstructions() && ResInstSize != RHS.ResInstSize)
679682
return false;
680683

@@ -3252,7 +3255,7 @@ void AsmMatcherEmitter::run(raw_ostream &OS) {
32523255
for (auto I = Info.Matchables.begin(), E = Info.Matchables.end(); I != E;
32533256
++I) {
32543257
for (auto J = I; J != E; ++J) {
3255-
assert(!((*J)->shouldBeMatchedBefore(**I, Target)));
3258+
assert(!(*J)->shouldBeMatchedBefore(**I, Target));
32563259
}
32573260
}
32583261
#endif

llvm/utils/TableGen/CodeGenTarget.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -342,10 +342,6 @@ Record *CodeGenTarget::getAsmParser() const {
342342
return LI[AsmParserNum];
343343
}
344344

345-
bool CodeGenTarget::getPreferSmallerInstructions() const {
346-
return getAsmParser()->getValueAsBit("PreferSmallerInstructions");
347-
}
348-
349345
/// getAsmParserVariant - Return the AssemblyParserVariant definition for
350346
/// this target.
351347
///

llvm/utils/TableGen/CodeGenTarget.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,6 @@ class CodeGenTarget {
100100
///
101101
bool getAllowRegisterRenaming() const;
102102

103-
/// getPreferSmallerInstructions - Return the PreferSmallerInstructions
104-
/// flag value for this target.
105-
///
106-
bool getPreferSmallerInstructions() const;
107-
108103
/// getAsmParser - Return the AssemblyParser definition for this target.
109104
///
110105
Record *getAsmParser() const;

0 commit comments

Comments
 (0)