Lines Matching full:target
13 // Target describes target OS/arch pair.
14 type Target struct { struct
34 // SpecialTypes allows target to do custom generation/mutation for some struct's and union's.
43 // Special strings that can matter for the target.
49 initArch func(target *Target) argument
58 var targets = make(map[string]*Target)
60 func RegisterTarget(target *Target, initArch func(target *Target)) { argument
61 key := target.OS + "/" + target.Arch
63 panic(fmt.Sprintf("duplicate target %v", key))
65 target.initArch = initArch
66 targets[key] = target
69 func GetTarget(OS, arch string) (*Target, error) {
71 target := targets[key]
72 if target == nil {
78 return nil, fmt.Errorf("unknown target: %v (supported: %v)", key, supported)
80 target.init.Do(target.lazyInit)
81 return target, nil
84 func AllTargets() []*Target {
85 var res []*Target
86 for _, target := range targets {
87 target.init.Do(target.lazyInit)
88 res = append(res, target)
99 func (target *Target) lazyInit() { argument
100 target.SanitizeCall = func(c *Call) {}
101 target.initTarget()
102 target.initArch(target)
103 target.ConstMap = nil // currently used only by initArch
106 func (target *Target) initTarget() { argument
107 target.ConstMap = make(map[string]uint64)
108 for _, c := range target.Consts {
109 target.ConstMap[c.Name] = c.Value
112 target.resourceMap = make(map[string]*ResourceDesc)
113 for _, res := range target.Resources {
114 target.resourceMap[res.Name] = res
118 for _, desc := range target.Structs {
121 target.Structs = nil
123 target.SyscallMap = make(map[string]*Syscall)
124 for i, c := range target.Syscalls {
126 target.SyscallMap[c.Name] = c
130 t.Desc = target.resourceMap[t.TypeName]
148 target.resourceCtors = make(map[string][]*Syscall)
149 for _, res := range target.Resources {
150 target.resourceCtors[res.Name] = target.calcResourceCtors(res.Kind, false)
152 initAnyTypes(target)
160 func (g *Gen) Target() *Target { func
161 return g.r.target
187 g.r.target.assignSizesArray([]Arg{arg})
194 ma := &mutationArgs{target: g.r.target, ignoreSpecial: true}
203 newCalls, ok := g.r.target.mutateArg(g.r, g.s, arg, ctx, &updateSizes)