Update skeleton

This commit is contained in:
Jeehoon Kang
2020-05-02 07:52:40 +00:00
parent 3bef06455e
commit f4dc5e426c
11 changed files with 142 additions and 15 deletions

View File

@@ -9,7 +9,7 @@ use core::ops::{Deref, DerefMut};
use hexf::{parse_hexf32, parse_hexf64};
use lang_c::ast;
use ordered_float::OrderedFloat;
use std::collections::HashMap;
use std::collections::{BTreeMap, HashMap};
use std::hash::{Hash, Hasher};
pub use dtype::{Dtype, DtypeError, HasDtype};
@@ -18,7 +18,7 @@ pub use parse::Parse;
#[derive(Debug, Clone, PartialEq)]
pub struct TranslationUnit {
pub decls: HashMap<String, Declaration>,
pub decls: BTreeMap<String, Declaration>,
pub structs: HashMap<String, Option<Dtype>>,
}
@@ -161,7 +161,7 @@ pub struct FunctionDefinition {
pub allocations: Vec<Named<Dtype>>,
/// Basic blocks.
pub blocks: HashMap<BlockId, Block>,
pub blocks: BTreeMap<BlockId, Block>,
/// The initial block id.
pub bid_init: BlockId,

View File

@@ -16,7 +16,7 @@ peg::parser! {
pub rule translation_unit() -> TranslationUnit
= _ ds:(named_decl() ** __) _ {
let mut decls = HashMap::new();
let mut decls = BTreeMap::new();
for decl in ds {
let result = decls.insert(decl.name.unwrap(), decl.inner);
assert!(result.is_none());