Path: blob/master/runtime/compiler/p/codegen/PPCPrivateLinkage.hpp
6004 views
/*******************************************************************************1* Copyright (c) 2000, 2019 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 PPC_PRIVATELINKAGE_INCL23#define PPC_PRIVATELINKAGE_INCL2425#include "codegen/LinkageConventionsEnum.hpp"26#include "codegen/PrivateLinkage.hpp"27#include "infra/Assert.hpp"2829class TR_BitVector;30class TR_ResolvedMethod;31namespace TR { class AutomaticSymbol; }32namespace TR { class CodeGenerator; }33namespace TR { class Instruction; }34namespace TR { class MemoryReference; }35namespace TR { class Node; }36namespace TR { class ParameterSymbol; }37namespace TR { class RegisterDependencyConditions; }38namespace TR { class ResolvedMethodSymbol; }3940namespace J941{4243struct PPCPICItem44{45TR_ALLOC(TR_Memory::Linkage);4647PPCPICItem(TR_OpaqueClassBlock *clazz, TR_ResolvedMethod *method, float freq) :48_clazz(clazz), _method(method), _frequency(freq) {}4950TR_OpaqueClassBlock *_clazz;51TR_ResolvedMethod *_method;52float _frequency;53};5455}565758namespace J959{6061namespace Power62{6364class PrivateLinkage : public J9::PrivateLinkage65{66public:6768PrivateLinkage(TR::CodeGenerator *cg);6970virtual const TR::PPCLinkageProperties& getProperties();71virtual uint32_t getRightToLeft();72virtual bool hasToBeOnStack(TR::ParameterSymbol *parm);73virtual void mapStack(TR::ResolvedMethodSymbol *method);74virtual void mapSingleAutomatic(TR::AutomaticSymbol *p, uint32_t &stackIndex);75virtual void initPPCRealRegisterLinkage();76virtual TR::MemoryReference *getOutgoingArgumentMemRef(int32_t argSize, TR::Register *argReg, TR::InstOpCode::Mnemonic opCode, TR::PPCMemoryArgument &memArg, uint32_t len);77virtual TR::MemoryReference *getOutgoingArgumentMemRef(int32_t argSize, TR::Register *argReg, TR::InstOpCode::Mnemonic opCode, TR::PPCMemoryArgument &memArg, uint32_t len, const TR::PPCLinkageProperties& properties);78virtual void setParameterLinkageRegisterIndex(TR::ResolvedMethodSymbol *method);7980virtual void createPrologue(TR::Instruction *cursor);8182virtual void createEpilogue(TR::Instruction *cursor);8384virtual int32_t buildArgs(85TR::Node *callNode,86TR::RegisterDependencyConditions *dependencies);8788virtual void buildVirtualDispatch(89TR::Node *callNode,90TR::RegisterDependencyConditions *dependencies,91uint32_t sizeOfArguments);9293protected:9495TR::PPCLinkageProperties _properties;9697int32_t buildPrivateLinkageArgs(98TR::Node *callNode,99TR::RegisterDependencyConditions *dependencies,100TR_LinkageConventions linkage);101102void buildDirectCall(103TR::Node *callNode,104TR::SymbolReference *callSymRef,105TR::RegisterDependencyConditions *dependencies,106const TR::PPCLinkageProperties &pp,107int32_t argSize);108109virtual TR::Register *buildDirectDispatch(TR::Node *callNode);110111virtual TR::Register *buildIndirectDispatch(TR::Node *callNode);112113virtual TR::Register *buildalloca(TR::Node *BIFCallNode);114};115116117class HelperLinkage : public PrivateLinkage118{119public:120121HelperLinkage(TR::CodeGenerator *cg, TR_LinkageConventions helperLinkage) : _helperLinkage(helperLinkage), PrivateLinkage(cg)122{123TR_ASSERT(helperLinkage == TR_Helper || helperLinkage == TR_CHelper, "Unexpected helper linkage convention");124}125126virtual int32_t buildArgs(127TR::Node *callNode,128TR::RegisterDependencyConditions *dependencies);129protected:130131TR_LinkageConventions _helperLinkage;132};133134}135136}137138#endif139140141