[llvm] [AArch64][SVE] Tweak how SVE CFI expressions are emitted (PR #151677)
Sander de Smalen via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 4 03:20:41 PDT 2025
================
@@ -221,6 +221,23 @@ inline uint64_t decodeULEB128AndIncUnsafe(const uint8_t *&p) {
return decodeULEB128AndInc(p, nullptr);
}
+enum class LEB128Sign { Unsigned, Signed };
+
+template <LEB128Sign Sign, typename T, typename U = char,
+ unsigned MaxLEB128SizeBytes = 16>
+inline void appendLEB128(SmallVectorImpl<U> &Buffer, T Value) {
+ static_assert(sizeof(U) == 1, "Expected buffer of bytes");
+ unsigned LEB128ValueSize;
+ U TmpBuffer[MaxLEB128SizeBytes];
+ if constexpr (Sign == LEB128Sign::Signed)
----------------
sdesmalen-arm wrote:
Why not create two functions `appendSLEB128` and `appendULEB128` ? That removes the need for the enumeration class, the static assert and this condition.
https://github.com/llvm/llvm-project/pull/151677
More information about the llvm-commits
mailing list