summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/SPARC
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2015-04-16 23:24:18 +0000
committerDavid Blaikie <dblaikie@gmail.com>2015-04-16 23:24:18 +0000
commit23af64846f29e8249c717cad08ae64afc2ba647b (patch)
tree0748fde05fcaace0e05cbb14d32cd1300c257363 /llvm/test/CodeGen/SPARC
parente68c0085199bb4e1aa036023952a0ece59afeaea (diff)
downloadbcm5719-llvm-23af64846f29e8249c717cad08ae64afc2ba647b.tar.gz
bcm5719-llvm-23af64846f29e8249c717cad08ae64afc2ba647b.zip
[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
Diffstat (limited to 'llvm/test/CodeGen/SPARC')
-rw-r--r--llvm/test/CodeGen/SPARC/2008-10-10-InlineAsmRegOperand.ll2
-rw-r--r--llvm/test/CodeGen/SPARC/2011-01-11-Call.ll6
-rw-r--r--llvm/test/CodeGen/SPARC/2011-01-19-DelaySlot.ll2
-rw-r--r--llvm/test/CodeGen/SPARC/64abi.ll2
-rw-r--r--llvm/test/CodeGen/SPARC/setjmp.ll2
-rw-r--r--llvm/test/CodeGen/SPARC/varargs.ll2
6 files changed, 8 insertions, 8 deletions
diff --git a/llvm/test/CodeGen/SPARC/2008-10-10-InlineAsmRegOperand.ll b/llvm/test/CodeGen/SPARC/2008-10-10-InlineAsmRegOperand.ll
index c12e9c13409..7975ee46823 100644
--- a/llvm/test/CodeGen/SPARC/2008-10-10-InlineAsmRegOperand.ll
+++ b/llvm/test/CodeGen/SPARC/2008-10-10-InlineAsmRegOperand.ll
@@ -7,7 +7,7 @@ module asm "\09.section\09\22.dtors\22,#alloc,#write"
define void @frame_dummy() nounwind {
entry:
- %asmtmp = tail call void (i8*)* (void (i8*)*)* asm "", "=r,0"(void (i8*)* @_Jv_RegisterClasses) nounwind ; <void (i8*)*> [#uses=0]
+ %asmtmp = tail call void (i8*)* (void (i8*)*) asm "", "=r,0"(void (i8*)* @_Jv_RegisterClasses) nounwind ; <void (i8*)*> [#uses=0]
unreachable
}
diff --git a/llvm/test/CodeGen/SPARC/2011-01-11-Call.ll b/llvm/test/CodeGen/SPARC/2011-01-11-Call.ll
index 067bade1660..8097e49ad3f 100644
--- a/llvm/test/CodeGen/SPARC/2011-01-11-Call.ll
+++ b/llvm/test/CodeGen/SPARC/2011-01-11-Call.ll
@@ -22,8 +22,8 @@
define void @test() nounwind {
entry:
- %0 = tail call i32 (...)* @foo() nounwind
- tail call void (...)* @bar() nounwind
+ %0 = tail call i32 (...) @foo() nounwind
+ tail call void (...) @bar() nounwind
ret void
}
@@ -48,6 +48,6 @@ declare void @bar(...)
define i32 @test_tail_call_with_return() nounwind {
entry:
- %0 = tail call i32 (...)* @foo() nounwind
+ %0 = tail call i32 (...) @foo() nounwind
ret i32 %0
}
diff --git a/llvm/test/CodeGen/SPARC/2011-01-19-DelaySlot.ll b/llvm/test/CodeGen/SPARC/2011-01-19-DelaySlot.ll
index 8a3edc64b2d..29bca67e2d2 100644
--- a/llvm/test/CodeGen/SPARC/2011-01-19-DelaySlot.ll
+++ b/llvm/test/CodeGen/SPARC/2011-01-19-DelaySlot.ll
@@ -66,7 +66,7 @@ entry:
br i1 %0, label %bb, label %bb1
bb: ; preds = %entry
- %1 = tail call i32 (...)* @foo(i32 %a) nounwind
+ %1 = tail call i32 (...) @foo(i32 %a) nounwind
ret i32 %1
bb1: ; preds = %entry
diff --git a/llvm/test/CodeGen/SPARC/64abi.ll b/llvm/test/CodeGen/SPARC/64abi.ll
index a7e482c898c..7c08998a142 100644
--- a/llvm/test/CodeGen/SPARC/64abi.ll
+++ b/llvm/test/CodeGen/SPARC/64abi.ll
@@ -436,7 +436,7 @@ declare i64 @receive_fp128(i64 %a, ...)
; CHECK: call receive_fp128
define i64 @test_fp128_variable_args(i64 %a, fp128 %b) {
entry:
- %0 = call i64 (i64, ...)* @receive_fp128(i64 %a, fp128 %b)
+ %0 = call i64 (i64, ...) @receive_fp128(i64 %a, fp128 %b)
ret i64 %0
}
diff --git a/llvm/test/CodeGen/SPARC/setjmp.ll b/llvm/test/CodeGen/SPARC/setjmp.ll
index e75ef96d3eb..17519c51627 100644
--- a/llvm/test/CodeGen/SPARC/setjmp.ll
+++ b/llvm/test/CodeGen/SPARC/setjmp.ll
@@ -47,7 +47,7 @@ entry:
bar.exit: ; preds = %entry
%8 = load i32, i32* %0, align 4, !tbaa !4
- %9 = call i32 (i8*, ...)* @printf(i8* noalias getelementptr inbounds ([30 x i8], [30 x i8]* @.cst, i32 0, i32 0), i32 %8) #0
+ %9 = call i32 (i8*, ...) @printf(i8* noalias getelementptr inbounds ([30 x i8], [30 x i8]* @.cst, i32 0, i32 0), i32 %8) #0
ret i32 0
}
diff --git a/llvm/test/CodeGen/SPARC/varargs.ll b/llvm/test/CodeGen/SPARC/varargs.ll
index 9f1864471ef..c2d1e98b698 100644
--- a/llvm/test/CodeGen/SPARC/varargs.ll
+++ b/llvm/test/CodeGen/SPARC/varargs.ll
@@ -71,6 +71,6 @@ declare void @llvm.va_start(i8*)
; CHECK: , %f2
define i32 @call_1d() #0 {
entry:
- %call = call double (i8*, double, ...)* @varargsfunc(i8* undef, double 1.000000e+00, double 2.000000e+00)
+ %call = call double (i8*, double, ...) @varargsfunc(i8* undef, double 1.000000e+00, double 2.000000e+00)
ret i32 1
}
OpenPOWER on IntegriCloud