X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=src%2Fvm%2Fjit%2Femit-common.h;h=11ba8f33038dbf1694fe302b9fafc0bc85fbda0b;hb=8694d1a5045f9839565eae82d3cced3bf6a8ecda;hp=43f0431326baf455aab74654939094323d8242cf;hpb=c839ffac68edcb98b039821b1ad9ab8b798d7514;p=cacao.git diff --git a/src/vm/jit/emit-common.h b/src/vm/jit/emit-common.h index 43f043132..11ba8f330 100644 --- a/src/vm/jit/emit-common.h +++ b/src/vm/jit/emit-common.h @@ -1,9 +1,9 @@ /* src/vm/jit/emit-common.h - common code emitter functions - Copyright (C) 1996-2005, 2006 R. Grafl, A. Krall, C. Kruegel, - C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring, - E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich, - J. Wenninger, Institut f. Computersprachen - TU Wien + Copyright (C) 2006, 2007 R. Grafl, A. Krall, C. Kruegel, C. Oates, + R. Obermaisser, M. Platter, M. Probst, S. Ring, E. Steiner, + C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich, J. Wenninger, + Institut f. Computersprachen - TU Wien This file is part of CACAO. @@ -22,23 +22,29 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - Contact: cacao@cacaojvm.org +*/ - Authors: Christian Thalinger - Changes: +#ifndef _EMIT_COMMON_H +#define _EMIT_COMMON_H - $Id: emitfuncs.c 4398 2006-01-31 23:43:08Z twisti $ +#include "config.h" +#include "vm/types.h" -*/ +#include "arch.h" +#include "vm/jit/codegen-common.h" +#include "vm/jit/jit.h" -#ifndef _EMIT_H -#define _EMIT_H -#include "vm/types.h" +/* branch labels **************************************************************/ -#include "vm/jit/jit.h" +#define BRANCH_LABEL_1 1 +#define BRANCH_LABEL_2 2 +#define BRANCH_LABEL_3 3 +#define BRANCH_LABEL_4 4 +#define BRANCH_LABEL_5 5 +#define BRANCH_LABEL_6 6 /* constant range macros ******************************************************/ @@ -56,6 +62,9 @@ # define IS_IMM8(c) \ (((s4) (c) >= -128) && ((s4) (c) <= 127)) +# define IS_IMM16(c) \ + (((s4) (c) >= -32768) && ((s4) (c) <= 32767)) + #endif @@ -86,26 +95,98 @@ void emit_store_low(jitdata *jd, instruction *iptr, varinfo *dst, s4 d); void emit_store_high(jitdata *jd, instruction *iptr, varinfo *dst, s4 d); #endif -void emit_copy(jitdata *jd, instruction *iptr, varinfo *src, varinfo *dst); +void emit_copy(jitdata *jd, instruction *iptr); void emit_iconst(codegendata *cd, s4 d, s4 value); void emit_lconst(codegendata *cd, s4 d, s8 value); -void emit_arithmetic_check(codegendata *cd, s4 reg); -void emit_arrayindexoutofbounds_check(codegendata *cd, s4 s1, s4 s2); -void emit_arraystore_check(codegendata *cd, s4 reg); -void emit_classcast_check(codegendata *cd, s4 condition, s4 reg, s4 s1); -void emit_nullpointer_check(codegendata *cd, s4 reg); -void emit_exception_check(codegendata *cd); +/* branch-emitting functions */ +void emit_bccz(codegendata *cd, basicblock *target, s4 condition, s4 reg, u4 options); +void emit_bcc(codegendata *cd, basicblock *target, s4 condition, u4 options); + +/* wrapper for unconditional branches */ +void emit_br(codegendata *cd, basicblock *target); + +/* wrappers for branches on one integer register */ + +#if SUPPORT_BRANCH_CONDITIONAL_ONE_INTEGER_REGISTER +void emit_beqz(codegendata *cd, basicblock *target, s4 reg); +void emit_bnez(codegendata *cd, basicblock *target, s4 reg); +void emit_bltz(codegendata *cd, basicblock *target, s4 reg); +void emit_bgez(codegendata *cd, basicblock *target, s4 reg); +void emit_bgtz(codegendata *cd, basicblock *target, s4 reg); +void emit_blez(codegendata *cd, basicblock *target, s4 reg); +#endif + +/* wrappers for branches on two integer registers */ + +#if SUPPORT_BRANCH_CONDITIONAL_TWO_INTEGER_REGISTERS +void emit_beq(codegendata *cd, basicblock *target, s4 s1, s4 s2); +void emit_bne(codegendata *cd, basicblock *target, s4 s1, s4 s2); +#endif + +/* wrappers for branches on condition codes */ + +#if SUPPORT_BRANCH_CONDITIONAL_CONDITION_REGISTER +void emit_beq(codegendata *cd, basicblock *target); +void emit_bne(codegendata *cd, basicblock *target); +void emit_blt(codegendata *cd, basicblock *target); +void emit_bge(codegendata *cd, basicblock *target); +void emit_bgt(codegendata *cd, basicblock *target); +void emit_ble(codegendata *cd, basicblock *target); +#endif + +#if SUPPORT_BRANCH_CONDITIONAL_UNSIGNED_CONDITIONS +void emit_bult(codegendata *cd, basicblock *target); +void emit_bule(codegendata *cd, basicblock *target); +void emit_buge(codegendata *cd, basicblock *target); +void emit_bugt(codegendata *cd, basicblock *target); +#endif + +#if defined(__POWERPC__) || defined(__POWERPC64__) +void emit_bnan(codegendata *cd, basicblock *target); +#endif + +/* label-branches */ +void emit_label_bccz(codegendata *cd, s4 label, s4 condition, s4 reg, u4 options); +void emit_label(codegendata *cd, s4 label); +void emit_label_bcc(codegendata *cd, s4 label, s4 condition, u4 options); + +void emit_label_br(codegendata *cd, s4 label); + +#if SUPPORT_BRANCH_CONDITIONAL_ONE_INTEGER_REGISTER +void emit_label_beqz(codegendata *cd, s4 label, s4 reg); +#endif + +#if SUPPORT_BRANCH_CONDITIONAL_CONDITION_REGISTER +void emit_label_beq(codegendata *cd, s4 label); +void emit_label_bne(codegendata *cd, s4 label); +void emit_label_blt(codegendata *cd, s4 label); +void emit_label_bge(codegendata *cd, s4 label); +void emit_label_bgt(codegendata *cd, s4 label); +void emit_label_ble(codegendata *cd, s4 label); +#endif + +/* machine dependent branch-emitting function */ +void emit_branch(codegendata *cd, s4 disp, s4 condition, s4 reg, u4 options); + +void emit_arithmetic_check(codegendata *cd, instruction *iptr, s4 reg); +void emit_arrayindexoutofbounds_check(codegendata *cd, instruction *iptr, s4 s1, s4 s2); +void emit_arraystore_check(codegendata *cd, instruction *iptr); +void emit_classcast_check(codegendata *cd, instruction *iptr, s4 condition, s4 reg, s4 s1); +void emit_nullpointer_check(codegendata *cd, instruction *iptr, s4 reg); +void emit_exception_check(codegendata *cd, instruction *iptr); + +void emit_trap_compiler(codegendata *cd); +uint32_t emit_trap(codegendata *cd); -void emit_exception_stubs(jitdata *jd); void emit_patcher_stubs(jitdata *jd); -void emit_replacement_stubs(jitdata *jd); +void emit_patcher_traps(jitdata *jd); void emit_verbosecall_enter(jitdata *jd); void emit_verbosecall_exit(jitdata *jd); -#endif /* _EMIT_H */ +#endif /* _EMIT_COMMON_H */ /*