createMakeInterface emits the LLVM IR for the *ssa.MakeInterface instruction. It tries to put the type in the interface value, but if that's not possible, it will do an allocation of the right size and put that in the interface value field. An interface value is a {typecode, value} tuple named runt
(val llvm.Value, typ types.Type, pos token.Pos)
| 83 | // |
| 84 | // An interface value is a {typecode, value} tuple named runtime._interface. |
| 85 | func (b *builder) createMakeInterface(val llvm.Value, typ types.Type, pos token.Pos) llvm.Value { |
| 86 | itfValue := b.emitPointerPack([]llvm.Value{val}) |
| 87 | itfType := b.getTypeCode(typ) |
| 88 | itf := llvm.Undef(b.getLLVMRuntimeType("_interface")) |
| 89 | itf = b.CreateInsertValue(itf, itfType, 0, "") |
| 90 | itf = b.CreateInsertValue(itf, itfValue, 1, "") |
| 91 | return itf |
| 92 | } |
| 93 | |
| 94 | // extractValueFromInterface extract the value from an interface value |
| 95 | // (runtime._interface) under the assumption that it is of the type given in |
no test coverage detected