[PATCH] D74911: [AIX] Pack BasicBlockBits

David Tenty via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 20 11:15:13 PST 2020


daltenty updated this revision to Diff 245695.
daltenty added a comment.

- Fix formating


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74911/new/

https://reviews.llvm.org/D74911

Files:
  llvm/include/llvm/IR/BasicBlock.h


Index: llvm/include/llvm/IR/BasicBlock.h
===================================================================
--- llvm/include/llvm/IR/BasicBlock.h
+++ llvm/include/llvm/IR/BasicBlock.h
@@ -461,11 +461,26 @@
   void validateInstrOrdering() const;
 
 private:
+#if defined(_AIX) && (!defined(__GNUC__) || defined(__ibmxl__))
+// Except for GCC; by default, AIX compilers store bit-fields in 4-byte words
+// and give the `pack` pragma push semantics.
+#define BEGIN_TWO_BYTE_PACK() _Pragma("pack(2)")
+#define END_TWO_BYTE_PACK() _Pragma("pack(pop)")
+#else
+#define BEGIN_TWO_BYTE_PACK()
+#define END_TWO_BYTE_PACK()
+#endif
+
+  BEGIN_TWO_BYTE_PACK()
   /// Bitfield to help interpret the bits in Value::SubclassData.
   struct BasicBlockBits {
     unsigned short BlockAddressRefCount : 15;
     unsigned short InstrOrderValid : 1;
   };
+  END_TWO_BYTE_PACK()
+
+#undef BEGIN_TWO_BYTE_PACK
+#undef END_TWO_BYTE_PACK
 
   /// Safely reinterpret the subclass data bits to a more useful form.
   BasicBlockBits getBasicBlockBits() const {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D74911.245695.patch
Type: text/x-patch
Size: 1038 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200220/78efba61/attachment.bin>


More information about the llvm-commits mailing list