mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-01 16:26:29 +00:00
add a new Instruction::mayReadFromMemory predicate, make
Instruction::mayWriteToMemory stronger for invokes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50858 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -219,7 +219,23 @@ bool Instruction::isUsedOutsideOfBlock(const BasicBlock *BB) const {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/// mayReadFromMemory - Return true if this instruction may read memory.
|
||||
///
|
||||
bool Instruction::mayReadFromMemory() const {
|
||||
switch (getOpcode()) {
|
||||
default: return false;
|
||||
case Instruction::Free:
|
||||
case Instruction::Store:
|
||||
case Instruction::VAArg:
|
||||
return true;
|
||||
case Instruction::Call:
|
||||
return !cast<CallInst>(this)->doesNotAccessMemory();
|
||||
case Instruction::Invoke:
|
||||
return !cast<InvokeInst>(this)->doesNotAccessMemory();
|
||||
case Instruction::Load:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/// mayWriteToMemory - Return true if this instruction may modify memory.
|
||||
///
|
||||
@@ -227,12 +243,13 @@ bool Instruction::mayWriteToMemory() const {
|
||||
switch (getOpcode()) {
|
||||
default: return false;
|
||||
case Instruction::Free:
|
||||
case Instruction::Invoke:
|
||||
case Instruction::Store:
|
||||
case Instruction::VAArg:
|
||||
return true;
|
||||
case Instruction::Call:
|
||||
return !cast<CallInst>(this)->onlyReadsMemory();
|
||||
case Instruction::Invoke:
|
||||
return !cast<InvokeInst>(this)->onlyReadsMemory();
|
||||
case Instruction::Load:
|
||||
return cast<LoadInst>(this)->isVolatile();
|
||||
}
|
||||
|
Reference in New Issue
Block a user