66 #ifndef OPENVDB_AX_CODEGEN_FUNCTION_TYPES_HAS_BEEN_INCLUDED 67 #define OPENVDB_AX_CODEGEN_FUNCTION_TYPES_HAS_BEEN_INCLUDED 73 #include <openvdb/version.h> 75 #include <llvm/IR/Constants.h> 76 #include <llvm/IR/IRBuilder.h> 77 #include <llvm/IR/Module.h> 83 #include <type_traits> 84 #include <unordered_map> 101 template <
typename T,
size_t _SIZE = 1>
104 static const size_t SIZE = _SIZE;
109 template <
typename T,
size_t S>
132 template <
typename T>
struct TypeToSymbol {
static inline std::string
s() {
return "?"; } };
133 template <>
struct TypeToSymbol<void> {
static inline std::string
s() {
return "v"; } };
134 template <>
struct TypeToSymbol<char> {
static inline std::string
s() {
return "c"; } };
135 template <>
struct TypeToSymbol<int16_t> {
static inline std::string
s() {
return "s"; } };
136 template <>
struct TypeToSymbol<int32_t> {
static inline std::string
s() {
return "i"; } };
137 template <>
struct TypeToSymbol<int64_t> {
static inline std::string
s() {
return "l"; } };
138 template <>
struct TypeToSymbol<float> {
static inline std::string
s() {
return "f"; } };
139 template <>
struct TypeToSymbol<double> {
static inline std::string
s() {
return "d"; } };
142 template <
typename T>
147 template <
typename T,
size_t S>
167 template <typename SignatureT, size_t I = FunctionTraits<SignatureT>::N_ARGS>
173 template <
typename OpT>
174 static void apply(
const OpT& op,
const bool forwards) {
186 template <
typename SignatureT>
189 template <
typename OpT>
190 static void apply(
const OpT&,
const bool) {}
201 template <
typename SignatureT>
204 std::vector<llvm::Type*>* types =
nullptr)
207 using ArgumentIteratorT =
211 types->reserve(Traits::N_ARGS);
212 auto callback = [&types, &C](
auto type) {
213 using Type = decltype(type);
216 ArgumentIteratorT::apply(callback,
true);
225 template <
typename SignatureT>
226 inline llvm::FunctionType*
229 std::vector<llvm::Type*> types;
230 llvm::Type* returnType =
231 llvmTypesFromSignature<SignatureT>(C, &types);
232 return llvm::FunctionType::get(returnType,
233 llvm::ArrayRef<llvm::Type*>(types),
250 const std::vector<llvm::Type*>& types,
251 const llvm::Type* returnType,
252 const char* name =
nullptr,
253 const std::vector<const char*>& names = {},
254 const bool axTypes =
false);
263 using Ptr = std::shared_ptr<Function>;
265 Function(
const size_t size,
const std::string& symbol)
268 , mAttributes(nullptr)
272 assert(!symbol.empty());
280 virtual llvm::Type* types(std::vector<llvm::Type*>&, llvm::LLVMContext&)
const = 0;
306 virtual llvm::Function*
307 create(llvm::LLVMContext& C, llvm::Module* M =
nullptr)
const;
312 llvm::Function*
create(llvm::Module& M)
const {
313 return this->create(M.getContext(), &M);
320 llvm::Function*
get(
const llvm::Module& M)
const;
346 call(
const std::vector<llvm::Value*>& args,
347 llvm::IRBuilder<>& B,
348 const bool cast =
false)
const;
374 virtual SignatureMatch match(
const std::vector<llvm::Type*>& inputs, llvm::LLVMContext& C)
const;
377 inline size_t size()
const {
return mSize; }
381 inline const char*
symbol()
const {
return mSymbol.c_str(); }
388 inline const char*
argName(
const size_t idx)
const {
389 return idx < mNames.size() ? mNames[idx] :
"";
403 virtual void print(llvm::LLVMContext& C,
405 const char* name =
nullptr,
406 const bool axTypes =
true)
const;
411 const llvm::Attribute::AttrKind& kind)
const 413 if (!mAttributes)
return false;
414 const auto iter = mAttributes->mParamAttrs.find(i);
415 if (iter == mAttributes->mParamAttrs.end())
return false;
416 const auto& vec = iter->second;
417 return std::find(vec.begin(), vec.end(), kind) != vec.end();
427 this->attrs().mFnAttrs = in;
431 this->attrs().mRetAttrs = in;
434 const std::vector<llvm::Attribute::AttrKind>& in)
436 this->attrs().mParamAttrs[i] = in;
448 static void cast(std::vector<llvm::Value*>& args,
449 const std::vector<llvm::Type*>& types,
450 llvm::IRBuilder<>& B);
455 std::vector<llvm::Attribute::AttrKind> mFnAttrs, mRetAttrs;
456 std::map<size_t, std::vector<llvm::Attribute::AttrKind>> mParamAttrs;
459 inline Attributes& attrs() {
460 if (!mAttributes) mAttributes.reset(
new Attributes());
464 llvm::AttributeList flattenAttrs(llvm::LLVMContext& C)
const;
467 const std::string mSymbol;
468 std::unique_ptr<Attributes> mAttributes;
469 std::vector<const char*> mNames;
470 std::vector<const char*> mDeps;
487 template <
typename SignatureT,
typename DerivedFunction>
490 using Ptr = std::shared_ptr<SRetFunction<SignatureT, DerivedFunction>>;
494 static_assert(Traits::N_ARGS > 0,
495 "SRET Function object has been setup with the first argument as the return " 496 "value, however the provided signature is empty.");
500 "SRET Function object has been setup with the first argument as the return " 501 "value and a non void return type.");
505 using FirstArgument =
typename Traits::template Arg<0>::Type;
507 "SRET Function object has been setup with the first argument as the return " 508 "value, but this argument it is not a pointer type.");
509 using SRetType =
typename std::remove_pointer<FirstArgument>::type;
516 llvm::LLVMContext& C)
const override 519 std::vector<llvm::Type*> inputs(args);
521 std::rotate(inputs.rbegin(), inputs.rbegin() + 1, inputs.rend());
522 return DerivedFunction::match(inputs, C);
532 call(
const std::vector<llvm::Value*>& args,
533 llvm::IRBuilder<>& B,
534 const bool cast)
const override 537 std::vector<llvm::Value*> inputs(args);
540 std::rotate(inputs.rbegin(), inputs.rbegin() + 1, inputs.rend());
541 DerivedFunction::call(inputs, B, cast);
542 return inputs.front();
548 const char* name =
nullptr,
549 const bool axTypes =
true)
const override 551 std::vector<llvm::Type*> current;
552 llvm::Type* ret = this->types(current, C);
554 std::rotate(current.begin(), current.begin() + 1, current.end());
555 ret = current.back();
558 std::vector<const char*> names;
559 names.reserve(this->size());
560 for (
size_t i = 0; i < this->size()-1; ++i) {
561 names.emplace_back(this->argName(i));
568 template <
typename ...Args>
575 using Ptr = std::shared_ptr<CFunctionBase>;
581 virtual uint64_t address()
const = 0;
586 inline virtual llvm::Value*
fold(
const std::vector<llvm::Value*>&,
587 llvm::LLVMContext&)
const {
593 const std::string& symbol)
595 , mConstantFold(false) {}
606 template <
typename SignatureT>
610 using Ptr = std::shared_ptr<CFunctionT>;
618 "CFunction object has been setup with a pointer return argument. C bindings " 619 "cannot return memory locations to LLVM - Consider using a CFunctionSRet.");
621 CFunction(
const std::string& symbol,
const SignatureT
function)
623 , mFunction(function) {}
627 inline llvm::Type*
types(std::vector<llvm::Type*>& types, llvm::LLVMContext& C)
const override 629 return llvmTypesFromSignature<SignatureT>(C, &types);
632 inline uint64_t
address() const override final {
633 return reinterpret_cast<uint64_t
>(mFunction);
637 call(
const std::vector<llvm::Value*>& args,
638 llvm::IRBuilder<>& B,
639 const bool cast)
const override 641 llvm::Value* result = this->fold(args, B.getContext());
642 if (result)
return result;
643 return Function::call(args, B, cast);
646 llvm::Value*
fold(
const std::vector<llvm::Value*>& args, llvm::LLVMContext& C)
const override final 649 [](
const std::vector<llvm::Value*>& vals) ->
bool {
650 for (
auto&
value : vals) {
651 if (!llvm::isa<llvm::Constant>(
value))
return false;
656 if (!this->hasConstantFold())
return nullptr;
657 if (!allconst(args))
return nullptr;
658 std::vector<llvm::Constant*> constants;
659 constants.reserve(args.size());
660 for (
auto&
value : args) {
661 constants.emplace_back(llvm::cast<llvm::Constant>(
value));
669 const SignatureT* mFunction;
675 using Ptr = std::shared_ptr<IRFunctionBase>;
687 (
const std::vector<llvm::Value*>&, llvm::IRBuilder<>&)>;
689 llvm::Type* types(std::vector<llvm::Type*>& types,
690 llvm::LLVMContext& C)
const override = 0;
710 create(llvm::LLVMContext& C, llvm::Module* M)
const override;
717 call(
const std::vector<llvm::Value*>& args,
718 llvm::IRBuilder<>& B,
719 const bool cast)
const override;
728 if (result == expected)
return;
729 std::string source, target;
733 "\" has been invoked with a mismatching return type. Expected: \"" +
734 target +
"\", got \"" + source +
"\".");
750 template <
typename SignatureT>
754 using Ptr = std::shared_ptr<IRFunction>;
760 types(std::vector<llvm::Type*>& types, llvm::LLVMContext& C)
const override 762 return llvmTypesFromSignature<SignatureT>(C, &types);
768 template <
typename SignatureT>
773 :
BaseT(symbol, function) {}
779 template <
typename SignatureT>
785 :
BaseT(symbol, gen) {}
792 using Ptr = std::shared_ptr<FunctionGroup>;
801 , mFunctionList(list) {}
818 match(
const std::vector<llvm::Type*>& types,
819 llvm::LLVMContext& C,
833 execute(
const std::vector<llvm::Value*>& args,
834 llvm::IRBuilder<>& B)
const;
850 execute(
const std::vector<llvm::Value*>& args,
851 llvm::IRBuilder<>& B,
852 llvm::Value*& result)
const;
856 const char*
name()
const {
return mName; }
857 const char*
doc()
const {
return mDoc; }
882 using Ptr = std::shared_ptr<Settings>;
885 if (mNames)
return false;
886 if (!mDeps.empty())
return false;
887 if (mConstantFold || mEmbedIR)
return false;
888 if (!mFnAttrs.empty())
return false;
889 if (!mRetAttrs.empty())
return false;
890 if (!mParamAttrs.empty())
return false;
894 std::shared_ptr<std::vector<const char*>> mNames =
nullptr;
895 std::vector<const char*> mDeps = {};
896 bool mConstantFold =
false;
897 bool mEmbedIR =
false;
898 std::vector<llvm::Attribute::AttrKind> mFnAttrs = {};
899 std::vector<llvm::Attribute::AttrKind> mRetAttrs = {};
900 std::map<size_t, std::vector<llvm::Attribute::AttrKind>> mParamAttrs = {};
905 , mCurrentSettings(new
Settings()) {}
908 template <
typename Signature,
bool SRet = false>
911 const char* symbol =
nullptr)
913 using IRFType =
typename std::conditional
915 using IRPtr =
typename IRFType::Ptr;
918 if (!mCurrentSettings->isDefault()) {
923 if (symbol) s = std::string(symbol);
924 else s = this->genSymbol<Signature>();
926 auto ir = IRPtr(
new IRFType(s, cb));
927 mIRFunctions.emplace_back(ir);
928 mSettings[ir.get()] = settings;
929 mCurrentSettings = settings;
933 template <
typename Signature,
bool SRet = false>
936 const char* symbol =
nullptr)
938 using CFType =
typename std::conditional
940 using CPtr =
typename CFType::Ptr;
943 if (!mCurrentSettings->isDefault()) {
948 if (symbol) s = std::string(symbol);
949 else s = this->genSymbol<Signature>();
951 auto c = CPtr(
new CFType(s, ptr));
952 mCFunctions.emplace_back(c);
953 mSettings[c.get()] = settings;
954 mCurrentSettings = settings;
958 template <
typename Signature,
bool SRet = false>
962 this->addSignature<Signature, SRet>(cb, symbol);
963 this->addSignature<Signature, SRet>(ptr, symbol);
968 mCurrentSettings->mDeps.emplace_back(name);
return *
this;
974 mCurrentSettings->mNames.reset(
new std::vector<const char*>(names));
1043 mCurrentSettings->mParamAttrs[idx].emplace_back(attr);
1049 mCurrentSettings->mRetAttrs.emplace_back(attr);
1055 mCurrentSettings->mFnAttrs.emplace_back(attr);
1064 for (
auto& decl : mCFunctions) {
1065 const auto& s = mSettings.at(decl.get());
1066 decl->setDependencies(s->mDeps);
1068 if (!s->mFnAttrs.empty()) decl->setFnAttributes(s->mFnAttrs);
1069 if (!s->mRetAttrs.empty()) decl->setRetAttributes(s->mRetAttrs);
1070 if (!s->mParamAttrs.empty()) {
1071 for (
auto& idxAttrs : s->mParamAttrs) {
1072 if (idxAttrs.first > decl->size())
continue;
1073 decl->setParamAttributes(idxAttrs.first, idxAttrs.second);
1079 for (
auto& decl : mIRFunctions) {
1080 const auto& s = mSettings.at(decl.get());
1081 decl->setDependencies(s->mDeps);
1083 if (!s->mFnAttrs.empty()) decl->setFnAttributes(s->mFnAttrs);
1084 if (!s->mRetAttrs.empty()) decl->setRetAttributes(s->mRetAttrs);
1085 if (!s->mParamAttrs.empty()) {
1086 for (
auto& idxAttrs : s->mParamAttrs) {
1087 if (idxAttrs.first > decl->size())
continue;
1088 decl->setParamAttributes(idxAttrs.first, idxAttrs.second);
1094 std::vector<Function::Ptr> functions;
1096 if (mDeclPref == DeclPreferrence::IR) {
1097 functions.insert(functions.end(), mIRFunctions.begin(), mIRFunctions.end());
1099 if (mDeclPref == DeclPreferrence::C) {
1100 functions.insert(functions.end(), mCFunctions.begin(), mCFunctions.end());
1102 if (functions.empty()) {
1103 functions.insert(functions.end(), mIRFunctions.begin(), mIRFunctions.end());
1104 functions.insert(functions.end(), mCFunctions.begin(), mCFunctions.end());
1113 template <
typename Signature>
1114 std::string genSymbol()
const 1119 auto callback = [&args](
auto type) {
1120 using Type = decltype(type);
1130 return "ax." + std::string(this->mName) +
"." +
1134 const char* mName =
"";
1135 const char* mDoc =
"";
1137 std::vector<CFunctionBase::Ptr> mCFunctions = {};
1138 std::vector<IRFunctionBase::Ptr> mIRFunctions = {};
1139 std::map<const Function*, Settings::Ptr> mSettings = {};
1148 #endif // OPENVDB_AX_CODEGEN_FUNCTION_TYPES_HAS_BEEN_INCLUDED bool hasEmbedIR() const
Definition: FunctionTypes.h:695
bool isDefault() const
Definition: FunctionTypes.h:884
Definition: FunctionTypes.h:880
llvm::Type * types(std::vector< llvm::Type * > &types, llvm::LLVMContext &C) const override
Populate a vector of llvm::Types which describe this function signature. This method is used by Funct...
Definition: FunctionTypes.h:627
llvm::FunctionType * llvmFunctionTypeFromSignature(llvm::LLVMContext &C)
Generate an LLVM FunctionType from a function signature.
Definition: FunctionTypes.h:227
bool mEmbedIR
Definition: FunctionTypes.h:746
const char * name() const
Definition: FunctionTypes.h:856
SignatureMatch
The result type from calls to Function::match.
Definition: FunctionTypes.h:351
const FunctionList & list() const
Accessor to the underlying function signature list.
Definition: FunctionTypes.h:855
typename FunctionTraits< SignatureT >::template Arg< I-1 > ArgT
Definition: FunctionTypes.h:170
#define OPENVDB_THROW(exception, message)
Definition: Exceptions.h:74
static void apply(const OpT &op, const bool forwards)
Definition: FunctionTypes.h:174
SRetFunction(Args &&...ts)
Forward all arguments to the derived class.
Definition: FunctionTypes.h:569
llvm::Value * fold(const std::vector< llvm::Value * > &args, llvm::LLVMContext &C) const override final
Definition: FunctionTypes.h:646
FunctionBuilder & setArgumentNames(const std::vector< const char * > &names)
Definition: FunctionTypes.h:973
FunctionBuilder & addSignature(const IRFunctionBase::GeneratorCb &cb, const char *symbol=nullptr)
Definition: FunctionTypes.h:910
todo
Definition: FunctionTypes.h:790
llvm::Value * call(const std::vector< llvm::Value * > &args, llvm::IRBuilder<> &B, const bool cast) const override
Override of call which allocates the required SRET llvm::Value for this function. ...
Definition: FunctionTypes.h:532
llvm::Value * call(const std::vector< llvm::Value * > &args, llvm::IRBuilder<> &B, const bool cast) const override
Uses the IRBuilder to create a call to this function with the given arguments, creating the function ...
Definition: FunctionTypes.h:637
void setRetAttributes(const std::vector< llvm::Attribute::AttrKind > &in)
Definition: FunctionTypes.h:429
FunctionBuilder & addFunctionAttribute(const llvm::Attribute::AttrKind attr)
Definition: FunctionTypes.h:1054
FunctionBuilder & addReturnAttribute(const llvm::Attribute::AttrKind attr)
Definition: FunctionTypes.h:1048
Alias mapping between two types, a frontend type T1 and a backend type T2. This class is the intended...
Definition: Types.h:218
T Type
Definition: FunctionTypes.h:103
static std::string s()
Definition: FunctionTypes.h:139
Type to symbol conversions - these characters are used to build each functions unique signature...
Definition: FunctionTypes.h:132
const std::vector< const char * > & dependencies() const
Definition: FunctionTypes.h:422
Consolidated llvm types for most supported types.
Function::SignatureMatch match(const std::vector< llvm::Type * > &args, llvm::LLVMContext &C) const override
Override of match which inserts the SRET type such that the base class methods ignore it...
Definition: FunctionTypes.h:515
CFunctionBase(const size_t size, const std::string &symbol)
Definition: FunctionTypes.h:592
std::shared_ptr< Function > Ptr
Definition: FunctionTypes.h:263
An extremely basic but native representation of a string class with SSO support. This exists to provi...
Definition: String.h:33
static std::string s()
Definition: FunctionTypes.h:137
std::shared_ptr< Settings > Ptr
Definition: FunctionTypes.h:882
bool hasConstantFold() const
Definition: FunctionTypes.h:584
void setParamAttributes(const size_t i, const std::vector< llvm::Attribute::AttrKind > &in)
Definition: FunctionTypes.h:433
IRFunctionBase(const std::string &symbol, const GeneratorCb &gen, const size_t size)
Definition: FunctionTypes.h:737
const char * argName(const size_t idx) const
Returns the descriptive name of the given argument index.
Definition: FunctionTypes.h:388
bool hasParamAttribute(const size_t i, const llvm::Attribute::AttrKind &kind) const
Builder methods.
Definition: FunctionTypes.h:410
void setEmbedIR(bool on)
Enable or disable the embedding of IR. Embedded IR is currently required for function which use paren...
Definition: FunctionTypes.h:694
Constant folding support structure.
Definition: ConstantFolding.h:34
static std::string s()
Definition: FunctionTypes.h:149
void printSignature(std::ostream &os, const std::vector< llvm::Type * > &types, const llvm::Type *returnType, const char *name=nullptr, const std::vector< const char * > &names={}, const bool axTypes=false)
Print a function signature to the provided ostream.
IRFunctionSRet(const std::string &symbol, const IRFunctionBase::GeneratorCb &gen)
Definition: FunctionTypes.h:783
static void apply(const OpT &, const bool)
Definition: FunctionTypes.h:190
FunctionBuilder & addParameterAttribute(const size_t idx, const llvm::Attribute::AttrKind attr)
Definition: FunctionTypes.h:1042
DeclPreferrence
Definition: FunctionTypes.h:876
static std::string s()
Definition: FunctionTypes.h:144
void setArgumentNames(std::vector< const char * > names)
Definition: FunctionTypes.h:420
std::unique_ptr< FunctionGroup > UniquePtr
Definition: FunctionTypes.h:793
Templated interface class for SRET functions. This struct provides the interface for functions that w...
Definition: FunctionTypes.h:488
std::vector< Function::Ptr > FunctionList
Definition: FunctionTypes.h:794
void setConstantFold(bool on)
Definition: FunctionTypes.h:583
Represents a concrete C function binding with the first argument as its return type.
Definition: FunctionTypes.h:769
virtual llvm::Value * fold(const std::vector< llvm::Value * > &, llvm::LLVMContext &) const
Definition: FunctionTypes.h:586
Function(const size_t size, const std::string &symbol)
Definition: FunctionTypes.h:265
CFunctionSRet(const std::string &symbol, const SignatureT function)
Definition: FunctionTypes.h:772
Templated function traits which provides compile-time index access to the types of the function signa...
Definition: Types.h:259
Definition: Exceptions.h:13
llvm::Function * create(llvm::Module &M) const
Convenience method which always uses the provided module to find the function or insert it if necessa...
Definition: FunctionTypes.h:312
FunctionBuilder & addSignature(const Signature *ptr, const char *symbol=nullptr)
Definition: FunctionTypes.h:935
ValueT value
Definition: GridBuilder.h:1287
IRFunction(const std::string &symbol, const GeneratorCb &gen)
Definition: FunctionTypes.h:756
ArrayType mData
Definition: FunctionTypes.h:106
Represents a concrete IR function.
Definition: FunctionTypes.h:751
LLVM type mapping from pod types.
Definition: Types.h:54
Definition: FunctionTypes.h:351
llvm::Type * types(std::vector< llvm::Type * > &types, llvm::LLVMContext &C) const override
Populate a vector of llvm::Types which describe this function signature. This method is used by Funct...
Definition: FunctionTypes.h:760
Definition: Exceptions.h:36
static std::string s()
Definition: FunctionTypes.h:138
static std::string s()
Definition: FunctionTypes.h:136
void setFnAttributes(const std::vector< llvm::Attribute::AttrKind > &in)
Definition: FunctionTypes.h:425
std::function< llvm::Value *(const std::vector< llvm::Value * > &, llvm::IRBuilder<> &)> GeneratorCb
The IR callback function which will write the LLVM IR for this function's body.
Definition: FunctionTypes.h:687
static std::string s()
Definition: FunctionTypes.h:133
void print(llvm::LLVMContext &C, std::ostream &os, const char *name=nullptr, const bool axTypes=true) const override
Override of print to avoid printing out the SRET type.
Definition: FunctionTypes.h:546
CFunction(const std::string &symbol, const SignatureT function)
Definition: FunctionTypes.h:621
const char * doc() const
Definition: FunctionTypes.h:857
The base class for all C bindings.
Definition: FunctionTypes.h:573
Represents a concrete IR function with the first argument as its return type.
Definition: FunctionTypes.h:780
const char * symbol() const
The function symbol name.
Definition: FunctionTypes.h:381
FunctionBuilder & addSignature(const IRFunctionBase::GeneratorCb &cb, const Signature *ptr, const char *symbol=nullptr)
Definition: FunctionTypes.h:960
The base/abstract definition for an IR function.
Definition: FunctionTypes.h:673
Constant folding for C++ bindings.
The base/abstract representation of an AX function. Derived classes must implement the Function::type...
Definition: FunctionTypes.h:261
FunctionBuilder & setPreferredImpl(DeclPreferrence pref)
Definition: FunctionTypes.h:1060
The FunctionBuilder class provides a builder pattern framework to allow easy and valid construction o...
Definition: FunctionTypes.h:874
Object to array conversion methods to allow functions to return vector types. These containers provid...
Definition: FunctionTypes.h:102
Type[SIZE] ArrayType
Definition: FunctionTypes.h:105
void setDependencies(std::vector< const char * > deps)
Definition: FunctionTypes.h:423
static std::string s()
Definition: FunctionTypes.h:132
size_t size() const
The number of arguments that this function has.
Definition: FunctionTypes.h:377
Templated argument iterator which implements various small functions per argument type...
Definition: FunctionTypes.h:168
static std::string s()
Definition: FunctionTypes.h:134
Definition: FunctionTypes.h:877
void verifyResultType(const llvm::Type *result, const llvm::Type *expected) const
Definition: FunctionTypes.h:726
static std::string s()
Definition: FunctionTypes.h:135
Utility code generation methods for performing various llvm operations.
Definition: FunctionTypes.h:143
FunctionBuilder & setEmbedIR(bool on)
Definition: FunctionTypes.h:971
FunctionGroup(const char *name, const char *doc, const FunctionList &list)
Definition: FunctionTypes.h:796
const GeneratorCb mGen
Definition: FunctionTypes.h:745
FunctionBuilder & setDocumentation(const char *doc)
Definition: FunctionTypes.h:1059
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition: version.h.in:116
FunctionBuilder(const char *name)
Definition: FunctionTypes.h:903
FunctionBuilder & addDependency(const char *name)
Definition: FunctionTypes.h:967
uint64_t address() const override final
Returns the global address of this function.
Definition: FunctionTypes.h:632
void print(const ast::Node &node, const bool numberStatements=true, std::ostream &os=std::cout, const char *indent=" ")
Writes a descriptive printout of a Node hierarchy into a target stream.
FunctionBuilder & setConstantFold(bool on)
Definition: FunctionTypes.h:972
void llvmTypeToString(const llvm::Type *const type, std::string &str)
Prints an llvm type to a std string.
Definition: Utils.h:70
static std::string s()
Definition: FunctionTypes.h:140
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h.in:202
std::shared_ptr< FunctionGroup > Ptr
Definition: FunctionTypes.h:792
Represents a concrete C function binding.
Definition: FunctionTypes.h:607
llvm::Type * llvmTypesFromSignature(llvm::LLVMContext &C, std::vector< llvm::Type * > *types=nullptr)
Populate a vector of llvm types from a function signature declaration.
Definition: FunctionTypes.h:203
typename ArgT::Type ArgumentValueType
Definition: FunctionTypes.h:171
llvm::Value * insertStaticAlloca(llvm::IRBuilder<> &B, llvm::Type *type, llvm::Value *size=nullptr)
Insert a stack allocation at the beginning of the current function of the provided type and size...
Definition: Utils.h:123