Skip to content

Commit

Permalink
AArch64: Implement TR::ARM64AdminInstruction::generateBinaryEncoding()
Browse files Browse the repository at this point in the history
This commit adds implementation of
TR::ARM64AdminInstruction::generateBinaryEncoding().

Signed-off-by: Akira Saitoh <[email protected]>
  • Loading branch information
Akira Saitoh committed Sep 18, 2019
1 parent 54fb162 commit 4a6a921
Showing 1 changed file with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions compiler/aarch64/codegen/ARM64BinaryEncoding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -268,10 +268,33 @@ uint8_t *TR::ARM64AdminInstruction::generateBinaryEncoding()
{
uint8_t *instructionStart = cg()->getBinaryBufferCursor();
TR::InstOpCode::Mnemonic op = getOpCodeValue();
int i;

if (op != OMR::InstOpCode::proc && op != OMR::InstOpCode::fence && op != OMR::InstOpCode::retn)
if (op == OMR::InstOpCode::fence)
{
TR_ASSERT(false, "Unsupported opcode in AdminInstruction.");
TR::Node *fenceNode = getFenceNode();
uint32_t rtype = fenceNode->getRelocationType();
if (rtype == TR_AbsoluteAddress)
{
for (i = 0; i < fenceNode->getNumRelocations(); i++)
{
*(uint8_t **)(fenceNode->getRelocationDestination(i)) = instructionStart;
}
}
else if (rtype == TR_EntryRelative16Bit)
{
for (i = 0; i < fenceNode->getNumRelocations(); i++)
{
*(uint16_t *)(fenceNode->getRelocationDestination(i)) = (uint16_t)cg()->getCodeLength();
}
}
else // TR_EntryRelative32Bit
{
for (i = 0; i < fenceNode->getNumRelocations(); i++)
{
*(uint32_t *)(fenceNode->getRelocationDestination(i)) = cg()->getCodeLength();
}
}
}

setBinaryLength(0);
Expand Down

0 comments on commit 4a6a921

Please sign in to comment.