func buildField(b *builder, this codegen.Ref, field *types.Field) *ref { retIR := codegen.NewAddrRef( this, field.T.Size(), field.Offset(), types.IsByte(field.T), true, ) return newAddressableRef(field.T, retIR) }
func buildArrayGet(b *builder, expr *tast.IndexExpr, array *ref) *ref { index := buildArrayIndex(b, expr.Index) base, n, et := loadArray(b, array) checkInRange(b, index, n, "u<") addr := b.newPtr() b.b.Arith(addr, index, "*", ir.Snum(arrayElementSize(et))) b.b.Arith(addr, base, "+", addr) size := et.Size() retIR := ir.NewAddrRef( addr, // base address size, // size 0, // dynamic offset; precalculated types.IsByte(et), // isByte true, // isAlign ) return newAddressableRef(et, retIR) }
func (b *builder) newLocal(t types.T, name string) ir.Ref { return b.f.NewLocal(t.Size(), name, types.IsByte(t), t.RegSizeAlign(), ) }
func (b *builder) newGlobalVar(t types.T, name string) ir.Ref { name = b.anonyName(name) return b.p.NewGlobalVar(t.Size(), name, types.IsByte(t), t.RegSizeAlign()) }
func (b *builder) newTempIR(t types.T) ir.Ref { return b.f.NewTemp(t.Size(), types.IsByte(t), t.RegSizeAlign()) }