mirror of
https://github.com/github/codeql.git
synced 2026-05-02 20:25:13 +02:00
autoformat and sync C++ files
This commit is contained in:
@@ -28,12 +28,15 @@ class Operand extends TStageOperand {
|
||||
cached
|
||||
Operand() {
|
||||
// Ensure that the operand does not refer to instructions from earlier stages that are unreachable here
|
||||
exists(Instruction use, Instruction def | this = registerOperand(use, _, def)) or
|
||||
exists(Instruction use | this = nonSSAMemoryOperand(use, _)) or
|
||||
exists(Instruction use, Instruction def | this = registerOperand(use, _, def))
|
||||
or
|
||||
exists(Instruction use | this = nonSSAMemoryOperand(use, _))
|
||||
or
|
||||
exists(Instruction use, Instruction def, IRBlock predecessorBlock |
|
||||
this = phiOperand(use, def, predecessorBlock, _) or
|
||||
this = reusedPhiOperand(use, def, predecessorBlock, _)
|
||||
) or
|
||||
)
|
||||
or
|
||||
exists(Instruction use | this = chiOperand(use, _))
|
||||
}
|
||||
|
||||
|
||||
@@ -92,9 +92,7 @@ private predicate operandIsConsumedWithoutEscaping(Operand operand) {
|
||||
instr.(ConvertInstruction).getResultIRType() instanceof IRBooleanType
|
||||
or
|
||||
instr instanceof CallInstruction and
|
||||
not exists(IREscapeAnalysisConfiguration config |
|
||||
config.useSoundEscapeAnalysis()
|
||||
)
|
||||
not exists(IREscapeAnalysisConfiguration config | config.useSoundEscapeAnalysis())
|
||||
)
|
||||
)
|
||||
or
|
||||
|
||||
@@ -144,9 +144,7 @@ class DynamicAllocation extends Allocation, TDynamicAllocation {
|
||||
}
|
||||
|
||||
class StageEscapeConfiguration extends string {
|
||||
StageEscapeConfiguration() {
|
||||
this = "StageEscapeConfiguration (aliased_ssa)"
|
||||
}
|
||||
StageEscapeConfiguration() { this = "StageEscapeConfiguration (aliased_ssa)" }
|
||||
|
||||
predicate useSoundEscapeAnalysis() { none() }
|
||||
}
|
||||
|
||||
@@ -569,15 +569,13 @@ private Overlap getVariableMemoryLocationOverlap(
|
||||
* Holds if the def/use information for the result of `instr` can be reused from the previous
|
||||
* iteration of the IR.
|
||||
*/
|
||||
predicate canReuseSSAForOldResult(Instruction instr) {
|
||||
OldSSA::canReuseSSAForMemoryResult(instr)
|
||||
}
|
||||
predicate canReuseSSAForOldResult(Instruction instr) { OldSSA::canReuseSSAForMemoryResult(instr) }
|
||||
|
||||
bindingset[result, b]
|
||||
private boolean unbindBool(boolean b) { result != b.booleanNot() }
|
||||
|
||||
MemoryLocation getResultMemoryLocation(Instruction instr) {
|
||||
not(canReuseSSAForOldResult(instr)) and
|
||||
not canReuseSSAForOldResult(instr) and
|
||||
exists(MemoryAccessKind kind, boolean isMayAccess |
|
||||
kind = instr.getResultMemoryAccess() and
|
||||
(if instr.hasResultMayMemoryAccess() then isMayAccess = true else isMayAccess = false) and
|
||||
@@ -610,7 +608,7 @@ MemoryLocation getResultMemoryLocation(Instruction instr) {
|
||||
}
|
||||
|
||||
MemoryLocation getOperandMemoryLocation(MemoryOperand operand) {
|
||||
not(canReuseSSAForOldResult(operand.getAnyDef())) and
|
||||
not canReuseSSAForOldResult(operand.getAnyDef()) and
|
||||
exists(MemoryAccessKind kind, boolean isMayAccess |
|
||||
kind = operand.getMemoryAccess() and
|
||||
(if operand.hasMayReadMemoryAccess() then isMayAccess = true else isMayAccess = false) and
|
||||
|
||||
@@ -150,13 +150,16 @@ private module Cached {
|
||||
(
|
||||
result = getNewInstruction(oldOperand.getAnyDef()) and
|
||||
overlap = originalOverlap
|
||||
/*or
|
||||
exists(OldIR::PhiInputOperand phiOperand, Overlap phiOperandOverlap |
|
||||
phiOperand = getDegeneratePhiOperand(oldOperand.getAnyDef()) and
|
||||
result = getNewDefinitionFromOldSSA(phiOperand, phiOperandOverlap) and
|
||||
overlap = combineOverlap(phiOperandOverlap, originalOverlap)
|
||||
) */
|
||||
)
|
||||
/*
|
||||
* or
|
||||
* exists(OldIR::PhiInputOperand phiOperand, Overlap phiOperandOverlap |
|
||||
* phiOperand = getDegeneratePhiOperand(oldOperand.getAnyDef()) and
|
||||
* result = getNewDefinitionFromOldSSA(phiOperand, phiOperandOverlap) and
|
||||
* overlap = combineOverlap(phiOperandOverlap, originalOverlap)
|
||||
* )
|
||||
*/
|
||||
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -313,12 +316,13 @@ private module Cached {
|
||||
|
||||
cached
|
||||
Instruction getPhiInstructionBlockStart(PhiInstruction instr) {
|
||||
exists(OldBlock oldBlock | (
|
||||
instr = getPhi(oldBlock, _)
|
||||
or
|
||||
// Any `Phi` that we propagated from the previous iteration stays in the same block.
|
||||
getOldInstruction(instr).getBlock() = oldBlock
|
||||
) and
|
||||
exists(OldBlock oldBlock |
|
||||
(
|
||||
instr = getPhi(oldBlock, _)
|
||||
or
|
||||
// Any `Phi` that we propagated from the previous iteration stays in the same block.
|
||||
getOldInstruction(instr).getBlock() = oldBlock
|
||||
) and
|
||||
result = getNewInstruction(oldBlock.getFirstInstruction())
|
||||
)
|
||||
}
|
||||
|
||||
@@ -55,10 +55,7 @@ module UnaliasedSSAInstructions {
|
||||
result = TUnaliasedSSAPhiInstruction(blockStartInstr, memoryLocation)
|
||||
}
|
||||
|
||||
TRawInstruction reusedPhiInstruction(
|
||||
TRawInstruction blockStartInstr) {
|
||||
none()
|
||||
}
|
||||
TRawInstruction reusedPhiInstruction(TRawInstruction blockStartInstr) { none() }
|
||||
|
||||
class TChiInstruction = TUnaliasedSSAChiInstruction;
|
||||
|
||||
@@ -88,8 +85,7 @@ module AliasedSSAInstructions {
|
||||
result = TAliasedSSAPhiInstruction(blockStartInstr, memoryLocation)
|
||||
}
|
||||
|
||||
TPhiInstruction reusedPhiInstruction(
|
||||
TRawInstruction blockStartInstr) {
|
||||
TPhiInstruction reusedPhiInstruction(TRawInstruction blockStartInstr) {
|
||||
result = TUnaliasedSSAPhiInstruction(blockStartInstr, _)
|
||||
}
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ private module Shared {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Provides wrappers for the constructors of each branch of `TOperand` that is used by the
|
||||
* raw IR stage.
|
||||
* These wrappers are not parameterized because it is not possible to invoke an IPA constructor via
|
||||
@@ -115,6 +115,7 @@ module RawOperands {
|
||||
) {
|
||||
none()
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Chi operand with the specified parameters.
|
||||
*/
|
||||
@@ -152,6 +153,7 @@ module UnaliasedSSAOperands {
|
||||
) {
|
||||
none()
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Chi operand with the specified parameters.
|
||||
*/
|
||||
@@ -195,6 +197,7 @@ module AliasedSSAOperands {
|
||||
result = Internal::TUnaliasedPhiOperand(useInstr, defInstr, oldBlock, overlap)
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Chi operand with the specified parameters.
|
||||
*/
|
||||
|
||||
@@ -28,12 +28,15 @@ class Operand extends TStageOperand {
|
||||
cached
|
||||
Operand() {
|
||||
// Ensure that the operand does not refer to instructions from earlier stages that are unreachable here
|
||||
exists(Instruction use, Instruction def | this = registerOperand(use, _, def)) or
|
||||
exists(Instruction use | this = nonSSAMemoryOperand(use, _)) or
|
||||
exists(Instruction use, Instruction def | this = registerOperand(use, _, def))
|
||||
or
|
||||
exists(Instruction use | this = nonSSAMemoryOperand(use, _))
|
||||
or
|
||||
exists(Instruction use, Instruction def, IRBlock predecessorBlock |
|
||||
this = phiOperand(use, def, predecessorBlock, _) or
|
||||
this = reusedPhiOperand(use, def, predecessorBlock, _)
|
||||
) or
|
||||
)
|
||||
or
|
||||
exists(Instruction use | this = chiOperand(use, _))
|
||||
}
|
||||
|
||||
|
||||
@@ -28,12 +28,15 @@ class Operand extends TStageOperand {
|
||||
cached
|
||||
Operand() {
|
||||
// Ensure that the operand does not refer to instructions from earlier stages that are unreachable here
|
||||
exists(Instruction use, Instruction def | this = registerOperand(use, _, def)) or
|
||||
exists(Instruction use | this = nonSSAMemoryOperand(use, _)) or
|
||||
exists(Instruction use, Instruction def | this = registerOperand(use, _, def))
|
||||
or
|
||||
exists(Instruction use | this = nonSSAMemoryOperand(use, _))
|
||||
or
|
||||
exists(Instruction use, Instruction def, IRBlock predecessorBlock |
|
||||
this = phiOperand(use, def, predecessorBlock, _) or
|
||||
this = reusedPhiOperand(use, def, predecessorBlock, _)
|
||||
) or
|
||||
)
|
||||
or
|
||||
exists(Instruction use | this = chiOperand(use, _))
|
||||
}
|
||||
|
||||
|
||||
@@ -92,9 +92,7 @@ private predicate operandIsConsumedWithoutEscaping(Operand operand) {
|
||||
instr.(ConvertInstruction).getResultIRType() instanceof IRBooleanType
|
||||
or
|
||||
instr instanceof CallInstruction and
|
||||
not exists(IREscapeAnalysisConfiguration config |
|
||||
config.useSoundEscapeAnalysis()
|
||||
)
|
||||
not exists(IREscapeAnalysisConfiguration config | config.useSoundEscapeAnalysis())
|
||||
)
|
||||
)
|
||||
or
|
||||
|
||||
@@ -16,9 +16,7 @@ class Allocation extends IRAutomaticVariable {
|
||||
}
|
||||
|
||||
class StageEscapeConfiguration extends string {
|
||||
StageEscapeConfiguration() {
|
||||
this = "StageEscapeConfiguration (unaliased_ssa)"
|
||||
}
|
||||
StageEscapeConfiguration() { this = "StageEscapeConfiguration (unaliased_ssa)" }
|
||||
|
||||
predicate useSoundEscapeAnalysis() { any() }
|
||||
}
|
||||
|
||||
@@ -150,13 +150,16 @@ private module Cached {
|
||||
(
|
||||
result = getNewInstruction(oldOperand.getAnyDef()) and
|
||||
overlap = originalOverlap
|
||||
/*or
|
||||
exists(OldIR::PhiInputOperand phiOperand, Overlap phiOperandOverlap |
|
||||
phiOperand = getDegeneratePhiOperand(oldOperand.getAnyDef()) and
|
||||
result = getNewDefinitionFromOldSSA(phiOperand, phiOperandOverlap) and
|
||||
overlap = combineOverlap(phiOperandOverlap, originalOverlap)
|
||||
) */
|
||||
)
|
||||
/*
|
||||
* or
|
||||
* exists(OldIR::PhiInputOperand phiOperand, Overlap phiOperandOverlap |
|
||||
* phiOperand = getDegeneratePhiOperand(oldOperand.getAnyDef()) and
|
||||
* result = getNewDefinitionFromOldSSA(phiOperand, phiOperandOverlap) and
|
||||
* overlap = combineOverlap(phiOperandOverlap, originalOverlap)
|
||||
* )
|
||||
*/
|
||||
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -313,12 +316,13 @@ private module Cached {
|
||||
|
||||
cached
|
||||
Instruction getPhiInstructionBlockStart(PhiInstruction instr) {
|
||||
exists(OldBlock oldBlock | (
|
||||
instr = getPhi(oldBlock, _)
|
||||
or
|
||||
// Any `Phi` that we propagated from the previous iteration stays in the same block.
|
||||
getOldInstruction(instr).getBlock() = oldBlock
|
||||
) and
|
||||
exists(OldBlock oldBlock |
|
||||
(
|
||||
instr = getPhi(oldBlock, _)
|
||||
or
|
||||
// Any `Phi` that we propagated from the previous iteration stays in the same block.
|
||||
getOldInstruction(instr).getBlock() = oldBlock
|
||||
) and
|
||||
result = getNewInstruction(oldBlock.getFirstInstruction())
|
||||
)
|
||||
}
|
||||
|
||||
@@ -72,9 +72,7 @@ class MemoryLocation extends TMemoryLocation {
|
||||
final predicate canReuseSSA() { canReuseSSAForVariable(var) }
|
||||
}
|
||||
|
||||
predicate canReuseSSAForOldResult(Instruction instr) {
|
||||
none()
|
||||
}
|
||||
predicate canReuseSSAForOldResult(Instruction instr) { none() }
|
||||
|
||||
/**
|
||||
* Represents a set of `MemoryLocation`s that cannot overlap with
|
||||
|
||||
Reference in New Issue
Block a user