mie: add stub memref dialect
This commit is contained in:
10
mie/dialect/memref/memref.c
Normal file
10
mie/dialect/memref/memref.c
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
#include <mie/dialect/dialect.h>
|
||||||
|
#include <mie/dialect/memref.h>
|
||||||
|
#include <mie/macros.h>
|
||||||
|
#include <mie/print/printer.h>
|
||||||
|
#include <mie/type/type-definition.h>
|
||||||
|
#include <mie/type/type.h>
|
||||||
|
|
||||||
|
MIE_DIALECT_BEGIN(mie_memref, struct mie_dialect, "memref")
|
||||||
|
MIE_DIALECT_ADD_TYPE(mie_memref_memref);
|
||||||
|
MIE_DIALECT_END()
|
||||||
52
mie/dialect/memref/type/memref.c
Normal file
52
mie/dialect/memref/type/memref.c
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
#include <mie/dialect/dialect.h>
|
||||||
|
#include <mie/dialect/memref.h>
|
||||||
|
#include <mie/macros.h>
|
||||||
|
#include <mie/print/printer.h>
|
||||||
|
#include <mie/type/type-definition.h>
|
||||||
|
#include <mie/type/type.h>
|
||||||
|
|
||||||
|
enum memref_rank_type {
|
||||||
|
MEMREF_RANK_UNKNOWN = 0,
|
||||||
|
MEMREF_RANK_STATIC,
|
||||||
|
MEMREF_RANK_TYPE,
|
||||||
|
};
|
||||||
|
|
||||||
|
struct memref_rank {
|
||||||
|
enum memref_rank_type r_ranktype;
|
||||||
|
union {
|
||||||
|
size_t r_static;
|
||||||
|
const struct mie_type *r_type;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
struct memref_type {
|
||||||
|
struct mie_type m_base;
|
||||||
|
MIE_VECTOR_DECLARE(struct memref_rank, m_rank);
|
||||||
|
};
|
||||||
|
|
||||||
|
static void type_init(
|
||||||
|
const struct mie_type_definition *type_info, struct mie_type *type)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static enum mie_status print(const struct mie_type *ty, struct mie_printer *out)
|
||||||
|
{
|
||||||
|
b_stream_write_string(
|
||||||
|
out->p_stream,
|
||||||
|
(out->p_flags & MIE_PRINT_F_ABBREVIATED) ? "memref" : "memref.memref",
|
||||||
|
NULL);
|
||||||
|
return MIE_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
static enum mie_status parse(struct mie_parser *parser, const struct mie_type **out)
|
||||||
|
{
|
||||||
|
printf("Parse memref!\n");
|
||||||
|
|
||||||
|
return MIE_ERR_BAD_FORMAT;
|
||||||
|
}
|
||||||
|
|
||||||
|
MIE_TYPE_DEFINITION_BEGIN(mie_memref_memref, "memref")
|
||||||
|
MIE_TYPE_DEFINITION_INIT(type_init);
|
||||||
|
MIE_TYPE_DEFINITION_PRINT(print);
|
||||||
|
MIE_TYPE_DEFINITION_PARSE(parse);
|
||||||
|
MIE_TYPE_DEFINITION_END()
|
||||||
Reference in New Issue
Block a user