LLVM 22.0.0git

Functions in this group relate to the inspection and manipulation of individual instructions. More...

Collaboration diagram for Instructions:

Topics

 Call Sites and Invocations
 Functions in this group apply to instructions that refer to call sites and invocations.
 Terminators
 Functions in this group only apply to instructions for which LLVMIsATerminatorInst returns true.
 Allocas
 Functions in this group only apply to instructions that map to llvm::AllocaInst instances.
 GEPs
 Functions in this group only apply to instructions that map to llvm::GetElementPtrInst instances.
 PHI Nodes
 Functions in this group only apply to instructions that map to llvm::PHINode instances.
 ExtractValue
 InsertValue
 Functions in this group only apply to instructions that map to llvm::ExtractValue and llvm::InsertValue instances.

Functions

LLVM_C_ABI int LLVMHasMetadata (LLVMValueRef Val)
 Determine whether an instruction has any metadata attached.
LLVM_C_ABI LLVMValueRef LLVMGetMetadata (LLVMValueRef Val, unsigned KindID)
 Return metadata associated with an instruction value.
LLVM_C_ABI void LLVMSetMetadata (LLVMValueRef Val, unsigned KindID, LLVMValueRef Node)
 Set metadata associated with an instruction value.
LLVM_C_ABI LLVMValueMetadataEntryLLVMInstructionGetAllMetadataOtherThanDebugLoc (LLVMValueRef Instr, size_t *NumEntries)
 Returns the metadata associated with an instruction value, but filters out all the debug locations.
LLVM_C_ABI LLVMBasicBlockRef LLVMGetInstructionParent (LLVMValueRef Inst)
 Obtain the basic block to which an instruction belongs.
LLVM_C_ABI LLVMValueRef LLVMGetNextInstruction (LLVMValueRef Inst)
 Obtain the instruction that occurs after the one specified.
LLVM_C_ABI LLVMValueRef LLVMGetPreviousInstruction (LLVMValueRef Inst)
 Obtain the instruction that occurred before this one.
LLVM_C_ABI void LLVMInstructionRemoveFromParent (LLVMValueRef Inst)
 Remove an instruction.
LLVM_C_ABI void LLVMInstructionEraseFromParent (LLVMValueRef Inst)
 Remove and delete an instruction.
LLVM_C_ABI void LLVMDeleteInstruction (LLVMValueRef Inst)
 Delete an instruction.
LLVM_C_ABI LLVMOpcode LLVMGetInstructionOpcode (LLVMValueRef Inst)
 Obtain the code opcode for an individual instruction.
LLVM_C_ABI LLVMIntPredicate LLVMGetICmpPredicate (LLVMValueRef Inst)
 Obtain the predicate of an instruction.
LLVM_C_ABI LLVMBool LLVMGetICmpSameSign (LLVMValueRef Inst)
 Get whether or not an icmp instruction has the samesign flag.
LLVM_C_ABI void LLVMSetICmpSameSign (LLVMValueRef Inst, LLVMBool SameSign)
 Set the samesign flag on an icmp instruction.
LLVM_C_ABI LLVMRealPredicate LLVMGetFCmpPredicate (LLVMValueRef Inst)
 Obtain the float predicate of an instruction.
LLVM_C_ABI LLVMValueRef LLVMInstructionClone (LLVMValueRef Inst)
 Create a copy of 'this' instruction that is identical in all ways except the following:
LLVM_C_ABI LLVMValueRef LLVMIsATerminatorInst (LLVMValueRef Inst)
 Determine whether an instruction is a terminator.
LLVM_C_ABI LLVMDbgRecordRef LLVMGetFirstDbgRecord (LLVMValueRef Inst)
 Obtain the first debug record attached to an instruction.
LLVM_C_ABI LLVMDbgRecordRef LLVMGetLastDbgRecord (LLVMValueRef Inst)
 Obtain the last debug record attached to an instruction.
LLVM_C_ABI LLVMDbgRecordRef LLVMGetNextDbgRecord (LLVMDbgRecordRef DbgRecord)
 Obtain the next DbgRecord in the sequence or NULL if there are no more.
LLVM_C_ABI LLVMDbgRecordRef LLVMGetPreviousDbgRecord (LLVMDbgRecordRef DbgRecord)
 Obtain the previous DbgRecord in the sequence or NULL if there are no more.

Detailed Description

Functions in this group relate to the inspection and manipulation of individual instructions.

