1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 19:23:23 +01:00

Added function to determine if an Instruction may trap.

llvm-svn: 7442
This commit is contained in:
Tanya Lattner 2003-07-31 04:05:50 +00:00
parent d1b7716c86
commit 8c2ac118ce
2 changed files with 24 additions and 1 deletions

View File

@ -97,7 +97,13 @@ public:
bool isCommutative() const { return isCommutative(getOpcode()); }
static bool isCommutative(unsigned op);
/// isTrappingInstruction - Return true if the instruction may trap.
///
bool isTrappingInstruction() const {
return isTrappingInstruction(getOpcode());
}
static bool isTrappingInstruction(unsigned op);
virtual void print(std::ostream &OS) const;
/// Methods for support type inquiry through isa, cast, and dyn_cast:

View File

@ -137,3 +137,20 @@ bool Instruction::isCommutative(unsigned op) {
return false;
}
}
/// isTrappingInstruction - Return true if the instruction may trap.
///
bool Instruction::isTrappingInstruction(unsigned op) {
switch(op) {
case Div:
case Rem:
case Load:
case Store:
case Call:
case Invoke:
return true;
default:
return false;
}
}