LLVM 19.0.0git
SandboxIR.cpp
Go to the documentation of this file.
1//===- SandboxIR.cpp - A transactional overlay IR on top of LLVM IR -------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
11#include "llvm/IR/Constants.h"
12#include "llvm/Support/Debug.h"
13#include <sstream>
14
15using namespace llvm::sandboxir;
16
17Value *Use::get() const { return Ctx->getValue(LLVMUse->get()); }
18
19unsigned Use::getOperandNo() const { return Usr->getUseOperandNo(*this); }
20
21#ifndef NDEBUG
22void Use::dump(raw_ostream &OS) const {
23 Value *Def = nullptr;
24 if (LLVMUse == nullptr)
25 OS << "<null> LLVM Use! ";
26 else
27 Def = Ctx->getValue(LLVMUse->get());
28 OS << "Def: ";
29 if (Def == nullptr)
30 OS << "NULL";
31 else
32 OS << *Def;
33 OS << "\n";
34
35 OS << "User: ";
36 if (Usr == nullptr)
37 OS << "NULL";
38 else
39 OS << *Usr;
40 OS << "\n";
41
42 OS << "OperandNo: ";
43 if (Usr == nullptr)
44 OS << "N/A";
45 else
46 OS << getOperandNo();
47 OS << "\n";
48}
49
50void Use::dump() const { dump(dbgs()); }
51#endif // NDEBUG
52
54
56 assert(Use.LLVMUse != nullptr && "Already at end!");
57 User *User = Use.getUser();
58 Use = User->getOperandUseInternal(Use.getOperandNo() + 1, /*Verify=*/false);
59 return *this;
60}
61
63 llvm::Use *&LLVMUse = Use.LLVMUse;
64 assert(LLVMUse != nullptr && "Already at end!");
65 LLVMUse = LLVMUse->getNext();
66 if (LLVMUse == nullptr) {
67 Use.Usr = nullptr;
68 return *this;
69 }
70 auto *Ctx = Use.Ctx;
71 auto *LLVMUser = LLVMUse->getUser();
72 Use.Usr = cast_or_null<sandboxir::User>(Ctx->getValue(LLVMUser));
73 return *this;
74}
75
76Value::Value(ClassID SubclassID, llvm::Value *Val, Context &Ctx)
77 : SubclassID(SubclassID), Val(Val), Ctx(Ctx) {
78#ifndef NDEBUG
80#endif
81}
82
84 llvm::Use *LLVMUse = nullptr;
85 if (Val->use_begin() != Val->use_end())
86 LLVMUse = &*Val->use_begin();
87 User *User = LLVMUse != nullptr ? cast_or_null<sandboxir::User>(Ctx.getValue(
88 Val->use_begin()->getUser()))
89 : nullptr;
90 return use_iterator(Use(LLVMUse, User, Ctx));
91}
92
94 auto UseBegin = Val->use_begin();
95 auto UseEnd = Val->use_end();
96 bool AtEnd = UseBegin == UseEnd;
97 llvm::Use *LLVMUse = AtEnd ? nullptr : &*UseBegin;
98 User *User =
99 AtEnd ? nullptr
100 : cast_or_null<sandboxir::User>(Ctx.getValue(&*LLVMUse->getUser()));
101 return user_iterator(Use(LLVMUse, User, Ctx), UseToUser());
102}
103
104unsigned Value::getNumUses() const { return range_size(Val->users()); }
105
107 Value *OtherV, llvm::function_ref<bool(const Use &)> ShouldReplace) {
108 assert(getType() == OtherV->getType() && "Can't replace with different type");
109 llvm::Value *OtherVal = OtherV->Val;
111 OtherVal, [&ShouldReplace, this](llvm::Use &LLVMUse) -> bool {
112 User *DstU = cast_or_null<User>(Ctx.getValue(LLVMUse.getUser()));
113 if (DstU == nullptr)
114 return false;
115 return ShouldReplace(Use(&LLVMUse, DstU, Ctx));
116 });
117}
118
120 assert(getType() == Other->getType() &&
121 "Replacing with Value of different type!");
123}
124
125#ifndef NDEBUG
126std::string Value::getName() const {
127 std::stringstream SS;
128 SS << "SB" << UID << ".";
129 return SS.str();
130}
131
133 OS << getName() << " " << getSubclassIDStr(SubclassID) << " ";
134}
135
137 OS.indent(2) << "Val: ";
138 if (Val)
139 OS << *Val;
140 else
141 OS << "NULL";
142 OS << "\n";
143}
144
146 if (Val)
147 OS << *Val;
148 else
149 OS << "NULL ";
150}
151
153 OS << " ; " << getName() << " (" << getSubclassIDStr(SubclassID) << ")";
154}
155
157 if (Val)
159 else
160 OS << "NULL ";
161}
162
165}
169}
170void Argument::dump() const {
171 dump(dbgs());
172 dbgs() << "\n";
173}
174#endif // NDEBUG
175
176Use User::getOperandUseDefault(unsigned OpIdx, bool Verify) const {
177 assert((!Verify || OpIdx < getNumOperands()) && "Out of bounds!");
178 assert(isa<llvm::User>(Val) && "Non-users have no operands!");
179 llvm::Use *LLVMUse;
180 if (OpIdx != getNumOperands())
181 LLVMUse = &cast<llvm::User>(Val)->getOperandUse(OpIdx);
182 else
183 LLVMUse = cast<llvm::User>(Val)->op_end();
184 return Use(LLVMUse, const_cast<User *>(this), Ctx);
185}
186
187#ifndef NDEBUG
189 assert(Ctx.getValue(Use.getUser()) == this &&
190 "Use not found in this SBUser's operands!");
191}
192#endif
193
195 switch (From->getSubclassID()) {
196#define DEF_VALUE(ID, CLASS)
197#define DEF_USER(ID, CLASS) \
198 case ClassID::ID: \
199 return true;
200#define DEF_INSTR(ID, OPC, CLASS) \
201 case ClassID::ID: \
202 return true;
203#include "llvm/SandboxIR/SandboxIRValues.def"
204 default:
205 return false;
206 }
207}
208
209void User::setOperand(unsigned OperandIdx, Value *Operand) {
210 assert(isa<llvm::User>(Val) && "No operands!");
211 cast<llvm::User>(Val)->setOperand(OperandIdx, Operand->Val);
212}
213
215 return cast<llvm::User>(Val)->replaceUsesOfWith(FromV->Val, ToV->Val);
216}
217
218#ifndef NDEBUG
221 // TODO: This is incomplete
222}
223#endif // NDEBUG
224
226 auto ItE = BB->end();
227 assert(It != ItE && "Already at end!");
228 ++It;
229 if (It == ItE)
230 return *this;
231 Instruction &NextI = *cast<sandboxir::Instruction>(Ctx->getValue(&*It));
232 unsigned Num = NextI.getNumOfIRInstrs();
233 assert(Num > 0 && "Bad getNumOfIRInstrs()");
234 It = std::next(It, Num - 1);
235 return *this;
236}
237
239 assert(It != BB->begin() && "Already at begin!");
240 if (It == BB->end()) {
241 --It;
242 return *this;
243 }
244 Instruction &CurrI = **this;
245 unsigned Num = CurrI.getNumOfIRInstrs();
246 assert(Num > 0 && "Bad getNumOfIRInstrs()");
247 assert(std::prev(It, Num - 1) != BB->begin() && "Already at begin!");
248 It = std::prev(It, Num);
249 return *this;
250}
251
253 switch (Opc) {
254#define DEF_VALUE(ID, CLASS)
255#define DEF_USER(ID, CLASS)
256#define OP(OPC) \
257 case Opcode::OPC: \
258 return #OPC;
259#define DEF_INSTR(ID, OPC, CLASS) OPC
260#include "llvm/SandboxIR/SandboxIRValues.def"
261 }
262 llvm_unreachable("Unknown Opcode");
263}
264
266 switch (From->getSubclassID()) {
267#define DEF_INSTR(ID, OPC, CLASS) \
268 case ClassID::ID: \
269 return true;
270#include "llvm/SandboxIR/SandboxIRValues.def"
271 default:
272 return false;
273 }
274}
275
276#ifndef NDEBUG
278 OS << "Unimplemented! Please override dump().";
279}
280void Instruction::dump() const {
281 dump(dbgs());
282 dbgs() << "\n";
283}
284
288}
289
290void OpaqueInst::dump() const {
291 dump(dbgs());
292 dbgs() << "\n";
293}
294
298}
299
300void Constant::dump() const {
301 dump(dbgs());
302 dbgs() << "\n";
303}
304
306 auto *F = cast<llvm::Function>(Val);
307 OS << *F->getReturnType() << " @" << F->getName() << "(";
309 F->args(),
310 [this, &OS](const llvm::Argument &LLVMArg) {
311 auto *SBArg = cast_or_null<Argument>(Ctx.getValue(&LLVMArg));
312 if (SBArg == nullptr)
313 OS << "NULL";
314 else
315 SBArg->printAsOperand(OS);
316 },
317 [&] { OS << ", "; });
318 OS << ")";
319}
322 OS << " {\n";
323 auto *LLVMF = cast<llvm::Function>(Val);
325 *LLVMF,
326 [this, &OS](const llvm::BasicBlock &LLVMBB) {
327 auto *BB = cast_or_null<BasicBlock>(Ctx.getValue(&LLVMBB));
328 if (BB == nullptr)
329 OS << "NULL";
330 else
331 OS << *BB;
332 },
333 [&OS] { OS << "\n"; });
334 OS << "}\n";
335}
336void Function::dump() const {
337 dump(dbgs());
338 dbgs() << "\n";
339}
340#endif // NDEBUG
341
343BasicBlock::iterator::getInstr(llvm::BasicBlock::iterator It) const {
344 return cast_or_null<Instruction>(Ctx->getValue(&*It));
345}
346
347Value *Context::registerValue(std::unique_ptr<Value> &&VPtr) {
348 assert(VPtr->getSubclassID() != Value::ClassID::User &&
349 "Can't register a user!");
350 Value *V = VPtr.get();
351 llvm::Value *Key = V->Val;
352 LLVMValueToValueMap[Key] = std::move(VPtr);
353 return V;
354}
355
357 auto Pair = LLVMValueToValueMap.insert({LLVMV, nullptr});
358 auto It = Pair.first;
359 if (!Pair.second)
360 return It->second.get();
361
362 if (auto *C = dyn_cast<llvm::Constant>(LLVMV)) {
363 It->second = std::unique_ptr<Constant>(new Constant(C, *this));
364 auto *NewC = It->second.get();
365 for (llvm::Value *COp : C->operands())
367 return NewC;
368 }
369 if (auto *Arg = dyn_cast<llvm::Argument>(LLVMV)) {
370 It->second = std::unique_ptr<Argument>(new Argument(Arg, *this));
371 return It->second.get();
372 }
373 if (auto *BB = dyn_cast<llvm::BasicBlock>(LLVMV)) {
374 assert(isa<BlockAddress>(U) &&
375 "This won't create a SBBB, don't call this function directly!");
376 if (auto *SBBB = getValue(BB))
377 return SBBB;
378 return nullptr;
379 }
380 assert(isa<llvm::Instruction>(LLVMV) && "Expected Instruction");
381 It->second = std::unique_ptr<OpaqueInst>(
382 new OpaqueInst(cast<llvm::Instruction>(LLVMV), *this));
383 return It->second.get();
384}
385
387 assert(getValue(LLVMBB) == nullptr && "Already exists!");
388 auto NewBBPtr = std::unique_ptr<BasicBlock>(new BasicBlock(LLVMBB, *this));
389 auto *BB = cast<BasicBlock>(registerValue(std::move(NewBBPtr)));
390 // Create SandboxIR for BB's body.
391 BB->buildBasicBlockFromLLVMIR(LLVMBB);
392 return BB;
393}
394
396 auto It = LLVMValueToValueMap.find(V);
397 if (It != LLVMValueToValueMap.end())
398 return It->second.get();
399 return nullptr;
400}
401
403 assert(getValue(F) == nullptr && "Already exists!");
404 auto NewFPtr = std::unique_ptr<Function>(new Function(F, *this));
405 // Create arguments.
406 for (auto &Arg : F->args())
408 // Create BBs.
409 for (auto &BB : *F)
410 createBasicBlock(&BB);
411 auto *SBF = cast<Function>(registerValue(std::move(NewFPtr)));
412 return SBF;
413}
414
416 auto *BB = cast<llvm::BasicBlock>(Val);
417 auto *F = BB->getParent();
418 if (F == nullptr)
419 // Detached
420 return nullptr;
421 return cast_or_null<Function>(Ctx.getValue(F));
422}
423
424void BasicBlock::buildBasicBlockFromLLVMIR(llvm::BasicBlock *LLVMBB) {
425 for (llvm::Instruction &IRef : reverse(*LLVMBB)) {
426 llvm::Instruction *I = &IRef;
428 for (auto [OpIdx, Op] : enumerate(I->operands())) {
429 // Skip instruction's label operands
430 if (isa<llvm::BasicBlock>(Op))
431 continue;
432 // Skip metadata
433 if (isa<llvm::MetadataAsValue>(Op))
434 continue;
435 // Skip asm
436 if (isa<llvm::InlineAsm>(Op))
437 continue;
439 }
440 }
441#if !defined(NDEBUG) && defined(SBVEC_EXPENSIVE_CHECKS)
442 verify();
443#endif
444}
445
447 llvm::BasicBlock *BB = cast<llvm::BasicBlock>(Val);
449 if (!BB->empty()) {
450 auto *V = Ctx.getValue(&*BB->begin());
451 assert(V != nullptr && "No SandboxIR for BB->begin()!");
452 auto *I = cast<Instruction>(V);
453 unsigned Num = I->getNumOfIRInstrs();
454 assert(Num >= 1u && "Bad getNumOfIRInstrs()");
455 It = std::next(It, Num - 1);
456 }
457 return iterator(BB, It, &Ctx);
458}
459
461 auto *TerminatorV =
462 Ctx.getValue(cast<llvm::BasicBlock>(Val)->getTerminator());
463 return cast_or_null<Instruction>(TerminatorV);
464}
465
467 auto *BB = cast<llvm::BasicBlock>(Val);
468 assert(!BB->empty() && "Empty block!");
469 auto *SBI = cast<Instruction>(getContext().getValue(&*BB->begin()));
470 assert(SBI != nullptr && "Expected Instr!");
471 return *SBI;
472}
473
475 auto *BB = cast<llvm::BasicBlock>(Val);
476 assert(!BB->empty() && "Empty block!");
477 auto *SBI = cast<Instruction>(getContext().getValue(&*BB->rbegin()));
478 assert(SBI != nullptr && "Expected Instr!");
479 return *SBI;
480}
481
482#ifndef NDEBUG
484 llvm::BasicBlock *BB = cast<llvm::BasicBlock>(Val);
485 const auto &Name = BB->getName();
486 OS << Name;
487 if (!Name.empty())
488 OS << ":\n";
489 // If there are Instructions in the BB that are not mapped to SandboxIR, then
490 // use a crash-proof dump.
491 if (any_of(*BB, [this](llvm::Instruction &I) {
492 return Ctx.getValue(&I) == nullptr;
493 })) {
494 OS << "<Crash-proof mode!>\n";
496 for (llvm::Instruction &IRef : *BB) {
497 Value *SBV = Ctx.getValue(&IRef);
498 if (SBV == nullptr)
499 OS << IRef << " *** No SandboxIR ***\n";
500 else {
501 auto *SBI = dyn_cast<Instruction>(SBV);
502 if (SBI == nullptr) {
503 OS << IRef << " *** Not a SBInstruction!!! ***\n";
504 } else {
505 if (Visited.insert(SBI).second)
506 OS << *SBI << "\n";
507 }
508 }
509 }
510 } else {
511 for (auto &SBI : *this) {
512 SBI.dump(OS);
513 OS << "\n";
514 }
515 }
516}
517void BasicBlock::dump() const {
518 dump(dbgs());
519 dbgs() << "\n";
520}
521#endif // NDEBUG
BlockVerifier::State From
This file contains the declarations for the subclasses of Constant, which represent the different fla...
std::string Name
#define F(x, y, z)
Definition: MD5.cpp:55
#define I(x, y, z)
Definition: MD5.cpp:58
ppc ctr loops PowerPC CTR Loops Verify
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
raw_pwrite_stream & OS
This file defines the SmallPtrSet class.
This class represents an incoming formal argument to a Function.
Definition: Argument.h:31
LLVM Basic Block Representation.
Definition: BasicBlock.h:61
iterator end()
Definition: BasicBlock.h:451
iterator begin()
Instruction iterator methods.
Definition: BasicBlock.h:438
bool empty() const
Definition: BasicBlock.h:460
InstListType::iterator iterator
Instruction iterators...
Definition: BasicBlock.h:167
This class represents an Operation in the Expression.
Implements a dense probed hash-table based set.
Definition: DenseSet.h:271
const char * getOpcodeName() const
Definition: Instruction.h:276
A Use represents the edge between a Value definition and its users.
Definition: Use.h:43
User * getUser() const
Returns the User that contains this Use.
Definition: Use.h:72
LLVM Value Representation.
Definition: Value.h:74
void replaceAllUsesWith(Value *V)
Change all uses of this to point to a new Value.
Definition: Value.cpp:534
iterator_range< user_iterator > users()
Definition: Value.h:421
use_iterator use_begin()
Definition: Value.h:360
void printAsOperand(raw_ostream &O, bool PrintType=true, const Module *M=nullptr) const
Print the name of this Value out to the specified raw_ostream.
Definition: AsmWriter.cpp:5105
void replaceUsesWithIf(Value *New, llvm::function_ref< bool(Use &U)> ShouldReplace)
Go through the uses list for this definition and make each use point to "V" if the callback ShouldRep...
Definition: Value.cpp:542
use_iterator use_end()
Definition: Value.h:368
StringRef getName() const
Return a constant reference to the value's name.
Definition: Value.cpp:309
std::pair< iterator, bool > insert(const ValueT &V)
Definition: DenseSet.h:206
An efficient, type-erasing, non-owning reference to a callable.
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:52
Argument of a sandboxir::Function.
Definition: SandboxIR.h:313
void printAsOperand(raw_ostream &OS) const
Definition: SandboxIR.cpp:163
LLVM_DUMP_METHOD void dump() const final
Definition: SandboxIR.cpp:170
The BasicBlock::iterator.
Definition: SandboxIR.h:452
void verify() const final
Should crash if there is something wrong with the instruction.
Definition: SandboxIR.h:606
Function * getParent() const
Definition: SandboxIR.cpp:415
Instruction & front() const
Definition: SandboxIR.cpp:466
Instruction * getTerminator() const
Definition: SandboxIR.cpp:460
Context & getContext() const
Definition: SandboxIR.h:599
Instruction & back() const
Definition: SandboxIR.cpp:474
iterator begin() const
Definition: SandboxIR.cpp:446
LLVM_DUMP_METHOD void dump() const final
Definition: SandboxIR.cpp:517
LLVM_DUMP_METHOD void dump() const override
Definition: SandboxIR.cpp:300
DenseMap< llvm::Value *, std::unique_ptr< sandboxir::Value > > LLVMValueToValueMap
Maps LLVM Value to the corresponding sandboxir::Value.
Definition: SandboxIR.h:624
Value * registerValue(std::unique_ptr< Value > &&VPtr)
Take ownership of VPtr and store it in LLVMValueToValueMap.
Definition: SandboxIR.cpp:347
sandboxir::Value * getValue(llvm::Value *V) const
Definition: SandboxIR.cpp:395
Argument * getOrCreateArgument(llvm::Argument *LLVMArg)
Definition: SandboxIR.h:631
Function * createFunction(llvm::Function *F)
Definition: SandboxIR.cpp:402
Value * getOrCreateValueInternal(llvm::Value *V, llvm::User *U=nullptr)
Definition: SandboxIR.cpp:356
BasicBlock * createBasicBlock(llvm::BasicBlock *BB)
Definition: SandboxIR.cpp:386
Value * getOrCreateValue(llvm::Value *LLVMV)
Definition: SandboxIR.h:641
friend class BasicBlock
Various leaf nodes.
Definition: SandboxIR.h:647
size_t getNumValues() const
\Returns the number of values registered with Context.
Definition: SandboxIR.h:660
void dumpNameAndArgs(raw_ostream &OS) const
Definition: SandboxIR.cpp:305
LLVM_DUMP_METHOD void dump() const final
Definition: SandboxIR.cpp:336
A sandboxir::User with operands and opcode.
Definition: SandboxIR.h:494
virtual unsigned getNumOfIRInstrs() const =0
This is used by BasicBlock::iterator.
static bool classof(const sandboxir::Value *From)
For isa/dyn_cast.
Definition: SandboxIR.cpp:265
LLVM_DUMP_METHOD void dump() const override
Definition: SandboxIR.cpp:280
An LLLVM Instruction that has no SandboxIR equivalent class gets mapped to an OpaqueInstr.
Definition: SandboxIR.h:537
LLVM_DUMP_METHOD void dump() const override
Definition: SandboxIR.cpp:290
Returns the operand edge when dereferenced.
Definition: SandboxIR.h:114
OperandUseIterator & operator++()
Definition: SandboxIR.cpp:55
Represents a Def-use/Use-def edge in SandboxIR.
Definition: SandboxIR.h:81
unsigned getOperandNo() const
Definition: SandboxIR.cpp:19
Value * get() const
Definition: SandboxIR.cpp:17
class User * getUser() const
Definition: SandboxIR.h:99
void dump() const
Definition: SandboxIR.cpp:50
Returns user edge when dereferenced.
Definition: SandboxIR.h:141
UserUseIterator & operator++()
Definition: SandboxIR.cpp:62
virtual unsigned getUseOperandNo(const Use &Use) const =0
\Returns the operand index of Use.
static bool classof(const Value *From)
For isa/dyn_cast.
Definition: SandboxIR.cpp:194
bool replaceUsesOfWith(Value *FromV, Value *ToV)
Replaces any operands that match FromV with ToV.
Definition: SandboxIR.cpp:214
void verifyUserOfLLVMUse(const llvm::Use &Use) const
Definition: SandboxIR.cpp:188
Use getOperandUseDefault(unsigned OpIdx, bool Verify) const
\Returns the Use edge that corresponds to OpIdx.
Definition: SandboxIR.cpp:176
virtual void setOperand(unsigned OperandIdx, Value *Operand)
Definition: SandboxIR.cpp:209
virtual Use getOperandUseInternal(unsigned OpIdx, bool Verify) const =0
virtual unsigned getNumOperands() const
Definition: SandboxIR.h:396
void dumpCommonHeader(raw_ostream &OS) const final
Definition: SandboxIR.cpp:219
A SandboxIR Value has users. This is the base class.
Definition: SandboxIR.h:166
mapped_iterator< sandboxir::UserUseIterator, UseToUser > user_iterator
Definition: SandboxIR.h:241
use_iterator use_begin()
Definition: SandboxIR.cpp:83
llvm::Value * Val
The LLVM Value that corresponds to this SandboxIR Value.
Definition: SandboxIR.h:200
user_iterator user_begin()
Definition: SandboxIR.cpp:93
void replaceAllUsesWith(Value *Other)
Definition: SandboxIR.cpp:119
void dumpCommonFooter(raw_ostream &OS) const
Definition: SandboxIR.cpp:136
virtual void dumpCommonHeader(raw_ostream &OS) const
Definition: SandboxIR.cpp:132
UserUseIterator use_iterator
Definition: SandboxIR.h:217
Context & Ctx
All values point to the context.
Definition: SandboxIR.h:206
ClassID SubclassID
For isa/dyn_cast.
Definition: SandboxIR.h:193
void dumpCommonSuffix(raw_ostream &OS) const
Definition: SandboxIR.cpp:152
Type * getType() const
Definition: SandboxIR.h:285
Value(ClassID SubclassID, llvm::Value *Val, Context &Ctx)
Definition: SandboxIR.cpp:76
std::string getName() const
Returns the name in the form 'SB<number>.' like 'SB1.'.
Definition: SandboxIR.cpp:126
void replaceUsesWithIf(Value *OtherV, llvm::function_ref< bool(const Use &)> ShouldReplace)
Definition: SandboxIR.cpp:106
unsigned getNumUses() const
\Returns the number of user edges (not necessarily to unique users).
Definition: SandboxIR.cpp:104
unsigned UID
A unique ID used for forming the name (used for debugging).
Definition: SandboxIR.h:196
void dumpCommonPrefix(raw_ostream &OS) const
Definition: SandboxIR.cpp:145
void printAsOperandCommon(raw_ostream &OS) const
Definition: SandboxIR.cpp:156
static const char * getSubclassIDStr(ClassID ID)
Definition: SandboxIR.h:176
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
@ C
The default llvm calling convention, compatible with C.
Definition: CallingConv.h:34
auto enumerate(FirstRange &&First, RestRanges &&...Rest)
Given two or more input ranges, returns a new range whose values are are tuples (A,...
Definition: STLExtras.h:2400
void interleave(ForwardIterator begin, ForwardIterator end, UnaryFunctor each_fn, NullaryFunctor between_fn)
An STL-style algorithm similar to std::for_each that applies a second functor between every pair of e...
Definition: STLExtras.h:2121
bool any_of(R &&range, UnaryPredicate P)
Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly.
Definition: STLExtras.h:1729
auto reverse(ContainerTy &&C)
Definition: STLExtras.h:419
constexpr size_t range_size(R &&Range)
Returns the size of the Range, i.e., the number of elements.
Definition: STLExtras.h:1705
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
Definition: Debug.cpp:163
@ Other
Any other memory.
Helper for mapped_iterator.
Definition: SandboxIR.h:237