#include "llvm/SandboxIR/SandboxIR.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/IR/Constants.h"
#include "llvm/Support/Debug.h"
#include <sstream>
usingnamespacellvm::sandboxir;
Value *Use::get() const { … }
void Use::set(Value *V) { … }
unsigned Use::getOperandNo() const { … }
void Use::swap(Use &OtherUse) { … }
#ifndef NDEBUG
void Use::dumpOS(raw_ostream &OS) const {
Value *Def = nullptr;
if (LLVMUse == nullptr)
OS << "<null> LLVM Use! ";
else
Def = Ctx->getValue(LLVMUse->get());
OS << "Def: ";
if (Def == nullptr)
OS << "NULL";
else
OS << *Def;
OS << "\n";
OS << "User: ";
if (Usr == nullptr)
OS << "NULL";
else
OS << *Usr;
OS << "\n";
OS << "OperandNo: ";
if (Usr == nullptr)
OS << "N/A";
else
OS << getOperandNo();
OS << "\n";
}
void Use::dump() const { dumpOS(dbgs()); }
#endif
Use OperandUseIterator::operator*() const { … }
OperandUseIterator &OperandUseIterator::operator++() { … }
UserUseIterator &UserUseIterator::operator++() { … }
OperandUseIterator OperandUseIterator::operator+(unsigned Num) const { … }
OperandUseIterator OperandUseIterator::operator-(unsigned Num) const { … }
int OperandUseIterator::operator-(const OperandUseIterator &Other) const { … }
Value::Value(ClassID SubclassID, llvm::Value *Val, Context &Ctx)
: … { … }
Value::use_iterator Value::use_begin() { … }
Value::user_iterator Value::user_begin() { … }
unsigned Value::getNumUses() const { … }
Type *Value::getType() const { … }
void Value::replaceUsesWithIf(
Value *OtherV, llvm::function_ref<bool(const Use &)> ShouldReplace) { … }
void Value::replaceAllUsesWith(Value *Other) { … }
#ifndef NDEBUG
std::string Value::getUid() const {
std::stringstream SS;
SS << "SB" << UID << ".";
return SS.str();
}
void Value::dumpCommonHeader(raw_ostream &OS) const {
OS << getUid() << " " << getSubclassIDStr(SubclassID) << " ";
}
void Value::dumpCommonFooter(raw_ostream &OS) const {
OS.indent(2) << "Val: ";
if (Val)
OS << *Val;
else
OS << "NULL";
OS << "\n";
}
void Value::dumpCommonPrefix(raw_ostream &OS) const {
if (Val)
OS << *Val;
else
OS << "NULL ";
}
void Value::dumpCommonSuffix(raw_ostream &OS) const {
OS << " ; " << getUid() << " (" << getSubclassIDStr(SubclassID) << ")";
}
void Value::printAsOperandCommon(raw_ostream &OS) const {
if (Val)
Val->printAsOperand(OS);
else
OS << "NULL ";
}
void Value::dump() const {
dumpOS(dbgs());
dbgs() << "\n";
}
void Argument::printAsOperand(raw_ostream &OS) const {
printAsOperandCommon(OS);
}
void Argument::dumpOS(raw_ostream &OS) const {
dumpCommonPrefix(OS);
dumpCommonSuffix(OS);
}
#endif
Use User::getOperandUseDefault(unsigned OpIdx, bool Verify) const { … }
#ifndef NDEBUG
void User::verifyUserOfLLVMUse(const llvm::Use &Use) const {
assert(Ctx.getValue(Use.getUser()) == this &&
"Use not found in this SBUser's operands!");
}
#endif
bool User::classof(const Value *From) { … }
void User::setOperand(unsigned OperandIdx, Value *Operand) { … }
bool User::replaceUsesOfWith(Value *FromV, Value *ToV) { … }
#ifndef NDEBUG
void User::dumpCommonHeader(raw_ostream &OS) const {
Value::dumpCommonHeader(OS);
}
#endif
BBIterator &BBIterator::operator++() { … }
BBIterator &BBIterator::operator--() { … }
const char *Instruction::getOpcodeName(Opcode Opc) { … }
llvm::Instruction *Instruction::getTopmostLLVMInstruction() const { … }
BBIterator Instruction::getIterator() const { … }
Instruction *Instruction::getNextNode() const { … }
Instruction *Instruction::getPrevNode() const { … }
void Instruction::removeFromParent() { … }
void Instruction::eraseFromParent() { … }
void Instruction::moveBefore(BasicBlock &BB, const BBIterator &WhereIt) { … }
void Instruction::insertBefore(Instruction *BeforeI) { … }
void Instruction::insertAfter(Instruction *AfterI) { … }
void Instruction::insertInto(BasicBlock *BB, const BBIterator &WhereIt) { … }
BasicBlock *Instruction::getParent() const { … }
bool Instruction::classof(const sandboxir::Value *From) { … }
void Instruction::setHasNoUnsignedWrap(bool B) { … }
void Instruction::setHasNoSignedWrap(bool B) { … }
void Instruction::setFast(bool B) { … }
void Instruction::setIsExact(bool B) { … }
void Instruction::setHasAllowReassoc(bool B) { … }
void Instruction::setHasNoNaNs(bool B) { … }
void Instruction::setHasNoInfs(bool B) { … }
void Instruction::setHasNoSignedZeros(bool B) { … }
void Instruction::setHasAllowReciprocal(bool B) { … }
void Instruction::setHasAllowContract(bool B) { … }
void Instruction::setFastMathFlags(FastMathFlags FMF) { … }
void Instruction::copyFastMathFlags(FastMathFlags FMF) { … }
void Instruction::setHasApproxFunc(bool B) { … }
#ifndef NDEBUG
void Instruction::dumpOS(raw_ostream &OS) const {
OS << "Unimplemented! Please override dump().";
}
#endif
VAArgInst *VAArgInst::create(Value *List, Type *Ty, BBIterator WhereIt,
BasicBlock *WhereBB, Context &Ctx,
const Twine &Name) { … }
Value *VAArgInst::getPointerOperand() { … }
FreezeInst *FreezeInst::create(Value *V, BBIterator WhereIt,
BasicBlock *WhereBB, Context &Ctx,
const Twine &Name) { … }
FenceInst *FenceInst::create(AtomicOrdering Ordering, BBIterator WhereIt,
BasicBlock *WhereBB, Context &Ctx,
SyncScope::ID SSID) { … }
void FenceInst::setOrdering(AtomicOrdering Ordering) { … }
void FenceInst::setSyncScopeID(SyncScope::ID SSID) { … }
Value *SelectInst::createCommon(Value *Cond, Value *True, Value *False,
const Twine &Name, IRBuilder<> &Builder,
Context &Ctx) { … }
Value *SelectInst::create(Value *Cond, Value *True, Value *False,
Instruction *InsertBefore, Context &Ctx,
const Twine &Name) { … }
Value *SelectInst::create(Value *Cond, Value *True, Value *False,
BasicBlock *InsertAtEnd, Context &Ctx,
const Twine &Name) { … }
void SelectInst::swapValues() { … }
bool SelectInst::classof(const Value *From) { … }
BranchInst *BranchInst::create(BasicBlock *IfTrue, Instruction *InsertBefore,
Context &Ctx) { … }
BranchInst *BranchInst::create(BasicBlock *IfTrue, BasicBlock *InsertAtEnd,
Context &Ctx) { … }
BranchInst *BranchInst::create(BasicBlock *IfTrue, BasicBlock *IfFalse,
Value *Cond, Instruction *InsertBefore,
Context &Ctx) { … }
BranchInst *BranchInst::create(BasicBlock *IfTrue, BasicBlock *IfFalse,
Value *Cond, BasicBlock *InsertAtEnd,
Context &Ctx) { … }
bool BranchInst::classof(const Value *From) { … }
Value *BranchInst::getCondition() const { … }
BasicBlock *BranchInst::getSuccessor(unsigned SuccIdx) const { … }
void BranchInst::setSuccessor(unsigned Idx, BasicBlock *NewSucc) { … }
BasicBlock *BranchInst::LLVMBBToSBBB::operator()(llvm::BasicBlock *BB) const { … }
const BasicBlock *
BranchInst::ConstLLVMBBToSBBB::operator()(const llvm::BasicBlock *BB) const { … }
void LoadInst::setVolatile(bool V) { … }
LoadInst *LoadInst::create(Type *Ty, Value *Ptr, MaybeAlign Align,
Instruction *InsertBefore, Context &Ctx,
const Twine &Name) { … }
LoadInst *LoadInst::create(Type *Ty, Value *Ptr, MaybeAlign Align,
Instruction *InsertBefore, bool IsVolatile,
Context &Ctx, const Twine &Name) { … }
LoadInst *LoadInst::create(Type *Ty, Value *Ptr, MaybeAlign Align,
BasicBlock *InsertAtEnd, Context &Ctx,
const Twine &Name) { … }
LoadInst *LoadInst::create(Type *Ty, Value *Ptr, MaybeAlign Align,
BasicBlock *InsertAtEnd, bool IsVolatile,
Context &Ctx, const Twine &Name) { … }
bool LoadInst::classof(const Value *From) { … }
Value *LoadInst::getPointerOperand() const { … }
void StoreInst::setVolatile(bool V) { … }
StoreInst *StoreInst::create(Value *V, Value *Ptr, MaybeAlign Align,
Instruction *InsertBefore, Context &Ctx) { … }
StoreInst *StoreInst::create(Value *V, Value *Ptr, MaybeAlign Align,
Instruction *InsertBefore, bool IsVolatile,
Context &Ctx) { … }
StoreInst *StoreInst::create(Value *V, Value *Ptr, MaybeAlign Align,
BasicBlock *InsertAtEnd, Context &Ctx) { … }
StoreInst *StoreInst::create(Value *V, Value *Ptr, MaybeAlign Align,
BasicBlock *InsertAtEnd, bool IsVolatile,
Context &Ctx) { … }
bool StoreInst::classof(const Value *From) { … }
Value *StoreInst::getValueOperand() const { … }
Value *StoreInst::getPointerOperand() const { … }
UnreachableInst *UnreachableInst::create(Instruction *InsertBefore,
Context &Ctx) { … }
UnreachableInst *UnreachableInst::create(BasicBlock *InsertAtEnd,
Context &Ctx) { … }
bool UnreachableInst::classof(const Value *From) { … }
ReturnInst *ReturnInst::createCommon(Value *RetVal, IRBuilder<> &Builder,
Context &Ctx) { … }
ReturnInst *ReturnInst::create(Value *RetVal, Instruction *InsertBefore,
Context &Ctx) { … }
ReturnInst *ReturnInst::create(Value *RetVal, BasicBlock *InsertAtEnd,
Context &Ctx) { … }
Value *ReturnInst::getReturnValue() const { … }
FunctionType *CallBase::getFunctionType() const { … }
Value *CallBase::getCalledOperand() const { … }
Use CallBase::getCalledOperandUse() const { … }
Function *CallBase::getCalledFunction() const { … }
Function *CallBase::getCaller() { … }
void CallBase::setCalledFunction(Function *F) { … }
CallInst *CallInst::create(FunctionType *FTy, Value *Func,
ArrayRef<Value *> Args, BasicBlock::iterator WhereIt,
BasicBlock *WhereBB, Context &Ctx,
const Twine &NameStr) { … }
CallInst *CallInst::create(FunctionType *FTy, Value *Func,
ArrayRef<Value *> Args, Instruction *InsertBefore,
Context &Ctx, const Twine &NameStr) { … }
CallInst *CallInst::create(FunctionType *FTy, Value *Func,
ArrayRef<Value *> Args, BasicBlock *InsertAtEnd,
Context &Ctx, const Twine &NameStr) { … }
InvokeInst *InvokeInst::create(FunctionType *FTy, Value *Func,
BasicBlock *IfNormal, BasicBlock *IfException,
ArrayRef<Value *> Args, BBIterator WhereIt,
BasicBlock *WhereBB, Context &Ctx,
const Twine &NameStr) { … }
InvokeInst *InvokeInst::create(FunctionType *FTy, Value *Func,
BasicBlock *IfNormal, BasicBlock *IfException,
ArrayRef<Value *> Args,
Instruction *InsertBefore, Context &Ctx,
const Twine &NameStr) { … }
InvokeInst *InvokeInst::create(FunctionType *FTy, Value *Func,
BasicBlock *IfNormal, BasicBlock *IfException,
ArrayRef<Value *> Args, BasicBlock *InsertAtEnd,
Context &Ctx, const Twine &NameStr) { … }
BasicBlock *InvokeInst::getNormalDest() const { … }
BasicBlock *InvokeInst::getUnwindDest() const { … }
void InvokeInst::setNormalDest(BasicBlock *BB) { … }
void InvokeInst::setUnwindDest(BasicBlock *BB) { … }
LandingPadInst *InvokeInst::getLandingPadInst() const { … }
BasicBlock *InvokeInst::getSuccessor(unsigned SuccIdx) const { … }
CallBrInst *CallBrInst::create(FunctionType *FTy, Value *Func,
BasicBlock *DefaultDest,
ArrayRef<BasicBlock *> IndirectDests,
ArrayRef<Value *> Args, BBIterator WhereIt,
BasicBlock *WhereBB, Context &Ctx,
const Twine &NameStr) { … }
CallBrInst *CallBrInst::create(FunctionType *FTy, Value *Func,
BasicBlock *DefaultDest,
ArrayRef<BasicBlock *> IndirectDests,
ArrayRef<Value *> Args,
Instruction *InsertBefore, Context &Ctx,
const Twine &NameStr) { … }
CallBrInst *CallBrInst::create(FunctionType *FTy, Value *Func,
BasicBlock *DefaultDest,
ArrayRef<BasicBlock *> IndirectDests,
ArrayRef<Value *> Args, BasicBlock *InsertAtEnd,
Context &Ctx, const Twine &NameStr) { … }
Value *CallBrInst::getIndirectDestLabel(unsigned Idx) const { … }
Value *CallBrInst::getIndirectDestLabelUse(unsigned Idx) const { … }
BasicBlock *CallBrInst::getDefaultDest() const { … }
BasicBlock *CallBrInst::getIndirectDest(unsigned Idx) const { … }
llvm::SmallVector<BasicBlock *, 16> CallBrInst::getIndirectDests() const { … }
void CallBrInst::setDefaultDest(BasicBlock *BB) { … }
void CallBrInst::setIndirectDest(unsigned Idx, BasicBlock *BB) { … }
BasicBlock *CallBrInst::getSuccessor(unsigned Idx) const { … }
LandingPadInst *LandingPadInst::create(Type *RetTy, unsigned NumReservedClauses,
BBIterator WhereIt, BasicBlock *WhereBB,
Context &Ctx, const Twine &Name) { … }
void LandingPadInst::setCleanup(bool V) { … }
Constant *LandingPadInst::getClause(unsigned Idx) const { … }
Value *FuncletPadInst::getParentPad() const { … }
void FuncletPadInst::setParentPad(Value *ParentPad) { … }
Value *FuncletPadInst::getArgOperand(unsigned Idx) const { … }
void FuncletPadInst::setArgOperand(unsigned Idx, Value *V) { … }
CatchSwitchInst *CatchPadInst::getCatchSwitch() const { … }
CatchPadInst *CatchPadInst::create(Value *ParentPad, ArrayRef<Value *> Args,
BBIterator WhereIt, BasicBlock *WhereBB,
Context &Ctx, const Twine &Name) { … }
CleanupPadInst *CleanupPadInst::create(Value *ParentPad, ArrayRef<Value *> Args,
BBIterator WhereIt, BasicBlock *WhereBB,
Context &Ctx, const Twine &Name) { … }
CatchReturnInst *CatchReturnInst::create(CatchPadInst *CatchPad, BasicBlock *BB,
BBIterator WhereIt,
BasicBlock *WhereBB, Context &Ctx) { … }
CatchPadInst *CatchReturnInst::getCatchPad() const { … }
void CatchReturnInst::setCatchPad(CatchPadInst *CatchPad) { … }
BasicBlock *CatchReturnInst::getSuccessor() const { … }
void CatchReturnInst::setSuccessor(BasicBlock *NewSucc) { … }
Value *CatchReturnInst::getCatchSwitchParentPad() const { … }
CleanupReturnInst *CleanupReturnInst::create(CleanupPadInst *CleanupPad,
BasicBlock *UnwindBB,
BBIterator WhereIt,
BasicBlock *WhereBB,
Context &Ctx) { … }
CleanupPadInst *CleanupReturnInst::getCleanupPad() const { … }
void CleanupReturnInst::setCleanupPad(CleanupPadInst *CleanupPad) { … }
BasicBlock *CleanupReturnInst::getUnwindDest() const { … }
void CleanupReturnInst::setUnwindDest(BasicBlock *NewDest) { … }
Value *GetElementPtrInst::create(Type *Ty, Value *Ptr,
ArrayRef<Value *> IdxList,
BasicBlock::iterator WhereIt,
BasicBlock *WhereBB, Context &Ctx,
const Twine &NameStr) { … }
Value *GetElementPtrInst::create(Type *Ty, Value *Ptr,
ArrayRef<Value *> IdxList,
Instruction *InsertBefore, Context &Ctx,
const Twine &NameStr) { … }
Value *GetElementPtrInst::create(Type *Ty, Value *Ptr,
ArrayRef<Value *> IdxList,
BasicBlock *InsertAtEnd, Context &Ctx,
const Twine &NameStr) { … }
Type *GetElementPtrInst::getSourceElementType() const { … }
Type *GetElementPtrInst::getResultElementType() const { … }
Value *GetElementPtrInst::getPointerOperand() const { … }
Type *GetElementPtrInst::getPointerOperandType() const { … }
BasicBlock *PHINode::LLVMBBToBB::operator()(llvm::BasicBlock *LLVMBB) const { … }
PHINode *PHINode::create(Type *Ty, unsigned NumReservedValues,
Instruction *InsertBefore, Context &Ctx,
const Twine &Name) { … }
bool PHINode::classof(const Value *From) { … }
Value *PHINode::getIncomingValue(unsigned Idx) const { … }
void PHINode::setIncomingValue(unsigned Idx, Value *V) { … }
BasicBlock *PHINode::getIncomingBlock(unsigned Idx) const { … }
BasicBlock *PHINode::getIncomingBlock(const Use &U) const { … }
void PHINode::setIncomingBlock(unsigned Idx, BasicBlock *BB) { … }
void PHINode::addIncoming(Value *V, BasicBlock *BB) { … }
Value *PHINode::removeIncomingValue(unsigned Idx) { … }
Value *PHINode::removeIncomingValue(BasicBlock *BB) { … }
int PHINode::getBasicBlockIndex(const BasicBlock *BB) const { … }
Value *PHINode::getIncomingValueForBlock(const BasicBlock *BB) const { … }
Value *PHINode::hasConstantValue() const { … }
void PHINode::replaceIncomingBlockWith(const BasicBlock *Old, BasicBlock *New) { … }
void PHINode::removeIncomingValueIf(function_ref<bool(unsigned)> Predicate) { … }
static llvm::Instruction::CastOps getLLVMCastOp(Instruction::Opcode Opc) { … }
static llvm::Instruction::UnaryOps getLLVMUnaryOp(Instruction::Opcode Opc) { … }
CatchSwitchInst *CatchSwitchInst::create(Value *ParentPad, BasicBlock *UnwindBB,
unsigned NumHandlers,
BBIterator WhereIt,
BasicBlock *WhereBB, Context &Ctx,
const Twine &Name) { … }
Value *CatchSwitchInst::getParentPad() const { … }
void CatchSwitchInst::setParentPad(Value *ParentPad) { … }
BasicBlock *CatchSwitchInst::getUnwindDest() const { … }
void CatchSwitchInst::setUnwindDest(BasicBlock *UnwindDest) { … }
void CatchSwitchInst::addHandler(BasicBlock *Dest) { … }
ResumeInst *ResumeInst::create(Value *Exn, BBIterator WhereIt,
BasicBlock *WhereBB, Context &Ctx) { … }
Value *ResumeInst::getValue() const { … }
SwitchInst *SwitchInst::create(Value *V, BasicBlock *Dest, unsigned NumCases,
BasicBlock::iterator WhereIt,
BasicBlock *WhereBB, Context &Ctx,
const Twine &Name) { … }
Value *SwitchInst::getCondition() const { … }
void SwitchInst::setCondition(Value *V) { … }
BasicBlock *SwitchInst::getDefaultDest() const { … }
void SwitchInst::setDefaultDest(BasicBlock *DefaultCase) { … }
ConstantInt *SwitchInst::findCaseDest(BasicBlock *BB) { … }
void SwitchInst::addCase(ConstantInt *OnVal, BasicBlock *Dest) { … }
SwitchInst::CaseIt SwitchInst::removeCase(CaseIt It) { … }
BasicBlock *SwitchInst::getSuccessor(unsigned Idx) const { … }
void SwitchInst::setSuccessor(unsigned Idx, BasicBlock *NewSucc) { … }
Value *UnaryOperator::create(Instruction::Opcode Op, Value *OpV,
BBIterator WhereIt, BasicBlock *WhereBB,
Context &Ctx, const Twine &Name) { … }
Value *UnaryOperator::create(Instruction::Opcode Op, Value *OpV,
Instruction *InsertBefore, Context &Ctx,
const Twine &Name) { … }
Value *UnaryOperator::create(Instruction::Opcode Op, Value *OpV,
BasicBlock *InsertAfter, Context &Ctx,
const Twine &Name) { … }
Value *UnaryOperator::createWithCopiedFlags(Instruction::Opcode Op, Value *OpV,
Value *CopyFrom, BBIterator WhereIt,
BasicBlock *WhereBB, Context &Ctx,
const Twine &Name) { … }
Value *UnaryOperator::createWithCopiedFlags(Instruction::Opcode Op, Value *OpV,
Value *CopyFrom,
Instruction *InsertBefore,
Context &Ctx, const Twine &Name) { … }
Value *UnaryOperator::createWithCopiedFlags(Instruction::Opcode Op, Value *OpV,
Value *CopyFrom,
BasicBlock *InsertAtEnd,
Context &Ctx, const Twine &Name) { … }
static llvm::Instruction::BinaryOps getLLVMBinaryOp(Instruction::Opcode Opc) { … }
Value *BinaryOperator::create(Instruction::Opcode Op, Value *LHS, Value *RHS,
BBIterator WhereIt, BasicBlock *WhereBB,
Context &Ctx, const Twine &Name) { … }
Value *BinaryOperator::create(Instruction::Opcode Op, Value *LHS, Value *RHS,
Instruction *InsertBefore, Context &Ctx,
const Twine &Name) { … }
Value *BinaryOperator::create(Instruction::Opcode Op, Value *LHS, Value *RHS,
BasicBlock *InsertAtEnd, Context &Ctx,
const Twine &Name) { … }
Value *BinaryOperator::createWithCopiedFlags(Instruction::Opcode Op, Value *LHS,
Value *RHS, Value *CopyFrom,
BBIterator WhereIt,
BasicBlock *WhereBB, Context &Ctx,
const Twine &Name) { … }
Value *BinaryOperator::createWithCopiedFlags(Instruction::Opcode Op, Value *LHS,
Value *RHS, Value *CopyFrom,
Instruction *InsertBefore,
Context &Ctx, const Twine &Name) { … }
Value *BinaryOperator::createWithCopiedFlags(Instruction::Opcode Op, Value *LHS,
Value *RHS, Value *CopyFrom,
BasicBlock *InsertAtEnd,
Context &Ctx, const Twine &Name) { … }
void PossiblyDisjointInst::setIsDisjoint(bool B) { … }
void AtomicRMWInst::setAlignment(Align Align) { … }
void AtomicRMWInst::setVolatile(bool V) { … }
void AtomicRMWInst::setOrdering(AtomicOrdering Ordering) { … }
void AtomicRMWInst::setSyncScopeID(SyncScope::ID SSID) { … }
Value *AtomicRMWInst::getPointerOperand() { … }
Value *AtomicRMWInst::getValOperand() { … }
AtomicRMWInst *AtomicRMWInst::create(BinOp Op, Value *Ptr, Value *Val,
MaybeAlign Align, AtomicOrdering Ordering,
BBIterator WhereIt, BasicBlock *WhereBB,
Context &Ctx, SyncScope::ID SSID,
const Twine &Name) { … }
AtomicRMWInst *AtomicRMWInst::create(BinOp Op, Value *Ptr, Value *Val,
MaybeAlign Align, AtomicOrdering Ordering,
Instruction *InsertBefore, Context &Ctx,
SyncScope::ID SSID, const Twine &Name) { … }
AtomicRMWInst *AtomicRMWInst::create(BinOp Op, Value *Ptr, Value *Val,
MaybeAlign Align, AtomicOrdering Ordering,
BasicBlock *InsertAtEnd, Context &Ctx,
SyncScope::ID SSID, const Twine &Name) { … }
void AtomicCmpXchgInst::setSyncScopeID(SyncScope::ID SSID) { … }
Value *AtomicCmpXchgInst::getPointerOperand() { … }
Value *AtomicCmpXchgInst::getCompareOperand() { … }
Value *AtomicCmpXchgInst::getNewValOperand() { … }
AtomicCmpXchgInst *
AtomicCmpXchgInst::create(Value *Ptr, Value *Cmp, Value *New, MaybeAlign Align,
AtomicOrdering SuccessOrdering,
AtomicOrdering FailureOrdering, BBIterator WhereIt,
BasicBlock *WhereBB, Context &Ctx, SyncScope::ID SSID,
const Twine &Name) { … }
AtomicCmpXchgInst *AtomicCmpXchgInst::create(Value *Ptr, Value *Cmp, Value *New,
MaybeAlign Align,
AtomicOrdering SuccessOrdering,
AtomicOrdering FailureOrdering,
Instruction *InsertBefore,
Context &Ctx, SyncScope::ID SSID,
const Twine &Name) { … }
AtomicCmpXchgInst *AtomicCmpXchgInst::create(Value *Ptr, Value *Cmp, Value *New,
MaybeAlign Align,
AtomicOrdering SuccessOrdering,
AtomicOrdering FailureOrdering,
BasicBlock *InsertAtEnd,
Context &Ctx, SyncScope::ID SSID,
const Twine &Name) { … }
void AtomicCmpXchgInst::setAlignment(Align Align) { … }
void AtomicCmpXchgInst::setVolatile(bool V) { … }
void AtomicCmpXchgInst::setWeak(bool IsWeak) { … }
void AtomicCmpXchgInst::setSuccessOrdering(AtomicOrdering Ordering) { … }
void AtomicCmpXchgInst::setFailureOrdering(AtomicOrdering Ordering) { … }
AllocaInst *AllocaInst::create(Type *Ty, unsigned AddrSpace, BBIterator WhereIt,
BasicBlock *WhereBB, Context &Ctx,
Value *ArraySize, const Twine &Name) { … }
AllocaInst *AllocaInst::create(Type *Ty, unsigned AddrSpace,
Instruction *InsertBefore, Context &Ctx,
Value *ArraySize, const Twine &Name) { … }
AllocaInst *AllocaInst::create(Type *Ty, unsigned AddrSpace,
BasicBlock *InsertAtEnd, Context &Ctx,
Value *ArraySize, const Twine &Name) { … }
Type *AllocaInst::getAllocatedType() const { … }
void AllocaInst::setAllocatedType(Type *Ty) { … }
void AllocaInst::setAlignment(Align Align) { … }
void AllocaInst::setUsedWithInAlloca(bool V) { … }
Value *AllocaInst::getArraySize() { … }
PointerType *AllocaInst::getType() const { … }
Value *CastInst::create(Type *DestTy, Opcode Op, Value *Operand,
BBIterator WhereIt, BasicBlock *WhereBB, Context &Ctx,
const Twine &Name) { … }
Value *CastInst::create(Type *DestTy, Opcode Op, Value *Operand,
Instruction *InsertBefore, Context &Ctx,
const Twine &Name) { … }
Value *CastInst::create(Type *DestTy, Opcode Op, Value *Operand,
BasicBlock *InsertAtEnd, Context &Ctx,
const Twine &Name) { … }
bool CastInst::classof(const Value *From) { … }
Type *CastInst::getSrcTy() const { … }
Type *CastInst::getDestTy() const { … }
void PossiblyNonNegInst::setNonNeg(bool B) { … }
Value *InsertElementInst::create(Value *Vec, Value *NewElt, Value *Idx,
Instruction *InsertBefore, Context &Ctx,
const Twine &Name) { … }
Value *InsertElementInst::create(Value *Vec, Value *NewElt, Value *Idx,
BasicBlock *InsertAtEnd, Context &Ctx,
const Twine &Name) { … }
Value *ExtractElementInst::create(Value *Vec, Value *Idx,
Instruction *InsertBefore, Context &Ctx,
const Twine &Name) { … }
Value *ExtractElementInst::create(Value *Vec, Value *Idx,
BasicBlock *InsertAtEnd, Context &Ctx,
const Twine &Name) { … }
Value *ShuffleVectorInst::create(Value *V1, Value *V2, Value *Mask,
Instruction *InsertBefore, Context &Ctx,
const Twine &Name) { … }
Value *ShuffleVectorInst::create(Value *V1, Value *V2, Value *Mask,
BasicBlock *InsertAtEnd, Context &Ctx,
const Twine &Name) { … }
Value *ShuffleVectorInst::create(Value *V1, Value *V2, ArrayRef<int> Mask,
Instruction *InsertBefore, Context &Ctx,
const Twine &Name) { … }
Value *ShuffleVectorInst::create(Value *V1, Value *V2, ArrayRef<int> Mask,
BasicBlock *InsertAtEnd, Context &Ctx,
const Twine &Name) { … }
void ShuffleVectorInst::setShuffleMask(ArrayRef<int> Mask) { … }
VectorType *ShuffleVectorInst::getType() const { … }
void ShuffleVectorInst::commute() { … }
Constant *ShuffleVectorInst::getShuffleMaskForBitcode() const { … }
Constant *ShuffleVectorInst::convertShuffleMaskForBitcode(ArrayRef<int> Mask,
Type *ResultTy) { … }
VectorType *ExtractElementInst::getVectorOperandType() const { … }
Value *ExtractValueInst::create(Value *Agg, ArrayRef<unsigned> Idxs,
BBIterator WhereIt, BasicBlock *WhereBB,
Context &Ctx, const Twine &Name) { … }
Type *ExtractValueInst::getIndexedType(Type *Agg, ArrayRef<unsigned> Idxs) { … }
Value *InsertValueInst::create(Value *Agg, Value *Val, ArrayRef<unsigned> Idxs,
BBIterator WhereIt, BasicBlock *WhereBB,
Context &Ctx, const Twine &Name) { … }
#ifndef NDEBUG
void Constant::dumpOS(raw_ostream &OS) const {
dumpCommonPrefix(OS);
dumpCommonSuffix(OS);
}
#endif
ConstantInt *ConstantInt::getTrue(Context &Ctx) { … }
ConstantInt *ConstantInt::getFalse(Context &Ctx) { … }
ConstantInt *ConstantInt::getBool(Context &Ctx, bool V) { … }
Constant *ConstantInt::getTrue(Type *Ty) { … }
Constant *ConstantInt::getFalse(Type *Ty) { … }
Constant *ConstantInt::getBool(Type *Ty, bool V) { … }
ConstantInt *ConstantInt::get(Type *Ty, uint64_t V, bool IsSigned) { … }
ConstantInt *ConstantInt::get(IntegerType *Ty, uint64_t V, bool IsSigned) { … }
ConstantInt *ConstantInt::getSigned(IntegerType *Ty, int64_t V) { … }
Constant *ConstantInt::getSigned(Type *Ty, int64_t V) { … }
ConstantInt *ConstantInt::get(Context &Ctx, const APInt &V) { … }
ConstantInt *ConstantInt::get(IntegerType *Ty, StringRef Str, uint8_t Radix) { … }
Constant *ConstantInt::get(Type *Ty, const APInt &V) { … }
IntegerType *ConstantInt::getIntegerType() const { … }
bool ConstantInt::isValueValidForType(Type *Ty, uint64_t V) { … }
bool ConstantInt::isValueValidForType(Type *Ty, int64_t V) { … }
Constant *ConstantFP::get(Type *Ty, double V) { … }
Constant *ConstantFP::get(Type *Ty, const APFloat &V) { … }
Constant *ConstantFP::get(Type *Ty, StringRef Str) { … }
ConstantFP *ConstantFP::get(const APFloat &V, Context &Ctx) { … }
Constant *ConstantFP::getNaN(Type *Ty, bool Negative, uint64_t Payload) { … }
Constant *ConstantFP::getQNaN(Type *Ty, bool Negative, APInt *Payload) { … }
Constant *ConstantFP::getSNaN(Type *Ty, bool Negative, APInt *Payload) { … }
Constant *ConstantFP::getZero(Type *Ty, bool Negative) { … }
Constant *ConstantFP::getNegativeZero(Type *Ty) { … }
Constant *ConstantFP::getInfinity(Type *Ty, bool Negative) { … }
bool ConstantFP::isValueValidForType(Type *Ty, const APFloat &V) { … }
Constant *ConstantArray::get(ArrayType *T, ArrayRef<Constant *> V) { … }
ArrayType *ConstantArray::getType() const { … }
Constant *ConstantStruct::get(StructType *T, ArrayRef<Constant *> V) { … }
StructType *ConstantStruct::getTypeForElements(Context &Ctx,
ArrayRef<Constant *> V,
bool Packed) { … }
ConstantAggregateZero *ConstantAggregateZero::get(Type *Ty) { … }
Constant *ConstantAggregateZero::getSequentialElement() const { … }
Constant *ConstantAggregateZero::getStructElement(unsigned Elt) const { … }
Constant *ConstantAggregateZero::getElementValue(Constant *C) const { … }
Constant *ConstantAggregateZero::getElementValue(unsigned Idx) const { … }
ConstantPointerNull *ConstantPointerNull::get(PointerType *Ty) { … }
PointerType *ConstantPointerNull::getType() const { … }
UndefValue *UndefValue::get(Type *T) { … }
UndefValue *UndefValue::getSequentialElement() const { … }
UndefValue *UndefValue::getStructElement(unsigned Elt) const { … }
UndefValue *UndefValue::getElementValue(Constant *C) const { … }
UndefValue *UndefValue::getElementValue(unsigned Idx) const { … }
PoisonValue *PoisonValue::get(Type *T) { … }
PoisonValue *PoisonValue::getSequentialElement() const { … }
PoisonValue *PoisonValue::getStructElement(unsigned Elt) const { … }
PoisonValue *PoisonValue::getElementValue(Constant *C) const { … }
PoisonValue *PoisonValue::getElementValue(unsigned Idx) const { … }
void GlobalObject::setAlignment(MaybeAlign Align) { … }
void GlobalObject::setGlobalObjectSubClassData(unsigned V) { … }
void GlobalObject::setSection(StringRef S) { … }
template <typename GlobalT, typename LLVMGlobalT, typename ParentT,
typename LLVMParentT>
GlobalT &GlobalWithNodeAPI<GlobalT, LLVMGlobalT, ParentT, LLVMParentT>::
LLVMGVToGV::operator()(LLVMGlobalT &LLVMGV) const { … }
namespace llvm::sandboxir {
template class GlobalWithNodeAPI<GlobalIFunc, llvm::GlobalIFunc, GlobalObject,
llvm::GlobalObject>;
template class GlobalWithNodeAPI<Function, llvm::Function, GlobalObject,
llvm::GlobalObject>;
}
void GlobalIFunc::setResolver(Constant *Resolver) { … }
Constant *GlobalIFunc::getResolver() const { … }
Function *GlobalIFunc::getResolverFunction() { … }
void GlobalValue::setUnnamedAddr(UnnamedAddr V) { … }
void GlobalValue::setVisibility(VisibilityTypes V) { … }
BlockAddress *BlockAddress::get(Function *F, BasicBlock *BB) { … }
BlockAddress *BlockAddress::get(BasicBlock *BB) { … }
BlockAddress *BlockAddress::lookup(const BasicBlock *BB) { … }
Function *BlockAddress::getFunction() const { … }
BasicBlock *BlockAddress::getBasicBlock() const { … }
DSOLocalEquivalent *DSOLocalEquivalent::get(GlobalValue *GV) { … }
GlobalValue *DSOLocalEquivalent::getGlobalValue() const { … }
ConstantTokenNone *ConstantTokenNone::get(Context &Ctx) { … }
FunctionType *Function::getFunctionType() const { … }
#ifndef NDEBUG
void Function::dumpNameAndArgs(raw_ostream &OS) const {
auto *F = cast<llvm::Function>(Val);
OS << *F->getReturnType() << " @" << F->getName() << "(";
interleave(
F->args(),
[this, &OS](const llvm::Argument &LLVMArg) {
auto *SBArg = cast_or_null<Argument>(Ctx.getValue(&LLVMArg));
if (SBArg == nullptr)
OS << "NULL";
else
SBArg->printAsOperand(OS);
},
[&] { OS << ", "; });
OS << ")";
}
void Function::dumpOS(raw_ostream &OS) const {
dumpNameAndArgs(OS);
OS << " {\n";
auto *LLVMF = cast<llvm::Function>(Val);
interleave(
*LLVMF,
[this, &OS](const llvm::BasicBlock &LLVMBB) {
auto *BB = cast_or_null<BasicBlock>(Ctx.getValue(&LLVMBB));
if (BB == nullptr)
OS << "NULL";
else
OS << *BB;
},
[&OS] { OS << "\n"; });
OS << "}\n";
}
#endif
BasicBlock::iterator::pointer
BasicBlock::iterator::getInstr(llvm::BasicBlock::iterator It) const { … }
std::unique_ptr<Value> Context::detachLLVMValue(llvm::Value *V) { … }
std::unique_ptr<Value> Context::detach(Value *V) { … }
Value *Context::registerValue(std::unique_ptr<Value> &&VPtr) { … }
Value *Context::getOrCreateValueInternal(llvm::Value *LLVMV, llvm::User *U) { … }
BasicBlock *Context::createBasicBlock(llvm::BasicBlock *LLVMBB) { … }
VAArgInst *Context::createVAArgInst(llvm::VAArgInst *SI) { … }
FreezeInst *Context::createFreezeInst(llvm::FreezeInst *SI) { … }
FenceInst *Context::createFenceInst(llvm::FenceInst *SI) { … }
SelectInst *Context::createSelectInst(llvm::SelectInst *SI) { … }
ExtractElementInst *
Context::createExtractElementInst(llvm::ExtractElementInst *EEI) { … }
InsertElementInst *
Context::createInsertElementInst(llvm::InsertElementInst *IEI) { … }
ShuffleVectorInst *
Context::createShuffleVectorInst(llvm::ShuffleVectorInst *SVI) { … }
ExtractValueInst *Context::createExtractValueInst(llvm::ExtractValueInst *EVI) { … }
InsertValueInst *Context::createInsertValueInst(llvm::InsertValueInst *IVI) { … }
BranchInst *Context::createBranchInst(llvm::BranchInst *BI) { … }
LoadInst *Context::createLoadInst(llvm::LoadInst *LI) { … }
StoreInst *Context::createStoreInst(llvm::StoreInst *SI) { … }
ReturnInst *Context::createReturnInst(llvm::ReturnInst *I) { … }
CallInst *Context::createCallInst(llvm::CallInst *I) { … }
InvokeInst *Context::createInvokeInst(llvm::InvokeInst *I) { … }
CallBrInst *Context::createCallBrInst(llvm::CallBrInst *I) { … }
UnreachableInst *Context::createUnreachableInst(llvm::UnreachableInst *UI) { … }
LandingPadInst *Context::createLandingPadInst(llvm::LandingPadInst *I) { … }
CatchPadInst *Context::createCatchPadInst(llvm::CatchPadInst *I) { … }
CleanupPadInst *Context::createCleanupPadInst(llvm::CleanupPadInst *I) { … }
CatchReturnInst *Context::createCatchReturnInst(llvm::CatchReturnInst *I) { … }
CleanupReturnInst *
Context::createCleanupReturnInst(llvm::CleanupReturnInst *I) { … }
GetElementPtrInst *
Context::createGetElementPtrInst(llvm::GetElementPtrInst *I) { … }
CatchSwitchInst *Context::createCatchSwitchInst(llvm::CatchSwitchInst *I) { … }
ResumeInst *Context::createResumeInst(llvm::ResumeInst *I) { … }
SwitchInst *Context::createSwitchInst(llvm::SwitchInst *I) { … }
UnaryOperator *Context::createUnaryOperator(llvm::UnaryOperator *I) { … }
BinaryOperator *Context::createBinaryOperator(llvm::BinaryOperator *I) { … }
AtomicRMWInst *Context::createAtomicRMWInst(llvm::AtomicRMWInst *I) { … }
AtomicCmpXchgInst *
Context::createAtomicCmpXchgInst(llvm::AtomicCmpXchgInst *I) { … }
AllocaInst *Context::createAllocaInst(llvm::AllocaInst *I) { … }
CastInst *Context::createCastInst(llvm::CastInst *I) { … }
PHINode *Context::createPHINode(llvm::PHINode *I) { … }
ICmpInst *Context::createICmpInst(llvm::ICmpInst *I) { … }
FCmpInst *Context::createFCmpInst(llvm::FCmpInst *I) { … }
CmpInst *CmpInst::create(Predicate P, Value *S1, Value *S2,
Instruction *InsertBefore, Context &Ctx,
const Twine &Name) { … }
CmpInst *CmpInst::createWithCopiedFlags(Predicate P, Value *S1, Value *S2,
const Instruction *F,
Instruction *InsertBefore, Context &Ctx,
const Twine &Name) { … }
Type *CmpInst::makeCmpResultType(Type *OpndType) { … }
void CmpInst::setPredicate(Predicate P) { … }
void CmpInst::swapOperands() { … }
void ICmpInst::swapOperands() { … }
void FCmpInst::swapOperands() { … }
#ifndef NDEBUG
void CmpInst::dumpOS(raw_ostream &OS) const {
dumpCommonPrefix(OS);
dumpCommonSuffix(OS);
}
void CmpInst::dump() const {
dumpOS(dbgs());
dbgs() << "\n";
}
#endif
Value *Context::getValue(llvm::Value *V) const { … }
Function *Context::createFunction(llvm::Function *F) { … }
Function *BasicBlock::getParent() const { … }
void BasicBlock::buildBasicBlockFromLLVMIR(llvm::BasicBlock *LLVMBB) { … }
BasicBlock::iterator BasicBlock::begin() const { … }
Instruction *BasicBlock::getTerminator() const { … }
Instruction &BasicBlock::front() const { … }
Instruction &BasicBlock::back() const { … }
#ifndef NDEBUG
void BasicBlock::dumpOS(raw_ostream &OS) const {
llvm::BasicBlock *BB = cast<llvm::BasicBlock>(Val);
const auto &Name = BB->getName();
OS << Name;
if (!Name.empty())
OS << ":\n";
if (any_of(*BB, [this](llvm::Instruction &I) {
return Ctx.getValue(&I) == nullptr;
})) {
OS << "<Crash-proof mode!>\n";
DenseSet<Instruction *> Visited;
for (llvm::Instruction &IRef : *BB) {
Value *SBV = Ctx.getValue(&IRef);
if (SBV == nullptr)
OS << IRef << " *** No SandboxIR ***\n";
else {
auto *SBI = dyn_cast<Instruction>(SBV);
if (SBI == nullptr) {
OS << IRef << " *** Not a SBInstruction!!! ***\n";
} else {
if (Visited.insert(SBI).second)
OS << *SBI << "\n";
}
}
}
} else {
for (auto &SBI : *this) {
SBI.dumpOS(OS);
OS << "\n";
}
}
}
void BasicBlock::verify() const {
assert(isa<llvm::BasicBlock>(Val) && "Expected BasicBlock!");
for (const auto &I : *this) {
I.verify();
}
}
#endif