Skip to content

Introduce helper-to-tcg

Anton Johansson via qemu development qemu-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v2 Latest50 patches 37 repliesIn review

Changes in v2 from the cover letter

- Use QEMU_ANNOTATE over introducing LLVM_ANNOTATE (Philippe);
- Move .h -> .hpp to avoid checkpatch (Philppe);
- Meson changes (Paolo);
- Gvec size changing operations (zext/sext/trunc) along with constant vector creation has been moved from general gvec operations to being emitted by helper-to-tcg on demand. A simple interface for specifying the target vector layout is available through commandline options (Richard);
- Constant vectors initialized from arrays now vectorized;
- Introduced a model of target vector layouts;
- Shifted LLVM version support from 10-14 to 15-21;
- Improved end-to-end testing, now verifies output across LLVM versions, currently these tests along with their expected output serve as usage examples;
- Added docker tests for supported LLVM versions;
- Dropped the tcg_gen_callN dispatcher in favour of emitting gen_helper_*()

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/50accel/tcg: Add bitreverse and funnel-shift runtime helper functionsaccel/tcg/tcg-runtime.c accel/tcg/tcg-runtime.h+34 -02 replies
2/50accel/tcg: Add getpc helperaccel/tcg/tcg-runtime.c accel/tcg/tcg-runtime.h+7 -01 reply
3/50tcg: Introduce tcg-global-mappingsinclude/tcg/tcg-global-mappings.h tcg/meson.build tcg/tcg-global-mappings.c+181 -01 reply
4/50tcg: Increase maximum TB sizeinclude/tcg/tcg.h+1 -11 reply
5/50tcg: Expose tcg_gen_ussub_sat()include/tcg/tcg-op-common.h tcg/tcg-op-gvec.c+4 -22 replies
6/50Add helper-to-tcg subprojectmeson.build meson_options.txt scripts/meson-buildoptions.sh +2 more+80 -01 reply
7/50helper-to-tcg: Introduce get-llvm-ir.pysubprojects/helper-to-tcg/get-llvm-ir.py subprojects/helper-to-tcg/meson.build+153 -02 replies
8/50helper-to-tcg: Handle LLVM version compatibilitysubprojects/helper-to-tcg/include/LlvmCompat.hpp subprojects/helper-to-tcg/meson.build subprojects/helper-to-tcg/src/LlvmCompat.cpp+214 -01 reply
9/50helper-to-tcg: Introduce custom LLVM pipelinesubprojects/helper-to-tcg/include/CmdLineOptions.hpp subprojects/helper-to-tcg/meson.build subprojects/helper-to-tcg/src/Pipeline.cpp+170 -00 replies
10/50helper-to-tcg: Add pipeline --debug and --debug-onlysubprojects/helper-to-tcg/src/Pipeline.cpp+24 -10 replies
11/50helper-to-tcg: Add simple error creation helpersubprojects/helper-to-tcg/include/Error.hpp+38 -00 replies
12/50helper-to-tcg: Introduce PrepareForOptPasssubprojects/helper-to-tcg/include/PrepareForOptPass.hpp subprojects/helper-to-tcg/meson.build subprojects/helper-to-tcg/src/Pipeline.cpp +1 more+91 -00 replies
13/50helper-to-tcg: PrepareForOptPass, demangle function namessubprojects/helper-to-tcg/src/PrepareForOptPass/PrepareForOptPass.cpp+42 -12 replies
14/50helper-to-tcg: PrepareForOptPass, map annotationssubprojects/helper-to-tcg/include/FunctionAnnotation.hpp subprojects/helper-to-tcg/include/PrepareForOptPass.hpp subprojects/helper-to-tcg/src/Pipeline.cpp +1 more+209 -23 replies
15/50helper-to-tcg: PrepareForOptPass, cull unused functionssubprojects/helper-to-tcg/include/CmdLineOptions.hpp subprojects/helper-to-tcg/include/PrepareForOptPass.hpp subprojects/helper-to-tcg/src/Pipeline.cpp +1 more+96 -41 reply
16/50helper-to-tcg: PrepareForOptPass, undef llvm.returnaddresssubprojects/helper-to-tcg/src/PrepareForOptPass/PrepareForOptPass.cpp+47 -01 reply
17/50helper-to-tcg: PrepareForOptPass, fixup inline attributessubprojects/helper-to-tcg/src/PrepareForOptPass/PrepareForOptPass.cpp+14 -01 reply
18/50helper-to-tcg: PrepareForOptPass, collect debuginfosubprojects/helper-to-tcg/include/DebugInfo.hpp subprojects/helper-to-tcg/include/PrepareForOptPass.hpp subprojects/helper-to-tcg/src/Pipeline.cpp +1 more+107 -41 reply
19/50helper-to-tcg: Pipeline, run optimization passsubprojects/helper-to-tcg/src/Pipeline.cpp+12 -01 reply
20/50helper-to-tcg: Introduce pseudo instructionssubprojects/helper-to-tcg/include/PseudoInst.hpp subprojects/helper-to-tcg/include/PseudoInst.inc subprojects/helper-to-tcg/meson.build +1 more+337 -01 reply
21/50helper-to-tcg: Add guest vector layout descriptionsubprojects/helper-to-tcg/include/VectorLayout.hpp+116 -01 reply
22/50helper-to-tcg: Introduce PrepareForTcgPasssubprojects/helper-to-tcg/include/CmdLineOptions.hpp subprojects/helper-to-tcg/include/PrepareForTcgPass.hpp subprojects/helper-to-tcg/meson.build +2 more+79 -01 reply
23/50helper-to-tcg: PrepareForTcgPass, remove functions with cyclessubprojects/helper-to-tcg/src/PrepareForTcgPass/PrepareForTcgPass.cpp+32 -21 reply
24/50helper-to-tcg: PrepareForTcgPass, demote PHI nodessubprojects/helper-to-tcg/src/PrepareForTcgPass/PrepareForTcgPass.cpp+23 -01 reply
25/50helper-to-tcg: PrepareForTcgPass, map TCG globalssubprojects/helper-to-tcg/include/PrepareForTcgPass.hpp subprojects/helper-to-tcg/include/TcgGlobalMap.hpp subprojects/helper-to-tcg/src/Pipeline.cpp +1 more+112 -50 replies
26/50helper-to-tcg: PrepareForTcgPass, transform GEPssubprojects/helper-to-tcg/include/PrepareForTcgPass.hpp subprojects/helper-to-tcg/meson.build subprojects/helper-to-tcg/src/Pipeline.cpp +3 more+411 -30 replies
27/50helper-to-tcg: PrepareForTcgPass, canonicalize IRsubprojects/helper-to-tcg/include/CmdLineOptions.hpp subprojects/helper-to-tcg/include/PrepareForTcgPass.hpp subprojects/helper-to-tcg/meson.build +4 more+1290 -30 replies
28/50helper-to-tcg: PrepareForTcgPass, identity map trivial expressionssubprojects/helper-to-tcg/meson.build subprojects/helper-to-tcg/src/PrepareForTcgPass/IdentityMap.cpp subprojects/helper-to-tcg/src/PrepareForTcgPass/IdentityMap.hpp +1 more+135 -00 replies
29/50helper-to-tcg: Introduce TcgV structuresubprojects/helper-to-tcg/include/TcgType.hpp+276 -00 replies
30/50helper-to-tcg: Introduce TcgGenPasssubprojects/helper-to-tcg/include/CmdLineOptions.hpp subprojects/helper-to-tcg/include/TcgGenPass.hpp subprojects/helper-to-tcg/meson.build +2 more+561 -12 replies
31/50helper-to-tcg: TcgGenPass, linearize basic blockssubprojects/helper-to-tcg/meson.build subprojects/helper-to-tcg/src/TcgGenPass/LinearizeBlocks.cpp subprojects/helper-to-tcg/src/TcgGenPass/LinearizeBlocks.hpp+173 -01 reply
32/50helper-to-tcg: TcgGenPass, introduce Value <-> TcgV mapsubprojects/helper-to-tcg/src/TcgGenPass/ValueMapping.hpp+110 -00 replies
33/50helper-to-tcg: TcgGenPass, add structs for string emissionsubprojects/helper-to-tcg/meson.build subprojects/helper-to-tcg/src/TcgGenPass/TcgEmit.cpp subprojects/helper-to-tcg/src/TcgGenPass/TcgEmit.hpp+1519 -00 replies
34/50helper-to-tcg: TcgGenPass, map arguments to TCGsubprojects/helper-to-tcg/meson.build subprojects/helper-to-tcg/src/TcgGenPass/MapArguments.cpp+123 -00 replies
35/50helper-to-tcg: TcgGenPass, propagate constant expresssionssubprojects/helper-to-tcg/meson.build subprojects/helper-to-tcg/src/TcgGenPass/MapConstantExpressions.cpp+329 -00 replies
36/50helper-to-tcg: TcgGenPass, allocate TCG registerssubprojects/helper-to-tcg/meson.build subprojects/helper-to-tcg/src/TcgGenPass/MapTemporaries.cpp+620 -00 replies
37/50helper-to-tcg: TcgGenPass, emit TCG stringssubprojects/helper-to-tcg/meson.build subprojects/helper-to-tcg/src/TcgGenPass/MapTcgOperations.cpp+989 -00 replies
38/50helper-to-tcg: Add READMEsubprojects/helper-to-tcg/README.md+297 -00 replies
39/50helper-to-tcg: Add end-to-end testssubprojects/helper-to-tcg/meson.build subprojects/helper-to-tcg/tests/call-to-declaration.c subprojects/helper-to-tcg/tests/call-translation.c +57 more+17835 -00 replies
40/50test: helper-to-tcg docker teststests/docker/dockerfiles/debian-llvm.docker tests/docker/test-helper-to-tcg+79 -03 replies
41/50target/hexagon: Add get_tb_mmu_index()target/hexagon/translate.c target/hexagon/translate.h+16 -01 reply
42/50target/hexagon: Increase VECTOR_TEMPS_MAXtarget/hexagon/cpu.h+5 -10 replies
43/50target/hexagon: Provide env to tcg global mappingtarget/hexagon/translate.c+57 -621 reply
44/50target/hexagon: Keep gen_slotval/check_noshuf for helper-to-tcgtarget/hexagon/genptr.c target/hexagon/op_helper.c+2 -21 reply
45/50target/hexagon: Emit annotations for helperstarget/hexagon/gen_helper_funcs.py target/hexagon/gen_helper_protos.py target/hexagon/gen_tcg_funcs.py +1 more+54 -120 replies
46/50target/hexagon: Split probe_and_commit helpertarget/hexagon/helper.h target/hexagon/op_helper.c+15 -31 reply
47/50target/hexagon: Use helper-to-tcg helper callstarget/hexagon/genptr.c target/hexagon/helper.h target/hexagon/translate.c+20 -00 replies
48/50target/hexagon: Manually call generated HVX instructionstarget/hexagon/gen_tcg_funcs.py target/hexagon/hex_common.py+72 -00 replies
49/50target/hexagon: Use idef-parser as a fallbacktarget/hexagon/gen_idef_parser_funcs.py+9 -00 replies
50/50target/hexagon: Use helper-to-tcgconfigs/targets/hexagon-linux-user.mak configs/targets/hexagon-softmmu.mak target/hexagon/meson.build+110 -401 reply

