/
inst_memory.go
661 lines (594 loc) · 19.1 KB
/
inst_memory.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
package ir
import (
"fmt"
"strings"
"github.com/llir/llvm/internal/gep"
"github.com/llir/llvm/ir/constant"
"github.com/llir/llvm/ir/enum"
"github.com/llir/llvm/ir/types"
"github.com/llir/llvm/ir/value"
)
// --- [ Memory instructions ] -------------------------------------------------
// ~~~ [ alloca ] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// InstAlloca is an LLVM IR alloca instruction.
type InstAlloca struct {
// Name of local variable associated with the result.
LocalIdent
// Element type.
ElemType types.Type
// (optional) Number of elements; nil if not present.
NElems value.Value
// extra.
// Type of result produced by the instruction, including an optional address
// space.
Typ *types.PointerType
// (optional) In-alloca.
InAlloca bool
// (optional) Swift error.
SwiftError bool
// (optional) Alignment; zero if not present.
Align Align
// (optional) Address space; zero if not present.
AddrSpace types.AddrSpace
// (optional) Metadata.
Metadata
}
// NewAlloca returns a new alloca instruction based on the given element type.
func NewAlloca(elemType types.Type) *InstAlloca {
inst := &InstAlloca{ElemType: elemType}
// Compute type.
inst.Type()
return inst
}
// String returns the LLVM syntax representation of the instruction as a
// type-value pair.
func (inst *InstAlloca) String() string {
return fmt.Sprintf("%s %s", inst.Type(), inst.Ident())
}
// Type returns the type of the instruction.
func (inst *InstAlloca) Type() types.Type {
// Cache type if not present.
if inst.Typ == nil {
inst.Typ = types.NewPointer(inst.ElemType)
inst.Typ.AddrSpace = inst.AddrSpace
}
return inst.Typ
}
// LLString returns the LLVM syntax representation of the instruction.
//
// 'alloca' InAllocaopt SwiftErroropt ElemType=Type NElems=(',' TypeValue)? (',' Align)? (',' AddrSpace)? Metadata=(',' MetadataAttachment)+?
func (inst *InstAlloca) LLString() string {
buf := &strings.Builder{}
fmt.Fprintf(buf, "%s = ", inst.Ident())
buf.WriteString("alloca")
if inst.InAlloca {
buf.WriteString(" inalloca")
}
if inst.SwiftError {
buf.WriteString(" swifterror")
}
fmt.Fprintf(buf, " %s", inst.ElemType)
if inst.NElems != nil {
fmt.Fprintf(buf, ", %s", inst.NElems)
}
if inst.Align != 0 {
fmt.Fprintf(buf, ", %s", inst.Align)
}
if inst.AddrSpace != 0 {
fmt.Fprintf(buf, ", %s", inst.AddrSpace)
}
for _, md := range inst.Metadata {
fmt.Fprintf(buf, ", %s", md)
}
return buf.String()
}
// Operands returns a mutable list of operands of the given instruction.
func (inst *InstAlloca) Operands() []*value.Value {
if inst.NElems != nil {
return []*value.Value{&inst.NElems}
}
return nil
}
// ~~~ [ load ] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// InstLoad is an LLVM IR load instruction.
type InstLoad struct {
// Name of local variable associated with the result.
LocalIdent
// Element type of src.
ElemType types.Type
// Source address.
Src value.Value
// extra.
// (optional) Atomic.
Atomic bool
// (optional) Volatile.
Volatile bool
// (optional) Sync scope; empty if not present.
SyncScope string
// (optional) Atomic memory ordering constraints; zero if not present.
Ordering enum.AtomicOrdering
// (optional) Alignment; zero if not present.
Align Align
// (optional) Metadata.
Metadata
}
// NewLoad returns a new load instruction based on the given element type and
// source address.
func NewLoad(elemType types.Type, src value.Value) *InstLoad {
inst := &InstLoad{ElemType: elemType, Src: src}
return inst
}
// String returns the LLVM syntax representation of the instruction as a
// type-value pair.
func (inst *InstLoad) String() string {
return fmt.Sprintf("%s %s", inst.Type(), inst.Ident())
}
// Type returns the type of the instruction.
func (inst *InstLoad) Type() types.Type {
return inst.ElemType
}
// LLString returns the LLVM syntax representation of the instruction.
//
// Load instruction.
//
// 'load' Volatileopt ElemType=Type ',' Src=TypeValue (',' Align)? Metadata=(',' MetadataAttachment)+?
//
// Atomic load instruction.
//
// 'load' Atomic Volatileopt ElemType=Type ',' Src=TypeValue SyncScopeopt Ordering=AtomicOrdering (',' Align)? Metadata=(',' MetadataAttachment)+?
func (inst *InstLoad) LLString() string {
buf := &strings.Builder{}
fmt.Fprintf(buf, "%s = ", inst.Ident())
buf.WriteString("load")
if inst.Atomic {
buf.WriteString(" atomic")
}
if inst.Volatile {
buf.WriteString(" volatile")
}
fmt.Fprintf(buf, " %s, %s", inst.ElemType, inst.Src)
if len(inst.SyncScope) > 0 {
fmt.Fprintf(buf, " syncscope(%s)", quote(inst.SyncScope))
}
if inst.Ordering != enum.AtomicOrderingNone {
fmt.Fprintf(buf, " %s", inst.Ordering)
}
if inst.Align != 0 {
fmt.Fprintf(buf, ", %s", inst.Align)
}
for _, md := range inst.Metadata {
fmt.Fprintf(buf, ", %s", md)
}
return buf.String()
}
// Operands returns a mutable list of operands of the given instruction.
func (inst *InstLoad) Operands() []*value.Value {
return []*value.Value{&inst.Src}
}
// ~~~ [ store ] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// InstStore is an LLVM IR store instruction.
type InstStore struct {
// Source value.
Src value.Value
// Destination address.
Dst value.Value
// extra.
// (optional) Atomic.
Atomic bool
// (optional) Volatile.
Volatile bool
// (optional) Sync scope; empty if not present.
SyncScope string
// (optional) Atomic memory ordering constraints; zero if not present.
Ordering enum.AtomicOrdering
// (optional) Alignment; zero if not present.
Align Align
// (optional) Metadata.
Metadata
}
// NewStore returns a new store instruction based on the given source value and
// destination address.
func NewStore(src, dst value.Value) *InstStore {
// Type-check operands.
dstPtrType, ok := dst.Type().(*types.PointerType)
if !ok {
panic(fmt.Errorf("invalid store dst operand type; expected *types.Pointer, got %T", dst.Type()))
}
if !src.Type().Equal(dstPtrType.ElemType) {
panic(fmt.Errorf("store operands are not compatible: src=%v; dst=%v", src.Type(), dst.Type()))
}
return &InstStore{Src: src, Dst: dst}
}
// LLString returns the LLVM syntax representation of the instruction.
//
// Store instruction.
//
// 'store' Volatileopt Src=TypeValue ',' Dst=TypeValue (',' Align)? Metadata=(',' MetadataAttachment)+?
//
// Atomic store instruction.
//
// 'store' Atomic Volatileopt Src=TypeValue ',' Dst=TypeValue SyncScopeopt Ordering=AtomicOrdering (',' Align)? Metadata=(',' MetadataAttachment)+?
func (inst *InstStore) LLString() string {
buf := &strings.Builder{}
buf.WriteString("store")
if inst.Atomic {
buf.WriteString(" atomic")
}
if inst.Volatile {
buf.WriteString(" volatile")
}
fmt.Fprintf(buf, " %s, %s", inst.Src, inst.Dst)
if len(inst.SyncScope) > 0 {
fmt.Fprintf(buf, " syncscope(%s)", quote(inst.SyncScope))
}
if inst.Ordering != enum.AtomicOrderingNone {
fmt.Fprintf(buf, " %s", inst.Ordering)
}
if inst.Align != 0 {
fmt.Fprintf(buf, ", %s", inst.Align)
}
for _, md := range inst.Metadata {
fmt.Fprintf(buf, ", %s", md)
}
return buf.String()
}
// Operands returns a mutable list of operands of the given instruction.
func (inst *InstStore) Operands() []*value.Value {
return []*value.Value{&inst.Src, &inst.Dst}
}
// ~~~ [ fence ] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// InstFence is an LLVM IR fence instruction.
type InstFence struct {
// Atomic memory ordering constraints.
Ordering enum.AtomicOrdering
// extra.
// (optional) Sync scope; empty if not present.
SyncScope string
// (optional) Metadata.
Metadata
}
// NewFence returns a new fence instruction based on the given atomic ordering.
func NewFence(ordering enum.AtomicOrdering) *InstFence {
return &InstFence{Ordering: ordering}
}
// LLString returns the LLVM syntax representation of the instruction.
//
// 'fence' SyncScopeopt Ordering=AtomicOrdering Metadata=(',' MetadataAttachment)+?
func (inst *InstFence) LLString() string {
buf := &strings.Builder{}
buf.WriteString("fence")
if len(inst.SyncScope) > 0 {
fmt.Fprintf(buf, " syncscope(%s)", quote(inst.SyncScope))
}
fmt.Fprintf(buf, " %s", inst.Ordering)
for _, md := range inst.Metadata {
fmt.Fprintf(buf, ", %s", md)
}
return buf.String()
}
// Operands returns a mutable list of operands of the given instruction.
func (inst *InstFence) Operands() []*value.Value {
return nil
}
// ~~~ [ cmpxchg ] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// InstCmpXchg is an LLVM IR cmpxchg instruction.
type InstCmpXchg struct {
// Name of local variable associated with the result.
LocalIdent
// Address to read from, compare against and store to.
Ptr value.Value
// Value to compare against.
Cmp value.Value
// New value to store.
New value.Value
// Atomic memory ordering constraints on success.
SuccessOrdering enum.AtomicOrdering
// Atomic memory ordering constraints on failure.
FailureOrdering enum.AtomicOrdering
// extra.
// Type of result produced by the instruction; the first field of the struct
// holds the old value, and the second field indicates success.
Typ *types.StructType
// (optional) Weak.
Weak bool
// (optional) Volatile.
Volatile bool
// (optional) Sync scope; empty if not present.
SyncScope string
// (optional) Metadata.
Metadata
}
// NewCmpXchg returns a new cmpxchg instruction based on the given address,
// value to compare against, new value to store, and atomic orderings for
// success and failure.
func NewCmpXchg(ptr, cmp, new value.Value, successOrdering, failureOrdering enum.AtomicOrdering) *InstCmpXchg {
inst := &InstCmpXchg{Ptr: ptr, Cmp: cmp, New: new, SuccessOrdering: successOrdering, FailureOrdering: failureOrdering}
// Compute type.
inst.Type()
return inst
}
// String returns the LLVM syntax representation of the instruction as a
// type-value pair.
func (inst *InstCmpXchg) String() string {
return fmt.Sprintf("%s %s", inst.Type(), inst.Ident())
}
// Type returns the type of the instruction. The result type is a struct type
// with two fields, the first field has the type of the old value and the second
// field has boolean type.
func (inst *InstCmpXchg) Type() types.Type {
// Cache type if not present.
if inst.Typ == nil {
oldType := inst.New.Type()
inst.Typ = types.NewStruct(oldType, types.I1)
}
return inst.Typ
}
// LLString returns the LLVM syntax representation of the instruction.
//
// 'cmpxchg' Weakopt Volatileopt Ptr=TypeValue ',' Cmp=TypeValue ',' New=TypeValue SyncScopeopt SuccessOrdering=AtomicOrdering FailureOrdering=AtomicOrdering Metadata=(',' MetadataAttachment)+?
func (inst *InstCmpXchg) LLString() string {
buf := &strings.Builder{}
fmt.Fprintf(buf, "%s = ", inst.Ident())
buf.WriteString("cmpxchg")
if inst.Weak {
buf.WriteString(" weak")
}
if inst.Volatile {
buf.WriteString(" volatile")
}
fmt.Fprintf(buf, " %s, %s, %s", inst.Ptr, inst.Cmp, inst.New)
if len(inst.SyncScope) > 0 {
fmt.Fprintf(buf, " syncscope(%s)", quote(inst.SyncScope))
}
fmt.Fprintf(buf, " %s", inst.SuccessOrdering)
fmt.Fprintf(buf, " %s", inst.FailureOrdering)
for _, md := range inst.Metadata {
fmt.Fprintf(buf, ", %s", md)
}
return buf.String()
}
// Operands returns a mutable list of operands of the given instruction.
func (inst *InstCmpXchg) Operands() []*value.Value {
return []*value.Value{&inst.Ptr, &inst.Cmp, &inst.New}
}
// ~~~ [ atomicrmw ] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// InstAtomicRMW is an LLVM IR atomicrmw instruction.
type InstAtomicRMW struct {
// Name of local variable associated with the result.
LocalIdent
// Atomic operation.
Op enum.AtomicOp
// Destination address.
Dst value.Value
// Operand.
X value.Value
// Atomic memory ordering constraints.
Ordering enum.AtomicOrdering
// extra.
// Type of result produced by the instruction.
Typ types.Type
// (optional) Volatile.
Volatile bool
// (optional) Sync scope; empty if not present.
SyncScope string
// (optional) Metadata.
Metadata
}
// NewAtomicRMW returns a new atomicrmw instruction based on the given atomic
// operation, destination address, operand and atomic ordering.
func NewAtomicRMW(op enum.AtomicOp, dst, x value.Value, ordering enum.AtomicOrdering) *InstAtomicRMW {
inst := &InstAtomicRMW{Op: op, Dst: dst, X: x, Ordering: ordering}
// Compute type.
inst.Type()
return inst
}
// String returns the LLVM syntax representation of the instruction as a
// type-value pair.
func (inst *InstAtomicRMW) String() string {
return fmt.Sprintf("%s %s", inst.Type(), inst.Ident())
}
// Type returns the type of the instruction.
func (inst *InstAtomicRMW) Type() types.Type {
// Cache type if not present.
if inst.Typ == nil {
t, ok := inst.Dst.Type().(*types.PointerType)
if !ok {
panic(fmt.Errorf("invalid destination type; expected *types.PointerType, got %T", inst.Dst.Type()))
}
inst.Typ = t.ElemType
}
return inst.Typ
}
// LLString returns the LLVM syntax representation of the instruction.
//
// 'atomicrmw' Volatileopt Op=AtomicOp Dst=TypeValue ',' X=TypeValue SyncScopeopt Ordering=AtomicOrdering Metadata=(',' MetadataAttachment)+?
func (inst *InstAtomicRMW) LLString() string {
buf := &strings.Builder{}
fmt.Fprintf(buf, "%s = ", inst.Ident())
buf.WriteString("atomicrmw")
if inst.Volatile {
buf.WriteString(" volatile")
}
fmt.Fprintf(buf, " %s %s, %s", inst.Op, inst.Dst, inst.X)
if len(inst.SyncScope) > 0 {
fmt.Fprintf(buf, " syncscope(%s)", quote(inst.SyncScope))
}
fmt.Fprintf(buf, " %s", inst.Ordering)
for _, md := range inst.Metadata {
fmt.Fprintf(buf, ", %s", md)
}
return buf.String()
}
// Operands returns a mutable list of operands of the given instruction.
func (inst *InstAtomicRMW) Operands() []*value.Value {
return []*value.Value{&inst.Dst, &inst.X}
}
// ~~~ [ getelementptr ] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// InstGetElementPtr is an LLVM IR getelementptr instruction.
type InstGetElementPtr struct {
// Name of local variable associated with the result.
LocalIdent
// Element type.
ElemType types.Type
// Source address.
Src value.Value
// Element indicies.
Indices []value.Value
// extra.
// Type of result produced by the instruction.
Typ types.Type // *types.PointerType or *types.VectorType (with elements of pointer type)
// (optional) In-bounds.
InBounds bool
// (optional) Metadata.
Metadata
}
// NewGetElementPtr returns a new getelementptr instruction based on the given
// element type, source address and element indices.
func NewGetElementPtr(elemType types.Type, src value.Value, indices ...value.Value) *InstGetElementPtr {
inst := &InstGetElementPtr{ElemType: elemType, Src: src, Indices: indices}
// Compute type.
inst.Type()
return inst
}
// String returns the LLVM syntax representation of the instruction as a
// type-value pair.
func (inst *InstGetElementPtr) String() string {
return fmt.Sprintf("%s %s", inst.Type(), inst.Ident())
}
// Type returns the type of the instruction.
func (inst *InstGetElementPtr) Type() types.Type {
// Cache type if not present.
if inst.Typ == nil {
inst.Typ = gepInstType(inst.ElemType, inst.Src.Type(), inst.Indices)
}
return inst.Typ
}
// LLString returns the LLVM syntax representation of the instruction.
//
// 'getelementptr' InBoundsopt ElemType=Type ',' Src=TypeValue Indices=(',' TypeValue)* Metadata=(',' MetadataAttachment)+?
func (inst *InstGetElementPtr) LLString() string {
buf := &strings.Builder{}
fmt.Fprintf(buf, "%s = ", inst.Ident())
buf.WriteString("getelementptr")
if inst.InBounds {
buf.WriteString(" inbounds")
}
fmt.Fprintf(buf, " %s, %s", inst.ElemType, inst.Src)
for _, index := range inst.Indices {
fmt.Fprintf(buf, ", %s", index)
}
for _, md := range inst.Metadata {
fmt.Fprintf(buf, ", %s", md)
}
return buf.String()
}
// Operands returns a mutable list of operands of the given instruction.
func (inst *InstGetElementPtr) Operands() []*value.Value {
ops := make([]*value.Value, 0, 1+len(inst.Indices))
ops = append(ops, &inst.Src)
for i := range inst.Indices {
ops = append(ops, &inst.Indices[i])
}
return ops
}
// ### [ Helper functions ] ####################################################
// gepInstType computes the result type of a getelementptr instruction.
//
// getelementptr ElemType, Src, Indices
func gepInstType(elemType, src types.Type, indices []value.Value) types.Type {
var idxs []gep.Index
for _, index := range indices {
var idx gep.Index
switch index := index.(type) {
case constant.Constant:
idx = getIndex(index)
default:
idx = gep.Index{HasVal: false}
// Check if index is of vector type.
if indexType, ok := index.Type().(*types.VectorType); ok {
idx.VectorLen = indexType.Len
}
}
idxs = append(idxs, idx)
}
return gep.ResultType(elemType, src, idxs)
}
// NOTE: keep getIndex in sync with getIndex in:
//
// * ast/inst_memory.go
// * ir/inst_memory.go
// * ir/constant/expr_memory.go
//
// The reference point and source of truth is in ir/constant/expr_memory.go.
// getIndex returns the gep index corresponding to the given constant index.
func getIndex(index constant.Constant) gep.Index {
// unpack inrange indices.
if idx, ok := index.(*constant.Index); ok {
index = idx.Constant
}
// TODO: figure out how to simplify expressions for GEP instructions without
// creating import cycle on irutil.
// Use index.Simplify() to simplify the constant expression to a concrete
// integer constant or vector of integers constant.
//if idx, ok := index.(constant.Expression); ok {
// index = idx.Simplify()
//}
switch index := index.(type) {
case *constant.Int:
val := index.X.Int64()
return gep.NewIndex(val)
case *constant.ZeroInitializer:
return gep.NewIndex(0)
case *constant.Vector:
// ref: https://llvm.org/docs/LangRef.html#getelementptr-instruction
//
// > The getelementptr returns a vector of pointers, instead of a single
// > address, when one or more of its arguments is a vector. In such
// > cases, all vector arguments should have the same number of elements,
// > and every scalar argument will be effectively broadcast into a vector
// > during address calculation.
if len(index.Elems) == 0 {
return gep.Index{HasVal: false}
}
// Sanity check. All vector elements must be integers, and must have the
// same value.
var val int64
for i, elem := range index.Elems {
switch elem := elem.(type) {
case *constant.Int:
x := elem.X.Int64()
if i == 0 {
val = x
} else if x != val {
// since all elements were not identical, we must conclude that
// the index vector does not have a concrete value.
return gep.Index{
HasVal: false,
VectorLen: uint64(len(index.Elems)),
}
}
default:
// TODO: remove debug output.
panic(fmt.Errorf("support for gep index vector element type %T not yet implemented", elem))
//return gep.Index{HasVal: false}
}
}
return gep.Index{
HasVal: true,
Val: val,
VectorLen: uint64(len(index.Elems)),
}
case *constant.Undef:
return gep.Index{HasVal: false}
case *constant.Poison:
return gep.Index{HasVal: false}
case constant.Expression:
// should already have been simplified to a form we can handle.
return gep.Index{HasVal: false}
default:
// TODO: add support for more constant expressions.
// TODO: remove debug output.
panic(fmt.Errorf("support for gep index type %T not yet implemented", index))
//return gep.Index{HasVal: false}
}
}