Skip to content

Commit d2e005b

Browse files
committed
Remove creation of nodes with deprecated unsigned add/sub opcodes
Signed-off-by: Bohao(Aaron) Wang <aaronwang0407@gmail.com>
1 parent 947946e commit d2e005b

File tree

3 files changed

+25
-30
lines changed

3 files changed

+25
-30
lines changed

compiler/il/OMRILOps.hpp

+18-23
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2000, 2019 IBM Corp. and others
2+
* Copyright (c) 2000, 2020 IBM Corp. and others
33
*
44
* This program and the accompanying materials are made available under
55
* the terms of the Eclipse Public License 2.0 which accompanies this
@@ -702,11 +702,11 @@ class ILOpCode
702702
{
703703
switch(type)
704704
{
705-
case TR::Int8: return TR::buadd;
706-
case TR::Int16: return TR::cadd;
707-
case TR::Int32: return TR::iuadd;
708-
case TR::Int64: return TR::luadd;
709-
case TR::Address: return (is64Bit) ? TR::aladd : TR::aiadd;
705+
case TR::Int8: return TR::badd;
706+
case TR::Int16: return TR::sadd;
707+
case TR::Int32: return TR::iadd;
708+
case TR::Int64: return TR::ladd;
709+
case TR::Address: return (is64Bit) ? TR::aladd : TR::aiadd;
710710
default: TR_ASSERT(0, "no add opcode for this datatype");
711711
}
712712
return TR::BadILOp;
@@ -737,12 +737,9 @@ class ILOpCode
737737
{
738738
switch(type)
739739
{
740-
case TR::Int8: return TR::busub;
741-
case TR::Int16: return TR::csub;
742-
case TR::Int32: return TR::iusub;
743-
case TR::Int64: return TR::lusub;
744740
default: TR_ASSERT(0, "no unsigned sub opcode for this datatype");
745741
}
742+
TR_ASSERT_FATAL(0, "all unsigned subtract opcode has been deprecated. (eclipse/omr#2657)");
746743
return TR::BadILOp;
747744
}
748745

@@ -910,15 +907,13 @@ class ILOpCode
910907
switch (longOp)
911908
{
912909
case TR::ladd: return TR::iadd;
913-
case TR::luadd: return TR::iuadd;
910+
case TR::luadd: return TR::iadd;
914911
case TR::lsub: return TR::isub;
915-
case TR::lusub: return TR::iusub;
916912
case TR::lmul: return TR::imul;
917913
case TR::ldiv: return TR::idiv;
918914
case TR::lrem: return TR::irem;
919915
case TR::labs: return TR::iabs;
920916
case TR::lneg: return TR::ineg;
921-
case TR::luneg: return TR::iuneg;
922917
case TR::lshr: return TR::ishr;
923918
case TR::lushr: return TR::iushr;
924919
case TR::lshl: return TR::ishl;
@@ -1452,24 +1447,24 @@ template <> inline TR::ILOpCodes OMR::ILOpCode::getConstOpCode< float>() { ret
14521447
template <> inline TR::ILOpCodes OMR::ILOpCode::getConstOpCode< double>() { return TR::dconst; }
14531448
template <> inline TR::ILOpCodes OMR::ILOpCode::getConstOpCode< void*>() { return TR::aconst; }
14541449

1455-
template <> inline TR::ILOpCodes OMR::ILOpCode::getAddOpCode< uint8_t>() { return TR::buadd; }
1450+
template <> inline TR::ILOpCodes OMR::ILOpCode::getAddOpCode< uint8_t>() { return TR::badd; }
14561451
template <> inline TR::ILOpCodes OMR::ILOpCode::getAddOpCode< int8_t>() { return TR::badd; }
1457-
template <> inline TR::ILOpCodes OMR::ILOpCode::getAddOpCode<uint16_t>() { return TR::cadd; }
1452+
template <> inline TR::ILOpCodes OMR::ILOpCode::getAddOpCode<uint16_t>() { return TR::sadd; }
14581453
template <> inline TR::ILOpCodes OMR::ILOpCode::getAddOpCode< int16_t>() { return TR::sadd; }
1459-
template <> inline TR::ILOpCodes OMR::ILOpCode::getAddOpCode<uint32_t>() { return TR::iuadd; }
1454+
template <> inline TR::ILOpCodes OMR::ILOpCode::getAddOpCode<uint32_t>() { return TR::iadd; }
14601455
template <> inline TR::ILOpCodes OMR::ILOpCode::getAddOpCode< int32_t>() { return TR::iadd; }
1461-
template <> inline TR::ILOpCodes OMR::ILOpCode::getAddOpCode<uint64_t>() { return TR::luadd; }
1456+
template <> inline TR::ILOpCodes OMR::ILOpCode::getAddOpCode<uint64_t>() { return TR::ladd; }
14621457
template <> inline TR::ILOpCodes OMR::ILOpCode::getAddOpCode< int64_t>() { return TR::ladd; }
14631458
template <> inline TR::ILOpCodes OMR::ILOpCode::getAddOpCode< float>() { return TR::fadd; }
14641459
template <> inline TR::ILOpCodes OMR::ILOpCode::getAddOpCode< double>() { return TR::dadd; }
14651460

1466-
template <> inline TR::ILOpCodes OMR::ILOpCode::getSubOpCode< uint8_t>() { return TR::busub; }
1461+
template <> inline TR::ILOpCodes OMR::ILOpCode::getSubOpCode< uint8_t>() { return TR::bsub; }
14671462
template <> inline TR::ILOpCodes OMR::ILOpCode::getSubOpCode< int8_t>() { return TR::bsub; }
1468-
template <> inline TR::ILOpCodes OMR::ILOpCode::getSubOpCode<uint16_t>() { return TR::csub; }
1463+
template <> inline TR::ILOpCodes OMR::ILOpCode::getSubOpCode<uint16_t>() { return TR::ssub; }
14691464
template <> inline TR::ILOpCodes OMR::ILOpCode::getSubOpCode< int16_t>() { return TR::ssub; }
1470-
template <> inline TR::ILOpCodes OMR::ILOpCode::getSubOpCode<uint32_t>() { return TR::iusub; }
1465+
template <> inline TR::ILOpCodes OMR::ILOpCode::getSubOpCode<uint32_t>() { return TR::isub; }
14711466
template <> inline TR::ILOpCodes OMR::ILOpCode::getSubOpCode< int32_t>() { return TR::isub; }
1472-
template <> inline TR::ILOpCodes OMR::ILOpCode::getSubOpCode<uint64_t>() { return TR::lusub; }
1467+
template <> inline TR::ILOpCodes OMR::ILOpCode::getSubOpCode<uint64_t>() { return TR::lsub; }
14731468
template <> inline TR::ILOpCodes OMR::ILOpCode::getSubOpCode< int64_t>() { return TR::lsub; }
14741469
template <> inline TR::ILOpCodes OMR::ILOpCode::getSubOpCode< float>() { return TR::fsub; }
14751470
template <> inline TR::ILOpCodes OMR::ILOpCode::getSubOpCode< double>() { return TR::dsub; }
@@ -1485,9 +1480,9 @@ template <> inline TR::ILOpCodes OMR::ILOpCode::getMulOpCode< double>() { retur
14851480

14861481
template <> inline TR::ILOpCodes OMR::ILOpCode::getNegOpCode< int8_t>() { return TR::bneg; }
14871482
template <> inline TR::ILOpCodes OMR::ILOpCode::getNegOpCode< int16_t>() { return TR::sneg; }
1488-
template <> inline TR::ILOpCodes OMR::ILOpCode::getNegOpCode<uint32_t>() { return TR::iuneg; }
1483+
template <> inline TR::ILOpCodes OMR::ILOpCode::getNegOpCode<uint32_t>() { return TR::ineg; }
14891484
template <> inline TR::ILOpCodes OMR::ILOpCode::getNegOpCode< int32_t>() { return TR::ineg; }
1490-
template <> inline TR::ILOpCodes OMR::ILOpCode::getNegOpCode<uint64_t>() { return TR::luneg; }
1485+
template <> inline TR::ILOpCodes OMR::ILOpCode::getNegOpCode<uint64_t>() { return TR::lneg; }
14911486
template <> inline TR::ILOpCodes OMR::ILOpCode::getNegOpCode< int64_t>() { return TR::lneg; }
14921487
template <> inline TR::ILOpCodes OMR::ILOpCode::getNegOpCode< float>() { return TR::fneg; }
14931488
template <> inline TR::ILOpCodes OMR::ILOpCode::getNegOpCode< double>() { return TR::dneg; }

compiler/optimizer/DebuggingCounters.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2000, 2019 IBM Corp. and others
2+
* Copyright (c) 2000, 2020 IBM Corp. and others
33
*
44
* This program and the accompanying materials are made available under
55
* the terms of the Eclipse Public License 2.0 which accompanies this
@@ -175,9 +175,11 @@ void TR_DebuggingCounters::insertCounter(const char * name, TR::Compilation * co
175175
TR::Node* loadNode = TR::Node::createWithSymRef(node, TR::iuload, 0, counterRef);
176176

177177
TR::Node* addNode =
178-
TR::Node::create(TR::iuadd, 2, loadNode,
178+
179+
TR::Node::create(TR::iadd, 2, loadNode,
179180
TR::Node::create(node, TR::iconst, 0, 1));
180181

182+
181183
TR::TreeTop* incrementTree =
182184
TR::TreeTop::create(comp, TR::Node::createWithSymRef(TR::iustore, 1, 1,
183185
addNode, counterRef));

compiler/optimizer/OMRSimplifierHandlers.cpp

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2000, 2019 IBM Corp. and others
2+
* Copyright (c) 2000, 2020 IBM Corp. and others
33
*
44
* This program and the accompanying materials are made available under
55
* the terms of the Eclipse Public License 2.0 which accompanies this
@@ -1623,8 +1623,6 @@ static bool reduceLongOp(TR::Node * node, TR::Block * block, TR::Simplifier * s,
16231623
case TR::land: newOp = TR::iand; break;
16241624
case TR::lor: newOp = TR::ior; break;
16251625
case TR::lxor: newOp = TR::ixor; break;
1626-
case TR::luadd: newOp = TR::iuadd; isUnsigned = true; break;
1627-
case TR::lusub: newOp = TR::iusub; isUnsigned = true; break;
16281626
case TR::lushr:
16291627
isUnsigned = true;
16301628
case TR::lshr:
@@ -1683,14 +1681,14 @@ static bool reduceLongOp(TR::Node * node, TR::Block * block, TR::Simplifier * s,
16831681
return false;
16841682
if (newConversionOp == TR::BadILOp)
16851683
{
1686-
TR::Node::recreate(node, isUnsigned ? TR::iuneg : TR::ineg);
1684+
TR::Node::recreate(node, TR::ineg);
16871685
TR::Node::recreate(firstChild, TR::l2i);
16881686
}
16891687
else
16901688
{
16911689
TR::Node * temp = TR::Node::create(TR::l2i, 1, firstChild->getFirstChild());
16921690
firstChild->getFirstChild()->decReferenceCount();
1693-
TR::Node::recreate(firstChild, isUnsigned ? TR::iuneg : TR::ineg);
1691+
TR::Node::recreate(firstChild, TR::ineg);
16941692
firstChild->setAndIncChild(0, temp);
16951693
TR::Node::recreate(node, newConversionOp);
16961694
}

0 commit comments

Comments
 (0)