Compare commits

...

1 Commits

Author SHA1 Message Date
Bill Wendling
392e4fbdd9 Creating release_31 branch
llvm-svn: 155059
llvm-svn: 155053
llvm-svn: 155051
2012-04-18 21:39:23 +00:00
7270 changed files with 0 additions and 1069968 deletions

View File

@@ -1,19 +0,0 @@
This is a collection of tests to check debugging information generated by
compiler. This test suite can be checked out inside clang/test folder. This
will enable 'make test' for clang to pick up these tests. Typically, test
cases included here includes debugger commands and intended debugger output
as comments in source file using DEBUGGER: and CHECK: as prefixes respectively.
For exmaple,
define i32 @f1(i32 %i) nounwind ssp {
; DEBUGGER: break f1
; DEBUGGER: r
; DEBUGGER: p i
; CHECK: $1 = 42
entry:
}
is a testcase where the debuger is asked to break at function 'f1' and
print value of argument 'i'. The expected value of 'i' is 42 in this case.

View File

@@ -1,32 +0,0 @@
// RUN: %clangxx -O0 -g %s -c -o %t.o
// RUN: %clangxx %t.o -o %t.out
// RUN: %test_debuginfo %s %t.out
// Radar 8945514
// DEBUGGER: break 22
// DEBUGGER: r
// DEBUGGER: p v
// CHECK: $1 = (SVal &)
// CHECK: Data = 0x0,
// CHECK: Kind = 2142
class SVal {
public:
~SVal() {}
const void* Data;
unsigned Kind;
};
void bar(SVal &v) {}
class A {
public:
void foo(SVal v) { bar(v); }
};
int main() {
SVal v;
v.Data = 0;
v.Kind = 2142;
A a;
a.foo(v);
return 0;
}

View File

@@ -1,32 +0,0 @@
// RUN: %clang -O0 -g %s -c -o %t.o
// RUN: %clang %t.o -o %t.out -framework Foundation
// RUN: %test_debuginfo %s %t.out
// XFAIL: *
// XTARGET: darwin
// DEBUGGER: break 24
// DEBUGGER: r
// DEBUGGER: p result
// CHECK: $1 = 42
void doBlock(void (^block)(void))
{
block();
}
int I(int n)
{
__block int result;
int i = 2;
doBlock(^{
result = n;
});
return result + i; /* Check value of 'result' */
}
int main (int argc, const char * argv[]) {
return I(42);
}

View File

@@ -1,43 +0,0 @@
// RUN: %clang -O0 -g %s -c -o %t.o
// RUN: %clang %t.o -o %t.out -framework Foundation
// RUN: %test_debuginfo %s %t.out
// XFAIL: *
// XTARGET: darwin
// Radar 9279956
// DEBUGGER: break 31
// DEBUGGER: r
// DEBUGGER: p m2
// DEBUGGER: p dbTransaction
// DEBUGGER: p master
// CHECK: $1 = 1
// CHECK: $2 = 0
// CHECK: $3 = 0
#include <Cocoa/Cocoa.h>
extern void foo(void(^)(void));
@interface A:NSObject @end
@implementation A
- (void) helper {
int master = 0;
__block int m2 = 0;
__block int dbTransaction = 0;
int (^x)(void) = ^(void) { (void) self;
(void) master;
(void) dbTransaction;
m2++;
return m2;
};
master = x();
}
@end
void foo(void(^x)(void)) {}
int main() {
A *a = [A alloc];
[a helper];
return 0;
}

View File

@@ -1,25 +0,0 @@
// RUN: %clangxx -O0 -g %s -c -o %t.o
// RUN: %clangxx %t.o -o %t.out
// RUN: %test_debuginfo %s %t.out
// DEBUGGER: break 14
// DEBUGGER: r
// DEBUGGER: p *this
// CHECK-NEXT-NOT: Cannot access memory at address
class A {
public:
A() : zero(0), data(42)
{
}
private:
int zero;
int data;
};
int main() {
A a;
return 0;
}

View File

@@ -1,126 +0,0 @@
; This test case checks debug info during register moves for an argument.
; RUN: %clang -arch x86_64 -mllvm -fast-isel=false %s -c -o %t.o
; RUN: %clang -arch x86_64 %t.o -o %t.out
; RUN: %test_debuginfo %s %t.out
; XFAIL: *
; XTARGET: darwin
; Radar 8412415
target triple = "x86_64-apple-darwin10.0.0"
%struct._mtx = type { i64, i32, %struct.anon }
%struct.anon = type { i32, i32 }
define i32 @foobar(%struct._mtx* nocapture %mutex) nounwind readonly noinline ssp {
; DEBUGGER: break foobar
; DEBUGGER: r
; DEBUGGER: info address mutex
; CHECK: Symbol "mutex" is
; CHECK-NEXT:
; CHECK-NEXT: in register
entry:
tail call void @llvm.dbg.value(metadata !{%struct._mtx* %mutex}, i64 0, metadata !8), !dbg !29
tail call void @llvm.dbg.value(metadata !30, i64 0, metadata !21), !dbg !31
tail call void @llvm.dbg.value(metadata !32, i64 0, metadata !23), !dbg !33
tail call void @llvm.dbg.value(metadata !32, i64 0, metadata !24), !dbg !34
br label %do.body1, !dbg !37
do.body1: ; preds = %entry, %do.body1
%0 = phi i32 [ 0, %entry ], [ %inc, %do.body1 ]
%r.1 = phi i32 [ 1, %entry ], [ %r.0, %do.body1 ]
%inc = add i32 %0, 1
%tmp2 = getelementptr inbounds %struct._mtx* %mutex, i64 0, i32 1, !dbg !35
%tmp3 = load i32* %tmp2, align 4, !dbg !35
%tobool = icmp eq i32 %tmp3, 0, !dbg !35
%r.0 = select i1 %tobool, i32 %r.1, i32 2
%call = tail call i32 @bar(i32 %r.0, i32 %0), !dbg !38
%cmp = icmp slt i32 %inc, %call, !dbg !39
br i1 %cmp, label %do.body1, label %do.end9, !dbg !39
do.end9: ; preds = %do.body1
tail call void @llvm.dbg.value(metadata !40, i64 0, metadata !21), !dbg !41
tail call void @llvm.dbg.value(metadata !{i32 %call}, i64 0, metadata !24), !dbg !38
tail call void @llvm.dbg.value(metadata !{i32 %inc}, i64 0, metadata !23), !dbg !42
%add = add nsw i32 %r.0, %call, !dbg !43
ret i32 %add, !dbg !43
}
declare void @llvm.dbg.declare(metadata, metadata) nounwind readnone
define i32 @bar(i32 %i, i32 %j) nounwind readnone noinline ssp {
entry:
tail call void @llvm.dbg.value(metadata !{i32 %i}, i64 0, metadata !25), !dbg !44
tail call void @llvm.dbg.value(metadata !{i32 %j}, i64 0, metadata !26), !dbg !45
%add = add nsw i32 %j, %i, !dbg !46
ret i32 %add, !dbg !46
}
define i32 @main() nounwind readonly ssp {
entry:
%m = alloca %struct._mtx, align 8
call void @llvm.dbg.declare(metadata !{%struct._mtx* %m}, metadata !27), !dbg !48
%tmp = getelementptr inbounds %struct._mtx* %m, i64 0, i32 1, !dbg !49
store i32 0, i32* %tmp, align 8, !dbg !49
%call = call i32 @foobar(%struct._mtx* %m), !dbg !50
ret i32 %call, !dbg !50
}
declare void @llvm.dbg.value(metadata, i64, metadata) nounwind readnone
!llvm.dbg.sp = !{!0, !6, !7}
!llvm.dbg.lv.foobar = !{!8, !21, !23, !24}
!llvm.dbg.lv.bar = !{!25, !26}
!llvm.dbg.lv.main = !{!27}
!0 = metadata !{i32 524334, i32 0, metadata !1, metadata !"foobar", metadata !"foobar", metadata !"foobar", metadata !1, i32 12, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i1 false, i1 true, i32 (%struct._mtx*)* @foobar} ; [ DW_TAG_subprogram ]
!1 = metadata !{i32 524329, metadata !"mu.c", metadata !"/private/tmp", metadata !2} ; [ DW_TAG_file_type ]
!2 = metadata !{i32 524305, i32 0, i32 12, metadata !"mu.c", metadata !"/private/tmp", metadata !"clang version 2.9 (trunk 114183)", i1 true, i1 true, metadata !"", i32 0} ; [ DW_TAG_compile_unit ]
!3 = metadata !{i32 524309, metadata !1, metadata !"", metadata !1, i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !4, i32 0, null} ; [ DW_TAG_subroutine_type ]
!4 = metadata !{metadata !5}
!5 = metadata !{i32 524324, metadata !1, metadata !"int", metadata !1, i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ]
!6 = metadata !{i32 524334, i32 0, metadata !1, metadata !"bar", metadata !"bar", metadata !"bar", metadata !1, i32 26, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i1 false, i1 true, i32 (i32, i32)* @bar} ; [ DW_TAG_subprogram ]
!7 = metadata !{i32 524334, i32 0, metadata !1, metadata !"main", metadata !"main", metadata !"main", metadata !1, i32 30, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i1 false, i1 true, i32 ()* @main} ; [ DW_TAG_subprogram ]
!8 = metadata !{i32 524545, metadata !0, metadata !"mutex", metadata !1, i32 12, metadata !9} ; [ DW_TAG_arg_variable ]
!9 = metadata !{i32 524303, metadata !1, metadata !"", metadata !1, i32 0, i64 64, i64 64, i64 0, i32 0, metadata !10} ; [ DW_TAG_pointer_type ]
!10 = metadata !{i32 524310, metadata !1, metadata !"mtx_t", metadata !1, i32 9, i64 0, i64 0, i64 0, i32 0, metadata !11} ; [ DW_TAG_typedef ]
!11 = metadata !{i32 524307, metadata !1, metadata !"_mtx", metadata !1, i32 2, i64 192, i64 64, i64 0, i32 0, null, metadata !12, i32 0, null} ; [ DW_TAG_structure_type ]
!12 = metadata !{metadata !13, metadata !15, metadata !16}
!13 = metadata !{i32 524301, metadata !1, metadata !"ptr", metadata !1, i32 3, i64 64, i64 64, i64 0, i32 0, metadata !14} ; [ DW_TAG_member ]
!14 = metadata !{i32 524324, metadata !1, metadata !"long unsigned int", metadata !1, i32 0, i64 64, i64 64, i64 0, i32 0, i32 7} ; [ DW_TAG_base_type ]
!15 = metadata !{i32 524301, metadata !1, metadata !"waiters", metadata !1, i32 4, i64 32, i64 32, i64 64, i32 0, metadata !5} ; [ DW_TAG_member ]
!16 = metadata !{i32 524301, metadata !1, metadata !"mtxi", metadata !1, i32 8, i64 64, i64 32, i64 96, i32 0, metadata !17} ; [ DW_TAG_member ]
!17 = metadata !{i32 524307, metadata !11, metadata !"", metadata !1, i32 5, i64 64, i64 32, i64 0, i32 0, null, metadata !18, i32 0, null} ; [ DW_TAG_structure_type ]
!18 = metadata !{metadata !19, metadata !20}
!19 = metadata !{i32 524301, metadata !1, metadata !"tag", metadata !1, i32 6, i64 32, i64 32, i64 0, i32 0, metadata !5} ; [ DW_TAG_member ]
!20 = metadata !{i32 524301, metadata !1, metadata !"pad", metadata !1, i32 7, i64 32, i64 32, i64 32, i32 0, metadata !5} ; [ DW_TAG_member ]
!21 = metadata !{i32 524544, metadata !22, metadata !"r", metadata !1, i32 13, metadata !5} ; [ DW_TAG_auto_variable ]
!22 = metadata !{i32 524299, metadata !0, i32 12, i32 52, metadata !1, i32 0} ; [ DW_TAG_lexical_block ]
!23 = metadata !{i32 524544, metadata !22, metadata !"l", metadata !1, i32 14, metadata !5} ; [ DW_TAG_auto_variable ]
!24 = metadata !{i32 524544, metadata !22, metadata !"j", metadata !1, i32 15, metadata !5} ; [ DW_TAG_auto_variable ]
!25 = metadata !{i32 524545, metadata !6, metadata !"i", metadata !1, i32 26, metadata !5} ; [ DW_TAG_arg_variable ]
!26 = metadata !{i32 524545, metadata !6, metadata !"j", metadata !1, i32 26, metadata !5} ; [ DW_TAG_arg_variable ]
!27 = metadata !{i32 524544, metadata !28, metadata !"m", metadata !1, i32 31, metadata !10} ; [ DW_TAG_auto_variable ]
!28 = metadata !{i32 524299, metadata !7, i32 30, i32 12, metadata !1, i32 4} ; [ DW_TAG_lexical_block ]
!29 = metadata !{i32 12, i32 45, metadata !0, null}
!30 = metadata !{i32 1}
!31 = metadata !{i32 13, i32 12, metadata !22, null}
!32 = metadata !{i32 0}
!33 = metadata !{i32 14, i32 12, metadata !22, null}
!34 = metadata !{i32 15, i32 12, metadata !22, null}
!35 = metadata !{i32 18, i32 5, metadata !36, null}
!36 = metadata !{i32 524299, metadata !22, i32 17, i32 6, metadata !1, i32 2} ; [ DW_TAG_lexical_block ]
!37 = metadata !{i32 16, i32 3, metadata !22, null}
!38 = metadata !{i32 20, i32 5, metadata !36, null}
!39 = metadata !{i32 22, i32 3, metadata !36, null}
!40 = metadata !{i32 2}
!41 = metadata !{i32 19, i32 7, metadata !36, null}
!42 = metadata !{i32 21, i32 5, metadata !36, null}
!43 = metadata !{i32 23, i32 3, metadata !22, null}
!44 = metadata !{i32 26, i32 39, metadata !6, null}
!45 = metadata !{i32 26, i32 46, metadata !6, null}
!46 = metadata !{i32 27, i32 3, metadata !47, null}
!47 = metadata !{i32 524299, metadata !6, i32 26, i32 49, metadata !1, i32 3} ; [ DW_TAG_lexical_block ]
!48 = metadata !{i32 31, i32 9, metadata !28, null}
!49 = metadata !{i32 32, i32 3, metadata !28, null}
!50 = metadata !{i32 33, i32 3, metadata !28, null}

View File

@@ -1,263 +0,0 @@
; This test case checks handling of llvm.dbg.declare intrinsic during fast-isel.
; RUN: %clang -arch x86_64 -O0 -g %s -c -o %t.o
; RUN: %clang -arch x86_64 %t.o -o %t.out
; RUN: %test_debuginfo %s %t.out
; XFAIL: *
; XTARGET: darwin
target triple = "x86_64-apple-darwin"
%struct.XYZ = type { i32, i32, i32, i32, i32 }
; Check handling of llvm.dbg.declare for an argument referred through alloca, where
; alloca dominates llvm.dbg.declare
define i32 @f1(i32 %i) nounwind ssp {
; DEBUGGER: break f1
; DEBUGGER: r
; DEBUGGER: p i
; CHECK: $1 = 42
entry:
%i.addr = alloca i32, align 4
store i32 %i, i32* %i.addr, align 4
call void @llvm.dbg.declare(metadata !{i32* %i.addr}, metadata !16), !dbg !17
%tmp = load i32* %i.addr, align 4, !dbg !18
ret i32 %tmp, !dbg !18
}
declare void @llvm.dbg.declare(metadata, metadata) nounwind readnone
; Check handling of llvm.dbg.declare for an argument referred through alloca, where
; llvm.dbg.declare dominates alloca.
define i32 @f2(i32 %i) nounwind ssp {
; DEBUGGER: break f2
; DEBUGGER: c
; DEBUGGER: p i
; CHECK: $2 = 43
entry:
call void @llvm.dbg.declare(metadata !{i32* %i.addr}, metadata !20), !dbg !21
%i.addr = alloca i32, align 4
store i32 %i, i32* %i.addr, align 4
%tmp = load i32* %i.addr, align 4, !dbg !22
ret i32 %tmp, !dbg !22
}
; If llvm.dbg.declare is using an argument after its last use then register
; allocator may destroy debug info for the argument. This is expected and
; it should be fixed before registers are allocated.
define i32 @f3(i32 %i) nounwind ssp {
entry:
%i.addr = alloca i32, align 4
store i32 %i, i32* %i.addr, align 4
call void @llvm.dbg.declare(metadata !{i32 %i}, metadata !24), !dbg !25
%tmp = load i32* %i.addr, align 4, !dbg !26
ret i32 %tmp, !dbg !26
}
; Check handling of an argument referred directly by llvm.dbg.declare where
; llvm.dbg.declare dominates all uses of argument.
define i32 @f4(i32 %i) nounwind ssp {
; DEBUGGER: break f4
; DEBUGGER: c
; DEBUGGER: p i
; CHECK: $3 = 45
entry:
call void @llvm.dbg.declare(metadata !{i32 %i}, metadata !28), !dbg !29
ret i32 %i, !dbg !30
}
; Check handling of an argument referred directly by llvm.dbg.declare where
; llvm.dbg.declare dominates all uses of argument in separate basic block.
define i32 @f5(i32 %i) nounwind ssp {
; DEBUGGER: break f5
; DEBUGGER: c
; DEBUGGER: p i
; CHECK: $4 = 46
entry:
call void @llvm.dbg.declare(metadata !{i32 %i}, metadata !32), !dbg !33
br label %bbr
bbr:
ret i32 %i, !dbg !34
}
; Check handling of an argument referred directly by llvm.dbg.declare where
; argument is not used.
define i32 @f6(i32 %i) nounwind ssp {
entry:
call void @llvm.dbg.declare(metadata !{i32 %i}, metadata !36), !dbg !37
ret i32 1, !dbg !38
}
; Check handling of an byval argument referred directly by llvm.dbg.declare where
; argument is not used.
define i32 @f7(%struct.XYZ* byval %i) nounwind ssp {
entry:
call void @llvm.dbg.declare(metadata !{%struct.XYZ* %i}, metadata !40), !dbg !48
ret i32 1, !dbg !49
}
; Check handling of an byval argument referred directly by llvm.dbg.declare where
; argument use dominates llvm.dbg.declare.
define i32 @f8(%struct.XYZ* byval %i) nounwind ssp {
; DEBUGGER: break f8
; DEBUGGER: c
; DEBUGGER: p i.x
; CHECK: $5 = 51
entry:
%tmp = getelementptr inbounds %struct.XYZ* %i, i32 0, i32 1, !dbg !53
%tmp1 = load i32* %tmp, align 4, !dbg !53
call void @llvm.dbg.declare(metadata !{%struct.XYZ* %i}, metadata !51), !dbg !52
ret i32 %tmp1, !dbg !53
}
; Check handling of an byval argument referred directly by llvm.dbg.declare where
; llvm.dbg.declare dominates all uses of argument.
define i32 @f9(%struct.XYZ* byval %i) nounwind ssp {
; DEBUGGER: break f9
; DEBUGGER: c
; DEBUGGER: p i.x
; CHECK: $6 = 51
entry:
call void @llvm.dbg.declare(metadata !{%struct.XYZ* %i}, metadata !55), !dbg !56
%tmp = getelementptr inbounds %struct.XYZ* %i, i32 0, i32 2, !dbg !57
%tmp1 = load i32* %tmp, align 4, !dbg !57
ret i32 %tmp1, !dbg !57
}
; Check handling of an byval argument referred directly by llvm.dbg.declare where
; llvm.dbg.declare dominates all uses of argument in separate basic block.
define i32 @f10(%struct.XYZ* byval %i) nounwind ssp {
entry:
call void @llvm.dbg.declare(metadata !{%struct.XYZ* %i}, metadata !59), !dbg !60
br label %bbr
bbr:
%tmp = getelementptr inbounds %struct.XYZ* %i, i32 0, i32 3, !dbg !61
%tmp1 = load i32* %tmp, align 4, !dbg !61
ret i32 %tmp1, !dbg !61
}
define i32 @main() nounwind ssp {
entry:
%retval = alloca i32, align 4
%abc = alloca %struct.XYZ, align 4
%agg.tmp = alloca %struct.XYZ, align 4
%agg.tmp13 = alloca %struct.XYZ, align 4
%agg.tmp17 = alloca %struct.XYZ, align 4
%agg.tmp21 = alloca %struct.XYZ, align 4
store i32 0, i32* %retval
%call = call i32 @f1(i32 42), !dbg !63
%call1 = call i32 @f2(i32 43), !dbg !65
%call2 = call i32 @f3(i32 44), !dbg !66
%call3 = call i32 @f4(i32 45), !dbg !67
%call4 = call i32 @f5(i32 46), !dbg !68
%call5 = call i32 @f6(i32 47), !dbg !69
call void @llvm.dbg.declare(metadata !{%struct.XYZ* %abc}, metadata !70), !dbg !71
%tmp = getelementptr inbounds %struct.XYZ* %abc, i32 0, i32 0, !dbg !72
store i32 51, i32* %tmp, align 4, !dbg !72
%tmp6 = getelementptr inbounds %struct.XYZ* %abc, i32 0, i32 1, !dbg !72
store i32 52, i32* %tmp6, align 4, !dbg !72
%tmp7 = getelementptr inbounds %struct.XYZ* %abc, i32 0, i32 2, !dbg !72
store i32 53, i32* %tmp7, align 4, !dbg !72
%tmp8 = getelementptr inbounds %struct.XYZ* %abc, i32 0, i32 3, !dbg !72
store i32 54, i32* %tmp8, align 4, !dbg !72
%tmp9 = getelementptr inbounds %struct.XYZ* %abc, i32 0, i32 4, !dbg !72
store i32 55, i32* %tmp9, align 4, !dbg !72
%tmp10 = bitcast %struct.XYZ* %agg.tmp to i8*, !dbg !73
%tmp11 = bitcast %struct.XYZ* %abc to i8*, !dbg !73
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %tmp10, i8* %tmp11, i64 20, i32 4, i1 false), !dbg !73
%call12 = call i32 @f7(%struct.XYZ* byval %agg.tmp), !dbg !73
%tmp14 = bitcast %struct.XYZ* %agg.tmp13 to i8*, !dbg !74
%tmp15 = bitcast %struct.XYZ* %abc to i8*, !dbg !74
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %tmp14, i8* %tmp15, i64 20, i32 4, i1 false), !dbg !74
%call16 = call i32 @f8(%struct.XYZ* byval %agg.tmp13), !dbg !74
%tmp18 = bitcast %struct.XYZ* %agg.tmp17 to i8*, !dbg !75
%tmp19 = bitcast %struct.XYZ* %abc to i8*, !dbg !75
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %tmp18, i8* %tmp19, i64 20, i32 4, i1 false), !dbg !75
%call20 = call i32 @f9(%struct.XYZ* byval %agg.tmp17), !dbg !75
%tmp22 = bitcast %struct.XYZ* %agg.tmp21 to i8*, !dbg !76
%tmp23 = bitcast %struct.XYZ* %abc to i8*, !dbg !76
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %tmp22, i8* %tmp23, i64 20, i32 4, i1 false), !dbg !76
%call24 = call i32 @f10(%struct.XYZ* byval %agg.tmp21), !dbg !76
ret i32 0, !dbg !77
}
declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture, i64, i32, i1) nounwind
!llvm.dbg.sp = !{!0, !6, !7, !8, !9, !10, !11, !12, !13, !14, !15}
!0 = metadata !{i32 524334, i32 0, metadata !1, metadata !"f1", metadata !"f1", metadata !"f1", metadata !1, i32 11, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i1 false, i1 false, i32 (i32)* @f1} ; [ DW_TAG_subprogram ]
!1 = metadata !{i32 524329, metadata !"fastisel_arg.c", metadata !"/private/tmp", metadata !2} ; [ DW_TAG_file_type ]
!2 = metadata !{i32 524305, i32 0, i32 12, metadata !"fastisel_arg.c", metadata !"/private/tmp", metadata !"clang version 2.8 (trunk 112967)", i1 true, i1 false, metadata !"", i32 0} ; [ DW_TAG_compile_unit ]
!3 = metadata !{i32 524309, metadata !1, metadata !"", metadata !1, i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !4, i32 0, null} ; [ DW_TAG_subroutine_type ]
!4 = metadata !{metadata !5}
!5 = metadata !{i32 524324, metadata !1, metadata !"int", metadata !1, i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ]
!6 = metadata !{i32 524334, i32 0, metadata !1, metadata !"f2", metadata !"f2", metadata !"f2", metadata !1, i32 12, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i1 false, i1 false, i32 (i32)* @f2} ; [ DW_TAG_subprogram ]
!7 = metadata !{i32 524334, i32 0, metadata !1, metadata !"f3", metadata !"f3", metadata !"f3", metadata !1, i32 13, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i1 false, i1 false, i32 (i32)* @f3} ; [ DW_TAG_subprogram ]
!8 = metadata !{i32 524334, i32 0, metadata !1, metadata !"f4", metadata !"f4", metadata !"f4", metadata !1, i32 14, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i1 false, i1 false, i32 (i32)* @f4} ; [ DW_TAG_subprogram ]
!9 = metadata !{i32 524334, i32 0, metadata !1, metadata !"f5", metadata !"f5", metadata !"f5", metadata !1, i32 15, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i1 false, i1 false, i32 (i32)* @f5} ; [ DW_TAG_subprogram ]
!10 = metadata !{i32 524334, i32 0, metadata !1, metadata !"f6", metadata !"f6", metadata !"f6", metadata !1, i32 16, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i1 false, i1 false, i32 (i32)* @f6} ; [ DW_TAG_subprogram ]
!11 = metadata !{i32 524334, i32 0, metadata !1, metadata !"f7", metadata !"f7", metadata !"f7", metadata !1, i32 17, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i1 false, i1 false, i32 (%struct.XYZ*)* @f7} ; [ DW_TAG_subprogram ]
!12 = metadata !{i32 524334, i32 0, metadata !1, metadata !"f8", metadata !"f8", metadata !"f8", metadata !1, i32 18, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i1 false, i1 false, i32 (%struct.XYZ*)* @f8} ; [ DW_TAG_subprogram ]
!13 = metadata !{i32 524334, i32 0, metadata !1, metadata !"f9", metadata !"f9", metadata !"f9", metadata !1, i32 19, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i1 false, i1 false, i32 (%struct.XYZ*)* @f9} ; [ DW_TAG_subprogram ]
!14 = metadata !{i32 524334, i32 0, metadata !1, metadata !"f10", metadata !"f10", metadata !"f10", metadata !1, i32 20, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i1 false, i1 false, i32 (%struct.XYZ*)* @f10} ; [ DW_TAG_subprogram ]
!15 = metadata !{i32 524334, i32 0, metadata !1, metadata !"main", metadata !"main", metadata !"main", metadata !1, i32 23, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i1 false, i1 false, i32 ()* @main} ; [ DW_TAG_subprogram ]
!16 = metadata !{i32 524545, metadata !0, metadata !"i", metadata !1, i32 11, metadata !5} ; [ DW_TAG_arg_variable ]
!17 = metadata !{i32 11, i32 12, metadata !0, null}
!18 = metadata !{i32 11, i32 17, metadata !19, null}
!19 = metadata !{i32 524299, metadata !0, i32 11, i32 15, metadata !1, i32 0} ; [ DW_TAG_lexical_block ]
!20 = metadata !{i32 524545, metadata !6, metadata !"i", metadata !1, i32 12, metadata !5} ; [ DW_TAG_arg_variable ]
!21 = metadata !{i32 12, i32 12, metadata !6, null}
!22 = metadata !{i32 12, i32 17, metadata !23, null}
!23 = metadata !{i32 524299, metadata !6, i32 12, i32 15, metadata !1, i32 1} ; [ DW_TAG_lexical_block ]
!24 = metadata !{i32 524545, metadata !7, metadata !"i", metadata !1, i32 13, metadata !5} ; [ DW_TAG_arg_variable ]
!25 = metadata !{i32 13, i32 12, metadata !7, null}
!26 = metadata !{i32 13, i32 17, metadata !27, null}
!27 = metadata !{i32 524299, metadata !7, i32 13, i32 15, metadata !1, i32 2} ; [ DW_TAG_lexical_block ]
!28 = metadata !{i32 524545, metadata !8, metadata !"i", metadata !1, i32 14, metadata !5} ; [ DW_TAG_arg_variable ]
!29 = metadata !{i32 14, i32 12, metadata !8, null}
!30 = metadata !{i32 14, i32 17, metadata !31, null}
!31 = metadata !{i32 524299, metadata !8, i32 14, i32 15, metadata !1, i32 3} ; [ DW_TAG_lexical_block ]
!32 = metadata !{i32 524545, metadata !9, metadata !"i", metadata !1, i32 15, metadata !5} ; [ DW_TAG_arg_variable ]
!33 = metadata !{i32 15, i32 12, metadata !9, null}
!34 = metadata !{i32 15, i32 17, metadata !35, null}
!35 = metadata !{i32 524299, metadata !9, i32 15, i32 15, metadata !1, i32 4} ; [ DW_TAG_lexical_block ]
!36 = metadata !{i32 524545, metadata !10, metadata !"i", metadata !1, i32 16, metadata !5} ; [ DW_TAG_arg_variable ]
!37 = metadata !{i32 16, i32 12, metadata !10, null}
!38 = metadata !{i32 16, i32 17, metadata !39, null}
!39 = metadata !{i32 524299, metadata !10, i32 16, i32 15, metadata !1, i32 5} ; [ DW_TAG_lexical_block ]
!40 = metadata !{i32 524545, metadata !11, metadata !"i", metadata !1, i32 17, metadata !41} ; [ DW_TAG_arg_variable ]
!41 = metadata !{i32 524307, metadata !1, metadata !"XYZ", metadata !1, i32 2, i64 160, i64 32, i64 0, i32 0, null, metadata !42, i32 0, null} ; [ DW_TAG_structure_type ]
!42 = metadata !{metadata !43, metadata !44, metadata !45, metadata !46, metadata !47}
!43 = metadata !{i32 524301, metadata !1, metadata !"x", metadata !1, i32 3, i64 32, i64 32, i64 0, i32 0, metadata !5} ; [ DW_TAG_member ]
!44 = metadata !{i32 524301, metadata !1, metadata !"y", metadata !1, i32 4, i64 32, i64 32, i64 32, i32 0, metadata !5} ; [ DW_TAG_member ]
!45 = metadata !{i32 524301, metadata !1, metadata !"z", metadata !1, i32 5, i64 32, i64 32, i64 64, i32 0, metadata !5} ; [ DW_TAG_member ]
!46 = metadata !{i32 524301, metadata !1, metadata !"a", metadata !1, i32 6, i64 32, i64 32, i64 96, i32 0, metadata !5} ; [ DW_TAG_member ]
!47 = metadata !{i32 524301, metadata !1, metadata !"b", metadata !1, i32 7, i64 32, i64 32, i64 128, i32 0, metadata !5} ; [ DW_TAG_member ]
!48 = metadata !{i32 17, i32 19, metadata !11, null}
!49 = metadata !{i32 17, i32 24, metadata !50, null}
!50 = metadata !{i32 524299, metadata !11, i32 17, i32 22, metadata !1, i32 6} ; [ DW_TAG_lexical_block ]
!51 = metadata !{i32 524545, metadata !12, metadata !"i", metadata !1, i32 18, metadata !41} ; [ DW_TAG_arg_variable ]
!52 = metadata !{i32 18, i32 19, metadata !12, null}
!53 = metadata !{i32 18, i32 24, metadata !54, null}
!54 = metadata !{i32 524299, metadata !12, i32 18, i32 22, metadata !1, i32 7} ; [ DW_TAG_lexical_block ]
!55 = metadata !{i32 524545, metadata !13, metadata !"i", metadata !1, i32 19, metadata !41} ; [ DW_TAG_arg_variable ]
!56 = metadata !{i32 19, i32 19, metadata !13, null}
!57 = metadata !{i32 19, i32 24, metadata !58, null}
!58 = metadata !{i32 524299, metadata !13, i32 19, i32 22, metadata !1, i32 8} ; [ DW_TAG_lexical_block ]
!59 = metadata !{i32 524545, metadata !14, metadata !"i", metadata !1, i32 20, metadata !41} ; [ DW_TAG_arg_variable ]
!60 = metadata !{i32 20, i32 20, metadata !14, null}
!61 = metadata !{i32 20, i32 25, metadata !62, null}
!62 = metadata !{i32 524299, metadata !14, i32 20, i32 23, metadata !1, i32 9} ; [ DW_TAG_lexical_block ]
!63 = metadata !{i32 24, i32 3, metadata !64, null}
!64 = metadata !{i32 524299, metadata !15, i32 23, i32 12, metadata !1, i32 10} ; [ DW_TAG_lexical_block ]
!65 = metadata !{i32 25, i32 3, metadata !64, null}
!66 = metadata !{i32 26, i32 3, metadata !64, null}
!67 = metadata !{i32 27, i32 3, metadata !64, null}
!68 = metadata !{i32 28, i32 3, metadata !64, null}
!69 = metadata !{i32 29, i32 3, metadata !64, null}
!70 = metadata !{i32 524544, metadata !64, metadata !"abc", metadata !1, i32 30, metadata !41} ; [ DW_TAG_auto_variable ]
!71 = metadata !{i32 30, i32 14, metadata !64, null}
!72 = metadata !{i32 30, i32 17, metadata !64, null}
!73 = metadata !{i32 31, i32 3, metadata !64, null}
!74 = metadata !{i32 32, i32 3, metadata !64, null}
!75 = metadata !{i32 33, i32 3, metadata !64, null}
!76 = metadata !{i32 34, i32 3, metadata !64, null}
!77 = metadata !{i32 36, i32 3, metadata !64, null}

