OmniSciDB  d2f719934e
 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, const Catalog_Namespace::Catalog *catalog)
 
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, const Catalog_Namespace::Catalog *catalog)
 

Protected Attributes

const Analyzer::GeoOperatoroperator_
 
const Catalog_Namespace::Catalogcat_
 
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,
const Catalog_Namespace::Catalog catalog 
)
inline

Definition at line 28 of file Codegen.h.

30  : operator_(geo_operator), cat_(catalog) {}
const Catalog_Namespace::Catalog * cat_
Definition: Codegen.h:71
const Analyzer::GeoOperator * operator_
Definition: Codegen.h:70
virtual spatial_type::Codegen::~Codegen ( )
inlinevirtual

Definition at line 67 of file Codegen.h.

67 {}

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 39 of file Codegen.h.

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

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

39 { return operator_->getName(); }
const std::string & getName() const
Definition: Analyzer.h:1925
const Analyzer::GeoOperator * operator_
Definition: Codegen.h:70

+ 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 50 of file Codegen.cpp.

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

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

+ 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, and spatial_type::NRings.

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::NPoints, and spatial_type::NRings.

Definition at line 63 of file Codegen.cpp.

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

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

63  {
64  CHECK_LT(index, operator_->size());
65  return operator_->getOperand(index);
66 }
#define CHECK_LT(x, y)
Definition: Logger.h:221
const Analyzer::GeoOperator * operator_
Definition: Codegen.h:70
size_t size() const
Definition: Analyzer.cpp:3644
Analyzer::Expr * getOperand(const size_t index) const
Definition: Analyzer.cpp:3648

+ 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 37 of file Codegen.h.

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

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

37 { return operator_->get_type_info(); }
const SQLTypeInfo & get_type_info() const
Definition: Analyzer.h:77
const Analyzer::GeoOperator * operator_
Definition: Codegen.h:70

+ 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,
const Catalog_Namespace::Catalog catalog 
)
static

Definition at line 22 of file Codegen.cpp.

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

Referenced by CodeGenerator::codegenGeoOperator().

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

+ 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 35 of file Codegen.h.

References is_nullable_.

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

35 { return is_nullable_; }

+ Here is the caller graph for this function:

Member Data Documentation

const Catalog_Namespace::Catalog* spatial_type::Codegen::cat_
protected

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