92#ifndef LLVM_SANDBOXIR_SANDBOXIR_H
93#define LLVM_SANDBOXIR_SANDBOXIR_H
147#define DEF_INSTR(ID, OPC, CLASS) friend class CLASS;
148#include "llvm/SandboxIR/SandboxIRValues.def"
169 return !(*
this ==
Other);
198 return !(*
this ==
Other);
207#define DEF_VALUE(ID, CLASS) ID,
208#define DEF_USER(ID, CLASS) ID,
209#define DEF_INSTR(ID, OPC, CLASS) ID,
210#include "llvm/SandboxIR/SandboxIRValues.def"
216#define DEF_VALUE(ID, CLASS) \
219#define DEF_USER(ID, CLASS) \
222#define DEF_INSTR(ID, OPC, CLASS) \
225#include "llvm/SandboxIR/SandboxIRValues.def"
365 std::string
getUid()
const;
388 return From->getSubclassID() == ClassID::Argument;
392 assert(isa<llvm::Argument>(
Val) &&
"Expected Argument!");
418 return Use.LLVMUse->getOperandNo();
445 assert(isa<llvm::User>(
Val) &&
"Expect User value!");
449 assert(isa<llvm::User>(
Val) &&
"Expect User value!");
471 return isa<llvm::User>(
Val) ? cast<llvm::User>(
Val)->getNumOperands() : 0;
481 assert(isa<llvm::User>(
Val) &&
"Expected User!");
498 Use getOperandUseInternal(
unsigned OpIdx,
bool Verify)
const override {
505 return From->getSubclassID() == ClassID::Constant ||
506 From->getSubclassID() == ClassID::ConstantInt ||
507 From->getSubclassID() == ClassID::Function;
515 assert(isa<llvm::Constant>(
Val) &&
"Expected Constant!");
526 Use getOperandUseInternal(
unsigned OpIdx,
bool Verify)
const final {
534 bool IsSigned =
false);
540 return From->getSubclassID() == ClassID::ConstantInt;
547 assert(isa<llvm::ConstantInt>(
Val) &&
"Expected a ConstantInst!");
575 : BB(BB), It(It), Ctx(Ctx) {}
590 assert(Ctx ==
Other.Ctx &&
"BBIterators in different context!");
591 return It ==
Other.It;
609 buildBasicBlockFromLLVMIR(BB);
616 return From->getSubclassID() == Value::ClassID::Block;
622 auto *BB = cast<llvm::BasicBlock>(
Val);
625 std::reverse_iterator<iterator>
rbegin()
const {
626 return std::make_reverse_iterator(
end());
628 std::reverse_iterator<iterator>
rend()
const {
629 return std::make_reverse_iterator(
begin());
639 assert(isa<llvm::BasicBlock>(
Val) &&
"Expected BasicBlock!");
651#define OPCODES(...) __VA_ARGS__
652#define DEF_INSTR(ID, OPC, CLASS) OPC
653#include "llvm/SandboxIR/SandboxIRValues.def"
735 return cast<llvm::Instruction>(
Val)->hasNoUnsignedWrap();
742 return cast<llvm::Instruction>(
Val)->hasNoSignedWrap();
748 bool isFast()
const {
return cast<llvm::Instruction>(
Val)->isFast(); }
755 return cast<llvm::Instruction>(
Val)->hasAllowReassoc();
762 bool isExact()
const {
return cast<llvm::Instruction>(
Val)->isExact(); }
767 bool hasNoNaNs()
const {
return cast<llvm::Instruction>(
Val)->hasNoNaNs(); }
773 bool hasNoInfs()
const {
return cast<llvm::Instruction>(
Val)->hasNoInfs(); }
780 return cast<llvm::Instruction>(
Val)->hasNoSignedZeros();
788 return cast<llvm::Instruction>(
Val)->hasAllowReciprocal();
796 return cast<llvm::Instruction>(
Val)->hasAllowContract();
804 return cast<llvm::Instruction>(
Val)->hasApproxFunc();
814 return cast<llvm::Instruction>(
Val)->getFastMathFlags();
837#define DEF_INSTR(ID, OPC, CLASS) friend class CLASS;
838#include "llvm/SandboxIR/SandboxIRValues.def"
842 Use getOperandUseInternal(
unsigned OpIdx,
bool Verify)
const final {
846 return {cast<llvm::Instruction>(
Val)};
908 return From->getSubclassID() == ClassID::InsertElement;
922 Opcode::ExtractElement,
I,
Ctx) {}
932 return From->getSubclassID() == ClassID::ExtractElement;
967 return cast<llvm::BranchInst>(
Val)->isUnconditional();
970 return cast<llvm::BranchInst>(
Val)->isConditional();
980 struct LLVMBBToSBBB {
982 LLVMBBToSBBB(
Context &Ctx) : Ctx(Ctx) {}
986 struct ConstLLVMBBToSBBB {
988 ConstLLVMBBToSBBB(Context &Ctx) : Ctx(Ctx) {}
997 cast<llvm::BranchInst>(
Val)->successors();
998 LLVMBBToSBBB BBMap(
Ctx);
1011 ConstLLVMBBToSBBB ConstBBMap(
Ctx);
1016 return make_range(ConstMappedBegin, ConstMappedEnd);
1030 return isa<LoadInst>(
I) || isa<CastInst>(
I);
1033 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
1067 bool isSimple()
const {
return cast<llvm::LoadInst>(
Val)->isSimple(); }
1097 bool isSimple()
const {
return cast<llvm::StoreInst>(
Val)->isSimple(); }
1106 Use getOperandUseInternal(
unsigned OpIdx,
bool Verify)
const final {
1110 return {cast<llvm::Instruction>(
Val)};
1140 return From->getSubclassID() == ClassID::Ret;
1155 auto Opc =
From->getSubclassID();
1156 return Opc == Instruction::ClassID::Call ||
1157 Opc == Instruction::ClassID::Invoke ||
1158 Opc == Instruction::ClassID::CallBr;
1162 return cast<llvm::CallBase>(
Val)->getFunctionType();
1170 auto *LLVMCB = cast<llvm::CallBase>(
Val);
1171 auto Dist = LLVMCB->data_operands_end() - LLVMCB->data_operands_begin();
1175 auto *LLVMCB = cast<llvm::CallBase>(
Val);
1176 auto Dist = LLVMCB->data_operands_end() - LLVMCB->data_operands_begin();
1192 assert(
this == U.getUser() &&
1193 "Only valid to query with a use of this instruction!");
1194 return cast<llvm::CallBase>(
Val)->isDataOperand(U.LLVMUse);
1198 return cast<llvm::CallBase>(
Val)->getDataOperandNo(U.LLVMUse);
1204 return cast<llvm::CallBase>(
Val)->getNumTotalBundleOperands();
1243 return cast<llvm::CallBase>(
Val)->isArgOperand(U.LLVMUse);
1246 return cast<llvm::CallBase>(
Val)->getArgOperandNo(U.LLVMUse);
1255 return cast<llvm::CallBase>(
Val)->isIndirectCall();
1258 return cast<llvm::CallBase>(
Val)->isCallee(U.LLVMUse);
1265 return cast<llvm::CallBase>(
Val)->isMustTailCall();
1269 return cast<llvm::CallBase>(
Val)->getIntrinsicID();
1274 return cast<llvm::CallBase>(
Val)->getCallingConv();
1291 const Twine &NameStr =
"");
1300 return From->getSubclassID() == ClassID::Call;
1317 const Twine &NameStr =
"");
1328 return From->getSubclassID() == ClassID::Invoke;
1338 assert(SuccIdx < 2 &&
"Successor # out of range for invoke!");
1345 return cast<llvm::InvokeInst>(
Val)->getNumSuccessors();
1363 const Twine &NameStr =
"");
1375 return From->getSubclassID() == ClassID::CallBr;
1378 return cast<llvm::CallBrInst>(
Val)->getNumIndirectDests();
1389 return cast<llvm::CallBrInst>(
Val)->getNumSuccessors();
1408 const Twine &NameStr =
"");
1411 const Twine &NameStr =
"");
1414 const Twine &NameStr =
"");
1417 return From->getSubclassID() == ClassID::GetElementPtr;
1421 return cast<llvm::GetElementPtrInst>(
Val)->getSourceElementType();
1424 return cast<llvm::GetElementPtrInst>(
Val)->getResultElementType();
1427 return cast<llvm::GetElementPtrInst>(
Val)->getAddressSpace();
1450 return cast<llvm::GetElementPtrInst>(
Val)->getPointerOperandType();
1453 return cast<llvm::GetElementPtrInst>(
Val)->getPointerAddressSpace();
1456 return cast<llvm::GetElementPtrInst>(
Val)->getNumIndices();
1459 return cast<llvm::GetElementPtrInst>(
Val)->hasIndices();
1462 return cast<llvm::GetElementPtrInst>(
Val)->hasAllConstantIndices();
1465 return cast<llvm::GetElementPtrInst>(
Val)->getNoWrapFlags();
1468 return cast<llvm::GetElementPtrInst>(
Val)->isInBounds();
1471 return cast<llvm::GetElementPtrInst>(
Val)->hasNoUnsignedSignedWrap();
1474 return cast<llvm::GetElementPtrInst>(
Val)->hasNoUnsignedWrap();
1477 return cast<llvm::GetElementPtrInst>(
Val)->accumulateConstantOffset(
DL,
1499 return cast<llvm::SwitchInst>(
Val)->defaultDestUndefined();
1503 return cast<llvm::SwitchInst>(
Val)->getNumCases();
1559 return cast<llvm::SwitchInst>(
Val)->getNumSuccessors();
1564 return From->getSubclassID() == ClassID::Switch;
1571 case llvm::Instruction::FNeg:
1572 return Opcode::FNeg;
1573 case llvm::Instruction::UnaryOpsEnd:
1605 return From->getSubclassID() == ClassID::UnOp;
1612 case llvm::Instruction::Add:
1614 case llvm::Instruction::FAdd:
1615 return Opcode::FAdd;
1616 case llvm::Instruction::Sub:
1618 case llvm::Instruction::FSub:
1619 return Opcode::FSub;
1620 case llvm::Instruction::Mul:
1622 case llvm::Instruction::FMul:
1623 return Opcode::FMul;
1624 case llvm::Instruction::UDiv:
1625 return Opcode::UDiv;
1626 case llvm::Instruction::SDiv:
1627 return Opcode::SDiv;
1628 case llvm::Instruction::FDiv:
1629 return Opcode::FDiv;
1630 case llvm::Instruction::URem:
1631 return Opcode::URem;
1632 case llvm::Instruction::SRem:
1633 return Opcode::SRem;
1634 case llvm::Instruction::FRem:
1635 return Opcode::FRem;
1636 case llvm::Instruction::Shl:
1638 case llvm::Instruction::LShr:
1639 return Opcode::LShr;
1640 case llvm::Instruction::AShr:
1641 return Opcode::AShr;
1642 case llvm::Instruction::And:
1644 case llvm::Instruction::Or:
1646 case llvm::Instruction::Xor:
1648 case llvm::Instruction::BinaryOpsEnd:
1655 getBinOpOpcode(BinOp->getOpcode()), BinOp,
1684 return From->getSubclassID() == ClassID::BinaryOperator;
1692 Instruction::Opcode::AtomicRMW, Atomic,
Ctx) {
1699 return cast<llvm::AtomicRMWInst>(
Val)->getOperation();
1708 cast<llvm::AtomicRMWInst>(
Val)->setOperation(
Op);
1713 return cast<llvm::AtomicRMWInst>(
Val)->isVolatile();
1717 return cast<llvm::AtomicRMWInst>(
Val)->getOrdering();
1721 return cast<llvm::AtomicRMWInst>(
Val)->getSyncScopeID();
1733 return cast<llvm::AtomicRMWInst>(
Val)->getPointerAddressSpace();
1736 return cast<llvm::AtomicRMWInst>(
Val)->isFloatingPointOperation();
1739 return From->getSubclassID() == ClassID::AtomicRMW;
1764 Instruction::Opcode::AtomicCmpXchg, Atomic,
1772 return cast<llvm::AtomicCmpXchgInst>(
Val)->getAlign();
1779 return cast<llvm::AtomicCmpXchgInst>(
Val)->isVolatile();
1784 bool isWeak()
const {
return cast<llvm::AtomicCmpXchgInst>(
Val)->isWeak(); }
1793 return cast<llvm::AtomicCmpXchgInst>(
Val)->getSuccessOrdering();
1798 return cast<llvm::AtomicCmpXchgInst>(
Val)->getFailureOrdering();
1802 return cast<llvm::AtomicCmpXchgInst>(
Val)->getMergedOrdering();
1805 return cast<llvm::AtomicCmpXchgInst>(
Val)->getSyncScopeID();
1825 return cast<llvm::AtomicCmpXchgInst>(
Val)->getPointerAddressSpace();
1865 return cast<llvm::AllocaInst>(
Val)->isArrayAllocation();
1875 return cast<llvm::AllocaInst>(
Val)->getType();
1879 return cast<llvm::AllocaInst>(
Val)->getAddressSpace();
1884 return cast<llvm::AllocaInst>(
Val)->getAllocationSize(
DL);
1889 return cast<llvm::AllocaInst>(
Val)->getAllocationSizeInBits(
DL);
1893 return cast<llvm::AllocaInst>(
Val)->getAllocatedType();
1906 return cast<llvm::AllocaInst>(
Val)->isStaticAlloca();
1911 return cast<llvm::AllocaInst>(
Val)->isUsedWithInAlloca();
1917 if (
auto *
I = dyn_cast<Instruction>(
From))
1918 return I->getSubclassID() == Instruction::ClassID::Alloca;
1926 case llvm::Instruction::ZExt:
1927 return Opcode::ZExt;
1928 case llvm::Instruction::SExt:
1929 return Opcode::SExt;
1930 case llvm::Instruction::FPToUI:
1931 return Opcode::FPToUI;
1932 case llvm::Instruction::FPToSI:
1933 return Opcode::FPToSI;
1934 case llvm::Instruction::FPExt:
1935 return Opcode::FPExt;
1936 case llvm::Instruction::PtrToInt:
1937 return Opcode::PtrToInt;
1938 case llvm::Instruction::IntToPtr:
1939 return Opcode::IntToPtr;
1940 case llvm::Instruction::SIToFP:
1941 return Opcode::SIToFP;
1942 case llvm::Instruction::UIToFP:
1943 return Opcode::UIToFP;
1944 case llvm::Instruction::Trunc:
1945 return Opcode::Trunc;
1946 case llvm::Instruction::FPTrunc:
1947 return Opcode::FPTrunc;
1948 case llvm::Instruction::BitCast:
1949 return Opcode::BitCast;
1950 case llvm::Instruction::AddrSpaceCast:
1951 return Opcode::AddrSpaceCast;
1952 case llvm::Instruction::CastOpsEnd:
1999 if (
auto *
I = dyn_cast<Instruction>(
From))
2000 return I->getOpcode() ==
Op;
2020 :
public CastInstImpl<Instruction::Opcode::AddrSpaceCast> {
2048 LLVMBBToBB(
Context &Ctx) : Ctx(Ctx) {}
2063 LLVMBBToBB BBGetter(
Ctx);
2068 LLVMBBToBB BBGetter(
Ctx);
2081 return cast<llvm::PHINode>(
Val)->getNumIncomingValues();
2107 return cast<llvm::PHINode>(
Val)->hasConstantOrUndefValue();
2128 return From->getSubclassID() == ClassID::Opaque;
2157 auto It = Pair.first;
2159 It->second = std::unique_ptr<Argument>(
new Argument(LLVMArg, *
this));
2160 return cast<Argument>(It->second.get());
2162 return cast<Argument>(It->second.get());
2253 LLVMBBToBB(
Context &Ctx) : Ctx(Ctx) {}
2255 return *cast<BasicBlock>(Ctx.
getValue(&LLVMBB));
2266 return From->getSubclassID() == ClassID::Function;
2274 size_t arg_size()
const {
return cast<llvm::Function>(
Val)->arg_size(); }
2279 LLVMBBToBB BBGetter(
Ctx);
2283 LLVMBBToBB BBGetter(
Ctx);
2287 return cast<llvm::Function>(
Val)->getFunctionType();
2292 assert(isa<llvm::Function>(
Val) &&
"Expected Function!");
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
BlockVerifier::State From
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
#define LLVM_DUMP_METHOD
Mark debug helper function definitions like dump() that should not be stripped from debug builds.
Returns the sub type a function will return at a given Idx Should correspond to the result type of an ExtractValue instruction executed with just that one unsigned Idx
ppc ctr loops PowerPC CTR Loops Verify
StandardInstrumentations SI(Mod->getContext(), Debug, VerifyEach)
const SmallVectorImpl< MachineOperand > & Cond
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
Class for arbitrary precision integers.
an instruction to allocate memory on the stack
This class represents an incoming formal argument to a Function.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
An instruction that atomically checks whether a specified value is in a memory location,...
static bool isValidFailureOrdering(AtomicOrdering Ordering)
static bool isValidSuccessOrdering(AtomicOrdering Ordering)
an instruction that atomically reads a memory location, combines it with another value,...
static bool isFPOperation(BinOp Op)
BinOp
This enumeration lists the possible modifications atomicrmw can make.
static StringRef getOperationName(BinOp Op)
LLVM Basic Block Representation.
InstListType::iterator iterator
Instruction iterators...
Conditional or Unconditional Branch instruction.
CallBr instruction, tracking function calls that may not return control but instead transfer it to a ...
This class represents a function call, abstracting a target machine's calling convention.
This is the base class for all instructions that perform data casts.
Instruction::CastOps getOpcode() const
Return the opcode of this CastInst.
ConstantFolder - Create constants with minimum, target independent, folding.
This is the shared class of boolean and integer constants.
This is an important base class in LLVM.
This class represents an Operation in the Expression.
A parsed version of the target data layout string in and methods for querying it.
Convenience struct for specifying and reasoning about fast-math flags.
Class to represent function types.
Represents flags for the getelementptr instruction/expression.
an instruction for type-safe pointer arithmetic to access elements of arrays and structs
static unsigned getPointerOperandIndex()
This provides a uniform API for creating instructions and inserting them into a basic block: either a...
This instruction inserts a single (scalar) element into a VectorType value.
static bool isValidOperands(const Value *Vec, const Value *NewElt, const Value *Idx)
Return true if an insertelement instruction can be formed with the specified operands.
This is an important class for using LLVM in a threaded context.
An instruction for reading from memory.
static unsigned getOperandNumForIncomingValue(unsigned i)
static unsigned getIncomingValueNumForOperand(unsigned i)
Class to represent pointers.
Return a value (possibly void), from a function.
This class represents the LLVM 'select' instruction.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
An instruction for storing to memory.
StringRef - Represent a constant reference to a string, i.e.
ConstantIntT * getCaseValue() const
Resolves case value for current case.
static const unsigned DefaultPseudoIndex
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
The instances of the Type class are immutable: once they are created, they are never changed.
unsigned getPointerAddressSpace() const
Get the address space of this pointer or pointer vector type.
UnaryOps getOpcode() const
This function has undefined behavior.
A Use represents the edge between a Value definition and its users.
LLVM Value Representation.
Type * getType() const
All values are typed, get the type of this value.
StringRef getName() const
Return a constant reference to the value's name.
Base class of all SIMD vector types.
An efficient, type-erasing, non-owning reference to a callable.
A range adaptor for a pair of iterators.
This class implements an extremely fast bulk output stream that can only output to a stream.
unsigned getSrcAddressSpace() const
\Returns the address space of the pointer operand.
Value * getPointerOperand()
\Returns the pointer operand.
unsigned getDestAddressSpace() const
\Returns the address space of the result.
const Value * getPointerOperand() const
\Returns the pointer operand.
static unsigned getPointerOperandIndex()
\Returns the operand index of the pointer operand.
bool isUsedWithInAlloca() const
Return true if this alloca is used as an inalloca argument to a call.
Value * getArraySize()
Get the number of elements allocated.
Type * getAllocatedType() const
Return the type that is being allocated by the instruction.
bool isStaticAlloca() const
Return true if this alloca is in the entry block of the function and is a constant size.
bool isArrayAllocation() const
Return true if there is an allocation size parameter to the allocation instruction that is not 1.
std::optional< TypeSize > getAllocationSizeInBits(const DataLayout &DL) const
Get allocation size in bits.
void setAlignment(Align Align)
unsigned getAddressSpace() const
Return the address space for the allocation.
Align getAlign() const
Return the alignment of the memory that is being allocated by the instruction.
PointerType * getType() const
Overload to return most specific pointer type.
void setUsedWithInAlloca(bool V)
Specify whether this alloca is used to represent the arguments to a call.
static AllocaInst * create(Type *Ty, unsigned AddrSpace, BBIterator WhereIt, BasicBlock *WhereBB, Context &Ctx, Value *ArraySize=nullptr, const Twine &Name="")
static bool classof(const Value *From)
std::optional< TypeSize > getAllocationSize(const DataLayout &DL) const
Get allocation size in bytes.
const Value * getArraySize() const
void setAllocatedType(Type *Ty)
for use only in special circumstances that need to generically transform a whole instruction (eg: IR ...
Argument of a sandboxir::Function.
void dumpOS(raw_ostream &OS) const final
void printAsOperand(raw_ostream &OS) const
void verify() const final
Should crash if there is something wrong with the instruction.
static bool classof(const sandboxir::Value *From)
void setSyncScopeID(SyncScope::ID SSID)
void setVolatile(bool V)
Specify whether this is a volatile cmpxchg.
Value * getCompareOperand()
void setAlignment(Align Align)
Value * getPointerOperand()
const Value * getNewValOperand() const
void setSuccessOrdering(AtomicOrdering Ordering)
unsigned getPointerAddressSpace() const
Returns the address space of the pointer operand.
AtomicOrdering getMergedOrdering() const
Value * getNewValOperand()
const Value * getCompareOperand() const
static AtomicCmpXchgInst * create(Value *Ptr, Value *Cmp, Value *New, MaybeAlign Align, AtomicOrdering SuccessOrdering, AtomicOrdering FailureOrdering, BBIterator WhereIt, BasicBlock *WhereBB, Context &Ctx, SyncScope::ID SSID=SyncScope::System, const Twine &Name="")
const Value * getPointerOperand() const
AtomicOrdering getFailureOrdering() const
static bool isValidFailureOrdering(AtomicOrdering Ordering)
void setWeak(bool IsWeak)
bool isVolatile() const
Return true if this is a cmpxchg from a volatile memory location.
static bool isValidSuccessOrdering(AtomicOrdering Ordering)
AtomicOrdering getSuccessOrdering() const
void setFailureOrdering(AtomicOrdering Ordering)
SyncScope::ID getSyncScopeID() const
Align getAlign() const
Return the alignment of the memory that is being allocated by the instruction.
bool isWeak() const
Return true if this cmpxchg may spuriously fail.
Value * getPointerOperand()
static AtomicRMWInst * create(BinOp Op, Value *Ptr, Value *Val, MaybeAlign Align, AtomicOrdering Ordering, BBIterator WhereIt, BasicBlock *WhereBB, Context &Ctx, SyncScope::ID SSID=SyncScope::System, const Twine &Name="")
BinOp getOperation() const
const Value * getPointerOperand() const
unsigned getPointerAddressSpace() const
llvm::AtomicRMWInst::BinOp BinOp
SyncScope::ID getSyncScopeID() const
void setAlignment(Align Align)
const Value * getValOperand() const
void setSyncScopeID(SyncScope::ID SSID)
static StringRef getOperationName(BinOp Op)
void setOrdering(AtomicOrdering Ordering)
AtomicOrdering getOrdering() const
void setOperation(BinOp Op)
static bool classof(const Value *From)
bool isFloatingPointOperation() const
static bool isFPOperation(BinOp Op)
Iterator for Instructions in a `BasicBlock.
BBIterator & operator++()
BBIterator operator++(int)
bool operator!=(const BBIterator &Other) const
BBIterator operator--(int)
pointer get() const
\Returns the SBInstruction that corresponds to this iterator, or null if the instruction is not found...
reference operator*() const
BBIterator & operator--()
std::bidirectional_iterator_tag iterator_category
std::ptrdiff_t difference_type
BBIterator(llvm::BasicBlock *BB, llvm::BasicBlock::iterator It, Context *Ctx)
bool operator==(const BBIterator &Other) const
Contains a list of sandboxir::Instruction's.
void dumpOS(raw_ostream &OS) const final
std::reverse_iterator< iterator > rbegin() const
static bool classof(const Value *From)
For isa/dyn_cast.
void verify() const final
Should crash if there is something wrong with the instruction.
std::reverse_iterator< iterator > rend() const
Function * getParent() const
Instruction & front() const
Instruction * getTerminator() const
Context & getContext() const
Instruction & back() const
static Value * create(Instruction::Opcode Op, Value *LHS, Value *RHS, BBIterator WhereIt, BasicBlock *WhereBB, Context &Ctx, const Twine &Name="")
static bool classof(const Value *From)
For isa/dyn_cast.
static Value * createWithCopiedFlags(Instruction::Opcode Op, Value *LHS, Value *RHS, Value *CopyFrom, BBIterator WhereIt, BasicBlock *WhereBB, Context &Ctx, const Twine &Name="")
unsigned getNumSuccessors() const
iterator_range< sb_succ_op_iterator > successors()
iterator_range< const_sb_succ_op_iterator > successors() const
static bool classof(const Value *From)
For isa/dyn_cast.
void setCondition(Value *V)
bool isConditional() const
void setSuccessor(unsigned Idx, BasicBlock *NewSucc)
bool isUnconditional() const
BasicBlock * getSuccessor(unsigned SuccIdx) const
static BranchInst * create(BasicBlock *IfTrue, Instruction *InsertBefore, Context &Ctx)
Value * getCondition() const
iterator_range< const_op_iterator > args() const
CallingConv::ID getCallingConv() const
bool isMustTailCall() const
const Function * getCaller() const
FunctionType * getFunctionType() const
void setCalledFunction(Function *F)
const_op_iterator arg_end() const
iterator_range< op_iterator > args()
static bool classof(const Value *From)
Value * getArgOperand(unsigned OpIdx) const
Function * getCalledFunction() const
Use getArgOperandUse(unsigned Idx)
bool isDataOperand(Use U) const
unsigned getArgOperandNo(Use U) const
const_op_iterator data_operands_end() const
op_iterator data_operands_end()
unsigned getDataOperandNo(Use U) const
unsigned getNumTotalBundleOperands() const
Return the total number operands (not operand bundles) used by every operand bundle in this OperandBu...
iterator_range< op_iterator > data_ops()
const_op_iterator data_operands_begin() const
bool data_operands_empty() const
bool hasArgument(const Value *V) const
void setCalledOperand(Value *V)
unsigned arg_size() const
unsigned data_operands_size() const
const_op_iterator arg_begin() const
Intrinsic::ID getIntrinsicID() const
Use getArgOperandUse(unsigned Idx) const
Value * getCalledOperand() const
op_iterator data_operands_begin()
bool isArgOperand(Use U) const
void setArgOperand(unsigned OpIdx, Value *NewOp)
iterator_range< const_op_iterator > data_ops() const
Use getCalledOperandUse() const
bool isCallee(Use U) const
bool isIndirectCall() const
static CallBrInst * create(FunctionType *FTy, Value *Func, BasicBlock *DefaultDest, ArrayRef< BasicBlock * > IndirectDests, ArrayRef< Value * > Args, BBIterator WhereIt, BasicBlock *WhereBB, Context &Ctx, const Twine &NameStr="")
BasicBlock * getIndirectDest(unsigned Idx) const
static bool classof(const Value *From)
void setDefaultDest(BasicBlock *BB)
Value * getIndirectDestLabel(unsigned Idx) const
Value * getIndirectDestLabelUse(unsigned Idx) const
unsigned getNumIndirectDests() const
SmallVector< BasicBlock *, 16 > getIndirectDests() const
BasicBlock * getDefaultDest() const
BasicBlock * getSuccessor(unsigned Idx) const
void setIndirectDest(unsigned Idx, BasicBlock *BB)
unsigned getNumSuccessors() const
static CallInst * create(FunctionType *FTy, Value *Func, ArrayRef< Value * > Args, BBIterator WhereIt, BasicBlock *WhereBB, Context &Ctx, const Twine &NameStr="")
static bool classof(const Value *From)
static Value * create(Value *Src, Type *DestTy, Instruction *InsertBefore, Context &Ctx, const Twine &Name="")
static bool classof(const Value *From)
static Value * create(Value *Src, Type *DestTy, BBIterator WhereIt, BasicBlock *WhereBB, Context &Ctx, const Twine &Name="")
static Value * create(Value *Src, Type *DestTy, BasicBlock *InsertAtEnd, Context &Ctx, const Twine &Name="")
static Value * create(Type *DestTy, Opcode Op, Value *Operand, BBIterator WhereIt, BasicBlock *WhereBB, Context &Ctx, const Twine &Name="")
static bool classof(const Value *From)
For isa/dyn_cast.
static ConstantInt * get(Type *Ty, uint64_t V, Context &Ctx, bool IsSigned=false)
If Ty is a vector type, return a Constant with a splat of the given value.
void verify() const override
Should crash if there is something wrong with the instruction.
unsigned getUseOperandNo(const Use &Use) const override
\Returns the operand index of Use.
void dumpOS(raw_ostream &OS) const override
static bool classof(const sandboxir::Value *From)
For isa/dyn_cast.
sandboxir::Context & getParent() const
void verify() const override
Should crash if there is something wrong with the instruction.
static bool classof(const sandboxir::Value *From)
For isa/dyn_cast.
void dumpOS(raw_ostream &OS) const override
unsigned getUseOperandNo(const Use &Use) const override
\Returns the operand index of Use.
CallBrInst * createCallBrInst(llvm::CallBrInst *I)
GetElementPtrInst * createGetElementPtrInst(llvm::GetElementPtrInst *I)
DenseMap< llvm::Value *, std::unique_ptr< sandboxir::Value > > LLVMValueToValueMap
Maps LLVM Value to the corresponding sandboxir::Value.
Value * registerValue(std::unique_ptr< Value > &&VPtr)
Take ownership of VPtr and store it in LLVMValueToValueMap.
sandboxir::Value * getValue(llvm::Value *V) const
IRBuilder< ConstantFolder > LLVMIRBuilder
Argument * getOrCreateArgument(llvm::Argument *LLVMArg)
Get or create a sandboxir::Argument for an existing LLVM IR LLVMArg.
Function * createFunction(llvm::Function *F)
Create a sandboxir::Function for an existing LLVM IR F, including all blocks and instructions.
Value * getOrCreateValueInternal(llvm::Value *V, llvm::User *U=nullptr)
This is the actual function that creates sandboxir values for V, and among others handles all instruc...
friend ExtractElementInst
auto & getLLVMIRBuilder()
std::unique_ptr< Value > detach(Value *V)
Remove SBV from all SandboxIR maps and stop owning it.
SwitchInst * createSwitchInst(llvm::SwitchInst *I)
UnreachableInst * createUnreachableInst(llvm::UnreachableInst *UI)
const sandboxir::Value * getValue(const llvm::Value *V) const
void accept()
Convenience function for getTracker().accept()
BranchInst * createBranchInst(llvm::BranchInst *I)
Constant * getOrCreateConstant(llvm::Constant *LLVMC)
Get or create a sandboxir::Constant from an existing LLVM IR LLVMC.
BasicBlock * createBasicBlock(llvm::BasicBlock *BB)
Create a sandboxir::BasicBlock for an existing LLVM IR BB.
UnaryOperator * createUnaryOperator(llvm::UnaryOperator *I)
ExtractElementInst * createExtractElementInst(llvm::ExtractElementInst *EEI)
LoadInst * createLoadInst(llvm::LoadInst *LI)
AllocaInst * createAllocaInst(llvm::AllocaInst *I)
Context(LLVMContext &LLVMCtx)
void revert()
Convenience function for getTracker().revert()
CallInst * createCallInst(llvm::CallInst *I)
AtomicRMWInst * createAtomicRMWInst(llvm::AtomicRMWInst *I)
std::unique_ptr< Value > detachLLVMValue(llvm::Value *V)
Remove V from the maps and returns the unique_ptr.
StoreInst * createStoreInst(llvm::StoreInst *SI)
void save()
Convenience function for getTracker().save()
Value * getOrCreateValue(llvm::Value *LLVMV)
Get or create a sandboxir::Value for an existing LLVM IR LLVMV.
InsertElementInst * createInsertElementInst(llvm::InsertElementInst *IEI)
AtomicCmpXchgInst * createAtomicCmpXchgInst(llvm::AtomicCmpXchgInst *I)
ReturnInst * createReturnInst(llvm::ReturnInst *I)
PHINode * createPHINode(llvm::PHINode *I)
SelectInst * createSelectInst(llvm::SelectInst *SI)
CastInst * createCastInst(llvm::CastInst *I)
BinaryOperator * createBinaryOperator(llvm::BinaryOperator *I)
InvokeInst * createInvokeInst(llvm::InvokeInst *I)
size_t getNumValues() const
\Returns the number of values registered with Context.
static Value * create(Value *Vec, Value *Idx, Instruction *InsertBefore, Context &Ctx, const Twine &Name="")
const Value * getVectorOperand() const
const Value * getIndexOperand() const
Value * getVectorOperand()
VectorType * getVectorOperandType() const
Value * getIndexOperand()
static bool classof(const Value *From)
static bool isValidOperands(const Value *Vec, const Value *Idx)
Argument * getArg(unsigned Idx) const
FunctionType * getFunctionType() const
void dumpNameAndArgs(raw_ostream &OS) const
void dumpOS(raw_ostream &OS) const final
void verify() const final
Should crash if there is something wrong with the instruction.
static bool classof(const sandboxir::Value *From)
For isa/dyn_cast.
mapped_iterator< llvm::Function::iterator, LLVMBBToBB > iterator
unsigned getAddressSpace() const
bool hasAllConstantIndices() const
bool hasNoUnsignedWrap() const
Value * getPointerOperand() const
iterator_range< op_iterator > indices()
const_op_iterator idx_begin() const
unsigned getPointerAddressSpace() const
GEPNoWrapFlags getNoWrapFlags() const
static Value * create(Type *Ty, Value *Ptr, ArrayRef< Value * > IdxList, BBIterator WhereIt, BasicBlock *WhereBB, Context &Ctx, const Twine &NameStr="")
Type * getResultElementType() const
unsigned getNumIndices() const
Type * getPointerOperandType() const
static unsigned getPointerOperandIndex()
Type * getSourceElementType() const
bool hasNoUnsignedSignedWrap() const
static bool classof(const Value *From)
const_op_iterator idx_end() const
bool accumulateConstantOffset(const DataLayout &DL, APInt &Offset) const
iterator_range< const_op_iterator > indices() const
static Value * create(Value *Vec, Value *NewElt, Value *Idx, Instruction *InsertBefore, Context &Ctx, const Twine &Name="")
static bool isValidOperands(const Value *Vec, const Value *NewElt, const Value *Idx)
static bool classof(const Value *From)
A sandboxir::User with operands, opcode and linked with previous/next instructions in an instruction ...
bool hasNoUnsignedWrap() const
Determine whether the no signed wrap flag is set.
friend class UnreachableInst
BBIterator getIterator() const
\Returns a BasicBlock::iterator for this Instruction.
void removeFromParent()
Detach this from its parent BasicBlock without deleting it.
bool hasAllowReassoc() const
Determine whether the allow-reassociation flag is set.
virtual unsigned getNumOfIRInstrs() const =0
This is used by BasicBlock::iterator.
bool hasNoSignedZeros() const
Determine whether the no-signed-zeros flag is set.
void copyFastMathFlags(FastMathFlags FMF)
Convenience function for transferring all fast-math flag values to this instruction,...
void setHasNoSignedZeros(bool B)
Set or clear the no-signed-zeros flag on this instruction, which must be an operator which supports t...
static bool classof(const sandboxir::Value *From)
For isa/dyn_cast.
void moveAfter(Instruction *After)
Move this instruction after After.
bool hasAllowContract() const
Determine whether the allow-contract flag is set.
void setHasAllowContract(bool B)
Set or clear the allow-contract flag on this instruction, which must be an operator which supports th...
void setIsExact(bool B=true)
Set or clear the exact flag on this instruction, which must be an operator which supports this flag.
bool hasApproxFunc() const
Determine whether the approximate-math-functions flag is set.
bool hasNoSignedWrap() const
Determine whether the no signed wrap flag is set.
void setHasNoNaNs(bool B)
Set or clear the no-nans flag on this instruction, which must be an operator which supports this flag...
void insertInto(BasicBlock *BB, const BBIterator &WhereIt)
Insert this detached instruction into BB at WhereIt.
Opcode getOpcode() const
\Returns this Instruction's opcode.
void setHasApproxFunc(bool B)
Set or clear the approximate-math-functions flag on this instruction, which must be an operator which...
bool isFast() const
Determine whether all fast-math-flags are set.
static const char * getOpcodeName(Opcode Opc)
void setHasAllowReassoc(bool B)
Set or clear the reassociation flag on this instruction, which must be an operator which supports thi...
void setFastMathFlags(FastMathFlags FMF)
Convenience function for setting multiple fast-math flags on this instruction, which must be an opera...
void eraseFromParent()
Detach this Value from its parent and delete it.
Instruction * getNextNode() const
\Returns the next sandboxir::Instruction in the block, or nullptr if at the end of the block.
void moveBefore(BasicBlock &BB, const BBIterator &WhereIt)
Move this instruction to WhereIt.
llvm::Instruction * getTopmostLLVMInstruction() const
A SandboxIR Instruction may map to multiple LLVM IR Instruction.
void setHasNoInfs(bool B)
Set or clear the no-infs flag on this instruction, which must be an operator which supports this flag...
void insertAfter(Instruction *AfterI)
Insert this detached instruction after AfterI.
virtual SmallVector< llvm::Instruction *, 1 > getLLVMInstrs() const =0
\Returns the LLVM IR Instructions that this SandboxIR maps to in program order.
void moveBefore(Instruction *Before)
Move this instruction before Before.
void dumpOS(raw_ostream &OS) const override
bool isExact() const
Determine whether the exact flag is set.
Instruction * getPrevNode() const
\Returns the previous sandboxir::Instruction in the block, or nullptr if at the beginning of the bloc...
Instruction(ClassID ID, Opcode Opc, llvm::Instruction *I, sandboxir::Context &SBCtx)
FastMathFlags getFastMathFlags() const
Convenience function for getting all the fast-math flags, which must be an operator which supports th...
void setHasNoSignedWrap(bool B=true)
Set or clear the nsw flag on this instruction, which must be an operator which supports this flag.
void setHasAllowReciprocal(bool B)
Set or clear the allow-reciprocal flag on this instruction, which must be an operator which supports ...
bool hasNoInfs() const
Determine whether the no-infs flag is set.
bool hasNoNaNs() const
Determine whether the no-NaNs flag is set.
bool hasAllowReciprocal() const
Determine whether the allow-reciprocal flag is set.
void setFast(bool B)
Set or clear all fast-math-flags on this instruction, which must be an operator which supports this f...
void setHasNoUnsignedWrap(bool B=true)
Set or clear the nuw flag on this instruction, which must be an operator which supports this flag.
void insertBefore(Instruction *BeforeI)
Insert this detached instruction before BeforeI.
BasicBlock * getParent() const
\Returns the BasicBlock containing this Instruction, or null if it is detached.
Instruction * getLandingPadInst() const
BasicBlock * getSuccessor(unsigned SuccIdx) const
void setNormalDest(BasicBlock *BB)
unsigned getNumSuccessors() const
static InvokeInst * create(FunctionType *FTy, Value *Func, BasicBlock *IfNormal, BasicBlock *IfException, ArrayRef< Value * > Args, BBIterator WhereIt, BasicBlock *WhereBB, Context &Ctx, const Twine &NameStr="")
static bool classof(const Value *From)
void setUnwindDest(BasicBlock *BB)
void setSuccessor(unsigned SuccIdx, BasicBlock *NewSucc)
BasicBlock * getNormalDest() const
BasicBlock * getUnwindDest() const
static bool classof(const Value *From)
For isa/dyn_cast.
static LoadInst * create(Type *Ty, Value *Ptr, MaybeAlign Align, Instruction *InsertBefore, Context &Ctx, const Twine &Name="")
void setVolatile(bool V)
Specify whether this is a volatile load or not.
bool isVolatile() const
Return true if this is a load from a volatile memory location.
Value * getPointerOperand() const
An LLLVM Instruction that has no SandboxIR equivalent class gets mapped to an OpaqueInstr.
static bool classof(const sandboxir::Value *From)
Iterator for the Use edges of a User's operands.
OperandUseIterator()=default
std::ptrdiff_t difference_type
value_type operator*() const
std::input_iterator_tag iterator_category
OperandUseIterator operator++(int)
OperandUseIterator operator+(unsigned Num) const
bool operator!=(const OperandUseIterator &Other) const
bool operator==(const OperandUseIterator &Other) const
OperandUseIterator operator-(unsigned Num) const
OperandUseIterator & operator++()
iterator_range< const_block_iterator > blocks() const
const_block_iterator block_end() const
static bool classof(const Value *From)
For isa/dyn_cast.
const_op_range incoming_values() const
void setIncomingBlock(unsigned Idx, BasicBlock *BB)
bool hasConstantOrUndefValue() const
void replaceIncomingBlockWith(const BasicBlock *Old, BasicBlock *New)
void setIncomingValue(unsigned Idx, Value *V)
unsigned getNumIncomingValues() const
void addIncoming(Value *V, BasicBlock *BB)
const_block_iterator block_begin() const
int getBasicBlockIndex(const BasicBlock *BB) const
mapped_iterator< llvm::PHINode::const_block_iterator, LLVMBBToBB > const_block_iterator
Value * removeIncomingValue(unsigned Idx)
void removeIncomingValueIf(function_ref< bool(unsigned)> Predicate)
Value * hasConstantValue() const
op_range incoming_values()
static unsigned getIncomingValueNumForOperand(unsigned Idx)
Value * getIncomingValueForBlock(const BasicBlock *BB) const
BasicBlock * getIncomingBlock(unsigned Idx) const
static unsigned getOperandNumForIncomingValue(unsigned Idx)
static PHINode * create(Type *Ty, unsigned NumReservedValues, Instruction *InsertBefore, Context &Ctx, const Twine &Name="")
Value * getIncomingValue(unsigned Idx) const
static bool classof(const Value *From)
Value * getReturnValue() const
\Returns null if there is no return value.
static ReturnInst * create(Value *RetVal, Instruction *InsertBefore, Context &Ctx)
static Value * create(Value *Cond, Value *True, Value *False, Instruction *InsertBefore, Context &Ctx, const Twine &Name="")
void setTrueValue(Value *New)
static bool classof(const Value *From)
For isa/dyn_cast.
void setCondition(Value *New)
void setFalseValue(Value *New)
Instructions that contain a single LLVM Instruction can inherit from this.
void dumpOS(raw_ostream &OS) const override
void verify() const final
Should crash if there is something wrong with the instruction.
unsigned getUseOperandNo(const Use &Use) const final
\Returns the operand index of Use.
unsigned getNumOfIRInstrs() const final
This is used by BasicBlock::iterator.
static bool classof(const Value *From)
For isa/dyn_cast.
void setVolatile(bool V)
Specify whether this is a volatile store or not.
static StoreInst * create(Value *V, Value *Ptr, MaybeAlign Align, Instruction *InsertBefore, Context &Ctx)
bool isVolatile() const
Return true if this is a store from a volatile memory location.
Value * getPointerOperand() const
Value * getValueOperand() const
BasicBlock * getSuccessor(unsigned Idx) const
CaseIt findCaseValue(const ConstantInt *C)
iterator_range< ConstCaseIt > cases() const
bool defaultDestUndefined() const
void setSuccessor(unsigned Idx, BasicBlock *NewSucc)
void setDefaultDest(BasicBlock *DefaultCase)
CaseIt case_begin()
Returns a read/write iterator that points to the first case in the SwitchInst.
iterator_range< CaseIt > cases()
Iteration adapter for range-for loops.
void addCase(ConstantInt *OnVal, BasicBlock *Dest)
llvm::SwitchInst::CaseIteratorImpl< CaseHandle > CaseIt
SwitchInst(llvm::SwitchInst *SI, Context &Ctx)
ConstCaseIt case_begin() const
ConstCaseIt case_end() const
llvm::SwitchInst::CaseIteratorImpl< ConstCaseHandle > ConstCaseIt
ConstCaseIt case_default() const
static bool classof(const Value *From)
BasicBlock * getDefaultDest() const
void setCondition(Value *V)
static SwitchInst * create(Value *V, BasicBlock *Dest, unsigned NumCases, BasicBlock::iterator WhereIt, BasicBlock *WhereBB, Context &Ctx, const Twine &Name="")
Value * getCondition() const
unsigned getNumCases() const
unsigned getNumSuccessors() const
CaseIt case_end()
Returns a read/write iterator that points one past the last in the SwitchInst.
ConstCaseIt findCaseValue(const ConstantInt *C) const
ConstantInt * findCaseDest(BasicBlock *BB)
static constexpr const unsigned DefaultPseudoIndex
CaseIt removeCase(CaseIt It)
This method removes the specified case and its successor from the switch instruction.
The tracker collects all the change objects and implements the main API for saving / reverting / acce...
void revert()
Stops tracking and reverts to saved state.
void save()
Turns on IR tracking.
void accept()
Stops tracking and accept changes.
An abstract class, parent of unary instructions.
static bool classof(const Instruction *I)
UnaryInstruction(ClassID ID, Opcode Opc, llvm::Instruction *LLVMI, Context &Ctx)
static bool classof(const Value *V)
static bool classof(const Value *From)
For isa/dyn_cast.
static Value * create(Instruction::Opcode Op, Value *OpV, BBIterator WhereIt, BasicBlock *WhereBB, Context &Ctx, const Twine &Name="")
static Value * createWithCopiedFlags(Instruction::Opcode Op, Value *OpV, Value *CopyFrom, BBIterator WhereIt, BasicBlock *WhereBB, Context &Ctx, const Twine &Name="")
static bool classof(const Value *From)
static UnreachableInst * create(Instruction *InsertBefore, Context &Ctx)
unsigned getNumOfIRInstrs() const final
This is used by BasicBlock::iterator.
unsigned getUseOperandNo(const Use &Use) const final
\Returns the operand index of Use.
unsigned getNumSuccessors() const
Represents a Def-use/Use-def edge in SandboxIR.
unsigned getOperandNo() const
class User * getUser() const
Iterator for the Use edges of a Value's users.
const sandboxir::Use & getUse() const
std::input_iterator_tag iterator_category
std::ptrdiff_t difference_type
bool operator!=(const UserUseIterator &Other) const
UserUseIterator & operator++()
value_type operator*() const
bool operator==(const UserUseIterator &Other) const
UserUseIterator()=default
A sandboxir::User has operands.
virtual op_iterator op_begin()
void dumpOS(raw_ostream &OS) const override
friend class OperandUseIterator
Value * getOperand(unsigned OpIdx) const
virtual unsigned getUseOperandNo(const Use &Use) const =0
\Returns the operand index of Use.
unsigned getUseOperandNoDefault(const Use &Use) const
The default implementation works only for single-LLVMIR-instruction Users and only if they match exac...
virtual const_op_iterator op_end() const
static bool classof(const Value *From)
For isa/dyn_cast.
bool replaceUsesOfWith(Value *FromV, Value *ToV)
Replaces any operands that match FromV with ToV.
void verifyUserOfLLVMUse(const llvm::Use &Use) const
void verify() const override
Should crash if there is something wrong with the instruction.
Use getOperandUseDefault(unsigned OpIdx, bool Verify) const
\Returns the Use edge that corresponds to OpIdx.
OperandUseIterator op_iterator
const_op_range operands() const
virtual void setOperand(unsigned OperandIdx, Value *Operand)
virtual Use getOperandUseInternal(unsigned OpIdx, bool Verify) const =0
\Returns the Use for the OpIdx'th operand.
void swapOperandsInternal(unsigned OpIdxA, unsigned OpIdxB)
virtual unsigned getNumOperands() const
virtual const_op_iterator op_begin() const
Use getOperandUse(unsigned OpIdx) const
\Returns the operand edge for OpIdx.
virtual op_iterator op_end()
User(ClassID ID, llvm::Value *V, Context &Ctx)
void dumpCommonHeader(raw_ostream &OS) const final
A SandboxIR Value has users. This is the base class.
mapped_iterator< sandboxir::UserUseIterator, UseToUser > user_iterator
LLVM_DUMP_METHOD void dump() const
llvm::Value * Val
The LLVM Value that corresponds to this SandboxIR Value.
std::string getUid() const
Returns the unique id in the form 'SB<number>.' like 'SB1.'.
const_use_iterator use_end() const
user_iterator user_begin()
void replaceAllUsesWith(Value *Other)
ClassID getSubclassID() const
StringRef getName() const
\Returns the LLVM IR name of the bottom-most LLVM value.
virtual void verify() const =0
Should crash if there is something wrong with the instruction.
void dumpCommonFooter(raw_ostream &OS) const
virtual void dumpCommonHeader(raw_ostream &OS) const
UserUseIterator use_iterator
Context & Ctx
All values point to the context.
ClassID SubclassID
For isa/dyn_cast.
void dumpCommonSuffix(raw_ostream &OS) const
friend class LLVMOpUserItToSBTy
const_use_iterator use_begin() const
Context & getContext() const
const_user_iterator user_begin() const
bool hasNUsesOrMore(unsigned Num) const
Return true if this value has N uses or more.
Value & operator=(const Value &)=delete
iterator_range< const_user_iterator > users() const
iterator_range< user_iterator > users()
void replaceUsesWithIf(Value *OtherV, llvm::function_ref< bool(const Use &)> ShouldReplace)
unsigned getNumUses() const
\Returns the number of user edges (not necessarily to unique users).
bool hasNUses(unsigned Num) const
Return true if this Value has exactly N uses.
unsigned UID
A unique ID used for forming the name (used for debugging).
virtual void dumpOS(raw_ostream &OS) const =0
iterator_range< use_iterator > uses()
const_user_iterator user_end() const
void dumpCommonPrefix(raw_ostream &OS) const
void printAsOperandCommon(raw_ostream &OS) const
static const char * getSubclassIDStr(ClassID ID)
Value(const Value &)=delete
Disable copies.
friend raw_ostream & operator<<(raw_ostream &OS, const sandboxir::Value &V)
iterator_range< const_use_iterator > uses() const
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
@ C
The default llvm calling convention, compatible with C.
@ BasicBlock
Various leaf nodes.
@ System
Synchronized with respect to all concurrently executing threads.
This is an optimization pass for GlobalISel generic memory operations.
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
mapped_iterator< ItTy, FuncTy > map_iterator(ItTy I, FuncTy F)
AtomicOrdering
Atomic ordering for LLVM's memory model.
DWARFExpression::Operation Op
auto find_if(R &&Range, UnaryPredicate P)
Provide wrappers to std::find_if which take ranges instead of having to pass begin/end explicitly.
bool is_contained(R &&Range, const E &Element)
Returns true if Element is found in Range.
This struct is a compact representation of a valid (non-zero power of two) alignment.
The const version of succ_op_iterator.
This struct is a compact representation of a valid (power of two) or undefined (0) alignment.
Helper for mapped_iterator.
User * operator()(const Use &Use) const