OmniSciDB  471d68cefb
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
anonymous_namespace{ResultSetReductionInterpreterStubs.cpp} Namespace Reference

Functions

llvm::Function * create_stub_function (const std::string &name, CgenState *cgen_state)
 
std::string get_stub_read_argument_name (const Type arg_type)
 

Function Documentation

llvm::Function* anonymous_namespace{ResultSetReductionInterpreterStubs.cpp}::create_stub_function ( const std::string &  name,
CgenState cgen_state 
)

Definition at line 26 of file ResultSetReductionInterpreterStubs.cpp.

References CgenState::context_, get_int_type(), CgenState::ir_builder_, and CgenState::module_.

Referenced by StubGenerator::generateStub().

26  {
27  auto void_type = llvm::Type::getVoidTy(cgen_state->context_);
28  auto int8_ptr_type = llvm::PointerType::get(get_int_type(8, cgen_state->context_), 0);
29  std::vector<llvm::Type*> parameter_types(2, int8_ptr_type);
30  const auto func_type = llvm::FunctionType::get(void_type, parameter_types, false);
31  auto function = llvm::Function::Create(
32  func_type, llvm::Function::ExternalLinkage, name, cgen_state->module_);
33  const auto bb_entry =
34  llvm::BasicBlock::Create(cgen_state->context_, ".entry", function, 0);
35  cgen_state->ir_builder_.SetInsertPoint(bb_entry);
36  return function;
37 }
llvm::IRBuilder ir_builder_
Definition: CgenState.h:340
string name
Definition: setup.in.py:72
llvm::Type * get_int_type(const int width, llvm::LLVMContext &context)
llvm::Module * module_
Definition: CgenState.h:329
llvm::LLVMContext & context_
Definition: CgenState.h:338

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::string anonymous_namespace{ResultSetReductionInterpreterStubs.cpp}::get_stub_read_argument_name ( const Type  arg_type)

Definition at line 41 of file ResultSetReductionInterpreterStubs.cpp.

References Double, logger::FATAL, Float, Int32, Int32Ptr, Int64, Int64Ptr, Int64PtrPtr, Int8Ptr, LOG, and VoidPtr.

Referenced by StubGenerator::generateStub().

41  {
42  std::string read_arg_name{"read_stub_arg_"};
43  switch (arg_type) {
44  case Type::Int32:
45  case Type::Int64: {
46  read_arg_name += "int";
47  break;
48  }
49  case Type::Float: {
50  read_arg_name += "float";
51  break;
52  }
53  case Type::Double: {
54  read_arg_name += "double";
55  break;
56  }
57  case Type::Int8Ptr: {
58  read_arg_name += "pi8";
59  break;
60  }
61  case Type::Int32Ptr: {
62  read_arg_name += "pi32";
63  break;
64  }
65  case Type::Int64Ptr: {
66  read_arg_name += "pi64";
67  break;
68  }
69  case Type::VoidPtr: {
70  read_arg_name += "pvoid";
71  break;
72  }
73  case Type::Int64PtrPtr: {
74  read_arg_name += "ppi64";
75  break;
76  }
77  default: {
78  LOG(FATAL) << "Invalid type: " << static_cast<int>(arg_type);
79  }
80  }
81  return read_arg_name;
82 }
#define LOG(tag)
Definition: Logger.h:203

+ Here is the caller graph for this function: