CACAO
Aarch64Register.hpp
Go to the documentation of this file.
1 /* src/vm/jit/compiler2/aarch64/Aarch64Register.hpp
2 
3  Copyright (C) 2013
4  CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
5 
6  This file is part of CACAO.
7 
8  This program is free software; you can redistribute it and/or
9  modify it under the terms of the GNU General Public License as
10  published by the Free Software Foundation; either version 2, or (at
11  your option) any later version.
12 
13  This program is distributed in the hope that it will be useful, but
14  WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with this program; if not, write to the Free Software
20  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21  02110-1301, USA.
22 
23 */
24 
25 #ifndef _JIT_COMPILER2_AARCH64_REGISTER
26 #define _JIT_COMPILER2_AARCH64_REGISTER
27 
30 
31 namespace cacao {
32 namespace jit {
33 namespace compiler2 {
34 namespace aarch64 {
35 
36 
38 public:
39  const unsigned index;
40  const char* name;
43 
44  Aarch64Register(const char* name, unsigned index,
47  : index(index), name(name), offset(offset), size(size) {}
48 
49  unsigned get_index() const {
50  return index;
51  }
52 
53  virtual MachineOperand::IdentifyTy id_base() const = 0;
55  virtual MachineOperand::IdentifySizeTy id_size() const { return size; }
56 };
57 
58 
59 /**
60  * This represents a machine register usage.
61  *
62  * It consists of a reference to the physical register and a type. This
63  * abstraction is needed because registers can be used several times
64  * with different types, e.g. x0 and w0
65  */
67 private:
70 
71 public:
74  return this;
75  }
77  return reg;
78  }
79  virtual IdentifyTy id_base() const { return reg->id_base(); }
80  virtual IdentifyOffsetTy id_offset() const { return reg->id_offset(); }
81  virtual IdentifySizeTy id_size() const { return reg->id_size(); }
82 };
83 
84 
85 class GPRegister : public Aarch64Register {
86 private:
87  static const uint8_t base;
88 
89 public:
90  GPRegister(const char* name, unsigned index,
93  : Aarch64Register(name, index, offset, size) {}
94 
96  return static_cast<const void*>(&base);
97  }
98 };
99 
100 
101 class FPRegister : public Aarch64Register {
102 private:
103  static const uint8_t base;
104 
105 public:
106  FPRegister(const char* name, unsigned index,
109  : Aarch64Register(name, index, offset, size) {}
110 
112  return static_cast<const void*>(&base);
113  }
114 };
115 
116 
117 extern GPRegister R0;
118 extern GPRegister R1;
119 extern GPRegister R2;
120 extern GPRegister R3;
121 extern GPRegister R4;
122 extern GPRegister R5;
123 extern GPRegister R6;
124 extern GPRegister R7;
125 extern GPRegister R8;
126 extern GPRegister R9;
148 extern GPRegister SP;
149 
150 extern FPRegister V0;
151 extern FPRegister V1;
152 extern FPRegister V2;
153 extern FPRegister V3;
154 extern FPRegister V4;
155 extern FPRegister V5;
156 extern FPRegister V6;
157 extern FPRegister V7;
158 extern FPRegister V8;
159 extern FPRegister V9;
182 
183 const std::size_t IntegerArgumentRegisterSize = 8;
185 
186 const std::size_t FloatArgumentRegisterSize = 8;
188 
189 template <class A,class B>
190 inline A* cast_to(B*);
191 
192 template <class A,A>
193 inline A* cast_to(A* a) {
194  assert(a);
195  return a;
196 }
197 
198 template <>
200  Register* reg = op->to_Register();
201  assert(reg);
202  MachineRegister *mreg = reg->to_MachineRegister();
203  assert(mreg);
204  NativeRegister *nreg = mreg->to_NativeRegister();
205  assert(nreg);
206  Aarch64Register *areg = nreg->get_Aarch64Register();
207  assert(areg);
208  return areg;
209 }
210 
211 } // end namespace aarch64
212 } // end namespace compiler2
213 } // end namespace jit
214 } // end namespace cacao
215 
216 #endif // _JIT_COMPILER2_AARCH64_REGISTER
217 
218 /*
219  * These are local overrides for various environment variables in Emacs.
220  * Please do not remove this and leave it at the end of the file, where
221  * Emacs will automagically detect them.
222  * ---------------------------------------------------------------------
223  * Local variables:
224  * mode: c++
225  * indent-tabs-mode: t
226  * c-basic-offset: 4
227  * tab-width: 4
228  * End:
229  * vim:noexpandtab:sw=4:ts=4:
230  */
FPRegister V30("V30", 30, 30 *16, 16)
GPRegister R4("R4", 4, 4 *8, 8)
FPRegister V15("V15", 15, 15 *16, 16)
FPRegister V12("V12", 12, 12 *16, 16)
const std::size_t FloatArgumentRegisterSize
FPRegister V11("V11", 11, 11 *16, 16)
GPRegister R12("R12", 12, 12 *8, 8)
GPRegister R21("R21", 21, 21 *8, 8)
FPRegister V28("V28", 28, 28 *16, 16)
GPRegister R24("R24", 24, 24 *8, 8)
GPRegister R22("R22", 22, 22 *8, 8)
GPRegister R13("R13", 13, 13 *8, 8)
FPRegister V17("V17", 17, 17 *16, 16)
FPRegister V31("V31", 31, 31 *16, 16)
u2 op
Definition: disass.cpp:129
FPRegister V27("V27", 27, 27 *16, 16)
virtual IdentifyOffsetTy id_offset() const
GPRegister R11("R11", 11, 11 *8, 8)
FPRegister V2("V2", 2, 2 *16, 16)
virtual MachineOperand::IdentifyTy id_base() const
virtual MachineOperand::IdentifyOffsetTy id_offset() const
const std::size_t IntegerArgumentRegisterSize
FPRegister V23("V23", 23, 23 *16, 16)
GPRegister R20("R20", 20, 20 *8, 8)
FPRegister V13("V13", 13, 13 *16, 16)
FPRegister V22("V22", 22, 22 *16, 16)
JNIEnv jclass jobject const char * name
Definition: jvmti.h:312
GPRegister R6("R6", 6, 6 *8, 8)
virtual MachineOperand::IdentifyTy id_base() const =0
virtual MachineOperand::IdentifyTy id_base() const
FPRegister V19("V19", 19, 19 *16, 16)
JNIEnv jthread jobject jclass jlong size
Definition: jvmti.h:387
FPRegister V5("V5", 5, 5 *16, 16)
GPRegister R1("R1", 1, 1 *8, 8)
FPRegister V18("V18", 18, 18 *16, 16)
GPRegister R10("R10", 10, 10 *8, 8)
GPRegister R26("R26", 26, 26 *8, 8)
FPRegister(const char *name, unsigned index, MachineOperand::IdentifyOffsetTy offset, MachineOperand::IdentifySizeTy size)
FPRegister V9("V9", 9, 9 *16, 16)
Aarch64Register * cast_to< Aarch64Register >(MachineOperand *op)
GPRegister R15("R15", 15, 15 *8, 8)
GPRegister R9("R9", 9, 9 *8, 8)
GPRegister SP("SP", 31, 31 *8, 8)
FPRegister V3("V3", 3, 3 *16, 16)
NativeRegister(Type::TypeID type, Aarch64Register *reg)
FPRegister V8("V8", 8, 8 *16, 16)
FPRegister V0("V0", 0, 0 *16, 16)
GPRegister R28("R28", 28, 28 *8, 8)
GPRegister R17("R17", 17, 17 *8, 8)
const MachineOperand::IdentifyOffsetTy offset
FPRegister V29("V29", 29, 29 *16, 16)
GPRegister R23("R23", 23, 23 *8, 8)
FPRegister V26("V26", 26, 26 *16, 16)
GPRegister R30("R30", 30, 30 *8, 8)
GPRegister R14("R14", 14, 14 *8, 8)
GPRegister R29("R29", 29, 29 *8, 8)
FPRegister V16("V16", 16, 16 *16, 16)
virtual MachineRegister * to_MachineRegister()
FPRegister V10("V10", 10, 10 *16, 16)
This represents a machine register usage.
GPRegister(const char *name, unsigned index, MachineOperand::IdentifyOffsetTy offset, MachineOperand::IdentifySizeTy size)
GPRegister R2("R2", 2, 2 *8, 8)
FPRegister V1("V1", 1, 1 *16, 16)
GPRegister R8("R8", 8, 8 *8, 8)
Aarch64Register(const char *name, unsigned index, MachineOperand::IdentifyOffsetTy offset, MachineOperand::IdentifySizeTy size)
FPRegister V6("V6", 6, 6 *16, 16)
GPRegister R0("R0", 0, 0 *8, 8)
FPRegister V20("V20", 20, 20 *16, 16)
virtual NativeRegister * to_NativeRegister()=0
Operands that can be directly used by the machine (register, memory, stackslot)
GPRegister R5("R5", 5, 5 *8, 8)
GPRegister R3("R3", 3, 3 *8, 8)
GPRegister R16("R16", 16, 16 *8, 8)
FPRegister V7("V7", 7, 7 *16, 16)
GPRegister R19("R19", 19, 19 *8, 8)
FPRegister V24("V24", 24, 24 *16, 16)
FPRegister V4("V4", 4, 4 *16, 16)
GPRegister R7("R7", 7, 7 *8, 8)
GPRegister R18("R18", 18, 18 *8, 8)
virtual MachineOperand::IdentifySizeTy id_size() const
FPRegister V25("V25", 25, 25 *16, 16)
FPRegister V14("V14", 14, 14 *16, 16)
GPRegister R27("R27", 27, 27 *8, 8)
FPRegister V21("V21", 21, 21 *16, 16)
const MachineOperand::IdentifySizeTy size
GPRegister R25("R25", 25, 25 *8, 8)