Alien-LibJIT
view release on metacpan or search on metacpan
libjit/jit/jit-rules.h view on Meta::CPAN
/*
* jit-rules.h - Rules that define the characteristics of the back-end.
*
* Copyright (C) 2004 Southern Storm Software, Pty Ltd.
*
* This file is part of the libjit library.
*
* The libjit library is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 2.1 of
* the License, or (at your option) any later version.
*
* The libjit library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with the libjit library. If not, see
* <http://www.gnu.org/licenses/>.
*/
#ifndef _JIT_RULES_H
#define _JIT_RULES_H
#include "jit-config.h"
#ifdef __cplusplus
extern "C" {
#endif
/*
* Information about a register.
*/
typedef struct
{
const char *name; /* Name of the register, for debugging */
short cpu_reg; /* CPU register number */
short other_reg; /* Other register for a "long" pair, or -1 */
int flags; /* Flags that define the register type */
} jit_reginfo_t;
/*
* Register information flags.
*/
#define JIT_REG_WORD (1 << 0) /* Can be used for word values */
#define JIT_REG_LONG (1 << 1) /* Can be used for long values */
#define JIT_REG_FLOAT32 (1 << 2) /* Can be used for float32 values */
#define JIT_REG_FLOAT64 (1 << 3) /* Can be used for float64 values */
#define JIT_REG_NFLOAT (1 << 4) /* Can be used for nfloat values */
#define JIT_REG_FRAME (1 << 5) /* Contains frame pointer */
#define JIT_REG_STACK_PTR (1 << 6) /* Contains CPU stack pointer */
#define JIT_REG_FIXED (1 << 7) /* Fixed use; not for allocation */
#define JIT_REG_CALL_USED (1 << 8) /* Destroyed by a call */
#define JIT_REG_IN_STACK (1 << 9) /* Middle of stack-like allocation */
#define JIT_REG_GLOBAL (1 << 10) /* Candidate for global allocation */
#define JIT_REG_ALL (JIT_REG_WORD | JIT_REG_LONG \
| JIT_REG_FLOAT32 | JIT_REG_FLOAT64 \
| JIT_REG_NFLOAT)
/*
* Include definitions that are specific to the backend.
*/
#if defined(JIT_BACKEND_INTERP)
# include "jit-rules-interp.h"
#elif defined(JIT_BACKEND_ALPHA)
# include "jit-rules-alpha.h"
#elif defined(JIT_BACKEND_ARM)
# include "jit-rules-arm.h"
#elif defined(JIT_BACKEND_X86)
# include "jit-rules-x86.h"
#elif defined(JIT_BACKEND_X86_64)
# include "jit-rules-x86-64.h"
#else
# error "unknown jit backend type"
#endif
/*
* The information blocks for all registers in the system.
*/
extern jit_reginfo_t const _jit_reg_info[JIT_NUM_REGS];
/*
* Macros for getting register information
*/
/* Get register name. */
#define jit_reg_name(reg) (_jit_reg_info[reg].name)
/* Get register flags. */
#define jit_reg_flags(reg) (_jit_reg_info[reg].flags)
/* Get CPU register number for machine instruction encoding. */
#define jit_reg_code(reg) (_jit_reg_info[reg].cpu_reg)
/* Given the first register of a register pair get the other one. */
( run in 0.644 second using v1.01-cache-2.11-cpan-02777c243ea )