OpenVDB
13.0.0
Toggle main menu visibility
Loading...
Searching...
No Matches
CompilerOptions.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 compiler/CompilerOptions.h
5
///
6
/// @authors Nick Avramoussis
7
///
8
/// @brief OpenVDB AX Compiler Options
9
///
10
11
#ifndef OPENVDB_AX_COMPILER_COMPILER_OPTIONS_HAS_BEEN_INCLUDED
12
#define OPENVDB_AX_COMPILER_COMPILER_OPTIONS_HAS_BEEN_INCLUDED
13
14
#include <
openvdb/openvdb.h
>
15
#include <openvdb/version.h>
16
17
namespace
openvdb
{
18
OPENVDB_USE_VERSION_NAMESPACE
19
namespace
OPENVDB_VERSION_NAME
{
20
21
namespace
ax {
22
23
/// @brief Options that control how functions behave
24
struct
OPENVDB_AX_API
FunctionOptions
25
{
26
/// @brief Enable the constant folding of C bindings. Functions may use this setting
27
/// to determine whether they are allowed to be called during code generation
28
/// to evaluate call sites with purely constant arguments and replace the call
29
/// with the result.
30
/// @note This does not impact IR functions which we leave to LLVM's CF during
31
/// IR optimization.
32
/// @note We used to bind IR methods to corresponding C bindings, however it can be
33
/// very easy to implement incorrectly, leading to discrepancies in the CF
34
/// results. Fundamentally, LLVM's support for CF IR is far superior and our
35
/// framework only supports some types of folding (see codegen/ConstantFolding.h)
36
bool
mConstantFoldCBindings
=
true
;
37
/// @brief When enabled, functions which have IR builder instruction definitions will
38
/// prioritise those over any registered external calls
39
bool
mPrioritiseIR
=
true
;
40
/// @brief When enabled, the function registry is only populated on a function visit.
41
/// At the end of code generation, only functions which have been instantiated
42
/// will exist in the function map.
43
bool
mLazyFunctions
=
true
;
44
};
45
46
/// @brief Settings which control how a Compiler class object behaves
47
struct
OPENVDB_AX_API
CompilerOptions
48
{
49
/// @brief Controls the llvm compiler optimization level
50
enum class
OptLevel
51
{
52
NONE,
// Do not run any optimization passes
53
O0,
// Optimization level 0. Similar to clang -O0
54
O1,
// Optimization level 1. Similar to clang -O1
55
O2,
// Optimization level 2. Similar to clang -O2
56
Os,
// Like -O2 with extra optimizations for size. Similar to clang -Os
57
Oz,
// Like -Os but reduces code size further. Similar to clang -Oz
58
O3
// Optimization level 3. Similar to clang -O3
59
};
60
61
OptLevel
mOptLevel
=
OptLevel::O3
;
62
63
/// @brief If this flag is true, the generated llvm module will be verified when compilation
64
/// occurs, resulting in an exception being thrown if it is not valid
65
bool
mVerify
=
true
;
66
/// @brief Options for the function registry
67
FunctionOptions
mFunctionOptions
=
FunctionOptions
();
68
};
69
70
}
// namespace ax
71
}
// namespace OPENVDB_VERSION_NAME
72
}
// namespace openvdb
73
74
#endif
// OPENVDB_AX_COMPILER_FUNCTION_REGISTRY_OPTIONS_HAS_BEEN_INCLUDED
75
OPENVDB_AX_API
#define OPENVDB_AX_API
Definition
Platform.h:312
openvdb
Definition
Exceptions.h:13
openvdb.h
openvdb::v13_0::ax::CompilerOptions
Settings which control how a Compiler class object behaves.
Definition
CompilerOptions.h:48
openvdb::v13_0::ax::CompilerOptions::mOptLevel
OptLevel mOptLevel
Definition
CompilerOptions.h:61
openvdb::v13_0::ax::CompilerOptions::OptLevel
OptLevel
Controls the llvm compiler optimization level.
Definition
CompilerOptions.h:51
openvdb::v13_0::ax::CompilerOptions::OptLevel::O3
@ O3
Definition
CompilerOptions.h:58
openvdb::v13_0::ax::CompilerOptions::mFunctionOptions
FunctionOptions mFunctionOptions
Options for the function registry.
Definition
CompilerOptions.h:67
openvdb::v13_0::ax::CompilerOptions::mVerify
bool mVerify
If this flag is true, the generated llvm module will be verified when compilation occurs,...
Definition
CompilerOptions.h:65
openvdb::v13_0::ax::FunctionOptions
Options that control how functions behave.
Definition
CompilerOptions.h:25
openvdb::v13_0::ax::FunctionOptions::mLazyFunctions
bool mLazyFunctions
When enabled, the function registry is only populated on a function visit. At the end of code generat...
Definition
CompilerOptions.h:43
openvdb::v13_0::ax::FunctionOptions::mConstantFoldCBindings
bool mConstantFoldCBindings
Enable the constant folding of C bindings. Functions may use this setting to determine whether they a...
Definition
CompilerOptions.h:36
openvdb::v13_0::ax::FunctionOptions::mPrioritiseIR
bool mPrioritiseIR
When enabled, functions which have IR builder instruction definitions will prioritise those over any ...
Definition
CompilerOptions.h:39
OPENVDB_VERSION_NAME
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition
version.h.in:121
OPENVDB_USE_VERSION_NAMESPACE
#define OPENVDB_USE_VERSION_NAMESPACE
Definition
version.h.in:218
openvdb_ax
compiler
CompilerOptions.h
Generated by
1.18.0