View File

@@ -1,264 +0,0 @@
; This test case checks handling of llvm.dbg.declare intrinsic during isel.
; RUN: %clang -arch x86_64 -mllvm -fast-isel=false -mllvm -regalloc=default -g %s -c -o %t.o
; RUN: %clang -arch x86_64 %t.o -o %t.out
; RUN: %test_debuginfo %s %t.out
; XFAIL: *
; XTARGET: darwin
target triple = "x86_64-apple-darwin"
%struct.XYZ = type { i32, i32, i32, i32, i32 }
; Check handling of llvm.dbg.declare for an argument referred through alloca, where
; alloca dominates llvm.dbg.declare
define i32 @f1(i32 %i) nounwind ssp {
; DEBUGGER: break f1
; DEBUGGER: r
; DEBUGGER: p i
; CHECK: $1 = 42
entry:
%i.addr = alloca i32, align 4
store i32 %i, i32* %i.addr, align 4
call void @llvm.dbg.declare(metadata !{i32* %i.addr}, metadata !16), !dbg !17
%tmp = load i32* %i.addr, align 4, !dbg !18
ret i32 %tmp, !dbg !18
}
declare void @llvm.dbg.declare(metadata, metadata) nounwind readnone
; Check handling of llvm.dbg.declare for an argument referred through alloca, where
; llvm.dbg.declare dominates alloca.
define i32 @f2(i32 %i) nounwind ssp {
; DEBUGGER: break f2
; DEBUGGER: c
; DEBUGGER: p i
; CHECK: $2 = 43
entry:
call void @llvm.dbg.declare(metadata !{i32* %i.addr}, metadata !20), !dbg !21
%i.addr = alloca i32, align 4
store i32 %i, i32* %i.addr, align 4
%tmp = load i32* %i.addr, align 4, !dbg !22
ret i32 %tmp, !dbg !22
}
; Check handling of an argument referred directly by llvm.dbg.declare where at least
; one argument use dominates llvm.dbg.declare.
; This is expected to not work because registor allocator has freedom to kill 'i'
; after its last use.
define i32 @f3(i32 %i) nounwind ssp {
entry:
%i.addr = alloca i32, align 4
store i32 %i, i32* %i.addr, align 4
call void @llvm.dbg.declare(metadata !{i32 %i}, metadata !24), !dbg !25
%tmp = load i32* %i.addr, align 4, !dbg !26
ret i32 %tmp, !dbg !26
}
; Check handling of an argument referred directly by llvm.dbg.declare where
; llvm.dbg.declare dominates all uses of argument.
define i32 @f4(i32 %i) nounwind ssp {
entry:
call void @llvm.dbg.declare(metadata !{i32 %i}, metadata !28), !dbg !29
ret i32 %i, !dbg !30
}
; Check handling of an argument referred directly by llvm.dbg.declare where
; llvm.dbg.declare dominates all uses of argument in separate basic block.
define i32 @f5(i32 %i) nounwind ssp {
entry:
call void @llvm.dbg.declare(metadata !{i32 %i}, metadata !32), !dbg !33
br label %bbr
bbr:
ret i32 %i, !dbg !34
}
; Check handling of an argument referred directly by llvm.dbg.declare where
; argument is not used.
define i32 @f6(i32 %i) nounwind ssp {
entry:
call void @llvm.dbg.declare(metadata !{i32 %i}, metadata !36), !dbg !37
ret i32 1, !dbg !38
}
; Check handling of an byval argument referred directly by llvm.dbg.declare where
; argument is not used.
define i32 @f7(%struct.XYZ* byval %i) nounwind ssp {
; DEBUGGER: break f7
; DEBUGGER: c
; DEBUGGER: p i.x
; CHECK: $3 = 51
entry:
call void @llvm.dbg.declare(metadata !{%struct.XYZ* %i}, metadata !40), !dbg !48
ret i32 1, !dbg !49
}
; Check handling of an byval argument referred directly by llvm.dbg.declare where
; argument use dominates llvm.dbg.declare.
define i32 @f8(%struct.XYZ* byval %i) nounwind ssp {
; DEBUGGER: break f8
; DEBUGGER: c
; DEBUGGER: p i.x
; CHECK: $4 = 51
entry:
%tmp = getelementptr inbounds %struct.XYZ* %i, i32 0, i32 1, !dbg !53
%tmp1 = load i32* %tmp, align 4, !dbg !53
call void @llvm.dbg.declare(metadata !{%struct.XYZ* %i}, metadata !51), !dbg !52
ret i32 %tmp1, !dbg !53
}
; Check handling of an byval argument referred directly by llvm.dbg.declare where
; llvm.dbg.declare dominates all uses of argument.
define i32 @f9(%struct.XYZ* byval %i) nounwind ssp {
; DEBUGGER: break f9
; DEBUGGER: c
; DEBUGGER: p i.x
; CHECK: $5 = 51
entry:
call void @llvm.dbg.declare(metadata !{%struct.XYZ* %i}, metadata !55), !dbg !56
%tmp = getelementptr inbounds %struct.XYZ* %i, i32 0, i32 2, !dbg !57
%tmp1 = load i32* %tmp, align 4, !dbg !57
ret i32 %tmp1, !dbg !57
}
; Check handling of an byval argument referred directly by llvm.dbg.declare where
; llvm.dbg.declare dominates all uses of argument in separate basic block.
define i32 @f10(%struct.XYZ* byval %i) nounwind ssp {
; DEBUGGER: break f10
; DEBUGGER: c
; DEBUGGER: p i.x
; CHECK: $6 = 51
entry:
call void @llvm.dbg.declare(metadata !{%struct.XYZ* %i}, metadata !59), !dbg !60
br label %bbr
bbr:
%tmp = getelementptr inbounds %struct.XYZ* %i, i32 0, i32 3, !dbg !61
%tmp1 = load i32* %tmp, align 4, !dbg !61
ret i32 %tmp1, !dbg !61
}
define i32 @main() nounwind ssp {
entry:
%retval = alloca i32, align 4
%abc = alloca %struct.XYZ, align 4
%agg.tmp = alloca %struct.XYZ, align 4
%agg.tmp13 = alloca %struct.XYZ, align 4
%agg.tmp17 = alloca %struct.XYZ, align 4
%agg.tmp21 = alloca %struct.XYZ, align 4
store i32 0, i32* %retval
%call = call i32 @f1(i32 42), !dbg !63
%call1 = call i32 @f2(i32 43), !dbg !65
%call2 = call i32 @f3(i32 44), !dbg !66
%call3 = call i32 @f4(i32 45), !dbg !67
%call4 = call i32 @f5(i32 46), !dbg !68
%call5 = call i32 @f6(i32 47), !dbg !69
call void @llvm.dbg.declare(metadata !{%struct.XYZ* %abc}, metadata !70), !dbg !71
%tmp = getelementptr inbounds %struct.XYZ* %abc, i32 0, i32 0, !dbg !72
store i32 51, i32* %tmp, align 4, !dbg !72
%tmp6 = getelementptr inbounds %struct.XYZ* %abc, i32 0, i32 1, !dbg !72
store i32 52, i32* %tmp6, align 4, !dbg !72
%tmp7 = getelementptr inbounds %struct.XYZ* %abc, i32 0, i32 2, !dbg !72
store i32 53, i32* %tmp7, align 4, !dbg !72
%tmp8 = getelementptr inbounds %struct.XYZ* %abc, i32 0, i32 3, !dbg !72
store i32 54, i32* %tmp8, align 4, !dbg !72
%tmp9 = getelementptr inbounds %struct.XYZ* %abc, i32 0, i32 4, !dbg !72
store i32 55, i32* %tmp9, align 4, !dbg !72
%tmp10 = bitcast %struct.XYZ* %agg.tmp to i8*, !dbg !73
%tmp11 = bitcast %struct.XYZ* %abc to i8*, !dbg !73
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %tmp10, i8* %tmp11, i64 20, i32 4, i1 false), !dbg !73
%call12 = call i32 @f7(%struct.XYZ* byval %agg.tmp), !dbg !73
%tmp14 = bitcast %struct.XYZ* %agg.tmp13 to i8*, !dbg !74
%tmp15 = bitcast %struct.XYZ* %abc to i8*, !dbg !74
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %tmp14, i8* %tmp15, i64 20, i32 4, i1 false), !dbg !74
%call16 = call i32 @f8(%struct.XYZ* byval %agg.tmp13), !dbg !74
%tmp18 = bitcast %struct.XYZ* %agg.tmp17 to i8*, !dbg !75
%tmp19 = bitcast %struct.XYZ* %abc to i8*, !dbg !75
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %tmp18, i8* %tmp19, i64 20, i32 4, i1 false), !dbg !75
%call20 = call i32 @f9(%struct.XYZ* byval %agg.tmp17), !dbg !75
%tmp22 = bitcast %struct.XYZ* %agg.tmp21 to i8*, !dbg !76
%tmp23 = bitcast %struct.XYZ* %abc to i8*, !dbg !76
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %tmp22, i8* %tmp23, i64 20, i32 4, i1 false), !dbg !76
%call24 = call i32 @f10(%struct.XYZ* byval %agg.tmp21), !dbg !76
ret i32 0, !dbg !77
}
declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture, i64, i32, i1) nounwind
!llvm.dbg.sp = !{!0, !6, !7, !8, !9, !10, !11, !12, !13, !14, !15}
!0 = metadata !{i32 524334, i32 0, metadata !1, metadata !"f1", metadata !"f1", metadata !"f1", metadata !1, i32 11, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i1 false, i1 false, i32 (i32)* @f1} ; [ DW_TAG_subprogram ]
!1 = metadata !{i32 524329, metadata !"fastisel_arg.c", metadata !"/private/tmp", metadata !2} ; [ DW_TAG_file_type ]
!2 = metadata !{i32 524305, i32 0, i32 12, metadata !"fastisel_arg.c", metadata !"/private/tmp", metadata !"clang version 2.8 (trunk 112967)", i1 true, i1 false, metadata !"", i32 0} ; [ DW_TAG_compile_unit ]
!3 = metadata !{i32 524309, metadata !1, metadata !"", metadata !1, i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !4, i32 0, null} ; [ DW_TAG_subroutine_type ]
!4 = metadata !{metadata !5}
!5 = metadata !{i32 524324, metadata !1, metadata !"int", metadata !1, i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ]
!6 = metadata !{i32 524334, i32 0, metadata !1, metadata !"f2", metadata !"f2", metadata !"f2", metadata !1, i32 12, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i1 false, i1 false, i32 (i32)* @f2} ; [ DW_TAG_subprogram ]
!7 = metadata !{i32 524334, i32 0, metadata !1, metadata !"f3", metadata !"f3", metadata !"f3", metadata !1, i32 13, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i1 false, i1 false, i32 (i32)* @f3} ; [ DW_TAG_subprogram ]
!8 = metadata !{i32 524334, i32 0, metadata !1, metadata !"f4", metadata !"f4", metadata !"f4", metadata !1, i32 14, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i1 false, i1 false, i32 (i32)* @f4} ; [ DW_TAG_subprogram ]
!9 = metadata !{i32 524334, i32 0, metadata !1, metadata !"f5", metadata !"f5", metadata !"f5", metadata !1, i32 15, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i1 false, i1 false, i32 (i32)* @f5} ; [ DW_TAG_subprogram ]
!10 = metadata !{i32 524334, i32 0, metadata !1, metadata !"f6", metadata !"f6", metadata !"f6", metadata !1, i32 16, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i1 false, i1 false, i32 (i32)* @f6} ; [ DW_TAG_subprogram ]
!11 = metadata !{i32 524334, i32 0, metadata !1, metadata !"f7", metadata !"f7", metadata !"f7", metadata !1, i32 17, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i1 false, i1 false, i32 (%struct.XYZ*)* @f7} ; [ DW_TAG_subprogram ]
!12 = metadata !{i32 524334, i32 0, metadata !1, metadata !"f8", metadata !"f8", metadata !"f8", metadata !1, i32 18, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i1 false, i1 false, i32 (%struct.XYZ*)* @f8} ; [ DW_TAG_subprogram ]
!13 = metadata !{i32 524334, i32 0, metadata !1, metadata !"f9", metadata !"f9", metadata !"f9", metadata !1, i32 19, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i1 false, i1 false, i32 (%struct.XYZ*)* @f9} ; [ DW_TAG_subprogram ]
!14 = metadata !{i32 524334, i32 0, metadata !1, metadata !"f10", metadata !"f10", metadata !"f10", metadata !1, i32 20, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i1 false, i1 false, i32 (%struct.XYZ*)* @f10} ; [ DW_TAG_subprogram ]
!15 = metadata !{i32 524334, i32 0, metadata !1, metadata !"main", metadata !"main", metadata !"main", metadata !1, i32 23, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i1 false, i1 false, i32 ()* @main} ; [ DW_TAG_subprogram ]
!16 = metadata !{i32 524545, metadata !0, metadata !"i", metadata !1, i32 11, metadata !5} ; [ DW_TAG_arg_variable ]
!17 = metadata !{i32 11, i32 12, metadata !0, null}
!18 = metadata !{i32 11, i32 17, metadata !19, null}
!19 = metadata !{i32 524299, metadata !0, i32 11, i32 15, metadata !1, i32 0} ; [ DW_TAG_lexical_block ]
!20 = metadata !{i32 524545, metadata !6, metadata !"i", metadata !1, i32 12, metadata !5} ; [ DW_TAG_arg_variable ]
!21 = metadata !{i32 12, i32 12, metadata !6, null}
!22 = metadata !{i32 12, i32 17, metadata !23, null}
!23 = metadata !{i32 524299, metadata !6, i32 12, i32 15, metadata !1, i32 1} ; [ DW_TAG_lexical_block ]
!24 = metadata !{i32 524545, metadata !7, metadata !"i", metadata !1, i32 13, metadata !5} ; [ DW_TAG_arg_variable ]
!25 = metadata !{i32 13, i32 12, metadata !7, null}
!26 = metadata !{i32 13, i32 17, metadata !27, null}
!27 = metadata !{i32 524299, metadata !7, i32 13, i32 15, metadata !1, i32 2} ; [ DW_TAG_lexical_block ]
!28 = metadata !{i32 524545, metadata !8, metadata !"i", metadata !1, i32 14, metadata !5} ; [ DW_TAG_arg_variable ]
!29 = metadata !{i32 14, i32 12, metadata !8, null}
!30 = metadata !{i32 14, i32 17, metadata !31, null}
!31 = metadata !{i32 524299, metadata !8, i32 14, i32 15, metadata !1, i32 3} ; [ DW_TAG_lexical_block ]
!32 = metadata !{i32 524545, metadata !9, metadata !"i", metadata !1, i32 15, metadata !5} ; [ DW_TAG_arg_variable ]
!33 = metadata !{i32 15, i32 12, metadata !9, null}
!34 = metadata !{i32 15, i32 17, metadata !35, null}
!35 = metadata !{i32 524299, metadata !9, i32 15, i32 15, metadata !1, i32 4} ; [ DW_TAG_lexical_block ]
!36 = metadata !{i32 524545, metadata !10, metadata !"i", metadata !1, i32 16, metadata !5} ; [ DW_TAG_arg_variable ]
!37 = metadata !{i32 16, i32 12, metadata !10, null}
!38 = metadata !{i32 16, i32 17, metadata !39, null}
!39 = metadata !{i32 524299, metadata !10, i32 16, i32 15, metadata !1, i32 5} ; [ DW_TAG_lexical_block ]
!40 = metadata !{i32 524545, metadata !11, metadata !"i", metadata !1, i32 17, metadata !41} ; [ DW_TAG_arg_variable ]
!41 = metadata !{i32 524307, metadata !1, metadata !"XYZ", metadata !1, i32 2, i64 160, i64 32, i64 0, i32 0, null, metadata !42, i32 0, null} ; [ DW_TAG_structure_type ]
!42 = metadata !{metadata !43, metadata !44, metadata !45, metadata !46, metadata !47}
!43 = metadata !{i32 524301, metadata !1, metadata !"x", metadata !1, i32 3, i64 32, i64 32, i64 0, i32 0, metadata !5} ; [ DW_TAG_member ]
!44 = metadata !{i32 524301, metadata !1, metadata !"y", metadata !1, i32 4, i64 32, i64 32, i64 32, i32 0, metadata !5} ; [ DW_TAG_member ]
!45 = metadata !{i32 524301, metadata !1, metadata !"z", metadata !1, i32 5, i64 32, i64 32, i64 64, i32 0, metadata !5} ; [ DW_TAG_member ]
!46 = metadata !{i32 524301, metadata !1, metadata !"a", metadata !1, i32 6, i64 32, i64 32, i64 96, i32 0, metadata !5} ; [ DW_TAG_member ]
!47 = metadata !{i32 524301, metadata !1, metadata !"b", metadata !1, i32 7, i64 32, i64 32, i64 128, i32 0, metadata !5} ; [ DW_TAG_member ]
!48 = metadata !{i32 17, i32 19, metadata !11, null}
!49 = metadata !{i32 17, i32 24, metadata !50, null}
!50 = metadata !{i32 524299, metadata !11, i32 17, i32 22, metadata !1, i32 6} ; [ DW_TAG_lexical_block ]
!51 = metadata !{i32 524545, metadata !12, metadata !"i", metadata !1, i32 18, metadata !41} ; [ DW_TAG_arg_variable ]
!52 = metadata !{i32 18, i32 19, metadata !12, null}
!53 = metadata !{i32 18, i32 24, metadata !54, null}
!54 = metadata !{i32 524299, metadata !12, i32 18, i32 22, metadata !1, i32 7} ; [ DW_TAG_lexical_block ]
!55 = metadata !{i32 524545, metadata !13, metadata !"i", metadata !1, i32 19, metadata !41} ; [ DW_TAG_arg_variable ]
!56 = metadata !{i32 19, i32 19, metadata !13, null}
!57 = metadata !{i32 19, i32 24, metadata !58, null}
!58 = metadata !{i32 524299, metadata !13, i32 19, i32 22, metadata !1, i32 8} ; [ DW_TAG_lexical_block ]
!59 = metadata !{i32 524545, metadata !14, metadata !"i", metadata !1, i32 20, metadata !41} ; [ DW_TAG_arg_variable ]
!60 = metadata !{i32 20, i32 20, metadata !14, null}
!61 = metadata !{i32 20, i32 25, metadata !62, null}
!62 = metadata !{i32 524299, metadata !14, i32 20, i32 23, metadata !1, i32 9} ; [ DW_TAG_lexical_block ]
!63 = metadata !{i32 24, i32 3, metadata !64, null}
!64 = metadata !{i32 524299, metadata !15, i32 23, i32 12, metadata !1, i32 10} ; [ DW_TAG_lexical_block ]
!65 = metadata !{i32 25, i32 3, metadata !64, null}
!66 = metadata !{i32 26, i32 3, metadata !64, null}
!67 = metadata !{i32 27, i32 3, metadata !64, null}
!68 = metadata !{i32 28, i32 3, metadata !64, null}
!69 = metadata !{i32 29, i32 3, metadata !64, null}
!70 = metadata !{i32 524544, metadata !64, metadata !"abc", metadata !1, i32 30, metadata !41} ; [ DW_TAG_auto_variable ]
!71 = metadata !{i32 30, i32 14, metadata !64, null}
!72 = metadata !{i32 30, i32 17, metadata !64, null}
!73 = metadata !{i32 31, i32 3, metadata !64, null}
!74 = metadata !{i32 32, i32 3, metadata !64, null}
!75 = metadata !{i32 33, i32 3, metadata !64, null}
!76 = metadata !{i32 34, i32 3, metadata !64, null}
!77 = metadata !{i32 36, i32 3, metadata !64, null}

View File

@@ -1,31 +0,0 @@
// RUN: %clang -O0 -g %s -c -o %t.o
// RUN: %clang %t.o -o %t.out -framework Foundation
// RUN: %test_debuginfo %s %t.out
// XFAIL: *
// XTARGET: darwin
// Radar 8757124
// DEBUGGER: break 25
// DEBUGGER: r
// DEBUGGER: po thing
// CHECK: aaa
#import <Foundation/Foundation.h>
int main (int argc, const char * argv[]) {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSArray *things = [NSArray arrayWithObjects:@"one", @"two", @"three" , nil];
for (NSString *thing in things) {
NSLog (@"%@", thing);
}
things = [NSArray arrayWithObjects:@"aaa", @"bbb", @"ccc" , nil];
for (NSString *thing in things) {
NSLog (@"%@", thing);
}
[pool release];
return 0;
}

