[clang] [lld] [llvm] [LLVM][WebAssembly] Implement branch hinting proposal (PR #146230)

Derek Schuff via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 5 14:42:17 PDT 2025


Lukas =?utf-8?q?Döllerer?= <contact at lukas-doellerer.de>,
Lukas =?utf-8?q?Döllerer?= <contact at lukas-doellerer.de>,
Lukas =?utf-8?q?Döllerer?= <contact at lukas-doellerer.de>,
Lukas =?utf-8?q?Döllerer?= <contact at lukas-doellerer.de>,
Lukas =?utf-8?q?Döllerer?= <contact at lukas-doellerer.de>,
Lukas =?utf-8?q?Döllerer?= <contact at lukas-doellerer.de>,
Lukas =?utf-8?q?Döllerer?= <lukas.doellerer at tum.de>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/146230 at github.com>


================
@@ -70,6 +75,25 @@ WebAssemblyAsmBackend::getFixupKindInfo(MCFixupKind Kind) const {
   return Infos[Kind - FirstTargetFixupKind];
 }
 
+std::pair<bool, bool> WebAssemblyAsmBackend::relaxLEB128(MCFragment &LF,
----------------
dschuff wrote:

Ok, sorry for the delay here, I had to poke around in the code more because I didn't remember how everything works.
The LEBs used when encoding instructions are encoded manually: [WebAssemblyMCCodeEmitter::encodeInstruction](https://github.com/llvm/llvm-project/blob/main/llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCCodeEmitter.cpp#L61) encodes the instruction (including relocatable LEBs) into a buffer and appends the fixup to a list.
https://github.com/llvm/llvm-project/blob/main/llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCCodeEmitter.cpp#L186-L189

Its caller is [MCObjectStreamer::emitInstToData](https://github.com/llvm/llvm-project/blob/main/llvm/lib/MC/MCObjectStreamer.cpp#L431) and there's not much interesting there because the fragment is not relaxable. 

https://github.com/llvm/llvm-project/pull/146230


More information about the llvm-commits mailing list