-
Notifications
You must be signed in to change notification settings - Fork 393
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
Refactoring of TR::ternary opcodes to TR::select #4578
Conversation
Shouldn't the |
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 for your first contribution! I did an initial pass through this and found a few things that need to get fixed up. Once they are, on my next pass I will checkout your branch and sniff around the code for other "ternaries" that may have been missed (other than the one that @andrewcraik already mentioned).
compiler/il/OMRIL.cpp
Outdated
TR::fternary, // Float | ||
TR::dternary, // Double | ||
TR::aternary, // Address | ||
TR::bselect, // Int8. Formerly- TR::bternary |
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.
Why are these ternary comments necessary? Please remove.
compiler/il/OMRILOpCodesEnum.hpp
Outdated
aternary, // | ||
fternary, // | ||
dternary, // | ||
iselect, // Former Ternary Operator: Based on the result of the first child, take the value of the |
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.
Replace "Former Ternary Operator" with "Select Operator"
compiler/il/OMRILOpCodesEnum.hpp
Outdated
dternary, // | ||
iselect, // Former Ternary Operator: Based on the result of the first child, take the value of the | ||
// second (first child evaluates to true) or third(first child evaluates to false) child | ||
// Formerly iternary, lternary, bternary, sternary etc.. |
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.
Remove the "Formerly..." comment.
compiler/il/OMRILOpCodesEnum.hpp
Outdated
@@ -574,7 +576,7 @@ | |||
vreturn, // return a vector | |||
vcall, // direct call returning a vector | |||
vcalli, // indirect call returning a vector | |||
vternary, // vector ternary operator | |||
vternary, // vector ternary operator |
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.
Rename to vselect
as well.
compiler/ilgen/OMRIlBuilder.hpp
Outdated
@@ -586,7 +586,7 @@ class IlBuilder : public TR::IlInjector | |||
TR::IlBuilder **caseBuilder, | |||
int32_t caseFallsThrough); | |||
|
|||
// ternary | |||
// select (former ternary) |
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.
Remove former ternary
@@ -14424,7 +14424,7 @@ OMR::Z::TreeEvaluator::inlineVectorBinaryOp(TR::Node * node, TR::CodeGenerator * | |||
} | |||
|
|||
TR::Register * | |||
OMR::Z::TreeEvaluator::inlineVectorTernaryOp(TR::Node * node, TR::CodeGenerator *cg, TR::InstOpCode::Mnemonic op) | |||
OMR::Z::TreeEvaluator::inlineVectorSelectOp(TR::Node * node, TR::CodeGenerator *cg, TR::InstOpCode::Mnemonic op) | |||
{ | |||
TR_ASSERT(node->getNumChildren() >= 3,"Ternary Node must contain 3 or more children"); |
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.
"Select node"
@@ -546,7 +546,7 @@ | |||
TR::TreeEvaluator::vreturnEvaluator, // TR::vreturn | |||
TR::TreeEvaluator::directCallEvaluator, // TR::vcall | |||
TR::TreeEvaluator::indirectCallEvaluator,// TR::vcalli | |||
TR::TreeEvaluator::ternaryEvaluator, // TR::vternary | |||
TR::TreeEvaluator::selectEvaluator, // TR::vternary |
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.
vselect
static signatureCharIJJ_J_testMethodType *_lternary; | ||
static signatureCharIFF_F_testMethodType *_fternary; | ||
static signatureCharIDD_D_testMethodType *_dternary; | ||
//Select (former- Ternary) operators |
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.
Remove former ternary
@@ -133,7 +133,7 @@ class OpIlInjector : public TR::IlInjector | |||
|
|||
TR::ILOpCodes _opCode; | |||
TR::DataType _dataType; // datatype of OpCode child/children | |||
TR::DataType _conditionalDataType; // return type of Ternary opcodes | |||
TR::DataType _conditionalDataType; // return type of Select (former- Ternary) opcodes |
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.
Remove former ternary
* | ||
* \tparam CompareType | ||
* The type of the compare child of the ternary opcode. | ||
* The type of the compare child of the select (former- ternary) opcode. |
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.
Remove former ternary
c90236d
to
9ca7659
Compare
compiler/il/OMRILOpCodesEnum.hpp
Outdated
@@ -500,7 +500,7 @@ | |||
vicmpanyle, // vector integer any less equal | |||
|
|||
vnot, // vector boolean not | |||
vselect, // vector select | |||
vbitselect, // vector select |
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.
Perhaps // vector bit select
{ | ||
return TR::TreeEvaluator::inlineVectorTernaryOp(node, cg, TR::InstOpCode::vsel); | ||
return TR::TreeEvaluator::inlineVectorSelectOp(node, cg, TR::InstOpCode::vsel); |
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 believe this function should be inlineVectorBitSelectOp
since the opcode was renamed. This comment applies elsewhere to the other evaluators that call it too.
@@ -478,7 +478,7 @@ | |||
TR::TreeEvaluator::unImpOpEvaluator, // TR::vicmpanylt | |||
TR::TreeEvaluator::unImpOpEvaluator, // TR::vicmpanyle | |||
TR::TreeEvaluator::unImpOpEvaluator, // TR::vnot | |||
TR::TreeEvaluator::vselEvaluator, // TR::vselect | |||
TR::TreeEvaluator::vselEvaluator, // TR::vbitselect |
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.
This should now be TR::TreeEvaluator::unImpOpEvaluator
as discussed in #4590.
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 believe the issue #4590 refers to the new vselect
opcode to be unimplemented in the Z tree evaluator table (which is done), not the vbitselect
. Can you please re-confirm? Thanks.
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.
Yes, sorry.
Looking at what is left after this commit is applied there are a few things that stand out:
You have to be careful though because some of these have uses in downstream projects like OpenJ9. What I suggest you do is to eliminate downstream breakages as much as possible when renaming. For example, you can duplicate the |
9ca7659
to
e8f48d1
Compare
e8f48d1
to
3948cd5
Compare
Be aware of #4681 as it is adding a new flag for "ternary" opcodes. Some of that new code will have to change if that PR lands first. |
3948cd5
to
097199d
Compare
097199d
to
4d02352
Compare
4d02352
to
1ad446f
Compare
@genie-omr build all |
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.
The bulk of these changes look good to me. I just have a few minor points in the comments.
eclipse-openj9/openj9#8364 has introduced a new use of aternary
in OpenJ9. In order for this PR in OMR to go in smoothly first, I suggest leaving the following in OMR for now:
- keep
aternary
in the enum that shares the same enum value asaselect
- keep the CodeGenerator functions
getSupportsTernary()
These can be cleaned up (along with removing isTernaryHigh
) once your corresponding OpenJ9 PR lands.
compiler/il/OMRIL.cpp
Outdated
TR::ILOpCodes | ||
OMR::IL::opCodeForSelect(TR::DataType dt) | ||
{ | ||
TR_ASSERT(dt < TR::NumOMRTypes, "unexpcted opcode"); |
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.
Should be "Unexpected data type". Also fix spelling of 'unexpected'.
compiler/il/OMRILOps.hpp
Outdated
bool isSelect() const { return properties2().testAny(ILProp2::Select); } | ||
bool isSelectAdd() const { return properties2().testAny(ILProp2::SelectAdd); } | ||
bool isSelectSub() const { return properties2().testAny(ILProp2::SelectSub); } |
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.
Please add a single space before const
to maintain alignment.
compiler/il/OMRILProps.hpp
Outdated
SelectAdd = 0x00010000, | ||
SelectSub = 0x00020000, |
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.
Please add a space before =
to maintain alignment.
@@ -2084,6 +2084,25 @@ OMR::Node::isTernaryHigh() | |||
return false; | |||
} | |||
|
|||
bool | |||
OMR::Node::isSelectHigh() | |||
{ |
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.
If isTernaryHigh()
is just a stub now (temporarily), I would rather it's body be gutted and simply return self()->isSelectHigh();
rather than identically duplicate this body.
static TR::Register *iuselectEvaluator(TR::Node *node, TR::CodeGenerator *cg); | ||
static TR::Register *luselectEvaluator(TR::Node *node, TR::CodeGenerator *cg); | ||
static TR::Register *buselectEvaluator(TR::Node *node, TR::CodeGenerator *cg); | ||
static TR::Register *suselectEvaluator(TR::Node *node, TR::CodeGenerator *cg); |
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 think these can just be deleted. There are no references and the opcode doesn't exist.
1ad446f
to
62e6925
Compare
Thanks for the changes. Please don't sprinkle the code with comment references to the OpenJ9 PR eclipse-openj9/openj9#7797. While it is true there is cleanup needed after that is merged, I'd rather you open an issue in OMR to track this removal (and all the other things you need to remove once downstream changes merge) than leave a comments in the code. I saw several comments in the code that referred to that downstream issue. |
62e6925
to
e10c9e0
Compare
@genie-omr build all |
@@ -533,6 +533,7 @@ class OMR_EXTENSIBLE Node | |||
/// and the opcodes for highOp/adjunctOp are luaddc/luadd, or lusubb/lusub. | |||
/// | |||
bool isTernaryHigh(); | |||
bool isSelectHigh(); |
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.
The doxygen should be on isSelectHigh with a deprecated warning on isTernaryHigh.
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.
Thank you for your comment, I am updating this for other similar instances (on compiler/il/OMRNode.cpp
).
Replacing of the ternary OpCodes such as TR::bternary etc. to TR::bselect etc. and the associated items respectively. The changes are made onto the followings: - Components of various data types such as- Int8, Float, Double (iternary, bternary, vternary etc) etc.. - Corresponding evaluators such as- bselectEvaluator, iselectEvaluator etc. and other functions where the IL OpCodes are used. - Corresponding outputs of texts such as- "iselect" etc. and comments (//ternary). - The IL opcode (and its respective evaluator to- vbitselectEvaluator)- vselect has been updated to vbitselect. - The new vselect opcode has been marked- unimplemented in the Z tree evaluator. - File names which involved updating of the class names. - There are some duplicated usages of the opcodes (`aternary`) and their respective functions for their dependencies on OpenJ9, they will need to be deleted once the eclipse/openj9 #7797 PR is accepted. Partially Resolves: GitHub issues eclipse#681 and eclipse#4590 Signed-off-by: Md. Alvee Noor <mnoor@unb.ca>
e10c9e0
to
66aae96
Compare
Removed deprecated functions (i.e. `getSupportsTernary` etc.) which were introduced by the PR eclipse#4578. Closes: GitHub issue eclipse#681 Signed-off-by: Md. Alvee Noor <mnoor@unb.ca>
Removed deprecated functions (i.e. `getSupportsTernary` etc.) which were introduced by the PR eclipse#4578. Closes: GitHub issue eclipse#681 and eclipse#4847 Signed-off-by: Md. Alvee Noor <mnoor@unb.ca>
@genie-omr build all |
macOS failure is a late infrastructure failure after the tests have succeeded. Merging. |
Replaced the ternary OpCodes such as TR::aternary etc. to TR::aselect etc. respectively. Related OMR PR: eclipse/omr#4578 Partially Resolves: Issue eclipse/omr#681 and eclipse/omr#4590 Signed-off-by: Md. Alvee Noor <mnoor@unb.ca>
Removed deprecated functions (i.e. `getSupportsTernary` etc.) which were introduced by the PR eclipse#4578. Closes: GitHub issue eclipse#681 and eclipse#4847 Signed-off-by: Md. Alvee Noor <mnoor@unb.ca>
Removed deprecated functions (i.e. `getSupportsTernary` etc.) which were introduced by the PR eclipse#4578. Closes: GitHub issue eclipse#681 and eclipse#4847 Signed-off-by: Md. Alvee Noor <mnoor@unb.ca>
Refactoring of TR::ternary opcodes to TR::select
Replacing of the ternary OpCodes such as TR::bternary etc. to
TR::bselect etc. and the associated items respectively.
The changes are made onto the followings:
(iternary, bternary etc) etc..
etc. and other functions where the IL OpCodes are used.
(//ternary).
Closes: GitHub issue #681
Signed-off-by: Md. Alvee Noor mnoor@unb.ca