Lines Matching refs:prog
16 func (comp *compiler) genResources() []*prog.ResourceDesc {
17 var resources []*prog.ResourceDesc
30 func (comp *compiler) genResource(n *ast.Resource) *prog.ResourceDesc {
31 res := &prog.ResourceDesc{
44 res.Type = comp.genType(base, "", prog.DirIn, false)
48 func (comp *compiler) genSyscalls() []*prog.Syscall {
49 var calls []*prog.Syscall
61 func (comp *compiler) genSyscall(n *ast.Call) *prog.Syscall {
62 var ret prog.Type
64 ret = comp.genType(n.Ret, "ret", prog.DirOut, true)
66 return &prog.Syscall{
70 Args: comp.genFieldArray(n.Args, prog.DirIn, true),
75 func (comp *compiler) genStructDescs(syscalls []*prog.Syscall) []*prog.KeyedStruct {
84 detach: make(map[**prog.StructDesc]bool),
121 detach map[**prog.StructDesc]bool
122 structs []*prog.KeyedStruct
125 func (ctx *structGen) check(key prog.StructKey, descp **prog.StructDesc) bool {
142 ctx.structs = append(ctx.structs, &prog.KeyedStruct{
150 func (ctx *structGen) walk(t0 prog.Type) {
152 case *prog.PtrType:
154 case *prog.ArrayType:
156 case *prog.StructType:
158 case *prog.UnionType:
163 func (ctx *structGen) walkArray(t *prog.ArrayType) {
175 if t.Kind == prog.ArrayRangeLen && t.RangeBegin == t.RangeEnd && !t.Type.Varlen() {
180 func (ctx *structGen) walkStruct(t *prog.StructType) {
218 func (ctx *structGen) walkUnion(t *prog.UnionType) {
244 func (comp *compiler) genStructDesc(res *prog.StructDesc, n *ast.Struct, dir prog.Dir, varlen bool)…
249 *res = prog.StructDesc{
255 func (comp *compiler) markBitfields(fields []prog.Type) {
273 func setBitfieldOffset(t0 prog.Type, offset uint64, middle bool) {
275 case *prog.IntType:
277 case *prog.ConstType:
279 case *prog.LenType:
281 case *prog.FlagsType:
283 case *prog.ProcType:
290 func (comp *compiler) addAlignment(fields []prog.Type, varlen, packed bool, alignAttr uint64) []pro…
291 var newFields []prog.Type
342 func (comp *compiler) typeAlign(t0 prog.Type) uint64 {
344 case *prog.IntType, *prog.ConstType, *prog.LenType, *prog.FlagsType, *prog.ProcType,
345 *prog.CsumType, *prog.PtrType, *prog.VmaType, *prog.ResourceType:
347 case *prog.BufferType:
352 case *prog.ArrayType:
354 case *prog.StructType:
369 case *prog.UnionType:
382 func genPad(size uint64) prog.Type {
383 return &prog.ConstType{
384 IntTypeCommon: genIntCommon(genCommon("pad", "", size, prog.DirIn, false), 0, false),
389 func (comp *compiler) genField(f *ast.Field, dir prog.Dir, isArg bool) prog.Type {
393 func (comp *compiler) genFieldArray(fields []*ast.Field, dir prog.Dir, isArg bool) []prog.Type {
394 var res []prog.Type
401 func (comp *compiler) genType(t *ast.Type, field string, dir prog.Dir, isArg bool) prog.Type {
410 func genCommon(name, field string, size uint64, dir prog.Dir, opt bool) prog.TypeCommon {
411 return prog.TypeCommon{
420 func genIntCommon(com prog.TypeCommon, bitLen uint64, bigEndian bool) prog.IntTypeCommon {
421 bf := prog.FormatNative
423 bf = prog.FormatBigEndian
425 return prog.IntTypeCommon{