MCPcopy Create free account
hub / github.com/google/gapid / Function

Method Function

core/codegen/module.go:272–283  ·  view source on GitHub ↗

Function creates a new function with the given name, result type and parameters.

(resTy Type, name string, paramTys ...Type)

Source from the content-addressed store, hash-verified

270
271// Function creates a new function with the given name, result type and parameters.
272func (m *Module) Function(resTy Type, name string, paramTys ...Type) *Function {
273 ty := m.Types.Function(resTy, paramTys...)
274 f := llvm.AddFunction(m.llvm, name, ty.llvm)
275 out := &Function{Name: name, Type: ty, llvm: f, m: m}
276 if name != "" {
277 if _, existing := m.funcs[name]; existing {
278 fail("Duplicate function with name: '%s'", name)
279 }
280 m.funcs[name] = out
281 }
282 return out
283}
284
285// Ctor creates and builds a new module constructor.
286func (m *Module) Ctor(priority int32, cb func(*Builder)) {

Callers 4

TestCodegenFunction · 0.95
NewModuleFunction · 0.95
CtorMethod · 0.95

Calls 1

failFunction · 0.70

Tested by 1

TestCodegenFunction · 0.76