diff options
| author | Fangrui Song <i@maskray.me> | 2025-06-20 20:13:04 -0700 |
|---|---|---|
| committer | Fangrui Song <i@maskray.me> | 2025-06-20 20:13:04 -0700 |
| commit | 95fbfc9be5d2842a945c04a20fe6244df9b10e18 (patch) | |
| tree | 00f80558d11aa5805e6d6f290663c6da44e5e6ef /clang/lib/AST/ByteCode/Disasm.cpp | |
| parent | a9ba028b98ffd53d9c7d00ca7563d74810fcf6e7 (diff) | |
| parent | 17e8465a3eb0cae48b9f62d27fd26f2b070f1f9b (diff) | |
[𝘀𝗽𝗿] changes introduced through rebaseusers/MaskRay/spr/main.move-relocation-specifier-constants-to-aarch64
Created using spr 1.3.5-bogner
[skip ci]
Diffstat (limited to 'clang/lib/AST/ByteCode/Disasm.cpp')
| -rw-r--r-- | clang/lib/AST/ByteCode/Disasm.cpp | 59 |
1 files changed, 41 insertions, 18 deletions
diff --git a/clang/lib/AST/ByteCode/Disasm.cpp b/clang/lib/AST/ByteCode/Disasm.cpp index 846dc2fe92a7..a3eecd06369b 100644 --- a/clang/lib/AST/ByteCode/Disasm.cpp +++ b/clang/lib/AST/ByteCode/Disasm.cpp @@ -50,34 +50,57 @@ inline static std::string printArg(Program &P, CodePtr &OpPC) { } template <> inline std::string printArg<Floating>(Program &P, CodePtr &OpPC) { - auto F = Floating::deserialize(*OpPC); - OpPC += align(F.bytesToSerialize()); + auto Sem = Floating::deserializeSemantics(*OpPC); - std::string Result; - llvm::raw_string_ostream SS(Result); - SS << F; - return Result; + unsigned BitWidth = llvm::APFloatBase::semanticsSizeInBits( + llvm::APFloatBase::EnumToSemantics(Sem)); + auto Memory = + std::make_unique<uint64_t[]>(llvm::APInt::getNumWords(BitWidth)); + Floating Result(Memory.get(), Sem); + Floating::deserialize(*OpPC, &Result); + + OpPC += align(Result.bytesToSerialize()); + + std::string S; + llvm::raw_string_ostream SS(S); + SS << Result; + return S; } template <> inline std::string printArg<IntegralAP<false>>(Program &P, CodePtr &OpPC) { - auto F = IntegralAP<false>::deserialize(*OpPC); - OpPC += align(F.bytesToSerialize()); + using T = IntegralAP<false>; + uint32_t BitWidth = T::deserializeSize(*OpPC); + auto Memory = + std::make_unique<uint64_t[]>(llvm::APInt::getNumWords(BitWidth)); - std::string Result; - llvm::raw_string_ostream SS(Result); - SS << F; - return Result; + T Result(Memory.get(), BitWidth); + T::deserialize(*OpPC, &Result); + + OpPC += align(Result.bytesToSerialize()); + + std::string Str; + llvm::raw_string_ostream SS(Str); + SS << Result; + return Str; } + template <> inline std::string printArg<IntegralAP<true>>(Program &P, CodePtr &OpPC) { - auto F = IntegralAP<true>::deserialize(*OpPC); - OpPC += align(F.bytesToSerialize()); + using T = IntegralAP<true>; + uint32_t BitWidth = T::deserializeSize(*OpPC); + auto Memory = + std::make_unique<uint64_t[]>(llvm::APInt::getNumWords(BitWidth)); - std::string Result; - llvm::raw_string_ostream SS(Result); - SS << F; - return Result; + T Result(Memory.get(), BitWidth); + T::deserialize(*OpPC, &Result); + + OpPC += align(Result.bytesToSerialize()); + + std::string Str; + llvm::raw_string_ostream SS(Str); + SS << Result; + return Str; } template <> inline std::string printArg<FixedPoint>(Program &P, CodePtr &OpPC) { |
