[PATCH] D44351: [WebAssembly] Add support for thread-local data
Nicholas Wilson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Mar 10 03:18:25 PST 2018
ncw created this revision.
Herald added subscribers: llvm-commits, sunfish, aheejin, kristof.beyls, jgravelle-google, sbc100, dschuff, jfb.
MOSTLY FINISHED - SOME BITS STILL TO TIDY UP
- Enables users to use `static __thread int threadLocalValue` variable declarations
- Enables Musl to use the existing `__builtin_thread_pointer()` intrinsic to read from the "thread-local register" (on x86 that intrinsic would be reading the `%fs` register, on ARM it might be the CP15 register?)
OK, OK, I know Wasm doesn't have threads quite yet - but it will do soon, surely sometime in 2018. At that point having the infrastructure in place would be quite nice.
I'm implementing the Itanium TLS ABI, as on ARM (x86 has a weird legacy model).
TODO:
- Add some tests
- Add an intrinsic `__builtin_wasm_set_thread_pointer()` to allow Musl to initialise its TLS block
- Open the corresponding review for LLD (halfway done, I put it to one side about a month ago)
Repository:
rL LLVM
https://reviews.llvm.org/D44351
Files:
include/llvm/BinaryFormat/Wasm.h
include/llvm/BinaryFormat/WasmRelocs.def
include/llvm/MC/MCSectionWasm.h
lib/MC/WasmObjectWriter.cpp
lib/Object/WasmObjectFile.cpp
lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCTargetDesc.h
lib/Target/WebAssembly/MCTargetDesc/WebAssemblyWasmObjectWriter.cpp
lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
lib/Target/WebAssembly/WebAssemblyISelLowering.h
lib/Target/WebAssembly/WebAssemblyInstrInfo.td
lib/Target/WebAssembly/WebAssemblyMCInstLower.cpp
lib/Target/WebAssembly/WebAssemblyMCInstLower.h
tools/llvm-readobj/WasmDumper.cpp
tools/yaml2obj/yaml2wasm.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D44351.137905.patch
Type: text/x-patch
Size: 15620 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180310/d7613c45/attachment.bin>
More information about the llvm-commits
mailing list