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

@@ -1226,17 +1226,13 @@ public:
return insert(new (F.getModule()) ProjectValueBufferInst(
getSILDebugLocation(Loc), valueType, operand));
}
ProjectBoxInst *createProjectBox(SILLocation Loc, SILValue boxOperand) {
auto valueTy =
boxOperand->getType().castTo<SILBoxType>()->getBoxedAddressType();
ProjectBoxInst *createProjectBox(SILLocation Loc, SILValue boxOperand,
unsigned index) {
auto boxTy = boxOperand->getType().castTo<SILBoxType>();
auto fieldTy = boxTy->getFieldType(index);
return insert(new (F.getModule()) ProjectBoxInst(
getSILDebugLocation(Loc), valueTy, boxOperand));
}
ProjectBoxInst *createProjectBox(SILLocation Loc, SILType valueTy,
SILValue boxOperand) {
return insert(new (F.getModule()) ProjectBoxInst(
getSILDebugLocation(Loc), valueTy, boxOperand));
getSILDebugLocation(Loc), boxOperand, index, fieldTy));
}
ProjectExistentialBoxInst *createProjectExistentialBox(SILLocation Loc,
SILType valueTy,