Compare commits

...

1 Commits

Author SHA1 Message Date
Philip Ginsbach
4518a3a3a9 Revert "Merge pull request #5829 from MathiasVP/reorder-get-instruction-opcode"
This reverts commit 390ee3a6b8, reversing
changes made to f03c99ab03.
2021-05-10 14:45:50 +01:00
10 changed files with 24 additions and 47 deletions

View File

@@ -297,8 +297,7 @@ class Instruction extends Construction::TStageInstruction {
/**
* Gets the opcode that specifies the operation performed by this instruction.
*/
pragma[inline]
final Opcode getOpcode() { Construction::getInstructionOpcode(result, this) }
final Opcode getOpcode() { result = Construction::getInstructionOpcode(this) }
/**
* Gets all direct uses of the result of this instruction. The result can be

View File

@@ -338,21 +338,15 @@ private module Cached {
instr = unreachedInstruction(_) and result = Language::getVoidType()
}
/**
* Holds if `opcode` is the opcode that specifies the operation performed by `instr`.
*
* The parameters are ordered such that they produce a clean join (with no need for reordering)
* in the characteristic predicates of the `Instruction` subclasses.
*/
cached
predicate getInstructionOpcode(Opcode opcode, Instruction instr) {
opcode = getOldInstruction(instr).getOpcode()
Opcode getInstructionOpcode(Instruction instr) {
result = getOldInstruction(instr).getOpcode()
or
instr = phiInstruction(_, _) and opcode instanceof Opcode::Phi
instr = phiInstruction(_, _) and result instanceof Opcode::Phi
or
instr = chiInstruction(_) and opcode instanceof Opcode::Chi
instr = chiInstruction(_) and result instanceof Opcode::Chi
or
instr = unreachedInstruction(_) and opcode instanceof Opcode::Unreached
instr = unreachedInstruction(_) and result instanceof Opcode::Unreached
}
cached

View File

@@ -297,8 +297,7 @@ class Instruction extends Construction::TStageInstruction {
/**
* Gets the opcode that specifies the operation performed by this instruction.
*/
pragma[inline]
final Opcode getOpcode() { Construction::getInstructionOpcode(result, this) }
final Opcode getOpcode() { result = Construction::getInstructionOpcode(this) }
/**
* Gets all direct uses of the result of this instruction. The result can be

View File

@@ -360,8 +360,8 @@ CppType getInstructionResultType(TStageInstruction instr) {
getInstructionTranslatedElement(instr).hasInstruction(_, getInstructionTag(instr), result)
}
predicate getInstructionOpcode(Opcode opcode, TStageInstruction instr) {
getInstructionTranslatedElement(instr).hasInstruction(opcode, getInstructionTag(instr), _)
Opcode getInstructionOpcode(TStageInstruction instr) {
getInstructionTranslatedElement(instr).hasInstruction(result, getInstructionTag(instr), _)
}
IRFunctionBase getInstructionEnclosingIRFunction(TStageInstruction instr) {

View File

@@ -297,8 +297,7 @@ class Instruction extends Construction::TStageInstruction {
/**
* Gets the opcode that specifies the operation performed by this instruction.
*/
pragma[inline]
final Opcode getOpcode() { Construction::getInstructionOpcode(result, this) }
final Opcode getOpcode() { result = Construction::getInstructionOpcode(this) }
/**
* Gets all direct uses of the result of this instruction. The result can be

View File

@@ -338,21 +338,15 @@ private module Cached {
instr = unreachedInstruction(_) and result = Language::getVoidType()
}
/**
* Holds if `opcode` is the opcode that specifies the operation performed by `instr`.
*
* The parameters are ordered such that they produce a clean join (with no need for reordering)
* in the characteristic predicates of the `Instruction` subclasses.
*/
cached
predicate getInstructionOpcode(Opcode opcode, Instruction instr) {
opcode = getOldInstruction(instr).getOpcode()
Opcode getInstructionOpcode(Instruction instr) {
result = getOldInstruction(instr).getOpcode()
or
instr = phiInstruction(_, _) and opcode instanceof Opcode::Phi
instr = phiInstruction(_, _) and result instanceof Opcode::Phi
or
instr = chiInstruction(_) and opcode instanceof Opcode::Chi
instr = chiInstruction(_) and result instanceof Opcode::Chi
or
instr = unreachedInstruction(_) and opcode instanceof Opcode::Unreached
instr = unreachedInstruction(_) and result instanceof Opcode::Unreached
}
cached

View File

@@ -297,8 +297,7 @@ class Instruction extends Construction::TStageInstruction {
/**
* Gets the opcode that specifies the operation performed by this instruction.
*/
pragma[inline]
final Opcode getOpcode() { Construction::getInstructionOpcode(result, this) }
final Opcode getOpcode() { result = Construction::getInstructionOpcode(this) }
/**
* Gets all direct uses of the result of this instruction. The result can be

View File

@@ -165,10 +165,10 @@ import Cached
cached
private module Cached {
cached
predicate getInstructionOpcode(Opcode opcode, TRawInstruction instr) {
Opcode getInstructionOpcode(TRawInstruction instr) {
exists(TranslatedElement element, InstructionTag tag |
instructionOrigin(instr, element, tag) and
element.hasInstruction(opcode, tag, _)
element.hasInstruction(result, tag, _)
)
}

View File

@@ -297,8 +297,7 @@ class Instruction extends Construction::TStageInstruction {
/**
* Gets the opcode that specifies the operation performed by this instruction.
*/
pragma[inline]
final Opcode getOpcode() { Construction::getInstructionOpcode(result, this) }
final Opcode getOpcode() { result = Construction::getInstructionOpcode(this) }
/**
* Gets all direct uses of the result of this instruction. The result can be

View File

@@ -338,21 +338,15 @@ private module Cached {
instr = unreachedInstruction(_) and result = Language::getVoidType()
}
/**
* Holds if `opcode` is the opcode that specifies the operation performed by `instr`.
*
* The parameters are ordered such that they produce a clean join (with no need for reordering)
* in the characteristic predicates of the `Instruction` subclasses.
*/
cached
predicate getInstructionOpcode(Opcode opcode, Instruction instr) {
opcode = getOldInstruction(instr).getOpcode()
Opcode getInstructionOpcode(Instruction instr) {
result = getOldInstruction(instr).getOpcode()
or
instr = phiInstruction(_, _) and opcode instanceof Opcode::Phi
instr = phiInstruction(_, _) and result instanceof Opcode::Phi
or
instr = chiInstruction(_) and opcode instanceof Opcode::Chi
instr = chiInstruction(_) and result instanceof Opcode::Chi
or
instr = unreachedInstruction(_) and opcode instanceof Opcode::Unreached
instr = unreachedInstruction(_) and result instanceof Opcode::Unreached
}
cached