Reviews trailers per patch

19 of 50 patches have a Reviewed-by or Acked-by.

PatchPhilippe Mathieu-DaudéAlessandro Di Federico
1/50R-b
2/50
3/50
4/50
5/50R-b
6/50
7/50R-b
8/50
9/50
10/50
11/50
12/50
13/50R-b
14/50R-b
15/50R-b
16/50R-b
17/50R-b
18/50R-b
19/50R-b
20/50R-b
21/50R-b
22/50R-b
23/50R-b
24/50R-b
25/50
26/50
27/50
28/50
29/50
30/50
31/50R-b
32/50
33/50
34/50
35/50
36/50
37/50
38/50
39/50
40/50R-b
41/50R-b
42/50
43/50
44/50
45/50
46/50R-b
47/50
48/50
49/50
50/50

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 00/50] Introduce helper-to-tcg

Hi all, this patchset introduces helper-to-tcg, a LLVM based build-time C to TCG translator, as a QEMU subproject. The purpose of this tool is to simplify implementation of instructions in TCG by automatically translating helper functions for a given target to TCG. It may also be used as a standalone tool for getting a base TCG implementation for complicated instructions.

See KVM forum 2023 and 2025 presentations which give an overview of its application to Hexagon and RISCV:

- https://www.youtube.com/watch?v=Gwz0kp7IZPE
- https://www.youtube.com/watch?v=7qIwraM3-4I

