@ -5,10 +5,13 @@ target triple = "armv6m-none-eabi"
%runtime.hashmap = type { %runtime.hashmap * , i8 * , i32 , i8 , i8 , i8 }
@main.m = global %runtime.hashmap * null
@main.binaryMap = global %runtime.hashmap * null
@main.stringMap = global %runtime.hashmap * null
@main.init.string = internal unnamed_addr constant [ 7 x i8 ] c "CONNECT"
declare %runtime.hashmap * @runtime.hashmapMake ( i8 , i8 , i32 , i8 * %context , i8 * %parentHandle )
declare void @runtime.hashmapBinarySet ( %runtime.hashmap * , i8 * , i8 * , i8 * %context , i8 * %parentHandle )
declare void @runtime.hashmapStringSet ( %runtime.hashmap * , i8 * , i32 , i8 * , i8 * %context , i8 * %parentHandle )
declare void @llvm.lifetime.end.p0i8 ( i64 , i8 * )
declare void @llvm.lifetime.start.p0i8 ( i64 , i8 * )
@ -20,6 +23,7 @@ entry:
define internal void @main.init ( i8 * %context , i8 * %parentHandle ) unnamed_addr {
entry:
; T e s t t h a t h a s h m a p o p t i m i z a t i o n s g e n e r a l l y w o r k ( e v e n w i t h l i f e t i m e s ) .
%hashmap.key = alloca i8
%hashmap.value = alloca %runtime._string
%0 = call %runtime.hashmap * @runtime.hashmapMake ( i8 1 , i8 8 , i32 1 , i8 * undef , i8 * null )
@ -32,5 +36,41 @@ entry:
call void @llvm.lifetime.end.p0i8 ( i64 1 , i8 * %hashmap.key )
call void @llvm.lifetime.end.p0i8 ( i64 8 , i8 * %hashmap.value.bitcast )
store %runtime.hashmap * %0 , %runtime.hashmap * * @main.m
; O t h e r t e s t s , t h a t c a n b e d one i n a s e p a r a t e f u n c t i o n .
call void @main.testNonConstantBinarySet ( )
call void @main.testNonConstantStringSet ( )
ret void
}
; T e s t t h a t a m a p l o a d e d from a global c a n s t i l l b e u s e d f or m a p a s s i g n
; o p e r a t i o n s ( w i t h b i n a r y k e y s ) .
define internal void @main.testNonConstantBinarySet ( ) {
%hashmap.key = alloca i8
%hashmap.value = alloca i8
; C r e a t e h a s h m a p from global . T h i s b r e a k s t h e n o r m a l h a s h m a p B i n a r y S e t
; o p t i m i z a t i o n , to t e s t t h e f a l l b a c k .
%map.new = call %runtime.hashmap * @runtime.hashmapMake ( i8 1 , i8 1 , i32 1 , i8 * undef , i8 * null )
store %runtime.hashmap * %map.new , %runtime.hashmap * * @main.binaryMap
%map = load %runtime.hashmap * , %runtime.hashmap * * @main.binaryMap
; D o t h e b i n a r y s e t to t h e n e w l y l o a d e d m a p .
store i8 1 , i8 * %hashmap.key
store i8 2 , i8 * %hashmap.value
call void @runtime.hashmapBinarySet ( %runtime.hashmap * %map , i8 * %hashmap.key , i8 * %hashmap.value , i8 * undef , i8 * null )
ret void
}
; T e s t t h a t a m a p l o a d e d from a global c a n s t i l l b e u s e d f or m a p a s s i g n
; o p e r a t i o n s ( w i t h s t r i n g k e y s ) .
define internal void @main.testNonConstantStringSet ( ) {
%hashmap.value = alloca i8
; C r e a t e h a s h m a p from global . T h i s b r e a k s t h e n o r m a l h a s h m a p S t r i n g S e t
; o p t i m i z a t i o n , to t e s t t h e f a l l b a c k .
%map.new = call %runtime.hashmap * @runtime.hashmapMake ( i8 8 , i8 1 , i32 1 , i8 * undef , i8 * null )
store %runtime.hashmap * %map.new , %runtime.hashmap * * @main.stringMap
%map = load %runtime.hashmap * , %runtime.hashmap * * @main.stringMap
; D o t h e s t r i n g s e t to t h e n e w l y l o a d e d m a p .
store i8 2 , i8 * %hashmap.value
call void @runtime.hashmapStringSet ( %runtime.hashmap * %map , i8 * getelementptr inbounds ( [ 7 x i8 ] , [ 7 x i8 ] * @main.init.string , i32 0 , i32 0 ) , i32 7 , i8 * %hashmap.value , i8 * undef , i8 * null )
ret void
}