brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.0 KiB · facd73d Raw
130 lines · plain
1# RUN: llc -mtriple=aarch64-apple-darwin -run-pass=prologepilog \2# RUN: -run-pass=machine-outliner -verify-machineinstrs %s -o - | FileCheck %s3# Check that we save LR to a callee-saved register when possible.4# foo() should use a callee-saved register. However, bar() should not.5--- |6 7  define void @foo() #0 {8    ret void9  }10 11  define void @bar() #0 {12    ret void13  }14 15  attributes #0 = { minsize noinline noredzone "frame-pointer"="all" }16...17---18# Make sure that when we outline and a register is available, we19# use it to save + restore LR instead of SP.20# Also make sure that we can call functions that require no save as the same21# outlined function.22# CHECK: name:            foo23# CHECK-DAG: bb.124# CHECK-DAG: $x[[REG:[0-9]+]] = ORRXrs $xzr, $lr, 025# CHECK-NEXT: BL26# CHECK-NEXT: $lr = ORRXrs $xzr, $x[[REG]], 027# CHECK-DAG: bb.228# CHECK-DAG: $x[[REG]] = ORRXrs $xzr, $lr, 029# CHECK-NEXT: BL30# CHECK-NEXT: $lr = ORRXrs $xzr, $x[[REG]], 031# CHECK-DAG: bb.332# CHECK-DAG: $x[[REG]] = ORRXrs $xzr, $lr, 033# CHECK-NEXT: BL34# CHECK-NEXT: $lr = ORRXrs $xzr, $x[[REG]], 035# CHECK-DAG: bb.436# CHECK-NOT: $x[[REG]] = ORRXrs $xzr, $lr, 037# CHECK-DAG: BL38name:            foo39tracksRegLiveness: true40fixedStack:41body:             |42  bb.0:43    $x9 = ORRXri $xzr, 144    $lr = ORRXri $xzr, 145  bb.1:46    liveins: $lr, $w947    $w9 = ORRWri $wzr, 148    $w9 = ORRWri $wzr, 149    $w9 = ORRWri $wzr, 150    $w9 = ORRWri $wzr, 151    $w9 = ORRWri $wzr, 152    $w9 = ORRWri $wzr, 253  bb.2:54    liveins: $lr, $w955    $w9 = ORRWri $wzr, 156    $w9 = ORRWri $wzr, 157    $w9 = ORRWri $wzr, 158    $w9 = ORRWri $wzr, 159    $w9 = ORRWri $wzr, 160    $w9 = ORRWri $wzr, 261  bb.3:62    liveins: $lr, $w963    $w9 = ORRWri $wzr, 164    $w9 = ORRWri $wzr, 165    $w9 = ORRWri $wzr, 166    $w9 = ORRWri $wzr, 167    $w9 = ORRWri $wzr, 168    $w9 = ORRWri $wzr, 269  bb.4:70    liveins: $lr, $w971    $w9 = ORRWri $wzr, 172    $w9 = ORRWri $wzr, 173    $w9 = ORRWri $wzr, 174    $w9 = ORRWri $wzr, 175    $w9 = ORRWri $wzr, 176    $w9 = ORRWri $wzr, 277  bb.5:78    liveins: $w979    RET undef $lr80 81...82---83# Convoluted case that shows that we'll still save to the stack when there are84# no approprate registers available.85# The live-in lists do not contain x16 or x17 since including them would cause86# nothing to be outlined.87# They also deliberately don't contain x18 to show that on Darwin we won't store88# to that.89# CHECK-LABEL: name:            bar90# CHECK: early-clobber $sp = STRXpre $lr, $sp, -1691# CHECK-NEXT: BL92# CHECK-DAG: early-clobber $sp, $lr = LDRXpost $sp, 1693# CHECK: early-clobber $sp = STRXpre $lr, $sp, -1694# CHECK-NEXT: BL95# CHECK-DAG: early-clobber $sp, $lr = LDRXpost $sp, 1696# CHECK: early-clobber $sp = STRXpre $lr, $sp, -1697# CHECK-NEXT: BL98# CHECK-NEXT: early-clobber $sp, $lr = LDRXpost $sp, 1699name:            bar100tracksRegLiveness: true101body:             |102  bb.0:103    liveins: $lr, $x0, $x1, $x2, $x3, $x4, $x5, $x6, $x7, $x8, $x9, $x10, $x11, $x12, $x13, $x14, $x15, $x19, $x20, $x21, $x22, $x23, $x20, $x21, $x22, $x23, $x24, $x25, $x26, $x27, $x28104    $lr = ORRXri $xzr, 1105    $w10 = ORRWri $wzr, 1106    $w10 = ORRWri $wzr, 1107    $w10 = ORRWri $wzr, 1108    $w10 = ORRWri $wzr, 1109    $w10 = ORRWri $wzr, 1110    $w12 = ORRWri $wzr, 2111  bb.1:112    liveins: $lr, $x0, $x1, $x2, $x3, $x4, $x5, $x6, $x7, $x8, $x9, $x10, $x11, $x12, $x13, $x14, $x15, $x19, $x20, $x21, $x22, $x23, $x20, $x21, $x22, $x23, $x24, $x25, $x26, $x27, $x28113    $w10 = ORRWri $wzr, 1114    $w10 = ORRWri $wzr, 1115    $w10 = ORRWri $wzr, 1116    $w10 = ORRWri $wzr, 1117    $w10 = ORRWri $wzr, 1118    $w12 = ORRWri $wzr, 2119  bb.2:120    liveins: $lr, $x0, $x1, $x2, $x3, $x4, $x5, $x6, $x7, $x8, $x9, $x10, $x11, $x12, $x13, $x14, $x15, $x19, $x20, $x21, $x22, $x23, $x20, $x21, $x22, $x23, $x24, $x25, $x26, $x27, $x28121    $w10 = ORRWri $wzr, 1122    $w10 = ORRWri $wzr, 1123    $w10 = ORRWri $wzr, 1124    $w10 = ORRWri $wzr, 1125    $w10 = ORRWri $wzr, 1126    $w12 = ORRWri $wzr, 2127  bb.3:128    liveins: $lr, $x0, $x1, $x2, $x3, $x4, $x5, $x6, $x7, $x8, $x9, $x10, $x11, $x12, $x13, $x14, $x15, $x19, $x20, $x21, $x22, $x23, $x20, $x21, $x22, $x23, $x24, $x25, $x26, $x27, $x28129    RET undef $lr130