4 #ifndef OPENVDB_AX_CODEGEN_CODECS_HAS_BEEN_INCLUDED 5 #define OPENVDB_AX_CODEGEN_CODECS_HAS_BEEN_INCLUDED 8 #include <openvdb/version.h> 22 using CodecTypeMap = std::map<const ast::tokens::CoreType, CodecNameMap>;
23 using Codecs = std::vector<const Codec*>;
46 : mEncoder(
std::move(encoder))
47 , mDecoder(
std::move(decoder))
50 assert(!mEncoder->list().empty());
51 assert(!mDecoder->list().empty());
52 assert(mEncoder->list().size() == mDecoder->list().size());
53 for (
const auto& F : mEncoder->list()) {
54 assert(F->size() == 1 || F->size() == 2);
73 llvm::Type* ret = findReturnTypeFromArg(this->encoder(), type->getPointerTo());
74 return ret ? ret->getPointerElementType() :
nullptr;
89 if (!in->isPointerTy()) in = in->getPointerTo();
90 llvm::Type* ret = findReturnTypeFromArg(this->decoder(), in);
91 return ret ? ret->getPointerElementType() :
nullptr;
96 inline uint32_t
flag()
const {
return mFlag; }
103 const uint32_t mFlag;
112 #endif // OPENVDB_AX_CODEGEN_CODECS_HAS_BEEN_INCLUDED llvm::Type * encodedToDecoded(llvm::Type *in) const
Given a llvm type, return a compatible llvm type which represents how the provided type should be exp...
Definition: Codecs.h:84
const codegen::FunctionGroup * decoder() const
Definition: Codecs.h:95
CoreType
Definition: Tokens.h:31
OPENVDB_AX_API const Codec * getCodec(const ast::tokens::CoreType type, const std::string &name)
Get a specific codec. Returns a nullptr if no codec exists.
OPENVDB_AX_API const CodecNameMap * getTypeSupportedCodecs(const ast::tokens::CoreType type)
Get a specific set of codecs which encode a given type. Returns a nullptr if no codec exists...
std::map< const ast::tokens::CoreType, CodecNameMap > CodecTypeMap
Definition: Codecs.h:22
todo
Definition: FunctionTypes.h:792
Contains frameworks for creating custom AX functions which can be registered within the FunctionRegis...
uint32_t flag() const
Definition: Codecs.h:96
OPENVDB_AX_API const CodecTypeMap & getCodecTypeMap()
Get the global codec map.
std::unique_ptr< Codec > UniquePtr
Definition: Codecs.h:41
llvm::Type * decodedToEncoded(const ast::tokens::CoreType &in, llvm::LLVMContext &C) const
Given a core type supported by the AX frontend, return a llvm compatible type which represents how th...
Definition: Codecs.h:64
Codec(codegen::FunctionGroup::UniquePtr encoder, codegen::FunctionGroup::UniquePtr decoder, uint32_t flag)
Definition: Codecs.h:43
std::map< const std::string, const Codec * > CodecNameMap
Definition: Codecs.h:21
Definition: Exceptions.h:13
std::unique_ptr< FunctionGroup > UniquePtr
Definition: FunctionTypes.h:795
const codegen::FunctionGroup * encoder() const
Definition: Codecs.h:94
Various function and operator tokens used throughout the AST and code generation. ...
OPENVDB_AX_API llvm::Type * llvmTypeFromToken(const ast::tokens::CoreType &type, llvm::LLVMContext &C)
Returns an llvm type representing a type defined by a string.
std::vector< const Codec * > Codecs
Definition: Codecs.h:23
#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:212