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. * Gets the opcode that specifies the operation performed by this instruction.
*/ */
pragma[inline] final Opcode getOpcode() { result = Construction::getInstructionOpcode(this) }
final Opcode getOpcode() { Construction::getInstructionOpcode(result, this) }
/** /**
* Gets all direct uses of the result of this instruction. The result can be * 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() 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 cached
predicate getInstructionOpcode(Opcode opcode, Instruction instr) { Opcode getInstructionOpcode(Instruction instr) {
opcode = getOldInstruction(instr).getOpcode() result = getOldInstruction(instr).getOpcode()
or or
instr = phiInstruction(_, _) and opcode instanceof Opcode::Phi instr = phiInstruction(_, _) and result instanceof Opcode::Phi
or or
instr = chiInstruction(_) and opcode instanceof Opcode::Chi instr = chiInstruction(_) and result instanceof Opcode::Chi
or or
instr = unreachedInstruction(_) and opcode instanceof Opcode::Unreached instr = unreachedInstruction(_) and result instanceof Opcode::Unreached
} }
cached cached

View File

@@ -297,8 +297,7 @@ class Instruction extends Construction::TStageInstruction {
/** /**
* Gets the opcode that specifies the operation performed by this instruction. * Gets the opcode that specifies the operation performed by this instruction.
*/ */
pragma[inline] final Opcode getOpcode() { result = Construction::getInstructionOpcode(this) }
final Opcode getOpcode() { Construction::getInstructionOpcode(result, this) }
/** /**
* Gets all direct uses of the result of this instruction. The result can be * 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) getInstructionTranslatedElement(instr).hasInstruction(_, getInstructionTag(instr), result)
} }
predicate getInstructionOpcode(Opcode opcode, TStageInstruction instr) { Opcode getInstructionOpcode(TStageInstruction instr) {
getInstructionTranslatedElement(instr).hasInstruction(opcode, getInstructionTag(instr), _) getInstructionTranslatedElement(instr).hasInstruction(result, getInstructionTag(instr), _)
} }
IRFunctionBase getInstructionEnclosingIRFunction(TStageInstruction 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. * Gets the opcode that specifies the operation performed by this instruction.
*/ */
pragma[inline] final Opcode getOpcode() { result = Construction::getInstructionOpcode(this) }
final Opcode getOpcode() { Construction::getInstructionOpcode(result, this) }
/** /**
* Gets all direct uses of the result of this instruction. The result can be * 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() 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 cached
predicate getInstructionOpcode(Opcode opcode, Instruction instr) { Opcode getInstructionOpcode(Instruction instr) {
opcode = getOldInstruction(instr).getOpcode() result = getOldInstruction(instr).getOpcode()
or or
instr = phiInstruction(_, _) and opcode instanceof Opcode::Phi instr = phiInstruction(_, _) and result instanceof Opcode::Phi
or or
instr = chiInstruction(_) and opcode instanceof Opcode::Chi instr = chiInstruction(_) and result instanceof Opcode::Chi
or or
instr = unreachedInstruction(_) and opcode instanceof Opcode::Unreached instr = unreachedInstruction(_) and result instanceof Opcode::Unreached
} }
cached cached

View File

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

View File

@@ -165,10 +165,10 @@ import Cached
cached cached
private module Cached { private module Cached {
cached cached
predicate getInstructionOpcode(Opcode opcode, TRawInstruction instr) { Opcode getInstructionOpcode(TRawInstruction instr) {
exists(TranslatedElement element, InstructionTag tag | exists(TranslatedElement element, InstructionTag tag |
instructionOrigin(instr, element, tag) and 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. * Gets the opcode that specifies the operation performed by this instruction.
*/ */
pragma[inline] final Opcode getOpcode() { result = Construction::getInstructionOpcode(this) }
final Opcode getOpcode() { Construction::getInstructionOpcode(result, this) }
/** /**
* Gets all direct uses of the result of this instruction. The result can be * 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() 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 cached
predicate getInstructionOpcode(Opcode opcode, Instruction instr) { Opcode getInstructionOpcode(Instruction instr) {
opcode = getOldInstruction(instr).getOpcode() result = getOldInstruction(instr).getOpcode()
or or
instr = phiInstruction(_, _) and opcode instanceof Opcode::Phi instr = phiInstruction(_, _) and result instanceof Opcode::Phi
or or
instr = chiInstruction(_) and opcode instanceof Opcode::Chi instr = chiInstruction(_) and result instanceof Opcode::Chi
or or
instr = unreachedInstruction(_) and opcode instanceof Opcode::Unreached instr = unreachedInstruction(_) and result instanceof Opcode::Unreached
} }
cached cached