1
- // RUN: %target-swift-frontend %use_no_opaque_pointers -module-name=cgtest -emit-ir -O %s | %FileCheck %s
2
- // RUN: %target-swift-frontend -module-name=cgtest -emit-ir -O %s
1
+ // RUN: %target-swift-frontend -module-name=cgtest -emit-ir -O %s | %FileCheck %s
3
2
4
3
// Test some imported CG APIs
5
4
import CoreGraphics
@@ -26,8 +25,8 @@ public func testEnums(_ model: CGColorSpaceModel) -> Int {
26
25
27
26
default : return - 1
28
27
}
29
- // CHECK: [[GEP:%.+]] = getelementptr inbounds [8 x i64], [8 x i64]* [[SWITCHTABLE]], i64 0, i64 %{{.*}}
30
- // CHECK: [[LOAD:%.+]] = load i64, i64* [[GEP]], align 8
28
+ // CHECK: [[GEP:%.+]] = getelementptr inbounds [8 x i64], ptr [[SWITCHTABLE]], i64 0, i64 %{{.*}}
29
+ // CHECK: [[LOAD:%.+]] = load i64, ptr [[GEP]], align 8
31
30
// CHECK: [[PHI:%.*]] = phi i64 [ [[LOAD]], %{{.*}} ], [ -1, %{{.*}} ]
32
31
// CHECK: ret i64 [[PHI]]
33
32
}
@@ -41,9 +40,9 @@ public func rotationAround(offset: CGPoint, angle: CGFloat,
41
40
. rotated ( by: angle)
42
41
. translatedBy ( x: - offset. x, y: - offset. y)
43
42
44
- // CHECK: call void @CGAffineTransformTranslate(%{{.*}}.CGAffineTransform* {{.*}}, %{{.*}}.CGAffineTransform* {{.*}},{{.*}}, {{.*}})
45
- // CHECK: call void @CGAffineTransformRotate(%{{.*}}.CGAffineTransform* {{.*}}, %{{.*}}.CGAffineTransform* {{.*}},{{.*}})
46
- // CHECK: call void @CGAffineTransformTranslate(%{{.*}}.CGAffineTransform* {{.*}}, %{{.*}}.CGAffineTransform* {{.*}},{{.*}}, {{.*}})
43
+ // CHECK: call void @CGAffineTransformTranslate(ptr {{.*}}, ptr {{.*}},{{.*}}, {{.*}})
44
+ // CHECK: call void @CGAffineTransformRotate(ptr {{.*}}, ptr {{.*}},{{.*}})
45
+ // CHECK: call void @CGAffineTransformTranslate(ptr {{.*}}, ptr {{.*}},{{.*}}, {{.*}})
47
46
//
48
47
// CHECK: ret void
49
48
}
@@ -56,12 +55,12 @@ public func trace(in context: CGContext, path: CGPath) {
56
55
context. setStrokeColor ( red)
57
56
context. strokePath ( )
58
57
context. restoreGState ( )
59
- // CHECK: call %{{.*}}.CGColor* @CGColorCreateGenericRGB(double 1.000000e+00, double 0.000000e+00, double 0.000000e+00, double 1.000000e+00)
60
- // CHECK: call void @CGContextSaveGState(%{{.*}}.CGContext* %{{.*}})
61
- // CHECK: call void @CGContextAddPath(%{{.*}}.CGContext* %{{.*}}, %{{.*}}.CGPath* %{{.*}})
62
- // CHECK: call void @CGContextSetStrokeColorWithColor(%{{.*}}.CGContext* %{{.*}}, %{{.*}}.CGColor* %{{.*}})
63
- // CHECK: call void @CGContextStrokePath(%{{.*}}.CGContext* %{{.*}})
64
- // CHECK: call void @CGContextRestoreGState(%{{.*}}.CGContext* %{{.*}})
58
+ // CHECK: call ptr @CGColorCreateGenericRGB(double 1.000000e+00, double 0.000000e+00, double 0.000000e+00, double 1.000000e+00)
59
+ // CHECK: call void @CGContextSaveGState(ptr %{{.*}})
60
+ // CHECK: call void @CGContextAddPath(ptr %{{.*}}, ptr %{{.*}})
61
+ // CHECK: call void @CGContextSetStrokeColorWithColor(ptr %{{.*}}, ptr %{{.*}})
62
+ // CHECK: call void @CGContextStrokePath(ptr %{{.*}})
63
+ // CHECK: call void @CGContextRestoreGState(ptr %{{.*}})
65
64
//
66
65
// CHECK: ret void
67
66
}
@@ -71,9 +70,9 @@ public func pdfOperations(_ context: CGContext) {
71
70
context. beginPDFPage ( nil )
72
71
context. endPDFPage ( )
73
72
context. closePDF ( )
74
- // CHECK: call void @CGPDFContextBeginPage(%{{.*}}.CGContext* %{{.*}}, %{{.*}}.__CFDictionary* {{.*}})
75
- // CHECK: call void @CGPDFContextEndPage(%{{.*}}.CGContext* %{{.*}})
76
- // CHECK: call void @CGPDFContextClose(%{{.*}}.CGContext* %{{.*}})
73
+ // CHECK: call void @CGPDFContextBeginPage(ptr %{{.*}}, ptr {{.*}})
74
+ // CHECK: call void @CGPDFContextEndPage(ptr %{{.*}})
75
+ // CHECK: call void @CGPDFContextClose(ptr %{{.*}})
77
76
//
78
77
// CHECK: ret void
79
78
}
@@ -85,11 +84,11 @@ public func pdfOperations(_ context: CGContext) {
85
84
public func testColorRenames( color: CGColor ,
86
85
intent: CGColorRenderingIntent ) {
87
86
let colorSpace = CGColorSpace ( name: CGColorSpace . sRGB) !
88
- // CHECK: %{{.*}} = load {{.*}}%struct.__CFString** @kCGColorSpaceSRGB{{.*}}, align 8
89
- // CHECK: %{{.*}} = {{.*}} call %struct.CGColorSpace* @CGColorSpaceCreateWithName(%struct.__CFString* %{{.*}})
87
+ // CHECK: %{{.*}} = load {{.*}}ptr @kCGColorSpaceSRGB{{.*}}, align 8
88
+ // CHECK: %{{.*}} = {{.*}} call ptr @CGColorSpaceCreateWithName(ptr %{{.*}})
90
89
91
90
let _ = color. converted ( to: colorSpace, intent: intent, options: nil )
92
- // CHECK: %{{.*}} = {{.*}} call %struct.CGColor* @CGColorCreateCopyByMatchingToColorSpace(%struct.CGColorSpace* nonnull %{{.*}}, i32 %{{.*}}, %struct.CGColor* %{{.*}}, %struct.__CFDictionary* null)
91
+ // CHECK: %{{.*}} = {{.*}} call ptr @CGColorCreateCopyByMatchingToColorSpace(ptr nonnull %{{.*}}, i32 %{{.*}}, ptr %{{.*}}, ptr null)
93
92
//
94
93
// CHECK: ret void
95
94
}
@@ -100,37 +99,37 @@ public func testRenames(transform: CGAffineTransform, context: CGContext,
100
99
image: CGImage ,
101
100
edge: CGRectEdge ) {
102
101
let transform = transform. inverted ( ) . concatenating ( transform)
103
- // CHECK: call void @CGAffineTransformInvert(%struct.CGAffineTransform* {{.*}}, %struct.CGAffineTransform* {{.*}})
104
- // CHECK: call void @CGAffineTransformConcat(%struct.CGAffineTransform* {{.*}}, %struct.CGAffineTransform* {{.*}}, %struct.CGAffineTransform* {{.*}})
102
+ // CHECK: call void @CGAffineTransformInvert(ptr {{.*}}, ptr {{.*}})
103
+ // CHECK: call void @CGAffineTransformConcat(ptr {{.*}}, ptr {{.*}}, ptr {{.*}})
105
104
106
105
blackHole ( point. applying ( transform) )
107
106
var rect = rect. applying ( transform)
108
107
blackHole ( size. applying ( transform) )
109
- // CHECK: %{{.*}} = {{(tail )?}}call { double, double } @CGPointApplyAffineTransform(double %{{.*}}, double %{{.*}}, %struct.CGAffineTransform* {{.*}})
110
- // CHECK: call void @CGRectApplyAffineTransform(%struct.CGRect* {{.*}}, %struct.CGRect* {{.*}}, %struct.CGAffineTransform* {{.*}})
111
- // CHECK: %{{.*}} = {{(tail )?}}call { double, double } @CGSizeApplyAffineTransform(double %{{.*}}, double %{{.*}}, %struct.CGAffineTransform* {{.*}})
108
+ // CHECK: %{{.*}} = {{(tail )?}}call { double, double } @CGPointApplyAffineTransform(double %{{.*}}, double %{{.*}}, ptr {{.*}})
109
+ // CHECK: call void @CGRectApplyAffineTransform(ptr {{.*}}, ptr {{.*}}, ptr {{.*}})
110
+ // CHECK: %{{.*}} = {{(tail )?}}call { double, double } @CGSizeApplyAffineTransform(double %{{.*}}, double %{{.*}}, ptr {{.*}})
112
111
113
112
context. concatenate ( transform)
114
113
context. rotate ( by: CGFloat . pi)
115
114
context. scaleBy ( x: 1.0 , y: 1.0 )
116
115
context. translateBy ( x: 1.0 , y: 1.0 )
117
- // CHECK: call void @CGContextConcatCTM(%struct.CGContext* [[CONTEXT:%[0-9]+]], %struct.CGAffineTransform* {{.*}})
118
- // CHECK: call void @CGContextRotateCTM(%struct.CGContext* [[CONTEXT]], double {{.*}})
119
- // CHECK: call void @CGContextScaleCTM(%struct.CGContext* [[CONTEXT]], double {{1\.0+.*}}, double {{1\.0+.*}})
120
- // CHECK: call void @CGContextTranslateCTM(%struct.CGContext* [[CONTEXT]], double {{1\.0+.*}}, double {{1\.0+.*}})
116
+ // CHECK: call void @CGContextConcatCTM(ptr [[CONTEXT:%[0-9]+]], ptr {{.*}})
117
+ // CHECK: call void @CGContextRotateCTM(ptr [[CONTEXT]], double {{.*}})
118
+ // CHECK: call void @CGContextScaleCTM(ptr [[CONTEXT]], double {{1\.0+.*}}, double {{1\.0+.*}})
119
+ // CHECK: call void @CGContextTranslateCTM(ptr [[CONTEXT]], double {{1\.0+.*}}, double {{1\.0+.*}})
121
120
122
121
context. clip ( to: rect)
123
122
context. clip ( to: rect, mask: image)
124
- // CHECK: call void @CGContextClipToRect(%struct.CGContext* [[CONTEXT]], %struct.CGRect* nonnull byval({{.*}}) align 8 %{{.*}})
125
- // CHECK: call void @CGContextClipToMask(%struct.CGContext* [[CONTEXT]], %struct.CGRect* nonnull byval({{.*}}) align 8 %{{.*}}, %struct.CGImage* %{{.*}})
123
+ // CHECK: call void @CGContextClipToRect(ptr [[CONTEXT]], ptr nonnull byval({{.*}}) align 8 %{{.*}})
124
+ // CHECK: call void @CGContextClipToMask(ptr [[CONTEXT]], ptr nonnull byval({{.*}}) align 8 %{{.*}}, ptr %{{.*}})
126
125
127
126
var slice = CGRect . zero
128
127
var remainder = CGRect . zero
129
128
rect. __divided ( slice: & slice, remainder: & remainder, atDistance: CGFloat ( 2.0 ) ,
130
129
from: edge)
131
130
assert ( ( slice, remainder) == rect. divided ( atDistance: CGFloat ( 2.0 ) ,
132
131
from: edge) )
133
- // CHECK: call void @CGRectDivide(%struct.CGRect* nonnull byval({{.*}}) align 8 %{{.*}}, %struct.CGRect* nonnull %{{.*}}, %struct.CGRect* nonnull %{{.*}}, double {{2\.0+.*}}, i32 %{{.*}})
132
+ // CHECK: call void @CGRectDivide(ptr nonnull byval({{.*}}) align 8 %{{.*}}, ptr nonnull %{{.*}}, ptr nonnull %{{.*}}, double {{2\.0+.*}}, i32 %{{.*}})
134
133
//
135
134
// CHECK: ret void
136
135
}
0 commit comments