4 #ifndef OPENVDB_AX_CODEGEN_CODECS_HAS_BEEN_INCLUDED 5 #define OPENVDB_AX_CODEGEN_CODECS_HAS_BEEN_INCLUDED 8 #include <openvdb/version.h> 23 using CodecTypeMap = std::map<const ast::tokens::CoreType, CodecNameMap>;
24 using Codecs = std::vector<const Codec*>;
47 : mEncoder(
std::move(encoder))
48 , mDecoder(
std::move(decoder))
53 OPENVDB_ASSERT(mEncoder->list().size() == mDecoder->list().size());
54 for ([[maybe_unused]]
const auto& F : mEncoder->list()) {
74 llvm::Type* ret = findReturnTypeFromArg(this->encoder(), type->getPointerTo());
75 return ret ? ret->getPointerElementType() :
nullptr;
90 if (!in->isPointerTy()) in = in->getPointerTo();
91 llvm::Type* ret = findReturnTypeFromArg(this->decoder(), in);
92 return ret ? ret->getPointerElementType() :
nullptr;
97 inline uint32_t
flag()
const {
return mFlag; }
104 const uint32_t mFlag;
113 #endif // OPENVDB_AX_CODEGEN_CODECS_HAS_BEEN_INCLUDED 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:24
std::unique_ptr< FunctionGroup > UniquePtr
Definition: FunctionTypes.h:796
uint32_t flag() const
Definition: Codecs.h:97
Contains frameworks for creating custom AX functions which can be registered within the FunctionRegis...
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:65
std::unique_ptr< Codec > UniquePtr
Definition: Codecs.h:42
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...
#define OPENVDB_ASSERT(X)
Definition: Assert.h:41
Codec(codegen::FunctionGroup::UniquePtr encoder, codegen::FunctionGroup::UniquePtr decoder, uint32_t flag)
Definition: Codecs.h:44
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.
CoreType
Definition: Tokens.h:31
Definition: Exceptions.h:13
todo
Definition: FunctionTypes.h:793
const codegen::FunctionGroup * encoder() const
Definition: Codecs.h:95
std::map< const std::string, const Codec * > CodecNameMap
Definition: Codecs.h:22
Various function and operator tokens used throughout the AST and code generation. ...
std::map< const ast::tokens::CoreType, CodecNameMap > CodecTypeMap
Definition: Codecs.h:23
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition: version.h.in:121
OPENVDB_AX_API const CodecTypeMap & getCodecTypeMap()
Get the global codec map.
const codegen::FunctionGroup * decoder() const
Definition: Codecs.h:96
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h.in:218
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:85