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

Method Return

core/codegen/builder.go:310–318  ·  view source on GitHub ↗

Return returns execution of the function with the given value

(val *Value)

Source from the content-addressed store, hash-verified

308
309// Return returns execution of the function with the given value
310func (b *Builder) Return(val *Value) {
311 if val != nil {
312 assertTypesEqual(val.Type(), b.function.Type.Signature.Result)
313 b.llvm.CreateStore(val.llvm, b.result)
314 } else if !b.result.IsNil() {
315 b.llvm.CreateStore(llvm.ConstNull(b.function.Type.Signature.Result.llvmTy()), b.result)
316 }
317 b.llvm.CreateBr(b.exit)
318}
319
320// IsBlockTerminated returns true if the last instruction is a terminator
321// (unconditional jump). It is illegal to write another instruction after a

Callers 1

TestCodegenFunction · 0.45

Calls 4

assertTypesEqualFunction · 0.85
TypeMethod · 0.65
llvmTyMethod · 0.65
IsNilMethod · 0.45

Tested by 1

TestCodegenFunction · 0.36