Path: blob/master/runtime/compiler/z/codegen/S390AOTRelocation.hpp
6004 views
/*******************************************************************************1* Copyright (c) 2000, 2020 IBM Corp. and others2*3* This program and the accompanying materials are made available under4* the terms of the Eclipse Public License 2.0 which accompanies this5* distribution and is available at https://www.eclipse.org/legal/epl-2.0/6* or the Apache License, Version 2.0 which accompanies this distribution and7* is available at https://www.apache.org/licenses/LICENSE-2.0.8*9* This Source Code may also be made available under the following10* Secondary Licenses when the conditions for such availability set11* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU12* General Public License, version 2 with the GNU Classpath13* Exception [1] and GNU General Public License, version 2 with the14* OpenJDK Assembly Exception [2].15*16* [1] https://www.gnu.org/software/classpath/license.html17* [2] http://openjdk.java.net/legal/assembly-exception.html18*19* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception20*******************************************************************************/2122#ifndef J9AOTRELOCATION_INCL23#define J9AOTRELOCATION_INCL2425#include "codegen/Relocation.hpp"2627#include "codegen/Instruction.hpp"28#include "runtime/Runtime.hpp"2930namespace TR { class CodeGenerator; }31namespace TR { class Instruction; }32namespace TR { class LabelSymbol; }3334namespace TR {3536class S390Relocation37{38public:39TR_ALLOC(TR_Memory::S390Relocation)4041S390Relocation(TR::Instruction *src,42uint8_t *trg,43TR_ExternalRelocationTargetKind k):44_srcInstruction(src), _relTarget(trg), _kind(k)45{}4647TR::Instruction *getSourceInstruction() {return _srcInstruction;}48void setSourceInstruction(TR::Instruction *i) {_srcInstruction = i;}4950uint8_t *getRelocationTarget() {return _relTarget;}51void setRelocationTarget(uint8_t *t) {_relTarget = t;}5253TR_ExternalRelocationTargetKind getKind() {return _kind;}54void setKind(TR_ExternalRelocationTargetKind k) {_kind = k;}5556virtual void mapRelocation(TR::CodeGenerator *cg) = 0;5758private:59TR::Instruction *_srcInstruction;60uint8_t *_relTarget;61TR_ExternalRelocationTargetKind _kind;62};6364class S390PairedRelocation: public TR::S390Relocation65{66public:67S390PairedRelocation(TR::Instruction *src1,68TR::Instruction *src2,69uint8_t *trg,70TR_ExternalRelocationTargetKind k) :71TR::S390Relocation(src1, trg, k), _src2Instruction(src2)72{}7374TR::Instruction *getSource2Instruction() {return _src2Instruction;}75void setSource2Instruction(TR::Instruction *src) {_src2Instruction = src;}7677virtual void mapRelocation(TR::CodeGenerator *cg);7879private:80TR::Instruction *_src2Instruction;81};8283class S390EncodingRelocation84{85public:86TR_ALLOC(TR_Memory::S390EncodingRelocation)87S390EncodingRelocation(TR_ExternalRelocationTargetKind rt,88TR::SymbolReference *sr,89uintptr_t inlinedSiteIndex = -1)90: _reloType(rt),91_symbolReference(sr),92_inlinedSiteIndex(inlinedSiteIndex) {}9394TR_ExternalRelocationTargetKind _reloType;95TR::SymbolReference* _symbolReference;96uintptr_t _inlinedSiteIndex;9798TR::SymbolReference* getSymbolReference() { return _symbolReference;}99TR::SymbolReference* setSymbolReference(TR::SymbolReference* sr)100{101return _symbolReference = sr;102}103104TR_ExternalRelocationTargetKind getReloType() { return _reloType;}105TR_ExternalRelocationTargetKind setReloType(TR_ExternalRelocationTargetKind rt)106{107return _reloType = rt;108}109110uintptr_t getInlinedSiteIndex() { return _inlinedSiteIndex;}111uintptr_t setInlinedSiteIndex(uintptr_t index)112{113return _inlinedSiteIndex = index;114}115116virtual void addRelocation(TR::CodeGenerator *codeGen, uint8_t *cursor, char* file, uintptr_t line, TR::Node* node);117};118119}120121#endif122123124