2019-01-14 18:55:55 +08:00
|
|
|
; RUN: llc < %s -mtriple=x86_64-apple-darwin -frame-pointer=all | FileCheck %s
|
|
|
|
; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=corei7 -frame-pointer=all | FileCheck --check-prefix=SSE %s
|
|
|
|
; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=corei7-avx -frame-pointer=all | FileCheck --check-prefix=AVX %s
|
2014-01-11 09:00:27 +08:00
|
|
|
|
2013-11-09 07:28:16 +08:00
|
|
|
|
|
|
|
; Stackmap Header: no constants - 6 callsites
|
2014-01-31 02:58:27 +08:00
|
|
|
; CHECK-LABEL: .section __LLVM_STACKMAPS,__llvm_stackmaps
|
|
|
|
; CHECK-NEXT: __LLVM_StackMaps:
|
2013-11-09 07:28:16 +08:00
|
|
|
; Header
|
2017-04-28 12:48:42 +08:00
|
|
|
; CHECK-NEXT: .byte 3
|
2014-04-01 06:14:04 +08:00
|
|
|
; CHECK-NEXT: .byte 0
|
|
|
|
; CHECK-NEXT: .short 0
|
2014-01-31 02:58:27 +08:00
|
|
|
; Num Functions
|
|
|
|
; CHECK-NEXT: .long 8
|
2013-11-09 07:28:16 +08:00
|
|
|
; Num Constants
|
2014-04-01 06:14:04 +08:00
|
|
|
; CHECK-NEXT: .long 0
|
2013-11-09 07:28:16 +08:00
|
|
|
; Num Callsites
|
2014-04-01 06:14:04 +08:00
|
|
|
; CHECK-NEXT: .long 8
|
|
|
|
|
|
|
|
; Functions and stack size
|
|
|
|
; CHECK-NEXT: .quad _test
|
|
|
|
; CHECK-NEXT: .quad 8
|
2016-09-15 04:22:03 +08:00
|
|
|
; CHECK-NEXT: .quad 1
|
2014-04-01 06:14:04 +08:00
|
|
|
; CHECK-NEXT: .quad _property_access1
|
|
|
|
; CHECK-NEXT: .quad 8
|
2016-09-15 04:22:03 +08:00
|
|
|
; CHECK-NEXT: .quad 1
|
2014-04-01 06:14:04 +08:00
|
|
|
; CHECK-NEXT: .quad _property_access2
|
|
|
|
; CHECK-NEXT: .quad 24
|
2016-09-15 04:22:03 +08:00
|
|
|
; CHECK-NEXT: .quad 1
|
2014-04-01 06:14:04 +08:00
|
|
|
; CHECK-NEXT: .quad _property_access3
|
|
|
|
; CHECK-NEXT: .quad 24
|
2016-09-15 04:22:03 +08:00
|
|
|
; CHECK-NEXT: .quad 1
|
2014-04-01 06:14:04 +08:00
|
|
|
; CHECK-NEXT: .quad _anyreg_test1
|
|
|
|
; CHECK-NEXT: .quad 56
|
2016-09-15 04:22:03 +08:00
|
|
|
; CHECK-NEXT: .quad 1
|
2014-04-01 06:14:04 +08:00
|
|
|
; CHECK-NEXT: .quad _anyreg_test2
|
2016-12-13 09:38:41 +08:00
|
|
|
; CHECK-NEXT: .quad 8
|
2016-09-15 04:22:03 +08:00
|
|
|
; CHECK-NEXT: .quad 1
|
2014-04-01 06:14:04 +08:00
|
|
|
; CHECK-NEXT: .quad _patchpoint_spilldef
|
|
|
|
; CHECK-NEXT: .quad 56
|
2016-09-15 04:22:03 +08:00
|
|
|
; CHECK-NEXT: .quad 1
|
2014-04-01 06:14:04 +08:00
|
|
|
; CHECK-NEXT: .quad _patchpoint_spillargs
|
|
|
|
; CHECK-NEXT: .quad 88
|
2016-09-15 04:22:03 +08:00
|
|
|
; CHECK-NEXT: .quad 1
|
2014-04-01 06:14:04 +08:00
|
|
|
|
|
|
|
; No constants
|
2013-11-09 07:28:16 +08:00
|
|
|
|
2014-04-01 06:14:04 +08:00
|
|
|
; Callsites
|
2013-11-09 07:28:16 +08:00
|
|
|
; test
|
2013-11-12 06:40:25 +08:00
|
|
|
; CHECK-LABEL: .long L{{.*}}-_test
|
2013-11-09 07:28:16 +08:00
|
|
|
; CHECK-NEXT: .short 0
|
|
|
|
; 3 locations
|
|
|
|
; CHECK-NEXT: .short 3
|
|
|
|
; Loc 0: Register
|
|
|
|
; CHECK-NEXT: .byte 1
|
2017-04-28 12:48:42 +08:00
|
|
|
; CHECK-NEXT: .byte 0
|
|
|
|
; CHECK-NEXT: .short 4
|
2013-11-09 07:28:16 +08:00
|
|
|
; CHECK-NEXT: .short {{[0-9]+}}
|
2017-04-28 12:48:42 +08:00
|
|
|
; CHECK-NEXT: .short 0
|
2013-11-09 07:28:16 +08:00
|
|
|
; CHECK-NEXT: .long 0
|
|
|
|
; Loc 1: Register
|
|
|
|
; CHECK-NEXT: .byte 1
|
2017-04-28 12:48:42 +08:00
|
|
|
; CHECK-NEXT: .byte 0
|
|
|
|
; CHECK-NEXT: .short 4
|
2013-11-09 07:28:16 +08:00
|
|
|
; CHECK-NEXT: .short {{[0-9]+}}
|
2017-04-28 12:48:42 +08:00
|
|
|
; CHECK-NEXT: .short 0
|
2013-11-09 07:28:16 +08:00
|
|
|
; CHECK-NEXT: .long 0
|
|
|
|
; Loc 2: Constant 3
|
|
|
|
; CHECK-NEXT: .byte 4
|
2017-04-28 12:48:42 +08:00
|
|
|
; CHECK-NEXT: .byte 0
|
|
|
|
; CHECK-NEXT: .short 8
|
2013-11-09 07:28:16 +08:00
|
|
|
; CHECK-NEXT: .short 0
|
2017-04-28 12:48:42 +08:00
|
|
|
; CHECK-NEXT: .short 0
|
2013-11-09 07:28:16 +08:00
|
|
|
; CHECK-NEXT: .long 3
|
|
|
|
define i64 @test() nounwind ssp uwtable {
|
|
|
|
entry:
|
[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))
llvm-svn: 235145
2015-04-17 07:24:18 +08:00
|
|
|
call anyregcc void (i64, i32, i8*, i32, ...) @llvm.experimental.patchpoint.void(i64 0, i32 15, i8* null, i32 2, i32 1, i32 2, i64 3)
|
2013-11-09 07:28:16 +08:00
|
|
|
ret i64 0
|
|
|
|
}
|
|
|
|
|
|
|
|
; property access 1 - %obj is an anyreg call argument and should therefore be in a register
|
2013-11-12 06:40:25 +08:00
|
|
|
; CHECK-LABEL: .long L{{.*}}-_property_access1
|
2013-11-09 07:28:16 +08:00
|
|
|
; CHECK-NEXT: .short 0
|
|
|
|
; 2 locations
|
|
|
|
; CHECK-NEXT: .short 2
|
|
|
|
; Loc 0: Register <-- this is the return register
|
|
|
|
; CHECK-NEXT: .byte 1
|
2017-04-28 12:48:42 +08:00
|
|
|
; CHECK-NEXT: .byte 0
|
|
|
|
; CHECK-NEXT: .short 8
|
2013-11-09 07:28:16 +08:00
|
|
|
; CHECK-NEXT: .short {{[0-9]+}}
|
2017-04-28 12:48:42 +08:00
|
|
|
; CHECK-NEXT: .short 0
|
2013-11-09 07:28:16 +08:00
|
|
|
; CHECK-NEXT: .long 0
|
|
|
|
; Loc 1: Register
|
|
|
|
; CHECK-NEXT: .byte 1
|
2017-04-28 12:48:42 +08:00
|
|
|
; CHECK-NEXT: .byte 0
|
|
|
|
; CHECK-NEXT: .short 8
|
2013-11-09 07:28:16 +08:00
|
|
|
; CHECK-NEXT: .short {{[0-9]+}}
|
2017-04-28 12:48:42 +08:00
|
|
|
; CHECK-NEXT: .short 0
|
2013-11-09 07:28:16 +08:00
|
|
|
; CHECK-NEXT: .long 0
|
|
|
|
define i64 @property_access1(i8* %obj) nounwind ssp uwtable {
|
|
|
|
entry:
|
|
|
|
%f = inttoptr i64 12297829382473034410 to i8*
|
[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))
llvm-svn: 235145
2015-04-17 07:24:18 +08:00
|
|
|
%ret = call anyregcc i64 (i64, i32, i8*, i32, ...) @llvm.experimental.patchpoint.i64(i64 1, i32 15, i8* %f, i32 1, i8* %obj)
|
2013-11-09 07:28:16 +08:00
|
|
|
ret i64 %ret
|
|
|
|
}
|
|
|
|
|
|
|
|
; property access 2 - %obj is an anyreg call argument and should therefore be in a register
|
2013-11-12 06:40:25 +08:00
|
|
|
; CHECK-LABEL: .long L{{.*}}-_property_access2
|
2013-11-09 07:28:16 +08:00
|
|
|
; CHECK-NEXT: .short 0
|
|
|
|
; 2 locations
|
|
|
|
; CHECK-NEXT: .short 2
|
|
|
|
; Loc 0: Register <-- this is the return register
|
|
|
|
; CHECK-NEXT: .byte 1
|
2017-04-28 12:48:42 +08:00
|
|
|
; CHECK-NEXT: .byte 0
|
|
|
|
; CHECK-NEXT: .short 8
|
2013-11-09 07:28:16 +08:00
|
|
|
; CHECK-NEXT: .short {{[0-9]+}}
|
2017-04-28 12:48:42 +08:00
|
|
|
; CHECK-NEXT: .short 0
|
2013-11-09 07:28:16 +08:00
|
|
|
; CHECK-NEXT: .long 0
|
|
|
|
; Loc 1: Register
|
|
|
|
; CHECK-NEXT: .byte 1
|
2017-04-28 12:48:42 +08:00
|
|
|
; CHECK-NEXT: .byte 0
|
|
|
|
; CHECK-NEXT: .short 8
|
2013-11-09 07:28:16 +08:00
|
|
|
; CHECK-NEXT: .short {{[0-9]+}}
|
2017-04-28 12:48:42 +08:00
|
|
|
; CHECK-NEXT: .short 0
|
2013-11-09 07:28:16 +08:00
|
|
|
; CHECK-NEXT: .long 0
|
|
|
|
define i64 @property_access2() nounwind ssp uwtable {
|
|
|
|
entry:
|
|
|
|
%obj = alloca i64, align 8
|
|
|
|
%f = inttoptr i64 12297829382473034410 to i8*
|
[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))
llvm-svn: 235145
2015-04-17 07:24:18 +08:00
|
|
|
%ret = call anyregcc i64 (i64, i32, i8*, i32, ...) @llvm.experimental.patchpoint.i64(i64 2, i32 15, i8* %f, i32 1, i64* %obj)
|
2013-11-09 07:28:16 +08:00
|
|
|
ret i64 %ret
|
|
|
|
}
|
|
|
|
|
|
|
|
; property access 3 - %obj is a frame index
|
2013-11-12 06:40:25 +08:00
|
|
|
; CHECK-LABEL: .long L{{.*}}-_property_access3
|
2013-11-09 07:28:16 +08:00
|
|
|
; CHECK-NEXT: .short 0
|
|
|
|
; 2 locations
|
|
|
|
; CHECK-NEXT: .short 2
|
|
|
|
; Loc 0: Register <-- this is the return register
|
|
|
|
; CHECK-NEXT: .byte 1
|
2017-04-28 12:48:42 +08:00
|
|
|
; CHECK-NEXT: .byte 0
|
|
|
|
; CHECK-NEXT: .short 8
|
2013-11-09 07:28:16 +08:00
|
|
|
; CHECK-NEXT: .short {{[0-9]+}}
|
2017-04-28 12:48:42 +08:00
|
|
|
; CHECK-NEXT: .short 0
|
2013-11-09 07:28:16 +08:00
|
|
|
; CHECK-NEXT: .long 0
|
2013-11-26 10:03:25 +08:00
|
|
|
; Loc 1: Direct RBP - ofs
|
|
|
|
; CHECK-NEXT: .byte 2
|
2017-04-28 12:48:42 +08:00
|
|
|
; CHECK-NEXT: .byte 0
|
|
|
|
; CHECK-NEXT: .short 8
|
2013-11-26 10:03:25 +08:00
|
|
|
; CHECK-NEXT: .short 6
|
2017-04-28 12:48:42 +08:00
|
|
|
; CHECK-NEXT: .short 0
|
2013-11-26 10:03:25 +08:00
|
|
|
; CHECK-NEXT: .long
|
2013-11-09 07:28:16 +08:00
|
|
|
define i64 @property_access3() nounwind ssp uwtable {
|
|
|
|
entry:
|
|
|
|
%obj = alloca i64, align 8
|
|
|
|
%f = inttoptr i64 12297829382473034410 to i8*
|
[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))
llvm-svn: 235145
2015-04-17 07:24:18 +08:00
|
|
|
%ret = call anyregcc i64 (i64, i32, i8*, i32, ...) @llvm.experimental.patchpoint.i64(i64 3, i32 15, i8* %f, i32 0, i64* %obj)
|
2013-11-09 07:28:16 +08:00
|
|
|
ret i64 %ret
|
|
|
|
}
|
|
|
|
|
|
|
|
; anyreg_test1
|
2013-11-12 06:40:25 +08:00
|
|
|
; CHECK-LABEL: .long L{{.*}}-_anyreg_test1
|
2013-11-09 07:28:16 +08:00
|
|
|
; CHECK-NEXT: .short 0
|
2013-11-09 09:51:33 +08:00
|
|
|
; 14 locations
|
|
|
|
; CHECK-NEXT: .short 14
|
2013-11-09 07:28:16 +08:00
|
|
|
; Loc 0: Register <-- this is the return register
|
|
|
|
; CHECK-NEXT: .byte 1
|
2017-04-28 12:48:42 +08:00
|
|
|
; CHECK-NEXT: .byte 0
|
|
|
|
; CHECK-NEXT: .short 8
|
2013-11-09 07:28:16 +08:00
|
|
|
; CHECK-NEXT: .short {{[0-9]+}}
|
2017-04-28 12:48:42 +08:00
|
|
|
; CHECK-NEXT: .short 0
|
2013-11-09 07:28:16 +08:00
|
|
|
; CHECK-NEXT: .long 0
|
|
|
|
; Loc 1: Register
|
|
|
|
; CHECK-NEXT: .byte 1
|
2017-04-28 12:48:42 +08:00
|
|
|
; CHECK-NEXT: .byte 0
|
|
|
|
; CHECK-NEXT: .short 8
|
2013-11-09 07:28:16 +08:00
|
|
|
; CHECK-NEXT: .short {{[0-9]+}}
|
2017-04-28 12:48:42 +08:00
|
|
|
; CHECK-NEXT: .short 0
|
2013-11-09 07:28:16 +08:00
|
|
|
; CHECK-NEXT: .long 0
|
|
|
|
; Loc 2: Register
|
|
|
|
; CHECK-NEXT: .byte 1
|
2017-04-28 12:48:42 +08:00
|
|
|
; CHECK-NEXT: .byte 0
|
|
|
|
; CHECK-NEXT: .short 8
|
2013-11-09 07:28:16 +08:00
|
|
|
; CHECK-NEXT: .short {{[0-9]+}}
|
2017-04-28 12:48:42 +08:00
|
|
|
; CHECK-NEXT: .short 0
|
2013-11-09 07:28:16 +08:00
|
|
|
; CHECK-NEXT: .long 0
|
|
|
|
; Loc 3: Register
|
|
|
|
; CHECK-NEXT: .byte 1
|
2017-04-28 12:48:42 +08:00
|
|
|
; CHECK-NEXT: .byte 0
|
|
|
|
; CHECK-NEXT: .short 8
|
2013-11-09 07:28:16 +08:00
|
|
|
; CHECK-NEXT: .short {{[0-9]+}}
|
2017-04-28 12:48:42 +08:00
|
|
|
; CHECK-NEXT: .short 0
|
2013-11-09 07:28:16 +08:00
|
|
|
; CHECK-NEXT: .long 0
|
|
|
|
; Loc 4: Register
|
|
|
|
; CHECK-NEXT: .byte 1
|
2017-04-28 12:48:42 +08:00
|
|
|
; CHECK-NEXT: .byte 0
|
|
|
|
; CHECK-NEXT: .short 8
|
2013-11-09 07:28:16 +08:00
|
|
|
; CHECK-NEXT: .short {{[0-9]+}}
|
2017-04-28 12:48:42 +08:00
|
|
|
; CHECK-NEXT: .short 0
|
2013-11-09 07:28:16 +08:00
|
|
|
; CHECK-NEXT: .long 0
|
|
|
|
; Loc 5: Register
|
|
|
|
; CHECK-NEXT: .byte 1
|
2017-04-28 12:48:42 +08:00
|
|
|
; CHECK-NEXT: .byte 0
|
|
|
|
; CHECK-NEXT: .short 8
|
2013-11-09 07:28:16 +08:00
|
|
|
; CHECK-NEXT: .short {{[0-9]+}}
|
2017-04-28 12:48:42 +08:00
|
|
|
; CHECK-NEXT: .short 0
|
2013-11-09 07:28:16 +08:00
|
|
|
; CHECK-NEXT: .long 0
|
|
|
|
; Loc 6: Register
|
|
|
|
; CHECK-NEXT: .byte 1
|
2017-04-28 12:48:42 +08:00
|
|
|
; CHECK-NEXT: .byte 0
|
|
|
|
; CHECK-NEXT: .short 8
|
2013-11-09 07:28:16 +08:00
|
|
|
; CHECK-NEXT: .short {{[0-9]+}}
|
2017-04-28 12:48:42 +08:00
|
|
|
; CHECK-NEXT: .short 0
|
2013-11-09 07:28:16 +08:00
|
|
|
; CHECK-NEXT: .long 0
|
|
|
|
; Loc 7: Register
|
|
|
|
; CHECK-NEXT: .byte 1
|
2017-04-28 12:48:42 +08:00
|
|
|
; CHECK-NEXT: .byte 0
|
|
|
|
; CHECK-NEXT: .short 8
|
2013-11-09 07:28:16 +08:00
|
|
|
; CHECK-NEXT: .short {{[0-9]+}}
|
2017-04-28 12:48:42 +08:00
|
|
|
; CHECK-NEXT: .short 0
|
2013-11-09 07:28:16 +08:00
|
|
|
; CHECK-NEXT: .long 0
|
|
|
|
; Loc 8: Register
|
|
|
|
; CHECK-NEXT: .byte 1
|
2017-04-28 12:48:42 +08:00
|
|
|
; CHECK-NEXT: .byte 0
|
|
|
|
; CHECK-NEXT: .short 8
|
2013-11-09 07:28:16 +08:00
|
|
|
; CHECK-NEXT: .short {{[0-9]+}}
|
2017-04-28 12:48:42 +08:00
|
|
|
; CHECK-NEXT: .short 0
|
2013-11-09 07:28:16 +08:00
|
|
|
; CHECK-NEXT: .long 0
|
|
|
|
; Loc 9: Register
|
|
|
|
; CHECK-NEXT: .byte 1
|
2017-04-28 12:48:42 +08:00
|
|
|
; CHECK-NEXT: .byte 0
|
|
|
|
; CHECK-NEXT: .short 8
|
2013-11-09 07:28:16 +08:00
|
|
|
; CHECK-NEXT: .short {{[0-9]+}}
|
2017-04-28 12:48:42 +08:00
|
|
|
; CHECK-NEXT: .short 0
|
2013-11-09 07:28:16 +08:00
|
|
|
; CHECK-NEXT: .long 0
|
|
|
|
; Loc 10: Register
|
|
|
|
; CHECK-NEXT: .byte 1
|
2017-04-28 12:48:42 +08:00
|
|
|
; CHECK-NEXT: .byte 0
|
|
|
|
; CHECK-NEXT: .short 8
|
2013-11-09 07:28:16 +08:00
|
|
|
; CHECK-NEXT: .short {{[0-9]+}}
|
2017-04-28 12:48:42 +08:00
|
|
|
; CHECK-NEXT: .short 0
|
2013-11-09 07:28:16 +08:00
|
|
|
; CHECK-NEXT: .long 0
|
|
|
|
; Loc 11: Register
|
|
|
|
; CHECK-NEXT: .byte 1
|
2017-04-28 12:48:42 +08:00
|
|
|
; CHECK-NEXT: .byte 0
|
|
|
|
; CHECK-NEXT: .short 8
|
2013-11-09 07:28:16 +08:00
|
|
|
; CHECK-NEXT: .short {{[0-9]+}}
|
2017-04-28 12:48:42 +08:00
|
|
|
; CHECK-NEXT: .short 0
|
2013-11-09 07:28:16 +08:00
|
|
|
; CHECK-NEXT: .long 0
|
|
|
|
; Loc 12: Register
|
|
|
|
; CHECK-NEXT: .byte 1
|
2017-04-28 12:48:42 +08:00
|
|
|
; CHECK-NEXT: .byte 0
|
|
|
|
; CHECK-NEXT: .short 8
|
2013-11-09 07:28:16 +08:00
|
|
|
; CHECK-NEXT: .short {{[0-9]+}}
|
2017-04-28 12:48:42 +08:00
|
|
|
; CHECK-NEXT: .short 0
|
2013-11-09 07:28:16 +08:00
|
|
|
; CHECK-NEXT: .long 0
|
|
|
|
; Loc 13: Register
|
|
|
|
; CHECK-NEXT: .byte 1
|
2017-04-28 12:48:42 +08:00
|
|
|
; CHECK-NEXT: .byte 0
|
|
|
|
; CHECK-NEXT: .short 8
|
2013-11-09 07:28:16 +08:00
|
|
|
; CHECK-NEXT: .short {{[0-9]+}}
|
2017-04-28 12:48:42 +08:00
|
|
|
; CHECK-NEXT: .short 0
|
2013-11-09 07:28:16 +08:00
|
|
|
; CHECK-NEXT: .long 0
|
2013-11-09 09:51:33 +08:00
|
|
|
define i64 @anyreg_test1(i8* %a1, i8* %a2, i8* %a3, i8* %a4, i8* %a5, i8* %a6, i8* %a7, i8* %a8, i8* %a9, i8* %a10, i8* %a11, i8* %a12, i8* %a13) nounwind ssp uwtable {
|
2013-11-09 07:28:16 +08:00
|
|
|
entry:
|
|
|
|
%f = inttoptr i64 12297829382473034410 to i8*
|
[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))
llvm-svn: 235145
2015-04-17 07:24:18 +08:00
|
|
|
%ret = call anyregcc i64 (i64, i32, i8*, i32, ...) @llvm.experimental.patchpoint.i64(i64 4, i32 15, i8* %f, i32 13, i8* %a1, i8* %a2, i8* %a3, i8* %a4, i8* %a5, i8* %a6, i8* %a7, i8* %a8, i8* %a9, i8* %a10, i8* %a11, i8* %a12, i8* %a13)
|
2013-11-09 07:28:16 +08:00
|
|
|
ret i64 %ret
|
|
|
|
}
|
|
|
|
|
|
|
|
; anyreg_test2
|
2013-11-12 06:40:25 +08:00
|
|
|
; CHECK-LABEL: .long L{{.*}}-_anyreg_test2
|
2013-11-09 07:28:16 +08:00
|
|
|
; CHECK-NEXT: .short 0
|
2013-11-09 09:51:33 +08:00
|
|
|
; 14 locations
|
|
|
|
; CHECK-NEXT: .short 14
|
2013-11-09 07:28:16 +08:00
|
|
|
; Loc 0: Register <-- this is the return register
|
|
|
|
; CHECK-NEXT: .byte 1
|
2017-04-28 12:48:42 +08:00
|
|
|
; CHECK-NEXT: .byte 0
|
|
|
|
; CHECK-NEXT: .short 8
|
2013-11-09 07:28:16 +08:00
|
|
|
; CHECK-NEXT: .short {{[0-9]+}}
|
2017-04-28 12:48:42 +08:00
|
|
|
; CHECK-NEXT: .short 0
|
2013-11-09 07:28:16 +08:00
|
|
|
; CHECK-NEXT: .long 0
|
|
|
|
; Loc 1: Register
|
|
|
|
; CHECK-NEXT: .byte 1
|
2017-04-28 12:48:42 +08:00
|
|
|
; CHECK-NEXT: .byte 0
|
|
|
|
; CHECK-NEXT: .short 8
|
2013-11-09 07:28:16 +08:00
|
|
|
; CHECK-NEXT: .short {{[0-9]+}}
|
2017-04-28 12:48:42 +08:00
|
|
|
; CHECK-NEXT: .short 0
|
2013-11-09 07:28:16 +08:00
|
|
|
; CHECK-NEXT: .long 0
|
|
|
|
; Loc 2: Register
|
|
|
|
; CHECK-NEXT: .byte 1
|
2017-04-28 12:48:42 +08:00
|
|
|
; CHECK-NEXT: .byte 0
|
|
|
|
; CHECK-NEXT: .short 8
|
2013-11-09 07:28:16 +08:00
|
|
|
; CHECK-NEXT: .short {{[0-9]+}}
|
2017-04-28 12:48:42 +08:00
|
|
|
; CHECK-NEXT: .short 0
|
2013-11-09 07:28:16 +08:00
|
|
|
; CHECK-NEXT: .long 0
|
|
|
|
; Loc 3: Register
|
|
|
|
; CHECK-NEXT: .byte 1
|
2017-04-28 12:48:42 +08:00
|
|
|
; CHECK-NEXT: .byte 0
|
|
|
|
; CHECK-NEXT: .short 8
|
2013-11-09 07:28:16 +08:00
|
|
|
; CHECK-NEXT: .short {{[0-9]+}}
|
2017-04-28 12:48:42 +08:00
|
|
|
; CHECK-NEXT: .short 0
|
2013-11-09 07:28:16 +08:00
|
|
|
; CHECK-NEXT: .long 0
|
|
|
|
; Loc 4: Register
|
|
|
|
; CHECK-NEXT: .byte 1
|
2017-04-28 12:48:42 +08:00
|
|
|
; CHECK-NEXT: .byte 0
|
|
|
|
; CHECK-NEXT: .short 8
|
2013-11-09 07:28:16 +08:00
|
|
|
; CHECK-NEXT: .short {{[0-9]+}}
|
2017-04-28 12:48:42 +08:00
|
|
|
; CHECK-NEXT: .short 0
|
2013-11-09 07:28:16 +08:00
|
|
|
; CHECK-NEXT: .long 0
|
|
|
|
; Loc 5: Register
|
|
|
|
; CHECK-NEXT: .byte 1
|
2017-04-28 12:48:42 +08:00
|
|
|
; CHECK-NEXT: .byte 0
|
|
|
|
; CHECK-NEXT: .short 8
|
2013-11-09 07:28:16 +08:00
|
|
|
; CHECK-NEXT: .short {{[0-9]+}}
|
2017-04-28 12:48:42 +08:00
|
|
|
; CHECK-NEXT: .short 0
|
2013-11-09 07:28:16 +08:00
|
|
|
; CHECK-NEXT: .long 0
|
|
|
|
; Loc 6: Register
|
|
|
|
; CHECK-NEXT: .byte 1
|
2017-04-28 12:48:42 +08:00
|
|
|
; CHECK-NEXT: .byte 0
|
|
|
|
; CHECK-NEXT: .short 8
|
2013-11-09 07:28:16 +08:00
|
|
|
; CHECK-NEXT: .short {{[0-9]+}}
|
2017-04-28 12:48:42 +08:00
|
|
|
; CHECK-NEXT: .short 0
|
2013-11-09 07:28:16 +08:00
|
|
|
; CHECK-NEXT: .long 0
|
|
|
|
; Loc 7: Register
|
|
|
|
; CHECK-NEXT: .byte 1
|
2017-04-28 12:48:42 +08:00
|
|
|
; CHECK-NEXT: .byte 0
|
|
|
|
; CHECK-NEXT: .short 8
|
2013-11-09 07:28:16 +08:00
|
|
|
; CHECK-NEXT: .short {{[0-9]+}}
|
2017-04-28 12:48:42 +08:00
|
|
|
; CHECK-NEXT: .short 0
|
2013-11-09 07:28:16 +08:00
|
|
|
; CHECK-NEXT: .long 0
|
|
|
|
; Loc 8: Register
|
|
|
|
; CHECK-NEXT: .byte 1
|
2017-04-28 12:48:42 +08:00
|
|
|
; CHECK-NEXT: .byte 0
|
|
|
|
; CHECK-NEXT: .short 8
|
2013-11-09 07:28:16 +08:00
|
|
|
; CHECK-NEXT: .short {{[0-9]+}}
|
2017-04-28 12:48:42 +08:00
|
|
|
; CHECK-NEXT: .short 0
|
2013-11-09 07:28:16 +08:00
|
|
|
; CHECK-NEXT: .long 0
|
2016-12-13 09:38:41 +08:00
|
|
|
; Loc 9: Argument, still on stack
|
|
|
|
; CHECK-NEXT: .byte 3
|
2017-04-28 12:48:42 +08:00
|
|
|
; CHECK-NEXT: .byte 0
|
|
|
|
; CHECK-NEXT: .short 8
|
2016-12-13 09:38:41 +08:00
|
|
|
; CHECK-NEXT: .short 6
|
2017-04-28 12:48:42 +08:00
|
|
|
; CHECK-NEXT: .short 0
|
2016-12-13 09:38:41 +08:00
|
|
|
; CHECK-NEXT: .long
|
|
|
|
; Loc 10: Argument, still on stack
|
|
|
|
; CHECK-NEXT: .byte 3
|
2017-04-28 12:48:42 +08:00
|
|
|
; CHECK-NEXT: .byte 0
|
|
|
|
; CHECK-NEXT: .short 8
|
2016-12-13 09:38:41 +08:00
|
|
|
; CHECK-NEXT: .short 6
|
2017-04-28 12:48:42 +08:00
|
|
|
; CHECK-NEXT: .short 0
|
2016-12-13 09:38:41 +08:00
|
|
|
; CHECK-NEXT: .long
|
|
|
|
; Loc 11: Argument, still on stack
|
|
|
|
; CHECK-NEXT: .byte 3
|
2017-04-28 12:48:42 +08:00
|
|
|
; CHECK-NEXT: .byte 0
|
|
|
|
; CHECK-NEXT: .short 8
|
2016-12-13 09:38:41 +08:00
|
|
|
; CHECK-NEXT: .short 6
|
2017-04-28 12:48:42 +08:00
|
|
|
; CHECK-NEXT: .short 0
|
2016-12-13 09:38:41 +08:00
|
|
|
; CHECK-NEXT: .long
|
|
|
|
; Loc 12: Argument, still on stack
|
|
|
|
; CHECK-NEXT: .byte 3
|
2017-04-28 12:48:42 +08:00
|
|
|
; CHECK-NEXT: .byte 0
|
|
|
|
; CHECK-NEXT: .short 8
|
2016-12-13 09:38:41 +08:00
|
|
|
; CHECK-NEXT: .short 6
|
2017-04-28 12:48:42 +08:00
|
|
|
; CHECK-NEXT: .short 0
|
2016-12-13 09:38:41 +08:00
|
|
|
; CHECK-NEXT: .long
|
|
|
|
; Loc 13: Argument, still on stack
|
|
|
|
; CHECK-NEXT: .byte 3
|
2017-04-28 12:48:42 +08:00
|
|
|
; CHECK-NEXT: .byte 0
|
|
|
|
; CHECK-NEXT: .short 8
|
2016-12-13 09:38:41 +08:00
|
|
|
; CHECK-NEXT: .short 6
|
2017-04-28 12:48:42 +08:00
|
|
|
; CHECK-NEXT: .short 0
|
2016-12-13 09:38:41 +08:00
|
|
|
; CHECK-NEXT: .long
|
2013-11-09 09:51:33 +08:00
|
|
|
define i64 @anyreg_test2(i8* %a1, i8* %a2, i8* %a3, i8* %a4, i8* %a5, i8* %a6, i8* %a7, i8* %a8, i8* %a9, i8* %a10, i8* %a11, i8* %a12, i8* %a13) nounwind ssp uwtable {
|
2013-11-09 07:28:16 +08:00
|
|
|
entry:
|
|
|
|
%f = inttoptr i64 12297829382473034410 to i8*
|
[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))
llvm-svn: 235145
2015-04-17 07:24:18 +08:00
|
|
|
%ret = call anyregcc i64 (i64, i32, i8*, i32, ...) @llvm.experimental.patchpoint.i64(i64 5, i32 15, i8* %f, i32 8, i8* %a1, i8* %a2, i8* %a3, i8* %a4, i8* %a5, i8* %a6, i8* %a7, i8* %a8, i8* %a9, i8* %a10, i8* %a11, i8* %a12, i8* %a13)
|
2013-11-09 07:28:16 +08:00
|
|
|
ret i64 %ret
|
|
|
|
}
|
|
|
|
|
2013-11-12 06:40:25 +08:00
|
|
|
; Test spilling the return value of an anyregcc call.
|
|
|
|
;
|
|
|
|
; <rdar://problem/15432754> [JS] Assertion: "Folded a def to a non-store!"
|
|
|
|
;
|
|
|
|
; CHECK-LABEL: .long L{{.*}}-_patchpoint_spilldef
|
|
|
|
; CHECK-NEXT: .short 0
|
|
|
|
; CHECK-NEXT: .short 3
|
|
|
|
; Loc 0: Register (some register that will be spilled to the stack)
|
|
|
|
; CHECK-NEXT: .byte 1
|
2017-04-28 12:48:42 +08:00
|
|
|
; CHECK-NEXT: .byte 0
|
|
|
|
; CHECK-NEXT: .short 8
|
2013-11-12 06:40:25 +08:00
|
|
|
; CHECK-NEXT: .short {{[0-9]+}}
|
2017-04-28 12:48:42 +08:00
|
|
|
; CHECK-NEXT: .short 0
|
2013-11-12 06:40:25 +08:00
|
|
|
; CHECK-NEXT: .long 0
|
|
|
|
; Loc 1: Register RDI
|
|
|
|
; CHECK-NEXT: .byte 1
|
2017-04-28 12:48:42 +08:00
|
|
|
; CHECK-NEXT: .byte 0
|
|
|
|
; CHECK-NEXT: .short 8
|
2013-11-12 06:40:25 +08:00
|
|
|
; CHECK-NEXT: .short 5
|
2017-04-28 12:48:42 +08:00
|
|
|
; CHECK-NEXT: .short 0
|
2013-11-12 06:40:25 +08:00
|
|
|
; CHECK-NEXT: .long 0
|
|
|
|
; Loc 1: Register RSI
|
|
|
|
; CHECK-NEXT: .byte 1
|
2017-04-28 12:48:42 +08:00
|
|
|
; CHECK-NEXT: .byte 0
|
|
|
|
; CHECK-NEXT: .short 8
|
2013-11-12 06:40:25 +08:00
|
|
|
; CHECK-NEXT: .short 4
|
2017-04-28 12:48:42 +08:00
|
|
|
; CHECK-NEXT: .short 0
|
2013-11-12 06:40:25 +08:00
|
|
|
; CHECK-NEXT: .long 0
|
|
|
|
define i64 @patchpoint_spilldef(i64 %p1, i64 %p2, i64 %p3, i64 %p4) {
|
|
|
|
entry:
|
[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))
llvm-svn: 235145
2015-04-17 07:24:18 +08:00
|
|
|
%result = tail call anyregcc i64 (i64, i32, i8*, i32, ...) @llvm.experimental.patchpoint.i64(i64 12, i32 15, i8* inttoptr (i64 0 to i8*), i32 2, i64 %p1, i64 %p2)
|
2013-11-12 06:40:25 +08:00
|
|
|
tail call void asm sideeffect "nop", "~{ax},~{bx},~{cx},~{dx},~{bp},~{si},~{di},~{r8},~{r9},~{r10},~{r11},~{r12},~{r13},~{r14},~{r15}"() nounwind
|
|
|
|
ret i64 %result
|
|
|
|
}
|
|
|
|
|
2013-11-19 11:29:59 +08:00
|
|
|
; Test spilling the arguments of an anyregcc call.
|
|
|
|
;
|
|
|
|
; <rdar://problem/15487687> [JS] AnyRegCC argument ends up being spilled
|
|
|
|
;
|
|
|
|
; CHECK-LABEL: .long L{{.*}}-_patchpoint_spillargs
|
|
|
|
; CHECK-NEXT: .short 0
|
|
|
|
; CHECK-NEXT: .short 5
|
|
|
|
; Loc 0: Return a register
|
|
|
|
; CHECK-NEXT: .byte 1
|
2017-04-28 12:48:42 +08:00
|
|
|
; CHECK-NEXT: .byte 0
|
|
|
|
; CHECK-NEXT: .short 8
|
2013-11-19 11:29:59 +08:00
|
|
|
; CHECK-NEXT: .short {{[0-9]+}}
|
2017-04-28 12:48:42 +08:00
|
|
|
; CHECK-NEXT: .short 0
|
2013-11-19 11:29:59 +08:00
|
|
|
; CHECK-NEXT: .long 0
|
|
|
|
; Loc 1: Arg0 in a Register
|
|
|
|
; CHECK-NEXT: .byte 1
|
2017-04-28 12:48:42 +08:00
|
|
|
; CHECK-NEXT: .byte 0
|
|
|
|
; CHECK-NEXT: .short 8
|
2013-11-19 11:29:59 +08:00
|
|
|
; CHECK-NEXT: .short {{[0-9]+}}
|
2017-04-28 12:48:42 +08:00
|
|
|
; CHECK-NEXT: .short 0
|
2013-11-19 11:29:59 +08:00
|
|
|
; CHECK-NEXT: .long 0
|
|
|
|
; Loc 2: Arg1 in a Register
|
|
|
|
; CHECK-NEXT: .byte 1
|
2017-04-28 12:48:42 +08:00
|
|
|
; CHECK-NEXT: .byte 0
|
|
|
|
; CHECK-NEXT: .short 8
|
2013-11-19 11:29:59 +08:00
|
|
|
; CHECK-NEXT: .short {{[0-9]+}}
|
2017-04-28 12:48:42 +08:00
|
|
|
; CHECK-NEXT: .short 0
|
2013-11-19 11:29:59 +08:00
|
|
|
; CHECK-NEXT: .long 0
|
|
|
|
; Loc 3: Arg2 spilled to RBP +
|
|
|
|
; CHECK-NEXT: .byte 3
|
2017-04-28 12:48:42 +08:00
|
|
|
; CHECK-NEXT: .byte 0
|
|
|
|
; CHECK-NEXT: .short 8
|
2013-11-26 10:03:25 +08:00
|
|
|
; CHECK-NEXT: .short 6
|
2017-04-28 12:48:42 +08:00
|
|
|
; CHECK-NEXT: .short 0
|
2013-11-26 10:03:25 +08:00
|
|
|
; CHECK-NEXT: .long
|
2013-11-19 11:29:59 +08:00
|
|
|
; Loc 4: Arg3 spilled to RBP +
|
|
|
|
; CHECK-NEXT: .byte 3
|
2017-04-28 12:48:42 +08:00
|
|
|
; CHECK-NEXT: .byte 0
|
|
|
|
; CHECK-NEXT: .short 8
|
2013-11-26 10:03:25 +08:00
|
|
|
; CHECK-NEXT: .short 6
|
2017-04-28 12:48:42 +08:00
|
|
|
; CHECK-NEXT: .short 0
|
2013-11-26 10:03:25 +08:00
|
|
|
; CHECK-NEXT: .long
|
2013-11-19 11:29:59 +08:00
|
|
|
define i64 @patchpoint_spillargs(i64 %p1, i64 %p2, i64 %p3, i64 %p4) {
|
|
|
|
entry:
|
|
|
|
tail call void asm sideeffect "nop", "~{ax},~{bx},~{cx},~{dx},~{bp},~{si},~{di},~{r8},~{r9},~{r10},~{r11},~{r12},~{r13},~{r14},~{r15}"() nounwind
|
[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))
llvm-svn: 235145
2015-04-17 07:24:18 +08:00
|
|
|
%result = tail call anyregcc i64 (i64, i32, i8*, i32, ...) @llvm.experimental.patchpoint.i64(i64 13, i32 15, i8* inttoptr (i64 0 to i8*), i32 2, i64 %p1, i64 %p2, i64 %p3, i64 %p4)
|
2013-11-19 11:29:59 +08:00
|
|
|
ret i64 %result
|
|
|
|
}
|
|
|
|
|
2014-01-11 09:00:27 +08:00
|
|
|
; Make sure all regs are spilled
|
|
|
|
define anyregcc void @anyregcc1() {
|
|
|
|
entry:
|
|
|
|
;SSE-LABEL: anyregcc1
|
2014-01-30 11:34:02 +08:00
|
|
|
;SSE: pushq %rbp
|
2014-01-31 02:58:27 +08:00
|
|
|
;SSE: pushq %rax
|
2014-01-11 09:00:27 +08:00
|
|
|
;SSE: pushq %r15
|
|
|
|
;SSE: pushq %r14
|
|
|
|
;SSE: pushq %r13
|
|
|
|
;SSE: pushq %r12
|
|
|
|
;SSE: pushq %r11
|
|
|
|
;SSE: pushq %r10
|
|
|
|
;SSE: pushq %r9
|
|
|
|
;SSE: pushq %r8
|
|
|
|
;SSE: pushq %rdi
|
|
|
|
;SSE: pushq %rsi
|
|
|
|
;SSE: pushq %rdx
|
|
|
|
;SSE: pushq %rcx
|
|
|
|
;SSE: pushq %rbx
|
|
|
|
;SSE: movaps %xmm15
|
|
|
|
;SSE-NEXT: movaps %xmm14
|
|
|
|
;SSE-NEXT: movaps %xmm13
|
|
|
|
;SSE-NEXT: movaps %xmm12
|
|
|
|
;SSE-NEXT: movaps %xmm11
|
|
|
|
;SSE-NEXT: movaps %xmm10
|
|
|
|
;SSE-NEXT: movaps %xmm9
|
|
|
|
;SSE-NEXT: movaps %xmm8
|
|
|
|
;SSE-NEXT: movaps %xmm7
|
|
|
|
;SSE-NEXT: movaps %xmm6
|
|
|
|
;SSE-NEXT: movaps %xmm5
|
|
|
|
;SSE-NEXT: movaps %xmm4
|
|
|
|
;SSE-NEXT: movaps %xmm3
|
|
|
|
;SSE-NEXT: movaps %xmm2
|
|
|
|
;SSE-NEXT: movaps %xmm1
|
|
|
|
;SSE-NEXT: movaps %xmm0
|
|
|
|
;AVX-LABEL:anyregcc1
|
2014-01-30 11:34:02 +08:00
|
|
|
;AVX: pushq %rbp
|
2014-01-31 02:58:27 +08:00
|
|
|
;AVX: pushq %rax
|
2014-01-11 09:00:27 +08:00
|
|
|
;AVX: pushq %r15
|
|
|
|
;AVX: pushq %r14
|
|
|
|
;AVX: pushq %r13
|
|
|
|
;AVX: pushq %r12
|
|
|
|
;AVX: pushq %r11
|
|
|
|
;AVX: pushq %r10
|
|
|
|
;AVX: pushq %r9
|
|
|
|
;AVX: pushq %r8
|
|
|
|
;AVX: pushq %rdi
|
|
|
|
;AVX: pushq %rsi
|
|
|
|
;AVX: pushq %rdx
|
|
|
|
;AVX: pushq %rcx
|
|
|
|
;AVX: pushq %rbx
|
2014-01-31 02:58:27 +08:00
|
|
|
;AVX: vmovaps %ymm15
|
|
|
|
;AVX-NEXT: vmovaps %ymm14
|
|
|
|
;AVX-NEXT: vmovaps %ymm13
|
|
|
|
;AVX-NEXT: vmovaps %ymm12
|
|
|
|
;AVX-NEXT: vmovaps %ymm11
|
|
|
|
;AVX-NEXT: vmovaps %ymm10
|
|
|
|
;AVX-NEXT: vmovaps %ymm9
|
|
|
|
;AVX-NEXT: vmovaps %ymm8
|
|
|
|
;AVX-NEXT: vmovaps %ymm7
|
|
|
|
;AVX-NEXT: vmovaps %ymm6
|
|
|
|
;AVX-NEXT: vmovaps %ymm5
|
|
|
|
;AVX-NEXT: vmovaps %ymm4
|
|
|
|
;AVX-NEXT: vmovaps %ymm3
|
|
|
|
;AVX-NEXT: vmovaps %ymm2
|
|
|
|
;AVX-NEXT: vmovaps %ymm1
|
|
|
|
;AVX-NEXT: vmovaps %ymm0
|
2014-01-11 09:00:27 +08:00
|
|
|
call void asm sideeffect "", "~{rax},~{rbx},~{rcx},~{rdx},~{rsi},~{rdi},~{r8},~{r9},~{r10},~{r11},~{r12},~{r13},~{r14},~{r15},~{rbp},~{xmm0},~{xmm1},~{xmm2},~{xmm3},~{xmm4},~{xmm5},~{xmm6},~{xmm7},~{xmm8},~{xmm9},~{xmm10},~{xmm11},~{xmm12},~{xmm13},~{xmm14},~{xmm15}"()
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; Make sure we don't spill any XMMs/YMMs
|
|
|
|
declare anyregcc void @foo()
|
|
|
|
define void @anyregcc2() {
|
|
|
|
entry:
|
|
|
|
;SSE-LABEL: anyregcc2
|
|
|
|
;SSE-NOT: movaps %xmm
|
|
|
|
;AVX-LABEL: anyregcc2
|
|
|
|
;AVX-NOT: vmovups %ymm
|
|
|
|
%a0 = call <2 x double> asm sideeffect "", "={xmm0}"() nounwind
|
|
|
|
%a1 = call <2 x double> asm sideeffect "", "={xmm1}"() nounwind
|
|
|
|
%a2 = call <2 x double> asm sideeffect "", "={xmm2}"() nounwind
|
|
|
|
%a3 = call <2 x double> asm sideeffect "", "={xmm3}"() nounwind
|
|
|
|
%a4 = call <2 x double> asm sideeffect "", "={xmm4}"() nounwind
|
|
|
|
%a5 = call <2 x double> asm sideeffect "", "={xmm5}"() nounwind
|
|
|
|
%a6 = call <2 x double> asm sideeffect "", "={xmm6}"() nounwind
|
|
|
|
%a7 = call <2 x double> asm sideeffect "", "={xmm7}"() nounwind
|
|
|
|
%a8 = call <2 x double> asm sideeffect "", "={xmm8}"() nounwind
|
|
|
|
%a9 = call <2 x double> asm sideeffect "", "={xmm9}"() nounwind
|
|
|
|
%a10 = call <2 x double> asm sideeffect "", "={xmm10}"() nounwind
|
|
|
|
%a11 = call <2 x double> asm sideeffect "", "={xmm11}"() nounwind
|
|
|
|
%a12 = call <2 x double> asm sideeffect "", "={xmm12}"() nounwind
|
|
|
|
%a13 = call <2 x double> asm sideeffect "", "={xmm13}"() nounwind
|
|
|
|
%a14 = call <2 x double> asm sideeffect "", "={xmm14}"() nounwind
|
|
|
|
%a15 = call <2 x double> asm sideeffect "", "={xmm15}"() nounwind
|
|
|
|
call anyregcc void @foo()
|
|
|
|
call void asm sideeffect "", "{xmm0},{xmm1},{xmm2},{xmm3},{xmm4},{xmm5},{xmm6},{xmm7},{xmm8},{xmm9},{xmm10},{xmm11},{xmm12},{xmm13},{xmm14},{xmm15}"(<2 x double> %a0, <2 x double> %a1, <2 x double> %a2, <2 x double> %a3, <2 x double> %a4, <2 x double> %a5, <2 x double> %a6, <2 x double> %a7, <2 x double> %a8, <2 x double> %a9, <2 x double> %a10, <2 x double> %a11, <2 x double> %a12, <2 x double> %a13, <2 x double> %a14, <2 x double> %a15)
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2013-12-14 02:37:10 +08:00
|
|
|
declare void @llvm.experimental.patchpoint.void(i64, i32, i8*, i32, ...)
|
|
|
|
declare i64 @llvm.experimental.patchpoint.i64(i64, i32, i8*, i32, ...)
|