OmniSciDB  a5dc49c757
 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 27 of file ResultSetReductionInterpreterStubs.cpp.

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

Referenced by StubGenerator::generateStub().

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

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

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

Referenced by StubGenerator::generateStub().

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

+ Here is the caller graph for this function: