mie: select: add support for target-specific nodes and lowering operations
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#include "builder.h"
|
||||
|
||||
#include <blue/core/stringstream.h>
|
||||
#include <mie/select/graph.h>
|
||||
#include <mie/select/node.h>
|
||||
#include <mie/select/opcode.h>
|
||||
@@ -129,6 +130,43 @@ void mie_select_node_get_uses(
|
||||
{
|
||||
}
|
||||
|
||||
enum mie_status mie_select_node_get_value(
|
||||
struct mie_select_node *node, struct mie_type *type, size_t index,
|
||||
struct mie_select_value *out)
|
||||
{
|
||||
for (size_t i = 0; i < node->n_nr_results; i++) {
|
||||
if (!mie_type_compare(node->n_results[i], type)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (index > 0) {
|
||||
index--;
|
||||
continue;
|
||||
}
|
||||
|
||||
out->v_node = node;
|
||||
out->v_index = i;
|
||||
return MIE_SUCCESS;
|
||||
}
|
||||
|
||||
memset(out, 0x0, sizeof *out);
|
||||
return MIE_ERR_NO_ENTRY;
|
||||
}
|
||||
|
||||
enum mie_status mie_select_node_set_description(
|
||||
struct mie_select_node *node, const char *format, ...)
|
||||
{
|
||||
va_list arg;
|
||||
va_start(arg, format);
|
||||
b_stringstream str;
|
||||
b_stringstream_begin_dynamic(&str);
|
||||
b_stringstream_addvf(&str, format, arg);
|
||||
va_end(arg);
|
||||
|
||||
node->n_description = b_stringstream_end(&str);
|
||||
return node->n_description ? MIE_SUCCESS : MIE_ERR_NO_MEMORY;
|
||||
}
|
||||
|
||||
struct mie_select_node *mie_select_node_get_glued_node(struct mie_select_node *node)
|
||||
{
|
||||
return NULL;
|
||||
|
||||
Reference in New Issue
Block a user