diff options
author | Duncan Sands <baldrick@free.fr> | 2007-12-03 20:06:50 +0000 |
---|---|---|
committer | Duncan Sands <baldrick@free.fr> | 2007-12-03 20:06:50 +0000 |
commit | a3355ffb3d30d19d226bbb75707991c60f236e37 (patch) | |
tree | 926575d8f1c3a0104fa7ea7236dd1842120e29cd /lib/VMCore/Instruction.cpp | |
parent | 4cf4b69330f0b2a3ba325bcdb1ff41847c022260 (diff) | |
download | external_llvm-a3355ffb3d30d19d226bbb75707991c60f236e37.zip external_llvm-a3355ffb3d30d19d226bbb75707991c60f236e37.tar.gz external_llvm-a3355ffb3d30d19d226bbb75707991c60f236e37.tar.bz2 |
Rather than having special rules like "intrinsics cannot
throw exceptions", just mark intrinsics with the nounwind
attribute. Likewise, mark intrinsics as readnone/readonly
and get rid of special aliasing logic (which didn't use
anything more than this anyway).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44544 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/Instruction.cpp')
-rw-r--r-- | lib/VMCore/Instruction.cpp | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/lib/VMCore/Instruction.cpp b/lib/VMCore/Instruction.cpp index a368753..9b20885 100644 --- a/lib/VMCore/Instruction.cpp +++ b/lib/VMCore/Instruction.cpp @@ -13,8 +13,8 @@ #include "llvm/Type.h" #include "llvm/Instructions.h" -#include "llvm/IntrinsicInst.h" #include "llvm/Function.h" +#include "llvm/Support/CallSite.h" #include "llvm/Support/LeakDetector.h" using namespace llvm; @@ -197,31 +197,18 @@ bool Instruction::isSameOperationAs(Instruction *I) const { return true; } -// IntrinsicOnlyReadsMemory - Return true if the specified intrinsic doesn't -// have any side-effects or if it only reads memory. -static bool IntrinsicOnlyReadsMemory(unsigned IntrinsicID) { -#define GET_SIDE_EFFECT_INFO -#include "llvm/Intrinsics.gen" -#undef GET_SIDE_EFFECT_INFO - return false; -} - /// mayWriteToMemory - Return true if this instruction may modify memory. /// bool Instruction::mayWriteToMemory() const { switch (getOpcode()) { default: return false; case Instruction::Free: - case Instruction::Store: case Instruction::Invoke: + case Instruction::Store: case Instruction::VAArg: return true; case Instruction::Call: - if (const IntrinsicInst *II = dyn_cast<IntrinsicInst>(this)) { - // If the intrinsic doesn't write memory, it is safe. - return !IntrinsicOnlyReadsMemory(II->getIntrinsicID()); - } - return true; + return !cast<CallInst>(this)->onlyReadsMemory(); case Instruction::Load: return cast<LoadInst>(this)->isVolatile(); } |