Goose  Diff

Differences From Artifact [86bbcd6d7b]:

  • File bs/llr/helpers.h — part of check-in [83476a562e] at 2019-10-05 11:55:44 on branch trunk — z3 builder: handle variables. (user: achavasse size: 1975)

To Artifact [852fd415c8]:

  • File bs/llr/helpers.h — part of check-in [238df77134] at 2019-11-19 00:04:49 on branch trunk — cfg: now that we got rid of this crazy system where CFGs could "call" other CFGs that weren't really functions, removed that clumsy cfg index that was needed to identify temporaries everywhere. (user: achavasse size: 1350)

16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
    }

    template< typename T >
    class TempStorage
    {
        public:
            template< typename TT >
            auto& set( uint32_t cfgId, uint32_t index, TT&& x )
            {
                auto [it, inserted] = m_storage.try_emplace( cfgId );

                if( it->second.size() <= index )
                    it->second.resize( index + 1 );

                it->second[index] = forward< TT >( x );
                return it->second[index];
            }

            template< typename TT >
            void setVec( uint32_t cfgId, TT&& x )
            {
                auto [it, inserted] = m_storage.try_emplace( cfgId );
                it->second = forward< TT >( x );
            }

            const T* get( uint32_t cfgId, uint32_t index ) const
            {
                auto it = m_storage.find( cfgId );
                if( it == m_storage.end() )
                    return nullptr;

                if( it->second.size() <= index )
                    return nullptr;

                return &it->second[index];
            }

            T* get( uint32_t cfgId, uint32_t index )
            {
                auto it = m_storage.find( cfgId );
                if( it == m_storage.end() )
                    return nullptr;

                if( it->second.size() <= index )
                    return nullptr;

                return &it->second[index];
            }

        private:
            unordered_map< uint32_t, llvm::SmallVector< T, 8 > >
                m_storage;
    };
}

#endif







|

|
<
<
<
<
|
|


<
<
<
<
<
<
<
|

|



<
<
<
|


|

|



<
<
<
|



|
<




16
17
18
19
20
21
22
23
24
25




26
27
28
29







30
31
32
33
34
35



36
37
38
39
40
41
42
43
44



45
46
47
48
49

50
51
52
53
    }

    template< typename T >
    class TempStorage
    {
        public:
            template< typename TT >
            auto& set( uint32_t index, TT&& x )
            {
                auto [it, inserted] = m_storage.try_emplace( index );




                it->second = forward< TT >( x );
                return it->second;
            }








            const T* get( uint32_t index ) const
            {
                auto it = m_storage.find( index );
                if( it == m_storage.end() )
                    return nullptr;




                return &it->second;
            }

            T* get( uint32_t index )
            {
                auto it = m_storage.find( index );
                if( it == m_storage.end() )
                    return nullptr;




                return &it->second;
            }

        private:
            unordered_map< uint32_t, T > m_storage;

    };
}

#endif