LLVM API Documentation

Modules | Functions
Instructions
Core
Collaboration diagram for Instructions:

Modules

 Call Sites and Invocations
 PHI Nodes

Functions

int LLVMHasMetadata (LLVMValueRef Val)
LLVMValueRef LLVMGetMetadata (LLVMValueRef Val, unsigned KindID)
void LLVMSetMetadata (LLVMValueRef Val, unsigned KindID, LLVMValueRef Node)
LLVMBasicBlockRef LLVMGetInstructionParent (LLVMValueRef Inst)
LLVMValueRef LLVMGetNextInstruction (LLVMValueRef Inst)
LLVMValueRef LLVMGetPreviousInstruction (LLVMValueRef Inst)
void LLVMInstructionEraseFromParent (LLVMValueRef Inst)
LLVMOpcode LLVMGetInstructionOpcode (LLVMValueRef Inst)
LLVMIntPredicate LLVMGetICmpPredicate (LLVMValueRef Inst)
LLVMBasicBlockRef LLVMGetSwitchDefaultDest (LLVMValueRef SwitchInstr)

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

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

References llvm::WinEH::CE, I, and llvm::unwrap().

Obtain the code opcode for an individual instruction.

See also:
llvm::Instruction::getOpCode()

Definition at line 1885 of file Core.cpp.

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

Obtain the basic block to which an instruction belongs.

See also:
llvm::Instruction::getParent()

Definition at line 1836 of file Core.cpp.

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

Return metadata associated with an instruction value.

Definition at line 558 of file Core.cpp.

References llvm::wrap().

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

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

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

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

Obtain the default destination basic block of a switch instruction.

This only works on llvm::SwitchInst instructions.

See also:
llvm::SwitchInst::getDefaultDest()

Definition at line 1954 of file Core.cpp.

References llvm::wrap().

Determine whether an instruction has any metadata attached.

Definition at line 554 of file Core.cpp.

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

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

Set metadata associated with an instruction value.

Definition at line 562 of file Core.cpp.