1 //===-- llvm/Instruction.h - Instruction class definition -------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file contains the declaration of the Instruction class, which is the
11 // base class for all of the LLVM instructions.
13 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_IR_INSTRUCTION_H
16 #define LLVM_IR_INSTRUCTION_H
18 #include "llvm/ADT/ArrayRef.h"
19 #include "llvm/ADT/None.h"
20 #include "llvm/ADT/StringRef.h"
21 #include "llvm/ADT/ilist_node.h"
22 #include "llvm/IR/DebugLoc.h"
23 #include "llvm/IR/SymbolTableListTraits.h"
24 #include "llvm/IR/User.h"
25 #include "llvm/IR/Value.h"
26 #include "llvm/Support/Casting.h"
40 template <> struct ilist_alloc_traits<Instruction> {
41 static inline void deleteNode(Instruction *V);
44 class Instruction : public User,
45 public ilist_node_with_parent<Instruction, BasicBlock> {
47 DebugLoc DbgLoc; // 'dbg' Metadata cache.
50 /// This is a bit stored in the SubClassData field which indicates whether
51 /// this instruction has metadata attached to it or not.
52 HasMetadataBit = 1 << 15
56 ~Instruction(); // Use deleteValue() to delete a generic Instruction.
59 Instruction(const Instruction &) = delete;
60 Instruction &operator=(const Instruction &) = delete;
62 /// Specialize the methods defined in Value, as we know that an instruction
63 /// can only be used by other instructions.
64 Instruction *user_back() { return cast<Instruction>(*user_begin());}
65 const Instruction *user_back() const { return cast<Instruction>(*user_begin());}
67 inline const BasicBlock *getParent() const { return Parent; }
68 inline BasicBlock *getParent() { return Parent; }
70 /// Return the module owning the function this instruction belongs to
71 /// or nullptr it the function does not have a module.
73 /// Note: this is undefined behavior if the instruction does not have a
74 /// parent, or the parent basic block does not have a parent function.
75 const Module *getModule() const;
77 return const_cast<Module *>(
78 static_cast<const Instruction *>(this)->getModule());
81 /// Return the function this instruction belongs to.
83 /// Note: it is undefined behavior to call this on an instruction not
84 /// currently inserted into a function.
85 const Function *getFunction() const;
86 Function *getFunction() {
87 return const_cast<Function *>(
88 static_cast<const Instruction *>(this)->getFunction());
91 /// This method unlinks 'this' from the containing basic block, but does not
93 void removeFromParent();
95 /// This method unlinks 'this' from the containing basic block and deletes it.
97 /// \returns an iterator pointing to the element after the erased one
98 SymbolTableList<Instruction>::iterator eraseFromParent();
100 /// Insert an unlinked instruction into a basic block immediately before
101 /// the specified instruction.
102 void insertBefore(Instruction *InsertPos);
104 /// Insert an unlinked instruction into a basic block immediately after the
105 /// specified instruction.
106 void insertAfter(Instruction *InsertPos);
108 /// Unlink this instruction from its current basic block and insert it into
109 /// the basic block that MovePos lives in, right before MovePos.
110 void moveBefore(Instruction *MovePos);
112 /// Unlink this instruction and insert into BB before I.
114 /// \pre I is a valid iterator into BB.
115 void moveBefore(BasicBlock &BB, SymbolTableList<Instruction>::iterator I);
117 /// Unlink this instruction from its current basic block and insert it into
118 /// the basic block that MovePos lives in, right after MovePos.
119 void moveAfter(Instruction *MovePos);
121 //===--------------------------------------------------------------------===//
122 // Subclass classification.
123 //===--------------------------------------------------------------------===//
125 /// Returns a member of one of the enums like Instruction::Add.
126 unsigned getOpcode() const { return getValueID() - InstructionVal; }
128 const char *getOpcodeName() const { return getOpcodeName(getOpcode()); }
129 bool isTerminator() const { return isTerminator(getOpcode()); }
130 bool isBinaryOp() const { return isBinaryOp(getOpcode()); }
131 bool isIntDivRem() const { return isIntDivRem(getOpcode()); }
132 bool isShift() { return isShift(getOpcode()); }
133 bool isCast() const { return isCast(getOpcode()); }
134 bool isFuncletPad() const { return isFuncletPad(getOpcode()); }
136 static const char* getOpcodeName(unsigned OpCode);
138 static inline bool isTerminator(unsigned OpCode) {
139 return OpCode >= TermOpsBegin && OpCode < TermOpsEnd;
142 static inline bool isBinaryOp(unsigned Opcode) {
143 return Opcode >= BinaryOpsBegin && Opcode < BinaryOpsEnd;
146 static inline bool isIntDivRem(unsigned Opcode) {
147 return Opcode == UDiv || Opcode == SDiv || Opcode == URem || Opcode == SRem;
150 /// Determine if the Opcode is one of the shift instructions.
151 static inline bool isShift(unsigned Opcode) {
152 return Opcode >= Shl && Opcode <= AShr;
155 /// Return true if this is a logical shift left or a logical shift right.
156 inline bool isLogicalShift() const {
157 return getOpcode() == Shl || getOpcode() == LShr;
160 /// Return true if this is an arithmetic shift right.
161 inline bool isArithmeticShift() const {
162 return getOpcode() == AShr;
165 /// Determine if the Opcode is and/or/xor.
166 static inline bool isBitwiseLogicOp(unsigned Opcode) {
167 return Opcode == And || Opcode == Or || Opcode == Xor;
170 /// Return true if this is and/or/xor.
171 inline bool isBitwiseLogicOp() const {
172 return isBitwiseLogicOp(getOpcode());
175 /// Determine if the OpCode is one of the CastInst instructions.
176 static inline bool isCast(unsigned OpCode) {
177 return OpCode >= CastOpsBegin && OpCode < CastOpsEnd;
180 /// Determine if the OpCode is one of the FuncletPadInst instructions.
181 static inline bool isFuncletPad(unsigned OpCode) {
182 return OpCode >= FuncletPadOpsBegin && OpCode < FuncletPadOpsEnd;
185 //===--------------------------------------------------------------------===//
186 // Metadata manipulation.
187 //===--------------------------------------------------------------------===//
189 /// Return true if this instruction has any metadata attached to it.
190 bool hasMetadata() const { return DbgLoc || hasMetadataHashEntry(); }
192 /// Return true if this instruction has metadata attached to it other than a
194 bool hasMetadataOtherThanDebugLoc() const {
195 return hasMetadataHashEntry();
198 /// Get the metadata of given kind attached to this Instruction.
199 /// If the metadata is not found then return null.
200 MDNode *getMetadata(unsigned KindID) const {
201 if (!hasMetadata()) return nullptr;
202 return getMetadataImpl(KindID);
205 /// Get the metadata of given kind attached to this Instruction.
206 /// If the metadata is not found then return null.
207 MDNode *getMetadata(StringRef Kind) const {
208 if (!hasMetadata()) return nullptr;
209 return getMetadataImpl(Kind);
212 /// Get all metadata attached to this Instruction. The first element of each
213 /// pair returned is the KindID, the second element is the metadata value.
214 /// This list is returned sorted by the KindID.
216 getAllMetadata(SmallVectorImpl<std::pair<unsigned, MDNode *>> &MDs) const {
218 getAllMetadataImpl(MDs);
221 /// This does the same thing as getAllMetadata, except that it filters out the
223 void getAllMetadataOtherThanDebugLoc(
224 SmallVectorImpl<std::pair<unsigned, MDNode *>> &MDs) const {
225 if (hasMetadataOtherThanDebugLoc())
226 getAllMetadataOtherThanDebugLocImpl(MDs);
229 /// Fills the AAMDNodes structure with AA metadata from this instruction.
230 /// When Merge is true, the existing AA metadata is merged with that from this
231 /// instruction providing the most-general result.
232 void getAAMetadata(AAMDNodes &N, bool Merge = false) const;
234 /// Set the metadata of the specified kind to the specified node. This updates
235 /// or replaces metadata if already present, or removes it if Node is null.
236 void setMetadata(unsigned KindID, MDNode *Node);
237 void setMetadata(StringRef Kind, MDNode *Node);
239 /// Copy metadata from \p SrcInst to this instruction. \p WL, if not empty,
240 /// specifies the list of meta data that needs to be copied. If \p WL is
241 /// empty, all meta data will be copied.
242 void copyMetadata(const Instruction &SrcInst,
243 ArrayRef<unsigned> WL = ArrayRef<unsigned>());
245 /// If the instruction has "branch_weights" MD_prof metadata and the MDNode
246 /// has three operands (including name string), swap the order of the
248 void swapProfMetadata();
250 /// Drop all unknown metadata except for debug locations.
252 /// Passes are required to drop metadata they don't understand. This is a
253 /// convenience method for passes to do so.
254 void dropUnknownNonDebugMetadata(ArrayRef<unsigned> KnownIDs);
255 void dropUnknownNonDebugMetadata() {
256 return dropUnknownNonDebugMetadata(None);
258 void dropUnknownNonDebugMetadata(unsigned ID1) {
259 return dropUnknownNonDebugMetadata(makeArrayRef(ID1));
261 void dropUnknownNonDebugMetadata(unsigned ID1, unsigned ID2) {
262 unsigned IDs[] = {ID1, ID2};
263 return dropUnknownNonDebugMetadata(IDs);
267 /// Sets the metadata on this instruction from the AAMDNodes structure.
268 void setAAMetadata(const AAMDNodes &N);
270 /// Retrieve the raw weight values of a conditional branch or select.
271 /// Returns true on success with profile weights filled in.
272 /// Returns false if no metadata or invalid metadata was found.
273 bool extractProfMetadata(uint64_t &TrueVal, uint64_t &FalseVal) const;
275 /// Retrieve total raw weight values of a branch.
276 /// Returns true on success with profile total weights filled in.
277 /// Returns false if no metadata was found.
278 bool extractProfTotalWeight(uint64_t &TotalVal) const;
280 /// Updates branch_weights metadata by scaling it by \p S / \p T.
281 void updateProfWeight(uint64_t S, uint64_t T);
283 /// Sets the branch_weights metadata to \p W for CallInst.
284 void setProfWeight(uint64_t W);
286 /// Set the debug location information for this instruction.
287 void setDebugLoc(DebugLoc Loc) { DbgLoc = std::move(Loc); }
289 /// Return the debug location for this node as a DebugLoc.
290 const DebugLoc &getDebugLoc() const { return DbgLoc; }
292 /// Set or clear the nuw flag on this instruction, which must be an operator
293 /// which supports this flag. See LangRef.html for the meaning of this flag.
294 void setHasNoUnsignedWrap(bool b = true);
296 /// Set or clear the nsw flag on this instruction, which must be an operator
297 /// which supports this flag. See LangRef.html for the meaning of this flag.
298 void setHasNoSignedWrap(bool b = true);
300 /// Set or clear the exact flag on this instruction, which must be an operator
301 /// which supports this flag. See LangRef.html for the meaning of this flag.
302 void setIsExact(bool b = true);
304 /// Determine whether the no unsigned wrap flag is set.
305 bool hasNoUnsignedWrap() const;
307 /// Determine whether the no signed wrap flag is set.
308 bool hasNoSignedWrap() const;
310 /// Drops flags that may cause this instruction to evaluate to poison despite
311 /// having non-poison inputs.
312 void dropPoisonGeneratingFlags();
314 /// Determine whether the exact flag is set.
315 bool isExact() const;
317 /// Set or clear all fast-math-flags on this instruction, which must be an
318 /// operator which supports this flag. See LangRef.html for the meaning of
320 void setFast(bool B);
322 /// Set or clear the reassociation flag on this instruction, which must be
323 /// an operator which supports this flag. See LangRef.html for the meaning of
325 void setHasAllowReassoc(bool B);
327 /// Set or clear the no-nans flag on this instruction, which must be an
328 /// operator which supports this flag. See LangRef.html for the meaning of
330 void setHasNoNaNs(bool B);
332 /// Set or clear the no-infs flag on this instruction, which must be an
333 /// operator which supports this flag. See LangRef.html for the meaning of
335 void setHasNoInfs(bool B);
337 /// Set or clear the no-signed-zeros flag on this instruction, which must be
338 /// an operator which supports this flag. See LangRef.html for the meaning of
340 void setHasNoSignedZeros(bool B);
342 /// Set or clear the allow-reciprocal flag on this instruction, which must be
343 /// an operator which supports this flag. See LangRef.html for the meaning of
345 void setHasAllowReciprocal(bool B);
347 /// Set or clear the approximate-math-functions flag on this instruction,
348 /// which must be an operator which supports this flag. See LangRef.html for
349 /// the meaning of this flag.
350 void setHasApproxFunc(bool B);
352 /// Convenience function for setting multiple fast-math flags on this
353 /// instruction, which must be an operator which supports these flags. See
354 /// LangRef.html for the meaning of these flags.
355 void setFastMathFlags(FastMathFlags FMF);
357 /// Convenience function for transferring all fast-math flag values to this
358 /// instruction, which must be an operator which supports these flags. See
359 /// LangRef.html for the meaning of these flags.
360 void copyFastMathFlags(FastMathFlags FMF);
362 /// Determine whether all fast-math-flags are set.
365 /// Determine whether the allow-reassociation flag is set.
366 bool hasAllowReassoc() const;
368 /// Determine whether the no-NaNs flag is set.
369 bool hasNoNaNs() const;
371 /// Determine whether the no-infs flag is set.
372 bool hasNoInfs() const;
374 /// Determine whether the no-signed-zeros flag is set.
375 bool hasNoSignedZeros() const;
377 /// Determine whether the allow-reciprocal flag is set.
378 bool hasAllowReciprocal() const;
380 /// Determine whether the allow-contract flag is set.
381 bool hasAllowContract() const;
383 /// Determine whether the approximate-math-functions flag is set.
384 bool hasApproxFunc() const;
386 /// Convenience function for getting all the fast-math flags, which must be an
387 /// operator which supports these flags. See LangRef.html for the meaning of
389 FastMathFlags getFastMathFlags() const;
391 /// Copy I's fast-math flags
392 void copyFastMathFlags(const Instruction *I);
394 /// Convenience method to copy supported exact, fast-math, and (optionally)
395 /// wrapping flags from V to this instruction.
396 void copyIRFlags(const Value *V, bool IncludeWrapFlags = true);
398 /// Logical 'and' of any supported wrapping, exact, and fast-math flags of
399 /// V and this instruction.
400 void andIRFlags(const Value *V);
402 /// Merge 2 debug locations and apply it to the Instruction. If the
403 /// instruction is a CallIns, we need to traverse the inline chain to find
404 /// the common scope. This is not efficient for N-way merging as each time
405 /// you merge 2 iterations, you need to rebuild the hashmap to find the
406 /// common scope. However, we still choose this API because:
407 /// 1) Simplicity: it takes 2 locations instead of a list of locations.
408 /// 2) In worst case, it increases the complexity from O(N*I) to
409 /// O(2*N*I), where N is # of Instructions to merge, and I is the
410 /// maximum level of inline stack. So it is still linear.
411 /// 3) Merging of call instructions should be extremely rare in real
412 /// applications, thus the N-way merging should be in code path.
413 /// The DebugLoc attached to this instruction will be overwritten by the
415 void applyMergedLocation(const DILocation *LocA, const DILocation *LocB);
418 /// Return true if we have an entry in the on-the-side metadata hash.
419 bool hasMetadataHashEntry() const {
420 return (getSubclassDataFromValue() & HasMetadataBit) != 0;
423 // These are all implemented in Metadata.cpp.
424 MDNode *getMetadataImpl(unsigned KindID) const;
425 MDNode *getMetadataImpl(StringRef Kind) const;
427 getAllMetadataImpl(SmallVectorImpl<std::pair<unsigned, MDNode *>> &) const;
428 void getAllMetadataOtherThanDebugLocImpl(
429 SmallVectorImpl<std::pair<unsigned, MDNode *>> &) const;
430 /// Clear all hashtable-based metadata from this instruction.
431 void clearMetadataHashEntries();
434 //===--------------------------------------------------------------------===//
435 // Predicates and helper methods.
436 //===--------------------------------------------------------------------===//
438 /// Return true if the instruction is associative:
440 /// Associative operators satisfy: x op (y op z) === (x op y) op z
442 /// In LLVM, the Add, Mul, And, Or, and Xor operators are associative.
444 bool isAssociative() const LLVM_READONLY;
445 static bool isAssociative(unsigned Opcode) {
446 return Opcode == And || Opcode == Or || Opcode == Xor ||
447 Opcode == Add || Opcode == Mul;
450 /// Return true if the instruction is commutative:
452 /// Commutative operators satisfy: (x op y) === (y op x)
454 /// In LLVM, these are the commutative operators, plus SetEQ and SetNE, when
455 /// applied to any type.
457 bool isCommutative() const { return isCommutative(getOpcode()); }
458 static bool isCommutative(unsigned Opcode) {
462 case And: case Or: case Xor:
469 /// Return true if the instruction is idempotent:
471 /// Idempotent operators satisfy: x op x === x
473 /// In LLVM, the And and Or operators are idempotent.
475 bool isIdempotent() const { return isIdempotent(getOpcode()); }
476 static bool isIdempotent(unsigned Opcode) {
477 return Opcode == And || Opcode == Or;
480 /// Return true if the instruction is nilpotent:
482 /// Nilpotent operators satisfy: x op x === Id,
484 /// where Id is the identity for the operator, i.e. a constant such that
485 /// x op Id === x and Id op x === x for all x.
487 /// In LLVM, the Xor operator is nilpotent.
489 bool isNilpotent() const { return isNilpotent(getOpcode()); }
490 static bool isNilpotent(unsigned Opcode) {
491 return Opcode == Xor;
494 /// Return true if this instruction may modify memory.
495 bool mayWriteToMemory() const;
497 /// Return true if this instruction may read memory.
498 bool mayReadFromMemory() const;
500 /// Return true if this instruction may read or write memory.
501 bool mayReadOrWriteMemory() const {
502 return mayReadFromMemory() || mayWriteToMemory();
505 /// Return true if this instruction has an AtomicOrdering of unordered or
507 bool isAtomic() const;
509 /// Return true if this atomic instruction loads from memory.
510 bool hasAtomicLoad() const;
512 /// Return true if this atomic instruction stores to memory.
513 bool hasAtomicStore() const;
515 /// Return true if this instruction may throw an exception.
516 bool mayThrow() const;
518 /// Return true if this instruction behaves like a memory fence: it can load
519 /// or store to memory location without being given a memory location.
520 bool isFenceLike() const {
521 switch (getOpcode()) {
524 // This list should be kept in sync with the list in mayWriteToMemory for
525 // all opcodes which don't have a memory location.
526 case Instruction::Fence:
527 case Instruction::CatchPad:
528 case Instruction::CatchRet:
529 case Instruction::Call:
530 case Instruction::Invoke:
535 /// Return true if the instruction may have side effects.
537 /// Note that this does not consider malloc and alloca to have side
538 /// effects because the newly allocated memory is completely invisible to
539 /// instructions which don't use the returned value. For cases where this
540 /// matters, isSafeToSpeculativelyExecute may be more appropriate.
541 bool mayHaveSideEffects() const { return mayWriteToMemory() || mayThrow(); }
543 /// Return true if the instruction can be removed if the result is unused.
545 /// When constant folding some instructions cannot be removed even if their
546 /// results are unused. Specifically terminator instructions and calls that
547 /// may have side effects cannot be removed without semantically changing the
548 /// generated program.
549 bool isSafeToRemove() const;
551 /// Return true if the instruction is a variety of EH-block.
552 bool isEHPad() const {
553 switch (getOpcode()) {
554 case Instruction::CatchSwitch:
555 case Instruction::CatchPad:
556 case Instruction::CleanupPad:
557 case Instruction::LandingPad:
564 /// Return a pointer to the next non-debug instruction in the same basic
565 /// block as 'this', or nullptr if no such instruction exists.
566 const Instruction *getNextNonDebugInstruction() const;
567 Instruction *getNextNonDebugInstruction() {
568 return const_cast<Instruction *>(
569 static_cast<const Instruction *>(this)->getNextNonDebugInstruction());
572 /// Create a copy of 'this' instruction that is identical in all ways except
574 /// * The instruction has no parent
575 /// * The instruction has no name
577 Instruction *clone() const;
579 /// Return true if the specified instruction is exactly identical to the
580 /// current one. This means that all operands match and any extra information
581 /// (e.g. load is volatile) agree.
582 bool isIdenticalTo(const Instruction *I) const;
584 /// This is like isIdenticalTo, except that it ignores the
585 /// SubclassOptionalData flags, which may specify conditions under which the
586 /// instruction's result is undefined.
587 bool isIdenticalToWhenDefined(const Instruction *I) const;
589 /// When checking for operation equivalence (using isSameOperationAs) it is
590 /// sometimes useful to ignore certain attributes.
591 enum OperationEquivalenceFlags {
592 /// Check for equivalence ignoring load/store alignment.
593 CompareIgnoringAlignment = 1<<0,
594 /// Check for equivalence treating a type and a vector of that type
596 CompareUsingScalarTypes = 1<<1
599 /// This function determines if the specified instruction executes the same
600 /// operation as the current one. This means that the opcodes, type, operand
601 /// types and any other factors affecting the operation must be the same. This
602 /// is similar to isIdenticalTo except the operands themselves don't have to
604 /// @returns true if the specified instruction is the same operation as
606 /// Determine if one instruction is the same operation as another.
607 bool isSameOperationAs(const Instruction *I, unsigned flags = 0) const;
609 /// Return true if there are any uses of this instruction in blocks other than
610 /// the specified block. Note that PHI nodes are considered to evaluate their
611 /// operands in the corresponding predecessor block.
612 bool isUsedOutsideOfBlock(const BasicBlock *BB) const;
615 /// Methods for support type inquiry through isa, cast, and dyn_cast:
616 static bool classof(const Value *V) {
617 return V->getValueID() >= Value::InstructionVal;
620 //----------------------------------------------------------------------
621 // Exported enumerations.
623 enum TermOps { // These terminate basic blocks
624 #define FIRST_TERM_INST(N) TermOpsBegin = N,
625 #define HANDLE_TERM_INST(N, OPC, CLASS) OPC = N,
626 #define LAST_TERM_INST(N) TermOpsEnd = N+1
627 #include "llvm/IR/Instruction.def"
631 #define FIRST_BINARY_INST(N) BinaryOpsBegin = N,
632 #define HANDLE_BINARY_INST(N, OPC, CLASS) OPC = N,
633 #define LAST_BINARY_INST(N) BinaryOpsEnd = N+1
634 #include "llvm/IR/Instruction.def"
638 #define FIRST_MEMORY_INST(N) MemoryOpsBegin = N,
639 #define HANDLE_MEMORY_INST(N, OPC, CLASS) OPC = N,
640 #define LAST_MEMORY_INST(N) MemoryOpsEnd = N+1
641 #include "llvm/IR/Instruction.def"
645 #define FIRST_CAST_INST(N) CastOpsBegin = N,
646 #define HANDLE_CAST_INST(N, OPC, CLASS) OPC = N,
647 #define LAST_CAST_INST(N) CastOpsEnd = N+1
648 #include "llvm/IR/Instruction.def"
652 #define FIRST_FUNCLETPAD_INST(N) FuncletPadOpsBegin = N,
653 #define HANDLE_FUNCLETPAD_INST(N, OPC, CLASS) OPC = N,
654 #define LAST_FUNCLETPAD_INST(N) FuncletPadOpsEnd = N+1
655 #include "llvm/IR/Instruction.def"
659 #define FIRST_OTHER_INST(N) OtherOpsBegin = N,
660 #define HANDLE_OTHER_INST(N, OPC, CLASS) OPC = N,
661 #define LAST_OTHER_INST(N) OtherOpsEnd = N+1
662 #include "llvm/IR/Instruction.def"
666 friend class SymbolTableListTraits<Instruction>;
668 // Shadow Value::setValueSubclassData with a private forwarding method so that
669 // subclasses cannot accidentally use it.
670 void setValueSubclassData(unsigned short D) {
671 Value::setValueSubclassData(D);
674 unsigned short getSubclassDataFromValue() const {
675 return Value::getSubclassDataFromValue();
678 void setHasMetadataHashEntry(bool V) {
679 setValueSubclassData((getSubclassDataFromValue() & ~HasMetadataBit) |
680 (V ? HasMetadataBit : 0));
683 void setParent(BasicBlock *P);
686 // Instruction subclasses can stick up to 15 bits of stuff into the
687 // SubclassData field of instruction with these members.
689 // Verify that only the low 15 bits are used.
690 void setInstructionSubclassData(unsigned short D) {
691 assert((D & HasMetadataBit) == 0 && "Out of range value put into field");
692 setValueSubclassData((getSubclassDataFromValue() & HasMetadataBit) | D);
695 unsigned getSubclassDataFromInstruction() const {
696 return getSubclassDataFromValue() & ~HasMetadataBit;
699 Instruction(Type *Ty, unsigned iType, Use *Ops, unsigned NumOps,
700 Instruction *InsertBefore = nullptr);
701 Instruction(Type *Ty, unsigned iType, Use *Ops, unsigned NumOps,
702 BasicBlock *InsertAtEnd);
705 /// Create a copy of this instruction.
706 Instruction *cloneImpl() const;
709 inline void ilist_alloc_traits<Instruction>::deleteNode(Instruction *V) {
713 } // end namespace llvm
715 #endif // LLVM_IR_INSTRUCTION_H