helper-to-tcg is also applied to the Hexagon frontend, managing to translate 1280 instructions, 162 of which are HVX instructions. In the current patchset we translate 1240 instructions due to limiting emission of the heavier vectorized instructions which requires larger TBs and more vector temporaries. For the time being, idef-parser remains translating 281 instructions consisting mostly of complicated load instructions. This count will be reduced over time until idef-parser can be deprecated.

As an example, consider the following helper function implementation of a Hexagon instruction for performing a 2-element scalar product, using signed saturated arithmetic

  void HELPER(V6_vdmpyhvsat)(CPUHexagonState *env,
                             void * restrict VdV_void,
                             void * restrict VuV_void,
                             void * restrict VvV_void)
  {
      fVFOREACH(32, i) {
          size8s_t accum = fMPY16SS(fGETHALF(0,VuV.w[i]),fGETHALF(0, VvV.w[i]));
          accum += fMPY16SS(fGETHALF(1,VuV.w[i]),fGETHALF(1, VvV.w[i]));
          VdV.w[i] = fVSATW(accum);
      }
  }

which at the end of the helper-to-tcg pipeline will have been converted to the following LLVM IR

  define void @helper_V6_vdmpyhvsat(%struct.CPUArchState* %0,
                                    i8* %1, i8* %2, i8* %3) {
      %4 = bitcast i8* %2 to <32 x i32>*
      %wide.load = load <32 x i32>, <32 x i32>* %4
      %5 = call <32 x i32> @VecShlScalar(<32 x i32> %wide.load, i32 16)
      %6 = call <32 x i32> @VecAShrScalar(<32 x i32> %5, i32 16)
      %7 = bitcast i8* %3 to <32 x i32>*
      %wide.load23 = load <32 x i32>, <32 x i32>* %7
      %8 = call <32 x i32> @VecShlScalar(<32 x i32> %wide.load23, i32 16)
      %9 = call <32 x i32> @VecAShrScalar(<32 x i32> %8, i32 16)
      %10 = mul nsw <32 x i32> %9, %6
      %11 = call <32 x i32> @VecAShrScalar(<32 x i32> %wide.load, i32 16)
      %12 = call <32 x i32> @VecAShrScalar(<32 x i32> %wide.load23, i32 16)
      %13 = mul nsw <32 x i32> %12, %11
      %14 = bitcast i8* %1 to <32 x i32>*
      ret void
  }

