summaryrefslogtreecommitdiff
path: root/include/llvm/IR/Instruction.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/llvm/IR/Instruction.h')
-rw-r--r--include/llvm/IR/Instruction.h44
1 files changed, 40 insertions, 4 deletions
diff --git a/include/llvm/IR/Instruction.h b/include/llvm/IR/Instruction.h
index 8dc02111b8663..6af9cbfae5ded 100644
--- a/include/llvm/IR/Instruction.h
+++ b/include/llvm/IR/Instruction.h
@@ -34,6 +34,7 @@ namespace llvm {
class BasicBlock;
class FastMathFlags;
class MDNode;
+class Module;
struct AAMDNodes;
template <> struct ilist_alloc_traits<Instruction> {
@@ -113,6 +114,10 @@ public:
/// \pre I is a valid iterator into BB.
void moveBefore(BasicBlock &BB, SymbolTableList<Instruction>::iterator I);
+ /// Unlink this instruction from its current basic block and insert it into
+ /// the basic block that MovePos lives in, right after MovePos.
+ void moveAfter(Instruction *MovePos);
+
//===--------------------------------------------------------------------===//
// Subclass classification.
//===--------------------------------------------------------------------===//
@@ -304,10 +309,15 @@ public:
/// Determine whether the exact flag is set.
bool isExact() const;
- /// Set or clear the unsafe-algebra flag on this instruction, which must be an
+ /// Set or clear all fast-math-flags on this instruction, which must be an
/// operator which supports this flag. See LangRef.html for the meaning of
/// this flag.
- void setHasUnsafeAlgebra(bool B);
+ void setFast(bool B);
+
+ /// Set or clear the reassociation flag on this instruction, which must be
+ /// an operator which supports this flag. See LangRef.html for the meaning of
+ /// this flag.
+ void setHasAllowReassoc(bool B);
/// Set or clear the no-nans flag on this instruction, which must be an
/// operator which supports this flag. See LangRef.html for the meaning of
@@ -329,6 +339,11 @@ public:
/// this flag.
void setHasAllowReciprocal(bool B);
+ /// Set or clear the approximate-math-functions flag on this instruction,
+ /// which must be an operator which supports this flag. See LangRef.html for
+ /// the meaning of this flag.
+ void setHasApproxFunc(bool B);
+
/// Convenience function for setting multiple fast-math flags on this
/// instruction, which must be an operator which supports these flags. See
/// LangRef.html for the meaning of these flags.
@@ -339,8 +354,11 @@ public:
/// LangRef.html for the meaning of these flags.
void copyFastMathFlags(FastMathFlags FMF);
- /// Determine whether the unsafe-algebra flag is set.
- bool hasUnsafeAlgebra() const;
+ /// Determine whether all fast-math-flags are set.
+ bool isFast() const;
+
+ /// Determine whether the allow-reassociation flag is set.
+ bool hasAllowReassoc() const;
/// Determine whether the no-NaNs flag is set.
bool hasNoNaNs() const;
@@ -357,6 +375,9 @@ public:
/// Determine whether the allow-contract flag is set.
bool hasAllowContract() const;
+ /// Determine whether the approximate-math-functions flag is set.
+ bool hasApproxFunc() const;
+
/// Convenience function for getting all the fast-math flags, which must be an
/// operator which supports these flags. See LangRef.html for the meaning of
/// these flags.
@@ -373,6 +394,21 @@ public:
/// V and this instruction.
void andIRFlags(const Value *V);
+ /// Merge 2 debug locations and apply it to the Instruction. If the
+ /// instruction is a CallIns, we need to traverse the inline chain to find
+ /// the common scope. This is not efficient for N-way merging as each time
+ /// you merge 2 iterations, you need to rebuild the hashmap to find the
+ /// common scope. However, we still choose this API because:
+ /// 1) Simplicity: it takes 2 locations instead of a list of locations.
+ /// 2) In worst case, it increases the complexity from O(N*I) to
+ /// O(2*N*I), where N is # of Instructions to merge, and I is the
+ /// maximum level of inline stack. So it is still linear.
+ /// 3) Merging of call instructions should be extremely rare in real
+ /// applications, thus the N-way merging should be in code path.
+ /// The DebugLoc attached to this instruction will be overwritten by the
+ /// merged DebugLoc.
+ void applyMergedLocation(const DILocation *LocA, const DILocation *LocB);
+
private:
/// Return true if we have an entry in the on-the-side metadata hash.
bool hasMetadataHashEntry() const {