OpenVDB: VolumeComputeGenerator.h Source File

OpenVDB 8.0.0

VolumeComputeGenerator.h
Go to the documentation of this file.
1 // Copyright Contributors to the OpenVDB Project
2 // SPDX-License-Identifier: MPL-2.0
3
11
12 #ifndef OPENVDB_AX_VOLUME_COMPUTE_GENERATOR_HAS_BEEN_INCLUDED
13 #define OPENVDB_AX_VOLUME_COMPUTE_GENERATOR_HAS_BEEN_INCLUDED
14
15 #include "ComputeGenerator.h"
16 #include "FunctionTypes.h"
17
18 #include "../compiler/AttributeRegistry.h"
19
20 #include <openvdb/version.h>
21
22 namespace openvdb {
23 OPENVDB_USE_VERSION_NAMESPACE
24 namespace OPENVDB_VERSION_NAME {
25
26 namespace ax {
27 namespace codegen {
28
44 struct VolumeKernel
45 {
46 // The signature of the generated function
47 using Signature =
48 void(const void* const,
49 const int32_t (*)[3],
50 const float (*)[3],
51 void**,
52 void**,
53 int64_t,
54 void*);
55
56 using FunctionTraitsT = codegen::FunctionTraits<Signature>;
57 static const size_t N_ARGS = FunctionTraitsT::N_ARGS;
58
59 static const std::array<std::string, N_ARGS>& argumentKeys();
60 static std::string getDefaultName();
61 };
62
63
66
67 namespace codegen_internal {
68
72 struct VolumeComputeGenerator : public ComputeGenerator
73 {
80 VolumeComputeGenerator(llvm::Module& module,
81 const FunctionOptions& options,
82 FunctionRegistry& functionRegistry,
83 Logger& logger);
84
85 ~VolumeComputeGenerator() override = default;
86
87 using ComputeGenerator::traverse;
88 using ComputeGenerator::visit;
89
90 AttributeRegistry::Ptr generate(const ast::Tree& node);
91 bool visit(const ast::Attribute*) override;
92
93 private:
94 llvm::Value* accessorHandleFromToken(const std::string&);
95 void getAccessorValue(const std::string&, llvm::Value*);
96 };
97
98 } // namespace codegen_internal
99
100 } // namespace codegen
101 } // namespace ax
102 } // namespace OPENVDB_VERSION_NAME
103 } // namespace openvdb
104
105 #endif // OPENVDB_AX_VOLUME_COMPUTE_GENERATOR_HAS_BEEN_INCLUDED
106
openvdb::v8_2::ax::codegen::codegen_internal::VolumeComputeGenerator
Visitor object which will generate llvm IR for a syntax tree which has been generated from AX that ta...
Definition: VolumeComputeGenerator.h:73
openvdb::v8_2::ax::codegen::codegen_internal::VolumeComputeGenerator::visit
bool visit(const ast::Attribute *) override
openvdb::v8_2::ax::codegen::FunctionTraits
Templated function traits which provides compile-time index access to the types of the function signa...
Definition: ax/openvdb_ax/codegen/Types.h:279
openvdb::v8_2::ax::codegen::codegen_internal::ComputeGenerator
Visitor object which will generate llvm IR for a syntax tree. This provides the majority of the code ...
Definition: ComputeGenerator.h:84
openvdb::v8_2::ax::codegen::VolumeKernel::argumentKeys
static const std::array< std::string, N_ARGS > & argumentKeys()
openvdb::v8_2::ax::AttributeRegistry::Ptr
std::shared_ptr< AttributeRegistry > Ptr
Definition: AttributeRegistry.h:39
openvdb::v8_2::ax::ast::Tree
A Tree is the highest concrete (non-abstract) node in the entire AX AST hierarchy....
Definition: AST.h:562
version.h
Library and file format version numbers.
openvdb::v8_2::ax::codegen::codegen_internal::VolumeComputeGenerator::generate
AttributeRegistry::Ptr generate(const ast::Tree &node)
openvdb::v8_2::ax::ast::Attribute
Attributes represent any access to a primitive value, typically associated with the '@' symbol syntax...
Definition: AST.h:1874
openvdb::v8_2::ax::codegen::codegen_internal::VolumeComputeGenerator::~VolumeComputeGenerator
~VolumeComputeGenerator() override=default
openvdb::v8_2::ax::codegen::VolumeKernel
The function definition and signature which is built by the VolumeComputeGenerator.
Definition: VolumeComputeGenerator.h:45
openvdb::v8_2::ax::codegen::VolumeKernel::getDefaultName
static std::string getDefaultName()
ComputeGenerator.h
The core visitor framework for code generation.
OPENVDB_USE_VERSION_NAMESPACE
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h:153
FunctionTypes.h
Contains frameworks for creating custom AX functions which can be registered within the FunctionRegis...
openvdb::v8_2::ax::codegen::FunctionRegistry
The function registry which is used for function code generation. Each time a function is visited wit...
Definition: FunctionRegistry.h:37
OPENVDB_VERSION_NAME
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition: version.h:101
openvdb::v8_2::ax::codegen::codegen_internal::VolumeComputeGenerator::VolumeComputeGenerator
VolumeComputeGenerator(llvm::Module &module, const FunctionOptions &options, FunctionRegistry &functionRegistry, Logger &logger)
Constructor.
openvdb::v8_2::ax::Logger
Logger for collecting errors and warnings that occur during AX compilation.
Definition: Logger.h:55
openvdb::v8_2::ax::FunctionOptions
Options that control how functions behave.
Definition: CompilerOptions.h:25
openvdb
Definition: openvdb/Exceptions.h:13
openvdb::v8_2::ax::codegen::VolumeKernel::Signature
void(const void *const, const int32_t(*)[3], const float(*)[3], void **, void **, int64_t, void *) Signature
Definition: VolumeComputeGenerator.h:54