1 /* src/vm/jit/emit-common.c - common code emitter functions
3 Copyright (C) 2006 R. Grafl, A. Krall, C. Kruegel, C. Oates,
4 R. Obermaisser, M. Platter, M. Probst, S. Ring, E. Steiner,
5 C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich, J. Wenninger,
6 Institut f. Computersprachen - TU Wien
8 This file is part of CACAO.
10 This program is free software; you can redistribute it and/or
11 modify it under the terms of the GNU General Public License as
12 published by the Free Software Foundation; either version 2, or (at
13 your option) any later version.
15 This program is distributed in the hope that it will be useful, but
16 WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
25 Contact: cacao@cacaojvm.org
27 Authors: Christian Thalinger
30 $Id: emitfuncs.c 4398 2006-01-31 23:43:08Z twisti $
41 #include "vm/jit/emit-common.h"
42 #include "vm/jit/jit.h"
45 /* emit_load_s1 ****************************************************************
47 Emits a possible load of the first source operand.
49 *******************************************************************************/
51 s4 emit_load_s1(jitdata *jd, instruction *iptr, s4 tempreg)
56 src = VAROP(iptr->s1);
58 reg = emit_load(jd, iptr, src, tempreg);
64 /* emit_load_s2 ****************************************************************
66 Emits a possible load of the second source operand.
68 *******************************************************************************/
70 s4 emit_load_s2(jitdata *jd, instruction *iptr, s4 tempreg)
75 src = VAROP(iptr->sx.s23.s2);
77 reg = emit_load(jd, iptr, src, tempreg);
83 /* emit_load_s3 ****************************************************************
85 Emits a possible load of the third source operand.
87 *******************************************************************************/
89 s4 emit_load_s3(jitdata *jd, instruction *iptr, s4 tempreg)
94 src = VAROP(iptr->sx.s23.s3);
96 reg = emit_load(jd, iptr, src, tempreg);
102 /* emit_load_s1_low ************************************************************
104 Emits a possible load of the low 32-bits of the first long source
107 *******************************************************************************/
109 #if SIZEOF_VOID_P == 4
110 s4 emit_load_s1_low(jitdata *jd, instruction *iptr, s4 tempreg)
115 src = VAROP(iptr->s1);
117 reg = emit_load_low(jd, iptr, src, tempreg);
124 /* emit_load_s2_low ************************************************************
126 Emits a possible load of the low 32-bits of the second long source
129 *******************************************************************************/
131 #if SIZEOF_VOID_P == 4
132 s4 emit_load_s2_low(jitdata *jd, instruction *iptr, s4 tempreg)
137 src = VAROP(iptr->sx.s23.s2);
139 reg = emit_load_low(jd, iptr, src, tempreg);
146 /* emit_load_s3_low ************************************************************
148 Emits a possible load of the low 32-bits of the third long source
151 *******************************************************************************/
153 #if SIZEOF_VOID_P == 4
154 s4 emit_load_s3_low(jitdata *jd, instruction *iptr, s4 tempreg)
159 src = VAROP(iptr->sx.s23.s3);
161 reg = emit_load_low(jd, iptr, src, tempreg);
168 /* emit_load_s1_high ***********************************************************
170 Emits a possible load of the high 32-bits of the first long source
173 *******************************************************************************/
175 #if SIZEOF_VOID_P == 4
176 s4 emit_load_s1_high(jitdata *jd, instruction *iptr, s4 tempreg)
181 src = VAROP(iptr->s1);
183 reg = emit_load_high(jd, iptr, src, tempreg);
190 /* emit_load_s2_high ***********************************************************
192 Emits a possible load of the high 32-bits of the second long source
195 *******************************************************************************/
197 #if SIZEOF_VOID_P == 4
198 s4 emit_load_s2_high(jitdata *jd, instruction *iptr, s4 tempreg)
203 src = VAROP(iptr->sx.s23.s2);
205 reg = emit_load_high(jd, iptr, src, tempreg);
212 /* emit_load_s3_high ***********************************************************
214 Emits a possible load of the high 32-bits of the third long source
217 *******************************************************************************/
219 #if SIZEOF_VOID_P == 4
220 s4 emit_load_s3_high(jitdata *jd, instruction *iptr, s4 tempreg)
225 src = VAROP(iptr->sx.s23.s3);
227 reg = emit_load_high(jd, iptr, src, tempreg);
234 /* emit_store_dst **************************************************************
236 This function generates the code to store the result of an
237 operation back into a spilled pseudo-variable. If the
238 pseudo-variable has not been spilled in the first place, this
239 function will generate nothing.
241 *******************************************************************************/
243 void emit_store_dst(jitdata *jd, instruction *iptr, s4 d)
245 emit_store(jd, iptr, VAROP(iptr->dst), d);
249 /* emit_array_checks ***********************************************************
251 Emit exception checks for array accesses, if they need to be
254 *******************************************************************************/
256 #if defined(__ALPHA__) || defined(__POWERPC__)
257 void emit_array_checks(codegendata *cd, instruction *iptr, s4 s1, s4 s2)
259 if (INSTRUCTION_MUST_CHECK(iptr)) {
260 emit_nullpointer_check(cd, s1);
261 emit_arrayindexoutofbounds_check(cd, s1, s2);
268 * These are local overrides for various environment variables in Emacs.
269 * Please do not remove this and leave it at the end of the file, where
270 * Emacs will automagically detect them.
271 * ---------------------------------------------------------------------
274 * indent-tabs-mode: t
278 * vim:noexpandtab:sw=4:ts=4: