History | View | Annotate | Download (27.8 kB)
exec: Add both big- and little-endian memory helpers
Step three in the transition: helpers not tied to the target"default" endianness. To be used when the guest uses a memoryoperation with non-default endianness.
Signed-off-by: Richard Henderson <rth@twiddle.net>
tcg: Add TCGMemOp
tcg: Add tcg-be-ldst.h
Move TCGLabelQemuLdst and related stuff out of tcg.h.
tcg: Merge tcg_register_helper into tcg_context_init
Eliminates the repeated checks for having createdthe s->helpers hash table.
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: Delete tcg_helper_get_name declaration
The function was deleted in 4dc81f2822187f4503d4bdb76785cafa5b28db0b.
tcg: Introduce zero and sign-extended versions of load helpers
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>Signed-off-by: Richard Henderson <rth@twiddle.net>
exec: Split softmmu_defs.h
The _cmmu helpers can be moved to exec-all.h. The helpers that areused from TCG will shortly need access to tcg_target_long so movetheir declarations into tcg.h.
This requires minor include adjustments to all TCG backends....
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 tcg_qemu_tb_exec return to uintptr_t
tcg: Allow TCG_TARGET_REG_BITS to be specified independantly
There are several hosts for which it would be useful to use theavailable 64-bit registers in a 32-bit pointer environment.
tcg: Define TCG_TYPE_PTR properly
tcg: Define TCG_ptr properly
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: 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: Split rem requirement from div requirement
There are several hosts with only a "div" insn. Remainder is computedmanually from the quotient and inputs. We can do this generically.
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>Signed-off-by: Richard Henderson <rth@twiddle.net>
Handle CPU interrupts by inline checking of a flag
Fix some of the nasty TCG race conditions and crashes by implementingcpu_exit() as setting a flag which is checked at the start of each TB.This avoids crashes if a thread or signal handler calls cpu_exit()...
tcg: Document tcg_qemu_tb_exec() and provide constants for low bit uses
Document tcg_qemu_tb_exec(). In particular, its return value is acombination of a pointer to the next translation block and someextra information in the low two bits. Provide some #defines for...
tcg: Make 32-bit multiword operations optional for 64-bit hosts
Signed-off-by: Richard Henderson <rth@twiddle.net>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
tcg: Add 64-bit multiword arithmetic operations
Matching the 32-bit multiword arithmetic that we already have.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
tcg: Add signed multiword multiplication operations
TCG: Move translation block variables to new context inside tcg_ctx: tb_ctx
It's worth to clean-up translation blocks variables and move theminto one context as was suggested by Swirl.Also if we use this context directly inside tcg_ctx, then itspeeds up code generation a bit....
TCG: Final globals clean-up
Signed-off-by: Evgeny Voevodin <evgenyvoevodin@gmail.com>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
tcg: Add TCGV_IS_UNUSED_*
Cc: Aurelien Jarno <aurelien@aurel32.net>Signed-off-by: Richard Henderson <rth@twiddle.net>Reviewed-by: Andreas Färber <afaerber@suse.de>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Merge remote-tracking branch 'stefanha/trivial-patches' into staging
tcg/tcg.h: Duplicate global TCG gen_opc_ arrays into TCGContext.
Signed-off-by: Evgeny Voevodin <e.voevodin@samsung.com>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Fix comments (adress -> address, layed -> laid, wierd -> weird)
Remove also a duplicated 'the'.
Signed-off-by: Stefan Weil <sw@weilnetz.de>Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
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/tcg.h: Duplicate global TCG variables in TCGContext
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: remove compatiblity call flags
Reviewed-by: Richard Henderson <rth@twiddle.net>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
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: 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.
Reviewed-by: Richard Henderson <rth@twiddle.net>...
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....
exec: Allocate code_gen_prologue from code_gen_buffer
We had a hack for arm and sparc, allocating code_gen_prologue to aspecial section. Which, honestly does no good under certain cases.We've already got limits on code_gen_buffer_size to ensure that all...
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: Add tcg_high_cond
The table that was recently added for hppa is generally usable.And with the renumbering of the TCG_COND constants it's not toodifficult to compute rather than have a table.
Signed-off-by: Richard Henderson <rth@twiddle.net>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
tcg: Add is_unsigned_cond
Before we rearrange the TCG_COND enumeration, add a predicate forthe (single) use of comparisons vs TCGCond.
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>...
tcg: Add tcg_debug_assert
Like the C assert macro, except only enabled for CONFIG_DEBUG_TCG,and without having to set _NDEBUG and disable all other asserts atthe same time.
The use of __builtin_unreachable (when available) gives the compilerthe same information, which may (or may not) help it optimize better....
tcg: Fix !USE_DIRECT_JUMP
Commit 6375e09e changed the type of TranslationBlock.tb_next,but failed to change the type of TCGContext.tb_next.
Signed-off-by: Richard Henderson <rth@twiddle.net>Reviewed-by: Andreas Färber <afaerber@suse.de>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
tcg: Introduce movcond
Implemented with setcond if the target does not providethe optional opcode.
revert "TCG: fix copy propagation"
Given the copy propagation breakage on 32-bit hosts has been fixedcommit e31b0a7c050711884ad570fe73df806520953618 can be reverted.
Cc: Blue Swirl <blauwirbel@gmail.com>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
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.
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)).
w64: Fix data type of next_tb and tcg_qemu_tb_exec
next_tb is the numeric value of a tcg target (= QEMU host) address.
Using tcg_target_ulong instead of unsigned long shows this and makesthe code portable for hosts with an unusual size of long (w64).
The type cast '(long)(next_tb & ~3)' was not needed (casting...
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: Rearrange definitions and include statements
This change makes tcg_target_ulong available in tcg-target.h.
Signed-off-by: Stefan Weil <sw@weilnetz.de>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
tcg: make tcg_const_ptr actually accept a pointer argument
Make tcg_const_ptr() include a cast so that you can pass it apointer. This allows us to drop the casts we had in all the placesthat use this macro.
Acked-by: Andreas Färber <andreas.faerber@web.de>...
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: TCG targets may define tcg_qemu_tb_exec
Targets may use a non standard definition of tcg_tb_execby defining this macro in their tcg_target.h.
This is used here by ppc. It will be used by the TCG interpreter, too.
Cc: malc <av1474@comtv.ru>Signed-off-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: Fix spelling in comment (varables -> variables)
Signed-off-by: Stefan Weil <sw@weilnetz.de>Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
tcg-i386: Introduce limited deposit support
x86 cannot provide an optimized generic deposit implementation. But atleast for a few special cases, namely for writing bits 0..7, 8..15, and0..15, versions using only a single instruction are feasible.Introducing such limited support improves emulating 16-bit x86 code on...
tcg: Declare TCG_TARGET_REG_BITS in tcg.h
TCG_TARGET_REG_BITS can be determined by the compiler,so there is no need to declare it for each individual tcg target.
This is especially important for new tcg targetswhich will be supported by the tcg interpreter....
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.
TCG: fix copy propagation
Copy propagation introduced in 22613af4a6d9602001e6d0e7b6d98aa40aa018dcconsidered only global registers. However, register temps and stackallocated locals must be handled differently because register tempsdon't survive across brcond....
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>...
cpu-exec.c: avoid AREG0 use
Make functions take a parameter for CPUState instead of relyingon global env. Pass CPUState pointer to TCG prologue, which movesit to AREG0.
Thanks to Peter Maydell and Laurent Desnogues for the ARM prologuechange.
Revert the hacks to avoid AREG0 use on Sparc hosts....
tcg: If DEBUG_TCGV, distinguish TCGv_ptr from TCGv_i32/TCGv_i64
When compiling with DEBUG_TCGV enabled, make the TCGv_ptr type distinctfrom TCGv_i32/TCGv_i64. This means that using an i32 or i64 TCG op tomanipulate a TCGv_ptr will always be detected at compile time, rather...
Fix spelling in comment (additon -> addition)
Signed-off-by: Stefan Weil <weil@mail.berlios.de>Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
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.
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Fix typos in comments (accross -> across)
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: 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.
tcg: Add TYPE parameter to tcg_out_mov.
Mirror tcg_out_movi in having a TYPE parameter. This allows x86_64to 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"...
tcg: Initialize the prologue after GUEST_BASE is fixed.
This will allow backends to make intelligent choices about howto implement GUEST_BASE.
tcg: Add missing 'static' attribute
tcg_out_reloc is only used locally (in */target.c which isincluded in tcg.c).
Signed-off-by: Stefan Weil <weil@mail.berlios.de>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
tcg: Change TCGType to an enumeration.
The TCGType name was already used consistently. Changing itto an enumeration instead of a set of defines aids debugging.
tcg: Name the opcode enumeration.
Give the enumeration formed from tcg-opc.h a name: TCGOpcode.Use that enumeration type instead of "int" whereever appropriate.
tcg: Add consistency checks for op definitions
When compiled with CONFIG_DEBUG_TCG, this code looksfor missing, duplicate and wrong entries in theop definitions.
Errors will raise an assertion at program start(all checks are done in the initial phase)....
tcg: Add tcg_swap_cond.
Returns the condition as if with swapped comparison operands.
tcg: add tcg_invert_cond
It is very handy to have a reliable mapping of a condition to its inverse.
tcg: Add tcg_unsigned_cond.
Returns an unsigned version of a signed condition;returns the original condition otherwise.
tcg: fix tcg_regset_{set,reset}_reg with more than 32 registers
tcg: remove dead code
Compile TCG runtime library only once
rename DEBUG_TCG to CONFIG_DEBUG_TCG
Signed-off-by: Juan Quintela <quintela@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Add a --enable-debug-tcg option to configure
This patch allows DEBUG_TCGV to be defined (and also prevents NDEBUGfrom being defined) when passing an option to the configure script.This should help to prevent any accidental changes that enableDEBUG_TCGV in tcg/tcg.h from being committed in future, and may...
tcg/tcg.h: fix a few typos
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7024 c046a42c-6fe2-441c-8c8c-71466251a162
tcg: add a CONST flag to TCG helpers
A const function only reads its arguments and does not use TCGglobals variables. Hence a call to such a function does notsave TCG globals variabes back to their canonical location.
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>...
tcg: improve comment about pure functions
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7007 c046a42c-6fe2-441c-8c8c-71466251a162
Fix tcg after commit 6800
The introduction of TCGV_EQUAL and not op is slightly broken.The definition of DEBUG_TCGV shows that.
Signed-off-by: Laurent Desnogues <laurent.desnogues@gmail.com>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6802 c046a42c-6fe2-441c-8c8c-71466251a162
tcg: define TCGV_EQUAL_I{32,64}
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6799 c046a42c-6fe2-441c-8c8c-71466251a162
TCG: remove obsolete old_op_count profiler field
Since we don't generate any "old op" anymore, the old_op_countis unneeded.
Signed-off-by: Laurent Desnogues <laurent.desnogues@gmail.com>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6614 c046a42c-6fe2-441c-8c8c-71466251a162
Add "static"
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6588 c046a42c-6fe2-441c-8c8c-71466251a162
Remove all traces of powerpc
According to $GCC/gcc/config/rs6000/rs6000-c.c _ARCH_PPC is theubiquitous define which should be used to test whether gcc targetsPowerPC, on 64bit platforms _ARCH_PPC64 will be also defined.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6301 c046a42c-6fe2-441c-8c8c-71466251a162
tcg: remove tcg_global_reg2_new_hack()
This patch removes the unused tcg_global_reg2_new_hack() function, whichwas added in r4438 to work around a register shortage problem regardingdyngen. The only ever user of this function was removed in r4577.
Signed-off-by: Stuart Brady <stuart.brady@gmail.com>...
Some cleanups after dyngen removal
1. hostregs_helper.h: fix comment2. translate-all.c: rename dyngen_code(_search_pc) to tcg_gen_code(_search_pc)3. tcg.c: - rename dyngen_table_op_count to tcg_table_op_count - no need to generate a log of dyngen ops generated...
this patch removes some now unused things after dyngen removal.
1. dyngen-exec.h: op_param, op _jmp and some associated macros are now unused;2. Makefile.target: tcg-dyngen is not needed anymore2. tcg/tcg-op.h, tcg/tcg-opc.h: gen-op.h is dead...