summaryrefslogtreecommitdiffstats
path: root/tcg/tcg.c
Commit message (Collapse)AuthorAgeFilesLines
* tcg: Allow ELF_HOST_FLAGS and ELF_OSABI overrides in gdb-jit.Richard Henderson2012-03-241-0/+6
| | | | | Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* tcg: Add debug_info to JIT ELF image.Richard Henderson2012-03-241-75/+158
| | | | | | | | | This allows us to actually supply a function name in softmmu builds; gdb doesn't pick up the minimal symbol table otherwise. Also add a bit of documentation and statically generate more of the ELF image. Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* tcg: Use the GDB JIT debugging interface.Richard Henderson2012-03-241-0/+194
| | | | | | | | This allows us to generate unwind info for the dynamicly generated code in the code_gen_buffer. Only i386 is converted at this point. Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* i386: Remove REGPARMBlue Swirl2012-03-181-14/+0
| | | | | | | Use stack based calling convention (GCC default) for interfacing with generated code instead of register based convention (regparm(3)). Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Fix large memory chunks allocation with tcg_malloc.Kirill Batuzov2012-03-171-5/+9
| | | | | | | | | | | | An attempt to allocate a large memory chunk after a small one resulted in circular links in list of pools. It caused the same memory being allocated twice for different arrays. Now pools for large memory chunks are kept in separate list and are freed during pool reset because current allocator can not reuse them. Signed-off-by: Kirill Batuzov <batuzovk@ispras.ru> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* tcg: Improve tcg_out_label and fix its usage for w64Stefan Weil2012-03-111-3/+3
| | | | | | | | | | | | | | | | tcg_out_label is always called with a third argument of pointer type which was casted to tcg_target_long. These casts can be avoided by changing the prototype of tcg_out_label. There was also a cast to long. For most hosts with sizeof(long) == sizeof(tcg_target_long) == sizeof(void *) this did not matter, but for w64 it was wrong. This is fixed now. Cc: Blue Swirl <blauwirbel@gmail.com> Cc: Richard Henderson <rth@twiddle.net> Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* w64: fix type casts when calling flush_icache_rangeStefan Weil2012-03-031-4/+5
| | | | | Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* tcg: Remove unneeded include statementsStefan Weil2012-02-231-12/+0
| | | | | | | | | | | The standard include files are already included in qemu-common.h. malloc.h and alloca.h were needed for alloca() which was removed from TCG code some years ago when switching from dyngen to TCG (see commit 49516bc0d622112caac9df628caf19010fda8b67). Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
* fix spelling in tcg sub directoryDong Xu Wang2011-12-021-1/+1
| | | | | Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
* tcg: Use TCGReg for standard tcg-target entry points.Richard Henderson2011-11-141-4/+4
| | | | | | | | | Including tcg_out_ld, tcg_out_st, tcg_out_mov, tcg_out_movi. Signed-off-by: Richard Henderson <rth@twiddle.net> Reviewed-by: Andreas Färber <afaerber@suse.de> Reviewed-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Alexander Graf <agraf@suse.de>
* tcg: Make ARRAY_SIZE(tcg_op_defs) globally availableStefan Weil2011-10-311-0/+1
| | | | | | | | | tcg_op_defs was already a global array. The tci disassembler also needs ARRAY_SIZE(tcg_op_defs), so add a new global constant with this value. Signed-off-by: Stefan Weil <sw@weilnetz.de>
* tcg: Add some assertionsStefan Weil2011-10-011-0/+2
| | | | | Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* tcg: Add forward declarations for local functionsStefan Weil2011-10-011-0/+16
| | | | | | | | | | | These functions are defined in the tcg target specific file tcg-target.c. The forward declarations assert that every tcg target uses the same function prototype. Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* tcg: Update --enable-debug for TCG_OPF_NOT_PRESENT.Richard Henderson2011-08-231-7/+8
| | | | | | Signed-off-by: Richard Henderson <rth@twiddle.net> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
* tcg: Always define all of the TCGOpcode enum members.Richard Henderson2011-08-211-0/+4
| | | | | | | | | | | | By always defining these symbols, we can eliminate a lot of ifdefs. To allow this to be checked reliably, the semantics of the TCG_TARGET_HAS_* macros must be changed from def/undef to true/false. This allows even more ifdefs to be removed, converting them into C if statements. Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* tcg: Add and use TCG_OPF_64BIT.Richard Henderson2011-08-211-1/+1
| | | | | | | | This allows the simplification of the op_bits function from tcg/optimize.c. Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Use glib memory allocation and free functionsAnthony Liguori2011-08-201-4/+4
| | | | | | qemu_malloc/qemu_free no longer exist after this commit. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Add TCG optimizations stubKirill Batuzov2011-07-301-0/+6
| | | | | | | | | Added file tcg/optimize.c to hold TCG optimizations. Function tcg_optimize is called from tcg_gen_code_common. It calls other functions performing specific optimizations. Stub for constant folding was added. Signed-off-by: Kirill Batuzov <batuzovk@ispras.ru> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* TCG/Sparc64: use stack for TCG tempsBlue Swirl2011-06-261-0/+2
| | | | | | | | | Use stack instead of temp_buf array in CPUState for TCG temps. On Sparc64, stack pointer is not aligned but there is a fixed bias of 2047, so don't try to enforce alignment. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* TCG: remove broken stack allocation for call argumentsBlue Swirl2011-06-261-6/+3
| | | | | | | | | | | | | | | The code for stack allocation for call arguments is way too simplistic to actually work on targets with non-trivial stack allocation policies, e.g. ppc64. We've also already allocated TCG_STATIC_CALL_ARGS_SIZE worth of stack for calls which should be well more than any helper needs. Remove broken dynamic stack allocation code and replace it with an assert. Should dynamic stack allocation ever be needed again, target specific functions should be added. Thanks to Richard Henderson for the analysis. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* TCG: fix negative frame offset calculationsBlue Swirl2011-06-261-3/+7
| | | | | | | size_t is unsigned, so the frame offset calculations can be incorrect for negative offsets. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Remove exec-all.h include directivesBlue Swirl2011-06-261-1/+0
| | | | | | Most exec-all.h include directives are now useless, remove them. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* tcg: Fix unused-but-set-variable warningChristophe Fergeau2011-06-031-2/+2
| | | | | | | | | | Based on a patch from Hans de Goede <hdegoede@redhat.com> This warning is new in gcc 4.6. Acked-by: Amit Shah <amit.shah@redhat.com> Signed-off-by: Christophe Fergeau <cfergeau@redhat.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* tcg: don't keep dead outputs in registersAurelien Jarno2011-05-231-10/+18
| | | | | | | | | | If an op with dead outputs is not removed, because it has side effects or has multiple output and only one dead, mark the registers as dead instead of saving them. This avoid a few register spills on TCG targets with low register count, especially with div2 and mul2 ops, or when a qemu_ld* result is not used (prefetch emulation for example). Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* tcg: mark dead output argument in op_dead_argsAurelien Jarno2011-05-231-2/+8
| | | | | | | If an op is not removed and has dead output arguments, mark it in op_dead_args similarly to what is done for input arguments. Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* tcg: replace op_dead_iargs by op_dead_argsAurelien Jarno2011-05-231-35/+36
| | | | | | | Allow all args to be dead by replacing the input specific op_dead_iargs variable by op_dead_args. Note this is a purely mechanical change. Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* tcg: Add support for debugging leakage of temporariesPeter Maydell2011-03-071-0/+32
| | | | | | | | | | | | | Add support (if CONFIG_DEBUG_TCG is defined) for debugging leakage of temporary variables. Generally any temporaries created by a target while it is translating an instruction should be freed by the end of that instruction; otherwise carefully crafted guest code could cause TCG to run out of temporaries and assert. By calling tcg_check_temp_count() after each instruction we can check that we are not leaking temporaries in this way. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* tcg: Use fprintf_function (format checking)Stefan Weil2010-10-301-4/+2
| | | | | | | | fprintf_function uses format checking with GCC_FMT_ATTR. Cc: Blue Swirl <blauwirbel@gmail.com> Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* tcg: Fix compiler error (comparison of unsigned expression)Stefan Weil2010-10-201-1/+1
| | | | | | | | | | | | | | | | | | When qemu is configured with --enable-debug-tcg, gcc throws this warning (or error with -Werror): tcg/tcg.c:1030: error: comparison of unsigned expression >= 0 is always true Fix it by removing the >= 0 part. The type cast to 'unsigned' catches negative values of op (which should never happen). This is a modification of Hollis Blanchard's patch. Cc: Hollis Blanchard <hollis@penguinppc.org> Cc: Blue Swirl <blauwirbel@gmail.com> Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* tcg: Optionally sign-extend 32-bit arguments for 64-bit hosts.Richard Henderson2010-06-161-6/+35
| | | | | | | | | | | | | | | | | | Some hosts (amd64, ia64) have an ABI that ignores the high bits of the 64-bit register when passing 32-bit arguments. Others require the value to be properly sign-extended for the type. I.e. "int32_t" must be sign-extended and "uint32_t" must be zero-extended to 64-bits. To effect this, extend the "sizemask" parameter to tcg_gen_callN to include the signedness of the type of each parameter. If the tcg target requires it, extend each 32-bit argument into a 64-bit temp and pass that to the function call. This ABI feature is required by sparc64, ppc64 and s390x. Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* tcg: fix DEF macro after commit c61aaf7a388c4ad95d8b546fdb9267dc01183317Aurelien Jarno2010-06-111-1/+1
| | | | Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* tcg: get rid of DEF2 in tcg-opc.hAurelien Jarno2010-06-091-3/+1
| | | | | | | Now that tcg-opc.h is only used in TCG code, get rid of DEF2 in tcg-opc.h. Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* tcg: get rid of copy_size in TCGOpDefAurelien Jarno2010-06-091-1/+1
| | | | | | copy_size is a left-over from the dyngen era, remove it. Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* tcg: Make some tcg-target.c routines static.Richard Henderson2010-06-091-0/+2
| | | | | | | | Both tcg_target_init and tcg_target_qemu_prologue are unused outside of tcg.c. Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* tcg: Add TYPE parameter to tcg_out_mov.Richard Henderson2010-06-091-6/+6
| | | | | | | | | | | | | | Mirror tcg_out_movi in having a TYPE parameter. This allows x86_64 to perform the move at the proper width, which may elide a REX prefix. Introduce a TCG_TYPE_REG enumerator to represent the "native width" of the host register, and to distinguish the usage from "pointer data" as represented by the existing TCG_TYPE_PTR. Update all targets to match. Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* tcg: Initialize the prologue after GUEST_BASE is fixed.Richard Henderson2010-05-211-0/+3
| | | | | | | | This will allow backends to make intelligent choices about how to implement GUEST_BASE. Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* tcg: Add missing 'static' attributeStefan Weil2010-05-071-2/+2
| | | | | | | | tcg_out_reloc is only used locally (in */target.c which is included in tcg.c). Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Remove dead assignments in various common files, spotted by clang analyzerBlue Swirl2010-04-251-0/+4
| | | | | | Value stored is never read. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Fix --enable-profiler compilation.Richard Henderson2010-04-171-0/+1
| | | | | | | | | There's a header file inclusion ordering problem between cpu-all.h and qemu-timer.h, such that cpu_get_real_ticks is not defined when we attempt to use it in profile_getclock. Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* tcg: Add missing static qualifiermalc2010-04-171-1/+1
| | | | | | Build breaks otherwise when USE_LIVENESS_ANALYSIS is not defined. Signed-off-by: malc <av1474@comtv.ru>
* tcg: Name the opcode enumeration.Richard Henderson2010-03-261-9/+24
| | | | | | | | Give the enumeration formed from tcg-opc.h a name: TCGOpcode. Use that enumeration type instead of "int" whereever appropriate. Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* tcg-hppa: Fix 64-bit argument orderingRichard Henderson2010-03-231-1/+11
| | | | | Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* Fix build with -DNDEBUG in CFLAGSBlue Swirl2010-03-131-1/+1
| | | | Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* tcg: Add consistency checks for op definitionsStefan Weil2010-02-181-0/+21
| | | | | | | | | | | | | | | When compiled with CONFIG_DEBUG_TCG, this code looks for missing, duplicate and wrong entries in the op definitions. Errors will raise an assertion at program start (all checks are done in the initial phase). The current code contains such errors, at least for i386 guest on i386 host. Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* tcg: generic support for conditional setRichard Henderson2010-02-061-6/+15
| | | | | | | Defines setcond_{i32,i64} and setcond2_i32 for 64-on-32-bit. Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* tcg: improve output logAurelien Jarno2009-10-071-1/+1
| | | | Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* tcg: allocate s->op_dead_iargs dynamicallyAurelien Jarno2009-10-041-2/+1
| | | | | | | Similarly to what is already done in tcg_liveness_analysis() when USE_LIVENESS_ANALYSIS is not set. Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* Revert part of 6692b043198d58a12317009edb98654c6839f043Aurelien Jarno2009-09-301-8/+4
| | | | | | Committed by accident. Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* TCG: fix DEF2 macroAurelien Jarno2009-09-301-5/+9
| | | | Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* rename DEBUG_TCG to CONFIG_DEBUG_TCGJuan Quintela2009-07-271-1/+1
| | | | | Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
OpenPOWER on IntegriCloud