In the C++ API, an instruction is modeled by llvm::Instruction. This class has a large number of descendents. llvm::Instruction is a llvm::Value and in the C API, instructions are modeled by LLVMValueRef.

This group also contains sub-groups which operate on specific llvm::Instruction types, e.g. llvm::CallInst.

Function Documentation

◆ LLVMDeleteInstruction()

LLVM_C_ABI void LLVMDeleteInstruction ( LLVMValueRef Inst)

Delete an instruction.

The instruction specified is deleted. It must have previously been removed from its containing building block.

See also
llvm::Value::deleteValue()

Definition at line 2954 of file Core.cpp.

References llvm::unwrap().

◆ LLVMGetFCmpPredicate()

LLVM_C_ABI LLVMRealPredicate LLVMGetFCmpPredicate ( LLVMValueRef Inst)

Obtain the float predicate of an instruction.

This is only valid for instructions that correspond to llvm::FCmpInst.

See also
llvm::FCmpInst::getPredicate()

Definition at line 2972 of file Core.cpp.

References llvm::dyn_cast(), I, and llvm::unwrap().

◆ LLVMGetFirstDbgRecord()

LLVM_C_ABI LLVMDbgRecordRef LLVMGetFirstDbgRecord ( LLVMValueRef Inst)

Obtain the first debug record attached to an instruction.

Use LLVMGetNextDbgRecord() and LLVMGetPreviousDbgRecord() to traverse the sequence of DbgRecords.

Return the first DbgRecord attached to Inst or NULL if there are none.

See also
llvm::Instruction::getDbgRecordRange()

Definition at line 2995 of file Core.cpp.

References I, llvm::unwrap(), and llvm::wrap().

◆ LLVMGetICmpPredicate()

LLVM_C_ABI LLVMIntPredicate LLVMGetICmpPredicate ( LLVMValueRef Inst)

Obtain the predicate of an instruction.

This is only valid for instructions that correspond to llvm::ICmpInst.

See also
llvm::ICmpInst::getPredicate()

Definition at line 2958 of file Core.cpp.

References llvm::dyn_cast(), I, and llvm::unwrap().

◆ LLVMGetICmpSameSign()

LLVM_C_ABI LLVMBool LLVMGetICmpSameSign ( LLVMValueRef Inst)

Get whether or not an icmp instruction has the samesign flag.

This is only valid for instructions that correspond to llvm::ICmpInst.

See also
llvm::ICmpInst::hasSameSign()

Definition at line 2964 of file Core.cpp.

References llvm::unwrap().

◆ LLVMGetInstructionOpcode()

LLVM_C_ABI LLVMOpcode LLVMGetInstructionOpcode ( LLVMValueRef Inst)

Obtain the code opcode for an individual instruction.

See also
llvm::Instruction::getOpCode()

Definition at line 2978 of file Core.cpp.

References llvm::CallingConv::C, llvm::dyn_cast(), map_to_llvmopcode(), and llvm::unwrap().

◆ LLVMGetInstructionParent()

LLVM_C_ABI LLVMBasicBlockRef LLVMGetInstructionParent ( LLVMValueRef Inst)

Obtain the basic block to which an instruction belongs.

See also
llvm::Instruction::getParent()

Definition at line 2910 of file Core.cpp.

References getParent(), llvm::unwrap(), and llvm::wrap().

◆ LLVMGetLastDbgRecord()

LLVM_C_ABI LLVMDbgRecordRef LLVMGetLastDbgRecord ( LLVMValueRef Inst)

Obtain the last debug record attached to an instruction.

Return the last DbgRecord attached to Inst or NULL if there are none.

See also
llvm::Instruction::getDbgRecordRange()

Definition at line 3003 of file Core.cpp.

References I, llvm::unwrap(), and llvm::wrap().

◆ LLVMGetMetadata()

LLVM_C_ABI LLVMValueRef LLVMGetMetadata ( LLVMValueRef Val,
unsigned KindID )

Return metadata associated with an instruction value.

Definition at line 1080 of file Core.cpp.

References assert(), llvm::MetadataAsValue::get(), I, llvm::unwrap(), and llvm::wrap().

◆ LLVMGetNextDbgRecord()

LLVM_C_ABI LLVMDbgRecordRef LLVMGetNextDbgRecord ( LLVMDbgRecordRef DbgRecord)

Obtain the next DbgRecord in the sequence or NULL if there are no more.

See also
llvm::Instruction::getDbgRecordRange()

Definition at line 3011 of file Core.cpp.

References I, llvm::unwrap(), and llvm::wrap().

