llvm.org GIT mirror llvm / e6b7482
[ORC] Use uint8_t for bitfields in SymbolTableEntry. This allows for better struct packing on MSVC, and as a bonus will eliminate a warning on GCC builds. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@362450 91177308-0d34-0410-b5e6-96231b3b80d8 Lang Hames 3 months ago
1 changed file(s) with 12 addition(s) and 8 deletion(s). Raw diff Collapse all Expand all
652652 public:
653653 SymbolTableEntry() = default;
654654 SymbolTableEntry(JITSymbolFlags Flags)
655 : Flags(Flags), State(SymbolState::NeverSearched),
655 : Flags(Flags), State(static_cast(SymbolState::NeverSearched)),
656656 MaterializerAttached(false), PendingRemoval(false) {}
657657
658658 JITTargetAddress getAddress() const { return Addr; }
659659 JITSymbolFlags getFlags() const { return Flags; }
660 SymbolState getState() const { return State; }
660 SymbolState getState() const { return static_cast(State); }
661661
662662 bool isInMaterializationPhase() const {
663 return State == SymbolState::Materializing ||
664 State == SymbolState::Resolved;
663 return getState() == SymbolState::Materializing ||
664 getState() == SymbolState::Resolved;
665665 }
666666
667667 bool hasMaterializerAttached() const { return MaterializerAttached; }
669669
670670 void setAddress(JITTargetAddress Addr) { this->Addr = Addr; }
671671 void setFlags(JITSymbolFlags Flags) { this->Flags = Flags; }
672 void setState(SymbolState State) { this->State = State; }
672 void setState(SymbolState State) {
673 assert(static_cast(State) < (1 << 6) &&
674 "State does not fit in bitfield");
675 this->State = static_cast(State);
676 }
673677
674678 void setMaterializerAttached(bool MaterializerAttached) {
675679 this->MaterializerAttached = MaterializerAttached;
686690 private:
687691 JITTargetAddress Addr = 0;
688692 JITSymbolFlags Flags;
689 SymbolState State : 6;
690 bool MaterializerAttached : 1;
691 bool PendingRemoval : 1;
693 uint8_t State : 6;
694 uint8_t MaterializerAttached : 1;
695 uint8_t PendingRemoval : 1;
692696 };
693697
694698 using SymbolTable = DenseMap;