MCPcopy Create free account
hub / github.com/apache/impala / AddLlvmCodegenEcho

Method AddLlvmCodegenEcho

be/src/codegen/llvm-codegen-cache-test.cc:206–225  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

204}
205
206void LlvmCodeGenCacheTest::AddLlvmCodegenEcho(
207 LlvmCodeGen* codegen, string* module_id = nullptr, bool doFinalizeModule = true) {
208 ASSERT_TRUE(codegen != nullptr);
209 LlvmCodeGen::FnPrototype prototype(codegen, "Echo", codegen->i32_type());
210 prototype.AddArgument(LlvmCodeGen::NamedVariable("n", codegen->i32_type()));
211 LlvmBuilder builder(codegen->context());
212 llvm::Value* args[1];
213 llvm::Function* fn = prototype.GeneratePrototype(&builder, args);
214 builder.CreateRet(args[0]);
215 fn = codegen->FinalizeFunction(fn);
216 ASSERT_TRUE(fn != nullptr);
217 CodegenFnPtr<TestEcho> jitted_fn;
218 AddFunctionToJit(codegen, fn, &jitted_fn);
219 if (doFinalizeModule) {
220 ASSERT_OK(FinalizeModule(codegen, module_id));
221 ASSERT_TRUE(jitted_fn.load() != nullptr);
222 TestEcho test_fn = jitted_fn.load();
223 ASSERT_EQ(test_fn(1), 1);
224 }
225}
226
227void LlvmCodeGenCacheTest::GetLlvmEmptyFunction(
228 LlvmCodeGen* codegen, llvm::Function** func) {

Callers

nothing calls this directly

Calls 7

NamedVariableClass · 0.85
i32_typeMethod · 0.80
AddArgumentMethod · 0.80
contextMethod · 0.80
GeneratePrototypeMethod · 0.80
FinalizeFunctionMethod · 0.80
loadMethod · 0.45

Tested by

no test coverage detected