[llvm] 2b45895 - [JITLink] Move some Block bitfields into Addressable to improve packing.

Lang Hames via llvm-commits llvm-commits at lists.llvm.org
Sat May 22 07:59:41 PDT 2021


Author: Lang Hames
Date: 2021-05-22T07:59:24-07:00
New Revision: 2b45895df46e3e87b9588bd207f417d2d2fe7482

URL: https://github.com/llvm/llvm-project/commit/2b45895df46e3e87b9588bd207f417d2d2fe7482
DIFF: https://github.com/llvm/llvm-project/commit/2b45895df46e3e87b9588bd207f417d2d2fe7482.diff

LOG: [JITLink] Move some Block bitfields into Addressable to improve packing.

Keeping these bitfields from Block to Addressable allows them to be packed with
the bitfields at the end of Addressable, reducing the size of Block by eight
bytes.

Added: 
    

Modified: 
    llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h b/llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h
index ef30775c51cff..770917f888b9c 100644
--- a/llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h
+++ b/llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h
@@ -135,6 +135,11 @@ class Addressable {
   JITTargetAddress Address = 0;
   uint64_t IsDefined : 1;
   uint64_t IsAbsolute : 1;
+
+protected:
+  // bitfields for Block, allocated here to improve packing.
+  uint64_t P2Align : 5;
+  uint64_t AlignmentOffset : 57;
 };
 
 using SectionOrdinal = unsigned;
@@ -265,8 +270,6 @@ class Block : public Addressable {
 private:
   static constexpr uint64_t MaxAlignmentOffset = (1ULL << 57) - 1;
 
-  uint64_t P2Align : 5;
-  uint64_t AlignmentOffset : 57;
   Section &Parent;
   const char *Data = nullptr;
   size_t Size = 0;


        


More information about the llvm-commits mailing list