OpenVDB 12.1.0
Loading...
Searching...
No Matches
VolumeComputeGenerator.h
Go to the documentation of this file.
1// Copyright Contributors to the OpenVDB Project
2// SPDX-License-Identifier: Apache-2.0
3
4/// @file codegen/VolumeComputeGenerator.h
5///
6/// @authors Nick Avramoussis
7///
8/// @brief The visitor framework and function definition for volume grid
9/// code generation
10///
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 "Types.h"
17#include "Value.h"
19#include <openvdb/version.h>
20
21namespace openvdb {
23namespace OPENVDB_VERSION_NAME {
24
25namespace ax {
26namespace codegen {
27namespace codegen_internal {
28
29/// @brief Visitor object which will generate llvm IR for a syntax tree which has been generated
30/// from AX that targets volumes. The IR will represent a single function. It is mainly
31/// used by the Compiler class.
33{
34 /// @brief Constructor
35 /// @param module llvm Module for generating IR
36 /// @param options Options for the function registry behaviour
37 /// @param functionRegistry Function registry object which will be used when generating IR
38 /// for function calls
39 /// @param logger Logger for collecting logical errors and warnings
40 VolumeComputeGenerator(llvm::Module& module,
41 const FunctionOptions& options,
42 FunctionRegistry& functionRegistry,
43 Logger& logger);
44
45 ~VolumeComputeGenerator() override = default;
46
49
51 bool visit(const ast::Attribute*) override;
52
53private:
54 llvm::Value* accessorHandleFromToken(const std::string&);
55 void getAccessorValue(const std::string&, Value);
56
57 void computek2(llvm::Function*, const AttributeRegistry&);
58 void computek3(llvm::Function*, const AttributeRegistry&);
59
60 // Stores internal ptrs to accessor allocations
61 SymbolTable<llvm::Value*> mInternalPtrs;
62};
63
64} // namespace codegen_internal
65
66} // namespace codegen
67} // namespace ax
68} // namespace OPENVDB_VERSION_NAME
69} // namespace openvdb
70
71#endif // OPENVDB_AX_VOLUME_COMPUTE_GENERATOR_HAS_BEEN_INCLUDED
72
These classes contain lists of expected attributes and volumes which are populated by compiler during...
The core visitor framework for code generation.
Intermediate representation of supported AX values.
Consolidated llvm types for most supported types.
This class stores a list of access names, types and their dependency connections.
Definition AttributeRegistry.h:40
std::shared_ptr< AttributeRegistry > Ptr
Definition AttributeRegistry.h:42
Logger for collecting errors and warnings that occur during AX compilation.
Definition Logger.h:58
The function registry which is used for function code generation. Each time a function is visited wit...
Definition FunctionRegistry.h:40
Intermediate representation wrapper for supported value types in AX as immutable instances.
Definition Value.h:63
Definition Exceptions.h:13
Options that control how functions behave.
Definition CompilerOptions.h:25
Attributes represent any access to a primitive value, typically associated with the '@' symbol syntax...
Definition AST.h:1875
A Tree is the highest concrete (non-abstract) node in the entire AX AST hierarchy....
Definition AST.h:563
A symbol table which can be used to represent a single scoped set of a programs variables....
Definition SymbolTable.h:38
ComputeGenerator(llvm::Module &module, const FunctionOptions &options, FunctionRegistry &functionRegistry, Logger &logger)
bool traverse(const ast::Block *block)
Custom traversal of scoped blocks.
Definition ComputeGenerator.h:112
virtual bool visit(const ast::CommaOperator *)
Visitor methods for all AST nodes which implement IR generation.
AttributeRegistry::Ptr generate(const ast::Tree &node)
VolumeComputeGenerator(llvm::Module &module, const FunctionOptions &options, FunctionRegistry &functionRegistry, Logger &logger)
Constructor.
bool visit(const ast::Attribute *) override
Visitor methods for all AST nodes which implement IR generation.
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition version.h.in:121
#define OPENVDB_USE_VERSION_NAMESPACE
Definition version.h.in:218