MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / update

Method update

cranelift/codegen/src/alias_analysis.rs:90–117  ·  view source on GitHub ↗
(&mut self, func: &Function, inst: Inst)

Source from the content-addressed store, hash-verified

88
89impl LastStores {
90 fn update(&mut self, func: &Function, inst: Inst) {
91 let opcode = func.dfg.insts[inst].opcode();
92 if has_memory_fence_semantics(opcode) {
93 self.regions.clear();
94 self.last_fence = inst.into();
95 self.other = inst.into();
96 } else if opcode.can_store() {
97 if let Some(memflags) = func.dfg.insts[inst].memflags() {
98 match func.dfg.mem_flags[memflags].alias_region() {
99 Some(region) => self.regions[region] = inst.into(),
100 None => {
101 // A store with no alias region may alias any region, so
102 // treat it like a fence: clear all regions and update
103 // `last_fence` so that subsequent region-tagged loads don't
104 // forward stale values past this store.
105 self.regions.clear();
106 self.last_fence = inst.into();
107 self.other = inst.into();
108 }
109 }
110 } else {
111 // Store with no memflags: must clobber everything.
112 self.regions.clear();
113 self.last_fence = inst.into();
114 self.other = inst.into();
115 }
116 }
117 }
118
119 fn get_last_store(&self, func: &Function, inst: Inst) -> PackedOption<Inst> {
120 if let Some(memflags) = func.dfg.insts[inst].memflags() {

Callers 2

process_instMethod · 0.45

Calls 6

can_storeMethod · 0.80
opcodeMethod · 0.45
clearMethod · 0.45
memflagsMethod · 0.45
alias_regionMethod · 0.45

Tested by

no test coverage detected