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> 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<uint8_t> {
static inline std::string
s() {
return "u8"; } };
136 template <>
struct TypeToSymbol<uint16_t> {
static inline std::string
s() {
return "us"; } };
137 template <>
struct TypeToSymbol<uint32_t> {
static inline std::string
s() {
return "ui"; } };
138 template <>
struct TypeToSymbol<uint64_t> {
static inline std::string
s() {
return "ul"; } };
139 template <>
struct TypeToSymbol<int8_t> {
static inline std::string
s() {
return "8"; } };
140 template <>
struct TypeToSymbol<int16_t> {
static inline std::string
s() {
return "s"; } };
141 template <>
struct TypeToSymbol<int32_t> {
static inline std::string
s() {
return "i"; } };
142 template <>
struct TypeToSymbol<int64_t> {
static inline std::string
s() {
return "l"; } };
143 template <>
struct TypeToSymbol<float> {
static inline std::string
s() {
return "f"; } };
144 template <>
struct TypeToSymbol<double> {
static inline std::string
s() {
return "d"; } };
147 template <
typename T>
152 template <
typename T,
size_t S>
172 template <typename SignatureT, size_t I = FunctionTraits<SignatureT>::N_ARGS>
178 template <
typename OpT>
179 static void apply(
const OpT& op,
const bool forwards) {
191 template <
typename SignatureT>
194 template <
typename OpT>
195 static void apply(
const OpT&,
const bool) {}
206 template <
typename SignatureT>
209 std::vector<llvm::Type*>* types =
nullptr)
212 using ArgumentIteratorT =
216 types->reserve(Traits::N_ARGS);
217 auto callback = [&types, &C](
auto type) {
218 using Type = decltype(type);
221 ArgumentIteratorT::apply(callback,
true);
230 template <
typename SignatureT>
231 inline llvm::FunctionType*
234 std::vector<llvm::Type*> types;
235 llvm::Type* returnType =
236 llvmTypesFromSignature<SignatureT>(C, &types);
237 return llvm::FunctionType::get(returnType,
238 llvm::ArrayRef<llvm::Type*>(types),
255 const std::vector<llvm::Type*>& types,
256 const llvm::Type* returnType,
257 const char* name =
nullptr,
258 const std::vector<const char*>& names = {},
259 const bool axTypes =
false);
268 using Ptr = std::shared_ptr<Function>;
270 Function(
const size_t size,
const std::string& symbol)
273 , mAttributes(nullptr)
277 assert(!symbol.empty());
285 virtual llvm::Type* types(std::vector<llvm::Type*>&, llvm::LLVMContext&)
const = 0;
311 virtual llvm::Function*
312 create(llvm::LLVMContext& C, llvm::Module* M =
nullptr)
const;
317 llvm::Function*
create(llvm::Module& M)
const {
318 return this->create(M.getContext(), &M);
325 llvm::Function*
get(
const llvm::Module& M)
const;
351 call(
const std::vector<llvm::Value*>& args,
352 llvm::IRBuilder<>& B,
353 const bool cast =
false)
const;
379 virtual SignatureMatch match(
const std::vector<llvm::Type*>& inputs, llvm::LLVMContext& C)
const;
382 inline size_t size()
const {
return mSize; }
386 inline const char*
symbol()
const {
return mSymbol.c_str(); }
393 inline const char*
argName(
const size_t idx)
const {
394 return idx < mNames.size() ? mNames[idx] :
"";
408 virtual void print(llvm::LLVMContext& C,
410 const char* name =
nullptr,
411 const bool axTypes =
true)
const;
416 const llvm::Attribute::AttrKind& kind)
const 418 if (!mAttributes)
return false;
419 const auto iter = mAttributes->mParamAttrs.find(i);
420 if (iter == mAttributes->mParamAttrs.end())
return false;
421 const auto& vec = iter->second;
422 return std::find(vec.begin(), vec.end(), kind) != vec.end();
432 this->attrs().mFnAttrs = in;
436 this->attrs().mRetAttrs = in;
439 const std::vector<llvm::Attribute::AttrKind>& in)
441 this->attrs().mParamAttrs[i] = in;
453 static void cast(std::vector<llvm::Value*>& args,
454 const std::vector<llvm::Type*>& types,
455 llvm::IRBuilder<>& B);
460 std::vector<llvm::Attribute::AttrKind> mFnAttrs, mRetAttrs;
461 std::map<size_t, std::vector<llvm::Attribute::AttrKind>> mParamAttrs;
464 inline Attributes& attrs() {
465 if (!mAttributes) mAttributes.reset(
new Attributes());
469 llvm::AttributeList flattenAttrs(llvm::LLVMContext& C)
const;
472 const std::string mSymbol;
473 std::unique_ptr<Attributes> mAttributes;
474 std::vector<const char*> mNames;
475 std::vector<const char*> mDeps;
492 template <
typename SignatureT,
typename DerivedFunction>
495 using Ptr = std::shared_ptr<SRetFunction<SignatureT, DerivedFunction>>;
499 static_assert(Traits::N_ARGS > 0,
500 "SRET Function object has been setup with the first argument as the return " 501 "value, however the provided signature is empty.");
504 static_assert(std::is_same<typename Traits::ReturnType, void>::value,
505 "SRET Function object has been setup with the first argument as the return " 506 "value and a non void return type.");
510 using FirstArgument =
typename Traits::template Arg<0>::Type;
511 static_assert(std::is_pointer<FirstArgument>::value,
512 "SRET Function object has been setup with the first argument as the return " 513 "value, but this argument it is not a pointer type.");
514 using SRetType =
typename std::remove_pointer<FirstArgument>::type;
521 llvm::LLVMContext& C)
const override 524 std::vector<llvm::Type*> inputs(args);
526 std::rotate(inputs.rbegin(), inputs.rbegin() + 1, inputs.rend());
527 return DerivedFunction::match(inputs, C);
537 call(
const std::vector<llvm::Value*>& args,
538 llvm::IRBuilder<>& B,
539 const bool cast)
const override 542 std::vector<llvm::Value*> inputs(args);
545 std::rotate(inputs.rbegin(), inputs.rbegin() + 1, inputs.rend());
546 DerivedFunction::call(inputs, B, cast);
547 return inputs.front();
553 const char* name =
nullptr,
554 const bool axTypes =
true)
const override 556 std::vector<llvm::Type*> current;
557 llvm::Type* ret = this->types(current, C);
559 std::rotate(current.begin(), current.begin() + 1, current.end());
560 ret = current.back();
563 std::vector<const char*> names;
564 names.reserve(this->size());
565 for (
size_t i = 0; i < this->size()-1; ++i) {
566 names.emplace_back(this->argName(i));
573 template <
typename ...Args>
580 using Ptr = std::shared_ptr<CFunctionBase>;
586 virtual uint64_t address()
const = 0;
591 inline virtual llvm::Value*
fold(
const std::vector<llvm::Value*>&,
592 llvm::LLVMContext&)
const {
598 const std::string& symbol)
600 , mConstantFold(false) {}
611 template <
typename SignatureT>
615 using Ptr = std::shared_ptr<CFunctionT>;
621 static_assert(std::is_same<typename Traits::ReturnType, void*>::value ||
622 !std::is_pointer<typename Traits::ReturnType>::value,
623 "CFunction object has been setup with a pointer return argument. C bindings " 624 "cannot return memory locations to LLVM - Consider using a CFunctionSRet.");
626 CFunction(
const std::string& symbol, SignatureT*
function)
628 , mFunction(function) {}
632 inline llvm::Type*
types(std::vector<llvm::Type*>& types, llvm::LLVMContext& C)
const override 634 return llvmTypesFromSignature<SignatureT>(C, &types);
637 inline uint64_t
address() const override final {
638 return reinterpret_cast<uint64_t
>(mFunction);
642 call(
const std::vector<llvm::Value*>& args,
643 llvm::IRBuilder<>& B,
644 const bool cast)
const override 646 llvm::Value* result = this->fold(args, B.getContext());
647 if (result)
return result;
648 return Function::call(args, B, cast);
651 llvm::Value*
fold(
const std::vector<llvm::Value*>& args, llvm::LLVMContext& C)
const override final 654 [](
const std::vector<llvm::Value*>& vals) ->
bool {
655 for (
auto& value : vals) {
656 if (!llvm::isa<llvm::Constant>(value))
return false;
661 if (!this->hasConstantFold())
return nullptr;
662 if (!allconst(args))
return nullptr;
663 std::vector<llvm::Constant*> constants;
664 constants.reserve(args.size());
665 for (
auto& value : args) {
666 constants.emplace_back(llvm::cast<llvm::Constant>(value));
674 SignatureT* mFunction;
680 using Ptr = std::shared_ptr<IRFunctionBase>;
692 (
const std::vector<llvm::Value*>&, llvm::IRBuilder<>&)>;
712 create(llvm::LLVMContext& C, llvm::Module* M)
const override;
719 call(
const std::vector<llvm::Value*>& args,
720 llvm::IRBuilder<>& B,
721 const bool cast)
const override;
730 if (result == expected)
return;
731 std::string source, target;
735 "\" has been invoked with a mismatching return type. Expected: \"" +
736 target +
"\", got \"" + source +
"\".");
752 template <
typename SignatureT>
756 using Ptr = std::shared_ptr<IRFunction>;
762 types(std::vector<llvm::Type*>& types, llvm::LLVMContext& C)
const override 764 return llvmTypesFromSignature<SignatureT>(C, &types);
770 template <
typename SignatureT>
775 :
BaseT(symbol, function) {}
781 template <
typename SignatureT>
787 :
BaseT(symbol, gen) {}
794 using Ptr = std::shared_ptr<FunctionGroup>;
803 , mFunctionList(list) {}
820 match(
const std::vector<llvm::Type*>& types,
821 llvm::LLVMContext& C,
835 execute(
const std::vector<llvm::Value*>& args,
836 llvm::IRBuilder<>& B)
const;
852 execute(
const std::vector<llvm::Value*>& args,
853 llvm::IRBuilder<>& B,
854 llvm::Value*& result)
const;
858 const char*
name()
const {
return mName; }
859 const char*
doc()
const {
return mDoc; }
884 using Ptr = std::shared_ptr<Settings>;
887 if (mNames)
return false;
888 if (!mDeps.empty())
return false;
889 if (mConstantFold || mEmbedIR)
return false;
890 if (!mFnAttrs.empty())
return false;
891 if (!mRetAttrs.empty())
return false;
892 if (!mParamAttrs.empty())
return false;
896 std::shared_ptr<std::vector<const char*>> mNames =
nullptr;
897 std::vector<const char*> mDeps = {};
898 bool mConstantFold =
false;
899 bool mEmbedIR =
false;
900 std::vector<llvm::Attribute::AttrKind> mFnAttrs = {};
901 std::vector<llvm::Attribute::AttrKind> mRetAttrs = {};
902 std::map<size_t, std::vector<llvm::Attribute::AttrKind>> mParamAttrs = {};
907 , mCurrentSettings(new
Settings()) {}
910 template <
typename Signature,
bool SRet = false>
913 const char* symbol =
nullptr)
915 using IRFType =
typename std::conditional
917 using IRPtr =
typename IRFType::Ptr;
920 if (!mCurrentSettings->isDefault()) {
925 if (symbol) s = std::string(symbol);
926 else s = this->genSymbol<Signature>();
928 auto ir = IRPtr(
new IRFType(s, cb));
929 mIRFunctions.emplace_back(ir);
930 mSettings[ir.get()] = settings;
931 mCurrentSettings = settings;
935 template <
typename Signature,
bool SRet = false>
938 const char* symbol =
nullptr)
940 using CFType =
typename std::conditional
942 using CPtr =
typename CFType::Ptr;
945 if (!mCurrentSettings->isDefault()) {
950 if (symbol) s = std::string(symbol);
951 else s = this->genSymbol<Signature>();
953 auto c = CPtr(
new CFType(s, ptr));
954 mCFunctions.emplace_back(c);
955 mSettings[c.get()] = settings;
956 mCurrentSettings = settings;
960 template <
typename Signature,
bool SRet = false>
964 this->addSignature<Signature, SRet>(cb, symbol);
965 this->addSignature<Signature, SRet>(ptr, symbol);
970 mCurrentSettings->mDeps.emplace_back(name);
return *
this;
976 mCurrentSettings->mNames.reset(
new std::vector<const char*>(names));
1045 mCurrentSettings->mParamAttrs[idx].emplace_back(attr);
1051 mCurrentSettings->mRetAttrs.emplace_back(attr);
1057 mCurrentSettings->mFnAttrs.emplace_back(attr);
1066 for (
auto& decl : mCFunctions) {
1067 const auto& s = mSettings.at(decl.get());
1068 decl->setDependencies(s->mDeps);
1070 if (!s->mFnAttrs.empty()) decl->setFnAttributes(s->mFnAttrs);
1071 if (!s->mRetAttrs.empty()) decl->setRetAttributes(s->mRetAttrs);
1072 if (!s->mParamAttrs.empty()) {
1073 for (
auto& idxAttrs : s->mParamAttrs) {
1074 if (idxAttrs.first > decl->size())
continue;
1075 decl->setParamAttributes(idxAttrs.first, idxAttrs.second);
1081 for (
auto& decl : mIRFunctions) {
1082 const auto& s = mSettings.at(decl.get());
1083 decl->setDependencies(s->mDeps);
1085 if (!s->mFnAttrs.empty()) decl->setFnAttributes(s->mFnAttrs);
1086 if (!s->mRetAttrs.empty()) decl->setRetAttributes(s->mRetAttrs);
1087 if (!s->mParamAttrs.empty()) {
1088 for (
auto& idxAttrs : s->mParamAttrs) {
1089 if (idxAttrs.first > decl->size())
continue;
1090 decl->setParamAttributes(idxAttrs.first, idxAttrs.second);
1096 std::vector<Function::Ptr> functions;
1098 if (mDeclPref == DeclPreferrence::IR) {
1099 functions.insert(functions.end(), mIRFunctions.begin(), mIRFunctions.end());
1101 if (mDeclPref == DeclPreferrence::C) {
1102 functions.insert(functions.end(), mCFunctions.begin(), mCFunctions.end());
1104 if (functions.empty()) {
1105 functions.insert(functions.end(), mIRFunctions.begin(), mIRFunctions.end());
1106 functions.insert(functions.end(), mCFunctions.begin(), mCFunctions.end());
1115 template <
typename Signature>
1116 std::string genSymbol()
const 1121 auto callback = [&args](
auto type) {
1122 using Type = decltype(type);
1132 return "ax." + std::string(this->mName) +
"." +
1136 const char* mName =
"";
1137 const char* mDoc =
"";
1139 std::vector<CFunctionBase::Ptr> mCFunctions = {};
1140 std::vector<IRFunctionBase::Ptr> mIRFunctions = {};
1141 std::map<const Function*, Settings::Ptr> mSettings = {};
1150 #endif // OPENVDB_AX_CODEGEN_FUNCTION_TYPES_HAS_BEEN_INCLUDED Definition: Exceptions.h:38
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:520
LLVM type mapping from pod types.
Definition: Types.h:54
const char * name() const
Definition: FunctionTypes.h:858
CFunctionBase(const size_t size, const std::string &symbol)
Definition: FunctionTypes.h:597
FunctionBuilder & addParameterAttribute(const size_t idx, const llvm::Attribute::AttrKind attr)
Definition: FunctionTypes.h:1044
void verifyResultType(const llvm::Type *result, const llvm::Type *expected) const
Definition: FunctionTypes.h:728
FunctionBuilder & setEmbedIR(bool on)
Definition: FunctionTypes.h:973
FunctionBuilder & addDependency(const char *name)
Definition: FunctionTypes.h:969
typename FunctionTraits< SignatureT >::template Arg< I-1 > ArgT
Definition: FunctionTypes.h:175
#define OPENVDB_THROW(exception, message)
Definition: Exceptions.h:74
static std::string s()
Definition: FunctionTypes.h:133
static std::string s()
Definition: FunctionTypes.h:141
The FunctionBuilder class provides a builder pattern framework to allow easy and valid construction o...
Definition: FunctionTypes.h:876
The base/abstract definition for an IR function.
Definition: FunctionTypes.h:678
void setRetAttributes(const std::vector< llvm::Attribute::AttrKind > &in)
Definition: FunctionTypes.h:434
static void apply(const OpT &, const bool)
Definition: FunctionTypes.h:195
The base class for all C bindings.
Definition: FunctionTypes.h:578
size_t size() const
The number of arguments that this function has.
Definition: FunctionTypes.h:382
bool mEmbedIR
Definition: FunctionTypes.h:748
static std::string s()
Definition: FunctionTypes.h:132
Templated interface class for SRET functions. This struct provides the interface for functions that w...
Definition: FunctionTypes.h:493
const char * doc() const
Definition: FunctionTypes.h:859
virtual llvm::Value * fold(const std::vector< llvm::Value * > &, llvm::LLVMContext &) const
Definition: FunctionTypes.h:591
SRetFunction(Args &&...ts)
Forward all arguments to the derived class.
Definition: FunctionTypes.h:574
static std::string s()
Definition: FunctionTypes.h:136
static std::string s()
Definition: FunctionTypes.h:154
static std::string s()
Definition: FunctionTypes.h:144
FunctionBuilder & setPreferredImpl(DeclPreferrence pref)
Definition: FunctionTypes.h:1062
void setDependencies(std::vector< const char * > deps)
Definition: FunctionTypes.h:428
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:317
llvm::FunctionType * llvmFunctionTypeFromSignature(llvm::LLVMContext &C)
Generate an LLVM FunctionType from a function signature.
Definition: FunctionTypes.h:232
todo
Definition: FunctionTypes.h:792
Consolidated llvm types for most supported types.
OPENVDB_AX_API 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.
static std::string s()
Definition: FunctionTypes.h:149
uint64_t address() const override final
Returns the global address of this function.
Definition: FunctionTypes.h:637
FunctionBuilder & addReturnAttribute(const llvm::Attribute::AttrKind attr)
Definition: FunctionTypes.h:1050
const std::vector< const char * > & dependencies() const
Definition: FunctionTypes.h:427
llvm::Value * fold(const std::vector< llvm::Value * > &args, llvm::LLVMContext &C) const override final
Definition: FunctionTypes.h:651
Function(const size_t size, const std::string &symbol)
Definition: FunctionTypes.h:270
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:762
Represents a concrete IR function.
Definition: FunctionTypes.h:753
std::vector< Function::Ptr > FunctionList
Definition: FunctionTypes.h:796
const FunctionList & list() const
Accessor to the underlying function signature list.
Definition: FunctionTypes.h:857
Represents a concrete IR function with the first argument as its return type.
Definition: FunctionTypes.h:782
IRFunctionBase(const std::string &symbol, const GeneratorCb &gen, const size_t size)
Definition: FunctionTypes.h:739
FunctionBuilder & addSignature(const IRFunctionBase::GeneratorCb &cb, const char *symbol=nullptr)
Definition: FunctionTypes.h:912
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:208
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:642
FunctionBuilder & setArgumentNames(const std::vector< const char * > &names)
Definition: FunctionTypes.h:975
FunctionBuilder & addSignature(const IRFunctionBase::GeneratorCb &cb, const Signature *ptr, const char *symbol=nullptr)
Definition: FunctionTypes.h:962
OPENVDB_AX_API 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.
bool isDefault() const
Definition: FunctionTypes.h:886
bool hasParamAttribute(const size_t i, const llvm::Attribute::AttrKind &kind) const
Builder methods.
Definition: FunctionTypes.h:415
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:632
static std::string s()
Definition: FunctionTypes.h:139
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:537
Definition: FunctionTypes.h:356
static std::string s()
Definition: FunctionTypes.h:143
Constant folding support structure.
Definition: ConstantFolding.h:34
const char * argName(const size_t idx) const
Returns the descriptive name of the given argument index.
Definition: FunctionTypes.h:393
CFunction(const std::string &symbol, SignatureT *function)
Definition: FunctionTypes.h:626
static std::string s()
Definition: FunctionTypes.h:137
typename ArgT::Type ArgumentValueType
Definition: FunctionTypes.h:176
static std::string s()
Definition: FunctionTypes.h:142
ArrayType mData
Definition: FunctionTypes.h:106
IRFunction(const std::string &symbol, const GeneratorCb &gen)
Definition: FunctionTypes.h:758
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:186
Definition: Exceptions.h:13
void setConstantFold(bool on)
Definition: FunctionTypes.h:588
FunctionBuilder & setConstantFold(bool on)
Definition: FunctionTypes.h:974
Represents a concrete C function binding with the first argument as its return type.
Definition: FunctionTypes.h:771
Type to symbol conversions - these characters are used to build each functions unique signature...
Definition: FunctionTypes.h:132
Type[SIZE] ArrayType
Definition: FunctionTypes.h:105
bool hasConstantFold() const
Definition: FunctionTypes.h:589
bool hasEmbedIR() const
Definition: FunctionTypes.h:697
Definition: FunctionTypes.h:882
void setFnAttributes(const std::vector< llvm::Attribute::AttrKind > &in)
Definition: FunctionTypes.h:430
An extremely basic but native representation of a string class with SSO support. This exists to provi...
Definition: String.h:33
CFunctionSRet(const std::string &symbol, const SignatureT function)
Definition: FunctionTypes.h:774
Alias mapping between two types, a frontend type T1 and a backend type T2. This class is the intended...
Definition: Types.h:238
void setArgumentNames(std::vector< const char * > names)
Definition: FunctionTypes.h:425
FunctionBuilder & addSignature(const Signature *ptr, const char *symbol=nullptr)
Definition: FunctionTypes.h:937
Templated argument iterator which implements various small functions per argument type...
Definition: FunctionTypes.h:173
std::unique_ptr< FunctionGroup > UniquePtr
Definition: FunctionTypes.h:795
void llvmTypeToString(const llvm::Type *const type, std::string &str)
Prints an llvm type to a std string.
Definition: Utils.h:133
std::shared_ptr< FunctionGroup > Ptr
Definition: FunctionTypes.h:794
FunctionGroup(const char *name, const char *doc, const FunctionList &list)
Definition: FunctionTypes.h:798
void setParamAttributes(const size_t i, const std::vector< llvm::Attribute::AttrKind > &in)
Definition: FunctionTypes.h:438
Constant folding for C++ bindings.
const char * symbol() const
The function symbol name.
Definition: FunctionTypes.h:386
FunctionBuilder & addFunctionAttribute(const llvm::Attribute::AttrKind attr)
Definition: FunctionTypes.h:1056
const GeneratorCb mGen
Definition: FunctionTypes.h:747
Definition: FunctionTypes.h:148
Templated function traits which provides compile-time index access to the types of the function signa...
Definition: Types.h:279
T Type
Definition: FunctionTypes.h:103
Represents a concrete C function binding.
Definition: FunctionTypes.h:612
DeclPreferrence
Definition: FunctionTypes.h:878
Object to array conversion methods to allow functions to return vector types. These containers provid...
Definition: FunctionTypes.h:102
std::shared_ptr< Settings > Ptr
Definition: FunctionTypes.h:884
static std::string s()
Definition: FunctionTypes.h:140
Utility code generation methods for performing various llvm operations.
std::shared_ptr< Function > Ptr
Definition: FunctionTypes.h:268
IRFunctionSRet(const std::string &symbol, const IRFunctionBase::GeneratorCb &gen)
Definition: FunctionTypes.h:785
FunctionBuilder(const char *name)
Definition: FunctionTypes.h:905
The base/abstract representation of an AX function. Derived classes must implement the Function::type...
Definition: FunctionTypes.h:266
Definition: FunctionTypes.h:879
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition: version.h.in:121
static std::string s()
Definition: FunctionTypes.h:145
static std::string s()
Definition: FunctionTypes.h:138
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:551
void setEmbedIR(bool on)
Enable or disable the embedding of IR. Embedded IR is currently required for function which use paren...
Definition: FunctionTypes.h:696
SignatureMatch
The result type from calls to Function::match.
Definition: FunctionTypes.h:356
static void apply(const OpT &op, const bool forwards)
Definition: FunctionTypes.h:179
FunctionBuilder & setDocumentation(const char *doc)
Definition: FunctionTypes.h:1061
static std::string s()
Definition: FunctionTypes.h:134
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:692
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h.in:212
static std::string s()
Definition: FunctionTypes.h:135