which, in TCG, gets emitted as

  void emit_V6_vdmpyhvsat(TCGv_env env, intptr_t vec3,
                          intptr_t vec7, intptr_t vec6) {
      VectorMem mem = {0};
      intptr_t vec0 = temp_new_gvec(&mem, 128);
      tcg_gen_gvec_shli(MO_32, vec0, vec7, 16, 128, 128);
      intptr_t vec5 = temp_new_gvec(&mem, 128);
      tcg_gen_gvec_sari(MO_32, vec5, vec0, 16, 128, 128);
      intptr_t vec1 = temp_new_gvec(&mem, 128);
      tcg_gen_gvec_shli(MO_32, vec1, vec6, 16, 128, 128);
      tcg_gen_gvec_sari(MO_32, vec1, vec1, 16, 128, 128);
      tcg_gen_gvec_mul(MO_32, vec1, vec1, vec5, 128, 128);
      intptr_t vec2 = temp_new_gvec(&mem, 128);
      tcg_gen_gvec_sari(MO_32, vec2, vec7, 16, 128, 128);
      tcg_gen_gvec_sari(MO_32, vec0, vec6, 16, 128, 128);
      tcg_gen_gvec_mul(MO_32, vec2, vec0, vec2, 128, 128);
      tcg_gen_gvec_ssadd(MO_32, vec3, vec1, vec2, 128, 128);
  }

consisting of a few vectorized shifts, multiplications, and a signed saturated add.

For a more in-depth usage guide see subprojects/helper-to-tcg/README.md.

Limitations:
- Does not handle functions with multiple return values. On Hexagon, a large set of instructions still translated by idef-parser fall into this category.

- Can emit complicated vector operations that are not the most host-friendly, identifying and emitting custom GVec patterns would be interesting.

Patchset overview:
1. helper-to-tcg (patches 6-40) - Introduces the actual translator as a QEMU subproject.

2. Fills gaps in TCG instructions (patches 1,2,5) - Since the tool is LLVM based it allows for translation of vector instructions to gvec instructions in Tinycode. This requires the introduction of a few new tcg_gen_gvec_*() functions for dealing with sign- and zero-extension, along with a function for initializing a vector to a constant, and functions for bitreversal and funnel shift.

3. Mapping of cpu state (patch 3) - helper-to-tcg needs information about the offsets of fields in the cpu state that correspond to TCG globals, so these can be emitted in the output code. For this purpose, a target may define an array of struct cpu_tcg_mapping to map fields in the cpu state to TCG globals in a declarative way. This global array can be parsed by helper-to-tcg, and replaces manually calling tcg_global_mem_new*() in frontend.

4. Increases max size of generated TB code (patch 4) - Due to the power of the LLVM auto-vectorizer, helper-to-tcg can emit quite complicated vectorized gvec code. Particularly for Hexagon where a single instruction packet can consist of multiple vector instructions. A single instruction packet can in rare cases exceed the TB buffer size of 128 longs.

5. Applies helper-to-tcg to Hexagon (patches 41-50) - helper-to-tcg is used on the Hexagon frontend to translate a majority of helper functions in place of idef-parser. For the time being idef-parser will remain in use to translate instructions with multiple return values that are not representable as helper functions and therefore translatable with helper-to-tcg.

Changes in v2:
- Use QEMU_ANNOTATE over introducing LLVM_ANNOTATE (Philippe);
- Move .h -> .hpp to avoid checkpatch (Philppe);
- Meson changes (Paolo);
- Gvec size changing operations (zext/sext/trunc) along with constant vector creation has been moved from general gvec operations to being emitted by helper-to-tcg on demand. A simple interface for specifying the target vector layout is available through commandline options (Richard);
- Constant vectors initialized from arrays now vectorized;
- Introduced a model of target vector layouts;
- Shifted LLVM version support from 10-14 to 15-21;
- Improved end-to-end testing, now verifies output across LLVM versions, currently these tests along with their expected output serve as usage examples;
- Added docker tests for supported LLVM versions;
- Dropped the tcg_gen_callN dispatcher in favour of emitting gen_helper_*()

    definitions directly;
  - Optionally allow calls to declarations, custom jump instructions, and propagation of
    DisasContext to better slot into existing frontends;
  - Limit vector usage for hexagon to 8 temporaries and 16 gvec
    instructions, also use existing `tmp_VRegs[]` memory.

- Many cleanups and bugfixes.

