SuccessChanges

Summary

  1. [TableGen] Add "getOperandType" to get operand types from opcode/opidx The InstrInfoEmitter outputs an enum called "OperandType" which gives numerical IDs to each operand type. This patch makes use of this enum to define a function called "getOperandType", which allows looking up the type of an operand given its opcode and operand index. Patch by Nicolas Guillemot. Thanks! Differential Revision: https://reviews.llvm.org/D63320
  2. [WebAssembly] Implement thread-local storage (local-exec model) Summary: Thread local variables are placed inside a `.tdata` segment. Their symbols are offsets from the start of the segment. The address of a thread local variable is computed as `__tls_base` + the offset from the start of the segment. `.tdata` segment is a passive segment and `memory.init` is used once per thread to initialize the thread local storage. `__tls_base` is a wasm global. Since each thread has its own wasm instance, it is effectively thread local. Currently, `__tls_base` must be initialized at thread startup, and so cannot be used with dynamic libraries. `__tls_base` is to be initialized with a new linker-synthesized function, `__wasm_init_tls`, which takes as an argument a block of memory to use as the storage for thread locals. It then initializes the block of memory and sets `__tls_base`. As `__wasm_init_tls` will handle the memory initialization, the memory does not have to be zeroed. To help allocating memory for thread-local storage, a new compiler intrinsic is introduced: `__builtin_wasm_tls_size()`. This instrinsic function returns the size of the thread-local storage for the current function. The expected usage is to run something like the following upon thread startup: __wasm_init_tls(malloc(__builtin_wasm_tls_size())); Reviewers: tlively, aheejin, kripken, sbc100 Subscribers: dschuff, jgravelle-google, hiraditya, sunfish, jfb, cfe-commits, llvm-commits Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D64537
Revision 366274 by Justin Bogner:
[TableGen] Add "getOperandType" to get operand types from opcode/opidx

The InstrInfoEmitter outputs an enum called "OperandType" which gives
numerical IDs to each operand type. This patch makes use of this enum
to define a function called "getOperandType", which allows looking up
the type of an operand given its opcode and operand index.

Patch by Nicolas Guillemot. Thanks!

Differential Revision: https://reviews.llvm.org/D63320
Change TypePath in RepositoryPath in Workspace
The file was added/llvm/trunk/test/TableGen/get-operand-type.tdllvm.src/test/TableGen/get-operand-type.td
The file was modified/llvm/trunk/utils/TableGen/InstrInfoEmitter.cpp (diff)llvm.src/utils/TableGen/InstrInfoEmitter.cpp
Revision 366272 by quantum:
[WebAssembly] Implement thread-local storage (local-exec model)

Summary:
Thread local variables are placed inside a `.tdata` segment. Their symbols are
offsets from the start of the segment. The address of a thread local variable
is computed as `__tls_base` + the offset from the start of the segment.

`.tdata` segment is a passive segment and `memory.init` is used once per thread
to initialize the thread local storage.

`__tls_base` is a wasm global. Since each thread has its own wasm instance,
it is effectively thread local. Currently, `__tls_base` must be initialized
at thread startup, and so cannot be used with dynamic libraries.

`__tls_base` is to be initialized with a new linker-synthesized function,
`__wasm_init_tls`, which takes as an argument a block of memory to use as the
storage for thread locals. It then initializes the block of memory and sets
`__tls_base`. As `__wasm_init_tls` will handle the memory initialization,
the memory does not have to be zeroed.

To help allocating memory for thread-local storage, a new compiler intrinsic
is introduced: `__builtin_wasm_tls_size()`. This instrinsic function returns
the size of the thread-local storage for the current function.

The expected usage is to run something like the following upon thread startup:

    __wasm_init_tls(malloc(__builtin_wasm_tls_size()));

Reviewers: tlively, aheejin, kripken, sbc100

Subscribers: dschuff, jgravelle-google, hiraditya, sunfish, jfb, cfe-commits, llvm-commits

Tags: #clang, #llvm

Differential Revision: https://reviews.llvm.org/D64537
Change TypePath in RepositoryPath in Workspace
The file was modified/cfe/trunk/include/clang/Basic/BuiltinsWebAssembly.def (diff)clang.src/include/clang/Basic/BuiltinsWebAssembly.def
The file was modified/cfe/trunk/lib/CodeGen/CGBuiltin.cpp (diff)clang.src/lib/CodeGen/CGBuiltin.cpp
The file was modified/cfe/trunk/test/CodeGen/builtins-wasm.c (diff)clang.src/test/CodeGen/builtins-wasm.c
The file was modified/lld/trunk/test/wasm/data-segments.ll (diff)N/A
The file was added/lld/trunk/test/wasm/tls.llN/A
The file was modified/lld/trunk/wasm/Driver.cpp (diff)N/A
The file was modified/lld/trunk/wasm/Symbols.cpp (diff)N/A
The file was modified/lld/trunk/wasm/Symbols.h (diff)N/A
The file was modified/lld/trunk/wasm/Writer.cpp (diff)N/A
The file was modified/llvm/trunk/include/llvm/BinaryFormat/Wasm.h (diff)llvm.src/include/llvm/BinaryFormat/Wasm.h
The file was modified/llvm/trunk/include/llvm/IR/IntrinsicsWebAssembly.td (diff)llvm.src/include/llvm/IR/IntrinsicsWebAssembly.td
The file was modified/llvm/trunk/include/llvm/MC/MCSectionWasm.h (diff)llvm.src/include/llvm/MC/MCSectionWasm.h
The file was modified/llvm/trunk/lib/Target/WebAssembly/WebAssemblyFastISel.cpp (diff)llvm.src/lib/Target/WebAssembly/WebAssemblyFastISel.cpp
The file was modified/llvm/trunk/lib/Target/WebAssembly/WebAssemblyISelDAGToDAG.cpp (diff)llvm.src/lib/Target/WebAssembly/WebAssemblyISelDAGToDAG.cpp
The file was modified/llvm/trunk/lib/Target/WebAssembly/WebAssemblyMCInstLower.cpp (diff)llvm.src/lib/Target/WebAssembly/WebAssemblyMCInstLower.cpp
The file was modified/llvm/trunk/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp (diff)llvm.src/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp
The file was modified/llvm/trunk/test/CodeGen/WebAssembly/target-features-tls.ll (diff)llvm.src/test/CodeGen/WebAssembly/target-features-tls.ll
The file was modified/llvm/trunk/test/CodeGen/WebAssembly/tls.ll (diff)llvm.src/test/CodeGen/WebAssembly/tls.ll