@@ -68,8 +68,14 @@ pub enum Instruction {
6868 UserCall { dest : Reg , start : Reg , end : Reg , name : NonLocal } ,
6969 IndirectCall { dest : Reg , start : Reg , end : Reg , name : Arg , ty : ArgTy } ,
7070 Jump { to : Label } ,
71- Return { arg : Arg , ty : ArgTy } ,
7271 Branch { then_label : Label , else_label : Label , condition : Reg } ,
72+
73+ // Traps
74+ Exit { arg : Arg , ty : ArgTy } ,
75+ Return { arg : Arg , ty : ArgTy } ,
76+ ReturnUnassigned ,
77+ Next ,
78+ NextFile ,
7379}
7480
7581const _: ( ) = const { assert ! ( size_of:: <Instruction >( ) <= size_of:: <u128 >( ) ) } ;
@@ -187,7 +193,7 @@ impl Display for Instruction {
187193 Self :: Jump { to } => {
188194 write ! ( f, "{op} {to}" )
189195 }
190- Self :: Return { arg, ty } => {
196+ Self :: Return { arg, ty } | Self :: Exit { arg , ty } => {
191197 write ! ( f, "{op}" ) ?;
192198 fmt_arg ( f, arg, ty, " " )
193199 }
@@ -208,6 +214,9 @@ impl Display for Instruction {
208214 Self :: UserCall { dest, start, end, name } => {
209215 write ! ( f, "{dest} <- {op} {name}, {start}..{end}" )
210216 }
217+ Self :: Next | Self :: NextFile | Self :: ReturnUnassigned => {
218+ write ! ( f, "{op}" )
219+ }
211220 }
212221 }
213222}
@@ -244,8 +253,11 @@ impl Instruction {
244253 Self :: IndirectCall { .. } => "vcall" ,
245254 Self :: OutputCall { .. } => "out" ,
246255 Self :: Jump { .. } => "jmp" ,
247- Self :: Return { .. } => "ret" ,
256+ Self :: Return { .. } | Self :: ReturnUnassigned => "ret" ,
248257 Self :: Branch { .. } => "brif" ,
258+ Self :: Exit { .. } => "exit" ,
259+ Self :: Next => "next" ,
260+ Self :: NextFile => "nextf" ,
249261 }
250262 }
251263}
0 commit comments