OmniSciDB  04ee39c94c
JoinLoopTest.cpp File Reference
#include "JoinLoop.h"
#include "Shared/Logger.h"
#include <llvm/ExecutionEngine/MCJIT.h>
#include <llvm/IR/BasicBlock.h>
#include <llvm/IR/Function.h>
#include <llvm/IR/IRBuilder.h>
#include <llvm/IR/Module.h>
#include <llvm/IR/Type.h>
#include <llvm/IR/Verifier.h>
#include <llvm/Support/TargetSelect.h>
#include <llvm/Support/raw_os_ostream.h>
#include <memory>
#include <vector>
+ Include dependency graph for JoinLoopTest.cpp:

Go to the source code of this file.

Namespaces

 anonymous_namespace{JoinLoopTest.cpp}
 

Functions

void print_iterators (const int64_t i, const int64_t j, const int64_t k)
 
void anonymous_namespace{JoinLoopTest.cpp}::verify_function_ir (const llvm::Function *func)
 
llvm::Value * anonymous_namespace{JoinLoopTest.cpp}::emit_external_call (const std::string &fname, llvm::Type *ret_type, const std::vector< llvm::Value *> args, llvm::Module *module, llvm::IRBuilder<> &builder)
 
llvm::Function * anonymous_namespace{JoinLoopTest.cpp}::create_loop_test_function (llvm::LLVMContext &context, llvm::Module *module, const std::vector< JoinLoop > &join_loops)
 
std::unique_ptr< llvm::Module > anonymous_namespace{JoinLoopTest.cpp}::create_loop_test_module ()
 
std::pair< void *, std::unique_ptr< llvm::ExecutionEngine > > anonymous_namespace{JoinLoopTest.cpp}::native_codegen (std::unique_ptr< llvm::Module > &module, llvm::Function *func)
 
std::vector< JoinLoopanonymous_namespace{JoinLoopTest.cpp}::generate_descriptors (const unsigned mask, const unsigned cond_mask, const std::vector< int64_t > &upper_bounds)
 
int main ()
 

Variables

llvm::LLVMContext anonymous_namespace{JoinLoopTest.cpp}::g_global_context
 

Function Documentation

◆ main()

int main ( )

Definition at line 188 of file JoinLoopTest.cpp.

References anonymous_namespace{JoinLoopTest.cpp}::create_loop_test_function(), anonymous_namespace{JoinLoopTest.cpp}::create_loop_test_module(), anonymous_namespace{JoinLoopTest.cpp}::g_global_context, anonymous_namespace{JoinLoopTest.cpp}::generate_descriptors(), generate_loop_ref::mask_bitcount, anonymous_namespace{JoinLoopTest.cpp}::native_codegen(), and generate_loop_ref::upper_bounds.

188  {
189  std::vector<int64_t> upper_bounds{5, 3, 9};
190  for (unsigned mask = 0; mask < static_cast<unsigned>(1 << upper_bounds.size());
191  ++mask) {
192  const unsigned mask_bitcount = __builtin_popcount(mask);
193  for (unsigned cond_mask = 0; cond_mask < static_cast<unsigned>(1 << mask_bitcount);
194  ++cond_mask) {
195  auto module = create_loop_test_module();
196  const auto join_loops = generate_descriptors(mask, cond_mask, upper_bounds);
197  const auto function =
198  create_loop_test_function(g_global_context, module.get(), join_loops);
199  const auto& func_and_ee = native_codegen(module, function);
200  reinterpret_cast<int64_t (*)()>(func_and_ee.first)();
201  }
202  }
203  return 0;
204 }
llvm::Function * create_loop_test_function(llvm::LLVMContext &context, llvm::Module *module, const std::vector< JoinLoop > &join_loops)
std::unique_ptr< llvm::Module > create_loop_test_module()
std::vector< JoinLoop > generate_descriptors(const unsigned mask, const unsigned cond_mask, const std::vector< int64_t > &upper_bounds)
std::pair< void *, std::unique_ptr< llvm::ExecutionEngine > > native_codegen(std::unique_ptr< llvm::Module > &module, llvm::Function *func)
+ Here is the call graph for this function:

◆ print_iterators()

void print_iterators ( const int64_t  i,
const int64_t  j,
const int64_t  k 
)

Definition at line 36 of file JoinLoopTest.cpp.

36  {
37  printf("%ld, %ld, %ld\n", i, j, k);
38 }