Skip to content

Commit 462e58d

Browse files
committed
SILLocation: a big refactoring and reducing its size from 3 to 2 words
My goal was to reduce the size of SILLocation. It now contains only of a storage union, which is basically a pointer and a bitfield containing the Kind, StorageKind and flags. By far, most locations are only single pointers to an AST node. For the few cases where more data needs to be stored, this data is allocated separately: with the SILModule's bump pointer allocator. While working on this, I couldn't resist to do a major refactoring to simplify the code: * removed unused stuff * The term "DebugLoc" was used for 3 completely different things: - for `struct SILLocation::DebugLoc` -> renamed it to `FilePosition` - for `hasDebugLoc()`/`getDebugSourceLoc()` -> renamed it to `hasASTNodeForDebugging()`/`getSourceLocForDebugging()` - for `class SILDebugLocation` -> kept it as it is (though, `SILScopedLocation` would be a better name, IMO) * made SILLocation more "functional", i.e. replaced some setters with corresponding constructors * replaced the hand-written bitfield `KindData` with C bitfields * updated and improved comments
1 parent fd85e0e commit 462e58d

25 files changed

+576
-733
lines changed

include/swift/SIL/PrettyStackTrace.h

+2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020

2121
#include "swift/SIL/SILLocation.h"
2222
#include "swift/SIL/SILNode.h"
23+
#include "llvm/ADT/SmallString.h"
24+
#include "llvm/ADT/Twine.h"
2325
#include "llvm/Support/PrettyStackTrace.h"
2426

2527
namespace swift {

0 commit comments

Comments
 (0)