Store stores val to the pointer ptr.
(val *Value)
| 96 | |
| 97 | // Store stores val to the pointer ptr. |
| 98 | func (v *Value) Store(val *Value) { |
| 99 | if !IsPointer(v.ty) { |
| 100 | fail("Store must be to a pointer. Got %v", v.Type) |
| 101 | } |
| 102 | elTy := v.Type().(Pointer).Element |
| 103 | if val.ty.String() != elTy.String() { |
| 104 | fail("Attempted to store value of type %v to pointer element type %v", |
| 105 | val.ty.TypeName(), elTy.TypeName()) |
| 106 | } |
| 107 | v.b.llvm.CreateStore(val.llvm, v.llvm) |
| 108 | } |
| 109 | |
| 110 | func field(s *Struct, f IndexOrName) (Field, int) { |
| 111 | var i int |