Lukas =?utf-8?q?Döllerer?= <cont...@lukas-doellerer.de>,
Lukas =?utf-8?q?Döllerer?= <cont...@lukas-doellerer.de>,
Lukas =?utf-8?q?Döllerer?= <cont...@lukas-doellerer.de>,
Lukas =?utf-8?q?Döllerer?= <cont...@lukas-doellerer.de>,
Lukas =?utf-8?q?Döllerer?= <cont...@lukas-doellerer.de>,
Lukas =?utf-8?q?Döllerer?= <cont...@lukas-doellerer.de>,
Lukas =?utf-8?q?Döllerer?= <lukas.doelle...@tum.de>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/146...@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:

So expanding on this more: because of that, emitInstToData just appends the 
instruction to a regular data fragment.
MCObjectStreamer::emitULEB128Value instead makes a new fragment with a special 
FT_LEB type. I'm guessing this might be specifically because ordinarily you'd 
want to LEBs to be relaxed into their smallest encoding. Outside of Wasm, LEBs 
are mostly used for DWARF and AFAIK don't need to be padded the way we do.

So this made me think a bit about more about how we want this to go through the 
assembler. Arguably we origininally could have done something like what you did 
here, sending the LEBs through the assembly layer as LEBs and then finding a 
way to keep them from being relaxed. I had thought we'd naturally want to use 
the`.sleb128` assembler directives here (one thing that is new with this change 
is that we want to encode the LEBs as raw section data rather than as part of 
instructions).
But those currently aren't really right for this use case because we never made 
them that way. So maybe it just makes sense to do the same approach of encoding 
the LEBs into a buffer and emit that directly to the section with fixups the 
way the instruction encoder does. Hopefully it won't be too terrible in terms 
of layering or duplication. I hope that should also eliminate the need for the 
DEBUG_REF reloc type.

https://github.com/llvm/llvm-project/pull/146230
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to