From a32deed8e21bfdd1962dd05f17ca1f1699ebbd86 Mon Sep 17 00:00:00 2001 From: Akira Saitoh Date: Tue, 14 Jan 2020 16:10:59 +0900 Subject: [PATCH] AArch64: Add generateNop to code generator This commit adds `generateNop` function to OMR::ARM64::CodeGenerator. Signed-off-by: Akira Saitoh --- compiler/aarch64/codegen/OMRCodeGenerator.cpp | 11 ++++++++++- compiler/aarch64/codegen/OMRCodeGenerator.hpp | 9 ++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/compiler/aarch64/codegen/OMRCodeGenerator.cpp b/compiler/aarch64/codegen/OMRCodeGenerator.cpp index 86865ebb18..c91e3ab224 100644 --- a/compiler/aarch64/codegen/OMRCodeGenerator.cpp +++ b/compiler/aarch64/codegen/OMRCodeGenerator.cpp @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2018, 2019 IBM Corp. and others + * Copyright (c) 2018, 2020 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -534,3 +534,12 @@ OMR::ARM64::CodeGenerator::directCallRequiresTrampoline(intptrj_t targetAddress, !self()->comp()->target().cpu.isTargetWithinUnconditionalBranchImmediateRange(targetAddress, sourceAddress) || self()->comp()->getOption(TR_StressTrampolines); } + +TR::Instruction * +OMR::ARM64::CodeGenerator::generateNop(TR::Node *node, TR::Instruction *preced) + { + if (preced) + return new (self()->trHeapMemory()) TR::Instruction(TR::InstOpCode::nop, node, preced, self()); + else + return new (self()->trHeapMemory()) TR::Instruction(TR::InstOpCode::nop, node, self()); + } diff --git a/compiler/aarch64/codegen/OMRCodeGenerator.hpp b/compiler/aarch64/codegen/OMRCodeGenerator.hpp index 6fba199bc2..1d66af4842 100644 --- a/compiler/aarch64/codegen/OMRCodeGenerator.hpp +++ b/compiler/aarch64/codegen/OMRCodeGenerator.hpp @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2018, 2019 IBM Corp. and others + * Copyright (c) 2018, 2020 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -393,6 +393,13 @@ class OMR_EXTENSIBLE CodeGenerator : public OMR::CodeGenerator */ void generateBinaryEncodingPrePrologue(TR_ARM64BinaryEncodingData &data); + /** + * @brief Generates nop + * @param[in] node: node + * @param[in] preced : preceding instruction + */ + TR::Instruction *generateNop(TR::Node *node, TR::Instruction *preced = 0); + private: enum // flags