-
Notifications
You must be signed in to change notification settings - Fork 13.4k
[TableGen] Add PreferSmallerInstructions
for Targets.
#83587
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[TableGen] Add PreferSmallerInstructions
for Targets.
#83587
Conversation
@kosarev This is a PR for the addition of the PreferSmallInstructions option |
✅ With the latest revision this PR passed the C/C++ code formatter. |
f03c485
to
f2ca97d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. LGTM modulo the typo. But please don't submit until this is actually needed.
f2ca97d
to
505a547
Compare
@s-barannikov Regarding
It is my understanding this needs to be here for ARM. The architecture reference manual states:
There are cases (such as thumb 1 instructions with a CCOut operand whereas thumb 2 doesnt) where the smaller instruction has more operands, so choosing that first would make this non-compliant. |
@s-barannikov regarding
I have just pushed a commit that moves it. |
@@ -346,6 +342,10 @@ Record *CodeGenTarget::getAsmParser() const { | |||
return LI[AsmParserNum]; | |||
} | |||
|
|||
bool CodeGenTarget::getPreferSmallerInstructions() const { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move to AsmMatcherEmitter.cpp?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure!
cd1b3e3
to
7c3b6e1
Compare
PreferSmallerInstructions
for Targets.PreferSmallerInstructions
for Targets.
PreferSmallerInstructions
for Targets.PreferSmallerInstructions
for Targets.
51e398a
to
992a749
Compare
This option means that in assembly matching instructions with smaller encodings will be preferred. This will be used for the ARM instruciton set where this is the correct behaviour after some other refactoring.
992a749
to
1cee0ef
Compare
- if (A.couldMatchAmbiguouslyWith(B, Target)) {
+ bool PreferSmallerInstructions =
+ AsmParser->getValueAsBit("PreferSmallerInstructions");
+ if (A.couldMatchAmbiguouslyWith(B, PreferSmallerInstructions)) {
Fixed. |
bdb8d7d
to
12ad9c4
Compare
Adding this now
The main reason for this flag is this change breaks a lot of assumptions that other backends (MIPS primarily) rely upon (see all the assumptions it broke in the ARM backend to get an idea (: ). I will add a comment to explain the default ordering and the change this makes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm happy with this from the point of view of it filling in the missing comment I asked for on review #83436. I can't comment on whether the details of the specified preference order are accurate, though, so I have to rely on other reviewers for that :-)
This option means that in assembly matching instructions with smaller encodings will be preferred.
This will be used for the ARM instruction set where this is the correct behavior after some other refactoring.