◆ LLVMGetNextInstruction()

LLVM_C_ABI LLVMValueRef LLVMGetNextInstruction ( LLVMValueRef Inst)

Obtain the instruction that occurs after the one specified.

The next instruction will be from the same basic block.

If this is the last instruction in a basic block, NULL will be returned.

Definition at line 2930 of file Core.cpp.

References I, llvm::unwrap(), and llvm::wrap().

◆ LLVMGetPreviousDbgRecord()

LLVM_C_ABI LLVMDbgRecordRef LLVMGetPreviousDbgRecord ( LLVMDbgRecordRef DbgRecord)

Obtain the previous DbgRecord in the sequence or NULL if there are no more.

See also
llvm::Instruction::getDbgRecordRange()

Definition at line 3019 of file Core.cpp.

References I, llvm::unwrap(), and llvm::wrap().

◆ LLVMGetPreviousInstruction()

LLVM_C_ABI LLVMValueRef LLVMGetPreviousInstruction ( LLVMValueRef Inst)

Obtain the instruction that occurred before this one.

If the instruction is the first instruction in a basic block, NULL will be returned.

Definition at line 2938 of file Core.cpp.

References I, llvm::unwrap(), and llvm::wrap().

◆ LLVMHasMetadata()

LLVM_C_ABI int LLVMHasMetadata ( LLVMValueRef Val)

Determine whether an instruction has any metadata attached.

Definition at line 1076 of file Core.cpp.

References llvm::unwrap().

◆ LLVMInstructionClone()

LLVM_C_ABI LLVMValueRef LLVMInstructionClone ( LLVMValueRef Inst)

Create a copy of 'this' instruction that is identical in all ways except the following:

  • The instruction has no parent
  • The instruction has no name
See also
llvm::Instruction::clone()

Definition at line 2984 of file Core.cpp.

References llvm::CallingConv::C, llvm::dyn_cast(), llvm::unwrap(), and llvm::wrap().

◆ LLVMInstructionEraseFromParent()

LLVM_C_ABI void LLVMInstructionEraseFromParent ( LLVMValueRef Inst)

Remove and delete an instruction.

The instruction specified is removed from its containing building block and then deleted.

See also
llvm::Instruction::eraseFromParent()

Definition at line 2950 of file Core.cpp.

References llvm::unwrap().

◆ LLVMInstructionGetAllMetadataOtherThanDebugLoc()

LLVM_C_ABI LLVMValueMetadataEntry * LLVMInstructionGetAllMetadataOtherThanDebugLoc ( LLVMValueRef Instr,
size_t * NumEntries )

Returns the metadata associated with an instruction value, but filters out all the debug locations.

See also
llvm::Instruction::getAllMetadataOtherThanDebugLoc()

Definition at line 1133 of file Core.cpp.

References llvm::SmallVectorImpl< T >::clear(), llvm_getMetadata(), and llvm::unwrap().

◆ LLVMInstructionRemoveFromParent()

LLVM_C_ABI void LLVMInstructionRemoveFromParent ( LLVMValueRef Inst)

Remove an instruction.

The instruction specified is removed from its containing building block but is kept alive.

See also
llvm::Instruction::removeFromParent()

Definition at line 2946 of file Core.cpp.

References llvm::unwrap().

◆ LLVMIsATerminatorInst()

LLVM_C_ABI LLVMValueRef LLVMIsATerminatorInst ( LLVMValueRef Inst)

Determine whether an instruction is a terminator.

This routine is named to be compatible with historical functions that did this by querying the underlying C++ type.

See also
llvm::Instruction::isTerminator()

Definition at line 2990 of file Core.cpp.

References llvm::dyn_cast(), I, llvm::unwrap(), and llvm::wrap().

◆ LLVMSetICmpSameSign()

LLVM_C_ABI void LLVMSetICmpSameSign ( LLVMValueRef Inst,
LLVMBool SameSign )

Set the samesign flag on an icmp instruction.

This is only valid for instructions that correspond to llvm::ICmpInst.

See also
llvm::ICmpInst::setSameSign()

Definition at line 2968 of file Core.cpp.

References llvm::unwrap().

◆ LLVMSetMetadata()

LLVM_C_ABI void LLVMSetMetadata ( LLVMValueRef Val,
unsigned KindID,
LLVMValueRef Node )

Set metadata associated with an instruction value.

Definition at line 1102 of file Core.cpp.

References extractMDNode(), N, and llvm::unwrap().