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"
24 Instruction::Instruction(Type *ty, unsigned it, Use *Ops, unsigned NumOps,
25 Instruction *InsertBefore)
30 // If requested, insert this instruction into a basic block...
33 "Instruction to insert before is not in a basic block!");
38 Instruction::Instruction(Type *ty, unsigned it, Use *Ops, unsigned NumOps,
44 // append this instruction into the basic block
51 Instruction::~Instruction() {
52 assert(Parent == 0 && "Instruction still linked in the program!");
58 void Instruction::setParent(BasicBlock *P) {
68 void Instruction::removeFromParent() {
72 void Instruction::eraseFromParent() {
77 /// immediately before the specified instruction.
78 void Instruction::insertBefore(Instruction *InsertPos) {
83 /// immediately after the specified instruction.
84 void Instruction::insertAfter(Instruction *InsertPos) {
88 /// moveBefore - Unlink this instruction from its current basic block and
91 void Instruction::moveBefore(Instruction *MovePos) {
96 /// Set or clear the unsafe-algebra flag on this instruction, which must be an
99 void Instruction::setHasUnsafeAlgebra(bool B) {
104 /// Set or clear the NoNaNs flag on this instruction, which must be an operator
106 void Instruction::setHasNoNaNs(bool B) {
111 /// Set or clear the no-infs flag on this instruction, which must be an operator
113 void Instruction::setHasNoInfs(bool B) {
118 /// Set or clear the no-signed-zeros flag on this instruction, which must be an
121 void Instruction::setHasNoSignedZeros(bool B) {
126 /// Set or clear the allow-reciprocal flag on this instruction, which must be an
129 void Instruction::setHasAllowReciprocal(bool B) {
135 /// instruction, which must be an operator which supports these flags. See
137 void Instruction::setFastMathFlags(FastMathFlags FMF) {
143 bool Instruction::hasUnsafeAlgebra() const {
149 bool Instruction::hasNoNaNs() const {
155 bool Instruction::hasNoInfs() const {
161 bool Instruction::hasNoSignedZeros() const {
167 bool Instruction::hasAllowReciprocal() const {
175 FastMathFlags Instruction::getFastMathFlags() const {
181 void Instruction::copyFastMathFlags(const Instruction *I) {
186 const char *Instruction::getOpcodeName(unsigned OpCode) {
260 /// isIdenticalTo - Return true if the specified instruction is exactly
263 bool Instruction::isIdenticalTo(const Instruction *I) const {
270 /// under which the instruction's result is undefined.
271 bool Instruction::isIdenticalToWhenDefined(const Instruction *I) const {
333 bool Instruction::isSameOperationAs(const Instruction *I,
400 bool Instruction::isUsedOutsideOfBlock(const BasicBlock *BB) const {
407 if (cast<Instruction>(U)->getParent() != BB)
418 /// mayReadFromMemory - Return true if this instruction may read memory.
420 bool Instruction::mayReadFromMemory() const {
423 case Instruction::VAArg:
424 case Instruction::Load:
425 case Instruction::Fence: // FIXME: refine definition of mayReadFromMemory
426 case Instruction::AtomicCmpXchg:
427 case Instruction::AtomicRMW:
429 case Instruction::Call:
431 case Instruction::Invoke:
433 case Instruction::Store:
438 /// mayWriteToMemory - Return true if this instruction may modify memory.
440 bool Instruction::mayWriteToMemory() const {
443 case Instruction::Fence: // FIXME: refine definition of mayWriteToMemory
444 case Instruction::Store:
445 case Instruction::VAArg:
446 case Instruction::AtomicCmpXchg:
447 case Instruction::AtomicRMW:
449 case Instruction::Call:
451 case Instruction::Invoke:
453 case Instruction::Load:
458 bool Instruction::mayThrow() const {
464 bool Instruction::mayReturn() const {
470 /// isAssociative - Return true if the instruction is associative:
476 bool Instruction::isAssociative(unsigned Opcode) {
481 bool Instruction::isAssociative() const {
495 /// isCommutative - Return true if the instruction is commutative:
502 bool Instruction::isCommutative(unsigned op) {
517 /// isIdempotent - Return true if the instruction is idempotent:
523 bool Instruction::isIdempotent(unsigned Opcode) {
527 /// isNilpotent - Return true if the instruction is nilpotent:
536 bool Instruction::isNilpotent(unsigned Opcode) {
540 Instruction *Instruction::clone() const {
541 Instruction *New = clone_impl();
546 // Otherwise, enumerate and copy over metadata from the old instruction to the