LLVM  10.0.0svn
Modules | Functions

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

Collaboration diagram for Instructions:

Modules

 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

int LLVMHasMetadata (LLVMValueRef Val)
 Determine whether an instruction has any metadata attached. More...
 
LLVMValueRef LLVMGetMetadata (LLVMValueRef Val, unsigned KindID)
 Return metadata associated with an instruction value. More...
 
void LLVMSetMetadata (LLVMValueRef Val, unsigned KindID, LLVMValueRef Node)
 Set metadata associated with an instruction value. More...
 
LLVMValueMetadataEntryLLVMInstructionGetAllMetadataOtherThanDebugLoc (LLVMValueRef Instr, size_t *NumEntries)
 Returns the metadata associated with an instruction value, but filters out all the debug locations. More...
 
LLVMBasicBlockRef LLVMGetInstructionParent (LLVMValueRef Inst)
 Obtain the basic block to which an instruction belongs. More...
 
LLVMValueRef LLVMGetNextInstruction (LLVMValueRef Inst)
 Obtain the instruction that occurs after the one specified. More...
 
LLVMValueRef LLVMGetPreviousInstruction (LLVMValueRef Inst)
 Obtain the instruction that occurred before this one. More...
 
void LLVMInstructionRemoveFromParent (LLVMValueRef Inst)
 Remove and delete an instruction. More...
 
void LLVMInstructionEraseFromParent (LLVMValueRef Inst)
 Remove and delete an instruction. More...
 
LLVMOpcode LLVMGetInstructionOpcode (LLVMValueRef Inst)
 Obtain the code opcode for an individual instruction. More...
 
LLVMIntPredicate LLVMGetICmpPredicate (LLVMValueRef Inst)
 Obtain the predicate of an instruction. More...
 
LLVMRealPredicate LLVMGetFCmpPredicate (LLVMValueRef Inst)
 Obtain the float predicate of an instruction. More...
 
LLVMValueRef LLVMInstructionClone (LLVMValueRef Inst)
 Create a copy of 'this' instruction that is identical in all ways except the following: More...
 
LLVMValueRef LLVMIsATerminatorInst (LLVMValueRef Inst)
 Determine whether an instruction is a terminator. 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

◆ LLVMGetFCmpPredicate()

LLVMRealPredicate LLVMGetFCmpPredicate ( LLVMValueRef  Inst)

Obtain the float predicate of an instruction.

This is only valid for instructions that correspond to llvm::FCmpInst or llvm::ConstantExpr whose opcode is llvm::Instruction::FCmp.

See also
llvm::FCmpInst::getPredicate()

Definition at line 2744 of file Core.cpp.

References I, and llvm::unwrap().

◆ LLVMGetICmpPredicate()

LLVMIntPredicate LLVMGetICmpPredicate ( LLVMValueRef  Inst)

Obtain the predicate of an instruction.

This is only valid for instructions that correspond to llvm::ICmpInst or llvm::ConstantExpr whose opcode is llvm::Instruction::ICmp.

See also
llvm::ICmpInst::getPredicate()

Definition at line 2735 of file Core.cpp.

References I, and llvm::unwrap().

◆ LLVMGetInstructionOpcode()

LLVMOpcode LLVMGetInstructionOpcode ( LLVMValueRef  Inst)

Obtain the code opcode for an individual instruction.

See also
llvm::Instruction::getOpCode()

Definition at line 2753 of file Core.cpp.

References C, llvm::Instruction::getOpcode(), map_to_llvmopcode(), and llvm::unwrap().

◆ LLVMGetInstructionParent()

LLVMBasicBlockRef LLVMGetInstructionParent ( LLVMValueRef  Inst)

Obtain the basic block to which an instruction belongs.

See also
llvm::Instruction::getParent()

Definition at line 2691 of file Core.cpp.

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

◆ LLVMGetMetadata()

LLVMValueRef LLVMGetMetadata ( LLVMValueRef  Val,
unsigned  KindID 
)

Return metadata associated with an instruction value.

Definition at line 863 of file Core.cpp.

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

◆ LLVMGetNextInstruction()

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 2711 of file Core.cpp.

References llvm::BasicBlock::end(), llvm::Instruction::getParent(), I, and llvm::wrap().

◆ LLVMGetPreviousInstruction()

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 2719 of file Core.cpp.

References llvm::BasicBlock::begin(), llvm::Instruction::getParent(), I, and llvm::wrap().

◆ LLVMHasMetadata()

int LLVMHasMetadata ( LLVMValueRef  Val)

Determine whether an instruction has any metadata attached.

Definition at line 859 of file Core.cpp.

◆ LLVMInstructionClone()

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 2759 of file Core.cpp.

References C, llvm::Instruction::clone(), llvm::unwrap(), and llvm::wrap().

◆ LLVMInstructionEraseFromParent()

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 2731 of file Core.cpp.

◆ LLVMInstructionGetAllMetadataOtherThanDebugLoc()

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 916 of file Core.cpp.

References llvm_getMetadata().

◆ LLVMInstructionRemoveFromParent()

void LLVMInstructionRemoveFromParent ( LLVMValueRef  Inst)

Remove and delete an instruction.

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

See also
llvm::Instruction::removeFromParent()

Definition at line 2727 of file Core.cpp.

◆ LLVMIsATerminatorInst()

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 2765 of file Core.cpp.

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

◆ LLVMSetMetadata()

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

Set metadata associated with an instruction value.

Definition at line 885 of file Core.cpp.

References extractMDNode(), N, and setMetadata().