mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Define critical SILInstruction and SILBasicBlock getters inline.
It makes no sense to operate on the block's instruction list without also including SILBasicBlock.h anyway. Similarly, it doesn't make sense to query the entry block without including SILFunction.h. Now we can call these simple getters in critical-path loops assuming they are as cheap as a load. I was avoiding calling these in critical path code, which resulted in less readability and consistency across the code base.
This commit is contained in:
@@ -1461,4 +1461,20 @@ private:
|
||||
|
||||
} // end llvm namespace
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Inline SIL implementations
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
namespace swift {
|
||||
|
||||
inline bool SILBasicBlock::isEntry() const {
|
||||
return this == &*getParent()->begin();
|
||||
}
|
||||
|
||||
inline SILModule &SILInstruction::getModule() const {
|
||||
return getFunction()->getModule();
|
||||
}
|
||||
|
||||
} // end swift namespace
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user