Anton Johansson (50):
accel/tcg: Add bitreverse and funnel-shift runtime helper functions accel/tcg: Add getpc helper
tcg: Introduce tcg-global-mappings
tcg: Increase maximum TB size
tcg: Expose tcg_gen_ussub_sat()
Add helper-to-tcg subproject
helper-to-tcg: Introduce get-llvm-ir.py
helper-to-tcg: Handle LLVM version compatibility
helper-to-tcg: Introduce custom LLVM pipeline
helper-to-tcg: Add pipeline --debug and --debug-only
helper-to-tcg: Add simple error creation helper
helper-to-tcg: Introduce PrepareForOptPass
helper-to-tcg: PrepareForOptPass, demangle function names
helper-to-tcg: PrepareForOptPass, map annotations
helper-to-tcg: PrepareForOptPass, cull unused functions
helper-to-tcg: PrepareForOptPass, undef llvm.returnaddress
helper-to-tcg: PrepareForOptPass, fixup inline attributes
helper-to-tcg: PrepareForOptPass, collect debuginfo
helper-to-tcg: Pipeline, run optimization pass
helper-to-tcg: Introduce pseudo instructions
helper-to-tcg: Add guest vector layout description
helper-to-tcg: Introduce PrepareForTcgPass
helper-to-tcg: PrepareForTcgPass, remove functions with cycles
helper-to-tcg: PrepareForTcgPass, demote PHI nodes
helper-to-tcg: PrepareForTcgPass, map TCG globals
helper-to-tcg: PrepareForTcgPass, transform GEPs
helper-to-tcg: PrepareForTcgPass, canonicalize IR
helper-to-tcg: PrepareForTcgPass, identity map trivial expressions
helper-to-tcg: Introduce TcgV structure
helper-to-tcg: Introduce TcgGenPass
helper-to-tcg: TcgGenPass, linearize basic blocks
helper-to-tcg: TcgGenPass, introduce Value <-> TcgV map
helper-to-tcg: TcgGenPass, add structs for string emission
helper-to-tcg: TcgGenPass, map arguments to TCG
helper-to-tcg: TcgGenPass, propagate constant expresssions
helper-to-tcg: TcgGenPass, allocate TCG registers
helper-to-tcg: TcgGenPass, emit TCG strings
helper-to-tcg: Add README
helper-to-tcg: Add end-to-end tests
test: helper-to-tcg docker tests
target/hexagon: Add get_tb_mmu_index()
target/hexagon: Increase VECTOR_TEMPS_MAX target/hexagon: Provide env to tcg global mapping target/hexagon: Keep gen_slotval/check_noshuf for helper-to-tcg target/hexagon: Emit annotations for helpers target/hexagon: Split probe_and_commit helper target/hexagon: Use helper-to-tcg helper calls target/hexagon: Manually call generated HVX instructions target/hexagon: Use idef-parser as a fallback target/hexagon: Use helper-to-tcg

 accel/tcg/tcg-runtime.c                       |   33 +
 accel/tcg/tcg-runtime.h                       |    8 +
 configs/targets/hexagon-linux-user.mak        |    1 +
 configs/targets/hexagon-softmmu.mak           |    1 +
 include/tcg/tcg-global-mappings.h             |  118 ++
 include/tcg/tcg-op-common.h                   |    2 +
 include/tcg/tcg.h                             |    2 +-
 meson.build                                   |   10 +
 meson_options.txt                             |    2 +
 scripts/meson-buildoptions.sh                 |    5 +
 subprojects/helper-to-tcg/README.md           |  297 ++++
 subprojects/helper-to-tcg/get-llvm-ir.py      |  145 ++
 .../helper-to-tcg/include/CmdLineOptions.hpp  |   46 +
 .../helper-to-tcg/include/DebugInfo.hpp       |   46 +
 subprojects/helper-to-tcg/include/Error.hpp   |   38 +
 .../include/FunctionAnnotation.hpp            |  104 ++
 .../helper-to-tcg/include/LlvmCompat.hpp      |  124 ++
 .../include/PrepareForOptPass.hpp             |   42 +
 .../include/PrepareForTcgPass.hpp             |   37 +
 .../helper-to-tcg/include/PseudoInst.hpp      |   75 +
 .../helper-to-tcg/include/PseudoInst.inc      |   78 ++
 .../helper-to-tcg/include/TcgGenPass.hpp      |   63 +
 .../helper-to-tcg/include/TcgGlobalMap.hpp    |   40 +
 subprojects/helper-to-tcg/include/TcgType.hpp |  276 ++++
 .../helper-to-tcg/include/VectorLayout.hpp    |  116 ++
 subprojects/helper-to-tcg/meson.build         |   86 ++
 subprojects/helper-to-tcg/meson_options.txt   |    2 +
 subprojects/helper-to-tcg/src/LlvmCompat.cpp  |   89 ++
 subprojects/helper-to-tcg/src/Pipeline.cpp    |  399 ++++++
 .../PrepareForOptPass/PrepareForOptPass.cpp   |  363 +++++
 .../src/PrepareForTcgPass/CanonicalizeIR.cpp  | 1193 ++++++++++++++++
 .../src/PrepareForTcgPass/CanonicalizeIR.hpp  |   24 +
 .../src/PrepareForTcgPass/IdentityMap.cpp     |   91 ++
 .../src/PrepareForTcgPass/IdentityMap.hpp     |   39 +
 .../PrepareForTcgPass/PrepareForTcgPass.cpp   |  150 ++
 .../src/PrepareForTcgPass/TransformGEPs.cpp   |  355 +++++
 .../src/PrepareForTcgPass/TransformGEPs.hpp   |   45 +
 subprojects/helper-to-tcg/src/PseudoInst.cpp  |  183 +++
 .../src/TcgGenPass/LinearizeBlocks.cpp        |  140 ++
 .../src/TcgGenPass/LinearizeBlocks.hpp        |   32 +
 .../src/TcgGenPass/MapArguments.cpp           |  122 ++
 .../src/TcgGenPass/MapConstantExpressions.cpp |  328 +++++
 .../src/TcgGenPass/MapTcgOperations.cpp       |  988 ++++++++++++++
 .../src/TcgGenPass/MapTemporaries.cpp         |  619 +++++++++
 .../helper-to-tcg/src/TcgGenPass/TcgEmit.cpp  | 1203 +++++++++++++++++
 .../helper-to-tcg/src/TcgGenPass/TcgEmit.hpp  |  315 +++++
 .../src/TcgGenPass/TcgGenPass.cpp             |  385 ++++++
 .../src/TcgGenPass/ValueMapping.hpp           |  110 ++
 .../helper-to-tcg/tests/call-to-declaration.c |   33 +
 .../helper-to-tcg/tests/call-translation.c    |   35 +
 subprojects/helper-to-tcg/tests/cpustate.c    |   44 +
 .../helper-to-tcg/tests/forward-context.c     |   21 +
 subprojects/helper-to-tcg/tests/ldst.c        |   17 +
 subprojects/helper-to-tcg/tests/meson.build   |  121 ++
 .../tests/ref/15/call-to-declaration.c        |   26 +
 .../tests/ref/15/call-translation.c           |   28 +
 .../helper-to-tcg/tests/ref/15/cpustate.c     |   36 +
 .../tests/ref/15/forward-context.c            |   30 +
 subprojects/helper-to-tcg/tests/ref/15/ldst.c |   21 +
 .../helper-to-tcg/tests/ref/15/scalar.c       |   21 +
 .../tests/ref/15/user-pcrel-jump.c            |   33 +
 .../tests/ref/15/vector-layout-f16L.c         |  527 ++++++++
 .../tests/ref/15/vector-layout-f16M.c         |  527 ++++++++
 .../tests/ref/15/vector-layout-f32L.c         |  527 ++++++++
 .../tests/ref/15/vector-layout-f32M.c         |  527 ++++++++
 .../tests/ref/15/vector-layout-f64L.c         |  527 ++++++++
 .../tests/ref/15/vector-layout-f64M.c         |  527 ++++++++
 .../tests/ref/15/vector-layout-f8L.c          |  527 ++++++++
 .../tests/ref/15/vector-layout-f8M.c          |  527 ++++++++
 .../tests/ref/15/vector-layout-t16L.c         |  527 ++++++++
 .../tests/ref/15/vector-layout-t16M.c         |  527 ++++++++
 .../tests/ref/15/vector-layout-t32L.c         |  527 ++++++++
 .../tests/ref/15/vector-layout-t32M.c         |  527 ++++++++
 .../tests/ref/15/vector-layout-t64L.c         |  527 ++++++++
 .../tests/ref/15/vector-layout-t64M.c         |  527 ++++++++
 .../tests/ref/15/vector-layout-t8L.c          |  527 ++++++++
 .../tests/ref/15/vector-layout-t8M.c          |  527 ++++++++
 .../helper-to-tcg/tests/ref/15/vector.c       |   31 +
 .../tests/ref/21/call-to-declaration.c        |   26 +
 .../tests/ref/21/call-translation.c           |   28 +
 .../helper-to-tcg/tests/ref/21/cpustate.c     |   36 +
 .../tests/ref/21/forward-context.c            |   30 +
 subprojects/helper-to-tcg/tests/ref/21/ldst.c |   21 +
 .../helper-to-tcg/tests/ref/21/scalar.c       |   21 +
 .../tests/ref/21/user-pcrel-jump.c            |   33 +
 .../tests/ref/21/vector-layout-f16L.c         |  527 ++++++++
 .../tests/ref/21/vector-layout-f16M.c         |  527 ++++++++
 .../tests/ref/21/vector-layout-f32L.c         |  527 ++++++++
 .../tests/ref/21/vector-layout-f32M.c         |  527 ++++++++
 .../tests/ref/21/vector-layout-f64L.c         |  527 ++++++++
 .../tests/ref/21/vector-layout-f64M.c         |  527 ++++++++
 .../tests/ref/21/vector-layout-f8L.c          |  527 ++++++++
 .../tests/ref/21/vector-layout-f8M.c          |  527 ++++++++
 .../tests/ref/21/vector-layout-t16L.c         |  527 ++++++++
 .../tests/ref/21/vector-layout-t16M.c         |  527 ++++++++
 .../tests/ref/21/vector-layout-t32L.c         |  527 ++++++++
 .../tests/ref/21/vector-layout-t32M.c         |  527 ++++++++
 .../tests/ref/21/vector-layout-t64L.c         |  527 ++++++++
 .../tests/ref/21/vector-layout-t64M.c         |  527 ++++++++
 .../tests/ref/21/vector-layout-t8L.c          |  527 ++++++++
 .../tests/ref/21/vector-layout-t8M.c          |  527 ++++++++
 .../helper-to-tcg/tests/ref/21/vector.c       |   31 +
 subprojects/helper-to-tcg/tests/scalar.c      |   15 +
 .../helper-to-tcg/tests/tcg-global-mappings.h |  118 ++
 .../helper-to-tcg/tests/user-pcrel-jump.c     |   28 +
 .../helper-to-tcg/tests/vector-layout.c       |   51 +
 subprojects/helper-to-tcg/tests/vector.c      |   34 +
 target/hexagon/cpu.h                          |    6 +-
 target/hexagon/gen_helper_funcs.py            |   17 +-
 target/hexagon/gen_helper_protos.py           |    2 +-
 target/hexagon/gen_idef_parser_funcs.py       |    9 +
 target/hexagon/gen_tcg_funcs.py               |   16 +-
 target/hexagon/genptr.c                       |    6 +-
 target/hexagon/helper.h                       |    9 +
 target/hexagon/hex_common.py                  |  103 +-
 target/hexagon/meson.build                    |  148 +-
 target/hexagon/op_helper.c                    |   17 +-
 target/hexagon/translate.c                    |  139 +-
 target/hexagon/translate.h                    |    4 +
 tcg/meson.build                               |    1 +
 tcg/tcg-global-mappings.c                     |   62 +
 tcg/tcg-op-gvec.c                             |    4 +-
 tests/docker/dockerfiles/debian-llvm.docker   |   38 +
 tests/docker/test-helper-to-tcg               |   41 +
 124 files changed, 27303 insertions(+), 122 deletions(-)
 create mode 100644 include/tcg/tcg-global-mappings.h
 create mode 100644 subprojects/helper-to-tcg/README.md
 create mode 100755 subprojects/helper-to-tcg/get-llvm-ir.py
 create mode 100644 subprojects/helper-to-tcg/include/CmdLineOptions.hpp
 create mode 100644 subprojects/helper-to-tcg/include/DebugInfo.hpp
 create mode 100644 subprojects/helper-to-tcg/include/Error.hpp
 create mode 100644 subprojects/helper-to-tcg/include/FunctionAnnotation.hpp
 create mode 100644 subprojects/helper-to-tcg/include/LlvmCompat.hpp
 create mode 100644 subprojects/helper-to-tcg/include/PrepareForOptPass.hpp
 create mode 100644 subprojects/helper-to-tcg/include/PrepareForTcgPass.hpp
 create mode 100644 subprojects/helper-to-tcg/include/PseudoInst.hpp
 create mode 100644 subprojects/helper-to-tcg/include/PseudoInst.inc
 create mode 100644 subprojects/helper-to-tcg/include/TcgGenPass.hpp
 create mode 100644 subprojects/helper-to-tcg/include/TcgGlobalMap.hpp
 create mode 100644 subprojects/helper-to-tcg/include/TcgType.hpp
 create mode 100644 subprojects/helper-to-tcg/include/VectorLayout.hpp
 create mode 100644 subprojects/helper-to-tcg/meson.build
 create mode 100644 subprojects/helper-to-tcg/meson_options.txt
 create mode 100644 subprojects/helper-to-tcg/src/LlvmCompat.cpp
 create mode 100644 subprojects/helper-to-tcg/src/Pipeline.cpp
 create mode 100644 subprojects/helper-to-tcg/src/PrepareForOptPass/PrepareForOptPass.cpp
 create mode 100644 subprojects/helper-to-tcg/src/PrepareForTcgPass/CanonicalizeIR.cpp
 create mode 100644 subprojects/helper-to-tcg/src/PrepareForTcgPass/CanonicalizeIR.hpp
 create mode 100644 subprojects/helper-to-tcg/src/PrepareForTcgPass/IdentityMap.cpp
 create mode 100644 subprojects/helper-to-tcg/src/PrepareForTcgPass/IdentityMap.hpp
 create mode 100644 subprojects/helper-to-tcg/src/PrepareForTcgPass/PrepareForTcgPass.cpp
 create mode 100644 subprojects/helper-to-tcg/src/PrepareForTcgPass/TransformGEPs.cpp
 create mode 100644 subprojects/helper-to-tcg/src/PrepareForTcgPass/TransformGEPs.hpp
 create mode 100644 subprojects/helper-to-tcg/src/PseudoInst.cpp
 create mode 100644 subprojects/helper-to-tcg/src/TcgGenPass/LinearizeBlocks.cpp
 create mode 100644 subprojects/helper-to-tcg/src/TcgGenPass/LinearizeBlocks.hpp
 create mode 100644 subprojects/helper-to-tcg/src/TcgGenPass/MapArguments.cpp
 create mode 100644 subprojects/helper-to-tcg/src/TcgGenPass/MapConstantExpressions.cpp
 create mode 100644 subprojects/helper-to-tcg/src/TcgGenPass/MapTcgOperations.cpp
 create mode 100644 subprojects/helper-to-tcg/src/TcgGenPass/MapTemporaries.cpp
 create mode 100644 subprojects/helper-to-tcg/src/TcgGenPass/TcgEmit.cpp
 create mode 100644 subprojects/helper-to-tcg/src/TcgGenPass/TcgEmit.hpp
 create mode 100644 subprojects/helper-to-tcg/src/TcgGenPass/TcgGenPass.cpp
 create mode 100644 subprojects/helper-to-tcg/src/TcgGenPass/ValueMapping.hpp
 create mode 100644 subprojects/helper-to-tcg/tests/call-to-declaration.c
 create mode 100644 subprojects/helper-to-tcg/tests/call-translation.c
 create mode 100644 subprojects/helper-to-tcg/tests/cpustate.c
 create mode 100644 subprojects/helper-to-tcg/tests/forward-context.c
 create mode 100644 subprojects/helper-to-tcg/tests/ldst.c
 create mode 100644 subprojects/helper-to-tcg/tests/meson.build
 create mode 100644 subprojects/helper-to-tcg/tests/ref/15/call-to-declaration.c
 create mode 100644 subprojects/helper-to-tcg/tests/ref/15/call-translation.c
 create mode 100644 subprojects/helper-to-tcg/tests/ref/15/cpustate.c
 create mode 100644 subprojects/helper-to-tcg/tests/ref/15/forward-context.c
 create mode 100644 subprojects/helper-to-tcg/tests/ref/15/ldst.c
 create mode 100644 subprojects/helper-to-tcg/tests/ref/15/scalar.c
 create mode 100644 subprojects/helper-to-tcg/tests/ref/15/user-pcrel-jump.c
 create mode 100644 subprojects/helper-to-tcg/tests/ref/15/vector-layout-f16L.c
 create mode 100644 subprojects/helper-to-tcg/tests/ref/15/vector-layout-f16M.c
 create mode 100644 subprojects/helper-to-tcg/tests/ref/15/vector-layout-f32L.c
 create mode 100644 subprojects/helper-to-tcg/tests/ref/15/vector-layout-f32M.c
 create mode 100644 subprojects/helper-to-tcg/tests/ref/15/vector-layout-f64L.c
 create mode 100644 subprojects/helper-to-tcg/tests/ref/15/vector-layout-f64M.c
 create mode 100644 subprojects/helper-to-tcg/tests/ref/15/vector-layout-f8L.c
 create mode 100644 subprojects/helper-to-tcg/tests/ref/15/vector-layout-f8M.c
 create mode 100644 subprojects/helper-to-tcg/tests/ref/15/vector-layout-t16L.c
 create mode 100644 subprojects/helper-to-tcg/tests/ref/15/vector-layout-t16M.c
 create mode 100644 subprojects/helper-to-tcg/tests/ref/15/vector-layout-t32L.c
 create mode 100644 subprojects/helper-to-tcg/tests/ref/15/vector-layout-t32M.c
 create mode 100644 subprojects/helper-to-tcg/tests/ref/15/vector-layout-t64L.c
 create mode 100644 subprojects/helper-to-tcg/tests/ref/15/vector-layout-t64M.c
 create mode 100644 subprojects/helper-to-tcg/tests/ref/15/vector-layout-t8L.c
 create mode 100644 subprojects/helper-to-tcg/tests/ref/15/vector-layout-t8M.c
 create mode 100644 subprojects/helper-to-tcg/tests/ref/15/vector.c
 create mode 100644 subprojects/helper-to-tcg/tests/ref/21/call-to-declaration.c
 create mode 100644 subprojects/helper-to-tcg/tests/ref/21/call-translation.c
 create mode 100644 subprojects/helper-to-tcg/tests/ref/21/cpustate.c
 create mode 100644 subprojects/helper-to-tcg/tests/ref/21/forward-context.c
 create mode 100644 subprojects/helper-to-tcg/tests/ref/21/ldst.c
 create mode 100644 subprojects/helper-to-tcg/tests/ref/21/scalar.c
 create mode 100644 subprojects/helper-to-tcg/tests/ref/21/user-pcrel-jump.c
 create mode 100644 subprojects/helper-to-tcg/tests/ref/21/vector-layout-f16L.c
 create mode 100644 subprojects/helper-to-tcg/tests/ref/21/vector-layout-f16M.c
 create mode 100644 subprojects/helper-to-tcg/tests/ref/21/vector-layout-f32L.c
 create mode 100644 subprojects/helper-to-tcg/tests/ref/21/vector-layout-f32M.c
 create mode 100644 subprojects/helper-to-tcg/tests/ref/21/vector-layout-f64L.c
 create mode 100644 subprojects/helper-to-tcg/tests/ref/21/vector-layout-f64M.c
 create mode 100644 subprojects/helper-to-tcg/tests/ref/21/vector-layout-f8L.c
 create mode 100644 subprojects/helper-to-tcg/tests/ref/21/vector-layout-f8M.c
 create mode 100644 subprojects/helper-to-tcg/tests/ref/21/vector-layout-t16L.c
 create mode 100644 subprojects/helper-to-tcg/tests/ref/21/vector-layout-t16M.c
 create mode 100644 subprojects/helper-to-tcg/tests/ref/21/vector-layout-t32L.c
 create mode 100644 subprojects/helper-to-tcg/tests/ref/21/vector-layout-t32M.c
 create mode 100644 subprojects/helper-to-tcg/tests/ref/21/vector-layout-t64L.c
 create mode 100644 subprojects/helper-to-tcg/tests/ref/21/vector-layout-t64M.c
 create mode 100644 subprojects/helper-to-tcg/tests/ref/21/vector-layout-t8L.c
 create mode 100644 subprojects/helper-to-tcg/tests/ref/21/vector-layout-t8M.c
 create mode 100644 subprojects/helper-to-tcg/tests/ref/21/vector.c
 create mode 100644 subprojects/helper-to-tcg/tests/scalar.c
 create mode 100644 subprojects/helper-to-tcg/tests/tcg-global-mappings.h
 create mode 100644 subprojects/helper-to-tcg/tests/user-pcrel-jump.c
 create mode 100644 subprojects/helper-to-tcg/tests/vector-layout.c
 create mode 100644 subprojects/helper-to-tcg/tests/vector.c
 create mode 100644 tcg/tcg-global-mappings.c
 create mode 100644 tests/docker/dockerfiles/debian-llvm.docker
 create mode 100755 tests/docker/test-helper-to-tcg
Signature · 1 line
2.52.0