diff options
author | Clement Courbet <courbet@google.com> | 2018-06-15 07:30:45 +0000 |
---|---|---|
committer | Clement Courbet <courbet@google.com> | 2018-06-15 07:30:45 +0000 |
commit | 4273e1e828f33692bfc45a09cd68c6ebed2aec15 (patch) | |
tree | 6397bb9100f33a4e62f8969308c2cb90252282c8 /llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp | |
parent | e4192a86dc564b5d3e19e477179275f1b2a71f4e (diff) | |
download | bcm5719-llvm-4273e1e828f33692bfc45a09cd68c6ebed2aec15.tar.gz bcm5719-llvm-4273e1e828f33692bfc45a09cd68c6ebed2aec15.zip |
[llvm-exegesis] Print the whole snippet in analysis.
Summary:
On hover, the whole asm snippet is displayed, including operands.
This requires the actual assembly output instead of just the MCInsts:
This is because some pseudo-instructions get lowered to actual target
instructions during codegen (e.g. ABS_Fp32 -> SSE or X87).
Reviewers: gchatelet
Subscribers: mgorny, tschuett, llvm-commits
Differential Revision: https://reviews.llvm.org/D48164
llvm-svn: 334805
Diffstat (limited to 'llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp')
-rw-r--r-- | llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp b/llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp index 841219cb7f2..33ad65075d9 100644 --- a/llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp +++ b/llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp @@ -10,6 +10,7 @@ #include "BenchmarkResult.h" #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/StringRef.h" +#include "llvm/ObjectYAML/YAML.h" #include "llvm/Support/FileOutputBuffer.h" #include "llvm/Support/FileSystem.h" #include "llvm/Support/Format.h" @@ -146,6 +147,23 @@ template <> struct MappingTraits<exegesis::InstructionBenchmarkKey> { }; template <> struct MappingTraits<exegesis::InstructionBenchmark> { + class NormalizedBinary { + public: + NormalizedBinary(IO &io) {} + NormalizedBinary(IO &, std::vector<uint8_t> &Data) : Binary(Data) {} + std::vector<uint8_t> denormalize(IO &) { + std::vector<uint8_t> Data; + std::string Str; + raw_string_ostream OSS(Str); + Binary.writeAsBinary(OSS); + OSS.flush(); + Data.assign(Str.begin(), Str.end()); + return Data; + } + + BinaryRef Binary; + }; + static void mapping(IO &Io, exegesis::InstructionBenchmark &Obj) { Io.mapRequired("mode", Obj.Mode); Io.mapRequired("key", Obj.Key); @@ -155,6 +173,10 @@ template <> struct MappingTraits<exegesis::InstructionBenchmark> { Io.mapRequired("measurements", Obj.Measurements); Io.mapRequired("error", Obj.Error); Io.mapOptional("info", Obj.Info); + // AssembledSnippet + MappingNormalization<NormalizedBinary, std::vector<uint8_t>> BinaryString( + Io, Obj.AssembledSnippet); + Io.mapOptional("assembled_snippet", BinaryString->Binary); } }; |