Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
e4b0ccd
[LLVM][WebAssembly] Implement branch hinting proposal
Lukasdoe Jul 2, 2025
a630d51
[LLVM][WebAssembly] Revert changes to WebAssemblyCFGStackify.cpp and …
Lukasdoe Jul 2, 2025
d13fe56
[LLVM][WebAssembly] Change custom section naming in object file
Lukasdoe Jul 2, 2025
7cca0fe
[LLVM][WebAssembly] Reorder branch hinting option in WebAssemblySubta…
Lukasdoe Jul 2, 2025
2c49830
[LLVM][WebAssembly] Parse code metadata entries in wasm-ld to discard…
Lukasdoe Jul 7, 2025
bee9c50
change sample ir to asm module repr in lld test
Lukasdoe Aug 1, 2025
b1db637
Merge branch 'main' into branch-hinting
Lukasdoe Aug 1, 2025
c59a707
adjust wasm leb128 relaxation for new MCFragment API
Lukasdoe Aug 2, 2025
937bec4
Merge branch 'main' into branch-hinting
Lukasdoe Aug 9, 2025
11035a3
Merge branch 'main' into branch-hinting
Lukasdoe Aug 12, 2025
5144c24
Merge branch 'main' into branch-hinting
Lukasdoe Aug 12, 2025
1562234
change test structure and other fixes from review
Lukasdoe Aug 15, 2025
d284f78
ensure correct function hint sorting based on assembler symbol order
Lukasdoe Sep 22, 2025
b16a0f6
fix nullptr deref on missing assembler ptr
Lukasdoe Oct 7, 2025
c75dc8e
formatting
Lukasdoe Oct 15, 2025
7867d51
adjust tests to new fallback order when compiling to asm
Lukasdoe Oct 15, 2025
f5604bd
Merge remote-tracking branch 'origin/main' into branch-hinting
Lukasdoe Oct 15, 2025
393b67a
instead of emitting leb128 fragments, emit wasm lebs to the data frag…
Lukasdoe Oct 17, 2025
31c149d
add test for correct assembling of variable threshold branch hints
Lukasdoe Nov 28, 2025
8b8cf47
Merge branch 'main' into branch-hinting
Lukasdoe Nov 28, 2025
cf1a0af
fixes from merging main
Lukasdoe Nov 28, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions clang/include/clang/Options/Options.td
Original file line number Diff line number Diff line change
Expand Up @@ -5468,6 +5468,8 @@ def mharden_sls_EQ : Joined<["-"], "mharden-sls=">, Group<m_Group>,

def matomics : Flag<["-"], "matomics">, Group<m_wasm_Features_Group>;
def mno_atomics : Flag<["-"], "mno-atomics">, Group<m_wasm_Features_Group>;
def mbranch_hinting : Flag<["-"], "mbranch-hinting">, Group<m_wasm_Features_Group>;
def mno_branch_hinting : Flag<["-"], "mno-branch-hinting">, Group<m_wasm_Features_Group>;
def mbulk_memory : Flag<["-"], "mbulk-memory">, Group<m_wasm_Features_Group>;
def mno_bulk_memory : Flag<["-"], "mno-bulk-memory">, Group<m_wasm_Features_Group>;
def mbulk_memory_opt : Flag<["-"], "mbulk-memory-opt">, Group<m_wasm_Features_Group>;
Expand Down
12 changes: 12 additions & 0 deletions clang/lib/Basic/Targets/WebAssembly.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ bool WebAssemblyTargetInfo::setABI(const std::string &Name) {
bool WebAssemblyTargetInfo::hasFeature(StringRef Feature) const {
return llvm::StringSwitch<bool>(Feature)
.Case("atomics", HasAtomics)
.Case("branch-hinting", HasBranchHinting)
.Case("bulk-memory", HasBulkMemory)
.Case("bulk-memory-opt", HasBulkMemoryOpt)
.Case("call-indirect-overlong", HasCallIndirectOverlong)
Expand Down Expand Up @@ -87,6 +88,8 @@ void WebAssemblyTargetInfo::getTargetDefines(const LangOptions &Opts,
defineCPUMacros(Builder, "wasm", /*Tuning=*/false);
if (HasAtomics)
Builder.defineMacro("__wasm_atomics__");
if (HasBranchHinting)
Builder.defineMacro("__wasm_branch_hinting__");
if (HasBulkMemory)
Builder.defineMacro("__wasm_bulk_memory__");
if (HasBulkMemoryOpt)
Expand Down Expand Up @@ -191,6 +194,7 @@ bool WebAssemblyTargetInfo::initFeatureMap(
auto addBleedingEdgeFeatures = [&]() {
addGenericFeatures();
Features["atomics"] = true;
Features["branch-hinting"] = true;
Features["exception-handling"] = true;
Features["extended-const"] = true;
Features["fp16"] = true;
Expand Down Expand Up @@ -223,6 +227,14 @@ bool WebAssemblyTargetInfo::handleTargetFeatures(
HasAtomics = false;
continue;
}
if (Feature == "+branch-hinting") {
HasBranchHinting = true;
continue;
}
if (Feature == "-branch-hinting") {
HasBranchHinting = false;
continue;
}
if (Feature == "+bulk-memory") {
HasBulkMemory = true;
continue;
Expand Down
1 change: 1 addition & 0 deletions clang/lib/Basic/Targets/WebAssembly.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ class LLVM_LIBRARY_VISIBILITY WebAssemblyTargetInfo : public TargetInfo {
} SIMDLevel = NoSIMD;

bool HasAtomics = false;
bool HasBranchHinting = false;
bool HasBulkMemory = false;
bool HasBulkMemoryOpt = false;
bool HasCallIndirectOverlong = false;
Expand Down
Loading