@@ -38,14 +38,6 @@ def SDT_RISCVSelectCC : SDTypeProfile<1, 5, [SDTCisSameAs<1, 2>,
38
38
def SDT_RISCVBrCC : SDTypeProfile<0, 4, [SDTCisSameAs<0, 1>,
39
39
SDTCisVT<2, OtherVT>,
40
40
SDTCisVT<3, OtherVT>]>;
41
- def SDT_RISCVReadCSR : SDTypeProfile<1, 1, [SDTCisInt<0>, SDTCisInt<1>]>;
42
- def SDT_RISCVWriteCSR : SDTypeProfile<0, 2, [SDTCisInt<0>, SDTCisInt<1>]>;
43
- def SDT_RISCVSwapCSR : SDTypeProfile<1, 2, [SDTCisInt<0>, SDTCisInt<1>,
44
- SDTCisInt<2>]>;
45
- def SDT_RISCVReadCounterWide : SDTypeProfile<2, 2, [SDTCisVT<0, i32>,
46
- SDTCisVT<1, i32>,
47
- SDTCisInt<2>,
48
- SDTCisInt<3>]>;
49
41
def SDT_RISCVIntUnaryOpW : SDTypeProfile<1, 1, [
50
42
SDTCisSameAs<0, 1>, SDTCisVT<0, i64>
51
43
]>;
@@ -62,13 +54,21 @@ def callseq_start : SDNode<"ISD::CALLSEQ_START", SDT_CallSeqStart,
62
54
def callseq_end : SDNode<"ISD::CALLSEQ_END", SDT_CallSeqEnd,
63
55
[SDNPHasChain, SDNPOptInGlue, SDNPOutGlue]>;
64
56
65
- // Target-dependent nodes.
66
57
def riscv_call : RVSDNode<"CALL", SDT_RISCVCall,
67
58
[SDNPHasChain, SDNPOptInGlue, SDNPOutGlue,
68
59
SDNPVariadic]>;
60
+ def riscv_tail : RVSDNode<"TAIL", SDT_RISCVCall,
61
+ [SDNPHasChain, SDNPOptInGlue, SDNPOutGlue,
62
+ SDNPVariadic]>;
63
+
64
+ // Software guarded calls for large code model
69
65
def riscv_sw_guarded_call : RVSDNode<"SW_GUARDED_CALL", SDT_RISCVCall,
70
66
[SDNPHasChain, SDNPOptInGlue, SDNPOutGlue,
71
67
SDNPVariadic]>;
68
+ def riscv_sw_guarded_tail : RVSDNode<"SW_GUARDED_TAIL", SDT_RISCVCall,
69
+ [SDNPHasChain, SDNPOptInGlue, SDNPOutGlue,
70
+ SDNPVariadic]>;
71
+
72
72
def riscv_ret_glue : RVSDNode<"RET_GLUE", SDTNone,
73
73
[SDNPHasChain, SDNPOptInGlue, SDNPVariadic]>;
74
74
def riscv_sret_glue : RVSDNode<"SRET_GLUE", SDTNone,
@@ -77,40 +77,78 @@ def riscv_mret_glue : RVSDNode<"MRET_GLUE", SDTNone,
77
77
[SDNPHasChain, SDNPOptInGlue]>;
78
78
def riscv_mileaveret_glue : RVSDNode<"QC_C_MILEAVERET_GLUE", SDTNone,
79
79
[SDNPHasChain, SDNPOptInGlue]>;
80
+
81
+ // Select with condition operator - This selects between a true value and
82
+ // a false value (ops #3 and #4) based on the boolean result of comparing
83
+ // the lhs and rhs (ops #0 and #1) of a conditional expression with the
84
+ // condition code in op #2, a XLenVT constant from the ISD::CondCode enum.
85
+ // The lhs and rhs are XLenVT integers. The true and false values can be
86
+ // integer or floating point.
80
87
def riscv_selectcc : RVSDNode<"SELECT_CC", SDT_RISCVSelectCC>;
81
88
def riscv_brcc : RVSDNode<"BR_CC", SDT_RISCVBrCC,
82
89
[SDNPHasChain]>;
83
- def riscv_tail : RVSDNode<"TAIL", SDT_RISCVCall,
84
- [SDNPHasChain, SDNPOptInGlue, SDNPOutGlue,
85
- SDNPVariadic]>;
86
- def riscv_sw_guarded_tail : RVSDNode<"SW_GUARDED_TAIL", SDT_RISCVCall,
87
- [SDNPHasChain, SDNPOptInGlue, SDNPOutGlue,
88
- SDNPVariadic]>;
90
+
91
+ // Software guarded BRIND node. Operand is the target address.
89
92
def riscv_sw_guarded_brind : RVSDNode<"SW_GUARDED_BRIND",
90
93
SDTBrind, [SDNPHasChain]>;
94
+
95
+ // RV64I shifts, directly matching the semantics of the named RISC-V
96
+ // instructions.
91
97
def riscv_sllw : RVSDNode<"SLLW", SDT_RISCVIntBinOpW>;
92
98
def riscv_sraw : RVSDNode<"SRAW", SDT_RISCVIntBinOpW>;
93
99
def riscv_srlw : RVSDNode<"SRLW", SDT_RISCVIntBinOpW>;
94
- def riscv_read_csr : RVSDNode<"READ_CSR", SDT_RISCVReadCSR,
100
+
101
+ // Reads value of CSR. The first operand is the address of the required CSR.
102
+ // The result is the read value.
103
+ def riscv_read_csr : RVSDNode<"READ_CSR",
104
+ SDTypeProfile<1, 1, [SDTCisInt<0>,
105
+ SDTCisInt<1>]>,
95
106
[SDNPHasChain]>;
96
- def riscv_write_csr : RVSDNode<"WRITE_CSR", SDT_RISCVWriteCSR,
107
+ // Write value to CSR. The first operand is the address of the required CSR,
108
+ // the second is the value to write.
109
+ def riscv_write_csr : RVSDNode<"WRITE_CSR",
110
+ SDTypeProfile<0, 2, [SDTCisInt<0>,
111
+ SDTCisInt<1>]>,
97
112
[SDNPHasChain]>;
98
- def riscv_swap_csr : RVSDNode<"SWAP_CSR", SDT_RISCVSwapCSR,
113
+
114
+ // Read and write value of CSR. The first operand is the address of the
115
+ // required CSR, the second is the value to write, and the result is the
116
+ // read value (before modification).
117
+ def riscv_swap_csr : RVSDNode<"SWAP_CSR",
118
+ SDTypeProfile<1, 2, [SDTCisInt<0>,
119
+ SDTCisInt<1>,
120
+ SDTCisInt<2>]>,
99
121
[SDNPHasChain]>;
100
122
123
+ // A read of the 64-bit counter CSR on a 32-bit target (returns (Lo, Hi)).
124
+ // It takes a chain operand and another two target constant operands (the
125
+ // CSR numbers of the low and high parts of the counter).
101
126
def riscv_read_counter_wide : RVSDNode<"READ_COUNTER_WIDE",
102
- SDT_RISCVReadCounterWide,
127
+ SDTypeProfile<2, 2, [SDTCisVT<0, i32>,
128
+ SDTCisVT<1, i32>,
129
+ SDTCisInt<2>,
130
+ SDTCisInt<3>]>,
103
131
[SDNPHasChain, SDNPSideEffect]>;
104
132
133
+ // Add the Lo 12 bits from an address. Selected to ADDI.
105
134
def riscv_add_lo : RVSDNode<"ADD_LO", SDTIntBinOp>;
135
+
136
+ // Get the Hi 20 bits from an address. Selected to LUI.
106
137
def riscv_hi : RVSDNode<"HI", SDTIntUnaryOp>;
138
+
139
+ // Represents an AUIPC+ADDI pair. Selected to PseudoLLA.
107
140
def riscv_lla : RVSDNode<"LLA", SDTIntUnaryOp>;
141
+
142
+ // Selected as PseudoAddTPRel. Used to emit a TP-relative relocation.
108
143
def riscv_add_tprel : RVSDNode<"ADD_TPREL",
109
144
SDTypeProfile<1, 3, [SDTCisSameAs<0, 1>,
110
145
SDTCisSameAs<0, 2>,
111
146
SDTCisSameAs<0, 3>,
112
147
SDTCisInt<0>]>>;
113
148
149
+ // To avoid stack clash, allocation is performed by block and each block is
150
+ // probed.
151
+ // FIXME: The Type Profile here is incorrect.
114
152
def riscv_probed_alloca : RVSDNode<"PROBED_ALLOCA",
115
153
SDTypeProfile<1, 1, [SDTCisSameAs<0, 1>,
116
154
SDTCisVT<0, i32>]>,
0 commit comments