Skip to content

Commit 8a4cc3b

Browse files
committed
C++: Sync identical files.
1 parent 200d947 commit 8a4cc3b

File tree

8 files changed

+55
-0
lines changed

8 files changed

+55
-0
lines changed

cpp/ql/src/semmle/code/cpp/ir/implementation/raw/Instruction.qll

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2055,6 +2055,13 @@ class ChiInstruction extends Instruction {
20552055
final predicate getUpdatedInterval(int startBit, int endBit) {
20562056
Construction::getIntervalUpdatedByChi(this, startBit, endBit)
20572057
}
2058+
2059+
/**
2060+
* Holds if the `ChiPartialOperand` totally, but not exactly, overlaps with the `ChiTotalOperand`.
2061+
* This means that the `ChiPartialOperand` will not override the entire memory associated with the
2062+
* `ChiTotalOperand`.
2063+
*/
2064+
final predicate isPartialUpdate() { Construction::chiOnlyPartiallyUpdatesLocation(this) }
20582065
}
20592066

20602067
/**

cpp/ql/src/semmle/code/cpp/ir/implementation/raw/internal/IRConstruction.qll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,8 @@ predicate getIntervalUpdatedByChi(ChiInstruction chi, int startBit, int endBit)
194194
*/
195195
predicate getUsedInterval(Operand operand, int startBit, int endBit) { none() }
196196

197+
predicate chiOnlyPartiallyUpdatesLocation(ChiInstruction chi) { none() }
198+
197199
/** Gets a non-phi instruction that defines an operand of `instr`. */
198200
private Instruction getNonPhiOperandDef(Instruction instr) {
199201
result = getRegisterOperandDefinition(instr, _)

cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/Instruction.qll

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2055,6 +2055,13 @@ class ChiInstruction extends Instruction {
20552055
final predicate getUpdatedInterval(int startBit, int endBit) {
20562056
Construction::getIntervalUpdatedByChi(this, startBit, endBit)
20572057
}
2058+
2059+
/**
2060+
* Holds if the `ChiPartialOperand` totally, but not exactly, overlaps with the `ChiTotalOperand`.
2061+
* This means that the `ChiPartialOperand` will not override the entire memory associated with the
2062+
* `ChiTotalOperand`.
2063+
*/
2064+
final predicate isPartialUpdate() { Construction::chiOnlyPartiallyUpdatesLocation(this) }
20582065
}
20592066

20602067
/**

cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/internal/SSAConstruction.qll

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,17 @@ private module Cached {
178178
)
179179
}
180180

181+
cached
182+
predicate chiOnlyPartiallyUpdatesLocation(ChiInstruction chi) {
183+
exists(Alias::MemoryLocation location, OldInstruction oldInstruction |
184+
oldInstruction = getOldInstruction(chi.getPartial()) and
185+
location = Alias::getResultMemoryLocation(oldInstruction)
186+
|
187+
Alias::getStartBitOffset(location) != 0 or
188+
Alias::getEndBitOffset(location) != 8 * location.getType().getByteSize()
189+
)
190+
}
191+
181192
/**
182193
* Holds if `instr` is part of a cycle in the operand graph that doesn't go
183194
* through a phi instruction and therefore should be impossible.

csharp/ql/src/experimental/ir/implementation/raw/Instruction.qll

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2055,6 +2055,13 @@ class ChiInstruction extends Instruction {
20552055
final predicate getUpdatedInterval(int startBit, int endBit) {
20562056
Construction::getIntervalUpdatedByChi(this, startBit, endBit)
20572057
}
2058+
2059+
/**
2060+
* Holds if the `ChiPartialOperand` totally, but not exactly, overlaps with the `ChiTotalOperand`.
2061+
* This means that the `ChiPartialOperand` will not override the entire memory associated with the
2062+
* `ChiTotalOperand`.
2063+
*/
2064+
final predicate isPartialUpdate() { Construction::chiOnlyPartiallyUpdatesLocation(this) }
20582065
}
20592066

20602067
/**

csharp/ql/src/experimental/ir/implementation/raw/internal/IRConstruction.qll

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,9 @@ private module Cached {
228228
cached
229229
predicate getUsedInterval(Operand operand, int startBit, int endBit) { none() }
230230

231+
cached
232+
predicate chiOnlyPartiallyUpdatesLocation(ChiInstruction chi) { none() }
233+
231234
/**
232235
* Holds if `instr` is part of a cycle in the operand graph that doesn't go
233236
* through a phi instruction and therefore should be impossible.

csharp/ql/src/experimental/ir/implementation/unaliased_ssa/Instruction.qll

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2055,6 +2055,13 @@ class ChiInstruction extends Instruction {
20552055
final predicate getUpdatedInterval(int startBit, int endBit) {
20562056
Construction::getIntervalUpdatedByChi(this, startBit, endBit)
20572057
}
2058+
2059+
/**
2060+
* Holds if the `ChiPartialOperand` totally, but not exactly, overlaps with the `ChiTotalOperand`.
2061+
* This means that the `ChiPartialOperand` will not override the entire memory associated with the
2062+
* `ChiTotalOperand`.
2063+
*/
2064+
final predicate isPartialUpdate() { Construction::chiOnlyPartiallyUpdatesLocation(this) }
20582065
}
20592066

20602067
/**

csharp/ql/src/experimental/ir/implementation/unaliased_ssa/internal/SSAConstruction.qll

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,17 @@ private module Cached {
178178
)
179179
}
180180

181+
cached
182+
predicate chiOnlyPartiallyUpdatesLocation(ChiInstruction chi) {
183+
exists(Alias::MemoryLocation location, OldInstruction oldInstruction |
184+
oldInstruction = getOldInstruction(chi.getPartial()) and
185+
location = Alias::getResultMemoryLocation(oldInstruction)
186+
|
187+
Alias::getStartBitOffset(location) != 0 or
188+
Alias::getEndBitOffset(location) != 8 * location.getType().getByteSize()
189+
)
190+
}
191+
181192
/**
182193
* Holds if `instr` is part of a cycle in the operand graph that doesn't go
183194
* through a phi instruction and therefore should be impossible.

0 commit comments

Comments
 (0)