mirror of
https://github.com/github/codeql.git
synced 2025-12-21 03:06:31 +01:00
C++: pull out hasMemoryOperandDefinition (slow)
This commit is contained in:
@@ -75,6 +75,22 @@ private module Cached {
|
||||
)
|
||||
}
|
||||
|
||||
private predicate hasMemoryOperandDefinition (OldInstruction oldInstruction, OldIR::NonPhiMemoryOperand oldOperand,
|
||||
Overlap overlap, Instruction instr) {
|
||||
oldOperand = oldInstruction.getAnOperand() and
|
||||
exists(
|
||||
OldBlock useBlock, int useRank, Alias::MemoryLocation useLocation,
|
||||
Alias::MemoryLocation defLocation, OldBlock defBlock, int defRank, int defOffset
|
||||
|
|
||||
useLocation = Alias::getOperandMemoryLocation(oldOperand) and
|
||||
hasDefinitionAtRank(useLocation, defLocation, defBlock, defRank, defOffset) and
|
||||
hasUseAtRank(useLocation, useBlock, useRank, oldInstruction) and
|
||||
definitionReachesUse(useLocation, defBlock, defRank, useBlock, useRank) and
|
||||
overlap = Alias::getOverlap(defLocation, useLocation) and
|
||||
instr = getDefinitionOrChiInstruction(defBlock, defOffset, defLocation, _)
|
||||
)
|
||||
}
|
||||
|
||||
cached
|
||||
Instruction getMemoryOperandDefinition(
|
||||
Instruction instruction, MemoryOperandTag tag, Overlap overlap
|
||||
@@ -87,17 +103,7 @@ private module Cached {
|
||||
(
|
||||
if exists(Alias::getOperandMemoryLocation(oldOperand))
|
||||
then
|
||||
exists(
|
||||
OldBlock useBlock, int useRank, Alias::MemoryLocation useLocation,
|
||||
Alias::MemoryLocation defLocation, OldBlock defBlock, int defRank, int defOffset
|
||||
|
|
||||
useLocation = Alias::getOperandMemoryLocation(oldOperand) and
|
||||
hasDefinitionAtRank(useLocation, defLocation, defBlock, defRank, defOffset) and
|
||||
hasUseAtRank(useLocation, useBlock, useRank, oldInstruction) and
|
||||
definitionReachesUse(useLocation, defBlock, defRank, useBlock, useRank) and
|
||||
overlap = Alias::getOverlap(defLocation, useLocation) and
|
||||
result = getDefinitionOrChiInstruction(defBlock, defOffset, defLocation, _)
|
||||
)
|
||||
hasMemoryOperandDefinition(oldInstruction, oldOperand, overlap, result)
|
||||
else (
|
||||
result = instruction.getEnclosingIRFunction().getUnmodeledDefinitionInstruction() and
|
||||
overlap instanceof MustTotallyOverlap
|
||||
|
||||
Reference in New Issue
Block a user