Skip to content
This repository has been archived by the owner on Mar 28, 2020. It is now read-only.
/ swift-llvm Public archive

WIP: [Swift+WASM] patches to support compiling Swift to WebAssembly #155

Draft
wants to merge 8 commits into
base: stable
Choose a base branch
from

Commits on Oct 22, 2019

  1. WebAssembly: enable Swift calling convention in ISelLowering, ignore …

    …hot/cold split directives
    zhuowei authored and MaxDesiatov committed Oct 22, 2019
    Configuration menu
    Copy the full SHA
    3b0b6ef View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    662f79a View commit details
    Browse the repository at this point in the history
  3. WebAssembly: pad __clangast section to 4 bytes

    Like Patcheng's https://reviews.llvm.org/D42233 but for Custom Sections instead
    
    padding for the padding gods.
    zhuowei authored and MaxDesiatov committed Oct 22, 2019
    Configuration menu
    Copy the full SHA
    f4445ac View commit details
    Browse the repository at this point in the history
  4. WebAssembly: attempt to fix non-SymbolExpr relocations

    Also try hard to extract a symbol from a MCExpr when writing relocations
    
    I doubt this is the right way, but hey it emits an object now
    zhuowei authored and MaxDesiatov committed Oct 22, 2019
    Configuration menu
    Copy the full SHA
    e5a7798 View commit details
    Browse the repository at this point in the history
  5. WebAssembly: add logging when I get a BinaryExpr

    I actually do need to know what's breaking.
    zhuowei authored and MaxDesiatov committed Oct 22, 2019
    Configuration menu
    Copy the full SHA
    0c8f940 View commit details
    Browse the repository at this point in the history
  6. WebAssembly: properly handle MCBinaryExpr in aliased symbols

    Swift uses aliased symbols to refer to offsets within metadata structures.
    
    eg
    
    ```
    @"$s12SwiftPrivate28_stdlib_ShardedAtomicCounterVN" = alias %swift.type, bitcast (i32* getelementptr inbounds (<{ i8**, i32, <{ i32, i32, i32, i32, i32, i32, i32 }>*, i32, i32 }>, <{ i8**, i32, <{ i32, i32, i32, i32, i32, i32, i32 }>*, i32, i32 }>* @"$s12SwiftPrivate28_stdlib_ShardedAtomicCounterVMf", i32 0, i32 1) to %swift.type*)
    ```
    
    My previous commit only got the alias to refer to the correct target symbol,
    but not at the right offset.
    
    This commit properly emits these symbols.
    
    With this change, print("hello world") works but print() with anything else is still broken.
    zhuowei authored and MaxDesiatov committed Oct 22, 2019
    Configuration menu
    Copy the full SHA
    d7a9e68 View commit details
    Browse the repository at this point in the history
  7. Revert "WebAssembly: add logging when I get a BinaryExpr"

    Don't need the logging anymore
    
    This reverts commit 8b8f31f.
    zhuowei authored and MaxDesiatov committed Oct 22, 2019
    Configuration menu
    Copy the full SHA
    0ed50bf View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    25e9748 View commit details
    Browse the repository at this point in the history