History | View | Annotate | Download (89.5 kB)
tcg: Fix typo in comment (dependancies -> dependencies)
Signed-off-by: Stefan Weil <sw@weilnetz.de>Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
TCG: Fix 32-bit host allocation typo
The second half register of a 64-bit temp on a 32-bit hostwas allocated with the wrong base_type.
The base_type of the second half register is never checked,but for consistency it should be the same as the first half....
TCG: Fix I64-on-32bit-host temporaries
We have cache pools of temporaries that we can reuse later when they'vealready been allocated before.
These cache pools differenciate between the target TCG variable type theycontain. So we have one pool for I32 and one pool for I64 variables....
tcg: Use bitmaps for free temporaries
We previously allocated 32-bits per temp for the next_free_temp entry.We now allocate 4 bits per temp across the 4 bitmaps.
Using a linked list meant that if a translator is tweeked, resulting intemps being freed in a different order, that would have follow-on effects...
tcg: Add qemu_ld_st_i32/64
Step two in the transition, adding the new ldst opcodes. Keep the oldopcodes around until all backends support the new opcodes.
Signed-off-by: Richard Henderson <rth@twiddle.net>
tcg: Add tcg-be-ldst.h
Move TCGLabelQemuLdst and related stuff out of tcg.h.
tcg: Put target helper data into an array.
One call inside of a loop to tcg_register_helper instead of hundredsof sequential calls.
Presumably more icache and branch prediction friendly; resulting binarysize mostly unchanged on x86_64, as we're trading 32-bit rip-relative...
tcg: Add tcg-runtime.c helpers to all_helpers
For the few targets that actually use these, we'd not reportthem symbolicly in the tcg opcode logs.
tcg: Merge tcg_register_helper into tcg_context_init
Eliminates the repeated checks for having createdthe s->helpers hash table.
tcg: Move helper registration into tcg_context_init
No longer needs to be done on a per-target basis.
tcg: Use a GHashTable for tcg_find_helper
Slightly changes the interface, in that we now return nameinstead of a TCGHelperInfo structure, which goes away.
Reviewed-by: Stefan Weil <sw@weilnetz.de>Signed-off-by: Richard Henderson <rth@twiddle.net>
tcg: Change tcg_out_ld/st offset to intptr_t
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>Signed-off-by: Richard Henderson <rth@twiddle.net>
tcg: Use appropriate types in tcg_reg_alloc_call
tcg: Fix jit debug for x32
tcg: Add muluh and mulsh opcodes
Use them in places where mulu2 and muls2 are used.Optimize mulx2 with dead low part to mulxh.
tcg: Change flush_icache_range arguments to uintptr_t
tcg: Change frame pointer offsets to intptr_t
tcg: Change memory offsets to intptr_t
tcg: Change relocation offsets to intptr_t
tcg: Use uintptr_t in TCGHelperInfo
tcg: Tidy generated code for tcg_outN
Aliasing was forcing s->code_ptr to be re-read after the store.Keep the pointer in a local variable to help the compiler.
tcg-i386: Add and use tcg_out64
No point in splitting the write into 32-bit pieces.
tcg: Fix high_pc fields in .debug_info
I don't think the debugger actually looks at this for anything,using the correct .debug_frame contents, but might as well getit all correct.
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>Signed-off-by: Richard Henderson <rth@twiddle.net>
tcg: Move the CIE and FDE header definitions to common code
These will necessarily be the same layout for all hosts. This limitsthe amount of boilerplate required to implement jit debug for a host.
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>...
tcg: Simplify logic using TCG_OPF_NOT_PRESENT
Expand the definition of "not present" to include "should not be present".This means we can simplify the logic surrounding the generic tcg opcodesfor which the host backend ought not be providing definitions....
tcg: Log the contents of the prologue with -d out_asm
This makes it easier to verify changes to the codegenerating the prologue.
[Aurelien: change the format from %i to %zu]
tcg: Apply life analysis to 64-bit multiword arithmetic ops
Signed-off-by: Richard Henderson <rth@twiddle.net>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
TCG: Final globals clean-up
Signed-off-by: Evgeny Voevodin <evgenyvoevodin@gmail.com>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
tcg: Remove unneeded assertion
Commit 7f6f0ae5b95adfa76e10eabe2c34424a955fd10c added two assertions.
One of these assertions is not needed:The pointer ts is never NULL because it is initialized with theaddress of an array element.
Reviewed-by: Richard Henderson <rth@twiddle.net>...
misc: move include files to include/qemu/
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
tcg: mark local temps as MEM in dead_temp()
In dead_temp, local temps should always be marked as back to memory,even if they have not been allocated (i.e. they are discared beforecross a basic block).
It fixes the following assertion in target-xtensa:...
TCG: Remove unused global variables
Signed-off-by: Evgeny Voevodin <e.voevodin@samsung.com>Reviewed-by: Richard Henderson <rth@twiddle.net>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
TCG: Use gen_opparam_buf from context instead of global variable.
TCG: Use gen_opc_buf from context instead of global variable.
TCG: Use gen_opparam_ptr from context instead of global variable.
TCG: Use gen_opc_ptr from context instead of global variable.
tcg: properly check that op's output needs to be synced to memory
Fix typo introduced in b3a1be87bac3a6aaa59bb88c1410f170dc9b22d5.
Reported-by: Ruslan Savchenko <ruslan.savchenko@gmail.com>Signed-off-by: Kirill Batuzov <batuzovk@ispras.ru>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
tcg: Optimize qemu_ld/st by generating slow paths at the end of a block
Add optimized TCG qemu_ld/st generation which locates the code of TLB misscases at the end of a block after generating the other IRs.Currently, this optimization supports only i386 and x86_64 hosts....
tcg: don't remove op if output needs to be synced to memory
Commit 9c43b68de628a1e2cba556adfb71c17028eb802e do not correctly checkfor dead outputs when they need to be synced to memory in case ofhalf-dead operations.
Fix that by applying the same pattern than for the default case....
tcg: rework TCG helper flags
The current helper flags, TCG_CALL_CONST and TCG_CALL_PURE might beconfusing and doesn't provide enough granularity for some helpers (FPhelpers for example).
This patch changes them into the following helpers flags:- TCG_CALL_NO_READ_GLOBALS means that the helper does not read globals,...
tcg: rewrite tcg_reg_alloc_mov()
Now that the liveness analysis provides more information, rewritetcg_reg_alloc_mov(). This changes the behaviour about propagatingconstants and memory accesses. We now take the assumption that oncea value is loaded into a register (from memory or from a constant),...
tcg: always mark dead input arguments as dead
Always mark dead input arguments as dead, even if the op is at the basicblock end. This will allow to check that all temps are correctly saved.
Reviewed-by: Richard Henderson <rth@twiddle.net>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
tcg: start with local temps in TEMP_VAL_MEM state
Start with local temps in TEMP_VAL_MEM state, to make possible a latercheck that all the temps are correctly saved back to memory.
tcg: don't explicitly save globals and temps
The liveness analysis ensures that globals and temps are at the correctstate at a basic block end or with an op with side effects. Avoidlooping on all temps, this can be time consuming on targets with a lotof globals. Keep an assert in debug mode....
tcg: synchronize globals for ops with side effects
Operations with side effects (in practice qemu_ld/st ops), only need tosynchronize globals to make sure the CPU state is consistent in case ofexception.
tcg: add temp_dead()
A lot of code is duplicated to mark a temporary as dead. Replace itby temp_dead(), which in addition marks the temp as saved in memoryfor globals and local temps, instead of doing this a posteriori intemp_save().
tcg: add tcg_reg_sync()
Add a new function tcg_reg_sync() to synchronize the canonical locationof a temp with the value in the associated register, but without freeingit. Rewrite tcg_reg_free() to first call tcg_reg_sync() and then to freethe register....
tcg: add temp_sync()
Add a new function temp_sync() to synchronize the canonical locationof a temp with the value in the corresponding register, but withoutfreeing the associated register. Rewrite temp_save() to calltemp_sync() followed by temp_dead()....
tcg: sync output arguments on liveness request
Synchronize an output argument when requested by the liveness analysis.This is needed so that the temp can be declared dead later.
For that, add a new op_sync_args table in which each bit tells if thecorresponding output argument needs to be synchronized with the memory....
tcg: rework liveness analysis
Rework the liveness analysis by tracking temps that need to go back tomemory in addition to dead temps tracking. This allows to mark outputarguments as "need sync", and to synchronize them back to memory as soonas they are not written anymore. This way even arguments mapping to...
tcg: improve tcg_reg_alloc_movi()
Now that the liveness analysis might mark some output temps as dead, calltemp_dead() if needed.
Merge branch 'linux-user-for-upstream' of git://git.linaro.org/people/rikuvoipio/qemu
tcg: Optimize mulu2
Like add2, do operand ordering, constant folding, and dead operandelimination. The latter happens about 15% of all mulu2 during anx86_64 bios boot.
Signed-off-by: Richard Henderson <rth@twiddle.net>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
tcg: Optimize half-dead add2/sub2
When x86_64 guest is not in 64-bit mode, the high-part of the 64-bitadd is dead. When the host is 32-bit, we can simplify to 32-bitarithmetic.
tcg: Remove TCG_TARGET_HAS_GUEST_BASE define
GUEST_BASE support is now supported by all TCG backends, and isnow mandatory. Drop the now-pointless TCG_TARGET_HAS_GUEST_BASEdefine (set by every backend) and the error if it is unset.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>...
tcg: Remove redundant pointer from TCGContext
The pointer entry 'temps' always refers to the array entry 'static_temps'.Removing the pointer and renaming 'static_temps' to 'temps' reduces thesize of TCGContext (4 or 8 byte) and allows better code generation....
tcg: Add TCG_COND_NEVER, TCG_COND_ALWAYS
There are several cases that can be handled easier inside bothtranslators and code generators if we have out-of-band valuesfor conditions. It's easy enough to handle ALWAYS and NEVER inthe natural way inside the tcg middle-end....
tcg: Sanity check goto_tb input
Checking that we don't try for idx != [01] is trivial. Checkingthat we don't issue more than one of any index requires a tadmore data and some ifdefs protecting that new variable.
Signed-off-by: Richard Henderson <rth@twiddle.net>...
Merge branch 'tcg-sparc' of git://repo.or.cz/qemu/rth
tcg: Remove tcg_target_get_call_iarg_regs_count
The TCG targets no longer need individual implementations.
Since commit 6a18ae2d2947532d5c26439548afa0481c4529f9,'flags' is no longer used in tcg_target_get_call_iarg_regs_count.
The remaining tcg_target_get_call_iarg_regs_count is trivial and only...
tcg: remove #ifdef #endif around TCGOpcode tests
Commit 25c4d9cc changed all TCGOpcode enums to be available, so we don'tneed to #ifdef #endif the one that are available only on some targets.This makes the code easier to read.
tcg-sparc: Assume v9 cpu always, i.e. force v8plus in 32-bit mode.
Current code doesn't actually work in 32-bit mode at all. Sinceno one really noticed, drop the complication of v7 and v8 cpus.Eliminate the --sparc_cpu configure option and standardize macro...
tcg: Introduce movcond
Implemented with setcond if the target does not providethe optional opcode.
tcg: mark set_label with TCG_OPF_BB_END flag
set_label is effectively the end of a basic block, as no optimizationcan be made accross it. It was treated as such in the liveness analysiscode, but as a special case.
Mark it with TCG_OPF_BB_END flag so that this information can be used...
tcg: improve profiler
Now that there are two passes of optimization (optimize.c, liveness)there is no point of outputing the statistics of the liveness partonly. Update the code to take into account both optimizations.
qemu-log: cleanup
Don't use global variables directly but via accessor functions. Rename globals.
Convert macros to functions, add GCC format attributes.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
tcg: Allow ELF_HOST_FLAGS and ELF_OSABI overrides in gdb-jit.
tcg: Add debug_info to JIT ELF image.
This allows us to actually supply a function name in softmmu builds;gdb doesn't pick up the minimal symbol table otherwise. Also add abit of documentation and statically generate more of the ELF image.
tcg: Use the GDB JIT debugging interface.
This allows us to generate unwind info for the dynamicly generatedcode in the code_gen_buffer. Only i386 is converted at this point.
i386: Remove REGPARM
Use stack based calling convention (GCC default) for interfacing withgenerated code instead of register based convention (regparm(3)).
Fix large memory chunks allocation with tcg_malloc.
An attempt to allocate a large memory chunk after a small one resulted incircular links in list of pools. It caused the same memory beingallocated twice for different arrays.
Now pools for large memory chunks are kept in separate list and are...
tcg: Improve tcg_out_label and fix its usage for w64
tcg_out_label is always called with a third argument of pointer typewhich 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...
w64: fix type casts when calling flush_icache_range
Signed-off-by: Stefan Weil <sw@weilnetz.de>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
tcg: Remove unneeded include statements
The standard include files are already included in qemu-common.h.
malloc.h and alloca.h were needed for alloca() which was removedfrom TCG code some years ago when switching from dyngen to TCG(see commit 49516bc0d622112caac9df628caf19010fda8b67)....
fix spelling in tcg sub directory
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.
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>...
tcg: Make ARRAY_SIZE(tcg_op_defs) globally available
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 assertions
Signed-off-by: Stefan Weil <weil@mail.berlios.de>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
tcg: Add forward declarations for local functions
These functions are defined in the tcg target specific filetcg-target.c.
The forward declarations assert that every tcg target usesthe same function prototype.
Signed-off-by: Stefan Weil <weil@mail.berlios.de>...
tcg: Update --enable-debug for TCG_OPF_NOT_PRESENT.
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.
By always defining these symbols, we can eliminate a lot of ifdefs.
To allow this to be checked reliably, the semantics of theTCG_TARGET_HAS_* macros must be changed from def/undef to true/false.This allows even more ifdefs to be removed, converting them into...
tcg: Add and use TCG_OPF_64BIT.
This allows the simplification of the op_bits function fromtcg/optimize.c.
Use glib memory allocation and free functions
qemu_malloc/qemu_free no longer exist after this commit.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Add TCG optimizations stub
Added file tcg/optimize.c to hold TCG optimizations. Function tcg_optimizeis called from tcg_gen_code_common. It calls other functions performingspecific optimizations. Stub for constant folding was added.
Signed-off-by: Kirill Batuzov <batuzovk@ispras.ru>...
TCG/Sparc64: use stack for TCG temps
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.
TCG: remove broken stack allocation for call arguments
The code for stack allocation for call arguments is way too simplisticto actually work on targets with non-trivial stack allocation policies,e.g. ppc64. We've also already allocated TCG_STATIC_CALL_ARGS_SIZE worth...
TCG: fix negative frame offset calculations
size_t is unsigned, so the frame offset calculations can be incorrect fornegative offsets.
Remove exec-all.h include directives
Most exec-all.h include directives are now useless, remove them.
tcg: Fix unused-but-set-variable warning
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 registers
If an op with dead outputs is not removed, because it has side effectsor has multiple output and only one dead, mark the registers as deadinstead of saving them. This avoid a few register spills on TCG targetswith low register count, especially with div2 and mul2 ops, or when a...
tcg: mark dead output argument in op_dead_args
If an op is not removed and has dead output arguments, mark itin 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_args
Allow all args to be dead by replacing the input specific op_dead_iargsvariable by op_dead_args. Note this is a purely mechanical change.
tcg: Add support for debugging leakage of temporaries
Add support (if CONFIG_DEBUG_TCG is defined) for debugging leakageof temporary variables. Generally any temporaries created bya target while it is translating an instruction should be freedby the end of that instruction; otherwise carefully crafted...
tcg: Use fprintf_function (format checking)
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)
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....
tcg: Optionally sign-extend 32-bit arguments for 64-bit hosts.
Some hosts (amd64, ia64) have an ABI that ignores the high bitsof the 64-bit register when passing 32-bit arguments. Othersrequire the value to be properly sign-extended for the type.I.e. "int32_t" must be sign-extended and "uint32_t" must be...
tcg: fix DEF macro after commit c61aaf7a388c4ad95d8b546fdb9267dc01183317
tcg: get rid of copy_size in TCGOpDef
copy_size is a left-over from the dyngen era, remove it.
tcg: get rid of DEF2 in tcg-opc.h
Now that tcg-opc.h is only used in TCG code, get rid of DEF2 intcg-opc.h.
tcg: Make some tcg-target.c routines static.
Both tcg_target_init and tcg_target_qemu_prologueare unused outside of tcg.c.