mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-07 11:33:44 +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:
parent
d7266d484a
commit
d96288a2ff
@ -50,6 +50,10 @@ public:
|
||||
///
|
||||
bool mayWriteToMemory() const;
|
||||
|
||||
/// mayReadFromMemory - Return true if this instruction may read memory.
|
||||
///
|
||||
bool mayReadFromMemory() const;
|
||||
|
||||
/// clone() - Create a copy of 'this' instruction that is identical in all
|
||||
/// ways except the following:
|
||||
/// * The instruction has no parent
|
||||
|
@ -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();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user