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