@@ -41,8 +41,18 @@ private newtype TMemoryLocation =
4141 IntValue endBitOffset , boolean isMayAccess
4242 ) {
4343 (
44- hasResultMemoryAccess ( _, var , type , _, startBitOffset , endBitOffset , isMayAccess ) or
44+ hasResultMemoryAccess ( _, var , type , _, startBitOffset , endBitOffset , isMayAccess )
45+ or
4546 hasOperandMemoryAccess ( _, var , type , _, startBitOffset , endBitOffset , isMayAccess )
47+ or
48+ exists ( IRAutomaticVariable autoVar |
49+ // Always create a memory location for the entire variable.
50+ autoVar = var and
51+ type = autoVar .getIRType ( ) and
52+ startBitOffset = 0 and
53+ endBitOffset = type .getByteSize ( ) * 8 and
54+ isMayAccess = false
55+ )
4656 ) and
4757 languageType = type .getCanonicalLanguageType ( )
4858 } or
@@ -78,6 +88,8 @@ abstract class MemoryLocation extends TMemoryLocation {
7888
7989 abstract IRFunction getIRFunction ( ) ;
8090
91+ abstract Location getLocation ( ) ;
92+
8193 final IRType getIRType ( ) { result = getType ( ) .getIRType ( ) }
8294
8395 abstract predicate isMayAccess ( ) ;
@@ -141,6 +153,8 @@ class VariableMemoryLocation extends TVariableMemoryLocation, MemoryLocation {
141153
142154 final override IRFunction getIRFunction ( ) { result = var .getEnclosingIRFunction ( ) }
143155
156+ final override Location getLocation ( ) { result = var .getLocation ( ) }
157+
144158 final IntValue getStartBitOffset ( ) { result = startBitOffset }
145159
146160 final IntValue getEndBitOffset ( ) { result = endBitOffset }
@@ -208,6 +222,8 @@ class UnknownMemoryLocation extends TUnknownMemoryLocation, MemoryLocation {
208222
209223 final override IRFunction getIRFunction ( ) { result = irFunc }
210224
225+ final override Location getLocation ( ) { result = irFunc .getLocation ( ) }
226+
211227 final override string getUniqueId ( ) { result = "{Unknown}" }
212228
213229 final override predicate isMayAccess ( ) { isMayAccess = true }
@@ -233,6 +249,8 @@ class AllNonLocalMemory extends TAllNonLocalMemory, MemoryLocation {
233249
234250 final override IRFunction getIRFunction ( ) { result = irFunc }
235251
252+ final override Location getLocation ( ) { result = irFunc .getLocation ( ) }
253+
236254 final override string getUniqueId ( ) { result = "{AllNonLocal}" }
237255
238256 final override predicate isMayAccess ( ) { isMayAccess = true }
@@ -255,6 +273,8 @@ class AllAliasedMemory extends TAllAliasedMemory, MemoryLocation {
255273
256274 final override IRFunction getIRFunction ( ) { result = irFunc }
257275
276+ final override Location getLocation ( ) { result = irFunc .getLocation ( ) }
277+
258278 final override string getUniqueId ( ) { result = " " + toString ( ) }
259279
260280 final override VirtualVariable getVirtualVariable ( ) { result = TAllAliasedMemory ( irFunc , false ) }
0 commit comments