[all-commits] [llvm/llvm-project] bf35f4: [WebAssembly][CodeGen] IR support for WebAssembly ...

Andy Wingo via All-commits all-commits at lists.llvm.org
Mon May 31 01:42:44 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: bf35f4af51cddd743435bb6b94a45592c967891a
      https://github.com/llvm/llvm-project/commit/bf35f4af51cddd743435bb6b94a45592c967891a
  Author: Andy Wingo <wingo at igalia.com>
  Date:   2021-05-31 (Mon, 31 May 2021)

  Changed paths:
    M llvm/include/llvm/CodeGen/MIRYamlMapping.h
    M llvm/include/llvm/CodeGen/TargetFrameLowering.h
    M llvm/lib/Target/AMDGPU/SIFrameLowering.cpp
    M llvm/lib/Target/RISCV/RISCVFrameLowering.cpp
    M llvm/lib/Target/WebAssembly/Utils/WebAssemblyUtilities.cpp
    M llvm/lib/Target/WebAssembly/Utils/WebAssemblyUtilities.h
    M llvm/lib/Target/WebAssembly/WebAssemblyExplicitLocals.cpp
    M llvm/lib/Target/WebAssembly/WebAssemblyFrameLowering.cpp
    M llvm/lib/Target/WebAssembly/WebAssemblyFrameLowering.h
    M llvm/lib/Target/WebAssembly/WebAssemblyISD.def
    M llvm/lib/Target/WebAssembly/WebAssemblyISelDAGToDAG.cpp
    M llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
    M llvm/lib/Target/WebAssembly/WebAssemblyInstrInfo.td
    A llvm/test/CodeGen/WebAssembly/ir-locals-stackid.ll
    A llvm/test/CodeGen/WebAssembly/ir-locals.ll

  Log Message:
  -----------
  [WebAssembly][CodeGen] IR support for WebAssembly local variables

This patch adds TargetStackID::WasmLocal.  This stack holds locations of
values that are only addressable by name -- not via a pointer to memory.
For the WebAssembly target, these objects are lowered to WebAssembly
local variables, which are managed by the WebAssembly run-time and are
not addressable by linear memory.

For the WebAssembly target IR indicates that an AllocaInst should be put
on TargetStackID::WasmLocal by putting it in the non-integral address
space WASM_ADDRESS_SPACE_WASM_VAR, with value 1.  SROA will mostly lift
these allocations to SSA locals, but any alloca that reaches instruction
selection (usually in non-optimized builds) will be assigned the new
TargetStackID there.  Loads and stores to those values are transformed
to new WebAssemblyISD::LOCAL_GET / WebAssemblyISD::LOCAL_SET nodes,
which then lower to the type-specific LOCAL_GET_I32 etc instructions via
tablegen patterns.

Differential Revision: https://reviews.llvm.org/D101140




More information about the All-commits mailing list