[RISCV] Implement MC layer support for the tail pseudoinstruction
Summary:
This patch implements MC support for tail psuedo instruction.
A follow-up patch implements the codegen support as well as handling of the indirect tail pseudo instruction.
Reviewers: asb, apazos
Reviewed By: asb
Subscribers: rbar, johnrusso, simoncook, jordy.potman.lists, sabuasal, niosHD, kito-cheng, shiva0217, zzheng, edward-jones, llvm-commits
Differential Revision: https://reviews.llvm.org/D46221
llvm-svn: 332634
2018-05-18 01:31:27 +08:00
|
|
|
# RUN: llvm-mc -filetype=obj -triple riscv32 < %s \
|
|
|
|
# RUN: | llvm-objdump -d - | FileCheck -check-prefix=INSTR %s
|
|
|
|
# RUN: llvm-mc -filetype=obj -triple riscv32 < %s \
|
|
|
|
# RUN: | llvm-readobj -r | FileCheck -check-prefix=RELOC %s
|
|
|
|
# RUN: llvm-mc -triple riscv32 < %s -show-encoding \
|
|
|
|
# RUN: | FileCheck -check-prefix=FIXUP %s
|
|
|
|
|
|
|
|
# RUN: llvm-mc -filetype=obj -triple riscv64 < %s \
|
|
|
|
# RUN: | llvm-objdump -d - | FileCheck -check-prefix=INSTR %s
|
|
|
|
# RUN: llvm-mc -filetype=obj -triple riscv64 < %s \
|
|
|
|
# RUN: | llvm-readobj -r | FileCheck -check-prefix=RELOC %s
|
|
|
|
# RUN: llvm-mc -triple riscv64 < %s -show-encoding \
|
|
|
|
# RUN: | FileCheck -check-prefix=FIXUP %s
|
|
|
|
|
|
|
|
.long foo
|
|
|
|
|
|
|
|
tail foo
|
|
|
|
# RELOC: R_RISCV_CALL foo 0x0
|
|
|
|
# INSTR: auipc t1, 0
|
[RISCV] Tail calls don't need to save return address
Summary:
When expanding the PseudoTail in expandFunctionCall() we were using X6
to save the return address. Since this is a tail call the return
address is not needed, this patch replaces it with X0 to be ignored.
This matches the behaviour listed in the ISA V2.2 document page 110.
tail offset -----> jalr x0, x6, offset
GCC exhibits the same behavior.
Reviewers: apazos, asb, mgrang
Reviewed By: asb
Subscribers: rbar, johnrusso, simoncook, niosHD, kito-cheng, shiva0217, zzheng, edward-jones, rogfer01
Differential Revision: https://reviews.llvm.org/D48343
llvm-svn: 335239
2018-06-21 22:37:09 +08:00
|
|
|
# INSTR: jr t1
|
[RISCV] Implement MC layer support for the tail pseudoinstruction
Summary:
This patch implements MC support for tail psuedo instruction.
A follow-up patch implements the codegen support as well as handling of the indirect tail pseudo instruction.
Reviewers: asb, apazos
Reviewed By: asb
Subscribers: rbar, johnrusso, simoncook, jordy.potman.lists, sabuasal, niosHD, kito-cheng, shiva0217, zzheng, edward-jones, llvm-commits
Differential Revision: https://reviews.llvm.org/D46221
llvm-svn: 332634
2018-05-18 01:31:27 +08:00
|
|
|
# FIXUP: fixup A - offset: 0, value: foo, kind:
|
|
|
|
tail bar
|
|
|
|
# RELOC: R_RISCV_CALL bar 0x0
|
|
|
|
# INSTR: auipc t1, 0
|
[RISCV] Tail calls don't need to save return address
Summary:
When expanding the PseudoTail in expandFunctionCall() we were using X6
to save the return address. Since this is a tail call the return
address is not needed, this patch replaces it with X0 to be ignored.
This matches the behaviour listed in the ISA V2.2 document page 110.
tail offset -----> jalr x0, x6, offset
GCC exhibits the same behavior.
Reviewers: apazos, asb, mgrang
Reviewed By: asb
Subscribers: rbar, johnrusso, simoncook, niosHD, kito-cheng, shiva0217, zzheng, edward-jones, rogfer01
Differential Revision: https://reviews.llvm.org/D48343
llvm-svn: 335239
2018-06-21 22:37:09 +08:00
|
|
|
# INSTR: jr t1
|
[RISCV] Implement MC layer support for the tail pseudoinstruction
Summary:
This patch implements MC support for tail psuedo instruction.
A follow-up patch implements the codegen support as well as handling of the indirect tail pseudo instruction.
Reviewers: asb, apazos
Reviewed By: asb
Subscribers: rbar, johnrusso, simoncook, jordy.potman.lists, sabuasal, niosHD, kito-cheng, shiva0217, zzheng, edward-jones, llvm-commits
Differential Revision: https://reviews.llvm.org/D46221
llvm-svn: 332634
2018-05-18 01:31:27 +08:00
|
|
|
# FIXUP: fixup A - offset: 0, value: bar, kind:
|
|
|
|
|
|
|
|
# Ensure that tail calls to functions whose names coincide with register names
|
|
|
|
# work.
|
|
|
|
|
|
|
|
tail zero
|
|
|
|
# RELOC: R_RISCV_CALL zero 0x0
|
|
|
|
# INSTR: auipc t1, 0
|
[RISCV] Tail calls don't need to save return address
Summary:
When expanding the PseudoTail in expandFunctionCall() we were using X6
to save the return address. Since this is a tail call the return
address is not needed, this patch replaces it with X0 to be ignored.
This matches the behaviour listed in the ISA V2.2 document page 110.
tail offset -----> jalr x0, x6, offset
GCC exhibits the same behavior.
Reviewers: apazos, asb, mgrang
Reviewed By: asb
Subscribers: rbar, johnrusso, simoncook, niosHD, kito-cheng, shiva0217, zzheng, edward-jones, rogfer01
Differential Revision: https://reviews.llvm.org/D48343
llvm-svn: 335239
2018-06-21 22:37:09 +08:00
|
|
|
# INSTR: jr t1
|
[RISCV] Implement MC layer support for the tail pseudoinstruction
Summary:
This patch implements MC support for tail psuedo instruction.
A follow-up patch implements the codegen support as well as handling of the indirect tail pseudo instruction.
Reviewers: asb, apazos
Reviewed By: asb
Subscribers: rbar, johnrusso, simoncook, jordy.potman.lists, sabuasal, niosHD, kito-cheng, shiva0217, zzheng, edward-jones, llvm-commits
Differential Revision: https://reviews.llvm.org/D46221
llvm-svn: 332634
2018-05-18 01:31:27 +08:00
|
|
|
# FIXUP: fixup A - offset: 0, value: zero, kind:
|
|
|
|
|
|
|
|
tail f1
|
|
|
|
# RELOC: R_RISCV_CALL f1 0x0
|
|
|
|
# INSTR: auipc t1, 0
|
[RISCV] Tail calls don't need to save return address
Summary:
When expanding the PseudoTail in expandFunctionCall() we were using X6
to save the return address. Since this is a tail call the return
address is not needed, this patch replaces it with X0 to be ignored.
This matches the behaviour listed in the ISA V2.2 document page 110.
tail offset -----> jalr x0, x6, offset
GCC exhibits the same behavior.
Reviewers: apazos, asb, mgrang
Reviewed By: asb
Subscribers: rbar, johnrusso, simoncook, niosHD, kito-cheng, shiva0217, zzheng, edward-jones, rogfer01
Differential Revision: https://reviews.llvm.org/D48343
llvm-svn: 335239
2018-06-21 22:37:09 +08:00
|
|
|
# INSTR: jr t1
|
[RISCV] Implement MC layer support for the tail pseudoinstruction
Summary:
This patch implements MC support for tail psuedo instruction.
A follow-up patch implements the codegen support as well as handling of the indirect tail pseudo instruction.
Reviewers: asb, apazos
Reviewed By: asb
Subscribers: rbar, johnrusso, simoncook, jordy.potman.lists, sabuasal, niosHD, kito-cheng, shiva0217, zzheng, edward-jones, llvm-commits
Differential Revision: https://reviews.llvm.org/D46221
llvm-svn: 332634
2018-05-18 01:31:27 +08:00
|
|
|
# FIXUP: fixup A - offset: 0, value: f1, kind:
|
|
|
|
|
|
|
|
tail ra
|
|
|
|
# RELOC: R_RISCV_CALL ra 0x0
|
|
|
|
# INSTR: auipc t1, 0
|
[RISCV] Tail calls don't need to save return address
Summary:
When expanding the PseudoTail in expandFunctionCall() we were using X6
to save the return address. Since this is a tail call the return
address is not needed, this patch replaces it with X0 to be ignored.
This matches the behaviour listed in the ISA V2.2 document page 110.
tail offset -----> jalr x0, x6, offset
GCC exhibits the same behavior.
Reviewers: apazos, asb, mgrang
Reviewed By: asb
Subscribers: rbar, johnrusso, simoncook, niosHD, kito-cheng, shiva0217, zzheng, edward-jones, rogfer01
Differential Revision: https://reviews.llvm.org/D48343
llvm-svn: 335239
2018-06-21 22:37:09 +08:00
|
|
|
# INSTR: jr t1
|
[RISCV] Implement MC layer support for the tail pseudoinstruction
Summary:
This patch implements MC support for tail psuedo instruction.
A follow-up patch implements the codegen support as well as handling of the indirect tail pseudo instruction.
Reviewers: asb, apazos
Reviewed By: asb
Subscribers: rbar, johnrusso, simoncook, jordy.potman.lists, sabuasal, niosHD, kito-cheng, shiva0217, zzheng, edward-jones, llvm-commits
Differential Revision: https://reviews.llvm.org/D46221
llvm-svn: 332634
2018-05-18 01:31:27 +08:00
|
|
|
# FIXUP: fixup A - offset: 0, value: ra, kind:
|
2019-04-02 20:47:20 +08:00
|
|
|
|
|
|
|
tail foo@plt
|
|
|
|
# RELOC: R_RISCV_CALL_PLT foo 0x0
|
|
|
|
# INSTR: auipc t1, 0
|
|
|
|
# INSTR: jr t1
|
|
|
|
# FIXUP: fixup A - offset: 0, value: foo@plt, kind:
|