mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-27 14:34:58 +00:00
Added function to determine if an Instruction may trap.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7442 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
0ad1361837
commit
741bb0019d
@ -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:
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user