Files
ivy/mie/include/mie/ir/block.h

31 lines
842 B
C

#ifndef MIE_BLOCK_H_
#define MIE_BLOCK_H_
#define MIE_BLOCK(p) ((struct mie_block *)(p))
#include <mie/ir/value.h>
struct mie_block {
struct mie_value b_base;
struct mie_func *b_parent;
/* the phi instruction(s). these must appear at the start of the block
* and are separated to make traversing the CFG easier */
b_queue b_phi;
/* the rest of the instructions in the block */
b_queue b_instr;
/* the instruction that transfers control to the next block,
* could be a switch, branch, or ret */
struct mie_instr *b_terminator;
};
MIE_API struct mie_block *mie_block_create(
struct mie_func *parent, const char *name);
MIE_API bool mie_block_add_instr(struct mie_block *block, struct mie_instr *instr);
static inline bool mie_block_is_terminated(const struct mie_block *block)
{
return block->b_terminator != NULL;
}
#endif