@@ -107,6 +107,38 @@ pub(crate) enum SsaInstKind {
107107 input : SsaValueId ,
108108 tag : ValueType ,
109109 } ,
110+ StringLen {
111+ text : SsaValueId ,
112+ } ,
113+ BytesLen {
114+ bytes : SsaValueId ,
115+ } ,
116+ StringSlice {
117+ text : SsaValueId ,
118+ start : SsaValueId ,
119+ length : SsaValueId ,
120+ } ,
121+ BytesSlice {
122+ bytes : SsaValueId ,
123+ start : SsaValueId ,
124+ length : SsaValueId ,
125+ } ,
126+ StringGet {
127+ text : SsaValueId ,
128+ index : SsaValueId ,
129+ } ,
130+ BytesGet {
131+ bytes : SsaValueId ,
132+ index : SsaValueId ,
133+ } ,
134+ StringConcat {
135+ lhs : SsaValueId ,
136+ rhs : SsaValueId ,
137+ } ,
138+ BytesConcat {
139+ lhs : SsaValueId ,
140+ rhs : SsaValueId ,
141+ } ,
110142 ArrayLen {
111143 array : SsaValueId ,
112144 } ,
@@ -245,10 +277,25 @@ impl SsaInstKind {
245277 | Self :: UnboxFloat { input }
246278 | Self :: UnboxBool { input }
247279 | Self :: UnboxHeapPtr { input, .. }
280+ | Self :: StringLen { text : input }
281+ | Self :: BytesLen { bytes : input }
248282 | Self :: ArrayLen { array : input }
249283 | Self :: MapLen { map : input }
250284 | Self :: IntNeg { input }
251285 | Self :: FloatNeg { input } => vec ! [ * input] ,
286+ Self :: StringSlice {
287+ text,
288+ start,
289+ length,
290+ } => vec ! [ * text, * start, * length] ,
291+ Self :: BytesSlice {
292+ bytes,
293+ start,
294+ length,
295+ } => vec ! [ * bytes, * start, * length] ,
296+ Self :: StringGet { text, index } => vec ! [ * text, * index] ,
297+ Self :: BytesGet { bytes, index } => vec ! [ * bytes, * index] ,
298+ Self :: StringConcat { lhs, rhs } | Self :: BytesConcat { lhs, rhs } => vec ! [ * lhs, * rhs] ,
252299 Self :: ArrayGet { array, index } => vec ! [ * array, * index] ,
253300 Self :: ArrayHas { array, index } => vec ! [ * array, * index] ,
254301 Self :: MapGet { map, key } => vec ! [ * map, * key] ,
@@ -751,6 +798,22 @@ fn render_inst_kind(kind: &SsaInstKind) -> String {
751798 SsaInstKind :: UnboxFloat { input } => format ! ( "unbox_float {input}" ) ,
752799 SsaInstKind :: UnboxBool { input } => format ! ( "unbox_bool {input}" ) ,
753800 SsaInstKind :: UnboxHeapPtr { input, tag } => format ! ( "unbox_ptr {input}, {tag:?}" ) ,
801+ SsaInstKind :: StringLen { text } => format ! ( "string_len {text}" ) ,
802+ SsaInstKind :: BytesLen { bytes } => format ! ( "bytes_len {bytes}" ) ,
803+ SsaInstKind :: StringSlice {
804+ text,
805+ start,
806+ length,
807+ } => format ! ( "string_slice {text}, {start}, {length}" ) ,
808+ SsaInstKind :: BytesSlice {
809+ bytes,
810+ start,
811+ length,
812+ } => format ! ( "bytes_slice {bytes}, {start}, {length}" ) ,
813+ SsaInstKind :: StringGet { text, index } => format ! ( "string_get {text}, {index}" ) ,
814+ SsaInstKind :: BytesGet { bytes, index } => format ! ( "bytes_get {bytes}, {index}" ) ,
815+ SsaInstKind :: StringConcat { lhs, rhs } => format ! ( "string_concat {lhs}, {rhs}" ) ,
816+ SsaInstKind :: BytesConcat { lhs, rhs } => format ! ( "bytes_concat {lhs}, {rhs}" ) ,
754817 SsaInstKind :: ArrayLen { array } => format ! ( "array_len {array}" ) ,
755818 SsaInstKind :: ArrayGet { array, index } => format ! ( "array_get {array}, {index}" ) ,
756819 SsaInstKind :: ArrayHas { array, index } => format ! ( "array_has {array}, {index}" ) ,
0 commit comments