Better mechanism to dispatch arch-dependent JIT headers as we can't use

raw arch names (e.g. mips expands to 1, thus not finding the header)
This commit is contained in:
gbeauche 2005-12-05 20:37:46 +00:00
parent d3e8f634b2
commit ecc90b0916
5 changed files with 69 additions and 43 deletions

View File

@ -23,7 +23,6 @@
#include "cpu/jit/jit-config.hpp"
#include "cpu/jit/jit-cache.hpp"
#include JIT_TARGET_INCLUDE(jit-target-cache.hpp)
// Set jump target address
static inline void dg_set_jmp_target(uint8 *jmp_addr, uint8 *addr)

View File

@ -22,7 +22,9 @@
#define DYNGEN_EXEC_H
#include "cpu/jit/jit-config.hpp"
#include JIT_TARGET_INCLUDE(dyngen-target-exec.h)
#define _JIT_HEADER dyngen-target-exec.h
#include "cpu/jit/jit-target-dispatch.h"
/* define virtual register set */
#define REG_A0 AREG0

View File

@ -21,6 +21,9 @@
#ifndef JIT_CACHE_H
#define JIT_CACHE_H
#define _JIT_HEADER jit-target-cache.hpp
#include "cpu/jit/jit-target-dispatch.h"
/**
* Basic translation cache
**/

View File

@ -59,45 +59,4 @@
#endif
#endif
/**
* Helpers to reach JIT backends headers
**/
#if ENABLE_DYNGEN
#if defined(__powerpc__) || defined(__ppc__)
#define JIT_TARGET ppc
#endif
#if defined(__i386__)
#define JIT_TARGET x86
#endif
#if defined(__x86_64__)
#define JIT_TARGET amd64
#endif
#if defined(__s390__)
#define JIT_TARGET s390
#endif
#if defined(__alpha__)
#define JIT_TARGET alpha
#endif
#if defined(__ia64__)
#define JIT_TARGET ia64
#endif
#if defined(__sparc__)
#define JIT_TARGET sparc
#endif
#if defined(__arm__)
#define JIT_TARGET arm
#endif
#if defined(__mc68000)
#define JIT_TARGET m68k
#endif
#ifndef JIT_TARGET
#error "Unsupported architecture for JIT1"
#endif
#define JIT_PATH_CONCAT(X, Y) X/Y
#define JIT_MAKE_HEADER(PATH, HEADER) <JIT_PATH_CONCAT(PATH,HEADER)>
#define JIT_TARGET_INCLUDE(HEADER) JIT_MAKE_HEADER(JIT_PATH_CONCAT(cpu/jit,JIT_TARGET),HEADER)
#endif
#endif /* JIT_CONFIG_H */

View File

@ -0,0 +1,63 @@
/*
* jit-target-dispatch.h - JIT headers dispatcher
*
* Kheperix (C) 2003-2005 Gwenole Beauchesne
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* Undefine some built-ins */
#ifdef i386
#undef i386
#define _jit_defined_i386
#endif
#ifdef amd64
#undef amd64
#define _jit_defined_amd64
#endif
#ifdef mips
#undef mips
#define _jit_defined_mips
#endif
/* Dispatch arch dependent header */
#define _JIT_MAKE_HEADER(arch,header) <cpu/jit/arch/header>
#if defined(__x86_64__)
#include _JIT_MAKE_HEADER(amd64,_JIT_HEADER)
#elif defined(__i386__)
#include _JIT_MAKE_HEADER(i386,_JIT_HEADER)
#elif defined(__powerpc__)
#include _JIT_MAKE_HEADER(ppc,_JIT_HEADER)
#elif defined(__mips__)
#include _JIT_MAKE_HEADER(mips,_JIT_HEADER)
#else
#error "Unknown architecture, please submit bug report"
#endif
#undef _JIT_MAKE_HEADER
#undef _JIT_HEADER
/* Redefine built-ins */
#ifdef _jit_defined_i386
#undef _jit_defined_i386
#define i386 1
#endif
#ifdef _jit_defined_amd64
#undef _jit_defined_amd64
#define amd64 1
#endif
#ifdef _jit_defined_mips
#undef _jit_defined_mips
#define mips 1
#endif