| 34 | typedef int64_t (*add_vector_func_t)(int64_t* elements, int nelements); |
| 35 | |
| 36 | class TestLLVMGenerator : public ::testing::Test { |
| 37 | protected: |
| 38 | std::shared_ptr<FunctionRegistry> registry_ = default_function_registry(); |
| 39 | |
| 40 | public: |
| 41 | // create a Configuration with the given registry and verify that the given function |
| 42 | // exists in the module. |
| 43 | static void VerifyFunctionMapping( |
| 44 | const std::string& function_name, |
| 45 | const std::function<std::shared_ptr<Configuration>( |
| 46 | std::shared_ptr<FunctionRegistry>)>& config_factory) { |
| 47 | auto external_registry = std::make_shared<FunctionRegistry>(); |
| 48 | auto config = config_factory(std::move(external_registry)); |
| 49 | |
| 50 | ASSERT_OK_AND_ASSIGN(auto generator, LLVMGenerator::Make(config, false)); |
| 51 | |
| 52 | auto module = generator->module(); |
| 53 | ASSERT_OK(generator->engine_->LoadFunctionIRs()); |
| 54 | EXPECT_NE(module->getFunction(function_name), nullptr); |
| 55 | } |
| 56 | }; |
| 57 | |
| 58 | // Verify that a valid pc function exists for every function in the registry. |
| 59 | TEST_F(TestLLVMGenerator, VerifyPCFunctions) { |
nothing calls this directly
no test coverage detected