From 04f577135a6a1c17d78061329f36f81a63cae584 Mon Sep 17 00:00:00 2001 From: Akira Saitoh Date: Wed, 18 Sep 2019 14:22:48 +0900 Subject: [PATCH] AArch64: Implement TR::ARM64AdminInstruction::generateBinaryEncoding() This commit adds implementation of TR::ARM64AdminInstruction::generateBinaryEncoding(). Signed-off-by: Akira Saitoh --- .../aarch64/codegen/ARM64BinaryEncoding.cpp | 27 +++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/compiler/aarch64/codegen/ARM64BinaryEncoding.cpp b/compiler/aarch64/codegen/ARM64BinaryEncoding.cpp index 300cf92ca5..c5f67c5ddb 100644 --- a/compiler/aarch64/codegen/ARM64BinaryEncoding.cpp +++ b/compiler/aarch64/codegen/ARM64BinaryEncoding.cpp @@ -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);