mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Small clean-up. Add createUncheckedBitCast to SILBuilder.
This new method eliminates repeated code sequences that all create an unchecked_trivial_bit_cast if the result type is trivial or unchecked_ref_bit_cast otherwise. NFC. Swift SVN r29486
This commit is contained in:
@@ -443,6 +443,17 @@ public:
|
||||
return insert(new (F.getModule()) UncheckedRefBitCastInst(Loc, Op, Ty));
|
||||
}
|
||||
|
||||
// Create the appropriate cast instruction based on result type.
|
||||
SILInstruction *createUncheckedBitCast(SILLocation Loc,
|
||||
SILValue Op,
|
||||
SILType Ty) {
|
||||
auto &M = F.getModule();
|
||||
if (Ty.isTrivial(M))
|
||||
return insert(new (M) UncheckedTrivialBitCastInst(Loc, Op, Ty));
|
||||
else
|
||||
return insert(new (M) UncheckedRefBitCastInst(Loc, Op, Ty));
|
||||
}
|
||||
|
||||
RefToBridgeObjectInst *createRefToBridgeObject(SILLocation Loc,
|
||||
SILValue Ref,
|
||||
SILValue Bits) {
|
||||
|
||||
Reference in New Issue
Block a user