Lines Matching full:instruction
1 //===-- Instruction.cpp - Implement the Instruction class -----------------===//
10 // This file implements the Instruction class for the IR library.
14 #include "llvm/IR/Instruction.h"
23 Instruction::Instruction(Type *ty, unsigned it, Use *Ops, unsigned NumOps,
24 Instruction *InsertBefore)
27 // If requested, insert this instruction into a basic block...
30 "Instruction to insert before is not in a basic block!");
35 Instruction::Instruction(Type *ty, unsigned it, Use *Ops, unsigned NumOps,
39 // append this instruction into the basic block
46 Instruction::~Instruction() {
47 assert(!Parent && "Instruction still linked in the program!");
53 void Instruction::setParent(BasicBlock *P) {
57 const Module *Instruction::getModule() const {
61 void Instruction::removeFromParent() {
65 iplist<Instruction>::iterator Instruction::eraseFromParent() {
70 /// immediately before the specified instruction.
71 void Instruction::insertBefore(Instruction *InsertPos) {
76 /// immediately after the specified instruction.
77 void Instruction::insertAfter(Instruction *InsertPos) {
81 /// moveBefore - Unlink this instruction from its current basic block and
84 void Instruction::moveBefore(Instruction *MovePos) {
89 /// Set or clear the unsafe-algebra flag on this instruction, which must be an
92 void Instruction::setHasUnsafeAlgebra(bool B) {
97 /// Set or clear the NoNaNs flag on this instruction, which must be an operator
99 void Instruction::setHasNoNaNs(bool B) {
104 /// Set or clear the no-infs flag on this instruction, which must be an operator
106 void Instruction::setHasNoInfs(bool B) {
111 /// Set or clear the no-signed-zeros flag on this instruction, which must be an
114 void Instruction::setHasNoSignedZeros(bool B) {
119 /// Set or clear the allow-reciprocal flag on this instruction, which must be an
122 void Instruction::setHasAllowReciprocal(bool B) {
128 /// instruction, which must be an operator which supports these flags. See
130 void Instruction::setFastMathFlags(FastMathFlags FMF) {
135 void Instruction::copyFastMathFlags(FastMathFlags FMF) {
141 bool Instruction::hasUnsafeAlgebra() const {
147 bool Instruction::hasNoNaNs() const {
153 bool Instruction::hasNoInfs() const {
159 bool Instruction::hasNoSignedZeros() const {
165 bool Instruction::hasAllowReciprocal() const {
173 FastMathFlags Instruction::getFastMathFlags() const {
179 void Instruction::copyFastMathFlags(const Instruction *I) {
184 const char *Instruction::getOpcodeName(unsigned OpCode) {
261 static bool haveSameSpecialState(const Instruction *I1, const Instruction *I2,
312 /// isIdenticalTo - Return true if the specified instruction is exactly
315 bool Instruction::isIdenticalTo(const Instruction *I) const {
322 /// under which the instruction's result is undefined.
323 bool Instruction::isIdenticalToWhenDefined(const Instruction *I) const {
350 bool Instruction::isSameOperationAs(const Instruction *I,
377 bool Instruction::isUsedOutsideOfBlock(const BasicBlock *BB) const {
381 const Instruction *I = cast<Instruction>(U.getUser());
395 /// mayReadFromMemory - Return true if this instruction may read memory.
397 bool Instruction::mayReadFromMemory() const {
400 case Instruction::VAArg:
401 case Instruction::Load:
402 case Instruction::Fence: // FIXME: refine definition of mayReadFromMemory
403 case Instruction::AtomicCmpXchg:
404 case Instruction::AtomicRMW:
406 case Instruction::Call:
408 case Instruction::Invoke:
410 case Instruction::Store:
415 /// mayWriteToMemory - Return true if this instruction may modify memory.
417 bool Instruction::mayWriteToMemory() const {
420 case Instruction::Fence: // FIXME: refine definition of mayWriteToMemory
421 case Instruction::Store:
422 case Instruction::VAArg:
423 case Instruction::AtomicCmpXchg:
424 case Instruction::AtomicRMW:
426 case Instruction::Call:
428 case Instruction::Invoke:
430 case Instruction::Load:
435 bool Instruction::isAtomic() const {
439 case Instruction::AtomicCmpXchg:
440 case Instruction::AtomicRMW:
441 case Instruction::Fence:
443 case Instruction::Load:
445 case Instruction::Store:
450 bool Instruction::mayThrow() const {
456 bool Instruction::mayReturn() const {
462 /// isAssociative - Return true if the instruction is associative:
468 bool Instruction::isAssociative(unsigned Opcode) {
473 bool Instruction::isAssociative() const {
487 /// isCommutative - Return true if the instruction is commutative:
494 bool Instruction::isCommutative(unsigned op) {
509 /// isIdempotent - Return true if the instruction is idempotent:
515 bool Instruction::isIdempotent(unsigned Opcode) {
519 /// isNilpotent - Return true if the instruction is nilpotent:
528 bool Instruction::isNilpotent(unsigned Opcode) {
532 Instruction *Instruction::clone() const {
533 Instruction *New = clone_impl();
538 // Otherwise, enumerate and copy over metadata from the old instruction to the