SIL: Give project_box a field index operand.

Allow project_box to get the address of any field in a multi-field box.
This commit is contained in:
Joe Groff
2016-10-21 16:01:06 -07:00
parent 374fa57530
commit e4c67e2d5a
62 changed files with 694 additions and 648 deletions

View File

@@ -286,7 +286,7 @@ public:
// it using a box.
AllocBoxInst *allocBox =
SGF.B.createAllocBox(decl, lType, {decl->isLet(), ArgNo});
SILValue addr = SGF.B.createProjectBox(decl, allocBox);
SILValue addr = SGF.B.createProjectBox(decl, allocBox, 0);
// Mark the memory as uninitialized, so DI will track it for us.
if (NeedsMarkUninit)
@@ -723,7 +723,7 @@ emitEnumMatch(ManagedValue value, EnumElementDecl *ElementDecl,
// If the payload is indirect, project it out of the box.
if (ElementDecl->isIndirect() || ElementDecl->getParentEnum()->isIndirect()) {
SILValue boxedValue = SGF.B.createProjectBox(loc, eltMV.getValue());
SILValue boxedValue = SGF.B.createProjectBox(loc, eltMV.getValue(), 0);
auto &boxedTL = SGF.getTypeLowering(boxedValue->getType());
if (boxedTL.isLoadable())
boxedValue = SGF.B.createLoad(loc, boxedValue);