From 96e132e24ee5a693069e83b6a981693588b088c1 Mon Sep 17 00:00:00 2001 From: Blue Swirl Date: Sun, 20 Sep 2009 19:06:34 +0000 Subject: Compile TCG runtime library only once Signed-off-by: Blue Swirl --- Makefile | 1 + Makefile.target | 5 +++- tcg-runtime.c | 61 +++++++++++++++++++++++++++++++++++++++++++++++++ tcg/tcg-runtime.c | 68 ------------------------------------------------------- tcg/tcg-runtime.h | 13 +++++++++++ tcg/tcg.h | 10 +------- 6 files changed, 80 insertions(+), 78 deletions(-) create mode 100644 tcg-runtime.c delete mode 100644 tcg/tcg-runtime.c create mode 100644 tcg/tcg-runtime.h diff --git a/Makefile b/Makefile index a0cc48827a..4ed4087ca2 100644 --- a/Makefile +++ b/Makefile @@ -74,6 +74,7 @@ block-obj-y += $(addprefix block/, $(block-nested-y)) obj-y = $(block-obj-y) obj-y += readline.o console.o +obj-y += tcg-runtime.o obj-y += irq.o ptimer.o ioport.o obj-y += i2c.o smbus.o smbus_eeprom.o max7310.o max111x.o wm8750.o obj-y += ssd0303.o ssd0323.o ads7846.o stellaris_input.o twl92230.o diff --git a/Makefile.target b/Makefile.target index e5db55bc07..8cc5b6d417 100644 --- a/Makefile.target +++ b/Makefile.target @@ -32,7 +32,7 @@ all: $(PROGS) ######################################################### # cpu emulator library libobj-y = exec.o translate-all.o cpu-exec.o translate.o host-utils.o -libobj-y += tcg/tcg.o tcg/tcg-runtime.o +libobj-y += tcg/tcg.o libobj-$(CONFIG_SOFTFLOAT) += fpu/softfloat.o libobj-$(CONFIG_NOSOFTFLOAT) += fpu/softfloat-native.o libobj-y += op_helper.o helper.o @@ -83,6 +83,7 @@ QEMU_CFLAGS+=-I$(SRC_PATH)/linux-user -I$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR) obj-y = main.o syscall.o strace.o mmap.o signal.o thunk.o \ elfload.o linuxload.o uaccess.o gdbstub.o gdbstub-xml.o obj-y += envlist.o path.o +obj-y += tcg/tcg-runtime.o obj-$(TARGET_HAS_BFLT) += flatload.o obj-$(TARGET_HAS_ELFLOAD32) += elfload32.o @@ -117,6 +118,7 @@ LIBS+=-lmx obj-y = main.o commpage.o machload.o mmap.o signal.o syscall.o thunk.o \ gdbstub.o gdbstub-xml.o obj-y += envlist.o path.o +obj-y += tcg/tcg-runtime.o obj-i386-y += ioport-user.o @@ -135,6 +137,7 @@ QEMU_CFLAGS+=-I$(SRC_PATH)/bsd-user -I$(SRC_PATH)/bsd-user/$(TARGET_ARCH) obj-y = main.o bsdload.o elfload.o mmap.o signal.o strace.o syscall.o \ gdbstub.o gdbstub-xml.o uaccess.o obj-y += envlist.o path.o +obj-y += tcg/tcg-runtime.o obj-i386-y += ioport-user.o diff --git a/tcg-runtime.c b/tcg-runtime.c new file mode 100644 index 0000000000..219cade429 --- /dev/null +++ b/tcg-runtime.c @@ -0,0 +1,61 @@ +/* + * Tiny Code Generator for QEMU + * + * Copyright (c) 2008 Fabrice Bellard + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ +#include + +#include "tcg/tcg-runtime.h" + +int64_t tcg_helper_shl_i64(int64_t arg1, int64_t arg2) +{ + return arg1 << arg2; +} + +int64_t tcg_helper_shr_i64(int64_t arg1, int64_t arg2) +{ + return (uint64_t)arg1 >> arg2; +} + +int64_t tcg_helper_sar_i64(int64_t arg1, int64_t arg2) +{ + return arg1 >> arg2; +} + +int64_t tcg_helper_div_i64(int64_t arg1, int64_t arg2) +{ + return arg1 / arg2; +} + +int64_t tcg_helper_rem_i64(int64_t arg1, int64_t arg2) +{ + return arg1 % arg2; +} + +uint64_t tcg_helper_divu_i64(uint64_t arg1, uint64_t arg2) +{ + return arg1 / arg2; +} + +uint64_t tcg_helper_remu_i64(uint64_t arg1, uint64_t arg2) +{ + return arg1 % arg2; +} diff --git a/tcg/tcg-runtime.c b/tcg/tcg-runtime.c deleted file mode 100644 index 1d77c37ee2..0000000000 --- a/tcg/tcg-runtime.c +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Tiny Code Generator for QEMU - * - * Copyright (c) 2008 Fabrice Bellard - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -#include -#include -#include -#include -#include - -#include "config.h" -#include "osdep.h" -#include "cpu.h" // For TARGET_LONG_BITS -#include "tcg.h" - -int64_t tcg_helper_shl_i64(int64_t arg1, int64_t arg2) -{ - return arg1 << arg2; -} - -int64_t tcg_helper_shr_i64(int64_t arg1, int64_t arg2) -{ - return (uint64_t)arg1 >> arg2; -} - -int64_t tcg_helper_sar_i64(int64_t arg1, int64_t arg2) -{ - return arg1 >> arg2; -} - -int64_t tcg_helper_div_i64(int64_t arg1, int64_t arg2) -{ - return arg1 / arg2; -} - -int64_t tcg_helper_rem_i64(int64_t arg1, int64_t arg2) -{ - return arg1 % arg2; -} - -uint64_t tcg_helper_divu_i64(uint64_t arg1, uint64_t arg2) -{ - return arg1 / arg2; -} - -uint64_t tcg_helper_remu_i64(uint64_t arg1, uint64_t arg2) -{ - return arg1 % arg2; -} diff --git a/tcg/tcg-runtime.h b/tcg/tcg-runtime.h new file mode 100644 index 0000000000..e750cc1952 --- /dev/null +++ b/tcg/tcg-runtime.h @@ -0,0 +1,13 @@ +#ifndef TCG_RUNTIME_H +#define TCG_RUNTIME_H + +/* tcg-runtime.c */ +int64_t tcg_helper_shl_i64(int64_t arg1, int64_t arg2); +int64_t tcg_helper_shr_i64(int64_t arg1, int64_t arg2); +int64_t tcg_helper_sar_i64(int64_t arg1, int64_t arg2); +int64_t tcg_helper_div_i64(int64_t arg1, int64_t arg2); +int64_t tcg_helper_rem_i64(int64_t arg1, int64_t arg2); +uint64_t tcg_helper_divu_i64(uint64_t arg1, uint64_t arg2); +uint64_t tcg_helper_remu_i64(uint64_t arg1, uint64_t arg2); + +#endif diff --git a/tcg/tcg.h b/tcg/tcg.h index 35e6aeb6f5..4304e2a15d 100644 --- a/tcg/tcg.h +++ b/tcg/tcg.h @@ -23,6 +23,7 @@ */ #include "qemu-common.h" #include "tcg-target.h" +#include "tcg-runtime.h" #if TCG_TARGET_REG_BITS == 32 typedef int32_t tcg_target_long; @@ -455,15 +456,6 @@ void tcg_out_reloc(TCGContext *s, uint8_t *code_ptr, int type, const TCGArg *tcg_gen_code_op(TCGContext *s, int opc, const TCGArg *args1, unsigned int dead_iargs); -/* tcg-runtime.c */ -int64_t tcg_helper_shl_i64(int64_t arg1, int64_t arg2); -int64_t tcg_helper_shr_i64(int64_t arg1, int64_t arg2); -int64_t tcg_helper_sar_i64(int64_t arg1, int64_t arg2); -int64_t tcg_helper_div_i64(int64_t arg1, int64_t arg2); -int64_t tcg_helper_rem_i64(int64_t arg1, int64_t arg2); -uint64_t tcg_helper_divu_i64(uint64_t arg1, uint64_t arg2); -uint64_t tcg_helper_remu_i64(uint64_t arg1, uint64_t arg2); - extern uint8_t code_gen_prologue[]; #if defined(_ARCH_PPC) && !defined(_ARCH_PPC64) #define tcg_qemu_tb_exec(tb_ptr) \ -- cgit v1.2.1