mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-26 04:32:44 +01:00
1bc07f6217
This patch implements the final bits of CMSE code generation: * emit special linker symbols * restrict parameter passing to no use memory * emit BXNS and BLXNS instructions for returns from non-secure entry functions, and non-secure function calls, respectively * emit code to save/restore secure floating-point state around calls to non-secure functions * emit code to save/restore non-secure floating-pointy state upon entry to non-secure entry function, and return to non-secure state * emit code to clobber registers not used for arguments and returns * when switching to no-secure state Patch by Momchil Velikov, Bradley Smith, Javed Absar, David Green, possibly others. Differential Revision: https://reviews.llvm.org/D76518
25 lines
749 B
LLVM
25 lines
749 B
LLVM
; RUN: llc -mtriple=thumbv8.1m.main -mattr=+8msecext %s -o - | FileCheck %s
|
|
|
|
define hidden i32 @f(i32 %0, i32 (i32)* nocapture %1) local_unnamed_addr #0 {
|
|
%3 = call i32 %1(i32 %0) #2
|
|
%4 = icmp eq i32 %3, 1
|
|
br i1 %4, label %6, label %5
|
|
|
|
5: ; preds = %2
|
|
call void bitcast (void (...)* @g to void ()*)() #3
|
|
unreachable
|
|
|
|
6: ; preds = %2
|
|
ret i32 1
|
|
}
|
|
; CHECK-NOT: clrm eq
|
|
; CHECK: clrm {r1, r2, r3, r12, apsr}
|
|
; CHECK: bl g
|
|
|
|
declare dso_local void @g(...) local_unnamed_addr #1
|
|
|
|
attributes #0 = { nounwind "cmse_nonsecure_entry" }
|
|
attributes #1 = { noreturn }
|
|
attributes #2 = { nounwind "cmse_nonsecure_call" }
|
|
attributes #3 = { noreturn nounwind }
|