View File

@@ -1,24 +0,0 @@
// RUN: %clangxx -O0 -g %s -c -o %t.o
// RUN: %test_debuginfo %s %t.o
// Radar 9168773
// DEBUGGER: ptype A
// CHECK: type = class A {
// CHECK-NEXT: public:
// CHECK-NEXT: int MyData;
// CHECK-NEXT: }
class A;
class B {
public:
void foo(const A *p);
};
B iEntry;
class A {
public:
int MyData;
};
A irp;

View File

@@ -1,109 +0,0 @@
; This test case checks handling of llvm.dbg.declare intrinsic during fast-isel.
; RUN: %clang -arch x86_64 -O0 -g %s -c -o %t.o
; RUN: %clang -arch x86_64 %t.o -o %t.out
; RUN: %test_debuginfo %s %t.out
; XFAIL: *
; XTARGET: darwin
target triple = "x86_64-apple-darwin10.0.0"
define i32 @f1() nounwind ssp {
; DEBUGGER: break f1
; DEBUGGER: r
; DEBUGGER: n
; DEBUGGER: p i
; CHECK: $1 = 42
entry:
%i = alloca i32, align 4
call void @llvm.dbg.declare(metadata !{i32* %i}, metadata !10), !dbg !12
store i32 42, i32* %i, align 4, !dbg !13
%tmp = load i32* %i, align 4, !dbg !14
ret i32 %tmp, !dbg !14
}
declare void @llvm.dbg.declare(metadata, metadata) nounwind readnone
define i32 @f2() nounwind ssp {
; DEBUGGER: break f2
; DEBUGGER: c
; DEBUGGER: n
; DEBUGGER: p i
; CHECK: $2 = 42
entry:
call void @llvm.dbg.declare(metadata !{i32* %i}, metadata !15), !dbg !17
%i = alloca i32, align 4
store i32 42, i32* %i, align 4, !dbg !18
%tmp = load i32* %i, align 4, !dbg !19
ret i32 %tmp, !dbg !19
}
; dbg.declare is dropped, as expected, by instruction selector.
; THIS IS NOT EXPECTED TO WORK.
define i32 @f3() nounwind ssp {
entry:
call void @llvm.dbg.declare(metadata !{i32* %i}, metadata !20), !dbg !22
br label %bbr
bbr:
%i = alloca i32, align 4
store i32 42, i32* %i, align 4, !dbg !23
%tmp = load i32* %i, align 4, !dbg !24
ret i32 %tmp, !dbg !24
}
; dbg.declare is dropped, as expected, by instruction selector.
; THIS IS NOT EXPECTED TO WORK.
define i32 @f4() nounwind ssp {
entry:
%i = alloca i32, align 4
call void @llvm.dbg.declare(metadata !{i32* %i}, metadata !25), !dbg !27
ret i32 42, !dbg !28
}
define i32 @main() nounwind ssp {
entry:
%retval = alloca i32, align 4
store i32 0, i32* %retval
%call = call i32 @f1(), !dbg !29
%call1 = call i32 @f2(), !dbg !31
%call2 = call i32 @f3(), !dbg !32
%call3 = call i32 @f4(), !dbg !33
ret i32 0, !dbg !34
}
!llvm.dbg.sp = !{!0, !6, !7, !8, !9}
!0 = metadata !{i32 524334, i32 0, metadata !1, metadata !"f1", metadata !"f1", metadata !"f1", metadata !1, i32 2, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i1 false, i1 false, i32 ()* @f1} ; [ DW_TAG_subprogram ]
!1 = metadata !{i32 524329, metadata !"lv.c", metadata !"dbg_info_bugs", metadata !2} ; [ DW_TAG_file_type ]
!2 = metadata !{i32 524305, i32 0, i32 12, metadata !"lv.c", metadata !"dbg_info_bugs", metadata !"clang version 2.9 (trunk 113428)", i1 true, i1 false, metadata !"", i32 0} ; [ DW_TAG_compile_unit ]
!3 = metadata !{i32 524309, metadata !1, metadata !"", metadata !1, i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !4, i32 0, null} ; [ DW_TAG_subroutine_type ]
!4 = metadata !{metadata !5}
!5 = metadata !{i32 524324, metadata !1, metadata !"int", metadata !1, i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ]
!6 = metadata !{i32 524334, i32 0, metadata !1, metadata !"f2", metadata !"f2", metadata !"f2", metadata !1, i32 8, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i1 false, i1 false, i32 ()* @f2} ; [ DW_TAG_subprogram ]
!7 = metadata !{i32 524334, i32 0, metadata !1, metadata !"f3", metadata !"f3", metadata !"f3", metadata !1, i32 14, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i1 false, i1 false, i32 ()* @f3} ; [ DW_TAG_subprogram ]
!8 = metadata !{i32 524334, i32 0, metadata !1, metadata !"f4", metadata !"f4", metadata !"f4", metadata !1, i32 20, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i1 false, i1 false, i32 ()* @f4} ; [ DW_TAG_subprogram ]
!9 = metadata !{i32 524334, i32 0, metadata !1, metadata !"main", metadata !"main", metadata !"main", metadata !1, i32 25, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i1 false, i1 false, i32 ()* @main} ; [ DW_TAG_subprogram ]
!10 = metadata !{i32 524544, metadata !11, metadata !"i", metadata !1, i32 3, metadata !5} ; [ DW_TAG_auto_variable ]
!11 = metadata !{i32 524299, metadata !0, i32 2, i32 10, metadata !1, i32 0} ; [ DW_TAG_lexical_block ]
!12 = metadata !{i32 3, i32 7, metadata !11, null}
!13 = metadata !{i32 4, i32 3, metadata !11, null}
!14 = metadata !{i32 5, i32 3, metadata !11, null}
!15 = metadata !{i32 524544, metadata !16, metadata !"i", metadata !1, i32 9, metadata !5} ; [ DW_TAG_auto_variable ]
!16 = metadata !{i32 524299, metadata !6, i32 8, i32 10, metadata !1, i32 1} ; [ DW_TAG_lexical_block ]
!17 = metadata !{i32 9, i32 7, metadata !16, null}
!18 = metadata !{i32 10, i32 3, metadata !16, null}
!19 = metadata !{i32 11, i32 3, metadata !16, null}
!20 = metadata !{i32 524544, metadata !21, metadata !"i", metadata !1, i32 15, metadata !5} ; [ DW_TAG_auto_variable ]
!21 = metadata !{i32 524299, metadata !7, i32 14, i32 10, metadata !1, i32 2} ; [ DW_TAG_lexical_block ]
!22 = metadata !{i32 15, i32 7, metadata !21, null}
!23 = metadata !{i32 16, i32 3, metadata !21, null}
!24 = metadata !{i32 17, i32 3, metadata !21, null}
!25 = metadata !{i32 524544, metadata !26, metadata !"i", metadata !1, i32 21, metadata !5} ; [ DW_TAG_auto_variable ]
!26 = metadata !{i32 524299, metadata !8, i32 20, i32 10, metadata !1, i32 3} ; [ DW_TAG_lexical_block ]
!27 = metadata !{i32 21, i32 7, metadata !26, null}
!28 = metadata !{i32 22, i32 3, metadata !26, null}
!29 = metadata !{i32 26, i32 3, metadata !30, null}
!30 = metadata !{i32 524299, metadata !9, i32 25, i32 12, metadata !1, i32 4} ; [ DW_TAG_lexical_block ]
!31 = metadata !{i32 27, i32 3, metadata !30, null}
!32 = metadata !{i32 28, i32 3, metadata !30, null}
!33 = metadata !{i32 29, i32 3, metadata !30, null}
!34 = metadata !{i32 30, i32 3, metadata !30, null}

View File

@@ -1,109 +0,0 @@
; This test case checks handling of llvm.dbg.declare intrinsic during isel.
; RUN: %clang -arch x86_64 -O0 -mllvm -fast-isel=false -g %s -c -o %t.o
; RUN: %clang -arch x86_64 %t.o -o %t.out
; RUN: %test_debuginfo %s %t.out
; XFAIL: *
; XTARGET: darwin
target triple = "x86_64-apple-darwin10.0.0"
define i32 @f1() nounwind ssp {
; DEBUGGER: break f1
; DEBUGGER: r
; DEBUGGER: n
; DEBUGGER: p i
; CHECK: $1 = 42
entry:
%i = alloca i32, align 4
call void @llvm.dbg.declare(metadata !{i32* %i}, metadata !10), !dbg !12
store i32 42, i32* %i, align 4, !dbg !13
%tmp = load i32* %i, align 4, !dbg !14
ret i32 %tmp, !dbg !14
}
declare void @llvm.dbg.declare(metadata, metadata) nounwind readnone
define i32 @f2() nounwind ssp {
; DEBUGGER: break f2
; DEBUGGER: c
; DEBUGGER: n
; DEBUGGER: p i
; CHECK: $2 = 42
entry:
call void @llvm.dbg.declare(metadata !{i32* %i}, metadata !15), !dbg !17
%i = alloca i32, align 4
store i32 42, i32* %i, align 4, !dbg !18
%tmp = load i32* %i, align 4, !dbg !19
ret i32 %tmp, !dbg !19
}
; dbg.declare is dropped, as expected, by instruction selector.
; THIS IS NOT EXPECTED TO WORK.
define i32 @f3() nounwind ssp {
entry:
call void @llvm.dbg.declare(metadata !{i32* %i}, metadata !20), !dbg !22
br label %bbr
bbr:
%i = alloca i32, align 4
store i32 42, i32* %i, align 4, !dbg !23
%tmp = load i32* %i, align 4, !dbg !24
ret i32 %tmp, !dbg !24
}
; dbg.declare is dropped, as expected, by instruction selector.
; THIS IS NOT EXPECTED TO WORK.
define i32 @f4() nounwind ssp {
entry:
%i = alloca i32, align 4
call void @llvm.dbg.declare(metadata !{i32* %i}, metadata !25), !dbg !27
ret i32 42, !dbg !28
}
define i32 @main() nounwind ssp {
entry:
%retval = alloca i32, align 4
store i32 0, i32* %retval
%call = call i32 @f1(), !dbg !29
%call1 = call i32 @f2(), !dbg !31
%call2 = call i32 @f3(), !dbg !32
%call3 = call i32 @f4(), !dbg !33
ret i32 0, !dbg !34
}
!llvm.dbg.sp = !{!0, !6, !7, !8, !9}
!0 = metadata !{i32 524334, i32 0, metadata !1, metadata !"f1", metadata !"f1", metadata !"f1", metadata !1, i32 2, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i1 false, i1 false, i32 ()* @f1} ; [ DW_TAG_subprogram ]
!1 = metadata !{i32 524329, metadata !"lv.c", metadata !"dbg_info_bugs", metadata !2} ; [ DW_TAG_file_type ]
!2 = metadata !{i32 524305, i32 0, i32 12, metadata !"lv.c", metadata !"dbg_info_bugs", metadata !"clang version 2.9 (trunk 113428)", i1 true, i1 false, metadata !"", i32 0} ; [ DW_TAG_compile_unit ]
!3 = metadata !{i32 524309, metadata !1, metadata !"", metadata !1, i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !4, i32 0, null} ; [ DW_TAG_subroutine_type ]
!4 = metadata !{metadata !5}
!5 = metadata !{i32 524324, metadata !1, metadata !"int", metadata !1, i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ]
!6 = metadata !{i32 524334, i32 0, metadata !1, metadata !"f2", metadata !"f2", metadata !"f2", metadata !1, i32 8, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i1 false, i1 false, i32 ()* @f2} ; [ DW_TAG_subprogram ]
!7 = metadata !{i32 524334, i32 0, metadata !1, metadata !"f3", metadata !"f3", metadata !"f3", metadata !1, i32 14, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i1 false, i1 false, i32 ()* @f3} ; [ DW_TAG_subprogram ]
!8 = metadata !{i32 524334, i32 0, metadata !1, metadata !"f4", metadata !"f4", metadata !"f4", metadata !1, i32 20, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i1 false, i1 false, i32 ()* @f4} ; [ DW_TAG_subprogram ]
!9 = metadata !{i32 524334, i32 0, metadata !1, metadata !"main", metadata !"main", metadata !"main", metadata !1, i32 25, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i1 false, i1 false, i32 ()* @main} ; [ DW_TAG_subprogram ]
!10 = metadata !{i32 524544, metadata !11, metadata !"i", metadata !1, i32 3, metadata !5} ; [ DW_TAG_auto_variable ]
!11 = metadata !{i32 524299, metadata !0, i32 2, i32 10, metadata !1, i32 0} ; [ DW_TAG_lexical_block ]
!12 = metadata !{i32 3, i32 7, metadata !11, null}
!13 = metadata !{i32 4, i32 3, metadata !11, null}
!14 = metadata !{i32 5, i32 3, metadata !11, null}
!15 = metadata !{i32 524544, metadata !16, metadata !"i", metadata !1, i32 9, metadata !5} ; [ DW_TAG_auto_variable ]
!16 = metadata !{i32 524299, metadata !6, i32 8, i32 10, metadata !1, i32 1} ; [ DW_TAG_lexical_block ]
!17 = metadata !{i32 9, i32 7, metadata !16, null}
!18 = metadata !{i32 10, i32 3, metadata !16, null}
!19 = metadata !{i32 11, i32 3, metadata !16, null}
!20 = metadata !{i32 524544, metadata !21, metadata !"i", metadata !1, i32 15, metadata !5} ; [ DW_TAG_auto_variable ]
!21 = metadata !{i32 524299, metadata !7, i32 14, i32 10, metadata !1, i32 2} ; [ DW_TAG_lexical_block ]
!22 = metadata !{i32 15, i32 7, metadata !21, null}
!23 = metadata !{i32 16, i32 3, metadata !21, null}
!24 = metadata !{i32 17, i32 3, metadata !21, null}
!25 = metadata !{i32 524544, metadata !26, metadata !"i", metadata !1, i32 21, metadata !5} ; [ DW_TAG_auto_variable ]
!26 = metadata !{i32 524299, metadata !8, i32 20, i32 10, metadata !1, i32 3} ; [ DW_TAG_lexical_block ]
!27 = metadata !{i32 21, i32 7, metadata !26, null}
!28 = metadata !{i32 22, i32 3, metadata !26, null}
!29 = metadata !{i32 26, i32 3, metadata !30, null}
!30 = metadata !{i32 524299, metadata !9, i32 25, i32 12, metadata !1, i32 4} ; [ DW_TAG_lexical_block ]
!31 = metadata !{i32 27, i32 3, metadata !30, null}
!32 = metadata !{i32 28, i32 3, metadata !30, null}
!33 = metadata !{i32 29, i32 3, metadata !30, null}
!34 = metadata !{i32 30, i32 3, metadata !30, null}

View File

@@ -1,21 +0,0 @@
// RUN: %clangxx -O0 -g %s -c -o %t.o
// RUN: %test_debuginfo %s %t.o
// Radar 9440721
// If debug info for my_number() is emitted outside function foo's scope
// then a debugger may not be able to handle it. At least one version of
// gdb crashes in such cases.
// DEBUGGER: ptype foo
// CHECK: type = int (void)
int foo() {
struct Local {
static int my_number() {
return 42;
}
};
int i = 0;
i = Local::my_number();
return i + 1;
}

View File

@@ -1,71 +0,0 @@
// RUN: %clangxx -O0 -g %s -c -o %t.o
// RUN: %clangxx %t.o -o %t.out
// RUN: %test_debuginfo %s %t.out
// Radar 8775834
// DEBUGGER: break 61
// DEBUGGER: r
// DEBUGGER: p a
// CHECK: $1 = (A &)
// CHECK: _vptr$A =
// CHECK: m_int = 12
class A
{
public:
A (int i=0);
A (const A& rhs);
const A&
operator= (const A& rhs);
virtual ~A() {}
int get_int();
protected:
int m_int;
};
A::A (int i) :
m_int(i)
{
}
A::A (const A& rhs) :
m_int (rhs.m_int)
{
}
const A &
A::operator =(const A& rhs)
{
m_int = rhs.m_int;
return *this;
}
int A::get_int()
{
return m_int;
}
class B
{
public:
B () {}
A AInstance();
};
A
B::AInstance()
{
A a(12);
return a;
}
int main (int argc, char const *argv[])
{
B b;
int return_val = b.AInstance().get_int();
A a(b.AInstance());
return return_val;
}

View File

@@ -1,84 +0,0 @@
; This test checks debug info of unused, zero extended argument.
; RUN: %clang -arch x86_64 -mllvm -fast-isel=false %s -c -o %t.o
; RUN: %clang -arch x86_64 %t.o -o %t.out
; RUN: %test_debuginfo %s %t.out
; XFAIL: *
; XTARGET: darwin
; Radar 9422775
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
target triple = "x86_64-apple-macosx10.6.7"
%class.aClass = type { float }
; DEBUGGER: break aClass::setValues
; DEBUGGER: r
; DEBUGGER: p Filter
; CHECK: true
define void @_ZN6aClass9setValuesEibf(%class.aClass* nocapture %this, i32 %ch, i1 zeroext %Filter, float %a1) nounwind noinline ssp align 2 {
entry:
tail call void @llvm.dbg.value(metadata !{%class.aClass* %this}, i64 0, metadata !19), !dbg !25
tail call void @llvm.dbg.value(metadata !{i32 %ch}, i64 0, metadata !20), !dbg !26
tail call void @llvm.dbg.value(metadata !{i1 %Filter}, i64 0, metadata !21), !dbg !27
tail call void @llvm.dbg.value(metadata !{float %a1}, i64 0, metadata !22), !dbg !28
%m = getelementptr inbounds %class.aClass* %this, i64 0, i32 0, !dbg !29
store float %a1, float* %m, align 4, !dbg !29, !tbaa !31
ret void, !dbg !34
}
declare void @llvm.dbg.declare(metadata, metadata) nounwind readnone
define i32 @main() nounwind ssp {
entry:
%a = alloca %class.aClass, align 4
call void @llvm.dbg.declare(metadata !{%class.aClass* %a}, metadata !23), !dbg !35
call void @_ZN6aClass9setValuesEibf(%class.aClass* %a, i32 undef, i1 zeroext 1, float 1.000000e+00), !dbg !36
ret i32 0, !dbg !37
}
declare void @llvm.dbg.value(metadata, i64, metadata) nounwind readnone
!llvm.dbg.cu = !{!0}
!llvm.dbg.sp = !{!1, !12, !16}
!llvm.dbg.lv._ZN6aClass9setValuesEibf = !{!19, !20, !21, !22}
!llvm.dbg.lv.main = !{!23}
!0 = metadata !{i32 589841, i32 0, i32 4, metadata !"two.cpp", metadata !"/private/tmp/inc", metadata !"clang version 3.0 (trunk 131411)", i1 true, i1 true, metadata !"", i32 0} ; [ DW_TAG_compile_unit ]
!1 = metadata !{i32 589870, i32 0, metadata !2, metadata !"setValues", metadata !"setValues", metadata !"_ZN6aClass9setValuesEibf", metadata !3, i32 6, metadata !7, i1 false, i1 false, i32 0, i32 0, null, i32 256, i1 true, null, null} ; [ DW_TAG_subprogram ]
!2 = metadata !{i32 589826, metadata !0, metadata !"aClass", metadata !3, i32 2, i64 32, i64 32, i32 0, i32 0, null, metadata !4, i32 0, null, null} ; [ DW_TAG_class_type ]
!3 = metadata !{i32 589865, metadata !"./one.h", metadata !"/private/tmp/inc", metadata !0} ; [ DW_TAG_file_type ]
!4 = metadata !{metadata !5, metadata !1}
!5 = metadata !{i32 589837, metadata !3, metadata !"m", metadata !3, i32 4, i64 32, i64 32, i64 0, i32 1, metadata !6} ; [ DW_TAG_member ]
!6 = metadata !{i32 589860, metadata !0, metadata !"float", null, i32 0, i64 32, i64 32, i64 0, i32 0, i32 4} ; [ DW_TAG_base_type ]
!7 = metadata !{i32 589845, metadata !3, metadata !"", metadata !3, i32 0, i64 0, i64 0, i32 0, i32 0, i32 0, metadata !8, i32 0, i32 0} ; [ DW_TAG_subroutine_type ]
!8 = metadata !{null, metadata !9, metadata !10, metadata !11, metadata !6}
!9 = metadata !{i32 589839, metadata !0, metadata !"", i32 0, i32 0, i64 64, i64 64, i64 0, i32 64, metadata !2} ; [ DW_TAG_pointer_type ]
!10 = metadata !{i32 589860, metadata !0, metadata !"int", null, i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ]
!11 = metadata !{i32 589860, metadata !0, metadata !"bool", null, i32 0, i64 8, i64 8, i64 0, i32 0, i32 2} ; [ DW_TAG_base_type ]
!12 = metadata !{i32 589870, i32 0, metadata !13, metadata !"setValues", metadata !"setValues", metadata !"_ZN6aClass9setValuesEibf", metadata !13, i32 4, metadata !14, i1 false, i1 true, i32 0, i32 0, i32 0, i32 256, i1 true, void (%class.aClass*, i32, i1, float)* @_ZN6aClass9setValuesEibf, null, metadata !1} ; [ DW_TAG_subprogram ]
!13 = metadata !{i32 589865, metadata !"two.cpp", metadata !"/private/tmp/inc", metadata !0} ; [ DW_TAG_file_type ]
!14 = metadata !{i32 589845, metadata !13, metadata !"", metadata !13, i32 0, i64 0, i64 0, i32 0, i32 0, i32 0, metadata !15, i32 0, i32 0} ; [ DW_TAG_subroutine_type ]
!15 = metadata !{null}
!16 = metadata !{i32 589870, i32 0, metadata !13, metadata !"main", metadata !"main", metadata !"", metadata !13, i32 9, metadata !17, i1 false, i1 true, i32 0, i32 0, i32 0, i32 256, i1 true, i32 ()* @main, null, null} ; [ DW_TAG_subprogram ]
!17 = metadata !{i32 589845, metadata !13, metadata !"", metadata !13, i32 0, i64 0, i64 0, i32 0, i32 0, i32 0, metadata !18, i32 0, i32 0} ; [ DW_TAG_subroutine_type ]
!18 = metadata !{metadata !10}
!19 = metadata !{i32 590081, metadata !12, metadata !"this", metadata !13, i32 16777219, metadata !9, i32 64} ; [ DW_TAG_arg_variable ]
!20 = metadata !{i32 590081, metadata !12, metadata !"ch", metadata !13, i32 33554435, metadata !10, i32 0} ; [ DW_TAG_arg_variable ]
!21 = metadata !{i32 590081, metadata !12, metadata !"Filter", metadata !13, i32 50331651, metadata !11, i32 0} ; [ DW_TAG_arg_variable ]
!22 = metadata !{i32 590081, metadata !12, metadata !"a1", metadata !13, i32 67108867, metadata !6, i32 0} ; [ DW_TAG_arg_variable ]
!23 = metadata !{i32 590080, metadata !24, metadata !"a", metadata !13, i32 10, metadata !2, i32 0} ; [ DW_TAG_auto_variable ]
!24 = metadata !{i32 589835, metadata !16, i32 9, i32 1, metadata !13, i32 1} ; [ DW_TAG_lexical_block ]
!25 = metadata !{i32 3, i32 40, metadata !12, null}
!26 = metadata !{i32 3, i32 54, metadata !12, null}
!27 = metadata !{i32 3, i32 63, metadata !12, null}
!28 = metadata !{i32 3, i32 77, metadata !12, null}
!29 = metadata !{i32 5, i32 2, metadata !30, null}
!30 = metadata !{i32 589835, metadata !12, i32 4, i32 1, metadata !13, i32 0} ; [ DW_TAG_lexical_block ]
!31 = metadata !{metadata !"float", metadata !32}
!32 = metadata !{metadata !"omnipotent char", metadata !33}
!33 = metadata !{metadata !"Simple C/C++ TBAA", null}
!34 = metadata !{i32 6, i32 1, metadata !30, null}
!35 = metadata !{i32 10, i32 11, metadata !24, null}
!36 = metadata !{i32 11, i32 4, metadata !24, null}
!37 = metadata !{i32 12, i32 4, metadata !24, null}

View File

@@ -1,2 +0,0 @@
N: Peter Collingbourne
E: peter@pcc.me.uk

View File

@@ -1,64 +0,0 @@
==============================================================================
libclc License
==============================================================================
The libclc library is dual licensed under both the University of Illinois
"BSD-Like" license and the MIT license. As a user of this code you may choose
to use it under either license. As a contributor, you agree to allow your code
to be used under both.
Full text of the relevant licenses is included below.
==============================================================================
Copyright (c) 2011-2012 by the contributors listed in CREDITS.TXT
All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal with
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimers.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimers in the
documentation and/or other materials provided with the distribution.
* The names of the contributors may not be used to endorse or promote
products derived from this Software without specific prior written
permission.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
SOFTWARE.
==============================================================================
Copyright (c) 2011-2012 by the contributors listed in CREDITS.TXT
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@@ -1,37 +0,0 @@
libclc
------
libclc is an open source, BSD licensed implementation of the library
requirements of the OpenCL C programming language, as specified by the
OpenCL 1.1 Specification. The following sections of the specification
impose library requirements:
* 6.1: Supported Data Types
* 6.2.3: Explicit Conversions
* 6.2.4.2: Reinterpreting Types Using as_type() and as_typen()
* 6.9: Preprocessor Directives and Macros
* 6.11: Built-in Functions
* 9.3: Double Precision Floating-Point
* 9.4: 64-bit Atomics
* 9.5: Writing to 3D image memory objects
* 9.6: Half Precision Floating-Point
libclc is intended to be used with the Clang compiler's OpenCL frontend.
libclc is designed to be portable and extensible. To this end, it provides
generic implementations of most library requirements, allowing the target
to override the generic implementation at the granularity of individual
functions.
libclc currently only supports the PTX target, but support for more
targets is welcome.
Compiling
---------
./configure.py --with-llvm-config=/path/to/llvm-config && make
Website
-------
http://www.pcc.me.uk/~peter/libclc/

View File

