xref: /freebsd/contrib/llvm-project/llvm/lib/Target/X86/X86InstrControl.td (revision 02e9120893770924227138ba49df1edb3896112a)
1//===-- X86InstrControl.td - Control Flow Instructions -----*- tablegen -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file describes the X86 jump, return, call, and related instructions.
10//
11//===----------------------------------------------------------------------===//
12
13//===----------------------------------------------------------------------===//
14//  Control Flow Instructions.
15//
16
17// Return instructions.
18//
19// The X86retglue return instructions are variadic because we may add ST0 and
20// ST1 arguments when returning values on the x87 stack.
21let isTerminator = 1, isReturn = 1, isBarrier = 1,
22    hasCtrlDep = 1, FPForm = SpecialFP, SchedRW = [WriteJumpLd] in {
23  def RET32  : I   <0xC3, RawFrm, (outs), (ins variable_ops),
24                    "ret{l}", []>, OpSize32, Requires<[Not64BitMode]>;
25  def RET64  : I   <0xC3, RawFrm, (outs), (ins variable_ops),
26                    "ret{q}", []>, OpSize32, Requires<[In64BitMode]>;
27  def RET16  : I   <0xC3, RawFrm, (outs), (ins),
28                    "ret{w}", []>, OpSize16;
29  def RETI32 : Ii16<0xC2, RawFrm, (outs), (ins i16imm:$amt, variable_ops),
30                    "ret{l}\t$amt", []>, OpSize32, Requires<[Not64BitMode]>;
31  def RETI64 : Ii16<0xC2, RawFrm, (outs), (ins i16imm:$amt, variable_ops),
32                    "ret{q}\t$amt", []>, OpSize32, Requires<[In64BitMode]>;
33  def RETI16 : Ii16<0xC2, RawFrm, (outs), (ins i16imm:$amt),
34                    "ret{w}\t$amt", []>, OpSize16;
35  def LRET32 : I   <0xCB, RawFrm, (outs), (ins),
36                    "{l}ret{l|f}", []>, OpSize32;
37  def LRET64 : RI  <0xCB, RawFrm, (outs), (ins),
38                    "{l}ret{|f}q", []>, Requires<[In64BitMode]>;
39  def LRET16 : I   <0xCB, RawFrm, (outs), (ins),
40                    "{l}ret{w|f}", []>, OpSize16;
41  def LRETI32 : Ii16<0xCA, RawFrm, (outs), (ins i16imm:$amt),
42                     "{l}ret{l|f}\t$amt", []>, OpSize32;
43  def LRETI64 : RIi16<0xCA, RawFrm, (outs), (ins i16imm:$amt),
44                      "{l}ret{|f}q\t$amt", []>, Requires<[In64BitMode]>;
45  def LRETI16 : Ii16<0xCA, RawFrm, (outs), (ins i16imm:$amt),
46                     "{l}ret{w|f}\t$amt", []>, OpSize16;
47
48  // The machine return from interrupt instruction, but sometimes we need to
49  // perform a post-epilogue stack adjustment. Codegen emits the pseudo form
50  // which expands to include an SP adjustment if necessary.
51  def IRET16 : I   <0xcf, RawFrm, (outs), (ins), "iret{w}", []>,
52               OpSize16;
53  def IRET32 : I   <0xcf, RawFrm, (outs), (ins), "iret{l|d}", []>, OpSize32;
54  def IRET64 : RI  <0xcf, RawFrm, (outs), (ins), "iretq", []>, Requires<[In64BitMode]>;
55  let isCodeGenOnly = 1 in
56  def IRET : PseudoI<(outs), (ins i32imm:$adj), [(X86iret timm:$adj)]>;
57  def RET  : PseudoI<(outs), (ins i32imm:$adj, variable_ops), [(X86retglue timm:$adj)]>;
58}
59
60// Unconditional branches.
61let isBarrier = 1, isBranch = 1, isTerminator = 1, SchedRW = [WriteJump] in {
62  def JMP_1 : Ii8PCRel<0xEB, RawFrm, (outs), (ins brtarget8:$dst),
63                       "jmp\t$dst", [(br bb:$dst)]>;
64  let hasSideEffects = 0, isCodeGenOnly = 1, ForceDisassemble = 1 in {
65    def JMP_2 : Ii16PCRel<0xE9, RawFrm, (outs), (ins brtarget16:$dst),
66                          "jmp\t$dst", []>, OpSize16;
67    def JMP_4 : Ii32PCRel<0xE9, RawFrm, (outs), (ins brtarget32:$dst),
68                          "jmp\t$dst", []>, OpSize32;
69  }
70}
71
72// Conditional Branches.
73let isBranch = 1, isTerminator = 1, Uses = [EFLAGS], SchedRW = [WriteJump],
74    isCodeGenOnly = 1, ForceDisassemble = 1 in {
75  def JCC_1 : Ii8PCRel <0x70, AddCCFrm, (outs),
76                        (ins brtarget8:$dst, ccode:$cond),
77                        "j${cond}\t$dst",
78                        [(X86brcond bb:$dst, timm:$cond, EFLAGS)]>;
79  let hasSideEffects = 0 in {
80    def JCC_2 : Ii16PCRel<0x80, AddCCFrm, (outs),
81                          (ins brtarget16:$dst, ccode:$cond),
82                          "j${cond}\t$dst",
83                          []>, OpSize16, TB;
84    def JCC_4 : Ii32PCRel<0x80, AddCCFrm, (outs),
85                          (ins brtarget32:$dst, ccode:$cond),
86                          "j${cond}\t$dst",
87                          []>, TB, OpSize32;
88  }
89}
90
91// jcx/jecx/jrcx instructions.
92let isBranch = 1, isTerminator = 1, hasSideEffects = 0, SchedRW = [WriteJump] in {
93  // These are the 32-bit versions of this instruction for the asmparser.  In
94  // 32-bit mode, the address size prefix is jcxz and the unprefixed version is
95  // jecxz.
96  let Uses = [CX] in
97    def JCXZ : Ii8PCRel<0xE3, RawFrm, (outs), (ins brtarget8:$dst),
98                        "jcxz\t$dst", []>, AdSize16, Requires<[Not64BitMode]>;
99  let Uses = [ECX] in
100    def JECXZ : Ii8PCRel<0xE3, RawFrm, (outs), (ins brtarget8:$dst),
101                        "jecxz\t$dst", []>, AdSize32;
102
103  let Uses = [RCX] in
104    def JRCXZ : Ii8PCRel<0xE3, RawFrm, (outs), (ins brtarget8:$dst),
105                         "jrcxz\t$dst", []>, AdSize64, Requires<[In64BitMode]>;
106}
107
108// Indirect branches
109let isBranch = 1, isTerminator = 1, isBarrier = 1, isIndirectBranch = 1 in {
110  def JMP16r     : I<0xFF, MRM4r, (outs), (ins GR16:$dst), "jmp{w}\t{*}$dst",
111                     [(brind GR16:$dst)]>, Requires<[Not64BitMode]>,
112                     OpSize16, Sched<[WriteJump]>;
113  def JMP16m     : I<0xFF, MRM4m, (outs), (ins i16mem:$dst), "jmp{w}\t{*}$dst",
114                     [(brind (loadi16 addr:$dst))]>, Requires<[Not64BitMode]>,
115                     OpSize16, Sched<[WriteJumpLd]>;
116
117  def JMP32r     : I<0xFF, MRM4r, (outs), (ins GR32:$dst), "jmp{l}\t{*}$dst",
118                     [(brind GR32:$dst)]>, Requires<[Not64BitMode]>,
119                     OpSize32, Sched<[WriteJump]>;
120  def JMP32m     : I<0xFF, MRM4m, (outs), (ins i32mem:$dst), "jmp{l}\t{*}$dst",
121                     [(brind (loadi32 addr:$dst))]>, Requires<[Not64BitMode]>,
122                     OpSize32, Sched<[WriteJumpLd]>;
123
124  def JMP64r     : I<0xFF, MRM4r, (outs), (ins GR64:$dst), "jmp{q}\t{*}$dst",
125                     [(brind GR64:$dst)]>, Requires<[In64BitMode]>,
126                     Sched<[WriteJump]>;
127  def JMP64m     : I<0xFF, MRM4m, (outs), (ins i64mem:$dst), "jmp{q}\t{*}$dst",
128                     [(brind (loadi64 addr:$dst))]>, Requires<[In64BitMode]>,
129                     Sched<[WriteJumpLd]>;
130
131  // Win64 wants indirect jumps leaving the function to have a REX_W prefix.
132  // These are switched from TAILJMPr/m64_REX in MCInstLower.
133  let isCodeGenOnly = 1, hasREX_W = 1 in {
134    def JMP64r_REX : I<0xFF, MRM4r, (outs), (ins GR64:$dst),
135                       "rex64 jmp{q}\t{*}$dst", []>, Sched<[WriteJump]>;
136    let mayLoad = 1 in
137    def JMP64m_REX : I<0xFF, MRM4m, (outs), (ins i64mem:$dst),
138                       "rex64 jmp{q}\t{*}$dst", []>, Sched<[WriteJumpLd]>;
139
140  }
141
142  // Non-tracking jumps for IBT, use with caution.
143  let isCodeGenOnly = 1 in {
144    def JMP16r_NT : I<0xFF, MRM4r, (outs), (ins GR16 : $dst), "jmp{w}\t{*}$dst",
145                      [(X86NoTrackBrind GR16 : $dst)]>, Requires<[Not64BitMode]>,
146                      OpSize16, Sched<[WriteJump]>, NOTRACK;
147
148    def JMP16m_NT : I<0xFF, MRM4m, (outs), (ins i16mem : $dst), "jmp{w}\t{*}$dst",
149                      [(X86NoTrackBrind (loadi16 addr : $dst))]>,
150                      Requires<[Not64BitMode]>, OpSize16, Sched<[WriteJumpLd]>,
151                      NOTRACK;
152
153    def JMP32r_NT : I<0xFF, MRM4r, (outs), (ins GR32 : $dst), "jmp{l}\t{*}$dst",
154                      [(X86NoTrackBrind GR32 : $dst)]>, Requires<[Not64BitMode]>,
155                      OpSize32, Sched<[WriteJump]>, NOTRACK;
156    def JMP32m_NT : I<0xFF, MRM4m, (outs), (ins i32mem : $dst), "jmp{l}\t{*}$dst",
157                      [(X86NoTrackBrind (loadi32 addr : $dst))]>,
158                      Requires<[Not64BitMode]>, OpSize32, Sched<[WriteJumpLd]>,
159                      NOTRACK;
160
161    def JMP64r_NT : I<0xFF, MRM4r, (outs), (ins GR64 : $dst), "jmp{q}\t{*}$dst",
162                      [(X86NoTrackBrind GR64 : $dst)]>, Requires<[In64BitMode]>,
163                      Sched<[WriteJump]>, NOTRACK;
164    def JMP64m_NT : I<0xFF, MRM4m, (outs), (ins i64mem : $dst), "jmp{q}\t{*}$dst",
165                      [(X86NoTrackBrind(loadi64 addr : $dst))]>,
166                      Requires<[In64BitMode]>, Sched<[WriteJumpLd]>, NOTRACK;
167  }
168
169  let Predicates = [Not64BitMode], AsmVariantName = "att" in {
170    def FARJMP16i  : Iseg16<0xEA, RawFrmImm16, (outs),
171                            (ins i16imm:$off, i16imm:$seg),
172                            "ljmp{w}\t$seg, $off", []>,
173                            OpSize16, Sched<[WriteJump]>;
174    def FARJMP32i  : Iseg32<0xEA, RawFrmImm16, (outs),
175                            (ins i32imm:$off, i16imm:$seg),
176                            "ljmp{l}\t$seg, $off", []>,
177                            OpSize32, Sched<[WriteJump]>;
178  }
179  let mayLoad = 1 in {
180    def FARJMP64m  : RI<0xFF, MRM5m, (outs), (ins opaquemem:$dst),
181                        "ljmp{q}\t{*}$dst", []>, Sched<[WriteJump]>, Requires<[In64BitMode]>;
182
183    let AsmVariantName = "att" in
184    def FARJMP16m  : I<0xFF, MRM5m, (outs), (ins opaquemem:$dst),
185                       "ljmp{w}\t{*}$dst", []>, OpSize16, Sched<[WriteJumpLd]>;
186    def FARJMP32m  : I<0xFF, MRM5m, (outs), (ins opaquemem:$dst),
187                       "{l}jmp{l}\t{*}$dst", []>, OpSize32, Sched<[WriteJumpLd]>;
188  }
189}
190
191// Loop instructions
192let isBranch = 1, isTerminator = 1, SchedRW = [WriteJump] in {
193def LOOP   : Ii8PCRel<0xE2, RawFrm, (outs), (ins brtarget8:$dst), "loop\t$dst", []>;
194def LOOPE  : Ii8PCRel<0xE1, RawFrm, (outs), (ins brtarget8:$dst), "loope\t$dst", []>;
195def LOOPNE : Ii8PCRel<0xE0, RawFrm, (outs), (ins brtarget8:$dst), "loopne\t$dst", []>;
196}
197
198//===----------------------------------------------------------------------===//
199//  Call Instructions...
200//
201let isCall = 1 in
202  // All calls clobber the non-callee saved registers. ESP is marked as
203  // a use to prevent stack-pointer assignments that appear immediately
204  // before calls from potentially appearing dead. Uses for argument
205  // registers are added manually.
206  let Uses = [ESP, SSP] in {
207    def CALLpcrel32 : Ii32PCRel<0xE8, RawFrm,
208                           (outs), (ins i32imm_brtarget:$dst),
209                           "call{l}\t$dst", []>, OpSize32,
210                      Requires<[Not64BitMode]>, Sched<[WriteJump]>;
211    let hasSideEffects = 0 in
212      def CALLpcrel16 : Ii16PCRel<0xE8, RawFrm,
213                             (outs), (ins i16imm_brtarget:$dst),
214                             "call{w}\t$dst", []>, OpSize16,
215                        Requires<[Not64BitMode]>, Sched<[WriteJump]>;
216    def CALL16r     : I<0xFF, MRM2r, (outs), (ins GR16:$dst),
217                        "call{w}\t{*}$dst", [(X86call GR16:$dst)]>,
218                      OpSize16, Requires<[Not64BitMode]>, Sched<[WriteJump]>;
219    def CALL16m     : I<0xFF, MRM2m, (outs), (ins i16mem:$dst),
220                        "call{w}\t{*}$dst", [(X86call (loadi16 addr:$dst))]>,
221                        OpSize16, Requires<[Not64BitMode,FavorMemIndirectCall]>,
222                        Sched<[WriteJumpLd]>;
223    def CALL32r     : I<0xFF, MRM2r, (outs), (ins GR32:$dst),
224                        "call{l}\t{*}$dst", [(X86call GR32:$dst)]>, OpSize32,
225                        Requires<[Not64BitMode,NotUseIndirectThunkCalls]>,
226                        Sched<[WriteJump]>;
227    def CALL32m     : I<0xFF, MRM2m, (outs), (ins i32mem:$dst),
228                        "call{l}\t{*}$dst", [(X86call (loadi32 addr:$dst))]>,
229                        OpSize32,
230                        Requires<[Not64BitMode,FavorMemIndirectCall,
231                                  NotUseIndirectThunkCalls]>,
232                        Sched<[WriteJumpLd]>;
233
234    // Non-tracking calls for IBT, use with caution.
235    let isCodeGenOnly = 1 in {
236      def CALL16r_NT : I<0xFF, MRM2r, (outs), (ins GR16 : $dst),
237                        "call{w}\t{*}$dst",[(X86NoTrackCall GR16 : $dst)]>,
238                        OpSize16, Requires<[Not64BitMode]>, Sched<[WriteJump]>, NOTRACK;
239      def CALL16m_NT : I<0xFF, MRM2m, (outs), (ins i16mem : $dst),
240                        "call{w}\t{*}$dst",[(X86NoTrackCall(loadi16 addr : $dst))]>,
241                        OpSize16, Requires<[Not64BitMode,FavorMemIndirectCall]>,
242                        Sched<[WriteJumpLd]>, NOTRACK;
243      def CALL32r_NT : I<0xFF, MRM2r, (outs), (ins GR32 : $dst),
244                        "call{l}\t{*}$dst",[(X86NoTrackCall GR32 : $dst)]>,
245                        OpSize32, Requires<[Not64BitMode]>, Sched<[WriteJump]>, NOTRACK;
246      def CALL32m_NT : I<0xFF, MRM2m, (outs), (ins i32mem : $dst),
247                        "call{l}\t{*}$dst",[(X86NoTrackCall(loadi32 addr : $dst))]>,
248                        OpSize32, Requires<[Not64BitMode,FavorMemIndirectCall]>,
249                        Sched<[WriteJumpLd]>, NOTRACK;
250    }
251
252    let Predicates = [Not64BitMode], AsmVariantName = "att" in {
253      def FARCALL16i  : Iseg16<0x9A, RawFrmImm16, (outs),
254                               (ins i16imm:$off, i16imm:$seg),
255                               "lcall{w}\t$seg, $off", []>,
256                               OpSize16, Sched<[WriteJump]>;
257      def FARCALL32i  : Iseg32<0x9A, RawFrmImm16, (outs),
258                               (ins i32imm:$off, i16imm:$seg),
259                               "lcall{l}\t$seg, $off", []>,
260                               OpSize32, Sched<[WriteJump]>;
261    }
262
263    let mayLoad = 1 in {
264      def FARCALL16m  : I<0xFF, MRM3m, (outs), (ins opaquemem:$dst),
265                          "lcall{w}\t{*}$dst", []>, OpSize16, Sched<[WriteJumpLd]>;
266      def FARCALL32m  : I<0xFF, MRM3m, (outs), (ins opaquemem:$dst),
267                          "{l}call{l}\t{*}$dst", []>, OpSize32, Sched<[WriteJumpLd]>;
268    }
269  }
270
271
272// Tail call stuff.
273let isCall = 1, isTerminator = 1, isReturn = 1, isBarrier = 1,
274    isCodeGenOnly = 1, Uses = [ESP, SSP] in {
275  def TCRETURNdi : PseudoI<(outs), (ins i32imm_brtarget:$dst, i32imm:$offset),
276                           []>, Sched<[WriteJump]>;
277  def TCRETURNri : PseudoI<(outs), (ins ptr_rc_tailcall:$dst, i32imm:$offset),
278                           []>, Sched<[WriteJump]>;
279  let mayLoad = 1 in
280  def TCRETURNmi : PseudoI<(outs), (ins i32mem_TC:$dst, i32imm:$offset),
281                           []>, Sched<[WriteJumpLd]>;
282
283  def TAILJMPd : PseudoI<(outs), (ins i32imm_brtarget:$dst),
284                         []>, Sched<[WriteJump]>;
285
286  def TAILJMPr : PseudoI<(outs), (ins ptr_rc_tailcall:$dst),
287                         []>, Sched<[WriteJump]>;
288  let mayLoad = 1 in
289  def TAILJMPm : PseudoI<(outs), (ins i32mem_TC:$dst),
290                         []>, Sched<[WriteJumpLd]>;
291}
292
293// Conditional tail calls are similar to the above, but they are branches
294// rather than barriers, and they use EFLAGS.
295let isCall = 1, isTerminator = 1, isReturn = 1, isBranch = 1,
296    isCodeGenOnly = 1, SchedRW = [WriteJump] in
297  let Uses = [ESP, EFLAGS, SSP] in {
298  def TCRETURNdicc : PseudoI<(outs),
299                     (ins i32imm_brtarget:$dst, i32imm:$offset, i32imm:$cond),
300                     []>;
301
302  // This gets substituted to a conditional jump instruction in MC lowering.
303  def TAILJMPd_CC : PseudoI<(outs), (ins i32imm_brtarget:$dst, i32imm:$cond), []>;
304}
305
306
307//===----------------------------------------------------------------------===//
308//  Call Instructions...
309//
310
311// RSP is marked as a use to prevent stack-pointer assignments that appear
312// immediately before calls from potentially appearing dead. Uses for argument
313// registers are added manually.
314let isCall = 1, Uses = [RSP, SSP], SchedRW = [WriteJump] in {
315  // NOTE: this pattern doesn't match "X86call imm", because we do not know
316  // that the offset between an arbitrary immediate and the call will fit in
317  // the 32-bit pcrel field that we have.
318  def CALL64pcrel32 : Ii32PCRel<0xE8, RawFrm,
319                        (outs), (ins i64i32imm_brtarget:$dst),
320                        "call{q}\t$dst", []>, OpSize32,
321                      Requires<[In64BitMode]>;
322  def CALL64r       : I<0xFF, MRM2r, (outs), (ins GR64:$dst),
323                        "call{q}\t{*}$dst", [(X86call GR64:$dst)]>,
324                      Requires<[In64BitMode,NotUseIndirectThunkCalls]>;
325  def CALL64m       : I<0xFF, MRM2m, (outs), (ins i64mem:$dst),
326                        "call{q}\t{*}$dst", [(X86call (loadi64 addr:$dst))]>,
327                      Requires<[In64BitMode,FavorMemIndirectCall,
328                                NotUseIndirectThunkCalls]>;
329
330  // Non-tracking calls for IBT, use with caution.
331  let isCodeGenOnly = 1 in {
332    def CALL64r_NT : I<0xFF, MRM2r, (outs), (ins GR64 : $dst),
333                      "call{q}\t{*}$dst",[(X86NoTrackCall GR64 : $dst)]>,
334                      Requires<[In64BitMode]>, NOTRACK;
335    def CALL64m_NT : I<0xFF, MRM2m, (outs), (ins i64mem : $dst),
336                       "call{q}\t{*}$dst",
337                       [(X86NoTrackCall(loadi64 addr : $dst))]>,
338                       Requires<[In64BitMode,FavorMemIndirectCall]>, NOTRACK;
339  }
340
341  let mayLoad = 1 in
342  def FARCALL64m  : RI<0xFF, MRM3m, (outs), (ins opaquemem:$dst),
343                       "lcall{q}\t{*}$dst", []>;
344}
345
346let isCall = 1, isTerminator = 1, isReturn = 1, isBarrier = 1,
347    isCodeGenOnly = 1, Uses = [RSP, SSP] in {
348  def TCRETURNdi64   : PseudoI<(outs),
349                               (ins i64i32imm_brtarget:$dst, i32imm:$offset),
350                               []>, Sched<[WriteJump]>;
351  def TCRETURNri64   : PseudoI<(outs),
352                               (ins ptr_rc_tailcall:$dst, i32imm:$offset),
353                               []>, Sched<[WriteJump]>;
354  let mayLoad = 1 in
355  def TCRETURNmi64   : PseudoI<(outs),
356                               (ins i64mem_TC:$dst, i32imm:$offset),
357                               []>, Sched<[WriteJumpLd]>;
358
359  def TAILJMPd64 : PseudoI<(outs), (ins i64i32imm_brtarget:$dst),
360                           []>, Sched<[WriteJump]>;
361
362  def TAILJMPr64 : PseudoI<(outs), (ins ptr_rc_tailcall:$dst),
363                           []>, Sched<[WriteJump]>;
364
365  let mayLoad = 1 in
366  def TAILJMPm64 : PseudoI<(outs), (ins i64mem_TC:$dst),
367                           []>, Sched<[WriteJumpLd]>;
368
369  // Win64 wants indirect jumps leaving the function to have a REX_W prefix.
370  let hasREX_W = 1 in {
371    def TAILJMPr64_REX : PseudoI<(outs), (ins ptr_rc_tailcall:$dst),
372                                 []>, Sched<[WriteJump]>;
373
374    let mayLoad = 1 in
375    def TAILJMPm64_REX : PseudoI<(outs), (ins i64mem_TC:$dst),
376                                 []>, Sched<[WriteJumpLd]>;
377  }
378}
379
380let isPseudo = 1, isCall = 1, isCodeGenOnly = 1,
381    Uses = [RSP, SSP],
382    usesCustomInserter = 1,
383    SchedRW = [WriteJump] in {
384  def INDIRECT_THUNK_CALL32 :
385    PseudoI<(outs), (ins GR32:$dst), [(X86call GR32:$dst)]>,
386            Requires<[Not64BitMode,UseIndirectThunkCalls]>;
387
388  def INDIRECT_THUNK_CALL64 :
389    PseudoI<(outs), (ins GR64:$dst), [(X86call GR64:$dst)]>,
390            Requires<[In64BitMode,UseIndirectThunkCalls]>;
391
392  // Indirect thunk variant of indirect tail calls.
393  let isTerminator = 1, isReturn = 1, isBarrier = 1 in {
394    def INDIRECT_THUNK_TCRETURN64 :
395      PseudoI<(outs), (ins GR64:$dst, i32imm:$offset), []>;
396    def INDIRECT_THUNK_TCRETURN32 :
397      PseudoI<(outs), (ins GR32:$dst, i32imm:$offset), []>;
398  }
399}
400
401let isPseudo = 1, isCall = 1, isCodeGenOnly = 1,
402    Uses = [RSP, SSP],
403    SchedRW = [WriteJump] in {
404  def CALL64m_RVMARKER :
405     PseudoI<(outs), (ins i64imm:$rvfunc, i64mem:$dst), [(X86call_rvmarker tglobaladdr:$rvfunc, (loadi64 addr:$dst))]>,
406             Requires<[In64BitMode]>;
407
408  def CALL64r_RVMARKER :
409    PseudoI<(outs), (ins i64imm:$rvfunc, GR64:$dst), [(X86call_rvmarker tglobaladdr:$rvfunc, GR64:$dst)]>,
410            Requires<[In64BitMode]>;
411
412  def CALL64pcrel32_RVMARKER :
413    PseudoI<(outs), (ins i64imm:$rvfunc, i64i32imm_brtarget:$dst), []>,
414            Requires<[In64BitMode]>;
415}
416
417// Conditional tail calls are similar to the above, but they are branches
418// rather than barriers, and they use EFLAGS.
419let isCall = 1, isTerminator = 1, isReturn = 1, isBranch = 1,
420    isCodeGenOnly = 1, SchedRW = [WriteJump] in
421  let Uses = [RSP, EFLAGS, SSP] in {
422  def TCRETURNdi64cc : PseudoI<(outs),
423                           (ins i64i32imm_brtarget:$dst, i32imm:$offset,
424                            i32imm:$cond), []>;
425
426  // This gets substituted to a conditional jump instruction in MC lowering.
427  def TAILJMPd64_CC : PseudoI<(outs),
428                              (ins i64i32imm_brtarget:$dst, i32imm:$cond), []>;
429}
430