Skip to content

Commit

Permalink
AArch64: Implement aladdEvaluator()
Browse files Browse the repository at this point in the history
This commit implements aladdEvaluator() for AArch64.

Signed-off-by: KONNO Kazuhiro <konno@jp.ibm.com>
  • Loading branch information
knn-k committed Jul 18, 2019
1 parent 4d46973 commit fad8eca
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 3 deletions.
46 changes: 45 additions & 1 deletion compiler/aarch64/codegen/BinaryEvaluator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include "codegen/TreeEvaluator.hpp"
#include "il/Node.hpp"
#include "il/Node_inlines.hpp"
#include "il/symbol/AutomaticSymbol.hpp"
#include "infra/Bit.hpp"

/**
Expand Down Expand Up @@ -247,7 +248,7 @@ OMR::ARM64::TreeEvaluator::imulEvaluator(TR::Node *node, TR::CodeGenerator *cg)

if (secondChild->getOpCode().isLoadConst() && secondChild->getRegister() == NULL)
{
mulConstant32(node, trgReg, src1Reg, value, cg);
mulConstant32(node, trgReg, src1Reg, value, cg);
}
else
{
Expand Down Expand Up @@ -612,3 +613,46 @@ OMR::ARM64::TreeEvaluator::lxorEvaluator(TR::Node *node, TR::CodeGenerator *cg)
// boolean xor of 2 integers
return genericBinaryEvaluator(node, TR::InstOpCode::eorx, TR::InstOpCode::eorimmx, true, cg);
}

// Also handles TR::aluadd
TR::Register *
OMR::ARM64::TreeEvaluator::aladdEvaluator(TR::Node *node, TR::CodeGenerator *cg)
{
TR::Register *trgReg = laddEvaluator(node, cg);

if (node->isInternalPointer())
{
if (node->getPinningArrayPointer())
{
trgReg->setContainsInternalPointer();
trgReg->setPinningArrayPointer(node->getPinningArrayPointer());
}
else
{
TR::Node *firstChild = node->getFirstChild();
if ((firstChild->getOpCodeValue() == TR::aload) &&
firstChild->getSymbolReference()->getSymbol()->isAuto() &&
firstChild->getSymbolReference()->getSymbol()->isPinningArrayPointer())
{
trgReg->setContainsInternalPointer();

if (!firstChild->getSymbolReference()->getSymbol()->isInternalPointer())
{
trgReg->setPinningArrayPointer(firstChild->getSymbolReference()->getSymbol()->castToAutoSymbol());
}
else
{
trgReg->setPinningArrayPointer(firstChild->getSymbolReference()->getSymbol()->castToInternalPointerAutoSymbol()->getPinningArrayPointer());
}
}
else if (firstChild->getRegister() &&
firstChild->getRegister()->containsInternalPointer())
{
trgReg->setContainsInternalPointer();
trgReg->setPinningArrayPointer(firstChild->getRegister()->getPinningArrayPointer());
}
}
}

return trgReg;
}
4 changes: 2 additions & 2 deletions compiler/aarch64/codegen/OMRTreeEvaluatorTable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -614,8 +614,8 @@
TR::TreeEvaluator::unImpOpEvaluator , // TODO:ARM64: Enable when Implemented: TR::TreeEvaluator::caddEvaluator , // TR::cadd // add 2 unsigned short integers
TR::TreeEvaluator::unImpOpEvaluator , // TODO:ARM64: Enable when Implemented: TR::TreeEvaluator::aiaddEvaluator , // TR::aiadd // add integer to address with address result (child1 a; child2 i)
TR::TreeEvaluator::unImpOpEvaluator , // TODO:ARM64: Enable when Implemented: TR::TreeEvaluator::aiuaddEvaluator , // TR::aiuadd // add unsigned integer to address with address result (child1 a; child2 i)
TR::TreeEvaluator::unImpOpEvaluator , // TODO:ARM64: Enable when Implemented: TR::TreeEvaluator::aladdEvaluator , // TR::aladd // add long integer to address with address result (child1 a; child2 i) (64-bit only)
TR::TreeEvaluator::unImpOpEvaluator , // TODO:ARM64: Enable when Implemented: TR::TreeEvaluator::aluaddEvaluator , // TR::aluadd // add unsigned long integer to address with address result (child1 a; child2 i) (64-bit only)
TR::TreeEvaluator::aladdEvaluator, // TR::aladd // add long integer to address with address result (child1 a; child2 i) (64-bit only)
TR::TreeEvaluator::aladdEvaluator, // TR::aluadd // add unsigned long integer to address with address result (child1 a; child2 i) (64-bit only)
TR::TreeEvaluator::unImpOpEvaluator , // TODO:ARM64: Enable when Implemented: TR::TreeEvaluator::lusubhEvaluator , // TR::lusubh // subtract 2 unsigned long integers (the high parts of prior lusub) as high part of 128bit subtraction.
TR::TreeEvaluator::unImpOpEvaluator , // TODO:ARM64: Enable when Implemented: TR::TreeEvaluator::csubEvaluator , // TR::csub // subtract 2 unsigned short integers (child1 - child2)
TR::TreeEvaluator::imulhEvaluator, // TR::imulh // multiply 2 integers; and return the high word of the product
Expand Down

0 comments on commit fad8eca

Please sign in to comment.