@@ -1,91 +0,0 @@
import ninja_syntax
import os
# Simple meta-build system.
class Make(object):
def __init__(self):
self.output = open(self.output_filename(), 'w')
self.rules = {}
self.rule_text = ''
self.all_targets = []
self.clean_files = []
self.distclean_files = []
self.output.write("""all::
ifndef VERBOSE
Verb = @
endif
""")
def output_filename(self):
return 'Makefile'
def rule(self, name, command, description=None, depfile=None,
generator=False):
self.rules[name] = {'command': command, 'description': description,
'depfile': depfile, 'generator': generator}
def build(self, output, rule, inputs=[], implicit=[], order_only=[]):
inputs = self._as_list(inputs)
implicit = self._as_list(implicit)
order_only = self._as_list(order_only)
output_dir = os.path.dirname(output)
if output_dir != '' and not os.path.isdir(output_dir):
os.makedirs(output_dir)
dollar_in = ' '.join(inputs)
subst = lambda text: text.replace('$in', dollar_in).replace('$out', output)
deps = ' '.join(inputs + implicit)
if order_only:
deps += ' | '
deps += ' '.join(order_only)
self.output.write('%s: %s\n' % (output, deps))
r = self.rules[rule]
command = subst(r['command'])
if r['description']:
desc = subst(r['description'])
self.output.write('\t@echo %s\n\t$(Verb) %s\n' % (desc, command))
else:
self.output.write('\t%s\n' % command)
if r['depfile']:
depfile = subst(r['depfile'])
self.output.write('-include '+depfile+'\n')
self.output.write('\n')
self.all_targets.append(output)
if r['generator']:
self.distclean_files.append(output)
else:
self.clean_files.append(output)
def _as_list(self, input):
if isinstance(input, list):
return input
return [input]
def finish(self):
self.output.write('all:: %s\n\n' % ' '.join(self.all_targets))
self.output.write('clean: \n\trm -f %s\n\n' % ' '.join(self.clean_files))
self.output.write('distclean: clean\n\trm -f %s\n' % ' '.join(self.distclean_files))
class Ninja(ninja_syntax.Writer):
def __init__(self):
ninja_syntax.Writer.__init__(self, open(self.output_filename(), 'w'))
def output_filename(self):
return 'build.ninja'
def finish(self):
pass
def from_name(name):
if name == 'make':
return Make()
if name == 'ninja':
return Ninja()
raise LookupError, 'unknown generator: %s; supported generators are make and ninja' % name

View File

@@ -1,110 +0,0 @@
#!/usr/bin/python
"""Python module for generating .ninja files.
Note that this is emphatically not a required piece of Ninja; it's
just a helpful utility for build-file-generation systems that already
use Python.
"""
import textwrap
class Writer(object):
def __init__(self, output, width=78):
self.output = output
self.width = width
def newline(self):
self.output.write('\n')
def comment(self, text):
for line in textwrap.wrap(text, self.width - 2):
self.output.write('# ' + line + '\n')
def variable(self, key, value, indent=0):
if value is None:
return
if isinstance(value, list):
value = ' '.join(value)
self._line('%s = %s' % (key, value), indent)
def rule(self, name, command, description=None, depfile=None,
generator=False):
self._line('rule %s' % name)
self.variable('command', command, indent=1)
if description:
self.variable('description', description, indent=1)
if depfile:
self.variable('depfile', depfile, indent=1)
if generator:
self.variable('generator', '1', indent=1)
def build(self, outputs, rule, inputs=None, implicit=None, order_only=None,
variables=None):
outputs = self._as_list(outputs)
all_inputs = self._as_list(inputs)[:]
if implicit:
all_inputs.append('|')
all_inputs.extend(self._as_list(implicit))
if order_only:
all_inputs.append('||')
all_inputs.extend(self._as_list(order_only))
self._line('build %s: %s %s' % (' '.join(outputs),
rule,
' '.join(all_inputs)))
if variables:
for key, val in variables:
self.variable(key, val, indent=1)
return outputs
def include(self, path):
self._line('include %s' % path)
def subninja(self, path):
self._line('subninja %s' % path)
def default(self, paths):
self._line('default %s' % ' '.join(self._as_list(paths)))
def _line(self, text, indent=0):
"""Write 'text' word-wrapped at self.width characters."""
leading_space = ' ' * indent
while len(text) > self.width:
# The text is too wide; wrap if possible.
# Find the rightmost space that would obey our width constraint.
available_space = self.width - len(leading_space) - len(' $')
space = text.rfind(' ', 0, available_space)
if space < 0:
# No such space; just use the first space we can find.
space = text.find(' ', available_space)
if space < 0:
# Give up on breaking.
break
self.output.write(leading_space + text[0:space] + ' $\n')
text = text[space+1:]
# Subsequent lines are continuations, so indent them.
leading_space = ' ' * (indent+2)
self.output.write(leading_space + text + '\n')
def _as_list(self, input):
if input is None:
return []
if isinstance(input, list):
return input
return [input]
def escape(string):
"""Escape a string such that it can be embedded into a Ninja file without
further interpretation."""
assert '\n' not in string, 'Ninja syntax does not allow newlines'
# We only have one special metacharacter: '$'.
return string.replace('$', '$$')

View File

@@ -1,3 +0,0 @@
#!/bin/sh
clang -ccc-host-triple ptx32--nvidiacl -Iptx-nvidiacl/include -Igeneric/include -Xclang -mlink-bitcode-file -Xclang ptx32--nvidiacl/lib/builtins.bc -include clc/clc.h -Dcl_clang_storage_class_specifiers "$@"

View File

@@ -1,133 +0,0 @@
#!/usr/bin/python
def c_compiler_rule(b, name, description, compiler, flags):
command = "%s -MMD -MF $out.d %s -c -o $out $in" % (compiler, flags)
b.rule(name, command, description + " $out", depfile="$out.d")
from optparse import OptionParser
import os
from subprocess import *
import sys
srcdir = os.path.dirname(sys.argv[0])
sys.path.insert(0, os.path.join(srcdir, 'build'))
import metabuild
p = OptionParser()
p.add_option('--with-llvm-config', metavar='PATH',
help='use given llvm-config script')
p.add_option('-g', metavar='GENERATOR', default='make',
help='use given generator (default: make)')
(options, args) = p.parse_args()
llvm_config_exe = options.with_llvm_config or "llvm-config"
def llvm_config(args):
try:
proc = Popen([llvm_config_exe] + args, stdout=PIPE)
return proc.communicate()[0].rstrip().replace('\n', ' ')
except OSError:
print "Error executing llvm-config."
print "Please ensure that llvm-config is in your $PATH, or use --with-llvm-config."
sys.exit(1)
llvm_bindir = llvm_config(['--bindir'])
llvm_core_libs = llvm_config(['--ldflags', '--libs', 'core', 'bitreader', 'bitwriter'])
llvm_cxxflags = llvm_config(['--cxxflags']) + ' -fno-exceptions -fno-rtti'
llvm_clang = os.path.join(llvm_bindir, 'clang')
llvm_link = os.path.join(llvm_bindir, 'llvm-link')
llvm_opt = os.path.join(llvm_bindir, 'opt')
default_targets = ['ptx32--nvidiacl', 'ptx64--nvidiacl']
targets = args
if not targets:
targets = default_targets
b = metabuild.from_name(options.g)
b.rule("LLVM_AS", "%s -o $out $in" % os.path.join(llvm_bindir, "llvm-as"),
'LLVM-AS $out')
b.rule("LLVM_LINK", command = llvm_link + " -o $out $in",
description = 'LLVM-LINK $out')
b.rule("OPT", command = llvm_opt + " -O3 -o $out $in",
description = 'OPT $out')
c_compiler_rule(b, "LLVM_TOOL_CXX", 'CXX', 'c++', llvm_cxxflags)
b.rule("LLVM_TOOL_LINK", "c++ -o $out $in %s" % llvm_core_libs, 'LINK $out')
prepare_builtins = os.path.join('utils', 'prepare-builtins')
b.build(os.path.join('utils', 'prepare-builtins.o'), "LLVM_TOOL_CXX",
os.path.join(srcdir, 'utils', 'prepare-builtins.cpp'))
b.build(prepare_builtins, "LLVM_TOOL_LINK",
os.path.join('utils', 'prepare-builtins.o'))
b.rule("PREPARE_BUILTINS", "%s -o $out $in" % prepare_builtins,
'PREPARE-BUILTINS $out')
manifest_deps = set([sys.argv[0], os.path.join(srcdir, 'build', 'metabuild.py'),
os.path.join(srcdir, 'build', 'ninja_syntax.py')])
for target in targets:
(t_arch, t_vendor, t_os) = target.split('-')
archs = [t_arch]
if t_arch == 'ptx32' or t_arch == 'ptx64':
archs.append('ptx')
archs.append('generic')
subdirs = []
for arch in archs:
subdirs.append("%s-%s-%s" % (arch, t_vendor, t_os))
subdirs.append("%s-%s" % (arch, t_os))
subdirs.append(arch)
subdirs = [subdir for subdir in subdirs
if os.path.isdir(os.path.join(srcdir, subdir, 'include')) or
os.path.isfile(os.path.join(srcdir, subdir, 'lib', 'SOURCES'))]
clang_cl_includes = ' '.join(["-I%s" % os.path.join(srcdir, subdir, 'include')
for subdir in subdirs])
# The rule for building a .bc file for the specified architecture using clang.
clang_bc_flags = "-ccc-host-triple %s -I`dirname $in` %s " \
"-Dcl_clang_storage_class_specifiers " \
"-emit-llvm" % (target, clang_cl_includes)
clang_bc_rule = "CLANG_CL_BC_" + target
c_compiler_rule(b, clang_bc_rule, "LLVM-CC", llvm_clang, clang_bc_flags)
objects = []
sources_seen = set()
for subdir in subdirs:
src_libdir = os.path.join(srcdir, subdir, 'lib')
if not os.path.isdir(src_libdir):
continue
subdir_list_file = os.path.join(src_libdir, 'SOURCES')
manifest_deps.add(subdir_list_file)
for src in open(subdir_list_file).readlines():
src = src.rstrip()
if src not in sources_seen:
sources_seen.add(src)
obj = os.path.join(target, 'lib', src + '.bc')
objects.append(obj)
src_file = os.path.join(src_libdir, src)
ext = os.path.splitext(src)[1]
if ext == '.ll':
b.build(obj, 'LLVM_AS', src_file)
else:
b.build(obj, clang_bc_rule, src_file)
builtins_link_bc = os.path.join(target, 'lib', 'builtins.link.bc')
builtins_opt_bc = os.path.join(target, 'lib', 'builtins.opt.bc')
builtins_bc = os.path.join(target, 'lib', 'builtins.bc')
b.build(builtins_link_bc, "LLVM_LINK", objects)
b.build(builtins_opt_bc, "OPT", builtins_link_bc)
b.build(builtins_bc, "PREPARE_BUILTINS", builtins_opt_bc, prepare_builtins)
b.rule("configure", command = ' '.join(sys.argv), description = 'CONFIGURE',
generator = True)
b.build(b.output_filename(), 'configure', list(manifest_deps))
b.finish()

View File

@@ -1,53 +0,0 @@
#define as_char(x) __builtin_astype(x, char)
#define as_uchar(x) __builtin_astype(x, uchar)
#define as_short(x) __builtin_astype(x, short)
#define as_ushort(x) __builtin_astype(x, ushort)
#define as_int(x) __builtin_astype(x, int)
#define as_uint(x) __builtin_astype(x, uint)
#define as_long(x) __builtin_astype(x, long)
#define as_ulong(x) __builtin_astype(x, ulong)
#define as_char2(x) __builtin_astype(x, char2)
#define as_uchar2(x) __builtin_astype(x, uchar2)
#define as_short2(x) __builtin_astype(x, short2)
#define as_ushort2(x) __builtin_astype(x, ushort2)
#define as_int2(x) __builtin_astype(x, int2)
#define as_uint2(x) __builtin_astype(x, uint2)
#define as_long2(x) __builtin_astype(x, long2)
#define as_ulong2(x) __builtin_astype(x, ulong2)
#define as_char3(x) __builtin_astype(x, char3)
#define as_uchar3(x) __builtin_astype(x, uchar3)
#define as_short3(x) __builtin_astype(x, short3)
#define as_ushort3(x) __builtin_astype(x, ushort3)
#define as_int3(x) __builtin_astype(x, int3)
#define as_uint3(x) __builtin_astype(x, uint3)
#define as_long3(x) __builtin_astype(x, long3)
#define as_ulong3(x) __builtin_astype(x, ulong3)
#define as_char4(x) __builtin_astype(x, char4)
#define as_uchar4(x) __builtin_astype(x, uchar4)
#define as_short4(x) __builtin_astype(x, short4)
#define as_ushort4(x) __builtin_astype(x, ushort4)
#define as_int4(x) __builtin_astype(x, int4)
#define as_uint4(x) __builtin_astype(x, uint4)
#define as_long4(x) __builtin_astype(x, long4)
#define as_ulong4(x) __builtin_astype(x, ulong4)
#define as_char8(x) __builtin_astype(x, char8)
#define as_uchar8(x) __builtin_astype(x, uchar8)
#define as_short8(x) __builtin_astype(x, short8)
#define as_ushort8(x) __builtin_astype(x, ushort8)
#define as_int8(x) __builtin_astype(x, int8)
#define as_uint8(x) __builtin_astype(x, uint8)
#define as_long8(x) __builtin_astype(x, long8)
#define as_ulong8(x) __builtin_astype(x, ulong8)
#define as_char16(x) __builtin_astype(x, char16)
#define as_uchar16(x) __builtin_astype(x, uchar16)
#define as_short16(x) __builtin_astype(x, short16)
#define as_ushort16(x) __builtin_astype(x, ushort16)
#define as_int16(x) __builtin_astype(x, int16)
#define as_uint16(x) __builtin_astype(x, uint16)
#define as_long16(x) __builtin_astype(x, long16)
#define as_ulong16(x) __builtin_astype(x, ulong16)

View File

@@ -1,57 +0,0 @@
#ifndef cl_clang_storage_class_specifiers
#error Implementation requires cl_clang_storage_class_specifiers extension!
#endif
#pragma OPENCL EXTENSION cl_clang_storage_class_specifiers : enable
#ifdef cl_khr_fp64
#pragma OPENCL EXTENSION cl_khr_fp64 : enable
#endif
/* Function Attributes */
#include <clc/clcfunc.h>
/* Pattern Macro Definitions */
#include <clc/clcmacro.h>
/* 6.1 Supported Data Types */
#include <clc/clctypes.h>
/* 6.2.4.2 Reinterpreting Types Using as_type() and as_typen() */
#include <clc/as_type.h>
/* 6.11.1 Work-Item Functions */
#include <clc/workitem/get_global_size.h>
#include <clc/workitem/get_global_id.h>
#include <clc/workitem/get_local_size.h>
#include <clc/workitem/get_local_id.h>
#include <clc/workitem/get_num_groups.h>
#include <clc/workitem/get_group_id.h>
/* 6.11.2 Math Functions */
#include <clc/math/cos.h>
#include <clc/math/sin.h>
#include <clc/math/sqrt.h>
#include <clc/math/native_cos.h>
#include <clc/math/native_divide.h>
#include <clc/math/native_sin.h>
#include <clc/math/native_sqrt.h>
/* 6.11.3 Integer Functions */
#include <clc/integer/abs.h>
#include <clc/integer/abs_diff.h>
#include <clc/integer/add_sat.h>
/* 6.11.5 Geometric Functions */
#include <clc/geometric/cross.h>
#include <clc/geometric/length.h>
#include <clc/geometric/normalize.h>
/* 6.11.6 Relational Functions */
#include <clc/relational/select.h>
/* 6.11.8 Synchronization Functions */
#include <clc/synchronization/cl_mem_fence_flags.h>
#include <clc/synchronization/barrier.h>
#pragma OPENCL EXTENSION all : disable

View File

@@ -1,4 +0,0 @@
#define _CLC_OVERLOAD __attribute__((overloadable))
#define _CLC_DECL
#define _CLC_DEF __attribute__((always_inline))
#define _CLC_INLINE __attribute__((always_inline)) static inline

View File

@@ -1,42 +0,0 @@
#define _CLC_UNARY_VECTORIZE(DECLSPEC, RET_TYPE, FUNCTION, ARG1_TYPE) \
DECLSPEC RET_TYPE##2 FUNCTION(ARG1_TYPE##2 x) { \
return (RET_TYPE##2)(FUNCTION(x.x), FUNCTION(x.y)); \
} \
\
DECLSPEC RET_TYPE##3 FUNCTION(ARG1_TYPE##3 x) { \
return (RET_TYPE##3)(FUNCTION(x.x), FUNCTION(x.y), FUNCTION(x.z)); \
} \
\
DECLSPEC RET_TYPE##4 FUNCTION(ARG1_TYPE##4 x) { \
return (RET_TYPE##4)(FUNCTION(x.lo), FUNCTION(x.hi)); \
} \
\
DECLSPEC RET_TYPE##8 FUNCTION(ARG1_TYPE##8 x) { \
return (RET_TYPE##8)(FUNCTION(x.lo), FUNCTION(x.hi)); \
} \
\
DECLSPEC RET_TYPE##16 FUNCTION(ARG1_TYPE##16 x) { \
return (RET_TYPE##16)(FUNCTION(x.lo), FUNCTION(x.hi)); \
}
#define _CLC_BINARY_VECTORIZE(DECLSPEC, RET_TYPE, FUNCTION, ARG1_TYPE, ARG2_TYPE) \
DECLSPEC RET_TYPE##2 FUNCTION(ARG1_TYPE##2 x, ARG2_TYPE##2 y) { \
return (RET_TYPE##2)(FUNCTION(x.x, y.x), FUNCTION(x.y, y.y)); \
} \
\
DECLSPEC RET_TYPE##3 FUNCTION(ARG1_TYPE##3 x, ARG2_TYPE##3 y) { \
return (RET_TYPE##3)(FUNCTION(x.x, y.x), FUNCTION(x.y, y.y), \
FUNCTION(x.z, y.z)); \
} \
\
DECLSPEC RET_TYPE##4 FUNCTION(ARG1_TYPE##4 x, ARG2_TYPE##4 y) { \
return (RET_TYPE##4)(FUNCTION(x.lo, y.lo), FUNCTION(x.hi, y.hi)); \
} \
\
DECLSPEC RET_TYPE##8 FUNCTION(ARG1_TYPE##8 x, ARG2_TYPE##8 y) { \
return (RET_TYPE##8)(FUNCTION(x.lo, y.lo), FUNCTION(x.hi, y.hi)); \
} \
\
DECLSPEC RET_TYPE##16 FUNCTION(ARG1_TYPE##16 x, ARG2_TYPE##16 y) { \
return (RET_TYPE##16)(FUNCTION(x.lo, y.lo), FUNCTION(x.hi, y.hi)); \
}

View File

@@ -1,74 +0,0 @@
/* 6.1.1 Built-in Scalar Data Types */
#include <stddef.h>
typedef unsigned char uchar;
typedef unsigned short ushort;
typedef unsigned int uint;
typedef unsigned long ulong;
/* 6.1.2 Built-in Vector Data Types */
typedef __attribute__((ext_vector_type(2))) char char2;
typedef __attribute__((ext_vector_type(3))) char char3;
typedef __attribute__((ext_vector_type(4))) char char4;
typedef __attribute__((ext_vector_type(8))) char char8;
typedef __attribute__((ext_vector_type(16))) char char16;
typedef __attribute__((ext_vector_type(2))) uchar uchar2;
typedef __attribute__((ext_vector_type(3))) uchar uchar3;
typedef __attribute__((ext_vector_type(4))) uchar uchar4;
typedef __attribute__((ext_vector_type(8))) uchar uchar8;
typedef __attribute__((ext_vector_type(16))) uchar uchar16;
typedef __attribute__((ext_vector_type(2))) short short2;
typedef __attribute__((ext_vector_type(3))) short short3;
typedef __attribute__((ext_vector_type(4))) short short4;
typedef __attribute__((ext_vector_type(8))) short short8;
typedef __attribute__((ext_vector_type(16))) short short16;
typedef __attribute__((ext_vector_type(2))) ushort ushort2;
typedef __attribute__((ext_vector_type(3))) ushort ushort3;
typedef __attribute__((ext_vector_type(4))) ushort ushort4;
typedef __attribute__((ext_vector_type(8))) ushort ushort8;
typedef __attribute__((ext_vector_type(16))) ushort ushort16;
typedef __attribute__((ext_vector_type(2))) int int2;
typedef __attribute__((ext_vector_type(3))) int int3;
typedef __attribute__((ext_vector_type(4))) int int4;
typedef __attribute__((ext_vector_type(8))) int int8;
typedef __attribute__((ext_vector_type(16))) int int16;
typedef __attribute__((ext_vector_type(2))) uint uint2;
typedef __attribute__((ext_vector_type(3))) uint uint3;
typedef __attribute__((ext_vector_type(4))) uint uint4;
typedef __attribute__((ext_vector_type(8))) uint uint8;
typedef __attribute__((ext_vector_type(16))) uint uint16;
typedef __attribute__((ext_vector_type(2))) long long2;
typedef __attribute__((ext_vector_type(3))) long long3;
typedef __attribute__((ext_vector_type(4))) long long4;
typedef __attribute__((ext_vector_type(8))) long long8;
typedef __attribute__((ext_vector_type(16))) long long16;
typedef __attribute__((ext_vector_type(2))) ulong ulong2;
typedef __attribute__((ext_vector_type(3))) ulong ulong3;
typedef __attribute__((ext_vector_type(4))) ulong ulong4;
typedef __attribute__((ext_vector_type(8))) ulong ulong8;
typedef __attribute__((ext_vector_type(16))) ulong ulong16;
typedef __attribute__((ext_vector_type(2))) float float2;
typedef __attribute__((ext_vector_type(3))) float float3;
typedef __attribute__((ext_vector_type(4))) float float4;
typedef __attribute__((ext_vector_type(8))) float float8;
typedef __attribute__((ext_vector_type(16))) float float16;
/* 9.3 Double Precision Floating-Point */
#ifdef cl_khr_fp64
typedef __attribute__((ext_vector_type(2))) double double2;
typedef __attribute__((ext_vector_type(3))) double double3;
typedef __attribute__((ext_vector_type(4))) double double4;
typedef __attribute__((ext_vector_type(8))) double double8;
typedef __attribute__((ext_vector_type(16))) double double16;
#endif

View File

@@ -1,51 +0,0 @@
#define GENTYPE float
#include BODY
#undef GENTYPE
#define GENTYPE float2
#include BODY
#undef GENTYPE
#define GENTYPE float3
#include BODY
#undef GENTYPE
#define GENTYPE float4
#include BODY
#undef GENTYPE
#define GENTYPE float8
#include BODY
#undef GENTYPE
#define GENTYPE float16
#include BODY
#undef GENTYPE
#ifdef cl_khr_fp64
#define GENTYPE double
#include BODY
#undef GENTYPE
#define GENTYPE double2
#include BODY
#undef GENTYPE
#define GENTYPE double3
#include BODY
#undef GENTYPE
#define GENTYPE double4
#include BODY
#undef GENTYPE
#define GENTYPE double8
#include BODY
#undef GENTYPE
#define GENTYPE double16
#include BODY
#undef GENTYPE
#endif
#undef BODY

View File

@@ -1,2 +0,0 @@
_CLC_OVERLOAD _CLC_DECL float3 cross(float3 p0, float3 p1);
_CLC_OVERLOAD _CLC_DECL float4 cross(float4 p0, float4 p1);

View File

@@ -1,2 +0,0 @@
#define BODY <clc/geometric/distance.inc>
#include <clc/geometric/floatn.inc>

View File

@@ -1,2 +0,0 @@
#define BODY <clc/geometric/dot.inc>
#include <clc/geometric/floatn.inc>

View File

@@ -1,35 +0,0 @@
#define FLOATN float
#include BODY
#undef FLOATN
#define FLOATN float2
#include BODY
#undef FLOATN
#define FLOATN float3
#include BODY
#undef FLOATN
#define FLOATN float4
#include BODY
#undef FLOATN
#ifdef cl_khr_fp64
#define FLOATN double
#include BODY
#undef FLOATN
#define FLOATN double2
#include BODY
#undef FLOATN
#define FLOATN double3
#include BODY
#undef FLOATN
#define FLOATN double4
#include BODY
#undef FLOATN
#endif
#undef BODY

View File

@@ -1,2 +0,0 @@
#define BODY <clc/geometric/length.inc>
#include <clc/geometric/floatn.inc>

View File

@@ -1 +0,0 @@
_CLC_OVERLOAD _CLC_DECL float length(FLOATN p0);

View File

@@ -1,2 +0,0 @@
#define BODY <clc/geometric/normalize.inc>
#include <clc/geometric/floatn.inc>

View File

@@ -1 +0,0 @@
_CLC_OVERLOAD _CLC_DECL FLOATN normalize(FLOATN p);

View File

@@ -1,2 +0,0 @@
#define BODY <clc/integer/abs.inc>
#include <clc/integer/gentype.inc>

View File

@@ -1 +0,0 @@
_CLC_OVERLOAD _CLC_DECL UGENTYPE abs(GENTYPE x);

View File

@@ -1,2 +0,0 @@
#define BODY <clc/integer/abs_diff.inc>
#include <clc/integer/gentype.inc>

View File

@@ -1 +0,0 @@
_CLC_OVERLOAD _CLC_DECL UGENTYPE abs_diff(GENTYPE x, GENTYPE y);

View File

@@ -1,2 +0,0 @@
#define BODY <clc/integer/add_sat.inc>
#include <clc/integer/gentype.inc>

View File

@@ -1 +0,0 @@
_CLC_OVERLOAD _CLC_DECL GENTYPE add_sat(GENTYPE x, GENTYPE y);

View File

@@ -1,385 +0,0 @@
#define GENTYPE char
#define UGENTYPE uchar
#define SGENTYPE char
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE char2
#define UGENTYPE uchar2
#define SGENTYPE char2
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE char3
#define UGENTYPE uchar3
#define SGENTYPE char3
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE char4
#define UGENTYPE uchar4
#define SGENTYPE char4
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE char8
#define UGENTYPE uchar8
#define SGENTYPE char8
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE char16
#define UGENTYPE uchar16
#define SGENTYPE char16
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE uchar
#define UGENTYPE uchar
#define SGENTYPE char
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE uchar2
#define UGENTYPE uchar2
#define SGENTYPE char2
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE uchar3
#define UGENTYPE uchar3
#define SGENTYPE char3
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE uchar4
#define UGENTYPE uchar4
#define SGENTYPE char4
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE uchar8
#define UGENTYPE uchar8
#define SGENTYPE char8
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE uchar16
#define UGENTYPE uchar16
#define SGENTYPE char16
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE short
#define UGENTYPE ushort
#define SGENTYPE short
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE short2
#define UGENTYPE ushort2
#define SGENTYPE short2
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE short3
#define UGENTYPE ushort3
#define SGENTYPE short3
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE short4
#define UGENTYPE ushort4
#define SGENTYPE short4
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE short8
#define UGENTYPE ushort8
#define SGENTYPE short8
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE short16
#define UGENTYPE ushort16
#define SGENTYPE short16
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE ushort
#define UGENTYPE ushort
#define SGENTYPE short
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE ushort2
#define UGENTYPE ushort2
#define SGENTYPE short2
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE ushort3
#define UGENTYPE ushort3
#define SGENTYPE short3
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE ushort4
#define UGENTYPE ushort4
#define SGENTYPE short4
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE ushort8
#define UGENTYPE ushort8
#define SGENTYPE short8
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE ushort16
#define UGENTYPE ushort16
#define SGENTYPE short16
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE int
#define UGENTYPE uint
#define SGENTYPE int
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE int2
#define UGENTYPE uint2
#define SGENTYPE int2
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE int3
#define UGENTYPE uint3
#define SGENTYPE int3
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE int4
#define UGENTYPE uint4
#define SGENTYPE int4
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE int8
#define UGENTYPE uint8
#define SGENTYPE int8
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE int16
#define UGENTYPE uint16
#define SGENTYPE int16
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE uint
#define UGENTYPE uint
#define SGENTYPE int
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE uint2
#define UGENTYPE uint2
#define SGENTYPE int2
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE uint3
#define UGENTYPE uint3
#define SGENTYPE int3
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE uint4
#define UGENTYPE uint4
#define SGENTYPE int4
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE uint8
#define UGENTYPE uint8
#define SGENTYPE int8
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE uint16
#define UGENTYPE uint16
#define SGENTYPE int16
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE long
#define UGENTYPE ulong
#define SGENTYPE long
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE long2
#define UGENTYPE ulong2
#define SGENTYPE long2
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE long3
#define UGENTYPE ulong3
#define SGENTYPE long3
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE long4
#define UGENTYPE ulong4
#define SGENTYPE long4
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE long8
#define UGENTYPE ulong8
#define SGENTYPE long8
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE long16
#define UGENTYPE ulong16
#define SGENTYPE long16
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE ulong
#define UGENTYPE ulong
#define SGENTYPE long
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE ulong2
#define UGENTYPE ulong2
#define SGENTYPE long2
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE ulong3
#define UGENTYPE ulong3
#define SGENTYPE long3
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE ulong4
#define UGENTYPE ulong4
#define SGENTYPE long4
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE ulong8
#define UGENTYPE ulong8
#define SGENTYPE long8
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#define GENTYPE ulong16
#define UGENTYPE ulong16
#define SGENTYPE long16
#include BODY
#undef GENTYPE
#undef UGENTYPE
#undef SGENTYPE
#undef BODY

View File

@@ -1,6 +0,0 @@
#undef cos
#define cos __clc_cos
#define FUNCTION __clc_cos
#define INTRINSIC "llvm.cos"
#include <clc/math/unary_intrin.inc>

View File

@@ -1 +0,0 @@
#define native_cos cos

View File

@@ -1 +0,0 @@
#define native_divide(x, y) ((x) / (y))

View File

@@ -1 +0,0 @@
#define native_sin sin

View File

@@ -1 +0,0 @@
#define native_sqrt sqrt

View File

@@ -1,6 +0,0 @@
#undef sin
#define sin __clc_sin
#define FUNCTION __clc_sin
#define INTRINSIC "llvm.sin"
#include <clc/math/unary_intrin.inc>

View File

@@ -1,6 +0,0 @@
#undef sqrt
#define sqrt __clc_sqrt
#define FUNCTION __clc_sqrt
#define INTRINSIC "llvm.sqrt"
#include <clc/math/unary_intrin.inc>

View File

@@ -1 +0,0 @@
_CLC_OVERLOAD _CLC_DECL GENTYPE FUNCTION(GENTYPE x);

View File

@@ -1,18 +0,0 @@
_CLC_OVERLOAD float FUNCTION(float f) __asm(INTRINSIC ".f32");
_CLC_OVERLOAD float2 FUNCTION(float2 f) __asm(INTRINSIC ".v2f32");
_CLC_OVERLOAD float3 FUNCTION(float3 f) __asm(INTRINSIC ".v3f32");
_CLC_OVERLOAD float4 FUNCTION(float4 f) __asm(INTRINSIC ".v4f32");
_CLC_OVERLOAD float8 FUNCTION(float8 f) __asm(INTRINSIC ".v8f32");
_CLC_OVERLOAD float16 FUNCTION(float16 f) __asm(INTRINSIC ".v16f32");
#ifdef cl_khr_fp64
_CLC_OVERLOAD double FUNCTION(double d) __asm(INTRINSIC ".f64");
_CLC_OVERLOAD double2 FUNCTION(double2 d) __asm(INTRINSIC ".v2f64");
_CLC_OVERLOAD double3 FUNCTION(double3 d) __asm(INTRINSIC ".v3f64");
_CLC_OVERLOAD double4 FUNCTION(double4 d) __asm(INTRINSIC ".v4f64");
_CLC_OVERLOAD double8 FUNCTION(double8 d) __asm(INTRINSIC ".v8f64");
_CLC_OVERLOAD double16 FUNCTION(double16 d) __asm(INTRINSIC ".v16f64");
#endif
#undef FUNCTION
#undef INTRINSIC

View File

@@ -1 +0,0 @@
#define select(a, b, c) ((c) ? (b) : (a))

View File

@@ -1,4 +0,0 @@
typedef uint cl_mem_fence_flags;
#define CLK_LOCAL_MEM_FENCE 1
#define CLK_GLOBAL_MEM_FENCE 2

View File

@@ -1,8 +0,0 @@
geometric/cross.cl
geometric/dot.cl
geometric/length.cl
geometric/normalize.cl
integer/abs.cl
integer/add_sat.cl
integer/add_sat.ll
integer/add_sat_impl.ll

View File

@@ -1,11 +0,0 @@
#include <clc/clc.h>
_CLC_OVERLOAD _CLC_DEF float3 cross(float3 p0, float3 p1) {
return (float3)(p0.y*p1.z - p0.z*p1.y, p0.z*p1.x - p0.x*p1.z,
p0.x*p1.y - p0.y*p1.x);
}
_CLC_OVERLOAD _CLC_DEF float4 cross(float4 p0, float4 p1) {
return (float4)(p0.y*p1.z - p0.z*p1.y, p0.z*p1.x - p0.x*p1.z,
p0.x*p1.y - p0.y*p1.x, 0.f);
}

View File

@@ -1,17 +0,0 @@
#include <clc/clc.h>
_CLC_OVERLOAD _CLC_DEF float dot(float p0, float p1) {
return p0*p1;
}
_CLC_OVERLOAD _CLC_DEF float dot(float2 p0, float2 p1) {
return p0.x*p1.x + p0.y*p1.y;
}
_CLC_OVERLOAD _CLC_DEF float dot(float3 p0, float3 p1) {
return p0.x*p1.x + p0.y*p1.y + p0.z*p1.z;
}
_CLC_OVERLOAD _CLC_DEF float dot(float4 p0, float4 p1) {
return p0.x*p1.x + p0.y*p1.y + p0.z*p1.z + p0.w*p1.w;
}

View File

@@ -1,4 +0,0 @@
#include <clc/clc.h>
#define BODY "length.inc"
#include <clc/geometric/floatn.inc>

View File

@@ -1,3 +0,0 @@
_CLC_OVERLOAD _CLC_DEF float length(FLOATN p) {
return native_sqrt(dot(p, p));
}

View File

@@ -1,4 +0,0 @@
#include <clc/clc.h>
#define BODY "normalize.inc"
#include <clc/geometric/floatn.inc>

View File

@@ -1,3 +0,0 @@
_CLC_OVERLOAD _CLC_DEF FLOATN normalize(FLOATN p) {
return p/length(p);
}

View File

@@ -1,4 +0,0 @@
#include <clc/clc.h>
#define BODY <abs.inc>
#include <clc/integer/gentype.inc>

View File

@@ -1,3 +0,0 @@
_CLC_OVERLOAD _CLC_DEF UGENTYPE abs(GENTYPE x) {
return __builtin_astype((GENTYPE)(x > (GENTYPE)(0) ? x : -x), UGENTYPE);
}

View File

@@ -1,4 +0,0 @@
#include <clc/clc.h>
#define BODY <abs_diff.inc>
#include <clc/integer/gentype.inc>

View File

@@ -1,3 +0,0 @@
_CLC_OVERLOAD _CLC_DEF UGENTYPE abs_diff(GENTYPE x) {
return __builtin_astype((GENTYPE)(x > y ? x-y : y-x), UGENTYPE);
}

View File

@@ -1,52 +0,0 @@
#include <clc/clc.h>
// From add_sat.ll
_CLC_DECL char __clc_add_sat_s8(char, char);
_CLC_DECL char __clc_add_sat_u8(uchar, uchar);
_CLC_DECL char __clc_add_sat_s16(short, short);
_CLC_DECL char __clc_add_sat_u16(ushort, ushort);
_CLC_DECL char __clc_add_sat_s32(int, int);
_CLC_DECL char __clc_add_sat_u32(uint, uint);
_CLC_DECL char __clc_add_sat_s64(long, long);
_CLC_DECL char __clc_add_sat_u64(ulong, ulong);
_CLC_OVERLOAD _CLC_DEF char add_sat(char x, char y) {
return __clc_add_sat_s8(x, y);
}
_CLC_OVERLOAD _CLC_DEF uchar add_sat(uchar x, uchar y) {
return __clc_add_sat_u8(x, y);
}
_CLC_OVERLOAD _CLC_DEF short add_sat(short x, short y) {
return __clc_add_sat_s16(x, y);
}
_CLC_OVERLOAD _CLC_DEF ushort add_sat(ushort x, ushort y) {
return __clc_add_sat_u16(x, y);
}
_CLC_OVERLOAD _CLC_DEF int add_sat(int x, int y) {
return __clc_add_sat_s32(x, y);
}
_CLC_OVERLOAD _CLC_DEF uint add_sat(uint x, uint y) {
return __clc_add_sat_u32(x, y);
}
_CLC_OVERLOAD _CLC_DEF long add_sat(long x, long y) {
return __clc_add_sat_s64(x, y);
}
_CLC_OVERLOAD _CLC_DEF ulong add_sat(ulong x, ulong y) {
return __clc_add_sat_u64(x, y);
}
_CLC_BINARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, char, add_sat, char, char)
_CLC_BINARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, uchar, add_sat, uchar, uchar)
_CLC_BINARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, short, add_sat, short, short)
_CLC_BINARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, ushort, add_sat, ushort, ushort)
_CLC_BINARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, int, add_sat, int, int)
_CLC_BINARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, uint, add_sat, uint, uint)
_CLC_BINARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, long, add_sat, long, long)
_CLC_BINARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, ulong, add_sat, ulong, ulong)

View File

@@ -1,55 +0,0 @@
declare i8 @__clc_add_sat_impl_s8(i8 %x, i8 %y)
define linkonce_odr i8 @__clc_add_sat_s8(i8 %x, i8 %y) nounwind readnone alwaysinline {
%call = call i8 @__clc_add_sat_impl_s8(i8 %x, i8 %y)
ret i8 %call
}
declare i8 @__clc_add_sat_impl_u8(i8 %x, i8 %y)
define linkonce_odr i8 @__clc_add_sat_u8(i8 %x, i8 %y) nounwind readnone alwaysinline {
%call = call i8 @__clc_add_sat_impl_u8(i8 %x, i8 %y)
ret i8 %call
}
declare i16 @__clc_add_sat_impl_s16(i16 %x, i16 %y)
define linkonce_odr i16 @__clc_add_sat_s16(i16 %x, i16 %y) nounwind readnone alwaysinline {
%call = call i16 @__clc_add_sat_impl_s16(i16 %x, i16 %y)
ret i16 %call
}
declare i16 @__clc_add_sat_impl_u16(i16 %x, i16 %y)
define linkonce_odr i16 @__clc_add_sat_u16(i16 %x, i16 %y) nounwind readnone alwaysinline {
%call = call i16 @__clc_add_sat_impl_u16(i16 %x, i16 %y)
ret i16 %call
}
declare i32 @__clc_add_sat_impl_s32(i32 %x, i32 %y)
define linkonce_odr i32 @__clc_add_sat_s32(i32 %x, i32 %y) nounwind readnone alwaysinline {
%call = call i32 @__clc_add_sat_impl_s32(i32 %x, i32 %y)
ret i32 %call
}
declare i32 @__clc_add_sat_impl_u32(i32 %x, i32 %y)
define linkonce_odr i32 @__clc_add_sat_u32(i32 %x, i32 %y) nounwind readnone alwaysinline {
%call = call i32 @__clc_add_sat_impl_u32(i32 %x, i32 %y)
ret i32 %call
}
declare i64 @__clc_add_sat_impl_s64(i64 %x, i64 %y)
define linkonce_odr i64 @__clc_add_sat_s64(i64 %x, i64 %y) nounwind readnone alwaysinline {
%call = call i64 @__clc_add_sat_impl_s64(i64 %x, i64 %y)
ret i64 %call
}
declare i64 @__clc_add_sat_impl_u64(i64 %x, i64 %y)
define linkonce_odr i64 @__clc_add_sat_u64(i64 %x, i64 %y) nounwind readnone alwaysinline {
%call = call i64 @__clc_add_sat_impl_u64(i64 %x, i64 %y)
ret i64 %call
}

View File

@@ -1,83 +0,0 @@
declare {i8, i1} @llvm.sadd.with.overflow.i8(i8, i8)
declare {i8, i1} @llvm.uadd.with.overflow.i8(i8, i8)
define linkonce_odr i8 @__clc_add_sat_impl_s8(i8 %x, i8 %y) nounwind readnone alwaysinline {
%call = call {i8, i1} @llvm.sadd.with.overflow.i8(i8 %x, i8 %y)
%res = extractvalue {i8, i1} %call, 0
%over = extractvalue {i8, i1} %call, 1
%x.msb = ashr i8 %x, 7
%x.limit = xor i8 %x.msb, 127
%sat = select i1 %over, i8 %x.limit, i8 %res
ret i8 %sat
}
define linkonce_odr i8 @__clc_add_sat_impl_u8(i8 %x, i8 %y) nounwind readnone alwaysinline {
%call = call {i8, i1} @llvm.uadd.with.overflow.i8(i8 %x, i8 %y)
%res = extractvalue {i8, i1} %call, 0
%over = extractvalue {i8, i1} %call, 1
%sat = select i1 %over, i8 -1, i8 %res
ret i8 %sat
}
declare {i16, i1} @llvm.sadd.with.overflow.i16(i16, i16)
declare {i16, i1} @llvm.uadd.with.overflow.i16(i16, i16)
define linkonce_odr i16 @__clc_add_sat_impl_s16(i16 %x, i16 %y) nounwind readnone alwaysinline {
%call = call {i16, i1} @llvm.sadd.with.overflow.i16(i16 %x, i16 %y)
%res = extractvalue {i16, i1} %call, 0
%over = extractvalue {i16, i1} %call, 1
%x.msb = ashr i16 %x, 15
%x.limit = xor i16 %x.msb, 32767
%sat = select i1 %over, i16 %x.limit, i16 %res
ret i16 %sat
}
define linkonce_odr i16 @__clc_add_sat_impl_u16(i16 %x, i16 %y) nounwind readnone alwaysinline {
%call = call {i16, i1} @llvm.uadd.with.overflow.i16(i16 %x, i16 %y)
%res = extractvalue {i16, i1} %call, 0
%over = extractvalue {i16, i1} %call, 1
%sat = select i1 %over, i16 -1, i16 %res
ret i16 %sat
}
declare {i32, i1} @llvm.sadd.with.overflow.i32(i32, i32)
declare {i32, i1} @llvm.uadd.with.overflow.i32(i32, i32)
define linkonce_odr i32 @__clc_add_sat_impl_s32(i32 %x, i32 %y) nounwind readnone alwaysinline {
%call = call {i32, i1} @llvm.sadd.with.overflow.i32(i32 %x, i32 %y)
%res = extractvalue {i32, i1} %call, 0
%over = extractvalue {i32, i1} %call, 1
%x.msb = ashr i32 %x, 31
%x.limit = xor i32 %x.msb, 2147483647
%sat = select i1 %over, i32 %x.limit, i32 %res
ret i32 %sat
}
define linkonce_odr i32 @__clc_add_sat_impl_u32(i32 %x, i32 %y) nounwind readnone alwaysinline {
%call = call {i32, i1} @llvm.uadd.with.overflow.i32(i32 %x, i32 %y)
%res = extractvalue {i32, i1} %call, 0
%over = extractvalue {i32, i1} %call, 1
%sat = select i1 %over, i32 -1, i32 %res
ret i32 %sat
}
declare {i64, i1} @llvm.sadd.with.overflow.i64(i64, i64)
declare {i64, i1} @llvm.uadd.with.overflow.i64(i64, i64)
define linkonce_odr i64 @__clc_add_sat_impl_s64(i64 %x, i64 %y) nounwind readnone alwaysinline {
%call = call {i64, i1} @llvm.sadd.with.overflow.i64(i64 %x, i64 %y)
%res = extractvalue {i64, i1} %call, 0
%over = extractvalue {i64, i1} %call, 1
%x.msb = ashr i64 %x, 63
%x.limit = xor i64 %x.msb, 9223372036854775807
%sat = select i1 %over, i64 %x.limit, i64 %res
ret i64 %sat
}
define linkonce_odr i64 @__clc_add_sat_impl_u64(i64 %x, i64 %y) nounwind readnone alwaysinline {
%call = call {i64, i1} @llvm.uadd.with.overflow.i64(i64 %x, i64 %y)
%res = extractvalue {i64, i1} %call, 0
%over = extractvalue {i64, i1} %call, 1
%sat = select i1 %over, i64 -1, i64 %res
ret i64 %sat
}

View File

@@ -1,6 +0,0 @@
_CLC_INLINE void barrier(cl_mem_fence_flags flags) {
if (flags & CLK_LOCAL_MEM_FENCE) {
__builtin_ptx_bar_sync(0);
}
}

View File

@@ -1,8 +0,0 @@
_CLC_INLINE size_t get_global_id(uint dim) {
switch (dim) {
case 0: return __builtin_ptx_read_ctaid_x()*__builtin_ptx_read_ntid_x()+__builtin_ptx_read_tid_x();
case 1: return __builtin_ptx_read_ctaid_y()*__builtin_ptx_read_ntid_y()+__builtin_ptx_read_tid_y();
case 2: return __builtin_ptx_read_ctaid_z()*__builtin_ptx_read_ntid_z()+__builtin_ptx_read_tid_z();
default: return 0;
}
}

View File

@@ -1,8 +0,0 @@
_CLC_INLINE size_t get_global_size(uint dim) {
switch (dim) {
case 0: return __builtin_ptx_read_nctaid_x()*__builtin_ptx_read_ntid_x();
case 1: return __builtin_ptx_read_nctaid_y()*__builtin_ptx_read_ntid_y();
case 2: return __builtin_ptx_read_nctaid_z()*__builtin_ptx_read_ntid_z();
default: return 0;
}
}

View File

@@ -1,8 +0,0 @@
_CLC_INLINE size_t get_group_id(uint dim) {
switch (dim) {
case 0: return __builtin_ptx_read_ctaid_x();
case 1: return __builtin_ptx_read_ctaid_y();
case 2: return __builtin_ptx_read_ctaid_z();
default: return 0;
}
}

View File

@@ -1,8 +0,0 @@
_CLC_INLINE size_t get_local_id(uint dim) {
switch (dim) {
case 0: return __builtin_ptx_read_tid_x();
case 1: return __builtin_ptx_read_tid_y();
case 2: return __builtin_ptx_read_tid_z();
default: return 0;
}
}

View File

@@ -1,8 +0,0 @@
_CLC_INLINE size_t get_local_size(uint dim) {
switch (dim) {
case 0: return __builtin_ptx_read_ntid_x();
case 1: return __builtin_ptx_read_ntid_y();
case 2: return __builtin_ptx_read_ntid_z();
default: return 0;
}
}

View File

@@ -1,8 +0,0 @@
_CLC_INLINE size_t get_num_groups(uint dim) {
switch (dim) {
case 0: return __builtin_ptx_read_nctaid_x();
case 1: return __builtin_ptx_read_nctaid_y();
case 2: return __builtin_ptx_read_nctaid_z();
default: return 0;
}
}

View File

@@ -1 +0,0 @@
integer/add_sat.ll

View File

@@ -1,55 +0,0 @@
declare i8 @__clc_add_sat_impl_s8(i8 %x, i8 %y)
define linkonce_odr ptx_device i8 @__clc_add_sat_s8(i8 %x, i8 %y) nounwind readnone alwaysinline {
%call = call i8 @__clc_add_sat_impl_s8(i8 %x, i8 %y)
ret i8 %call
}
declare i8 @__clc_add_sat_impl_u8(i8 %x, i8 %y)
define linkonce_odr ptx_device i8 @__clc_add_sat_u8(i8 %x, i8 %y) nounwind readnone alwaysinline {
%call = call i8 @__clc_add_sat_impl_u8(i8 %x, i8 %y)
ret i8 %call
}
declare i16 @__clc_add_sat_impl_s16(i16 %x, i16 %y)
define linkonce_odr ptx_device i16 @__clc_add_sat_s16(i16 %x, i16 %y) nounwind readnone alwaysinline {
%call = call i16 @__clc_add_sat_impl_s16(i16 %x, i16 %y)
ret i16 %call
}
declare i16 @__clc_add_sat_impl_u16(i16 %x, i16 %y)
define linkonce_odr ptx_device i16 @__clc_add_sat_u16(i16 %x, i16 %y) nounwind readnone alwaysinline {
%call = call i16 @__clc_add_sat_impl_u16(i16 %x, i16 %y)
ret i16 %call
}
declare i32 @__clc_add_sat_impl_s32(i32 %x, i32 %y)
define linkonce_odr ptx_device i32 @__clc_add_sat_s32(i32 %x, i32 %y) nounwind readnone alwaysinline {
%call = call i32 @__clc_add_sat_impl_s32(i32 %x, i32 %y)
ret i32 %call
}
declare i32 @__clc_add_sat_impl_u32(i32 %x, i32 %y)
define linkonce_odr ptx_device i32 @__clc_add_sat_u32(i32 %x, i32 %y) nounwind readnone alwaysinline {
%call = call i32 @__clc_add_sat_impl_u32(i32 %x, i32 %y)
ret i32 %call
}
declare i64 @__clc_add_sat_impl_s64(i64 %x, i64 %y)
define linkonce_odr ptx_device i64 @__clc_add_sat_s64(i64 %x, i64 %y) nounwind readnone alwaysinline {
%call = call i64 @__clc_add_sat_impl_s64(i64 %x, i64 %y)
ret i64 %call
}
declare i64 @__clc_add_sat_impl_u64(i64 %x, i64 %y)
define linkonce_odr ptx_device i64 @__clc_add_sat_u64(i64 %x, i64 %y) nounwind readnone alwaysinline {
%call = call i64 @__clc_add_sat_impl_u64(i64 %x, i64 %y)
ret i64 %call
}

View File

@@ -1,3 +0,0 @@
__kernel void foo(float4 *f) {
*f = cos(*f);
}

View File

@@ -1,3 +0,0 @@
__kernel void foo(float4 *f) {
*f = cross(f[0], f[1]);
}

View File

@@ -1,3 +0,0 @@
__kernel void foo(int *i) {
i[get_group_id(0)] = 1;
}

View File

@@ -1,81 +0,0 @@
#include "llvm/ADT/OwningPtr.h"
#include "llvm/Bitcode/ReaderWriter.h"
#include "llvm/Function.h"
#include "llvm/GlobalVariable.h"
#include "llvm/LLVMContext.h"
#include "llvm/Module.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Support/system_error.h"
#include "llvm/Support/ToolOutputFile.h"
using namespace llvm;
static cl::opt<std::string>
InputFilename(cl::Positional, cl::desc("<input bitcode>"), cl::init("-"));
static cl::opt<std::string>
OutputFilename("o", cl::desc("Output filename"),
cl::value_desc("filename"));
int main(int argc, char **argv) {
LLVMContext &Context = getGlobalContext();
llvm_shutdown_obj Y; // Call llvm_shutdown() on exit.
cl::ParseCommandLineOptions(argc, argv, "libclc builtin preparation tool\n");
std::string ErrorMessage;
std::auto_ptr<Module> M;
{
OwningPtr<MemoryBuffer> BufferPtr;
if (error_code ec = MemoryBuffer::getFileOrSTDIN(InputFilename, BufferPtr))
ErrorMessage = ec.message();
else
M.reset(ParseBitcodeFile(BufferPtr.get(), Context, &ErrorMessage));
}
if (M.get() == 0) {
errs() << argv[0] << ": ";
if (ErrorMessage.size())
errs() << ErrorMessage << "\n";
else
errs() << "bitcode didn't read correctly.\n";
return 1;
}
// Set linkage of every external definition to linkonce_odr.
for (Module::iterator i = M->begin(), e = M->end(); i != e; ++i) {
if (!i->isDeclaration() && i->getLinkage() == GlobalValue::ExternalLinkage)
i->setLinkage(GlobalValue::LinkOnceODRLinkage);
}
for (Module::global_iterator i = M->global_begin(), e = M->global_end();
i != e; ++i) {
if (!i->isDeclaration() && i->getLinkage() == GlobalValue::ExternalLinkage)
i->setLinkage(GlobalValue::LinkOnceODRLinkage);
}
if (OutputFilename.empty()) {
errs() << "no output file\n";
return 1;
}
std::string ErrorInfo;
OwningPtr<tool_output_file> Out
(new tool_output_file(OutputFilename.c_str(), ErrorInfo,
raw_fd_ostream::F_Binary));
if (!ErrorInfo.empty()) {
errs() << ErrorInfo << '\n';
exit(1);
}
WriteBitcodeToFile(M.get(), Out->os());
// Declare success.
Out->keep();
return 0;
}

View File

@@ -1,55 +0,0 @@
<html>
<head>
<title>libclc</title>
</head>
<body>
<h1>libclc</h1>
<p>
libclc is an open source, BSD/MIT dual licensed
implementation of the library requirements of the
OpenCL C programming language, as specified by the <a
href="http://www.khronos.org/registry/cl/specs/opencl-1.1.pdf">OpenCL
1.1 Specification</a>. The following sections of the specification
impose library requirements:
<ul>
<li>6.1: Supported Data Types
<li>6.2.3: Explicit Conversions
<li>6.2.4.2: Reinterpreting Types Using as_type() and as_typen()
<li>6.9: Preprocessor Directives and Macros
<li>6.11: Built-in Functions
<li>9.3: Double Precision Floating-Point
<li>9.4: 64-bit Atomics
<li>9.5: Writing to 3D image memory objects
<li>9.6: Half Precision Floating-Point
</ul>
</p>
<p>
libclc is intended to be used with the <a href="http://clang.llvm.org/">Clang</a>
compiler's OpenCL frontend.
</p>
<p>
libclc is designed to be portable and extensible. To this end,
it provides generic implementations of most library requirements,
allowing the target to override the generic implementation at the
granularity of individual functions.
</p>
<p>
libclc currently only supports the PTX target, but support for more
targets is welcome.
</p>
<h2>Download</h2>
<tt>svn checkout http://llvm.org/svn/llvm-project/libclc/trunk libclc</tt> (<a href="http://llvm.org/viewvc/llvm-project/libclc/trunk/">ViewVC</a>)
<br>- or -<br>
<tt>git clone http://llvm.org/git/libclc.git</tt>
<h2>Mailing List</h2>
libclc-dev@pcc.me.uk (<a href="http://www.pcc.me.uk/cgi-bin/mailman/listinfo/libclc-dev">subscribe/unsubscribe</a>, <a href="http://www.pcc.me.uk/pipermail/libclc-dev/">archives</a>)
</body>
</html>

View File

@@ -1,159 +0,0 @@
# See www/CMake.html for instructions on how to build libcxx with CMake.
#===============================================================================
# Setup Project
#===============================================================================
project(libcxx CXX C)
cmake_minimum_required(VERSION 2.8)
set(PACKAGE_NAME libcxx)
set(PACKAGE_VERSION trunk-svn)
set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
set(PACKAGE_BUGREPORT "llvmbugs@cs.uiuc.edu")
# Add path for custom modules
set(CMAKE_MODULE_PATH
${CMAKE_MODULE_PATH}
"${CMAKE_CURRENT_SOURCE_DIR}/cmake"
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules"
)
# Require out of source build.
include(MacroEnsureOutOfSourceBuild)
MACRO_ENSURE_OUT_OF_SOURCE_BUILD(
"${PROJECT_NAME} requires an out of source build. Please create a separate
build directory and run 'cmake /path/to/${PROJECT_NAME} [options]' there."
)
#===============================================================================
# Setup CMake Options
#===============================================================================
# Define options.
option(LIBCXX_ENABLE_EXCEPTIONS "Use exceptions." ON)
option(LIBCXX_ENABLE_RTTI "Use run time type information." ON)
option(LIBCXX_ENABLE_ASSERTIONS "Enable assertions independent of build mode." ON)
option(LIBCXX_ENABLE_PEDANTIC "Compile with pedantic enabled." ON)
option(LIBCXX_ENABLE_WERROR "Fail and stop if a warning is triggered." OFF)
option(LIBCXX_ENABLE_CXX0X "Enable -std=c++0x and use of c++0x language features if the compiler supports it." ON)
option(LIBCXX_ENABLE_SHARED "Build libc++ as a shared library." ON)
#===============================================================================
# Configure System
#===============================================================================
# Get triples.
include(GetTriple)
get_host_triple(LIBCXX_HOST_TRIPLE
LIBCXX_HOST_ARCH
LIBCXX_HOST_VENDOR
LIBCXX_HOST_OS
)
set(LIBCXX_HOST_TRIPLE ${LIBCXX_HOST_TRIPLE} CACHE STRING "Host triple.")
get_target_triple(LIBCXX_TARGET_TRIPLE
LIBCXX_TARGET_ARCH
LIBCXX_TARGET_VENDOR
LIBCXX_TARGET_OS
)
set(LIBCXX_TARGET_TRIPLE ${LIBCXX_TARGET_TRIPLE} CACHE STRING "Target triple.")
# Configure compiler.
include(config-ix)
#===============================================================================
# Setup Compiler Flags
#===============================================================================
# Get required flags.
# On all systems the system c++ standard library headers need to be excluded.
if (MSVC)
# MSVC only has -X, which disables all default includes; including the crt.
# Thus, we do nothing and hope we don't accidentally include any of the C++
# headers.
else()
if (LIBCXX_HAS_NOSTDINCXX_FLAG)
set(LIBCXX_CXX_REQUIRED_FLAGS -nostdinc++)
endif()
if (LIBCXX_ENABLE_CXX0X AND LIBCXX_HAS_STDCXX0X_FLAG)
list(APPEND LIBCXX_CXX_REQUIRED_FLAGS -std=c++0x)
endif()
endif()
macro(append_if list condition var)
if (${condition})
list(APPEND ${list} ${var})
endif()
endmacro()
# Get warning flags
append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_WALL_FLAG -Wall)
append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_W_FLAG -W)
append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_WNO_UNUSED_PARAMETER_FLAG -Wno-unused-parameter)
append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_WWRITE_STRINGS_FLAG -Wwrite-strings)
append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_WNO_LONG_LONG_FLAG -Wno-long-long)
if (LIBCXX_ENABLE_WERROR)
append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_WERROR_FLAG -Werror)
append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_WX_FLAG -WX)
endif()
if (LIBCXX_ENABLE_PEDANTIC)
append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_PEDANTIC_FLAG -pedantic)
endif()
# Get feature flags.
# Exceptions
if (LIBCXX_ENABLE_EXCEPTIONS)
# Catches C++ exceptions only and tells the compiler to assume that extern C
# functions never throw a C++ exception.
append_if(LIBCXX_CXX_FEATURE_FLAGS LIBCXX_HAS_EHSC_FLAG -EHsc)
else()
list(APPEND LIBCXX_CXX_FEATURE_FLAGS -D_LIBCPP_NO_EXCEPTIONS)
append_if(LIBCXX_CXX_FEATURE_FLAGS LIBCXX_HAS_NO_EHS_FLAG -EHs-)
append_if(LIBCXX_CXX_FEATURE_FLAGS LIBCXX_HAS_NO_EHA_FLAG -EHa-)
append_if(LIBCXX_CXX_FEATURE_FLAGS LIBCXX_HAS_FNO_EXCEPTIONS_FLAG -fno-exceptions)
endif()
# RTTI
if (NOT LIBCXX_ENABLE_RTTI)
list(APPEND LIBCXX_CXX_FEATURE_FLAGS -D_LIBCPP_NO_RTTI)
append_if(LIBCXX_CXX_FEATURE_FLAGS LIBCXX_HAS_NO_GR_FLAG -GR-)
append_if(LIBCXX_CXX_FEATURE_FLAGS LIBCXX_HAS_FNO_RTTI_FLAG -fno-rtti)
endif()
# Assert
if (LLVM_ENABLE_ASSERTIONS)
# MSVC doesn't like _DEBUG on release builds. See PR 4379.
if (NOT MSVC)
list(APPEND LIBCXX_CXX_FEATURE_FLAGS -D_DEBUG)
endif()
# On Release builds cmake automatically defines NDEBUG, so we
# explicitly undefine it:
if (uppercase_CMAKE_BUILD_TYPE STREQUAL "RELEASE")
list(APPEND LIBCXX_CXX_FEATURE_FLAGS -UNDEBUG)
endif()
else()
if (NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "RELEASE")
list(APPEND LIBCXX_CXX_FEATURE_FLAGS -DNDEBUG)
endif()
endif()
# This is the _ONLY_ place where add_definitions is called.
add_definitions(
${LIBCXX_CXX_REQUIRED_FLAGS}
${LIBCXX_CXX_WARNING_FLAGS}
${LIBCXX_CXX_FEATURE_FLAGS}
)
#===============================================================================
# Setup Source Code
#===============================================================================
include_directories(include)
# Add source code. This also contains all of the logic for deciding linker flags
# soname, etc...
add_subdirectory(lib)
#===============================================================================
# Setup Tests
#===============================================================================
add_subdirectory(test)

View File

@@ -1,49 +0,0 @@
This file is a partial list of people who have contributed to the LLVM/libc++
project. If you have contributed a patch or made some other contribution to
LLVM/libc++, please submit a patch to this file to add yourself, and it will be
done!
The list is sorted by surname and formatted to allow easy grepping and
beautification by scripts. The fields are: name (N), email (E), web-address
(W), PGP key ID and fingerprint (P), description (D), and snail-mail address
(S).
N: Howard Hinnant
E: hhinnant@apple.com
D: Architect and primary author of libc++
N: Marshall Clow
E: marshall@idio.com
E: mclow@qualcomm.com
D: Minor patches and bug fixes.
N: Bjorn Reese
E: breese@users.sourceforge.net
D: Initial regex prototype
N: David Chisnall
E: theraven at theravensnest dot org
D: FreeBSD and Solaris ports, libcxxrt support, some atomics work.
N: Ruben Van Boxem
E: vanboxem dot ruben at gmail dot com
D: Initial Windows patches.
N: Arvid Picciani
E: aep at exys dot org
D: Minor patches and musl port.
N: Craig Silverstein
E: csilvers@google.com
D: Implemented Cityhash as the string hash function on 64-bit machines
N: Google Inc.
D: Copyright owner and contributor of the CityHash algorithm
N: Jeffrey Yasskin
E: jyasskin@gmail.com
E: jyasskin@google.com
D: Linux fixes.
N: Jonathan Sauer
D: Minor patches, mostly related to constexpr

View File

@@ -1,76 +0,0 @@
==============================================================================
libc++ License
==============================================================================
The libc++ library is dual licensed under both the University of Illinois
"BSD-Like" license and the MIT license. As a user of this code you may choose
to use it under either license. As a contributor, you agree to allow your code
to be used under both.
Full text of the relevant licenses is included below.
==============================================================================
University of Illinois/NCSA
Open Source License
Copyright (c) 2009-2012 by the contributors listed in CREDITS.TXT
All rights reserved.
Developed by:
LLVM Team
University of Illinois at Urbana-Champaign
http://llvm.org
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal with
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimers.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimers in the
documentation and/or other materials provided with the distribution.
* Neither the names of the LLVM Team, University of Illinois at
Urbana-Champaign, nor the names of its contributors may be used to
endorse or promote products derived from this Software without specific
prior written permission.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
SOFTWARE.
==============================================================================
Copyright (c) 2009-2012 by the contributors listed in CREDITS.TXT
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@@ -1,55 +0,0 @@
##
# libcpp Makefile
##
SRCDIRS = .
DESTDIR = $(DSTROOT)
OBJROOT=.
SYMROOT=.
export TRIPLE=-apple-
ifeq (,$(RC_INDIGO))
INSTALL_PREFIX=""
else
INSTALL_PREFIX="$(SDKROOT)"
endif
INSTALL_DIR=$(DSTROOT)/$(INSTALL_PREFIX)
.PHONY: help installsrc clean installheaders do-installhdrs install
help::
echo Use make install DSTROOT=<destination>
installsrc:: $(SRCROOT)
ditto $(SRCDIRS)/include $(SRCROOT)/include
ditto $(SRCDIRS)/lib $(SRCROOT)/lib
ditto $(SRCDIRS)/src $(SRCROOT)/src
ditto $(SRCDIRS)/Makefile $(SRCROOT)/Makefile
clean::
installheaders:: do-installhdrs
# The do-installhdrs target is also used by clang's runtime/libcxx makefile.
do-installhdrs:
mkdir -p $(HEADER_DIR)/c++/v1/ext
rsync -r --exclude=".*" --exclude="support" $(SRCDIRS)/include/* \
$(HEADER_DIR)/c++/v1/
chown -R root:wheel $(HEADER_DIR)/c++
chmod 755 $(HEADER_DIR)/c++/v1
chmod 644 $(HEADER_DIR)/c++/v1/*
chmod 755 $(HEADER_DIR)/c++/v1/ext
chmod 644 $(HEADER_DIR)/c++/v1/ext/*
install::
cd lib && ./buildit
ditto lib/libc++.1.dylib $(SYMROOT)/usr/lib/libc++.1.dylib
cd lib && dsymutil -o $(SYMROOT)/libc++.1.dylib.dSYM \
$(SYMROOT)/usr/lib/libc++.1.dylib
mkdir -p $(INSTALL_DIR)/usr/lib
strip -S -o $(INSTALL_DIR)/usr/lib/libc++.1.dylib \
$(SYMROOT)/usr/lib/libc++.1.dylib
cd $(INSTALL_DIR)/usr/lib && ln -s libc++.1.dylib libc++.dylib

View File

@@ -1,53 +0,0 @@
# Define functions to get the host and target triple.
function(get_host_triple out out_arch out_vendor out_os)
# Get the architecture.
set(arch ${CMAKE_HOST_SYSTEM_PROCESSOR})
if (arch STREQUAL "x86")
set(arch "i686")
endif()
# Get the vendor.
if (${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Darwin")
set(vendor "apple")
else()
set(vendor "pc")
endif()
# Get os.
if (${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Windows")
set(os "win32")
else()
string(TOLOWER ${CMAKE_HOST_SYSTEM_NAME} os)
endif()
set(triple "${arch}-${vendor}-${os}")
set(${out} ${triple} PARENT_SCOPE)
set(${out_arch} ${arch} PARENT_SCOPE)
set(${out_vendor} ${vendor} PARENT_SCOPE)
set(${out_os} ${os} PARENT_SCOPE)
message(STATUS "Host triple: ${triple}")
endfunction()
function(get_target_triple out out_arch out_vendor out_os)
# Get the architecture.
set(arch ${CMAKE_SYSTEM_PROCESSOR})
if (arch STREQUAL "x86")
set(arch "i686")
endif()
# Get the vendor.
if (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
set(vendor "apple")
else()
set(vendor "pc")
endif()
# Get os.
if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
set(os "win32")
else()
string(TOLOWER ${CMAKE_SYSTEM_NAME} os)
endif()
set(triple "${arch}-${vendor}-${os}")
set(${out} ${triple} PARENT_SCOPE)
set(${out_arch} ${arch} PARENT_SCOPE)
set(${out_vendor} ${vendor} PARENT_SCOPE)
set(${out_os} ${os} PARENT_SCOPE)
message(STATUS "Target triple: ${triple}")
endfunction()

View File

@@ -1,18 +0,0 @@
# MACRO_ENSURE_OUT_OF_SOURCE_BUILD(<errorMessage>)
macro( MACRO_ENSURE_OUT_OF_SOURCE_BUILD _errorMessage )
string( COMPARE EQUAL "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" _insource )
if( _insource )
message( SEND_ERROR "${_errorMessage}" )
message( FATAL_ERROR
"In-source builds are not allowed.
CMake would overwrite the makefiles distributed with Compiler-RT.
Please create a directory and run cmake from there, passing the path
to this source directory as the last argument.
This process created the file `CMakeCache.txt' and the directory `CMakeFiles'.
Please delete them."
)
endif( _insource )
endmacro( MACRO_ENSURE_OUT_OF_SOURCE_BUILD )

View File

@@ -1,38 +0,0 @@
include(CheckLibraryExists)
include(CheckCXXCompilerFlag)
# Check compiler flags
check_cxx_compiler_flag(-std=c++0x LIBCXX_HAS_STDCXX0X_FLAG)
check_cxx_compiler_flag(-fPIC LIBCXX_HAS_FPIC_FLAG)
check_cxx_compiler_flag(-nodefaultlibs LIBCXX_HAS_NODEFAULTLIBS_FLAG)
check_cxx_compiler_flag(-nostdinc++ LIBCXX_HAS_NOSTDINCXX_FLAG)
check_cxx_compiler_flag(-Wall LIBCXX_HAS_WALL_FLAG)
check_cxx_compiler_flag(-W LIBCXX_HAS_W_FLAG)
check_cxx_compiler_flag(-Wno-unused-parameter LIBCXX_HAS_WNO_UNUSED_PARAMETER_FLAG)
check_cxx_compiler_flag(-Wwrite-strings LIBCXX_HAS_WWRITE_STRINGS_FLAG)
check_cxx_compiler_flag(-Wno-long-long LIBCXX_HAS_WNO_LONG_LONG_FLAG)
check_cxx_compiler_flag(-pedantic LIBCXX_HAS_PEDANTIC_FLAG)
check_cxx_compiler_flag(-Werror LIBCXX_HAS_WERROR_FLAG)
check_cxx_compiler_flag(-fno-exceptions LIBCXX_HAS_FNO_EXCEPTIONS_FLAG)
check_cxx_compiler_flag(-fno-rtti LIBCXX_HAS_FNO_RTTI_FLAG)
check_cxx_compiler_flag(/WX LIBCXX_HAS_WX_FLAG)
check_cxx_compiler_flag(/EHsc LIBCXX_HAS_EHSC_FLAG)
check_cxx_compiler_flag(/EHs- LIBCXX_HAS_NO_EHS_FLAG)
check_cxx_compiler_flag(/EHa- LIBCXX_HAS_NO_EHA_FLAG)
check_cxx_compiler_flag(/GR- LIBCXX_HAS_NO_GR_FLAG)
# Check libraries
check_library_exists(pthread pthread_create "" LIBCXX_HAS_PTHREAD_LIB)
check_library_exists(c printf "" LIBCXX_HAS_C_LIB)
check_library_exists(m ccos "" LIBCXX_HAS_M_LIB)
check_library_exists(rt clock_gettime "" LIBCXX_HAS_RT_LIB)
check_library_exists(gcc_s __gcc_personality_v0 "" LIBCXX_HAS_GCC_S_LIB)
# Check C++0x features
if (LIBCXX_ENABLE_CXX0X)
if (LIBCXX_HAS_STDCXX0X_FLAG)
set(CMAKE_REQUIRED_DEFINITIONS -std=c++0x)
endif()
else()
set(LIBCXX_HAS_STDCXX0X_FLAG FALSE)
endif()

File diff suppressed because it is too large Load Diff

View File

@@ -1,445 +0,0 @@
// -*- C++ -*-
//===--------------------------- __config ---------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef _LIBCPP_CONFIG
#define _LIBCPP_CONFIG
#if !_MSC_VER // explicit macro necessary because it is only defined below in this file
#pragma GCC system_header
#endif
#define _LIBCPP_VERSION 1001
#define _LIBCPP_ABI_VERSION 1
#define _LIBCPP_CONCAT1(_LIBCPP_X,_LIBCPP_Y) _LIBCPP_X##_LIBCPP_Y
#define _LIBCPP_CONCAT(_LIBCPP_X,_LIBCPP_Y) _LIBCPP_CONCAT1(_LIBCPP_X,_LIBCPP_Y)
#define _LIBCPP_NAMESPACE _LIBCPP_CONCAT(__,_LIBCPP_ABI_VERSION)
#ifdef __LITTLE_ENDIAN__
#if __LITTLE_ENDIAN__
#define _LIBCPP_LITTLE_ENDIAN 1
#define _LIBCPP_BIG_ENDIAN 0
#endif // __LITTLE_ENDIAN__
#endif // __LITTLE_ENDIAN__
#ifdef __BIG_ENDIAN__
#if __BIG_ENDIAN__
#define _LIBCPP_LITTLE_ENDIAN 0
#define _LIBCPP_BIG_ENDIAN 1
#endif // __BIG_ENDIAN__
#endif // __BIG_ENDIAN__
#ifdef __FreeBSD__
# include <sys/endian.h>
# if _BYTE_ORDER == _LITTLE_ENDIAN
# define _LIBCPP_LITTLE_ENDIAN 1
# define _LIBCPP_BIG_ENDIAN 0
# else // _BYTE_ORDER == _LITTLE_ENDIAN
# define _LIBCPP_LITTLE_ENDIAN 0
# define _LIBCPP_BIG_ENDIAN 1
# endif // _BYTE_ORDER == _LITTLE_ENDIAN
#endif // __FreeBSD__
#ifdef _WIN32
# define _LIBCPP_LITTLE_ENDIAN 1
# define _LIBCPP_BIG_ENDIAN 0
// Compiler intrinsics (GCC or MSVC)
# if (defined(_MSC_VER) && _MSC_VER >= 1400) || (__GNUC__ >= 4 && __GNUC_MINOR__ > 3)
# define _LIBCP_HAS_IS_BASE_OF
# endif
#endif // _WIN32
#ifdef __sun__
# include <sys/isa_defs.h>
# ifdef _LITTLE_ENDIAN
# define _LIBCPP_LITTLE_ENDIAN 1
# define _LIBCPP_BIG_ENDIAN 0
# else
# define _LIBCPP_LITTLE_ENDIAN 0
# define _LIBCPP_BIG_ENDIAN 1
# endif
#endif // __sun__
#if !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN)
# include <endian.h>
# if __BYTE_ORDER == __LITTLE_ENDIAN
# define _LIBCPP_LITTLE_ENDIAN 1
# define _LIBCPP_BIG_ENDIAN 0
# elif __BYTE_ORDER == __BIG_ENDIAN
# define _LIBCPP_LITTLE_ENDIAN 0
# define _LIBCPP_BIG_ENDIAN 1
# else // __BYTE_ORDER == __BIG_ENDIAN
# error unable to determine endian
# endif
#endif // !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN)
#if _WIN32
// only really useful for a DLL
#ifdef _LIBCPP_DLL // this should be a compiler builtin define ideally...
# ifdef cxx_EXPORTS
# define _LIBCPP_HIDDEN
# define _LIBCPP_VISIBLE __declspec(dllexport)
# else
# define _LIBCPP_HIDDEN
# define _LIBCPP_VISIBLE __declspec(dllimport)
# endif
#else
# define _LIBCPP_HIDDEN
# define _LIBCPP_VISIBLE
#endif
#ifndef _LIBCPP_INLINE_VISIBILITY
# if _MSC_VER
# define _LIBCPP_INLINE_VISIBILITY __forceinline
# else // MinGW GCC and Clang
# define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__always_inline__))
# endif
#endif
#ifndef _LIBCPP_EXCEPTION_ABI
#define _LIBCPP_EXCEPTION_ABI _LIBCPP_VISIBLE
#endif
#ifndef _LIBCPP_ALWAYS_INLINE
# if _MSC_VER
# define _LIBCPP_ALWAYS_INLINE __forceinline
# endif
#endif
#endif // _WIN32
#ifndef _LIBCPP_HIDDEN
#define _LIBCPP_HIDDEN __attribute__ ((__visibility__("hidden")))
#endif
#ifndef _LIBCPP_VISIBLE
#define _LIBCPP_VISIBLE __attribute__ ((__visibility__("default")))
#endif
#ifndef _LIBCPP_INLINE_VISIBILITY
#define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__visibility__("hidden"), __always_inline__))
#endif
#ifndef _LIBCPP_EXCEPTION_ABI
#define _LIBCPP_EXCEPTION_ABI __attribute__ ((__visibility__("default")))
#endif
#ifndef _LIBCPP_CANTTHROW
#define _LIBCPP_CANTTHROW __attribute__ ((__nothrow__))
#endif
#ifndef _LIBCPP_ALWAYS_INLINE
#define _LIBCPP_ALWAYS_INLINE __attribute__ ((__visibility__("hidden"), __always_inline__))
#endif
#if defined(__clang__)
#if __has_feature(cxx_alignas)
# define _ALIGNAS(x) alignas(x)
#else
# define _ALIGNAS(x) __attribute__((__aligned__(x)))
#endif
#if !__has_feature(cxx_alias_templates)
#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
#endif
#ifndef __GXX_EXPERIMENTAL_CXX0X__
#ifdef __linux__
#define _LIBCPP_HAS_NO_UNICODE_CHARS
#else
typedef __char16_t char16_t;
typedef __char32_t char32_t;
#endif
#endif
#if !(__has_feature(cxx_exceptions))
#define _LIBCPP_NO_EXCEPTIONS
#endif
#if !(__has_feature(cxx_rtti))
#define _LIBCPP_NO_RTTI
#endif
#if !(__has_feature(cxx_strong_enums))
#define _LIBCPP_HAS_NO_STRONG_ENUMS
#endif
#if !(__has_feature(cxx_decltype))
#define _LIBCPP_HAS_NO_DECLTYPE
#endif
#if __has_feature(cxx_attributes)
# define _ATTRIBUTE(x) [[x]]
#else
# define _ATTRIBUTE(x) __attribute__ ((x))
#endif
#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
#if !(__has_feature(cxx_deleted_functions))
#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
#endif // !(__has_feature(cxx_deleted_functions))
#if !(__has_feature(cxx_lambdas))
#define _LIBCPP_HAS_NO_LAMBDAS
#endif
#if !(__has_feature(cxx_nullptr))
#define _LIBCPP_HAS_NO_NULLPTR
#endif
#if !(__has_feature(cxx_rvalue_references))
#define _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
#if !(__has_feature(cxx_static_assert))
#define _LIBCPP_HAS_NO_STATIC_ASSERT
#endif
#if !(__has_feature(cxx_auto_type))
#define _LIBCPP_HAS_NO_AUTO_TYPE
#endif
#if !(__has_feature(cxx_access_control_sfinae)) || !__has_feature(cxx_trailing_return)
#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
#endif
#if !(__has_feature(cxx_variadic_templates))
#define _LIBCPP_HAS_NO_VARIADICS
#endif
#if !(__has_feature(cxx_trailing_return))
#define _LIBCPP_HAS_NO_TRAILING_RETURN
#endif
#if !(__has_feature(cxx_generalized_initializers))
#define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#endif
#if __has_feature(is_base_of)
# define _LIBCP_HAS_IS_BASE_OF
#endif
// Objective-C++ features (opt-in)
#if __has_feature(objc_arc)
#define _LIBCPP_HAS_OBJC_ARC
#endif
#if __has_feature(objc_arc_weak)
#define _LIBCPP_HAS_OBJC_ARC_WEAK
#define _LIBCPP_HAS_NO_STRONG_ENUMS
#endif
#if !(__has_feature(cxx_constexpr))
#define _LIBCPP_HAS_NO_CONSTEXPR
#endif
#if __FreeBSD__
#define _LIBCPP_HAS_QUICK_EXIT
#endif
#if (__has_feature(cxx_noexcept))
# define _NOEXCEPT noexcept
# define _NOEXCEPT_(x) noexcept(x)
#else
# define _NOEXCEPT throw()
# define _NOEXCEPT_(x)
#endif
#if __has_feature(underlying_type)
# define _LIBCXX_UNDERLYING_TYPE(T) __underlying_type(T)
#endif
// Inline namespaces are available in Clang regardless of C++ dialect.
#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {inline namespace _LIBCPP_NAMESPACE {
#define _LIBCPP_END_NAMESPACE_STD } }
#define _VSTD std::_LIBCPP_NAMESPACE
namespace std {
inline namespace _LIBCPP_NAMESPACE {
}
}
#elif defined(__GNUC__)
#define _ALIGNAS(x) __attribute__((__aligned__(x)))
#define _ATTRIBUTE(x) __attribute__((x))
#if !__EXCEPTIONS
#define _LIBCPP_NO_EXCEPTIONS
#endif
#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
#define _LIBCPP_HAS_NO_CONSTEXPR
#define _NOEXCEPT throw()
#define _NOEXCEPT_(x)
#ifndef __GXX_EXPERIMENTAL_CXX0X__
#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
#define _LIBCPP_HAS_NO_DECLTYPE
#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
#define _LIBCPP_HAS_NO_NULLPTR
#define _LIBCPP_HAS_NO_STATIC_ASSERT
#define _LIBCPP_HAS_NO_UNICODE_CHARS
#define _LIBCPP_HAS_NO_VARIADICS
#define _LIBCPP_HAS_NO_RVALUE_REFERENCES
#define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
#else // __GXX_EXPERIMENTAL_CXX0X__
#define _LIBCPP_HAS_NO_TRAILING_RETURN
#define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 3)
#define _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 3)
#define _LIBCPP_HAS_NO_STATIC_ASSERT
#endif
#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 4)
#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
#define _LIBCPP_HAS_NO_DECLTYPE
#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
#define _LIBCPP_HAS_NO_UNICODE_CHARS
#define _LIBCPP_HAS_NO_VARIADICS
#define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#endif // !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 4)
#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 6)
#define _LIBCPP_HAS_NO_NULLPTR
#endif
#endif // __GXX_EXPERIMENTAL_CXX0X__
#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std { namespace _LIBCPP_NAMESPACE {
#define _LIBCPP_END_NAMESPACE_STD } }
#define _VSTD std::_LIBCPP_NAMESPACE
namespace std {
namespace _LIBCPP_NAMESPACE {
}
using namespace _LIBCPP_NAMESPACE __attribute__((__strong__));
}
#elif defined(_MSC_VER)
#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
#define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
#define _LIBCPP_HAS_NO_CONSTEXPR
#define _LIBCPP_HAS_NO_UNICODE_CHARS
#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
#define __alignof__ __alignof
#define _ATTRIBUTE __declspec
#define _ALIGNAS(x) __declspec(align(x))
#define _LIBCPP_HAS_NO_VARIADICS
#define _NOEXCEPT throw()
#define _NOEXCEPT_(x)
#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {
#define _LIBCPP_END_NAMESPACE_STD }
#define _VSTD std
namespace std {
}
#endif // __clang__ || __GNUC___ || _MSC_VER
#ifdef _LIBCPP_HAS_NO_UNICODE_CHARS
typedef unsigned short char16_t;
typedef unsigned int char32_t;
#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
#ifdef _LIBCPP_HAS_NO_STATIC_ASSERT
template <bool> struct __static_assert_test;
template <> struct __static_assert_test<true> {};
template <unsigned> struct __static_assert_check {};
#define static_assert(__b, __m) \
typedef __static_assert_check<sizeof(__static_assert_test<(__b)>)> \
_LIBCPP_CONCAT(__t, __LINE__)
#endif // _LIBCPP_HAS_NO_STATIC_ASSERT
#ifdef _LIBCPP_HAS_NO_DECLTYPE
#define decltype(x) __typeof__(x)
#endif
#ifdef _LIBCPP_HAS_NO_CONSTEXPR
#define _LIBCPP_CONSTEXPR
#else
#define _LIBCPP_CONSTEXPR constexpr
#endif
#ifndef __has_feature
#define __has_feature(__x) 0
#endif
#if __has_feature(cxx_explicit_conversions)
# define _LIBCPP_EXPLICIT explicit
#else
# define _LIBCPP_EXPLICIT
#endif
#ifdef _LIBCPP_HAS_NO_STRONG_ENUMS
#define _LIBCPP_DECLARE_STRONG_ENUM(x) struct _LIBCPP_VISIBLE x { enum _
#define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x) \
_ __v_; \
_LIBCPP_ALWAYS_INLINE x(_ __v) : __v_(__v) {} \
_LIBCPP_ALWAYS_INLINE operator int() const {return __v_;} \
};
#else // _LIBCPP_HAS_NO_STRONG_ENUMS
#define _LIBCPP_DECLARE_STRONG_ENUM(x) enum class _LIBCPP_VISIBLE x
#define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x)
#endif // _LIBCPP_HAS_NO_STRONG_ENUMS
#if __APPLE__ || __FreeBSD__ || _WIN32 || __sun__
#define _LIBCPP_LOCALE__L_EXTENSIONS 1
#endif
#if __FreeBSD__
#define _DECLARE_C99_LDBL_MATH 1
#endif
#if __APPLE__ || __FreeBSD__
#define _LIBCPP_HAS_DEFAULTRUNELOCALE
#endif
#if __APPLE__ || __FreeBSD__ || __sun__
#define _LIBCPP_WCTYPE_IS_MASK
#endif
#ifdef _LIBCPP_DEBUG2
# if _LIBCPP_DEBUG2 == 0
# define _LIBCPP_DEBUG_LEVEL 1
# elif _LIBCPP_DEBUG2 == 1
# define _LIBCPP_DEBUG_LEVEL 2
# else
# error Supported values for _LIBCPP_DEBUG2 are 0 and 1
# endif
#endif
#ifdef _LIBCPP_DEBUG2
# include <__debug>
#else
# define _LIBCPP_ASSERT(x, m) ((void)0)
#endif
#endif // _LIBCPP_CONFIG

View File

@@ -1,191 +0,0 @@
// -*- C++ -*-
//===--------------------------- __debug ----------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef _LIBCPP_DEBUG_H
#define _LIBCPP_DEBUG_H
#if _LIBCPP_DEBUG_LEVEL >= 1
# include <cstdlib>
# include <cstdio>
# include <cstddef>
# define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : (_VSTD::printf("%s\n", m), _VSTD::abort()))
#endif
#if _LIBCPP_DEBUG_LEVEL >= 2
_LIBCPP_BEGIN_NAMESPACE_STD
struct _LIBCPP_VISIBLE __c_node;
struct _LIBCPP_VISIBLE __i_node
{
void* __i_;
__i_node* __next_;
__c_node* __c_;
__i_node(const __i_node&) = delete;
__i_node& operator=(const __i_node&) = delete;
_LIBCPP_INLINE_VISIBILITY
__i_node(void* __i, __i_node* __next, __c_node* __c)
: __i_(__i), __next_(__next), __c_(__c) {}
~__i_node();
};
struct _LIBCPP_VISIBLE __c_node
{
void* __c_;
__c_node* __next_;
__i_node** beg_;
__i_node** end_;
__i_node** cap_;
__c_node(const __c_node&) = delete;
__c_node& operator=(const __c_node&) = delete;
_LIBCPP_INLINE_VISIBILITY
__c_node(void* __c, __c_node* __next)
: __c_(__c), __next_(__next), beg_(nullptr), end_(nullptr), cap_(nullptr) {}
virtual ~__c_node();
virtual bool __dereferenceable(const void*) const = 0;
virtual bool __decrementable(const void*) const = 0;
virtual bool __addable(const void*, ptrdiff_t) const = 0;
virtual bool __subscriptable(const void*, ptrdiff_t) const = 0;
void __add(__i_node* __i);
_LIBCPP_HIDDEN void __remove(__i_node* __i);
};
template <class _Cont>
struct _C_node
: public __c_node
{
_C_node(void* __c, __c_node* __n)
: __c_node(__c, __n) {}
virtual bool __dereferenceable(const void*) const;
virtual bool __decrementable(const void*) const;
virtual bool __addable(const void*, ptrdiff_t) const;
virtual bool __subscriptable(const void*, ptrdiff_t) const;
};
template <class _Cont>
bool
_C_node<_Cont>::__dereferenceable(const void* __i) const
{
typedef typename _Cont::const_iterator iterator;
const iterator* __j = static_cast<const iterator*>(__i);
_Cont* _Cp = static_cast<_Cont*>(__c_);
return _Cp->__dereferenceable(__j);
}
template <class _Cont>
bool
_C_node<_Cont>::__decrementable(const void* __i) const
{
typedef typename _Cont::const_iterator iterator;
const iterator* __j = static_cast<const iterator*>(__i);
_Cont* _Cp = static_cast<_Cont*>(__c_);
return _Cp->__decrementable(__j);
}
template <class _Cont>
bool
_C_node<_Cont>::__addable(const void* __i, ptrdiff_t __n) const
{
typedef typename _Cont::const_iterator iterator;
const iterator* __j = static_cast<const iterator*>(__i);
_Cont* _Cp = static_cast<_Cont*>(__c_);
return _Cp->__addable(__j, __n);
}
template <class _Cont>
bool
_C_node<_Cont>::__subscriptable(const void* __i, ptrdiff_t __n) const
{
typedef typename _Cont::const_iterator iterator;
const iterator* __j = static_cast<const iterator*>(__i);
_Cont* _Cp = static_cast<_Cont*>(__c_);
return _Cp->__subscriptable(__j, __n);
}
class _LIBCPP_VISIBLE __libcpp_db
{
__c_node** __cbeg_;
__c_node** __cend_;
size_t __csz_;
__i_node** __ibeg_;
__i_node** __iend_;
size_t __isz_;
__libcpp_db();
public:
__libcpp_db(const __libcpp_db&) = delete;
__libcpp_db& operator=(const __libcpp_db&) = delete;
~__libcpp_db();
class __db_c_iterator;
class __db_c_const_iterator;
class __db_i_iterator;
class __db_i_const_iterator;
__db_c_const_iterator __c_end() const;
__db_i_const_iterator __i_end() const;
template <class _Cont>
_LIBCPP_INLINE_VISIBILITY
void __insert_c(_Cont* __c)
{
__c_node* __n = __insert_c(static_cast<void*>(__c));
::new(__n) _C_node<_Cont>(__n->__c_, __n->__next_);
}
void __insert_i(void* __i);
__c_node* __insert_c(void* __c);
void __erase_c(void* __c);
void __insert_ic(void* __i, const void* __c);
void __iterator_copy(void* __i, const void* __i0);
void __erase_i(void* __i);
void* __find_c_from_i(void* __i) const;
void __invalidate_all(void* __c);
__c_node* __find_c_and_lock(void* __c) const;
__c_node* __find_c(void* __c) const;
void unlock() const;
void swap(void* __c1, void* __c2);
bool __dereferenceable(const void* __i) const;
bool __decrementable(const void* __i) const;
bool __addable(const void* __i, ptrdiff_t __n) const;
bool __subscriptable(const void* __i, ptrdiff_t __n) const;
bool __comparable(const void* __i, const void* __j) const;
private:
_LIBCPP_HIDDEN
__i_node* __insert_iterator(void* __i);
_LIBCPP_HIDDEN
__i_node* __find_iterator(const void* __i) const;
friend _LIBCPP_VISIBLE __libcpp_db* __get_db();
};
_LIBCPP_VISIBLE __libcpp_db* __get_db();
_LIBCPP_VISIBLE const __libcpp_db* __get_const_db();
_LIBCPP_END_NAMESPACE_STD
#endif
#endif // _LIBCPP_DEBUG_H

File diff suppressed because it is too large Load Diff

View File

@@ -1,437 +0,0 @@
// -*- C++ -*-
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef _LIBCPP_FUNCTIONAL_BASE
#define _LIBCPP_FUNCTIONAL_BASE
#include <__config>
#include <type_traits>
#include <typeinfo>
#include <exception>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Arg, class _Result>
struct _LIBCPP_VISIBLE unary_function
{
typedef _Arg argument_type;
typedef _Result result_type;
};
template <class _Arg1, class _Arg2, class _Result>
struct _LIBCPP_VISIBLE binary_function
{
typedef _Arg1 first_argument_type;
typedef _Arg2 second_argument_type;
typedef _Result result_type;
};
template <class _Tp> struct _LIBCPP_VISIBLE hash;
template <class _Tp>
struct __has_result_type
{
private:
struct __two {char _; char __;};
template <class _Up> static __two __test(...);
template <class _Up> static char __test(typename _Up::result_type* = 0);
public:
static const bool value = sizeof(__test<_Tp>(0)) == 1;
};
template <class _Tp>
struct _LIBCPP_VISIBLE less : binary_function<_Tp, _Tp, bool>
{
_LIBCPP_INLINE_VISIBILITY bool operator()(const _Tp& __x, const _Tp& __y) const
{return __x < __y;}
};
#ifdef _LIBCPP_HAS_NO_VARIADICS
#include <__functional_base_03>
#else // _LIBCPP_HAS_NO_VARIADICS
// __weak_result_type
template <class _Tp>
struct __derives_from_unary_function
{
private:
struct __two {char _; char __;};
static __two __test(...);
template <class _Ap, class _Rp>
static unary_function<_Ap, _Rp>
__test(const volatile unary_function<_Ap, _Rp>*);
public:
static const bool value = !is_same<decltype(__test((_Tp*)0)), __two>::value;
typedef decltype(__test((_Tp*)0)) type;
};
template <class _Tp>
struct __derives_from_binary_function
{
private:
struct __two {char _; char __;};
static __two __test(...);
template <class _A1, class _A2, class _Rp>
static binary_function<_A1, _A2, _Rp>
__test(const volatile binary_function<_A1, _A2, _Rp>*);
public:
static const bool value = !is_same<decltype(__test((_Tp*)0)), __two>::value;
typedef decltype(__test((_Tp*)0)) type;
};
template <class _Tp, bool = __derives_from_unary_function<_Tp>::value>
struct __maybe_derive_from_unary_function // bool is true
: public __derives_from_unary_function<_Tp>::type
{
};
template <class _Tp>
struct __maybe_derive_from_unary_function<_Tp, false>
{
};
template <class _Tp, bool = __derives_from_binary_function<_Tp>::value>
struct __maybe_derive_from_binary_function // bool is true
: public __derives_from_binary_function<_Tp>::type
{
};
template <class _Tp>
struct __maybe_derive_from_binary_function<_Tp, false>
{
};
template <class _Tp, bool = __has_result_type<_Tp>::value>
struct __weak_result_type_imp // bool is true
: public __maybe_derive_from_unary_function<_Tp>,
public __maybe_derive_from_binary_function<_Tp>
{
typedef typename _Tp::result_type result_type;
};
template <class _Tp>
struct __weak_result_type_imp<_Tp, false>
: public __maybe_derive_from_unary_function<_Tp>,
public __maybe_derive_from_binary_function<_Tp>
{
};
template <class _Tp>
struct __weak_result_type
: public __weak_result_type_imp<_Tp>
{
};
// 0 argument case
template <class _Rp>
struct __weak_result_type<_Rp ()>
{
typedef _Rp result_type;
};
template <class _Rp>
struct __weak_result_type<_Rp (&)()>
{
typedef _Rp result_type;
};
template <class _Rp>
struct __weak_result_type<_Rp (*)()>
{
typedef _Rp result_type;
};
// 1 argument case
template <class _Rp, class _A1>
struct __weak_result_type<_Rp (_A1)>
: public unary_function<_A1, _Rp>
{
};
template <class _Rp, class _A1>
struct __weak_result_type<_Rp (&)(_A1)>
: public unary_function<_A1, _Rp>
{
};
template <class _Rp, class _A1>
struct __weak_result_type<_Rp (*)(_A1)>
: public unary_function<_A1, _Rp>
{
};
template <class _Rp, class _Cp>
struct __weak_result_type<_Rp (_Cp::*)()>
: public unary_function<_Cp*, _Rp>
{
};
template <class _Rp, class _Cp>
struct __weak_result_type<_Rp (_Cp::*)() const>
: public unary_function<const _Cp*, _Rp>
{
};
template <class _Rp, class _Cp>
struct __weak_result_type<_Rp (_Cp::*)() volatile>
: public unary_function<volatile _Cp*, _Rp>
{
};
template <class _Rp, class _Cp>
struct __weak_result_type<_Rp (_Cp::*)() const volatile>
: public unary_function<const volatile _Cp*, _Rp>
{
};
// 2 argument case
template <class _Rp, class _A1, class _A2>
struct __weak_result_type<_Rp (_A1, _A2)>
: public binary_function<_A1, _A2, _Rp>
{
};
template <class _Rp, class _A1, class _A2>
struct __weak_result_type<_Rp (*)(_A1, _A2)>
: public binary_function<_A1, _A2, _Rp>
{
};
template <class _Rp, class _A1, class _A2>
struct __weak_result_type<_Rp (&)(_A1, _A2)>
: public binary_function<_A1, _A2, _Rp>
{
};
template <class _Rp, class _Cp, class _A1>
struct __weak_result_type<_Rp (_Cp::*)(_A1)>
: public binary_function<_Cp*, _A1, _Rp>
{
};
template <class _Rp, class _Cp, class _A1>
struct __weak_result_type<_Rp (_Cp::*)(_A1) const>
: public binary_function<const _Cp*, _A1, _Rp>
{
};
template <class _Rp, class _Cp, class _A1>
struct __weak_result_type<_Rp (_Cp::*)(_A1) volatile>
: public binary_function<volatile _Cp*, _A1, _Rp>
{
};
template <class _Rp, class _Cp, class _A1>
struct __weak_result_type<_Rp (_Cp::*)(_A1) const volatile>
: public binary_function<const volatile _Cp*, _A1, _Rp>
{
};
// 3 or more arguments
template <class _Rp, class _A1, class _A2, class _A3, class ..._A4>
struct __weak_result_type<_Rp (_A1, _A2, _A3, _A4...)>
{
typedef _Rp result_type;
};
template <class _Rp, class _A1, class _A2, class _A3, class ..._A4>
struct __weak_result_type<_Rp (&)(_A1, _A2, _A3, _A4...)>
{
typedef _Rp result_type;
};
template <class _Rp, class _A1, class _A2, class _A3, class ..._A4>
struct __weak_result_type<_Rp (*)(_A1, _A2, _A3, _A4...)>
{
typedef _Rp result_type;
};
template <class _Rp, class _Cp, class _A1, class _A2, class ..._A3>
struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...)>
{
typedef _Rp result_type;
};
template <class _Rp, class _Cp, class _A1, class _A2, class ..._A3>
struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) const>
{
typedef _Rp result_type;
};
template <class _Rp, class _Cp, class _A1, class _A2, class ..._A3>
struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) volatile>
{
typedef _Rp result_type;
};
template <class _Rp, class _Cp, class _A1, class _A2, class ..._A3>
struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) const volatile>
{
typedef _Rp result_type;
};
// __invoke
// bullets 1 and 2
template <class _Fp, class _A0, class ..._Args>
inline _LIBCPP_INLINE_VISIBILITY
auto
__invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args)
-> decltype((_VSTD::forward<_A0>(__a0).*__f)(_VSTD::forward<_Args>(__args)...))
{
return (_VSTD::forward<_A0>(__a0).*__f)(_VSTD::forward<_Args>(__args)...);
}
template <class _Fp, class _A0, class ..._Args>
inline _LIBCPP_INLINE_VISIBILITY
auto
__invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args)
-> decltype(((*_VSTD::forward<_A0>(__a0)).*__f)(_VSTD::forward<_Args>(__args)...))
{
return ((*_VSTD::forward<_A0>(__a0)).*__f)(_VSTD::forward<_Args>(__args)...);
}
// bullets 3 and 4
template <class _Fp, class _A0>
inline _LIBCPP_INLINE_VISIBILITY
auto
__invoke(_Fp&& __f, _A0&& __a0)
-> decltype(_VSTD::forward<_A0>(__a0).*__f)
{
return _VSTD::forward<_A0>(__a0).*__f;
}
template <class _Fp, class _A0>
inline _LIBCPP_INLINE_VISIBILITY
auto
__invoke(_Fp&& __f, _A0&& __a0)
-> decltype((*_VSTD::forward<_A0>(__a0)).*__f)
{
return (*_VSTD::forward<_A0>(__a0)).*__f;
}
// bullet 5
template <class _Fp, class ..._Args>
inline _LIBCPP_INLINE_VISIBILITY
auto
__invoke(_Fp&& __f, _Args&& ...__args)
-> decltype(_VSTD::forward<_Fp>(__f)(_VSTD::forward<_Args>(__args)...))
{
return _VSTD::forward<_Fp>(__f)(_VSTD::forward<_Args>(__args)...);
}
template <class _Tp, class ..._Args>
struct __invoke_return
{
typedef decltype(__invoke(_VSTD::declval<_Tp>(), _VSTD::declval<_Args>()...)) type;
};
template <class _Tp>
class _LIBCPP_VISIBLE reference_wrapper
: public __weak_result_type<_Tp>
{
public:
// types
typedef _Tp type;
private:
type* __f_;
public:
// construct/copy/destroy
_LIBCPP_INLINE_VISIBILITY reference_wrapper(type& __f) _NOEXCEPT : __f_(&__f) {}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
private: reference_wrapper(type&&); public: // = delete; // do not bind to temps
#endif
// access
_LIBCPP_INLINE_VISIBILITY operator type& () const _NOEXCEPT {return *__f_;}
_LIBCPP_INLINE_VISIBILITY type& get() const _NOEXCEPT {return *__f_;}
// invoke
template <class... _ArgTypes>
_LIBCPP_INLINE_VISIBILITY
typename __invoke_of<type&, _ArgTypes...>::type
operator() (_ArgTypes&&... __args) const
{
return __invoke(get(), _VSTD::forward<_ArgTypes>(__args)...);
}
};
template <class _Tp> struct ____is_reference_wrapper : public false_type {};
template <class _Tp> struct ____is_reference_wrapper<reference_wrapper<_Tp> > : public true_type {};
template <class _Tp> struct __is_reference_wrapper
: public ____is_reference_wrapper<typename remove_cv<_Tp>::type> {};
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
reference_wrapper<_Tp>
ref(_Tp& __t) _NOEXCEPT
{
return reference_wrapper<_Tp>(__t);
}
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
reference_wrapper<_Tp>
ref(reference_wrapper<_Tp> __t) _NOEXCEPT
{
return ref(__t.get());
}
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
reference_wrapper<const _Tp>
cref(const _Tp& __t) _NOEXCEPT
{
return reference_wrapper<const _Tp>(__t);
}
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
reference_wrapper<const _Tp>
cref(reference_wrapper<_Tp> __t) _NOEXCEPT
{
return cref(__t.get());
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
template <class _Tp> void ref(const _Tp&&) = delete;
template <class _Tp> void cref(const _Tp&&) = delete;
#else // _LIBCPP_HAS_NO_DELETED_FUNCTIONS
template <class _Tp> void ref(const _Tp&&);// = delete;
template <class _Tp> void cref(const _Tp&&);// = delete;
#endif // _LIBCPP_HAS_NO_DELETED_FUNCTIONS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif // _LIBCPP_HAS_NO_VARIADICS
_LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP_FUNCTIONAL_BASE

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,439 +0,0 @@
// -*- C++ -*-
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef _LIBCPP___MUTEX_BASE
#define _LIBCPP___MUTEX_BASE
#include <__config>
#include <chrono>
#include <system_error>
#include <pthread.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
#ifdef _LIBCPP_SHARED_LOCK
namespace ting {
template <class _Mutex> class shared_lock;
template <class _Mutex> class upgrade_lock;
}
#endif // _LIBCPP_SHARED_LOCK
_LIBCPP_BEGIN_NAMESPACE_STD
class _LIBCPP_VISIBLE mutex
{
pthread_mutex_t __m_;
public:
_LIBCPP_INLINE_VISIBILITY
mutex() {__m_ = (pthread_mutex_t)PTHREAD_MUTEX_INITIALIZER;}
~mutex();
private:
mutex(const mutex&);// = delete;
mutex& operator=(const mutex&);// = delete;
public:
void lock();
bool try_lock();
void unlock();
typedef pthread_mutex_t* native_handle_type;
_LIBCPP_INLINE_VISIBILITY native_handle_type native_handle() {return &__m_;}
};
struct _LIBCPP_VISIBLE defer_lock_t {};
struct _LIBCPP_VISIBLE try_to_lock_t {};
struct _LIBCPP_VISIBLE adopt_lock_t {};
//constexpr
extern const
defer_lock_t defer_lock;
//constexpr
extern const
try_to_lock_t try_to_lock;
//constexpr
extern const
adopt_lock_t adopt_lock;
template <class _Mutex>
class _LIBCPP_VISIBLE lock_guard
{
public:
typedef _Mutex mutex_type;
private:
mutex_type& __m_;
public:
_LIBCPP_INLINE_VISIBILITY
explicit lock_guard(mutex_type& __m)
: __m_(__m) {__m_.lock();}
_LIBCPP_INLINE_VISIBILITY
lock_guard(mutex_type& __m, adopt_lock_t)
: __m_(__m) {}
_LIBCPP_INLINE_VISIBILITY
~lock_guard() {__m_.unlock();}
private:
lock_guard(lock_guard const&);// = delete;
lock_guard& operator=(lock_guard const&);// = delete;
};
template <class _Mutex>
class _LIBCPP_VISIBLE unique_lock
{
public:
typedef _Mutex mutex_type;
private:
mutex_type* __m_;
bool __owns_;
public:
_LIBCPP_INLINE_VISIBILITY
unique_lock() : __m_(nullptr), __owns_(false) {}
_LIBCPP_INLINE_VISIBILITY
explicit unique_lock(mutex_type& __m)
: __m_(&__m), __owns_(true) {__m_->lock();}
_LIBCPP_INLINE_VISIBILITY
unique_lock(mutex_type& __m, defer_lock_t)
: __m_(&__m), __owns_(false) {}
_LIBCPP_INLINE_VISIBILITY
unique_lock(mutex_type& __m, try_to_lock_t)
: __m_(&__m), __owns_(__m.try_lock()) {}
_LIBCPP_INLINE_VISIBILITY
unique_lock(mutex_type& __m, adopt_lock_t)
: __m_(&__m), __owns_(true) {}
template <class _Clock, class _Duration>
_LIBCPP_INLINE_VISIBILITY
unique_lock(mutex_type& __m, const chrono::time_point<_Clock, _Duration>& __t)
: __m_(&__m), __owns_(__m.try_lock_until(__t)) {}
template <class _Rep, class _Period>
_LIBCPP_INLINE_VISIBILITY
unique_lock(mutex_type& __m, const chrono::duration<_Rep, _Period>& __d)
: __m_(&__m), __owns_(__m.try_lock_for(__d)) {}
_LIBCPP_INLINE_VISIBILITY
~unique_lock()
{
if (__owns_)
__m_->unlock();
}
private:
unique_lock(unique_lock const&); // = delete;
unique_lock& operator=(unique_lock const&); // = delete;
public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
unique_lock(unique_lock&& __u)
: __m_(__u.__m_), __owns_(__u.__owns_)
{__u.__m_ = nullptr; __u.__owns_ = false;}
_LIBCPP_INLINE_VISIBILITY
unique_lock& operator=(unique_lock&& __u)
{
if (__owns_)
__m_->unlock();
__m_ = __u.__m_;
__owns_ = __u.__owns_;
__u.__m_ = nullptr;
__u.__owns_ = false;
return *this;
}
#ifdef _LIBCPP_SHARED_LOCK
unique_lock(ting::shared_lock<mutex_type>&&, try_to_lock_t);
template <class _Clock, class _Duration>
unique_lock(ting::shared_lock<mutex_type>&&,
const chrono::time_point<_Clock, _Duration>&);
template <class _Rep, class _Period>
unique_lock(ting::shared_lock<mutex_type>&&,
const chrono::duration<_Rep, _Period>&);
explicit unique_lock(ting::upgrade_lock<mutex_type>&&);
unique_lock(ting::upgrade_lock<mutex_type>&&, try_to_lock_t);
template <class _Clock, class _Duration>
unique_lock(ting::upgrade_lock<mutex_type>&&,
const chrono::time_point<_Clock, _Duration>&);
template <class _Rep, class _Period>
unique_lock(ting::upgrade_lock<mutex_type>&&,
const chrono::duration<_Rep, _Period>&);
#endif // _LIBCPP_SHARED_LOCK
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
void lock();
bool try_lock();
template <class _Rep, class _Period>
bool try_lock_for(const chrono::duration<_Rep, _Period>& __d);
template <class _Clock, class _Duration>
bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __t);
void unlock();
_LIBCPP_INLINE_VISIBILITY
void swap(unique_lock& __u)
{
_VSTD::swap(__m_, __u.__m_);
_VSTD::swap(__owns_, __u.__owns_);
}
_LIBCPP_INLINE_VISIBILITY
mutex_type* release()
{
mutex_type* __m = __m_;
__m_ = nullptr;
__owns_ = false;
return __m;
}
_LIBCPP_INLINE_VISIBILITY
bool owns_lock() const {return __owns_;}
_LIBCPP_INLINE_VISIBILITY
_LIBCPP_EXPLICIT
operator bool () const {return __owns_;}
_LIBCPP_INLINE_VISIBILITY
mutex_type* mutex() const {return __m_;}
};
template <class _Mutex>
void
unique_lock<_Mutex>::lock()
{
if (__m_ == nullptr)
__throw_system_error(EPERM, "unique_lock::lock: references null mutex");
if (__owns_)
__throw_system_error(EDEADLK, "unique_lock::lock: already locked");
__m_->lock();
__owns_ = true;
}
template <class _Mutex>
bool
unique_lock<_Mutex>::try_lock()
{
if (__m_ == nullptr)
__throw_system_error(EPERM, "unique_lock::try_lock: references null mutex");
if (__owns_)
__throw_system_error(EDEADLK, "unique_lock::try_lock: already locked");
__owns_ = __m_->try_lock();
return __owns_;
}
template <class _Mutex>
template <class _Rep, class _Period>
bool
unique_lock<_Mutex>::try_lock_for(const chrono::duration<_Rep, _Period>& __d)
{
if (__m_ == nullptr)
__throw_system_error(EPERM, "unique_lock::try_lock_for: references null mutex");
if (__owns_)
__throw_system_error(EDEADLK, "unique_lock::try_lock_for: already locked");
__owns_ = __m_->try_lock_for(__d);
return __owns_;
}
template <class _Mutex>
template <class _Clock, class _Duration>
bool
unique_lock<_Mutex>::try_lock_until(const chrono::time_point<_Clock, _Duration>& __t)
{
if (__m_ == nullptr)
__throw_system_error(EPERM, "unique_lock::try_lock_until: references null mutex");
if (__owns_)
__throw_system_error(EDEADLK, "unique_lock::try_lock_until: already locked");
__owns_ = __m_->try_lock_until(__t);
return __owns_;
}
template <class _Mutex>
void
unique_lock<_Mutex>::unlock()
{
if (!__owns_)
__throw_system_error(EPERM, "unique_lock::unlock: not locked");
__m_->unlock();
__owns_ = false;
}
template <class _Mutex>
inline _LIBCPP_INLINE_VISIBILITY
void
swap(unique_lock<_Mutex>& __x, unique_lock<_Mutex>& __y) {__x.swap(__y);}
struct _LIBCPP_VISIBLE cv_status
{
enum _ {
no_timeout,
timeout
};
_ __v_;
_LIBCPP_INLINE_VISIBILITY cv_status(_ __v) : __v_(__v) {}
_LIBCPP_INLINE_VISIBILITY operator int() const {return __v_;}
};
class _LIBCPP_VISIBLE condition_variable
{
pthread_cond_t __cv_;
public:
_LIBCPP_INLINE_VISIBILITY
condition_variable() {__cv_ = (pthread_cond_t)PTHREAD_COND_INITIALIZER;}
~condition_variable();
private:
condition_variable(const condition_variable&); // = delete;
condition_variable& operator=(const condition_variable&); // = delete;
public:
void notify_one();
void notify_all();
void wait(unique_lock<mutex>& __lk);
template <class _Predicate>
void wait(unique_lock<mutex>& __lk, _Predicate __pred);
template <class _Duration>
cv_status
wait_until(unique_lock<mutex>& __lk,
const chrono::time_point<chrono::system_clock, _Duration>& __t);
template <class _Clock, class _Duration>
cv_status
wait_until(unique_lock<mutex>& __lk,
const chrono::time_point<_Clock, _Duration>& __t);
template <class _Clock, class _Duration, class _Predicate>
bool
wait_until(unique_lock<mutex>& __lk,
const chrono::time_point<_Clock, _Duration>& __t,
_Predicate __pred);
template <class _Rep, class _Period>
cv_status
wait_for(unique_lock<mutex>& __lk,
const chrono::duration<_Rep, _Period>& __d);
template <class _Rep, class _Period, class _Predicate>
bool
wait_for(unique_lock<mutex>& __lk,
const chrono::duration<_Rep, _Period>& __d,
_Predicate __pred);
typedef pthread_cond_t* native_handle_type;
_LIBCPP_INLINE_VISIBILITY native_handle_type native_handle() {return &__cv_;}
private:
void __do_timed_wait(unique_lock<mutex>& __lk,
chrono::time_point<chrono::system_clock, chrono::nanoseconds>);
};
template <class _To, class _Rep, class _Period>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
chrono::__is_duration<_To>::value,
_To
>::type
__ceil(chrono::duration<_Rep, _Period> __d)
{
using namespace chrono;
_To __r = duration_cast<_To>(__d);
if (__r < __d)
++__r;
return __r;
}
template <class _Predicate>
void
condition_variable::wait(unique_lock<mutex>& __lk, _Predicate __pred)
{
while (!__pred())
wait(__lk);
}
template <class _Duration>
cv_status
condition_variable::wait_until(unique_lock<mutex>& __lk,
const chrono::time_point<chrono::system_clock, _Duration>& __t)
{
using namespace chrono;
typedef time_point<system_clock, nanoseconds> __nano_sys_tmpt;
__do_timed_wait(__lk,
__nano_sys_tmpt(__ceil<nanoseconds>(__t.time_since_epoch())));
return system_clock::now() < __t ? cv_status::no_timeout :
cv_status::timeout;
}
template <class _Clock, class _Duration>
cv_status
condition_variable::wait_until(unique_lock<mutex>& __lk,
const chrono::time_point<_Clock, _Duration>& __t)
{
using namespace chrono;
system_clock::time_point __s_now = system_clock::now();
typename _Clock::time_point __c_now = _Clock::now();
__do_timed_wait(__lk, __s_now + __ceil<nanoseconds>(__t - __c_now));
return _Clock::now() < __t ? cv_status::no_timeout : cv_status::timeout;
}
template <class _Clock, class _Duration, class _Predicate>
bool
condition_variable::wait_until(unique_lock<mutex>& __lk,
const chrono::time_point<_Clock, _Duration>& __t,
_Predicate __pred)
{
while (!__pred())
{
if (wait_until(__lk, __t) == cv_status::timeout)
return __pred();
}
return true;
}
template <class _Rep, class _Period>
cv_status
condition_variable::wait_for(unique_lock<mutex>& __lk,
const chrono::duration<_Rep, _Period>& __d)
{
using namespace chrono;
system_clock::time_point __s_now = system_clock::now();
steady_clock::time_point __c_now = steady_clock::now();
__do_timed_wait(__lk, __s_now + __ceil<nanoseconds>(__d));
return steady_clock::now() - __c_now < __d ? cv_status::no_timeout :
cv_status::timeout;
}
template <class _Rep, class _Period, class _Predicate>
inline _LIBCPP_INLINE_VISIBILITY
bool
condition_variable::wait_for(unique_lock<mutex>& __lk,
const chrono::duration<_Rep, _Period>& __d,
_Predicate __pred)
{
return wait_until(__lk, chrono::steady_clock::now() + __d,
_VSTD::move(__pred));
}
_LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP___MUTEX_BASE

View File

@@ -1,654 +0,0 @@
// -*- C++ -*-
#ifndef _LIBCPP_SPLIT_BUFFER
#define _LIBCPP_SPLIT_BUFFER
#include <__config>
#include <type_traits>
#include <algorithm>
#include <__undef_min_max>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
template <bool>
class __split_buffer_common
{
protected:
void __throw_length_error() const;
void __throw_out_of_range() const;
};
template <class _Tp, class _Allocator = allocator<_Tp> >
struct __split_buffer
: private __split_buffer_common<true>
{
private:
__split_buffer(const __split_buffer&);
__split_buffer& operator=(const __split_buffer&);
public:
typedef _Tp value_type;
typedef _Allocator allocator_type;
typedef typename remove_reference<allocator_type>::type __alloc_rr;
typedef allocator_traits<__alloc_rr> __alloc_traits;
typedef value_type& reference;
typedef const value_type& const_reference;
typedef typename __alloc_traits::size_type size_type;
typedef typename __alloc_traits::difference_type difference_type;
typedef typename __alloc_traits::pointer pointer;
typedef typename __alloc_traits::const_pointer const_pointer;
typedef pointer iterator;
typedef const_pointer const_iterator;
pointer __first_;
pointer __begin_;
pointer __end_;
__compressed_pair<pointer, allocator_type> __end_cap_;
typedef typename add_lvalue_reference<allocator_type>::type __alloc_ref;
typedef typename add_lvalue_reference<allocator_type>::type __alloc_const_ref;
_LIBCPP_INLINE_VISIBILITY __alloc_rr& __alloc() _NOEXCEPT {return __end_cap_.second();}
_LIBCPP_INLINE_VISIBILITY const __alloc_rr& __alloc() const _NOEXCEPT {return __end_cap_.second();}
_LIBCPP_INLINE_VISIBILITY pointer& __end_cap() _NOEXCEPT {return __end_cap_.first();}
_LIBCPP_INLINE_VISIBILITY const pointer& __end_cap() const _NOEXCEPT {return __end_cap_.first();}
__split_buffer()
_NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value);
explicit __split_buffer(__alloc_rr& __a);
explicit __split_buffer(const __alloc_rr& __a);
__split_buffer(size_type __cap, size_type __start, __alloc_rr& __a);
~__split_buffer();
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
__split_buffer(__split_buffer&& __c)
_NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value);
__split_buffer(__split_buffer&& __c, const __alloc_rr& __a);
__split_buffer& operator=(__split_buffer&& __c)
_NOEXCEPT_((__alloc_traits::propagate_on_container_move_assignment::value &&
is_nothrow_move_assignable<allocator_type>::value) ||
!__alloc_traits::propagate_on_container_move_assignment::value);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY iterator begin() _NOEXCEPT {return __begin_;}
_LIBCPP_INLINE_VISIBILITY const_iterator begin() const _NOEXCEPT {return __begin_;}
_LIBCPP_INLINE_VISIBILITY iterator end() _NOEXCEPT {return __end_;}
_LIBCPP_INLINE_VISIBILITY const_iterator end() const _NOEXCEPT {return __end_;}
_LIBCPP_INLINE_VISIBILITY
void clear() _NOEXCEPT
{__destruct_at_end(__begin_);}
_LIBCPP_INLINE_VISIBILITY size_type size() const {return static_cast<size_type>(__end_ - __begin_);}
_LIBCPP_INLINE_VISIBILITY bool empty() const {return __end_ == __begin_;}
_LIBCPP_INLINE_VISIBILITY size_type capacity() const {return static_cast<size_type>(__end_cap() - __first_);}
_LIBCPP_INLINE_VISIBILITY size_type __front_spare() const {return static_cast<size_type>(__begin_ - __first_);}
_LIBCPP_INLINE_VISIBILITY size_type __back_spare() const {return static_cast<size_type>(__end_cap() - __end_);}
_LIBCPP_INLINE_VISIBILITY reference front() {return *__begin_;}
_LIBCPP_INLINE_VISIBILITY const_reference front() const {return *__begin_;}
_LIBCPP_INLINE_VISIBILITY reference back() {return *(__end_ - 1);}
_LIBCPP_INLINE_VISIBILITY const_reference back() const {return *(__end_ - 1);}
void reserve(size_type __n);
void shrink_to_fit() _NOEXCEPT;
void push_front(const_reference __x);
_LIBCPP_INLINE_VISIBILITY void push_back(const_reference __x);
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
void push_front(value_type&& __x);
void push_back(value_type&& __x);
#if !defined(_LIBCPP_HAS_NO_VARIADICS)
template <class... _Args>
void emplace_back(_Args&&... __args);
#endif // !defined(_LIBCPP_HAS_NO_VARIADICS)
#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
_LIBCPP_INLINE_VISIBILITY void pop_front() {__destruct_at_begin(__begin_+1);}
_LIBCPP_INLINE_VISIBILITY void pop_back() {__destruct_at_end(__end_-1);}
void __construct_at_end(size_type __n);
void __construct_at_end(size_type __n, const_reference __x);
template <class _InputIter>
typename enable_if
<
__is_input_iterator<_InputIter>::value &&
!__is_forward_iterator<_InputIter>::value,
void
>::type
__construct_at_end(_InputIter __first, _InputIter __last);
template <class _ForwardIterator>
typename enable_if
<
__is_forward_iterator<_ForwardIterator>::value,
void
>::type
__construct_at_end(_ForwardIterator __first, _ForwardIterator __last);
_LIBCPP_INLINE_VISIBILITY void __destruct_at_begin(pointer __new_begin)
{__destruct_at_begin(__new_begin, is_trivially_destructible<value_type>());}
void __destruct_at_begin(pointer __new_begin, false_type);
void __destruct_at_begin(pointer __new_begin, true_type);
_LIBCPP_INLINE_VISIBILITY
void __destruct_at_end(pointer __new_last) _NOEXCEPT
{__destruct_at_end(__new_last, false_type());}
_LIBCPP_INLINE_VISIBILITY
void __destruct_at_end(pointer __new_last, false_type) _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
void __destruct_at_end(pointer __new_last, true_type) _NOEXCEPT;
void swap(__split_buffer& __x)
_NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value||
__is_nothrow_swappable<__alloc_rr>::value);
bool __invariants() const;
private:
_LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(__split_buffer& __c, true_type)
_NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value)
{
__alloc() = _VSTD::move(__c.__alloc());
}
_LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(__split_buffer&, false_type) _NOEXCEPT
{}
_LIBCPP_INLINE_VISIBILITY
static void __swap_alloc(__alloc_rr& __x, __alloc_rr& __y)
_NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value||
__is_nothrow_swappable<__alloc_rr>::value)
{__swap_alloc(__x, __y, integral_constant<bool,
__alloc_traits::propagate_on_container_swap::value>());}
_LIBCPP_INLINE_VISIBILITY
static void __swap_alloc(__alloc_rr& __x, __alloc_rr& __y, true_type)
_NOEXCEPT_(__is_nothrow_swappable<__alloc_rr>::value)
{
using _VSTD::swap;
swap(__x, __y);
}
_LIBCPP_INLINE_VISIBILITY
static void __swap_alloc(__alloc_rr&, __alloc_rr&, false_type) _NOEXCEPT
{}
};
template <class _Tp, class _Allocator>
bool
__split_buffer<_Tp, _Allocator>::__invariants() const
{
if (__first_ == nullptr)
{
if (__begin_ != nullptr)
return false;
if (__end_ != nullptr)
return false;
if (__end_cap() != nullptr)
return false;
}
else
{
if (__begin_ < __first_)
return false;
if (__end_ < __begin_)
return false;
if (__end_cap() < __end_)
return false;
}
return true;
}
// Default constructs __n objects starting at __end_
// throws if construction throws
// Precondition: __n > 0
// Precondition: size() + __n <= capacity()
// Postcondition: size() == size() + __n
template <class _Tp, class _Allocator>
void
__split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n)
{
__alloc_rr& __a = this->__alloc();
do
{
__alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_));
++this->__end_;
--__n;
} while (__n > 0);
}
// Copy constructs __n objects starting at __end_ from __x
// throws if construction throws
// Precondition: __n > 0
// Precondition: size() + __n <= capacity()
// Postcondition: size() == old size() + __n
// Postcondition: [i] == __x for all i in [size() - __n, __n)
template <class _Tp, class _Allocator>
void
__split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x)
{
__alloc_rr& __a = this->__alloc();
do
{
__alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_), __x);
++this->__end_;
--__n;
} while (__n > 0);
}
template <class _Tp, class _Allocator>
template <class _InputIter>
typename enable_if
<
__is_input_iterator<_InputIter>::value &&
!__is_forward_iterator<_InputIter>::value,
void
>::type
__split_buffer<_Tp, _Allocator>::__construct_at_end(_InputIter __first, _InputIter __last)
{
__alloc_rr& __a = this->__alloc();
for (; __first != __last; ++__first)
{
if (__end_ == __end_cap())
{
size_type __old_cap = __end_cap() - __first_;
size_type __new_cap = _VSTD::max<size_type>(2 * __old_cap, 8);
__split_buffer __buf(__new_cap, 0, __a);
for (pointer __p = __begin_; __p != __end_; ++__p, ++__buf.__end_)
__alloc_traits::construct(__buf.__alloc(),
_VSTD::__to_raw_pointer(__buf.__end_), _VSTD::move(*__p));
swap(__buf);
}
__alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_), *__first);
++this->__end_;
}
}
template <class _Tp, class _Allocator>
template <class _ForwardIterator>
typename enable_if
<
__is_forward_iterator<_ForwardIterator>::value,
void
>::type
__split_buffer<_Tp, _Allocator>::__construct_at_end(_ForwardIterator __first, _ForwardIterator __last)
{
__alloc_rr& __a = this->__alloc();
for (; __first != __last; ++__first)
{
__alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_), *__first);
++this->__end_;
}
}
template <class _Tp, class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
void
__split_buffer<_Tp, _Allocator>::__destruct_at_begin(pointer __new_begin, false_type)
{
while (__begin_ != __new_begin)
__alloc_traits::destroy(__alloc(), __begin_++);
}
template <class _Tp, class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
void
__split_buffer<_Tp, _Allocator>::__destruct_at_begin(pointer __new_begin, true_type)
{
__begin_ = __new_begin;
}
template <class _Tp, class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
void
__split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, false_type) _NOEXCEPT
{
while (__new_last != __end_)
__alloc_traits::destroy(__alloc(), --__end_);
}
template <class _Tp, class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
void
__split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, true_type) _NOEXCEPT
{
__end_ = __new_last;
}
template <class _Tp, class _Allocator>
__split_buffer<_Tp, _Allocator>::__split_buffer(size_type __cap, size_type __start, __alloc_rr& __a)
: __end_cap_(0, __a)
{
__first_ = __cap != 0 ? __alloc_traits::allocate(__alloc(), __cap) : nullptr;
__begin_ = __end_ = __first_ + __start;
__end_cap() = __first_ + __cap;
}
template <class _Tp, class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
__split_buffer<_Tp, _Allocator>::__split_buffer()
_NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
: __first_(0), __begin_(0), __end_(0), __end_cap_(0)
{
}
template <class _Tp, class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
__split_buffer<_Tp, _Allocator>::__split_buffer(__alloc_rr& __a)
: __first_(0), __begin_(0), __end_(0), __end_cap_(0, __a)
{
}
template <class _Tp, class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
__split_buffer<_Tp, _Allocator>::__split_buffer(const __alloc_rr& __a)
: __first_(0), __begin_(0), __end_(0), __end_cap_(0, __a)
{
}
template <class _Tp, class _Allocator>
__split_buffer<_Tp, _Allocator>::~__split_buffer()
{
clear();
if (__first_)
__alloc_traits::deallocate(__alloc(), __first_, capacity());
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Tp, class _Allocator>
__split_buffer<_Tp, _Allocator>::__split_buffer(__split_buffer&& __c)
_NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value)
: __first_(_VSTD::move(__c.__first_)),
__begin_(_VSTD::move(__c.__begin_)),
__end_(_VSTD::move(__c.__end_)),
__end_cap_(_VSTD::move(__c.__end_cap_))
{
__c.__first_ = nullptr;
__c.__begin_ = nullptr;
__c.__end_ = nullptr;
__c.__end_cap() = nullptr;
}
template <class _Tp, class _Allocator>
__split_buffer<_Tp, _Allocator>::__split_buffer(__split_buffer&& __c, const __alloc_rr& __a)
: __end_cap_(__a)
{
if (__a == __c.__alloc())
{
__first_ = __c.__first_;
__begin_ = __c.__begin_;
__end_ = __c.__end_;
__end_cap() = __c.__end_cap();
__c.__first_ = nullptr;
__c.__begin_ = nullptr;
__c.__end_ = nullptr;
__c.__end_cap() = nullptr;
}
else
{
size_type __cap = __c.size();
__first_ = __alloc_traits::allocate(__alloc(), __cap);
__begin_ = __end_ = __first_;
__end_cap() = __first_ + __cap;
typedef move_iterator<iterator> _Ip;
__construct_at_end(_Ip(__c.begin()), _Ip(__c.end()));
}
}
template <class _Tp, class _Allocator>
__split_buffer<_Tp, _Allocator>&
__split_buffer<_Tp, _Allocator>::operator=(__split_buffer&& __c)
_NOEXCEPT_((__alloc_traits::propagate_on_container_move_assignment::value &&
is_nothrow_move_assignable<allocator_type>::value) ||
!__alloc_traits::propagate_on_container_move_assignment::value)
{
clear();
shrink_to_fit();
__first_ = __c.__first_;
__begin_ = __c.__begin_;
__end_ = __c.__end_;
__end_cap() = __c.__end_cap();
__move_assign_alloc(__c,
integral_constant<bool,
__alloc_traits::propagate_on_container_move_assignment::value>());
__c.__first_ = __c.__begin_ = __c.__end_ = __c.__end_cap() = nullptr;
return *this;
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Tp, class _Allocator>
void
__split_buffer<_Tp, _Allocator>::swap(__split_buffer& __x)
_NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value||
__is_nothrow_swappable<__alloc_rr>::value)
{
_VSTD::swap(__first_, __x.__first_);
_VSTD::swap(__begin_, __x.__begin_);
_VSTD::swap(__end_, __x.__end_);
_VSTD::swap(__end_cap(), __x.__end_cap());
__swap_alloc(__alloc(), __x.__alloc());
}
template <class _Tp, class _Allocator>
void
__split_buffer<_Tp, _Allocator>::reserve(size_type __n)
{
if (__n < capacity())
{
__split_buffer<value_type, __alloc_rr&> __t(__n, 0, __alloc());
__t.__construct_at_end(move_iterator<pointer>(__begin_),
move_iterator<pointer>(__end_));
_VSTD::swap(__first_, __t.__first_);
_VSTD::swap(__begin_, __t.__begin_);
_VSTD::swap(__end_, __t.__end_);
_VSTD::swap(__end_cap(), __t.__end_cap());
}
}
template <class _Tp, class _Allocator>
void
__split_buffer<_Tp, _Allocator>::shrink_to_fit() _NOEXCEPT
{
if (capacity() > size())
{
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
__split_buffer<value_type, __alloc_rr&> __t(size(), 0, __alloc());
__t.__construct_at_end(move_iterator<pointer>(__begin_),
move_iterator<pointer>(__end_));
__t.__end_ = __t.__begin_ + (__end_ - __begin_);
_VSTD::swap(__first_, __t.__first_);
_VSTD::swap(__begin_, __t.__begin_);
_VSTD::swap(__end_, __t.__end_);
_VSTD::swap(__end_cap(), __t.__end_cap());
#ifndef _LIBCPP_NO_EXCEPTIONS
}
catch (...)
{
}
#endif // _LIBCPP_NO_EXCEPTIONS
}
}
template <class _Tp, class _Allocator>
void
__split_buffer<_Tp, _Allocator>::push_front(const_reference __x)
{
if (__begin_ == __first_)
{
if (__end_ < __end_cap())
{
difference_type __d = __end_cap() - __end_;
__d = (__d + 1) / 2;
__begin_ = _VSTD::move_backward(__begin_, __end_, __end_ + __d);
__end_ += __d;
}
else
{
size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);
__split_buffer<value_type, __alloc_rr&> __t(__c, (__c + 3) / 4, __alloc());
__t.__construct_at_end(move_iterator<pointer>(__begin_),
move_iterator<pointer>(__end_));
_VSTD::swap(__first_, __t.__first_);
_VSTD::swap(__begin_, __t.__begin_);
_VSTD::swap(__end_, __t.__end_);
_VSTD::swap(__end_cap(), __t.__end_cap());
}
}
__alloc_traits::construct(__alloc(), _VSTD::__to_raw_pointer(__begin_-1), __x);
--__begin_;
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Tp, class _Allocator>
void
__split_buffer<_Tp, _Allocator>::push_front(value_type&& __x)
{
if (__begin_ == __first_)
{
if (__end_ < __end_cap())
{
difference_type __d = __end_cap() - __end_;
__d = (__d + 1) / 2;
__begin_ = _VSTD::move_backward(__begin_, __end_, __end_ + __d);
__end_ += __d;
}
else
{
size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);
__split_buffer<value_type, __alloc_rr&> __t(__c, (__c + 3) / 4, __alloc());
__t.__construct_at_end(move_iterator<pointer>(__begin_),
move_iterator<pointer>(__end_));
_VSTD::swap(__first_, __t.__first_);
_VSTD::swap(__begin_, __t.__begin_);
_VSTD::swap(__end_, __t.__end_);
_VSTD::swap(__end_cap(), __t.__end_cap());
}
}
__alloc_traits::construct(__alloc(), _VSTD::__to_raw_pointer(__begin_-1),
_VSTD::move(__x));
--__begin_;
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Tp, class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
void
__split_buffer<_Tp, _Allocator>::push_back(const_reference __x)
{
if (__end_ == __end_cap())
{
if (__begin_ > __first_)
{
difference_type __d = __begin_ - __first_;
__d = (__d + 1) / 2;
__end_ = _VSTD::move(__begin_, __end_, __begin_ - __d);
__begin_ -= __d;
}
else
{
size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);
__split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc());
__t.__construct_at_end(move_iterator<pointer>(__begin_),
move_iterator<pointer>(__end_));
_VSTD::swap(__first_, __t.__first_);
_VSTD::swap(__begin_, __t.__begin_);
_VSTD::swap(__end_, __t.__end_);
_VSTD::swap(__end_cap(), __t.__end_cap());
}
}
__alloc_traits::construct(__alloc(), _VSTD::__to_raw_pointer(__end_), __x);
++__end_;
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Tp, class _Allocator>
void
__split_buffer<_Tp, _Allocator>::push_back(value_type&& __x)
{
if (__end_ == __end_cap())
{
if (__begin_ > __first_)
{
difference_type __d = __begin_ - __first_;
__d = (__d + 1) / 2;
__end_ = _VSTD::move(__begin_, __end_, __begin_ - __d);
__begin_ -= __d;
}
else
{
size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);
__split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc());
__t.__construct_at_end(move_iterator<pointer>(__begin_),
move_iterator<pointer>(__end_));
_VSTD::swap(__first_, __t.__first_);
_VSTD::swap(__begin_, __t.__begin_);
_VSTD::swap(__end_, __t.__end_);
_VSTD::swap(__end_cap(), __t.__end_cap());
}
}
__alloc_traits::construct(__alloc(), _VSTD::__to_raw_pointer(__end_),
_VSTD::move(__x));
++__end_;
}
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class _Tp, class _Allocator>
template <class... _Args>
void
__split_buffer<_Tp, _Allocator>::emplace_back(_Args&&... __args)
{
if (__end_ == __end_cap())
{
if (__begin_ > __first_)
{
difference_type __d = __begin_ - __first_;
__d = (__d + 1) / 2;
__end_ = _VSTD::move(__begin_, __end_, __begin_ - __d);
__begin_ -= __d;
}
else
{
size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);
__split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc());
__t.__construct_at_end(move_iterator<pointer>(__begin_),
move_iterator<pointer>(__end_));
_VSTD::swap(__first_, __t.__first_);
_VSTD::swap(__begin_, __t.__begin_);
_VSTD::swap(__end_, __t.__end_);
_VSTD::swap(__end_cap(), __t.__end_cap());
}
}
__alloc_traits::construct(__alloc(), _VSTD::__to_raw_pointer(__end_),
_VSTD::forward<_Args>(__args)...);
++__end_;
}
#endif // _LIBCPP_HAS_NO_VARIADICS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Tp, class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
void
swap(__split_buffer<_Tp, _Allocator>& __x, __split_buffer<_Tp, _Allocator>& __y)
_NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
{
__x.swap(__y);
}
_LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP_SPLIT_BUFFER

Some files were not shown because too many files have changed in this diff Show More