| 4035 | } |
| 4036 | |
| 4037 | void PrintUpdateInstr(MemberUpdateInstruction * instr) |
| 4038 | { |
| 4039 | int variableID = ctx.AddInstrVariableDeclaration((ILOperand*)instr, instr->Operands[0]->Type, StorageClass::Function); |
| 4040 | ctx.AddInstrStore((ILOperand*)instr, variableID, GetOperandValue(instr->Operands[0].Ptr())); |
| 4041 | |
| 4042 | auto typeIL = ctx.IDInfos[variableID]().GetILType().Ptr(); |
| 4043 | int memberID = -1; |
| 4044 | int indexID = GetOperandValue(instr->Operands[1].Ptr()); |
| 4045 | |
| 4046 | if (indexID == -1) |
| 4047 | throw InvalidOperationException("bad index in PrintUpdateInstr(): " + instr->Operands[1]->ToString()); |
| 4048 | |
| 4049 | if (auto structType = dynamic_cast<ILStructType*>(typeIL)) |
| 4050 | { |
| 4051 | auto c = dynamic_cast<ILConstOperand*>(instr->Operands[1].Ptr()); |
| 4052 | if (c) |
| 4053 | memberID = ctx.AddInstrAccessChain_StructMember(0, variableID, indexID, c->IntValues[0]); |
| 4054 | else |
| 4055 | throw InvalidOperationException("index of struct must be const in PrintUpdateInstr(): " + instr->Operands[1]->ToString()); |
| 4056 | } |
| 4057 | else if (auto arrayType = dynamic_cast<ILArrayType*>(typeIL)) |
| 4058 | { |
| 4059 | memberID = ctx.AddInstrAccessChain_ArrayMember(0, typeIL, variableID, indexID); |
| 4060 | } |
| 4061 | else if (auto vecType = dynamic_cast<ILBasicType*>(typeIL)) |
| 4062 | { |
| 4063 | if (!typeIL->IsVector()) |
| 4064 | throw InvalidOperationException("unable to update members of type: " + typeIL->ToString()); |
| 4065 | memberID = ctx.AddInstrAccessChain_VectorMember(0, variableID, indexID, -1); |
| 4066 | } |
| 4067 | else |
| 4068 | throw InvalidOperationException("not supported type in PrintUpdateInstr(): " + typeIL->ToString()); |
| 4069 | |
| 4070 | ctx.AddInstrStore( |
| 4071 | 0, |
| 4072 | memberID, |
| 4073 | GetOperandValue(instr->Operands[2].Ptr()) |
| 4074 | ); |
| 4075 | ctx.InvalidateValue((ILOperand*)instr); |
| 4076 | } |
| 4077 | |
| 4078 | void PrintSelectInstr(SelectInstruction * instr) |
| 4079 | { |
nothing calls this directly
no test coverage detected