diff options
| author | lewis-revill <lewis.revill@embecosm.com> | 2019-12-19 16:41:53 +0000 | 
|---|---|---|
| committer | lewis-revill <lewis.revill@embecosm.com> | 2019-12-19 16:41:53 +0000 | 
| commit | a116f28a0d71c221c1dc023908b180beaf22799d (patch) | |
| tree | b82fee045e7cb6c303572bf631938fcd08f85be4 /llvm/test/CodeGen/RISCV | |
| parent | ba430f503244d1498529d47f31090cdf79b5c231 (diff) | |
| download | bcm5719-llvm-a116f28a0d71c221c1dc023908b180beaf22799d.tar.gz bcm5719-llvm-a116f28a0d71c221c1dc023908b180beaf22799d.zip  | |
[RISCV] Enable the machine outliner for RISC-V
This patch enables the machine outliner for RISC-V and adds the
necessary logic for checking whether sequences can be safely outlined,
and describing how they should be outlined. Outlined functions are
called using the register t0 (x5) as the return address register, which
must be available for an occurrence of a sequence to be safely outlined.
Differential Revision: https://reviews.llvm.org/D66210
Diffstat (limited to 'llvm/test/CodeGen/RISCV')
| -rw-r--r-- | llvm/test/CodeGen/RISCV/machineoutliner.mir | 132 | 
1 files changed, 132 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/RISCV/machineoutliner.mir b/llvm/test/CodeGen/RISCV/machineoutliner.mir new file mode 100644 index 00000000000..e629a626e3d --- /dev/null +++ b/llvm/test/CodeGen/RISCV/machineoutliner.mir @@ -0,0 +1,132 @@ +# RUN: llc -march=riscv32 -x mir -run-pass=machine-outliner -simplify-mir -verify-machineinstrs < %s \ +# RUN: | FileCheck -check-prefix=RV32I-MO %s +# RUN: llc -march=riscv64 -x mir -run-pass=machine-outliner -simplify-mir -verify-machineinstrs < %s \ +# RUN: | FileCheck -check-prefix=RV64I-MO %s + +--- | +  define i32 @outline_0(i32 %a, i32 %b) { ret i32 0 } + +  define i32 @outline_1(i32 %a, i32 %b) { ret i32 0 } + +  define i32 @outline_2(i32 %a, i32 %b) { ret i32 0 } + +  ; Should not outline linkonce_odr functions which could be deduplicated by the +  ; linker. +  define linkonce_odr i32 @dont_outline_0(i32 %a, i32 %b) { ret i32 0 } + +  ; Should not outline functions with named linker sections +  define i32 @dont_outline_1(i32 %a, i32 %b) section "named" { ret i32 0 } + +  ; Cannot outline if the X5 (t0) register is not free +  define i32 @dont_outline_2(i32 %a, i32 %b) { ret i32 0 } + +... +--- +name:            outline_0 +tracksRegLiveness: true +body:             | +  bb.0: +    liveins: $x10, $x11 +    ; RV32I-MO-LABEL: name: outline_0 +    ; RV32I-MO: $x5 = PseudoCALLReg {{.*}} @OUTLINED_FUNCTION_0 +    ; +    ; RV64I-MO-LABEL: name: outline_0 +    ; RV64I-MO: $x5 = PseudoCALLReg {{.*}} @OUTLINED_FUNCTION_0 +    $x11 = ORI $x11, 1023 +    $x12 = ADDI $x10, 17 +    $x11 = AND $x12, $x11 +    $x10 = SUB $x10, $x11 +    PseudoRET implicit $x10 + +... +--- +name:            outline_1 +tracksRegLiveness: true +body:             | +  bb.0: +    liveins: $x10, $x11 +    ; RV32I-MO-LABEL: name: outline_1 +    ; RV32I-MO: $x5 = PseudoCALLReg {{.*}} @OUTLINED_FUNCTION_0 +    ; +    ; RV64I-MO-LABEL: name: outline_1 +    ; RV64I-MO: $x5 = PseudoCALLReg {{.*}} @OUTLINED_FUNCTION_0 +    $x11 = ORI $x11, 1023 +    $x12 = ADDI $x10, 17 +    $x11 = AND $x12, $x11 +    $x10 = SUB $x10, $x11 +    PseudoRET implicit $x10 + +... +--- +name:            outline_2 +tracksRegLiveness: true +body:             | +  bb.0: +    liveins: $x10, $x11 +    ; RV32I-MO-LABEL: name: outline_2 +    ; RV32I-MO: $x5 = PseudoCALLReg {{.*}} @OUTLINED_FUNCTION_0 +    ; +    ; RV64I-MO-LABEL: name: outline_2 +    ; RV64I-MO: $x5 = PseudoCALLReg {{.*}} @OUTLINED_FUNCTION_0 +    $x11 = ORI $x11, 1023 +    $x12 = ADDI $x10, 17 +    $x11 = AND $x12, $x11 +    $x10 = SUB $x10, $x11 +    PseudoRET implicit $x10 + +... +--- +name:            dont_outline_0 +tracksRegLiveness: true +body:             | +  bb.0: +    liveins: $x10, $x11 +    ; RV32I-MO-LABEL: name: dont_outline_0 +    ; RV32I-MO-NOT: $x5 = PseudoCALLReg {{.*}} @OUTLINED_FUNCTION_0 +    ; +    ; RV64I-MO-LABEL: name: dont_outline_0 +    ; RV64I-MO-NOT: $x5 = PseudoCALLReg {{.*}} @OUTLINED_FUNCTION_0 +    $x11 = ORI $x11, 1023 +    $x12 = ADDI $x10, 17 +    $x11 = AND $x12, $x11 +    $x10 = SUB $x10, $x11 +    PseudoRET implicit $x10 + +... +--- +name:            dont_outline_1 +tracksRegLiveness: true +body:             | +  bb.0: +    liveins: $x10, $x11 +    ; RV32I-MO-LABEL: name: dont_outline_1 +    ; RV32I-MO-NOT: $x5 = PseudoCALLReg {{.*}} @OUTLINED_FUNCTION_0 +    ; +    ; RV64I-MO-LABEL: name: dont_outline_1 +    ; RV64I-MO-NOT: $x5 = PseudoCALLReg {{.*}} @OUTLINED_FUNCTION_0 +    $x11 = ORI $x11, 1023 +    $x12 = ADDI $x10, 17 +    $x11 = AND $x12, $x11 +    $x10 = SUB $x10, $x11 +    PseudoRET implicit $x10 + +... +--- +name:            dont_outline_2 +tracksRegLiveness: true +body:             | +  bb.0: +    liveins: $x10, $x11, $x5 +    ; RV32I-MO-LABEL: name: dont_outline_2 +    ; RV32I-MO-NOT: $x5 = PseudoCALLReg {{.*}} @OUTLINED_FUNCTION_0 +    ; +    ; RV64I-MO-LABEL: name: dont_outline_2 +    ; RV64I-MO-NOT: $x5 = PseudoCALLReg {{.*}} @OUTLINED_FUNCTION_0 +    $x11 = ORI $x11, 1023 +    $x12 = ADDI $x10, 17 +    $x11 = AND $x12, $x11 +    $x10 = SUB $x10, $x11 +    $x10 = ADD $x10, $x5 +    PseudoRET implicit $x10 + +...  | 

