OmniSciDB  a5dc49c757
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
spatial_type::Codegen Class Referenceabstract

#include <Codegen.h>

+ Inheritance diagram for spatial_type::Codegen:
+ Collaboration diagram for spatial_type::Codegen:

Public Member Functions

 Codegen (const Analyzer::GeoOperator *geo_operator)
 
auto isNullable () const
 
auto getTypeInfo () const
 
std::string getName () const
 
virtual std::unique_ptr
< CodeGenerator::NullCheckCodegen
getNullCheckCodegen (llvm::Value *null_lv, CgenState *cgen_state, Executor *executor)
 
virtual size_t size () const =0
 
virtual SQLTypeInfo getNullType () const =0
 
virtual const Analyzer::ExprgetOperand (const size_t index)
 
virtual std::tuple
< std::vector< llvm::Value * >
, llvm::Value * > 
codegenLoads (const std::vector< llvm::Value * > &arg_lvs, const std::vector< llvm::Value * > &pos_lvs, CgenState *cgen_state)=0
 
virtual std::vector
< llvm::Value * > 
codegen (const std::vector< llvm::Value * > &args, CodeGenerator::NullCheckCodegen *nullcheck_codegen, CgenState *cgen_state, const CompilationOptions &co)=0
 
virtual ~Codegen ()
 

Static Public Member Functions

static std::unique_ptr< Codegeninit (const Analyzer::GeoOperator *geo_operator)
 
static char const * pointIsNullFunctionName (SQLTypeInfo const &)
 

Protected Attributes

const Analyzer::GeoOperatoroperator_
 
bool is_nullable_ {true}
 

Detailed Description

Definition at line 26 of file Codegen.h.

Constructor & Destructor Documentation

spatial_type::Codegen::Codegen ( const Analyzer::GeoOperator geo_operator)
inline

Definition at line 28 of file Codegen.h.

28 : operator_(geo_operator) {}
const Analyzer::GeoOperator * operator_
Definition: Codegen.h:69
virtual spatial_type::Codegen::~Codegen ( )
inlinevirtual

Definition at line 64 of file Codegen.h.

64 {}

Member Function Documentation

virtual std::vector<llvm::Value*> spatial_type::Codegen::codegen ( const std::vector< llvm::Value * > &  args,
CodeGenerator::NullCheckCodegen nullcheck_codegen,
CgenState cgen_state,
const CompilationOptions co 
)
pure virtual
virtual std::tuple<std::vector<llvm::Value*>, llvm::Value*> spatial_type::Codegen::codegenLoads ( const std::vector< llvm::Value * > &  arg_lvs,
const std::vector< llvm::Value * > &  pos_lvs,
CgenState cgen_state 
)
pure virtual
std::string spatial_type::Codegen::getName ( ) const
inline

Definition at line 36 of file Codegen.h.

References Analyzer::GeoOperator::getName(), and operator_.

Referenced by spatial_type::Transform::codegen(), spatial_type::PointN::getNullCheckCodegen(), spatial_type::PointConstructor::getNullCheckCodegen(), getNullCheckCodegen(), spatial_type::NumGeometries::getOperand(), and spatial_type::NumGeometries::getOperandTypeInfo().

36 { return operator_->getName(); }
const std::string & getName() const
Definition: Analyzer.h:3298
const Analyzer::GeoOperator * operator_
Definition: Codegen.h:69

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::unique_ptr< CodeGenerator::NullCheckCodegen > spatial_type::Codegen::getNullCheckCodegen ( llvm::Value *  null_lv,
CgenState cgen_state,
Executor executor 
)
virtual

Reimplemented in spatial_type::PointConstructor, and spatial_type::PointN.

Definition at line 51 of file Codegen.cpp.

References CHECK, getName(), getNullType(), and isNullable().

54  {
55  if (isNullable()) {
56  CHECK(null_lv);
57  return std::make_unique<CodeGenerator::NullCheckCodegen>(
58  cgen_state, executor, null_lv, getNullType(), getName() + "_nullcheck");
59  } else {
60  return nullptr;
61  }
62 }
auto isNullable() const
Definition: Codegen.h:32
virtual SQLTypeInfo getNullType() const =0
#define CHECK(condition)
Definition: Logger.h:291
std::string getName() const
Definition: Codegen.h:36

+ Here is the call graph for this function:

virtual SQLTypeInfo spatial_type::Codegen::getNullType ( ) const
pure virtual

Implemented in spatial_type::PointConstructor, spatial_type::PointN, spatial_type::Transform, spatial_type::AreaPerimeter, spatial_type::Centroid, spatial_type::Distance, spatial_type::StartEndPoint, spatial_type::PointAccessors, spatial_type::NPoints, spatial_type::NRings, and spatial_type::NumGeometries.

Referenced by getNullCheckCodegen().

+ Here is the caller graph for this function:

const Analyzer::Expr * spatial_type::Codegen::getOperand ( const size_t  index)
virtual

Reimplemented in spatial_type::NumGeometries, spatial_type::NPoints, and spatial_type::NRings.

