mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
SIL: improve inline bitfields in SILNode, SILBasicBlock and Operand
* Let the customBits and lastInitializedBitfieldID share a single uint64_t. This increases the number of available bits in SILNode and Operand from 8 to 20. Also, it simplifies the Operand class because no PointerIntPairs are used anymore to store the operand pointer fields. * Instead make the "deleted" flag a separate bool field in SILNode (instead of encoding it with the sign of lastInitializedBitfieldID). Another simplification * Enable important invariant checks also in release builds by using `require` instead of `assert`. Not catching such errors in release builds would be a disaster. * Let the Swift optimization passes use all the available bits and not only a fixed amount of 8 (SILNode) and 16 (SILBasicBlock).
This commit is contained in:
@@ -21,20 +21,20 @@ class BasicBlockBitfield;
|
||||
|
||||
struct SILFunction {
|
||||
BasicBlockBitfield *newestAliveBlockBitfield = nullptr;
|
||||
int64_t currentBitfieldID = 1;
|
||||
uint64_t currentBitfieldID = 1;
|
||||
};
|
||||
|
||||
struct SILBasicBlock {
|
||||
SILFunction *function;
|
||||
uint32_t customBits = 0;
|
||||
int64_t lastInitializedBitfieldID = 0;
|
||||
uint64_t lastInitializedBitfieldID = 0;
|
||||
|
||||
enum { numCustomBits = 32 };
|
||||
enum { maxBitfieldID = std::numeric_limits<uint64_t>::max() };
|
||||
|
||||
SILBasicBlock(SILFunction *function): function(function) {}
|
||||
|
||||
SILFunction *getFunction() const { return function; }
|
||||
bool isMarkedAsDeleted() const { return false; }
|
||||
|
||||
unsigned getCustomBits() const { return customBits; }
|
||||
void setCustomBits(unsigned value) { customBits = value; }
|
||||
|
||||
Reference in New Issue
Block a user