2016-09-25 21:29:59 +00:00
|
|
|
#ifndef HOP_H
|
|
|
|
#define HOP_H
|
|
|
|
|
2016-09-27 21:38:47 +00:00
|
|
|
enum insel_type
|
|
|
|
{
|
|
|
|
INSEL_STRING,
|
2016-10-10 21:19:46 +00:00
|
|
|
INSEL_HREG,
|
2016-10-02 21:25:54 +00:00
|
|
|
INSEL_VREG,
|
2016-09-27 21:38:47 +00:00
|
|
|
INSEL_VALUE,
|
2016-10-15 20:53:56 +00:00
|
|
|
INSEL_ST_OFFSET,
|
|
|
|
INSEL_AB_OFFSET,
|
|
|
|
INSEL_LB_OFFSET,
|
2016-09-27 21:38:47 +00:00
|
|
|
INSEL_EOI
|
|
|
|
};
|
|
|
|
|
|
|
|
struct insel
|
|
|
|
{
|
|
|
|
enum insel_type type;
|
2016-10-21 21:31:00 +00:00
|
|
|
int index;
|
2016-09-27 21:38:47 +00:00
|
|
|
union
|
|
|
|
{
|
|
|
|
const char* string;
|
2016-10-10 21:19:46 +00:00
|
|
|
struct hreg* hreg;
|
2016-10-02 21:25:54 +00:00
|
|
|
struct vreg* vreg;
|
2016-09-27 21:38:47 +00:00
|
|
|
struct ir* value;
|
2016-10-15 20:53:56 +00:00
|
|
|
int offset;
|
2016-09-27 21:38:47 +00:00
|
|
|
}
|
|
|
|
u;
|
|
|
|
};
|
|
|
|
|
2016-10-09 13:09:34 +00:00
|
|
|
struct constraint
|
|
|
|
{
|
|
|
|
uint32_t attrs;
|
2016-10-14 20:17:02 +00:00
|
|
|
struct vreg* equals_to;
|
2016-10-09 13:09:34 +00:00
|
|
|
};
|
|
|
|
|
2016-09-25 21:29:59 +00:00
|
|
|
struct hop
|
|
|
|
{
|
2016-09-27 21:38:47 +00:00
|
|
|
int id;
|
2016-10-07 22:21:23 +00:00
|
|
|
struct basicblock* bb;
|
2016-09-25 21:29:59 +00:00
|
|
|
struct ir* ir;
|
2016-10-14 23:15:08 +00:00
|
|
|
const struct burm_instruction_data* insndata;
|
2016-09-27 21:38:47 +00:00
|
|
|
ARRAYOF(struct insel) insels;
|
2016-10-02 21:25:54 +00:00
|
|
|
struct vreg* output;
|
2016-10-05 20:56:25 +00:00
|
|
|
|
2016-10-09 13:09:34 +00:00
|
|
|
PMAPOF(struct vreg, struct constraint) constraints;
|
|
|
|
|
2016-10-05 20:56:25 +00:00
|
|
|
ARRAYOF(struct vreg) ins;
|
|
|
|
ARRAYOF(struct vreg) outs;
|
2016-10-07 22:21:23 +00:00
|
|
|
ARRAYOF(struct vreg) throughs;
|
2016-10-08 21:32:54 +00:00
|
|
|
register_assignment_t regsin;
|
|
|
|
register_assignment_t regsout;
|
2016-09-25 21:29:59 +00:00
|
|
|
};
|
|
|
|
|
2016-10-07 22:21:23 +00:00
|
|
|
extern struct hop* new_hop(struct basicblock* bb, struct ir* ir);
|
2016-09-25 21:29:59 +00:00
|
|
|
|
2016-09-27 21:38:47 +00:00
|
|
|
extern void hop_add_string_insel(struct hop* hop, const char* string);
|
2016-10-21 21:31:00 +00:00
|
|
|
extern void hop_add_hreg_insel(struct hop* hop, struct hreg* hreg, int index);
|
|
|
|
extern void hop_add_vreg_insel(struct hop* hop, struct vreg* vreg, int index);
|
2016-09-27 21:38:47 +00:00
|
|
|
extern void hop_add_value_insel(struct hop* hop, struct ir* ir);
|
2016-10-15 20:53:56 +00:00
|
|
|
extern void hop_add_st_offset_insel(struct hop* hop, struct hreg* hreg);
|
|
|
|
extern void hop_add_ab_offset_insel(struct hop* hop, int offset);
|
|
|
|
extern void hop_add_lb_offset_insel(struct hop* hop, int offset);
|
2016-09-27 21:38:47 +00:00
|
|
|
extern void hop_add_eoi_insel(struct hop* hop);
|
|
|
|
|
2016-10-15 16:38:46 +00:00
|
|
|
extern void hop_add_insel(struct hop* hop, const char* fmt, ...);
|
|
|
|
|
2016-10-10 22:12:11 +00:00
|
|
|
extern char* hop_render(struct hop* hop);
|
2016-09-26 22:19:45 +00:00
|
|
|
extern void hop_print(char k, struct hop* hop);
|
2016-09-25 21:29:59 +00:00
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2016-10-05 19:07:29 +00:00
|
|
|
/* vim: set sw=4 ts=4 expandtab : */
|
|
|
|
|