| 204 | } |
| 205 | |
| 206 | void 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 | |
| 227 | void LlvmCodeGenCacheTest::GetLlvmEmptyFunction( |
| 228 | LlvmCodeGen* codegen, llvm::Function** func) { |
nothing calls this directly
no test coverage detected