Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openj9
Path: blob/master/runtime/compiler/p/codegen/PPCPrivateLinkage.hpp
6004 views
1
/*******************************************************************************
2
* Copyright (c) 2000, 2019 IBM Corp. and others
3
*
4
* This program and the accompanying materials are made available under
5
* the terms of the Eclipse Public License 2.0 which accompanies this
6
* distribution and is available at https://www.eclipse.org/legal/epl-2.0/
7
* or the Apache License, Version 2.0 which accompanies this distribution and
8
* is available at https://www.apache.org/licenses/LICENSE-2.0.
9
*
10
* This Source Code may also be made available under the following
11
* Secondary Licenses when the conditions for such availability set
12
* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU
13
* General Public License, version 2 with the GNU Classpath
14
* Exception [1] and GNU General Public License, version 2 with the
15
* OpenJDK Assembly Exception [2].
16
*
17
* [1] https://www.gnu.org/software/classpath/license.html
18
* [2] http://openjdk.java.net/legal/assembly-exception.html
19
*
20
* 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-exception
21
*******************************************************************************/
22
23
#ifndef PPC_PRIVATELINKAGE_INCL
24
#define PPC_PRIVATELINKAGE_INCL
25
26
#include "codegen/LinkageConventionsEnum.hpp"
27
#include "codegen/PrivateLinkage.hpp"
28
#include "infra/Assert.hpp"
29
30
class TR_BitVector;
31
class TR_ResolvedMethod;
32
namespace TR { class AutomaticSymbol; }
33
namespace TR { class CodeGenerator; }
34
namespace TR { class Instruction; }
35
namespace TR { class MemoryReference; }
36
namespace TR { class Node; }
37
namespace TR { class ParameterSymbol; }
38
namespace TR { class RegisterDependencyConditions; }
39
namespace TR { class ResolvedMethodSymbol; }
40
41
namespace J9
42
{
43
44
struct PPCPICItem
45
{
46
TR_ALLOC(TR_Memory::Linkage);
47
48
PPCPICItem(TR_OpaqueClassBlock *clazz, TR_ResolvedMethod *method, float freq) :
49
_clazz(clazz), _method(method), _frequency(freq) {}
50
51
TR_OpaqueClassBlock *_clazz;
52
TR_ResolvedMethod *_method;
53
float _frequency;
54
};
55
56
}
57
58
59
namespace J9
60
{
61
62
namespace Power
63
{
64
65
class PrivateLinkage : public J9::PrivateLinkage
66
{
67
public:
68
69
PrivateLinkage(TR::CodeGenerator *cg);
70
71
virtual const TR::PPCLinkageProperties& getProperties();
72
virtual uint32_t getRightToLeft();
73
virtual bool hasToBeOnStack(TR::ParameterSymbol *parm);
74
virtual void mapStack(TR::ResolvedMethodSymbol *method);
75
virtual void mapSingleAutomatic(TR::AutomaticSymbol *p, uint32_t &stackIndex);
76
virtual void initPPCRealRegisterLinkage();
77
virtual TR::MemoryReference *getOutgoingArgumentMemRef(int32_t argSize, TR::Register *argReg, TR::InstOpCode::Mnemonic opCode, TR::PPCMemoryArgument &memArg, uint32_t len);
78
virtual TR::MemoryReference *getOutgoingArgumentMemRef(int32_t argSize, TR::Register *argReg, TR::InstOpCode::Mnemonic opCode, TR::PPCMemoryArgument &memArg, uint32_t len, const TR::PPCLinkageProperties& properties);
79
virtual void setParameterLinkageRegisterIndex(TR::ResolvedMethodSymbol *method);
80
81
virtual void createPrologue(TR::Instruction *cursor);
82
83
virtual void createEpilogue(TR::Instruction *cursor);
84
85
virtual int32_t buildArgs(
86
TR::Node *callNode,
87
TR::RegisterDependencyConditions *dependencies);
88
89
virtual void buildVirtualDispatch(
90
TR::Node *callNode,
91
TR::RegisterDependencyConditions *dependencies,
92
uint32_t sizeOfArguments);
93
94
protected:
95
96
TR::PPCLinkageProperties _properties;
97
98
int32_t buildPrivateLinkageArgs(
99
TR::Node *callNode,
100
TR::RegisterDependencyConditions *dependencies,
101
TR_LinkageConventions linkage);
102
103
void buildDirectCall(
104
TR::Node *callNode,
105
TR::SymbolReference *callSymRef,
106
TR::RegisterDependencyConditions *dependencies,
107
const TR::PPCLinkageProperties &pp,
108
int32_t argSize);
109
110
virtual TR::Register *buildDirectDispatch(TR::Node *callNode);
111
112
virtual TR::Register *buildIndirectDispatch(TR::Node *callNode);
113
114
virtual TR::Register *buildalloca(TR::Node *BIFCallNode);
115
};
116
117
118
class HelperLinkage : public PrivateLinkage
119
{
120
public:
121
122
HelperLinkage(TR::CodeGenerator *cg, TR_LinkageConventions helperLinkage) : _helperLinkage(helperLinkage), PrivateLinkage(cg)
123
{
124
TR_ASSERT(helperLinkage == TR_Helper || helperLinkage == TR_CHelper, "Unexpected helper linkage convention");
125
}
126
127
virtual int32_t buildArgs(
128
TR::Node *callNode,
129
TR::RegisterDependencyConditions *dependencies);
130
protected:
131
132
TR_LinkageConventions _helperLinkage;
133
};
134
135
}
136
137
}
138
139
#endif
140
141