Add PrimaryEntityData marker trait.

Require this trait on the value type stored in an EntityMap to 'unlock' the
methods intended for primary entity maps that are allowed to create references
with the 'push method.

This prevents accidentally depending on these methods in secondary maps.
This commit is contained in:
Jakob Stoklund Olesen
2016-08-01 14:45:59 -07:00
parent 4c0b59a947
commit 82a85961ff
3 changed files with 44 additions and 21 deletions

View File

@@ -1,6 +1,6 @@
//! Data flow graph tracking Instructions, Values, and EBBs.
use entity_map::EntityMap;
use entity_map::{EntityMap, PrimaryEntityData};
use ir::entities::{Ebb, Inst, Value, NO_VALUE, ExpandedValue};
use ir::instructions::InstructionData;
use ir::types::Type;
@@ -33,6 +33,9 @@ pub struct DataFlowGraph {
extended_values: Vec<ValueData>,
}
impl PrimaryEntityData for InstructionData {}
impl PrimaryEntityData for EbbData {}
impl DataFlowGraph {
/// Create a new empty `DataFlowGraph`.
pub fn new() -> DataFlowGraph {