Skip to content

Commit

Permalink
Merge pull request #4326 from Akira1Saitoh/aarch64AdminInstruction
Browse files Browse the repository at this point in the history
AArch64: Implement TR::ARM64AdminInstruction::generateBinaryEncoding()
  • Loading branch information
0xdaryl committed Sep 20, 2019
2 parents 8135ba9 + 04f5771 commit 20db4fb
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();
int32_t 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 20db4fb

Please sign in to comment.