2014-01-06 14:20:53 +00:00
|
|
|
; RUN: llc < %s -march=xcore | FileCheck %s
|
2014-01-11 21:06:00 +00:00
|
|
|
; RUN: llc < %s -march=xcore -disable-fp-elim | FileCheck %s -check-prefix=CHECKFP
|
2014-01-06 14:20:53 +00:00
|
|
|
|
|
|
|
declare i8* @llvm.frameaddress(i32) nounwind readnone
|
2014-01-06 14:21:12 +00:00
|
|
|
declare i8* @llvm.returnaddress(i32) nounwind
|
|
|
|
declare i8* @llvm.eh.dwarf.cfa(i32) nounwind
|
|
|
|
declare void @llvm.eh.return.i32(i32, i8*) nounwind
|
|
|
|
declare void @llvm.eh.unwind.init() nounwind
|
|
|
|
|
2014-01-06 14:20:53 +00:00
|
|
|
define i8* @FA0() nounwind {
|
|
|
|
entry:
|
|
|
|
; CHECK-LABEL: FA0
|
|
|
|
; CHECK: ldaw r0, sp[0]
|
|
|
|
; CHECK-NEXT: retsp 0
|
|
|
|
%0 = call i8* @llvm.frameaddress(i32 0)
|
|
|
|
ret i8* %0
|
|
|
|
}
|
|
|
|
|
|
|
|
define i8* @FA1() nounwind {
|
|
|
|
entry:
|
|
|
|
; CHECK-LABEL: FA1
|
|
|
|
; CHECK: entsp 100
|
|
|
|
; CHECK-NEXT: ldaw r0, sp[0]
|
|
|
|
; CHECK-NEXT: retsp 100
|
|
|
|
%0 = alloca [100 x i32]
|
|
|
|
%1 = call i8* @llvm.frameaddress(i32 0)
|
|
|
|
ret i8* %1
|
|
|
|
}
|
|
|
|
|
|
|
|
define i8* @RA0() nounwind {
|
|
|
|
entry:
|
|
|
|
; CHECK-LABEL: RA0
|
|
|
|
; CHECK: stw lr, sp[0]
|
|
|
|
; CHECK-NEXT: ldw r0, sp[0]
|
|
|
|
; CHECK-NEXT: ldw lr, sp[0]
|
|
|
|
; CHECK-NEXT: retsp 0
|
|
|
|
%0 = call i8* @llvm.returnaddress(i32 0)
|
|
|
|
ret i8* %0
|
|
|
|
}
|
|
|
|
|
|
|
|
define i8* @RA1() nounwind {
|
|
|
|
entry:
|
|
|
|
; CHECK-LABEL: RA1
|
|
|
|
; CHECK: entsp 100
|
|
|
|
; CHECK-NEXT: ldw r0, sp[100]
|
|
|
|
; CHECK-NEXT: retsp 100
|
|
|
|
%0 = alloca [100 x i32]
|
|
|
|
%1 = call i8* @llvm.returnaddress(i32 0)
|
|
|
|
ret i8* %1
|
|
|
|
}
|
2014-01-06 14:21:00 +00:00
|
|
|
|
|
|
|
; test FRAME_TO_ARGS_OFFSET lowering
|
|
|
|
define i8* @FTAO0() nounwind {
|
|
|
|
entry:
|
|
|
|
; CHECK-LABEL: FTAO0
|
|
|
|
; CHECK: ldc r0, 0
|
|
|
|
; CHECK-NEXT: ldaw r1, sp[0]
|
|
|
|
; CHECK-NEXT: add r0, r1, r0
|
|
|
|
; CHECK-NEXT: retsp 0
|
|
|
|
%0 = call i8* @llvm.eh.dwarf.cfa(i32 0)
|
|
|
|
ret i8* %0
|
|
|
|
}
|
|
|
|
|
|
|
|
define i8* @FTAO1() nounwind {
|
|
|
|
entry:
|
|
|
|
; CHECK-LABEL: FTAO1
|
|
|
|
; CHECK: entsp 100
|
|
|
|
; CHECK-NEXT: ldc r0, 400
|
|
|
|
; CHECK-NEXT: ldaw r1, sp[0]
|
|
|
|
; CHECK-NEXT: add r0, r1, r0
|
|
|
|
; CHECK-NEXT: retsp 100
|
|
|
|
%0 = alloca [100 x i32]
|
|
|
|
%1 = call i8* @llvm.eh.dwarf.cfa(i32 0)
|
|
|
|
ret i8* %1
|
|
|
|
}
|
2014-01-06 14:21:07 +00:00
|
|
|
|
|
|
|
define i8* @EH0(i32 %offset, i8* %handler) {
|
|
|
|
entry:
|
|
|
|
; CHECK-LABEL: EH0
|
2014-02-18 11:21:48 +00:00
|
|
|
; CHECK: entsp 2
|
|
|
|
; CHECK: .cfi_def_cfa_offset 8
|
|
|
|
; CHECK: .cfi_offset 15, 0
|
|
|
|
; CHECK: .cfi_offset 1, -8
|
|
|
|
; CHECK: .cfi_offset 0, -4
|
|
|
|
; CHECK: ldc r2, 8
|
2014-01-06 14:21:07 +00:00
|
|
|
; CHECK-NEXT: ldaw r3, sp[0]
|
|
|
|
; CHECK-NEXT: add r2, r3, r2
|
|
|
|
; CHECK-NEXT: add r2, r2, r0
|
|
|
|
; CHECK-NEXT: mov r3, r1
|
2014-02-18 11:21:48 +00:00
|
|
|
; CHECK-NEXT: ldw r1, sp[0]
|
|
|
|
; CHECK-NEXT: ldw r0, sp[1]
|
2014-01-06 14:21:07 +00:00
|
|
|
; CHECK-NEXT: set sp, r2
|
|
|
|
; CHECK-NEXT: bau r3
|
|
|
|
call void @llvm.eh.return.i32(i32 %offset, i8* %handler)
|
|
|
|
unreachable
|
|
|
|
}
|
|
|
|
|
|
|
|
declare void @foo(...)
|
|
|
|
define i8* @EH1(i32 %offset, i8* %handler) {
|
|
|
|
entry:
|
|
|
|
; CHECK-LABEL: EH1
|
2014-02-18 11:21:48 +00:00
|
|
|
; CHECK: entsp 5
|
|
|
|
; CHECK: .cfi_def_cfa_offset 20
|
|
|
|
; CHECK: .cfi_offset 15, 0
|
|
|
|
; CHECK: .cfi_offset 1, -16
|
|
|
|
; CHECK: .cfi_offset 0, -12
|
|
|
|
; CHECK: stw r4, sp[4]
|
|
|
|
; CHECK: .cfi_offset 4, -4
|
|
|
|
; CHECK: stw r5, sp[3]
|
|
|
|
; CHECK: .cfi_offset 5, -8
|
2014-01-06 14:21:07 +00:00
|
|
|
; CHECK: mov r4, r1
|
|
|
|
; CHECK-NEXT: mov r5, r0
|
|
|
|
; CHECK-NEXT: bl foo
|
2014-02-18 11:21:48 +00:00
|
|
|
; CHECK-NEXT: ldc r0, 20
|
2014-01-06 14:21:07 +00:00
|
|
|
; CHECK-NEXT: ldaw r1, sp[0]
|
|
|
|
; CHECK-NEXT: add r0, r1, r0
|
|
|
|
; CHECK-NEXT: add r2, r0, r5
|
|
|
|
; CHECK-NEXT: mov r3, r4
|
2014-02-18 11:21:48 +00:00
|
|
|
; CHECK-NEXT: ldw r5, sp[3]
|
|
|
|
; CHECK-NEXT: ldw r4, sp[4]
|
|
|
|
; CHECK-NEXT: ldw r1, sp[1]
|
|
|
|
; CHECK-NEXT: ldw r0, sp[2]
|
2014-01-06 14:21:07 +00:00
|
|
|
; CHECK-NEXT: set sp, r2
|
|
|
|
; CHECK-NEXT: bau r3
|
[opaque pointer type] Add textual IR support for explicit type parameter to the call instruction
See r230786 and r230794 for similar changes to gep and load
respectively.
Call is a bit different because it often doesn't have a single explicit
type - usually the type is deduced from the arguments, and just the
return type is explicit. In those cases there's no need to change the
IR.
When that's not the case, the IR usually contains the pointer type of
the first operand - but since typed pointers are going away, that
representation is insufficient so I'm just stripping the "pointerness"
of the explicit type away.
This does make the IR a bit weird - it /sort of/ reads like the type of
the first operand: "call void () %x(" but %x is actually of type "void
()*" and will eventually be just of type "ptr". But this seems not too
bad and I don't think it would benefit from repeating the type
("void (), void () * %x(" and then eventually "void (), ptr %x(") as has
been done with gep and load.
This also has a side benefit: since the explicit type is no longer a
pointer, there's no ambiguity between an explicit type and a function
that returns a function pointer. Previously this case needed an explicit
type (eg: a function returning a void() function was written as
"call void () () * @x(" rather than "call void () * @x(" because of the
ambiguity between a function returning a pointer to a void() function
and a function returning void).
No ambiguity means even function pointer return types can just be
written alone, without writing the whole function's type.
This leaves /only/ the varargs case where the explicit type is required.
Given the special type syntax in call instructions, the regex-fu used
for migration was a bit more involved in its own unique way (as every
one of these is) so here it is. Use it in conjunction with the apply.sh
script and associated find/xargs commands I've provided in rr230786 to
migrate your out of tree tests. Do let me know if any of this doesn't
cover your cases & we can iterate on a more general script/regexes to
help others with out of tree tests.
About 9 test cases couldn't be automatically migrated - half of those
were functions returning function pointers, where I just had to manually
delete the function argument types now that we didn't need an explicit
function type there. The other half were typedefs of function types used
in calls - just had to manually drop the * from those.
import fileinput
import sys
import re
pat = re.compile(r'((?:=|:|^|\s)call\s(?:[^@]*?))(\s*$|\s*(?:(?:\[\[[a-zA-Z0-9_]+\]\]|[@%](?:(")?[\\\?@a-zA-Z0-9_.]*?(?(3)"|)|{{.*}}))(?:\(|$)|undef|inttoptr|bitcast|null|asm).*$)')
addrspace_end = re.compile(r"addrspace\(\d+\)\s*\*$")
func_end = re.compile("(?:void.*|\)\s*)\*$")
def conv(match, line):
if not match or re.search(addrspace_end, match.group(1)) or not re.search(func_end, match.group(1)):
return line
return line[:match.start()] + match.group(1)[:match.group(1).rfind('*')].rstrip() + match.group(2) + line[match.end():]
for line in sys.stdin:
sys.stdout.write(conv(re.search(pat, line), line))
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235145 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-16 23:24:18 +00:00
|
|
|
call void (...) @foo()
|
2014-01-06 14:21:07 +00:00
|
|
|
call void @llvm.eh.return.i32(i32 %offset, i8* %handler)
|
|
|
|
unreachable
|
|
|
|
}
|
|
|
|
|
|
|
|
@offset = external constant i32
|
|
|
|
@handler = external constant i8
|
|
|
|
define i8* @EH2(i32 %r0, i32 %r1, i32 %r2, i32 %r3) {
|
|
|
|
entry:
|
|
|
|
; CHECK-LABEL: EH2
|
2014-02-18 11:21:48 +00:00
|
|
|
; CHECK: entsp 3
|
2014-01-06 14:21:07 +00:00
|
|
|
; CHECK: bl foo
|
2014-02-11 10:36:26 +00:00
|
|
|
; CHECK-NEXT: ldw r0, dp[offset]
|
2014-02-18 11:21:48 +00:00
|
|
|
; CHECK-NEXT: ldc r1, 12
|
2014-01-06 14:21:07 +00:00
|
|
|
; CHECK-NEXT: ldaw r2, sp[0]
|
|
|
|
; CHECK-NEXT: add r1, r2, r1
|
|
|
|
; CHECK-NEXT: add r2, r1, r0
|
2014-02-11 10:36:26 +00:00
|
|
|
; CHECK-NEXT: ldaw r3, dp[handler]
|
2014-02-18 11:21:48 +00:00
|
|
|
; CHECK-NEXT: ldw r1, sp[1]
|
|
|
|
; CHECK-NEXT: ldw r0, sp[2]
|
2014-01-06 14:21:07 +00:00
|
|
|
; CHECK-NEXT: set sp, r2
|
|
|
|
; CHECK-NEXT: bau r3
|
[opaque pointer type] Add textual IR support for explicit type parameter to the call instruction
See r230786 and r230794 for similar changes to gep and load
respectively.
Call is a bit different because it often doesn't have a single explicit
type - usually the type is deduced from the arguments, and just the
return type is explicit. In those cases there's no need to change the
IR.
When that's not the case, the IR usually contains the pointer type of
the first operand - but since typed pointers are going away, that
representation is insufficient so I'm just stripping the "pointerness"
of the explicit type away.
This does make the IR a bit weird - it /sort of/ reads like the type of
the first operand: "call void () %x(" but %x is actually of type "void
()*" and will eventually be just of type "ptr". But this seems not too
bad and I don't think it would benefit from repeating the type
("void (), void () * %x(" and then eventually "void (), ptr %x(") as has
been done with gep and load.
This also has a side benefit: since the explicit type is no longer a
pointer, there's no ambiguity between an explicit type and a function
that returns a function pointer. Previously this case needed an explicit
type (eg: a function returning a void() function was written as
"call void () () * @x(" rather than "call void () * @x(" because of the
ambiguity between a function returning a pointer to a void() function
and a function returning void).
No ambiguity means even function pointer return types can just be
written alone, without writing the whole function's type.
This leaves /only/ the varargs case where the explicit type is required.
Given the special type syntax in call instructions, the regex-fu used
for migration was a bit more involved in its own unique way (as every
one of these is) so here it is. Use it in conjunction with the apply.sh
script and associated find/xargs commands I've provided in rr230786 to
migrate your out of tree tests. Do let me know if any of this doesn't
cover your cases & we can iterate on a more general script/regexes to
help others with out of tree tests.
About 9 test cases couldn't be automatically migrated - half of those
were functions returning function pointers, where I just had to manually
delete the function argument types now that we didn't need an explicit
function type there. The other half were typedefs of function types used
in calls - just had to manually drop the * from those.
import fileinput
import sys
import re
pat = re.compile(r'((?:=|:|^|\s)call\s(?:[^@]*?))(\s*$|\s*(?:(?:\[\[[a-zA-Z0-9_]+\]\]|[@%](?:(")?[\\\?@a-zA-Z0-9_.]*?(?(3)"|)|{{.*}}))(?:\(|$)|undef|inttoptr|bitcast|null|asm).*$)')
addrspace_end = re.compile(r"addrspace\(\d+\)\s*\*$")
func_end = re.compile("(?:void.*|\)\s*)\*$")
def conv(match, line):
if not match or re.search(addrspace_end, match.group(1)) or not re.search(func_end, match.group(1)):
return line
return line[:match.start()] + match.group(1)[:match.group(1).rfind('*')].rstrip() + match.group(2) + line[match.end():]
for line in sys.stdin:
sys.stdout.write(conv(re.search(pat, line), line))
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235145 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-16 23:24:18 +00:00
|
|
|
call void (...) @foo()
|
2015-02-27 21:17:42 +00:00
|
|
|
%0 = load i32, i32* @offset
|
2014-01-06 14:21:07 +00:00
|
|
|
call void @llvm.eh.return.i32(i32 %0, i8* @handler)
|
|
|
|
unreachable
|
|
|
|
}
|
2014-01-06 14:21:12 +00:00
|
|
|
|
|
|
|
|
2014-02-18 11:21:48 +00:00
|
|
|
; FP: spill FP+SR+R0:1+R4:9 = entsp 2+2+6
|
|
|
|
; But we dont actually spill or restore R0:1
|
2014-01-06 14:21:12 +00:00
|
|
|
; CHECKFP-LABEL: Unwind0:
|
2014-02-18 11:21:48 +00:00
|
|
|
; CHECKFP: entsp 10
|
2014-01-06 14:21:12 +00:00
|
|
|
; CHECKFP: stw r10, sp[1]
|
|
|
|
; CHECKFP: ldaw r10, sp[0]
|
2014-02-18 11:21:48 +00:00
|
|
|
; CHECKFP: stw r4, r10[9]
|
|
|
|
; CHECKFP: stw r5, r10[8]
|
|
|
|
; CHECKFP: stw r6, r10[7]
|
|
|
|
; CHECKFP: stw r7, r10[6]
|
|
|
|
; CHECKFP: stw r8, r10[5]
|
|
|
|
; CHECKFP: stw r9, r10[4]
|
|
|
|
; CHECKFP: ldw r9, r10[4]
|
|
|
|
; CHECKFP: ldw r8, r10[5]
|
|
|
|
; CHECKFP: ldw r7, r10[6]
|
|
|
|
; CHECKFP: ldw r6, r10[7]
|
|
|
|
; CHECKFP: ldw r5, r10[8]
|
|
|
|
; CHECKFP: ldw r4, r10[9]
|
2014-01-06 14:21:12 +00:00
|
|
|
; CHECKFP: set sp, r10
|
|
|
|
; CHECKFP: ldw r10, sp[1]
|
2014-02-18 11:21:48 +00:00
|
|
|
; CHECKFP: retsp 10
|
2014-01-06 14:21:12 +00:00
|
|
|
;
|
2014-02-18 11:21:48 +00:00
|
|
|
; !FP: spill R0:1+R4:10 = entsp 2+7
|
|
|
|
; But we dont actually spill or restore R0:1
|
2014-01-06 14:21:12 +00:00
|
|
|
; CHECK-LABEL: Unwind0:
|
2014-02-18 11:21:48 +00:00
|
|
|
; CHECK: entsp 9
|
|
|
|
; CHECK: stw r4, sp[8]
|
|
|
|
; CHECK: stw r5, sp[7]
|
|
|
|
; CHECK: stw r6, sp[6]
|
|
|
|
; CHECK: stw r7, sp[5]
|
|
|
|
; CHECK: stw r8, sp[4]
|
|
|
|
; CHECK: stw r9, sp[3]
|
|
|
|
; CHECK: stw r10, sp[2]
|
|
|
|
; CHECK: ldw r10, sp[2]
|
|
|
|
; CHECK: ldw r9, sp[3]
|
|
|
|
; CHECK: ldw r8, sp[4]
|
|
|
|
; CHECK: ldw r7, sp[5]
|
|
|
|
; CHECK: ldw r6, sp[6]
|
|
|
|
; CHECK: ldw r5, sp[7]
|
|
|
|
; CHECK: ldw r4, sp[8]
|
|
|
|
; CHECK: retsp 9
|
2014-01-06 14:21:12 +00:00
|
|
|
define void @Unwind0() {
|
|
|
|
call void @llvm.eh.unwind.init()
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-02-18 11:21:48 +00:00
|
|
|
; FP: spill FP+SR+R0:1+R4:9+LR = entsp 2+2+6 + extsp 1
|
|
|
|
; But we dont actually spill or restore R0:1
|
2014-01-06 14:21:12 +00:00
|
|
|
; CHECKFP-LABEL: Unwind1:
|
2014-02-18 11:21:48 +00:00
|
|
|
; CHECKFP: entsp 10
|
2014-01-06 14:21:12 +00:00
|
|
|
; CHECKFP: stw r10, sp[1]
|
|
|
|
; CHECKFP: ldaw r10, sp[0]
|
2014-02-18 11:21:48 +00:00
|
|
|
; CHECKFP: stw r4, r10[9]
|
|
|
|
; CHECKFP: stw r5, r10[8]
|
|
|
|
; CHECKFP: stw r6, r10[7]
|
|
|
|
; CHECKFP: stw r7, r10[6]
|
|
|
|
; CHECKFP: stw r8, r10[5]
|
|
|
|
; CHECKFP: stw r9, r10[4]
|
2014-01-06 14:21:12 +00:00
|
|
|
; CHECKFP: extsp 1
|
|
|
|
; CHECKFP: bl foo
|
|
|
|
; CHECKFP: ldaw sp, sp[1]
|
2014-02-18 11:21:48 +00:00
|
|
|
; CHECKFP: ldw r9, r10[4]
|
|
|
|
; CHECKFP: ldw r8, r10[5]
|
|
|
|
; CHECKFP: ldw r7, r10[6]
|
|
|
|
; CHECKFP: ldw r6, r10[7]
|
|
|
|
; CHECKFP: ldw r5, r10[8]
|
|
|
|
; CHECKFP: ldw r4, r10[9]
|
2014-01-06 14:21:12 +00:00
|
|
|
; CHECKFP: set sp, r10
|
|
|
|
; CHECKFP: ldw r10, sp[1]
|
2014-02-18 11:21:48 +00:00
|
|
|
; CHECKFP: retsp 10
|
2014-01-06 14:21:12 +00:00
|
|
|
;
|
2014-02-18 11:21:48 +00:00
|
|
|
; !FP: spill R0:1+R4:10+LR = entsp 2+7+1
|
|
|
|
; But we dont actually spill or restore R0:1
|
2014-01-06 14:21:12 +00:00
|
|
|
; CHECK-LABEL: Unwind1:
|
2014-02-18 11:21:48 +00:00
|
|
|
; CHECK: entsp 10
|
|
|
|
; CHECK: stw r4, sp[9]
|
|
|
|
; CHECK: stw r5, sp[8]
|
|
|
|
; CHECK: stw r6, sp[7]
|
|
|
|
; CHECK: stw r7, sp[6]
|
|
|
|
; CHECK: stw r8, sp[5]
|
|
|
|
; CHECK: stw r9, sp[4]
|
|
|
|
; CHECK: stw r10, sp[3]
|
2014-01-06 14:21:12 +00:00
|
|
|
; CHECK: bl foo
|
2014-02-18 11:21:48 +00:00
|
|
|
; CHECK: ldw r10, sp[3]
|
|
|
|
; CHECK: ldw r9, sp[4]
|
|
|
|
; CHECK: ldw r8, sp[5]
|
|
|
|
; CHECK: ldw r7, sp[6]
|
|
|
|
; CHECK: ldw r6, sp[7]
|
|
|
|
; CHECK: ldw r5, sp[8]
|
|
|
|
; CHECK: ldw r4, sp[9]
|
|
|
|
; CHECK: retsp 10
|
2014-01-06 14:21:12 +00:00
|
|
|
define void @Unwind1() {
|
[opaque pointer type] Add textual IR support for explicit type parameter to the call instruction
See r230786 and r230794 for similar changes to gep and load
respectively.
Call is a bit different because it often doesn't have a single explicit
type - usually the type is deduced from the arguments, and just the
return type is explicit. In those cases there's no need to change the
IR.
When that's not the case, the IR usually contains the pointer type of
the first operand - but since typed pointers are going away, that
representation is insufficient so I'm just stripping the "pointerness"
of the explicit type away.
This does make the IR a bit weird - it /sort of/ reads like the type of
the first operand: "call void () %x(" but %x is actually of type "void
()*" and will eventually be just of type "ptr". But this seems not too
bad and I don't think it would benefit from repeating the type
("void (), void () * %x(" and then eventually "void (), ptr %x(") as has
been done with gep and load.
This also has a side benefit: since the explicit type is no longer a
pointer, there's no ambiguity between an explicit type and a function
that returns a function pointer. Previously this case needed an explicit
type (eg: a function returning a void() function was written as
"call void () () * @x(" rather than "call void () * @x(" because of the
ambiguity between a function returning a pointer to a void() function
and a function returning void).
No ambiguity means even function pointer return types can just be
written alone, without writing the whole function's type.
This leaves /only/ the varargs case where the explicit type is required.
Given the special type syntax in call instructions, the regex-fu used
for migration was a bit more involved in its own unique way (as every
one of these is) so here it is. Use it in conjunction with the apply.sh
script and associated find/xargs commands I've provided in rr230786 to
migrate your out of tree tests. Do let me know if any of this doesn't
cover your cases & we can iterate on a more general script/regexes to
help others with out of tree tests.
About 9 test cases couldn't be automatically migrated - half of those
were functions returning function pointers, where I just had to manually
delete the function argument types now that we didn't need an explicit
function type there. The other half were typedefs of function types used
in calls - just had to manually drop the * from those.
import fileinput
import sys
import re
pat = re.compile(r'((?:=|:|^|\s)call\s(?:[^@]*?))(\s*$|\s*(?:(?:\[\[[a-zA-Z0-9_]+\]\]|[@%](?:(")?[\\\?@a-zA-Z0-9_.]*?(?(3)"|)|{{.*}}))(?:\(|$)|undef|inttoptr|bitcast|null|asm).*$)')
addrspace_end = re.compile(r"addrspace\(\d+\)\s*\*$")
func_end = re.compile("(?:void.*|\)\s*)\*$")
def conv(match, line):
if not match or re.search(addrspace_end, match.group(1)) or not re.search(func_end, match.group(1)):
return line
return line[:match.start()] + match.group(1)[:match.group(1).rfind('*')].rstrip() + match.group(2) + line[match.end():]
for line in sys.stdin:
sys.stdout.write(conv(re.search(pat, line), line))
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235145 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-16 23:24:18 +00:00
|
|
|
call void (...) @foo()
|
2014-01-06 14:21:12 +00:00
|
|
|
call void @llvm.eh.unwind.init()
|
|
|
|
ret void
|
|
|
|
}
|
2014-02-18 11:21:48 +00:00
|
|
|
|
|
|
|
; FP: spill FP+SR+R0:1+R4:9 = entsp 2+2+6
|
|
|
|
; We dont spill R0:1
|
|
|
|
; We only restore R0:1 during eh.return
|
|
|
|
; CHECKFP-LABEL: UnwindEH:
|
|
|
|
; CHECKFP: entsp 10
|
|
|
|
; CHECKFP: .cfi_def_cfa_offset 40
|
|
|
|
; CHECKFP: .cfi_offset 15, 0
|
|
|
|
; CHECKFP: stw r10, sp[1]
|
|
|
|
; CHECKFP: .cfi_offset 10, -36
|
|
|
|
; CHECKFP: ldaw r10, sp[0]
|
|
|
|
; CHECKFP: .cfi_def_cfa_register 10
|
|
|
|
; CHECKFP: .cfi_offset 1, -32
|
|
|
|
; CHECKFP: .cfi_offset 0, -28
|
|
|
|
; CHECKFP: stw r4, r10[9]
|
|
|
|
; CHECKFP: .cfi_offset 4, -4
|
|
|
|
; CHECKFP: stw r5, r10[8]
|
|
|
|
; CHECKFP: .cfi_offset 5, -8
|
|
|
|
; CHECKFP: stw r6, r10[7]
|
|
|
|
; CHECKFP: .cfi_offset 6, -12
|
|
|
|
; CHECKFP: stw r7, r10[6]
|
|
|
|
; CHECKFP: .cfi_offset 7, -16
|
|
|
|
; CHECKFP: stw r8, r10[5]
|
|
|
|
; CHECKFP: .cfi_offset 8, -20
|
|
|
|
; CHECKFP: stw r9, r10[4]
|
|
|
|
; CHECKFP: .cfi_offset 9, -24
|
|
|
|
; CHECKFP: bt r0, .LBB{{[0-9_]+}}
|
|
|
|
; CHECKFP: ldw r9, r10[4]
|
|
|
|
; CHECKFP-NEXT: ldw r8, r10[5]
|
|
|
|
; CHECKFP-NEXT: ldw r7, r10[6]
|
|
|
|
; CHECKFP-NEXT: ldw r6, r10[7]
|
|
|
|
; CHECKFP-NEXT: ldw r5, r10[8]
|
|
|
|
; CHECKFP-NEXT: ldw r4, r10[9]
|
|
|
|
; CHECKFP-NEXT: set sp, r10
|
|
|
|
; CHECKFP-NEXT: ldw r10, sp[1]
|
|
|
|
; CHECKFP-NEXT: retsp 10
|
|
|
|
; CHECKFP: .LBB{{[0-9_]+}}
|
|
|
|
; CHECKFP-NEXT: ldc r2, 40
|
|
|
|
; CHECKFP-NEXT: add r2, r10, r2
|
2014-04-21 17:57:07 +00:00
|
|
|
; CHECKFP-NEXT: add r2, r2, r0
|
2014-02-18 11:21:48 +00:00
|
|
|
; CHECKFP-NEXT: mov r3, r1
|
|
|
|
; CHECKFP-NEXT: ldw r9, r10[4]
|
|
|
|
; CHECKFP-NEXT: ldw r8, r10[5]
|
|
|
|
; CHECKFP-NEXT: ldw r7, r10[6]
|
|
|
|
; CHECKFP-NEXT: ldw r6, r10[7]
|
|
|
|
; CHECKFP-NEXT: ldw r5, r10[8]
|
|
|
|
; CHECKFP-NEXT: ldw r4, r10[9]
|
|
|
|
; CHECKFP-NEXT: ldw r1, sp[2]
|
|
|
|
; CHECKFP-NEXT: ldw r0, sp[3]
|
|
|
|
; CHECKFP-NEXT: set sp, r2
|
|
|
|
; CHECKFP-NEXT: bau r3
|
|
|
|
;
|
|
|
|
; !FP: spill R0:1+R4:10 = entsp 2+7
|
|
|
|
; We dont spill R0:1
|
|
|
|
; We only restore R0:1 during eh.return
|
|
|
|
; CHECK-LABEL: UnwindEH:
|
|
|
|
; CHECK: entsp 9
|
|
|
|
; CHECK: .cfi_def_cfa_offset 36
|
|
|
|
; CHECK: .cfi_offset 15, 0
|
|
|
|
; CHECK: .cfi_offset 1, -36
|
|
|
|
; CHECK: .cfi_offset 0, -32
|
|
|
|
; CHECK: stw r4, sp[8]
|
|
|
|
; CHECK: .cfi_offset 4, -4
|
|
|
|
; CHECK: stw r5, sp[7]
|
|
|
|
; CHECK: .cfi_offset 5, -8
|
|
|
|
; CHECK: stw r6, sp[6]
|
|
|
|
; CHECK: .cfi_offset 6, -12
|
|
|
|
; CHECK: stw r7, sp[5]
|
|
|
|
; CHECK: .cfi_offset 7, -16
|
|
|
|
; CHECK: stw r8, sp[4]
|
|
|
|
; CHECK: .cfi_offset 8, -20
|
|
|
|
; CHECK: stw r9, sp[3]
|
|
|
|
; CHECK: .cfi_offset 9, -24
|
|
|
|
; CHECK: stw r10, sp[2]
|
|
|
|
; CHECK: .cfi_offset 10, -28
|
|
|
|
; CHECK: bt r0, .LBB{{[0-9_]+}}
|
|
|
|
; CHECK: ldw r10, sp[2]
|
|
|
|
; CHECK-NEXT: ldw r9, sp[3]
|
|
|
|
; CHECK-NEXT: ldw r8, sp[4]
|
|
|
|
; CHECK-NEXT: ldw r7, sp[5]
|
|
|
|
; CHECK-NEXT: ldw r6, sp[6]
|
|
|
|
; CHECK-NEXT: ldw r5, sp[7]
|
|
|
|
; CHECK-NEXT: ldw r4, sp[8]
|
|
|
|
; CHECK-NEXT: retsp 9
|
|
|
|
; CHECK: .LBB{{[0-9_]+}}
|
|
|
|
; CHECK-NEXT: ldc r2, 36
|
|
|
|
; CHECK-NEXT: ldaw r3, sp[0]
|
|
|
|
; CHECK-NEXT: add r2, r3, r2
|
2014-04-21 17:57:07 +00:00
|
|
|
; CHECK-NEXT: add r2, r2, r0
|
2014-02-18 11:21:48 +00:00
|
|
|
; CHECK-NEXT: mov r3, r1
|
|
|
|
; CHECK-NEXT: ldw r10, sp[2]
|
|
|
|
; CHECK-NEXT: ldw r9, sp[3]
|
|
|
|
; CHECK-NEXT: ldw r8, sp[4]
|
|
|
|
; CHECK-NEXT: ldw r7, sp[5]
|
|
|
|
; CHECK-NEXT: ldw r6, sp[6]
|
|
|
|
; CHECK-NEXT: ldw r5, sp[7]
|
|
|
|
; CHECK-NEXT: ldw r4, sp[8]
|
|
|
|
; CHECK-NEXT: ldw r1, sp[0]
|
|
|
|
; CHECK-NEXT: ldw r0, sp[1]
|
|
|
|
; CHECK-NEXT: set sp, r2
|
|
|
|
; CHECK-NEXT: bau r3
|
|
|
|
define void @UnwindEH(i32 %offset, i8* %handler) {
|
|
|
|
call void @llvm.eh.unwind.init()
|
|
|
|
%cmp = icmp eq i32 %offset, 0
|
|
|
|
br i1 %cmp, label %normal, label %eh
|
|
|
|
eh:
|
|
|
|
call void @llvm.eh.return.i32(i32 %offset, i8* %handler)
|
|
|
|
unreachable
|
|
|
|
normal:
|
|
|
|
ret void
|
|
|
|
}
|