Definition at line 64 of file Codegen.cpp.

References CHECK_LT, Analyzer::GeoOperator::getOperand(), operator_, and Analyzer::GeoOperator::size().

Referenced by spatial_type::Transform::codegen(), spatial_type::PointAccessors::codegen(), spatial_type::Centroid::codegenLoads(), spatial_type::Distance::codegenLoads(), spatial_type::AreaPerimeter::codegenLoads(), spatial_type::StartEndPoint::codegenLoads(), spatial_type::PointAccessors::codegenLoads(), spatial_type::Transform::codegenLoads(), and spatial_type::PointN::codegenLoads().

64  {
65  CHECK_LT(index, operator_->size());
66  return operator_->getOperand(index);
67 }
#define CHECK_LT(x, y)
Definition: Logger.h:303
const Analyzer::GeoOperator * operator_
Definition: Codegen.h:69
size_t size() const
Definition: Analyzer.cpp:4211
Analyzer::Expr * getOperand(const size_t index) const
Definition: Analyzer.cpp:4215

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

auto spatial_type::Codegen::getTypeInfo ( ) const
inline

Definition at line 34 of file Codegen.h.

References Analyzer::Expr::get_type_info(), and operator_.

Referenced by spatial_type::NRings::codegen(), spatial_type::NumGeometries::codegen(), spatial_type::NPoints::codegenLoads(), spatial_type::NRings::codegenLoads(), and spatial_type::NumGeometries::codegenLoads().

34 { return operator_->get_type_info(); }
const SQLTypeInfo & get_type_info() const
Definition: Analyzer.h:79
const Analyzer::GeoOperator * operator_
Definition: Codegen.h:69

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::unique_ptr< Codegen > spatial_type::Codegen::init ( const Analyzer::GeoOperator geo_operator)
static

Definition at line 22 of file Codegen.cpp.

References Analyzer::GeoOperator::getName(), and UNREACHABLE.

Referenced by CodeGenerator::codegenGeoOperator().

22  {
23  const auto operator_name = geo_operator->getName();
24  if (operator_name == "ST_NRings") {
25  return std::make_unique<NRings>(geo_operator);
26  } else if (operator_name == "ST_NumGeometries") {
27  return std::make_unique<NumGeometries>(geo_operator);
28  } else if (operator_name == "ST_NPoints") {
29  return std::make_unique<NPoints>(geo_operator);
30  } else if (operator_name == "ST_PointN") {
31  return std::make_unique<PointN>(geo_operator);
32  } else if (operator_name == "ST_StartPoint" || operator_name == "ST_EndPoint") {
33  return std::make_unique<StartEndPoint>(geo_operator);
34  } else if (operator_name == "ST_X" || operator_name == "ST_Y") {
35  return std::make_unique<PointAccessors>(geo_operator);
36  } else if (operator_name == "ST_Point") {
37  return std::make_unique<PointConstructor>(geo_operator);
38  } else if (operator_name == "ST_Transform") {
39  return std::make_unique<Transform>(geo_operator);
40  } else if (operator_name == "ST_Perimeter" || operator_name == "ST_Area") {
41  return std::make_unique<AreaPerimeter>(geo_operator);
42  } else if (operator_name == "ST_Centroid") {
43  return std::make_unique<Centroid>(geo_operator);
44  } else if (operator_name == "ST_Distance" || operator_name == "ST_MaxDistance") {
45  return std::make_unique<Distance>(geo_operator);
46  }
47  UNREACHABLE();
48  return nullptr;
49 }
#define UNREACHABLE()
Definition: Logger.h:338
const std::string & getName() const
Definition: Analyzer.h:3298

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

auto spatial_type::Codegen::isNullable ( ) const
inline

Definition at line 32 of file Codegen.h.

References is_nullable_.

Referenced by spatial_type::NRings::codegen(), spatial_type::NumGeometries::codegen(), spatial_type::NPoints::codegenLoads(), spatial_type::NRings::codegenLoads(), spatial_type::NumGeometries::codegenLoads(), spatial_type::PointN::getNullCheckCodegen(), spatial_type::PointConstructor::getNullCheckCodegen(), and getNullCheckCodegen().

32 { return is_nullable_; }

+ Here is the caller graph for this function:

char const * spatial_type::Codegen::pointIsNullFunctionName ( SQLTypeInfo const &  geo_ti)
static

Definition at line 69 of file Codegen.cpp.

References CHECK_EQ, SQLTypeInfo::get_compression(), SQLTypeInfo::get_type(), kENCODING_GEOINT, and kPOINT.

Referenced by CodeGenerator::codegenIsNull(), spatial_type::PointAccessors::codegenLoads(), and spatial_type::Transform::codegenLoads().

69  {
70  CHECK_EQ(kPOINT, geo_ti.get_type());
71  return geo_ti.get_compression() == kENCODING_GEOINT ? "point_int32_is_null"
72  : "point_double_is_null";
73 }
#define CHECK_EQ(x, y)
Definition: Logger.h:301

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Member Data Documentation


The documentation for this class was generated from the following files: