bundle.rs 1.61 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14
// Copyright 2017 The Australian National University
// 
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// 
//     http://www.apache.org/licenses/LICENSE-2.0
// 
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

15 16 17
use ir::*;
use ptr::*;
use types::*;
qinsoon's avatar
qinsoon committed
18

19
use utils::LinkedHashMap;
qinsoon's avatar
qinsoon committed
20 21

pub struct MuBundle {
qinsoon's avatar
qinsoon committed
22 23
    pub id: MuID,
    
24 25 26 27 28 29
    pub type_defs: LinkedHashMap<MuID, P<MuType>>,
    pub func_sigs: LinkedHashMap<MuID, P<MuFuncSig>>,
    pub constants: LinkedHashMap<MuID, P<Value>>,
    pub globals  : LinkedHashMap<MuID, P<Value>>,
    pub func_defs: LinkedHashMap<MuID, MuFunction>,
    pub func_decls: LinkedHashMap<MuID, MuFunctionVersion>,
qinsoon's avatar
qinsoon committed
30
    
31 32
//    id_name_map: LinkedHashMap<MuID, MuName>,
//    name_id_map: LinkedHashMap<MuName, MuID>
qinsoon's avatar
qinsoon committed
33 34 35
}

impl MuBundle {
qinsoon's avatar
qinsoon committed
36
    pub fn new(id: MuID) -> MuBundle {
qinsoon's avatar
qinsoon committed
37
        MuBundle {
qinsoon's avatar
qinsoon committed
38 39
            id: id,
            
40 41 42 43 44 45
            type_defs: LinkedHashMap::new(),
            func_sigs: LinkedHashMap::new(),
            constants: LinkedHashMap::new(),
            globals: LinkedHashMap::new(),
            func_defs: LinkedHashMap::new(),
            func_decls: LinkedHashMap::new(),
qinsoon's avatar
qinsoon committed
46
            
47 48
//            id_name_map: LinkedHashMap::new(),
//            name_id_map: LinkedHashMap::new()
qinsoon's avatar
qinsoon committed
49 50
        }
    }
qinsoon's avatar
qinsoon committed
51
}