OmniSciDB  a47db9e897
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros 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 24 of file ResultSetReductionInterpreterStubs.cpp.

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

Referenced by StubGenerator::generateStub().

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

+ 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 39 of file ResultSetReductionInterpreterStubs.cpp.

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

Referenced by StubGenerator::generateStub().

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

+ Here is the caller graph for this function: