hashmap_shims.ll raw
1 ; ModuleID = '/home/mleku/s/moxie/sysroot/hashmap_shims.bc'
2 source_filename = "hashmap_shims.ll"
3 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
4 target triple = "x86_64-pc-linux-gnu"
5
6 @io.EOF = local_unnamed_addr global { ptr, ptr } zeroinitializer
7 @io.ErrNoProgress = local_unnamed_addr global { ptr, ptr } zeroinitializer
8 @.str.eof = hidden constant [3 x i8] c"EOF"
9 @.str.enoprogress = hidden constant [43 x i8] c"multiple Read calls return no data or error"
10 @"reflect/types.type:pointer:named:bytes.Buffer" = local_unnamed_addr global i8 0
11
12 declare void @runtime.hashmapSet(ptr, ptr, ptr, i32, ptr) local_unnamed_addr
13
14 declare i1 @runtime.hashmapGet(ptr, ptr, ptr, i64, i32, ptr) local_unnamed_addr
15
16 ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read)
17 define i64 @runtime.hashmapLen(ptr readonly captures(address_is_null) %m) local_unnamed_addr #0 {
18 entry:
19 %isnil = icmp eq ptr %m, null
20 br i1 %isnil, label %common.ret, label %load
21
22 common.ret: ; preds = %entry, %load
23 %common.ret.op = phi i64 [ %count, %load ], [ 0, %entry ]
24 ret i64 %common.ret.op
25
26 load: ; preds = %entry
27 %countptr = getelementptr i8, ptr %m, i64 16
28 %count = load i64, ptr %countptr, align 4
29 br label %common.ret
30 }
31
32 define void @runtime.hashmapBinarySet(ptr %m, ptr %key, ptr %value) local_unnamed_addr {
33 entry:
34 %seedptr = getelementptr i8, ptr %m, i64 8
35 %seed = load i64, ptr %seedptr, align 4
36 %keysizeptr = getelementptr i8, ptr %m, i64 24
37 %keysize = load i64, ptr %keysizeptr, align 4
38 %hashfnptr = getelementptr i8, ptr %m, i64 72
39 %hashfn = load ptr, ptr %hashfnptr, align 8
40 %hash = tail call i32 %hashfn(ptr %key, i64 %keysize, i64 %seed)
41 tail call void @runtime.hashmapSet(ptr %m, ptr %key, ptr %value, i32 %hash, ptr null)
42 ret void
43 }
44
45 define i1 @runtime.hashmapBinaryGet(ptr %m, ptr %key, ptr %value, i64 %valueSize) local_unnamed_addr {
46 entry:
47 %isnil = icmp eq ptr %m, null
48 br i1 %isnil, label %common.ret, label %doit
49
50 common.ret: ; preds = %entry, %doit
51 %common.ret.op = phi i1 [ %ok, %doit ], [ false, %entry ]
52 ret i1 %common.ret.op
53
54 doit: ; preds = %entry
55 %seedptr = getelementptr i8, ptr %m, i64 8
56 %seed = load i64, ptr %seedptr, align 4
57 %keysizeptr = getelementptr i8, ptr %m, i64 24
58 %keysize = load i64, ptr %keysizeptr, align 4
59 %hashfnptr = getelementptr i8, ptr %m, i64 72
60 %hashfn = load ptr, ptr %hashfnptr, align 8
61 %hash = tail call i32 %hashfn(ptr %key, i64 %keysize, i64 %seed)
62 %ok = tail call i1 @runtime.hashmapGet(ptr nonnull %m, ptr %key, ptr %value, i64 %valueSize, i32 %hash, ptr null)
63 br label %common.ret
64 }
65
66 declare void @runtime.hashmapDelete(ptr, ptr, i32, ptr) local_unnamed_addr
67
68 define void @runtime.hashmapBinaryDelete(ptr %m, ptr %key) local_unnamed_addr {
69 entry:
70 %isnil = icmp eq ptr %m, null
71 br i1 %isnil, label %done, label %doit
72
73 doit:
74 %seedptr = getelementptr i8, ptr %m, i64 8
75 %seed = load i64, ptr %seedptr, align 4
76 %keysizeptr = getelementptr i8, ptr %m, i64 24
77 %keysize = load i64, ptr %keysizeptr, align 4
78 %hashfnptr = getelementptr i8, ptr %m, i64 72
79 %hashfn = load ptr, ptr %hashfnptr, align 8
80 %hash = tail call i32 %hashfn(ptr %key, i64 %keysize, i64 %seed)
81 tail call void @runtime.hashmapDelete(ptr nonnull %m, ptr %key, i32 %hash, ptr null)
82 br label %done
83
84 done:
85 ret void
86 }
87
88 ; Function Attrs: mustprogress nofree norecurse nounwind willreturn memory(argmem: read)
89 define i1 @runtime.stringLess(ptr readonly captures(none) %a.data, i64 %a.len, i64 %a.cap, ptr readonly captures(none) %b.data, i64 %b.len, i64 %b.cap) local_unnamed_addr #1 {
90 entry:
91 %minlen = tail call i64 @llvm.umin.i64(i64 %a.len, i64 %b.len)
92 %cmp = tail call i32 @memcmp(ptr %a.data, ptr %b.data, i64 %minlen)
93 %islt = icmp slt i32 %cmp, 0
94 br i1 %islt, label %common.ret, label %check
95
96 check: ; preds = %entry
97 %minlen.a = icmp ult i64 %a.len, %b.len
98 %iseq = icmp eq i32 %cmp, 0
99 %spec.select = select i1 %iseq, i1 %minlen.a, i1 false
100 br label %common.ret
101
102 common.ret: ; preds = %check, %entry
103 %common.ret.op = phi i1 [ true, %entry ], [ %spec.select, %check ]
104 ret i1 %common.ret.op
105 }
106
107 declare void @runtime.runtimePanicAt(ptr, ptr, i64, i64, ptr) local_unnamed_addr
108
109 ; Function Attrs: noreturn
110 define void @runtime._panicstr(ptr %msg.data, i64 %msg.len, i64 %msg.cap) local_unnamed_addr #2 {
111 entry:
112 tail call void @runtime.runtimePanicAt(ptr null, ptr %msg.data, i64 %msg.len, i64 %msg.cap, ptr null)
113 unreachable
114 }
115
116 ; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: read)
117 declare i32 @memcmp(ptr captures(none), ptr captures(none), i64) local_unnamed_addr #3
118
119 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
120 declare i64 @llvm.umin.i64(i64, i64) #4
121
122 attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) }
123 attributes #1 = { mustprogress nofree norecurse nounwind willreturn memory(argmem: read) }
124 attributes #2 = { noreturn }
125 attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: read) }
126 attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
127