CACAO
Aarch64MachineMethodDescriptor.hpp
Go to the documentation of this file.
1 /* src/vm/jit/compiler2/aarch64/Aarch64MachineMethodDescriptor.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_MACHINEMETHODDESCRIPTOR
26 #define _JIT_COMPILER2_AARCH64_MACHINEMETHODDESCRIPTOR
27 
31 
32 namespace cacao {
33 namespace jit {
34 namespace compiler2 {
35 namespace aarch64 {
36 
38 private:
41 
42 public:
44  : md(md), parameter(md.size()) {
45  unsigned int_argument_counter = 0;
46  unsigned float_argument_counter = 0;
47  int stackslot_index = 2;
48 
49  for (unsigned i = 0, e = md.size(); i < e; ++i) {
50  Type::TypeID type = md[i];
51  switch (type) {
52  case Type::IntTypeID:
53  case Type::LongTypeID:
55  if (int_argument_counter < IntegerArgumentRegisterSize) {
56  parameter[i]= new NativeRegister(type,
57  IntegerArgumentRegisters[int_argument_counter]);
58  } else {
59  parameter[i]= new StackSlot(stackslot_index,type);
60  stackslot_index++;
61  }
62  int_argument_counter++;
63  break;
64  case Type::FloatTypeID:
65  case Type::DoubleTypeID:
66  if (float_argument_counter < FloatArgumentRegisterSize) {
67  parameter[i]= new NativeRegister(type,
68  FloatArgumentRegisters[float_argument_counter]);
69  } else {
70  parameter[i]= new StackSlot(stackslot_index,type);
71  stackslot_index++;
72  }
73  float_argument_counter++;
74  break;
75  default:
76  ABORT_MSG("Aarch64 MachineMethodDescriptor: Type not yet "
77  "supported!", "Type: " << type);
78  }
79  }
80  }
81  MachineOperand* operator[](unsigned index) const {
82  assert(index < parameter.size());
83  return parameter[index];
84  }
85  friend OStream& operator<<(OStream &os, const MachineMethodDescriptor &mmd);
86 };
87 
90  if (!mmd) {
91  return os << "(Aarch64MachineMethodDescriptor) NULL";
92  }
93  return os << *mmd;
94 }
95 
96 } // end namespace aarch64
97 } // end namespace compiler2
98 } // end namespace jit
99 } // end namespace cacao
100 
101 #endif /* _JIT_COMPILER2_AARCH64_MACHINEMETHODDESCRIPTOR */
102 
103 
104 /*
105  * These are local overrides for various environment variables in Emacs.
106  * Please do not remove this and leave it at the end of the file, where
107  * Emacs will automagically detect them.
108  * ---------------------------------------------------------------------
109  * Local variables:
110  * mode: c++
111  * indent-tabs-mode: t
112  * c-basic-offset: 4
113  * tab-width: 4
114  * End:
115  * vim:noexpandtab:sw=4:ts=4:
116  */
std::size_t index
const std::size_t FloatArgumentRegisterSize
Definition: os.hpp:123
OStream & operator<<(OStream &os, const MachineMethodDescriptor &mmd)
const std::size_t IntegerArgumentRegisterSize
JNIEnv jthread jobject jclass jlong size
Definition: jvmti.h:387
std::vector< T, Allocator< T > > type
Definition: vector.hpp:38
Simple stream class for formatted output.
Definition: OStream.hpp:141
MIIterator i
MIIterator e
Operands that can be directly used by the machine (register, memory, stackslot)
aarch64::NativeRegister NativeRegister
Definition: Target.hpp:42
friend OStream & operator<<(OStream &os, const MachineMethodDescriptor &mmd)
#define ABORT_MSG(EXPR_SHORT, EXPR_LONG)
Definition: logging.hpp:133
MethodDescriptor TODO: more info.