aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmir Ayupov <aaupov@fb.com>2024-07-29 15:23:47 -0700
committerAmir Ayupov <aaupov@fb.com>2024-07-29 15:23:47 -0700
commit588c0e28dcccc2f373d083c510a8a52d50bc419c (patch)
tree56f97905bea456e38821af6bb00679a757beabdf
parentd3ecb16e852d81628d82110402ec0a18d6c6b2ac (diff)
downloadllvm-users/aaupov/spr/boltnfc-keep-input-icount-for-disassembled-functions.zip
llvm-users/aaupov/spr/boltnfc-keep-input-icount-for-disassembled-functions.tar.gz
llvm-users/aaupov/spr/boltnfc-keep-input-icount-for-disassembled-functions.tar.bz2
Created using spr 1.3.4
-rw-r--r--bolt/include/bolt/Core/BinaryFunction.h6
-rw-r--r--bolt/lib/Core/BinaryFunction.cpp2
2 files changed, 8 insertions, 0 deletions
diff --git a/bolt/include/bolt/Core/BinaryFunction.h b/bolt/include/bolt/Core/BinaryFunction.h
index 24c7db2..2c8e239 100644
--- a/bolt/include/bolt/Core/BinaryFunction.h
+++ b/bolt/include/bolt/Core/BinaryFunction.h
@@ -242,6 +242,9 @@ private:
/// Original size of the function.
uint64_t Size;
+ /// Original instruction count of the function, if disassembly succeeded.
+ uint64_t InputInstructionCount{0};
+
/// Address of the function in output.
uint64_t OutputAddress{0};
@@ -2173,6 +2176,9 @@ public:
/// Get the number of instructions within this function.
uint64_t getInstructionCount() const;
+ /// Get the original number of instructions.
+ uint64_t getInputInstructionCount() const { return InputInstructionCount; }
+
const CFIInstrMapType &getFDEProgram() const { return FrameInstructions; }
void moveRememberRestorePair(BinaryBasicBlock *BB);
diff --git a/bolt/lib/Core/BinaryFunction.cpp b/bolt/lib/Core/BinaryFunction.cpp
index ea09371..1f5869c 100644
--- a/bolt/lib/Core/BinaryFunction.cpp
+++ b/bolt/lib/Core/BinaryFunction.cpp
@@ -1499,6 +1499,8 @@ add_instruction:
clearList(Relocations);
+ InputInstructionCount = Instructions.size();
+
if (!IsSimple) {
clearList(Instructions);
return createNonFatalBOLTError("");