OpenVDB 13.0.1
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.
32struct VolumeComputeGenerator : public ComputeGenerator
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
47 using ComputeGenerator::traverse;
48 using ComputeGenerator::visit;
49
50 AttributeRegistry::Ptr generate(const ast::Tree& node);
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.
Definition Exceptions.h:13
#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