aboutsummaryrefslogtreecommitdiff
path: root/handwritten_support/hgen/pretty_xml.hgen
blob: be080cd3da48b45464ca0cacb2f31d7419565325 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
| `RISCVThreadStart -> ("op_thread_start", [])

| `RISCVStopFetching -> ("op_stop_fetching", [])

| `RISCVUTYPE(imm, rd, op) ->
    ("op_U_type",
      [ ("op",   pp_riscv_uop op);
        ("uimm", sprintf "%d" imm);
        ("dest", pp_reg rd);
      ])

| `RISCVJAL(imm, rd) ->
    ("op_jal",
      [ ("offset", sprintf "%d" imm);
        ("dest",   pp_reg rd);
      ])

| `RISCVJALR(imm, rs1, rd) ->
    ("op_jalr",
      [ ("offset", sprintf "%d" imm);
        ("base",   pp_reg rs1);
        ("dest",   pp_reg rd);
      ])

| `RISCVBType(imm, rs2, rs1, op) ->
    ("op_branch",
      [ ("op",     pp_riscv_bop op);
        ("offset", sprintf "%d" imm);
        ("src2",   pp_reg rs2);
        ("src1",   pp_reg rs1);
      ])

| `RISCVIType(imm, rs1, rd, op) ->
    ("op_I_type",
      [ ("op",   pp_riscv_iop op);
        ("iimm", sprintf "%d" imm);
        ("src",  pp_reg rs1);
        ("dest", pp_reg rd);
      ])

| `RISCVShiftIop(imm, rs1, rd, op) ->
    ("op_IS_type",
      [ ("op",     pp_riscv_sop op);
        ("shamt",  sprintf "%d" imm);
        ("src",    pp_reg rs1);
        ("dest",   pp_reg rd);
      ])

| `RISCVSHIFTW(imm, rs1, rd, op) ->
    ("op_ISW_type",
      [ ("op",    pp_riscv_sop op);
        ("shamt", sprintf "%d" imm);
        ("src",   pp_reg rs1);
        ("dest",  pp_reg rd);
      ])

| `RISCVRType (rs2, rs1, rd, op) ->
    ("op_R_type",
      [ ("op",   pp_riscv_rop op);
        ("src2", pp_reg rs2);
        ("src1", pp_reg rs1);
        ("dest", pp_reg rd);
      ])

| `RISCVLoad(imm, rs1, rd, unsigned, width, aq, rl) ->
    ("op_load",
      [ ("aq",       if aq then "true" else "false");
        ("rl",       if rl then "true" else "false");
        ("width",    pp_word_width width);
        ("unsigned", if unsigned then "true" else "false");
        ("base",     pp_reg rs1);
        ("offset",   sprintf "%d" imm);
        ("dest",     pp_reg rd);
      ])

| `RISCVStore(imm, rs2, rs1, width, aq, rl) ->
    ("op_store",
      [ ("aq",       if aq then "true" else "false");
        ("rl",       if rl then "true" else "false");
        ("width",    pp_word_width width);
        ("src",      pp_reg rs2);
        ("base",     pp_reg rs1);
        ("offset",   sprintf "%d" imm);
      ])

| `RISCVADDIW(imm, rs1, rd) ->
    ("op_addiw",
      [ ("iimm",  sprintf "%d" imm);
        ("src",   pp_reg rs1);
        ("dest",  pp_reg rd);
      ])

| `RISCVRTYPEW(rs2, rs1, rd, op) ->
    ("op_RW_type",
      [ ("op",   pp_riscv_ropw op);
        ("src2", pp_reg rs2);
        ("src1", pp_reg rs1);
        ("dest", pp_reg rd);
      ])

| `RISCVFENCE(pred, succ) ->
    ("op_fence",
      [ ("pred", pp_riscv_fence_option pred);
        ("succ", pp_riscv_fence_option succ);
      ])

| `RISCVFENCE_TSO(pred, succ) ->
    ("op_fence_tso",
      [ ("pred", pp_riscv_fence_option pred);
        ("succ", pp_riscv_fence_option succ);
      ])

| `RISCVFENCEI -> ("op_fence_i", [])

| `RISCVLoadRes(aq, rl, rs1, width, rd) ->
    ("op_lr",
      [ ("aq",    if aq then "true" else "false");
        ("rl",    if rl then "true" else "false");
        ("width", pp_word_width width);
        ("addr",  pp_reg rs1);
        ("dest",  pp_reg rd);
      ])

| `RISCVStoreCon(aq, rl, rs2, rs1, width, rd) ->
    ("op_sc",
      [ ("aq",    if aq then "true" else "false");
        ("rl",    if rl then "true" else "false");
        ("width", pp_word_width width);
        ("addr",  pp_reg rs1);
        ("src",   pp_reg rs2);
        ("dest",  pp_reg rd);
      ])

| `RISCVAMO(op, aq, rl, rs2, rs1, width, rd) ->
    ("op_amo",
      [ ("op",    pp_riscv_amo_op_part op);
        ("aq",    if aq then "true" else "false");
        ("rl",    if rl then "true" else "false");
        ("width", pp_word_width width);
        ("src",   pp_reg rs2);
        ("addr",  pp_reg rs1);
        ("dest",  pp_reg rd);
      ])