llvm.org GIT mirror llvm / c34a25d
[C++] Use 'nullptr'. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207394 91177308-0d34-0410-b5e6-96231b3b80d8 Craig Topper 6 years ago
124 changed file(s) with 352 addition(s) and 343 deletion(s). Raw diff Collapse all Expand all
8585 }
8686
8787 void setNext(const ECValue *NewNext) const {
88 assert(getNext() == 0 && "Already has a next pointer!");
88 assert(getNext() == nullptr && "Already has a next pointer!");
8989 Next = (const ECValue*)((intptr_t)NewNext | (intptr_t)isLeader());
9090 }
9191 public:
9292 ECValue(const ECValue &RHS) : Leader(this), Next((ECValue*)(intptr_t)1),
9393 Data(RHS.Data) {
9494 // Only support copying of singleton nodes.
95 assert(RHS.isLeader() && RHS.getNext() == 0 && "Not a singleton!");
95 assert(RHS.isLeader() && RHS.getNext() == nullptr && "Not a singleton!");
9696 }
9797
9898 bool operator<(const ECValue &UFN) const { return Data < UFN.Data; }
250250 explicit member_iterator(const ECValue *N) : Node(N) {}
251251
252252 reference operator*() const {
253 assert(Node != 0 && "Dereferencing end()!");
253 assert(Node != nullptr && "Dereferencing end()!");
254254 return Node->getData();
255255 }
256256 reference operator->() const { return operator*(); }
257257
258258 member_iterator &operator++() {
259 assert(Node != 0 && "++'d off the end of the list!");
259 assert(Node != nullptr && "++'d off the end of the list!");
260260 Node = Node->getNext();
261261 return *this;
262262 }
13941394
13951395 void doFunction(const FunctionT *F, const BranchProbabilityInfoT *BPI,
13961396 const LoopInfoT *LI);
1397 BlockFrequencyInfoImpl() : BPI(0), LI(0), F(0) {}
1397 BlockFrequencyInfoImpl() : BPI(nullptr), LI(nullptr), F(nullptr) {}
13981398
13991399 using BlockFrequencyInfoImplBase::getEntryFreq;
14001400 BlockFrequency getBlockFreq(const BlockT *BB) const {
279279 }
280280
281281 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
282 void CallGraphWrapperPass::dump() const { print(dbgs(), 0); }
282 void CallGraphWrapperPass::dump() const { print(dbgs(), nullptr); }
283283 #endif
284284
285285 // Enuse that users of CallGraph.h also link with this file
223223 }
224224
225225 explicit BitcodeReader(MemoryBuffer *buffer, LLVMContext &C)
226 : Context(C), TheModule(0), Buffer(buffer), BufferOwned(false),
227 LazyStreamer(0), NextUnreadBit(0), SeenValueSymbolTable(false),
226 : Context(C), TheModule(nullptr), Buffer(buffer), BufferOwned(false),
227 LazyStreamer(nullptr), NextUnreadBit(0), SeenValueSymbolTable(false),
228228 ValueList(C), MDValueList(C),
229229 SeenFirstFunctionBody(false), UseRelativeIDs(false) {
230230 }
231231 explicit BitcodeReader(DataStreamer *streamer, LLVMContext &C)
232 : Context(C), TheModule(0), Buffer(0), BufferOwned(false),
232 : Context(C), TheModule(nullptr), Buffer(nullptr), BufferOwned(false),
233233 LazyStreamer(streamer), NextUnreadBit(0), SeenValueSymbolTable(false),
234234 ValueList(C), MDValueList(C),
235235 SeenFirstFunctionBody(false), UseRelativeIDs(false) {
270270 return ValueList.getValueFwdRef(ID, Ty);
271271 }
272272 BasicBlock *getBasicBlock(unsigned ID) const {
273 if (ID >= FunctionBBs.size()) return 0; // Invalid ID
273 if (ID >= FunctionBBs.size()) return nullptr; // Invalid ID
274274 return FunctionBBs[ID];
275275 }
276276 AttributeSet getAttributes(unsigned i) const {
292292 if (ValNo < InstNum) {
293293 // If this is not a forward reference, just return the value we already
294294 // have.
295 ResVal = getFnValueByID(ValNo, 0);
296 return ResVal == 0;
295 ResVal = getFnValueByID(ValNo, nullptr);
296 return ResVal == nullptr;
297297 } else if (Slot == Record.size()) {
298298 return true;
299299 }
300300
301301 unsigned TypeNo = (unsigned)Record[Slot++];
302302 ResVal = getFnValueByID(ValNo, getTypeByID(TypeNo));
303 return ResVal == 0;
303 return ResVal == nullptr;
304304 }
305305
306306 /// popValue - Read a value out of the specified record from slot 'Slot'.
319319 bool getValue(SmallVectorImpl &Record, unsigned Slot,
320320 unsigned InstNum, Type *Ty, Value *&ResVal) {
321321 ResVal = getValue(Record, Slot, InstNum, Ty);
322 return ResVal == 0;
322 return ResVal == nullptr;
323323 }
324324
325325 /// getValue -- Version of getValue that returns ResVal directly,
326326 /// or 0 if there is an error.
327327 Value *getValue(SmallVectorImpl &Record, unsigned Slot,
328328 unsigned InstNum, Type *Ty) {
329 if (Slot == Record.size()) return 0;
329 if (Slot == Record.size()) return nullptr;
330330 unsigned ValNo = (unsigned)Record[Slot];
331331 // Adjust the ValNo, if it was encoded relative to the InstNum.
332332 if (UseRelativeIDs)
337337 /// getValueSigned -- Like getValue, but decodes signed VBRs.
338338 Value *getValueSigned(SmallVectorImpl &Record, unsigned Slot,
339339 unsigned InstNum, Type *Ty) {
340 if (Slot == Record.size()) return 0;
340 if (Slot == Record.size()) return nullptr;
341341 unsigned ValNo = (unsigned)decodeSignRotatedValue(Record[Slot]);
342342 // Adjust the ValNo, if it was encoded relative to the InstNum.
343343 if (UseRelativeIDs)
109109 }
110110
111111 AsmPrinter::~AsmPrinter() {
112 assert(DD == 0 && Handlers.empty() && "Debug/EH info didn't get finalized");
112 assert(!DD && Handlers.empty() && "Debug/EH info didn't get finalized");
113113
114114 if (GCMetadataPrinters) {
115115 gcp_map_type &GCMap = getGCMap(GCMetadataPrinters);
9393 const DwarfCompileUnit *Unit;
9494
9595 public:
96 DebugLocEntry() : Begin(0), End(0), Unit(0) {}
96 DebugLocEntry() : Begin(nullptr), End(nullptr), Unit(nullptr) {}
9797 DebugLocEntry(const MCSymbol *B, const MCSymbol *E,
9898 Value Val, const DwarfCompileUnit *U)
9999 : Begin(B), End(E), Unit(U) {
993993
994994 // Emit all Dwarf sections that should come after the content.
995995 void DwarfDebug::endModule() {
996 assert(CurFn == 0);
997 assert(CurMI == 0);
996 assert(CurFn == nullptr);
997 assert(CurMI == nullptr);
998998
999999 if (!FirstCU)
10001000 return;
12781278
12791279 // Process beginning of an instruction.
12801280 void DwarfDebug::beginInstruction(const MachineInstr *MI) {
1281 assert(CurMI == 0);
1281 assert(CurMI == nullptr);
12821282 CurMI = MI;
12831283 // Check if source location changes, but ignore DBG_VALUE locations.
12841284 if (!MI->isDebugValue()) {
13221322
13231323 // Process end of an instruction.
13241324 void DwarfDebug::endInstruction() {
1325 assert(CurMI != 0);
1325 assert(CurMI != nullptr);
13261326 // Don't create a new label after DBG_VALUE instructions.
13271327 // They don't generate code.
13281328 if (!CurMI->isDebugValue())
16071607 CurFn = MF;
16081608 else
16091609 assert(CurFn == MF);
1610 assert(CurFn != 0);
1610 assert(CurFn != nullptr);
16111611
16121612 if (!MMI->hasDebugInfo() || LScopes.empty()) {
16131613 // If we don't have a lexical scope for this function then there will
7777 public:
7878 // AbsVar may be NULL.
7979 DbgVariable(DIVariable V, DbgVariable *AV, DwarfDebug *DD)
80 : Var(V), TheDIE(0), DotDebugLocOffset(~0U), AbsVar(AV), MInsn(0),
81 FrameIndex(~0), DD(DD) {}
80 : Var(V), TheDIE(nullptr), DotDebugLocOffset(~0U), AbsVar(AV),
81 MInsn(nullptr), FrameIndex(~0), DD(DD) {}
8282
8383 // Accessors.
8484 DIVariable getVariable() const { return Var; }
522522
523523 /// \brief Ensure that a label will be emitted before MI.
524524 void requestLabelBeforeInsn(const MachineInstr *MI) {
525 LabelsBeforeInsn.insert(std::make_pair(MI, (MCSymbol *)0));
525 LabelsBeforeInsn.insert(std::make_pair(MI, nullptr));
526526 }
527527
528528 /// \brief Return Label preceding the instruction.
530530
531531 /// \brief Ensure that a label will be emitted after MI.
532532 void requestLabelAfterInsn(const MachineInstr *MI) {
533 LabelsAfterInsn.insert(std::make_pair(MI, (MCSymbol *)0));
533 LabelsAfterInsn.insert(std::make_pair(MI, nullptr));
534534 }
535535
536536 /// \brief Return Label immediately following the instruction.
215215 if (FnDebugInfo.empty())
216216 return;
217217
218 assert(Asm != 0);
218 assert(Asm != nullptr);
219219 Asm->OutStreamer.SwitchSection(
220220 Asm->getObjFileLowering().getCOFFDebugSymbolsSection());
221221 Asm->EmitInt32(COFF::DEBUG_SECTION_MAGIC);
3737 struct FunctionInfo {
3838 SmallVector Instrs;
3939 MCSymbol *End;
40 FunctionInfo() : End(0) {}
40 FunctionInfo() : End(nullptr) {}
4141 } *CurFn;
4242
4343 typedef DenseMap FnDebugInfoTy;
103103 void maybeRecordLocation(DebugLoc DL, const MachineFunction *MF);
104104
105105 void clear() {
106 assert(CurFn == 0);
106 assert(CurFn == nullptr);
107107 FileNameRegistry.clear();
108108 InstrInfo.clear();
109109 }
3838 const DWARFAbbreviationDeclaration *AbbrevDecl;
3939 public:
4040 DWARFDebugInfoEntryMinimal()
41 : Offset(0), ParentIdx(0), SiblingIdx(0), AbbrevDecl(0) {}
41 : Offset(0), ParentIdx(0), SiblingIdx(0), AbbrevDecl(nullptr) {}
4242
4343 void dump(raw_ostream &OS, const DWARFUnit *u, unsigned recurseDepth,
4444 unsigned indent = 0) const;
5151 bool extractFast(const DWARFUnit *U, uint32_t *OffsetPtr);
5252
5353 uint32_t getTag() const { return AbbrevDecl ? AbbrevDecl->getTag() : 0; }
54 bool isNULL() const { return AbbrevDecl == 0; }
54 bool isNULL() const { return AbbrevDecl == nullptr; }
5555
5656 /// Returns true if DIE represents a subprogram (not inlined).
5757 bool isSubprogramDIE() const;
6565 // We know we are kept in a vector of contiguous entries, so we know
6666 // our parent will be some index behind "this".
6767 DWARFDebugInfoEntryMinimal *getParent() {
68 return ParentIdx > 0 ? this - ParentIdx : 0;
68 return ParentIdx > 0 ? this - ParentIdx : nullptr;
6969 }
7070 const DWARFDebugInfoEntryMinimal *getParent() const {
71 return ParentIdx > 0 ? this - ParentIdx : 0;
71 return ParentIdx > 0 ? this - ParentIdx : nullptr;
7272 }
7373 // We know we are kept in a vector of contiguous entries, so we know
7474 // our sibling will be some index after "this".
7575 DWARFDebugInfoEntryMinimal *getSibling() {
76 return SiblingIdx > 0 ? this + SiblingIdx : 0;
76 return SiblingIdx > 0 ? this + SiblingIdx : nullptr;
7777 }
7878 const DWARFDebugInfoEntryMinimal *getSibling() const {
79 return SiblingIdx > 0 ? this + SiblingIdx : 0;
79 return SiblingIdx > 0 ? this + SiblingIdx : nullptr;
8080 }
8181 // We know we are kept in a vector of contiguous entries, so we know
8282 // we don't need to store our child pointer, if we have a child it will
8383 // be the next entry in the list...
8484 DWARFDebugInfoEntryMinimal *getFirstChild() {
85 return hasChildren() ? this + 1 : 0;
85 return hasChildren() ? this + 1 : nullptr;
8686 }
8787 const DWARFDebugInfoEntryMinimal *getFirstChild() const {
88 return hasChildren() ? this + 1 : 0;
88 return hasChildren() ? this + 1 : nullptr;
8989 }
9090
9191 void setParent(DWARFDebugInfoEntryMinimal *parent) {
167167 /// (except the last DIE) in this chain is contained in address
168168 /// range for next DIE in the chain.
169169 struct DWARFDebugInfoEntryInlinedChain {
170 DWARFDebugInfoEntryInlinedChain() : U(0) {}
170 DWARFDebugInfoEntryInlinedChain() : U(nullptr) {}
171171 SmallVector DIEs;
172172 const DWARFUnit *U;
173173 };
2323 public:
2424 DWARFDebugLine(const RelocAddrMap* LineInfoRelocMap) : RelocMap(LineInfoRelocMap) {}
2525 struct FileNameEntry {
26 FileNameEntry() : Name(0), DirIdx(0), ModTime(0), Length(0) {}
26 FileNameEntry() : Name(nullptr), DirIdx(0), ModTime(0), Length(0) {}
2727
2828 const char *Name;
2929 uint64_t DirIdx;
117117 const DWARFDebugInfoEntryMinimal *
118118 getCompileUnitDIE(bool extract_cu_die_only = true) {
119119 extractDIEsIfNeeded(extract_cu_die_only);
120 return DieArray.empty() ? NULL : &DieArray[0];
120 return DieArray.empty() ? nullptr : &DieArray[0];
121121 }
122122
123123 const char *getCompilationDir();
5757 IMPLEMENT_BINARY_OPERATOR(+, Double);
5858 default:
5959 dbgs() << "Unhandled type for FAdd instruction: " << *Ty << "\n";
60 llvm_unreachable(0);
60 llvm_unreachable(nullptr);
6161 }
6262 }
6363
6868 IMPLEMENT_BINARY_OPERATOR(-, Double);
6969 default:
7070 dbgs() << "Unhandled type for FSub instruction: " << *Ty << "\n";
71 llvm_unreachable(0);
71 llvm_unreachable(nullptr);
7272 }
7373 }
7474
7979 IMPLEMENT_BINARY_OPERATOR(*, Double);
8080 default:
8181 dbgs() << "Unhandled type for FMul instruction: " << *Ty << "\n";
82 llvm_unreachable(0);
82 llvm_unreachable(nullptr);
8383 }
8484 }
8585
9090 IMPLEMENT_BINARY_OPERATOR(/, Double);
9191 default:
9292 dbgs() << "Unhandled type for FDiv instruction: " << *Ty << "\n";
93 llvm_unreachable(0);
93 llvm_unreachable(nullptr);
9494 }
9595 }
9696
105105 break;
106106 default:
107107 dbgs() << "Unhandled type for Rem instruction: " << *Ty << "\n";
108 llvm_unreachable(0);
108 llvm_unreachable(nullptr);
109109 }
110110 }
111111
142142 IMPLEMENT_POINTER_ICMP(==);
143143 default:
144144 dbgs() << "Unhandled type for ICMP_EQ predicate: " << *Ty << "\n";
145 llvm_unreachable(0);
145 llvm_unreachable(nullptr);
146146 }
147147 return Dest;
148148 }
156156 IMPLEMENT_POINTER_ICMP(!=);
157157 default:
158158 dbgs() << "Unhandled type for ICMP_NE predicate: " << *Ty << "\n";
159 llvm_unreachable(0);
159 llvm_unreachable(nullptr);
160160 }
161161 return Dest;
162162 }
170170 IMPLEMENT_POINTER_ICMP(<);
171171 default:
172172 dbgs() << "Unhandled type for ICMP_ULT predicate: " << *Ty << "\n";
173 llvm_unreachable(0);
173 llvm_unreachable(nullptr);
174174 }
175175 return Dest;
176176 }
184184 IMPLEMENT_POINTER_ICMP(<);
185185 default:
186186 dbgs() << "Unhandled type for ICMP_SLT predicate: " << *Ty << "\n";
187 llvm_unreachable(0);
187 llvm_unreachable(nullptr);
188188 }
189189 return Dest;
190190 }
198198 IMPLEMENT_POINTER_ICMP(>);
199199 default:
200200 dbgs() << "Unhandled type for ICMP_UGT predicate: " << *Ty << "\n";
201 llvm_unreachable(0);
201 llvm_unreachable(nullptr);
202202 }
203203 return Dest;
204204 }
212212 IMPLEMENT_POINTER_ICMP(>);
213213 default:
214214 dbgs() << "Unhandled type for ICMP_SGT predicate: " << *Ty << "\n";
215 llvm_unreachable(0);
215 llvm_unreachable(nullptr);
216216 }
217217 return Dest;
218218 }
226226 IMPLEMENT_POINTER_ICMP(<=);
227227 default:
228228 dbgs() << "Unhandled type for ICMP_ULE predicate: " << *Ty << "\n";
229 llvm_unreachable(0);
229 llvm_unreachable(nullptr);
230230 }
231231 return Dest;
232232 }
240240 IMPLEMENT_POINTER_ICMP(<=);
241241 default:
242242 dbgs() << "Unhandled type for ICMP_SLE predicate: " << *Ty << "\n";
243 llvm_unreachable(0);
243 llvm_unreachable(nullptr);
244244 }
245245 return Dest;
246246 }
254254 IMPLEMENT_POINTER_ICMP(>=);
255255 default:
256256 dbgs() << "Unhandled type for ICMP_UGE predicate: " << *Ty << "\n";
257 llvm_unreachable(0);
257 llvm_unreachable(nullptr);
258258 }
259259 return Dest;
260260 }
268268 IMPLEMENT_POINTER_ICMP(>=);
269269 default:
270270 dbgs() << "Unhandled type for ICMP_SGE predicate: " << *Ty << "\n";
271 llvm_unreachable(0);
271 llvm_unreachable(nullptr);
272272 }
273273 return Dest;
274274 }
293293 case ICmpInst::ICMP_SGE: R = executeICMP_SGE(Src1, Src2, Ty); break;
294294 default:
295295 dbgs() << "Don't know how to handle this ICmp predicate!\n-->" << I;
296 llvm_unreachable(0);
296 llvm_unreachable(nullptr);
297297 }
298298
299299 SetValue(&I, R, SF);
329329 IMPLEMENT_VECTOR_FCMP(==);
330330 default:
331331 dbgs() << "Unhandled type for FCmp EQ instruction: " << *Ty << "\n";
332 llvm_unreachable(0);
332 llvm_unreachable(nullptr);
333333 }
334334 return Dest;
335335 }
385385 IMPLEMENT_VECTOR_FCMP(!=);
386386 default:
387387 dbgs() << "Unhandled type for FCmp NE instruction: " << *Ty << "\n";
388 llvm_unreachable(0);
388 llvm_unreachable(nullptr);
389389 }
390390 // in vector case mask out NaN elements
391391 if (Ty->isVectorTy())
405405 IMPLEMENT_VECTOR_FCMP(<=);
406406 default:
407407 dbgs() << "Unhandled type for FCmp LE instruction: " << *Ty << "\n";
408 llvm_unreachable(0);
408 llvm_unreachable(nullptr);
409409 }
410410 return Dest;
411411 }
419419 IMPLEMENT_VECTOR_FCMP(>=);
420420 default:
421421 dbgs() << "Unhandled type for FCmp GE instruction: " << *Ty << "\n";
422 llvm_unreachable(0);
422 llvm_unreachable(nullptr);
423423 }
424424 return Dest;
425425 }
433433 IMPLEMENT_VECTOR_FCMP(<);
434434 default:
435435 dbgs() << "Unhandled type for FCmp LT instruction: " << *Ty << "\n";
436 llvm_unreachable(0);
436 llvm_unreachable(nullptr);
437437 }
438438 return Dest;
439439 }
447447 IMPLEMENT_VECTOR_FCMP(>);
448448 default:
449449 dbgs() << "Unhandled type for FCmp GT instruction: " << *Ty << "\n";
450 llvm_unreachable(0);
450 llvm_unreachable(nullptr);
451451 }
452452 return Dest;
453453 }
615615 switch (I.getPredicate()) {
616616 default:
617617 dbgs() << "Don't know how to handle this FCmp predicate!\n-->" << I;
618 llvm_unreachable(0);
618 llvm_unreachable(nullptr);
619619 break;
620620 case FCmpInst::FCMP_FALSE: R = executeFCMP_BOOL(Src1, Src2, Ty, false);
621621 break;
672672 case FCmpInst::FCMP_TRUE: return executeFCMP_BOOL(Src1, Src2, Ty, true);
673673 default:
674674 dbgs() << "Unhandled Cmp predicate\n";
675 llvm_unreachable(0);
675 llvm_unreachable(nullptr);
676676 }
677677 }
678678
726726 switch(I.getOpcode()){
727727 default:
728728 dbgs() << "Don't know how to handle this binary operator!\n-->" << I;
729 llvm_unreachable(0);
729 llvm_unreachable(nullptr);
730730 break;
731731 case Instruction::Add: INTEGER_VECTOR_OPERATION(+) break;
732732 case Instruction::Sub: INTEGER_VECTOR_OPERATION(-) break;
754754 fmod(Src1.AggregateVal[i].DoubleVal, Src2.AggregateVal[i].DoubleVal);
755755 else {
756756 dbgs() << "Unhandled type for Rem instruction: " << *Ty << "\n";
757 llvm_unreachable(0);
757 llvm_unreachable(nullptr);
758758 }
759759 }
760760 break;
763763 switch (I.getOpcode()) {
764764 default:
765765 dbgs() << "Don't know how to handle this binary operator!\n-->" << I;
766 llvm_unreachable(0);
766 llvm_unreachable(nullptr);
767767 break;
768768 case Instruction::Add: R.IntVal = Src1.IntVal + Src2.IntVal; break;
769769 case Instruction::Sub: R.IntVal = Src1.IntVal - Src2.IntVal; break;
979979 << uintptr_t(Memory) << '\n');
980980
981981 GenericValue Result = PTOGV(Memory);
982 assert(Result.PointerVal != 0 && "Null pointer returned by malloc!");
982 assert(Result.PointerVal && "Null pointer returned by malloc!");
983983 SetValue(&I, Result, SF);
984984
985985 if (I.getOpcode() == Instruction::Alloca)
17321732 IMPLEMENT_VAARG(Double);
17331733 default:
17341734 dbgs() << "Unhandled dest type for vaarg instruction: " << *Ty << "\n";
1735 llvm_unreachable(0);
1735 llvm_unreachable(nullptr);
17361736 }
17371737
17381738 // Set the Value of this Instruction.
17561756 default:
17571757 dbgs() << "Unhandled destination type for extractelement instruction: "
17581758 << *Ty << "\n";
1759 llvm_unreachable(0);
1759 llvm_unreachable(nullptr);
17601760 break;
17611761 case Type::IntegerTyID:
17621762 Dest.IntVal = Src1.AggregateVal[indx].IntVal;
20732073 //
20742074 void Interpreter::callFunction(Function *F,
20752075 const std::vector &ArgVals) {
2076 assert((ECStack.empty() || ECStack.back().Caller.getInstruction() == 0 ||
2076 assert((ECStack.empty() || !ECStack.back().Caller.getInstruction() ||
20772077 ECStack.back().Caller.arg_size() == ArgVals.size()) &&
20782078 "Incorrect number of arguments passed into function call!");
20792079 // Make a new stack frame... and fill it in.
107107
108108 /// create - Create an interpreter ExecutionEngine. This can never fail.
109109 ///
110 static ExecutionEngine *create(Module *M, std::string *ErrorStr = 0);
110 static ExecutionEngine *create(Module *M, std::string *ErrorStr = nullptr);
111111
112112 /// run - Start execution with the specified function and arguments.
113113 ///
117117 void *getPointerToNamedFunction(const std::string &Name,
118118 bool AbortOnFailure = true) override {
119119 // FIXME: not implemented.
120 return 0;
120 return nullptr;
121121 }
122122
123123 /// recompileAndRelinkFunction - For the interpreter, functions are always
188188 TargetMachine *TM);
189189
190190 // Run the JIT on F and return information about the generated code
191 void runJITOnFunction(Function *F, MachineCodeInfo *MCI = 0) override;
191 void runJITOnFunction(Function *F, MachineCodeInfo *MCI = nullptr) override;
192192
193193 void RegisterJITEventListener(JITEventListener *L) override;
194194 void UnregisterJITEventListener(JITEventListener *L) override;
642642 }
643643
644644 void DefaultJITMemoryManager::AllocateGOT() {
645 assert(GOTBase == 0 && "Cannot allocate the got multiple times");
645 assert(!GOTBase && "Cannot allocate the got multiple times");
646646 GOTBase = new uint8_t[sizeof(void*) * 8192];
647647 HasGOT = true;
648648 }
7070 ClientMM->deregisterEHFrames(Addr, LoadAddr, Size);
7171 }
7272
73 bool finalizeMemory(std::string *ErrMsg = 0) override {
73 bool finalizeMemory(std::string *ErrMsg = nullptr) override {
7474 return ClientMM->finalizeMemory(ErrMsg);
7575 }
7676
4747 object::ObjectFile::createObjectFile(Buffer->getMemBuffer()).get();
4848 }
4949 ObjectImageCommon(object::ObjectFile* Input)
50 : ObjectImage(NULL), ObjFile(Input) {}
50 : ObjectImage(nullptr), ObjFile(Input) {}
5151 virtual ~ObjectImageCommon() { delete ObjFile; }
5252
5353 object::symbol_iterator begin_symbols() const override
120120 uint64_t Offset;
121121 int64_t Addend;
122122 const char *SymbolName;
123 RelocationValueRef() : SectionID(0), Offset(0), Addend(0), SymbolName(0) {}
123 RelocationValueRef() : SectionID(0), Offset(0), Addend(0),
124 SymbolName(nullptr) {}
124125
125126 inline bool operator==(const RelocationValueRef &Other) const {
126127 return SectionID == Other.SectionID && Offset == Other.Offset &&
334335 // Work in progress.
335336 SymbolTableMap::const_iterator pos = GlobalSymbolTable.find(Name);
336337 if (pos == GlobalSymbolTable.end())
337 return 0;
338 return nullptr;
338339 SymbolLoc Loc = pos->second;
339340 return getSectionAddress(Loc.first) + Loc.second;
340341 }
585585 /// necessary.
586586 ConstantClass *getOrCreate(TypeClass *Ty, ValRefType V) {
587587 MapKey Lookup(Ty, V);
588 ConstantClass* Result = 0;
588 ConstantClass* Result = nullptr;
589589
590590 typename MapTy::iterator I = Map.find(Lookup);
591591 // Is it in the map?
721721 /// necessary.
722722 ConstantClass *getOrCreate(TypeClass *Ty, Operands V) {
723723 LookupKey Lookup(Ty, V);
724 ConstantClass* Result = 0;
724 ConstantClass* Result = nullptr;
725725
726726 typename MapTy::iterator I = Map.find_as(Lookup);
727727 // Is it in the map?
5555 return hash_combine(Key.type, Key.val);
5656 }
5757 };
58 static inline KeyTy getEmptyKey() { return KeyTy(APInt(1,0), 0); }
59 static inline KeyTy getTombstoneKey() { return KeyTy(APInt(1,1), 0); }
58 static inline KeyTy getEmptyKey() { return KeyTy(APInt(1,0), nullptr); }
59 static inline KeyTy getTombstoneKey() { return KeyTy(APInt(1,1), nullptr); }
6060 static unsigned getHashValue(const KeyTy &Key) {
6161 return static_cast(hash_value(Key));
6262 }
3333 template
3434 struct LeakDetectorImpl {
3535 explicit LeakDetectorImpl(const char* const name = "") :
36 Cache(0), Name(name) { }
36 Cache(nullptr), Name(name) { }
3737
3838 void clear() {
39 Cache = 0;
39 Cache = nullptr;
4040 Ts.clear();
4141 }
4242
6060
6161 void removeGarbage(const T* o) {
6262 if (o == Cache)
63 Cache = 0; // Cache hit
63 Cache = nullptr; // Cache hit
6464 else
6565 Ts.erase(o);
6666 }
6767
6868 bool hasGarbage(const std::string& Message) {
69 addGarbage(0); // Flush the Cache
69 addGarbage(nullptr); // Flush the Cache
7070
71 assert(Cache == 0 && "No value should be cached anymore!");
71 assert(!Cache && "No value should be cached anymore!");
7272
7373 if (!Ts.empty()) {
7474 errs() << "Leaked " << Name << " objects found: " << Message << ":\n";
6464 template
6565 void SymbolTableListTraits
6666 ::addNodeToList(ValueSubClass *V) {
67 assert(V->getParent() == 0 && "Value already in a container!!");
67 assert(!V->getParent() && "Value already in a container!!");
6868 ItemParentClass *Owner = getListOwner();
6969 V->setParent(Owner);
7070 if (V->hasName())
7575 template
7676 void SymbolTableListTraits
7777 ::removeNodeFromList(ValueSubClass *V) {
78 V->setParent(0);
78 V->setParent(nullptr);
7979 if (V->hasName())
8080 if (ValueSymbolTable *ST = TraitsClass::getSymTab(getListOwner()))
8181 ST->removeValueName(V->getValueName());
120120 Protect, MMFlags, fd, 0);
121121 if (Addr == MAP_FAILED) {
122122 if (NearBlock) //Try again without a near hint
123 return allocateMappedMemory(NumBytes, 0, PFlags, EC);
123 return allocateMappedMemory(NumBytes, nullptr, PFlags, EC);
124124
125125 EC = error_code(errno, system_category());
126126 return MemoryBlock();
138138
139139 error_code
140140 Memory::releaseMappedMemory(MemoryBlock &M) {
141 if (M.Address == 0 || M.Size == 0)
141 if (M.Address == nullptr || M.Size == 0)
142142 return error_code::success();
143143
144144 if (0 != ::munmap(M.Address, M.Size))
145145 return error_code(errno, system_category());
146146
147 M.Address = 0;
147 M.Address = nullptr;
148148 M.Size = 0;
149149
150150 return error_code::success();
152152
153153 error_code
154154 Memory::protectMappedMemory(const MemoryBlock &M, unsigned Flags) {
155 if (M.Address == 0 || M.Size == 0)
155 if (M.Address == nullptr || M.Size == 0)
156156 return error_code::success();
157157
158158 if (!Flags)
202202 ;
203203
204204 void* start = NearBlock ? (unsigned char*)NearBlock->base() +
205 NearBlock->size() : 0;
205 NearBlock->size() : nullptr;
206206
207207 #if defined(__APPLE__) && (defined(__arm__) || defined(__arm64__))
208208 void *pa = ::mmap(start, PageSize*NumPages, PROT_READ|PROT_EXEC,
213213 #endif
214214 if (pa == MAP_FAILED) {
215215 if (NearBlock) //Try again without a near hint
216 return AllocateRWX(NumBytes, 0);
216 return AllocateRWX(NumBytes, nullptr);
217217
218218 MakeErrMsg(ErrMsg, "Can't allocate RWX Memory");
219219 return MemoryBlock();
245245 }
246246
247247 bool Memory::ReleaseRWX(MemoryBlock &M, std::string *ErrMsg) {
248 if (M.Address == 0 || M.Size == 0) return false;
248 if (M.Address == nullptr || M.Size == 0) return false;
249249 if (0 != ::munmap(M.Address, M.Size))
250250 return MakeErrMsg(ErrMsg, "Can't release RWX Memory");
251251 return false;
8888
8989 static error_code TempDir(SmallVectorImpl &result) {
9090 // FIXME: Don't use TMPDIR if program is SUID or SGID enabled.
91 const char *dir = 0;
91 const char *dir = nullptr;
9292 (dir = std::getenv("TMPDIR")) || (dir = std::getenv("TMP")) ||
9393 (dir = std::getenv("TEMP")) || (dir = std::getenv("TEMPDIR")) ||
9494 #ifdef P_tmpdir
245245 #endif
246246
247247 while (true) {
248 if (::getcwd(result.data(), result.capacity()) == 0) {
248 if (::getcwd(result.data(), result.capacity()) == nullptr) {
249249 // See if there was a real error.
250250 if (errno != errc::not_enough_memory)
251251 return error_code(errno, system_category());
493493 #ifdef MAP_FILE
494494 flags |= MAP_FILE;
495495 #endif
496 Mapping = ::mmap(0, Size, prot, flags, FD, Offset);
496 Mapping = ::mmap(nullptr, Size, prot, flags, FD, Offset);
497497 if (Mapping == MAP_FAILED)
498498 return error_code(errno, system_category());
499499 return error_code::success();
524524
525525 ec = init(ofd, true, offset);
526526 if (ec)
527 Mapping = 0;
527 Mapping = nullptr;
528528 }
529529
530530 mapped_file_region::mapped_file_region(int fd,
544544
545545 ec = init(fd, closefd, offset);
546546 if (ec)
547 Mapping = 0;
547 Mapping = nullptr;
548548 }
549549
550550 mapped_file_region::~mapped_file_region() {
554554
555555 mapped_file_region::mapped_file_region(mapped_file_region &&other)
556556 : Mode(other.Mode), Size(other.Size), Mapping(other.Mapping) {
557 other.Mapping = 0;
557 other.Mapping = nullptr;
558558 }
559559
560560 mapped_file_region::mapmode mapped_file_region::flags() const {
586586 StringRef path){
587587 SmallString<128> path_null(path);
588588 DIR *directory = ::opendir(path_null.c_str());
589 if (directory == 0)
589 if (!directory)
590590 return error_code(errno, system_category());
591591
592592 it.IterationHandle = reinterpret_cast(directory);
607607 error_code detail::directory_iterator_increment(detail::DirIterState &it) {
608608 errno = 0;
609609 dirent *cur_dir = ::readdir(reinterpret_cast(it.IterationHandle));
610 if (cur_dir == 0 && errno != 0) {
611 return error_code(errno, system_category());
612 } else if (cur_dir != 0) {
610 if (cur_dir == nullptr && errno != 0) {
611 return error_code(errno, system_category());
612 } else if (cur_dir != nullptr) {
613613 StringRef name(cur_dir->d_name, NAMLEN(cur_dir));
614614 if ((name.size() == 1 && name[0] == '.') ||
615615 (name.size() == 2 && name[0] == '.' && name[1] == '.'))
629629
630630 // Open path.
631631 std::FILE *file = std::fopen(Path.data(), "rb");
632 if (file == 0)
632 if (!file)
633633 return error_code(errno, system_category());
634634
635635 // Reserve storage.
666666 #ifdef MAP_FILE
667667 flags |= MAP_FILE;
668668 #endif
669 result = ::mmap(0, size, prot, flags, fd, file_offset);
669 result = ::mmap(nullptr, size, prot, flags, fd, file_offset);
670670 if (result == MAP_FAILED) {
671671 return error_code(errno, system_category());
672672 }
269269 MutexGuard G(M);
270270
271271 int errret = 0;
272 if (setupterm((char *)0, fd, &errret) != 0)
272 if (setupterm((char *)nullptr, fd, &errret) != 0)
273273 // Regardless of why, if we can't get terminfo, we shouldn't try to print
274274 // colors.
275275 return false;
291291
292292 // Now extract the structure allocated by setupterm and free its memory
293293 // through a really silly dance.
294 struct term *termp = set_curterm((struct term *)0);
294 struct term *termp = set_curterm((struct term *)nullptr);
295295 (void)del_curterm(termp); // Drop any errors here.
296296
297297 // Return true if we found a color capabilities for the current terminal.
6969
7070 // Get the path. If its empty, we can't do anything to find it.
7171 const char *PathStr = getenv("PATH");
72 if (PathStr == 0)
72 if (!PathStr)
7373 return "";
7474
7575 // Now we have a colon separated list of directories to search; try them.
9898 }
9999
100100 static bool RedirectIO(const StringRef *Path, int FD, std::string* ErrMsg) {
101 if (Path == 0) // Noop
101 if (!Path) // Noop
102102 return false;
103103 std::string File;
104104 if (Path->empty())
128128 #ifdef HAVE_POSIX_SPAWN
129129 static bool RedirectIO_PS(const std::string *Path, int FD, std::string *ErrMsg,
130130 posix_spawn_file_actions_t *FileActions) {
131 if (Path == 0) // Noop
131 if (!Path) // Noop
132132 return false;
133133 const char *File;
134134 if (Path->empty())
194194 #ifdef HAVE_POSIX_SPAWN
195195 if (memoryLimit == 0) {
196196 posix_spawn_file_actions_t FileActionsStore;
197 posix_spawn_file_actions_t *FileActions = 0;
197 posix_spawn_file_actions_t *FileActions = nullptr;
198198
199199 // If we call posix_spawn_file_actions_addopen we have to make sure the
200200 // c strings we pass to it stay alive until the call to posix_spawn,
202202 std::string RedirectsStorage[3];
203203
204204 if (redirects) {
205 std::string *RedirectsStr[3] = {0, 0, 0};
205 std::string *RedirectsStr[3] = {nullptr, nullptr, nullptr};
206206 for (int I = 0; I < 3; ++I) {
207207 if (redirects[I]) {
208208 RedirectsStorage[I] = *redirects[I];
217217 if (RedirectIO_PS(RedirectsStr[0], 0, ErrMsg, FileActions) ||
218218 RedirectIO_PS(RedirectsStr[1], 1, ErrMsg, FileActions))
219219 return false;
220 if (redirects[1] == 0 || redirects[2] == 0 ||
220 if (redirects[1] == nullptr || redirects[2] == nullptr ||
221221 *redirects[1] != *redirects[2]) {
222222 // Just redirect stderr
223223 if (RedirectIO_PS(RedirectsStr[2], 2, ErrMsg, FileActions))
241241 // Explicitly initialized to prevent what appears to be a valgrind false
242242 // positive.
243243 pid_t PID = 0;
244 int Err = posix_spawn(&PID, Program.str().c_str(), FileActions, /*attrp*/0,
245 const_cast(args), const_cast(envp));
244 int Err = posix_spawn(&PID, Program.str().c_str(), FileActions,
245 /*attrp*/nullptr, const_cast(args),
246 const_cast(envp));
246247
247248 if (FileActions)
248249 posix_spawn_file_actions_destroy(FileActions);
293294
294295 // Execute!
295296 std::string PathStr = Program;
296 if (envp != 0)
297 if (envp != nullptr)
297298 execve(PathStr.c_str(),
298299 const_cast(args),
299300 const_cast(envp));
359360
360361 // Turn off the alarm and restore the signal handler
361362 alarm(0);
362 sigaction(SIGALRM, &Old, 0);
363 sigaction(SIGALRM, &Old, nullptr);
363364
364365 // Wait for child to die
365366 if (wait(&status) != ChildPid)
380381 // We exited normally without timeout, so turn off the timer.
381382 if (SecondsToWait && !WaitUntilTerminates) {
382383 alarm(0);
383 sigaction(SIGALRM, &Old, 0);
384 sigaction(SIGALRM, &Old, nullptr);
384385 }
385386
386387 // Return the proper exit status. Detect error conditions
4343 static SmartMutex SignalsMutex;
4444
4545 /// InterruptFunction - The function to call if ctrl-c is pressed.
46 static void (*InterruptFunction)() = 0;
46 static void (*InterruptFunction)() = nullptr;
4747
4848 static std::vector FilesToRemove;
4949 static std::vector > CallBacksToRun;
112112 // Restore all of the signal handlers to how they were before we showed up.
113113 for (unsigned i = 0, e = NumRegisteredSignals; i != e; ++i)
114114 sigaction(RegisteredSignalInfo[i].SigNo,
115 &RegisteredSignalInfo[i].SA, 0);
115 &RegisteredSignalInfo[i].SA, nullptr);
116116 NumRegisteredSignals = 0;
117117 }
118118
159159 // Unmask all potentially blocked kill signals.
160160 sigset_t SigMask;
161161 sigfillset(&SigMask);
162 sigprocmask(SIG_UNBLOCK, &SigMask, 0);
162 sigprocmask(SIG_UNBLOCK, &SigMask, nullptr);
163163
164164 SignalsMutex.acquire();
165165 RemoveFilesToRemove();
168168 if (InterruptFunction) {
169169 void (*IF)() = InterruptFunction;
170170 SignalsMutex.release();
171 InterruptFunction = 0;
171 InterruptFunction = nullptr;
172172 IF(); // run the interrupt function.
173173 return;
174174 }
211211 bool llvm::sys::RemoveFileOnSignal(StringRef Filename,
212212 std::string* ErrMsg) {
213213 SignalsMutex.acquire();
214 std::string *OldPtr = FilesToRemove.empty() ? 0 : &FilesToRemove[0];
214 std::string *OldPtr = FilesToRemove.empty() ? nullptr : &FilesToRemove[0];
215215 FilesToRemove.push_back(Filename);
216216
217217 // We want to call 'c_str()' on every std::string in this vector so that if
278278 const char* name = strrchr(dlinfo.dli_fname, '/');
279279
280280 int nwidth;
281 if (name == NULL) nwidth = strlen(dlinfo.dli_fname);
282 else nwidth = strlen(name) - 1;
281 if (!name) nwidth = strlen(dlinfo.dli_fname);
282 else nwidth = strlen(name) - 1;
283283
284284 if (nwidth > width) width = nwidth;
285285 }
291291 fprintf(FD, "%-2d", i);
292292
293293 const char* name = strrchr(dlinfo.dli_fname, '/');
294 if (name == NULL) fprintf(FD, " %-*s", width, dlinfo.dli_fname);
295 else fprintf(FD, " %-*s", width, name+1);
294 if (!name) fprintf(FD, " %-*s", width, dlinfo.dli_fname);
295 else fprintf(FD, " %-*s", width, name+1);
296296
297297 fprintf(FD, " %#0*lx",
298298 (int)(sizeof(void*) * 2) + 2, (unsigned long)StackTrace[i]);
299299
300 if (dlinfo.dli_sname != NULL) {
300 if (dlinfo.dli_sname != nullptr) {
301301 fputc(' ', FD);
302302 # if HAVE_CXXABI_H
303303 int res;
304 char* d = abi::__cxa_demangle(dlinfo.dli_sname, NULL, NULL, &res);
304 char* d = abi::__cxa_demangle(dlinfo.dli_sname, nullptr, nullptr, &res);
305305 # else
306306 char* d = NULL;
307307 # endif
308 if (d == NULL) fputs(dlinfo.dli_sname, FD);
309 else fputs(d, FD);
308 if (!d) fputs(dlinfo.dli_sname, FD);
309 else fputs(d, FD);
310310 free(d);
311311
312312 // FIXME: When we move to C++11, use %t length modifier. It's not in
330330 /// PrintStackTraceOnErrorSignal - When an error signal (such as SIGABRT or
331331 /// SIGSEGV) is delivered to the process, print a stack trace and then exit.
332332 void llvm::sys::PrintStackTraceOnErrorSignal() {
333 AddSignalHandler(PrintStackTraceSignalHandler, 0);
333 AddSignalHandler(PrintStackTraceSignalHandler, nullptr);
334334
335335 #if defined(__APPLE__) && defined(ENABLE_CRASH_OVERRIDES)
336336 // Environment variable to disable any kind of crash dialog.
3535 TimeValue TimeValue::now() {
3636 struct timeval the_time;
3737 timerclear(&the_time);
38 if (0 != ::gettimeofday(&the_time,0)) {
38 if (0 != ::gettimeofday(&the_time,nullptr)) {
3939 // This is *really* unlikely to occur because the only gettimeofday
4040 // errors concern the timezone parameter which we're passing in as 0.
4141 // In the unlikely case it does happen, just return MinTime, no error
114114
115115 // We should have a BitsInit type now.
116116 BitsInit *BInit = dyn_cast(BI);
117 assert(BInit != 0);
117 assert(BInit != nullptr);
118118
119119 SmallVector NewBits(CurVal->getNumBits());
120120
8484
8585 public:
8686 TGParser(SourceMgr &SrcMgr, RecordKeeper &records)
87 : Lex(SrcMgr), CurMultiClass(0), Records(records), AnonCounter(0) {}
87 : Lex(SrcMgr), CurMultiClass(nullptr), Records(records), AnonCounter(0) {}
8888
8989 /// ParseFile - Main entrypoint for parsing a tblgen file. These parser
9090 /// routines return true on error, or false on success.
130130 bool ProcessForeachDefs(Record *CurRec, SMLoc Loc, IterSet &IterVals);
131131
132132 private: // Parser methods.
133 bool ParseObjectList(MultiClass *MC = 0);
133 bool ParseObjectList(MultiClass *MC = nullptr);
134134 bool ParseObject(MultiClass *MC);
135135 bool ParseClass();
136136 bool ParseMultiClass();
168168
169169 Init *ParseIDValue(Record *CurRec, const std::string &Name, SMLoc NameLoc,
170170 IDParseMode Mode = ParseValueMode);
171 Init *ParseSimpleValue(Record *CurRec, RecTy *ItemType = 0,
171 Init *ParseSimpleValue(Record *CurRec, RecTy *ItemType = nullptr,
172172 IDParseMode Mode = ParseValueMode);
173 Init *ParseValue(Record *CurRec, RecTy *ItemType = 0,
173 Init *ParseValue(Record *CurRec, RecTy *ItemType = nullptr,
174174 IDParseMode Mode = ParseValueMode);
175 std::vector ParseValueList(Record *CurRec, Record *ArgsRec = 0,
176 RecTy *EltTy = 0);
175 std::vector ParseValueList(Record *CurRec, Record *ArgsRec = nullptr,
176 RecTy *EltTy = nullptr);
177177 std::vector > ParseDagArgList(Record *);
178178 bool ParseOptionalRangeList(std::vector &Ranges);
179179 bool ParseOptionalBitList(std::vector &Ranges);
15581558 SDNode *ResNode = SelectCode(Node);
15591559
15601560 DEBUG(dbgs() << "=> ";
1561 if (ResNode == NULL || ResNode == Node)
1561 if (ResNode == nullptr || ResNode == Node)
15621562 Node->dump(CurDAG);
15631563 else
15641564 ResNode->dump(CurDAG);
2626 struct AArch64RegisterInfo : public AArch64GenRegisterInfo {
2727 AArch64RegisterInfo();
2828
29 const MCPhysReg *getCalleeSavedRegs(const MachineFunction *MF = 0) const;
29 const MCPhysReg *getCalleeSavedRegs(const MachineFunction *MF =nullptr) const;
3030 const uint32_t *getCallPreservedMask(CallingConv::ID) const;
3131
3232 unsigned getCSRFirstUseCost() const {
4343
4444 void eliminateFrameIndex(MachineBasicBlock::iterator II, int SPAdj,
4545 unsigned FIOperandNum,
46 RegScavenger *Rs = NULL) const;
46 RegScavenger *Rs = nullptr) const;
4747
4848 /// getCrossCopyRegClass - Returns a legal register class to copy a register
4949 /// in the specified class to or from. Returns original class if it is
4646 bool InConstantPool;
4747 public:
4848 explicit ARMAsmPrinter(TargetMachine &TM, MCStreamer &Streamer)
49 : AsmPrinter(TM, Streamer), AFI(NULL), MCP(NULL), InConstantPool(false) {
50 Subtarget = &TM.getSubtarget();
51 }
49 : AsmPrinter(TM, Streamer), AFI(nullptr), MCP(nullptr),
50 InConstantPool(false) {
51 Subtarget = &TM.getSubtarget();
52 }
5253
5354 const char *getPassName() const override {
5455 return "ARM Assembly / Object Emitter";
5556 }
5657
5758 void printOperand(const MachineInstr *MI, int OpNum, raw_ostream &O,
58 const char *Modifier = 0);
59 const char *Modifier = nullptr);
5960
6061 bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNum,
6162 unsigned AsmVariant, const char *ExtraCode,
623623 MI->getOperand(NumOps - (MI->isPredicable() ? 3 : 2));
624624 unsigned JTI = JTOP.getIndex();
625625 const MachineJumpTableInfo *MJTI = MF->getJumpTableInfo();
626 assert(MJTI != 0);
626 assert(MJTI != nullptr);
627627 const std::vector &JT = MJTI->getJumpTables();
628628 assert(JTI < JT.size());
629629 // Thumb instructions are 2 byte aligned, but JT entries are 4 byte
260260
261261 unsigned getInstrLatency(const InstrItineraryData *ItinData,
262262 const MachineInstr *MI,
263 unsigned *PredCost = 0) const override;
263 unsigned *PredCost = nullptr) const override;
264264
265265 int getInstrLatency(const InstrItineraryData *ItinData,
266266 SDNode *Node) const override;
100100 public:
101101 /// Code Generation virtual methods...
102102 const MCPhysReg *
103 getCalleeSavedRegs(const MachineFunction *MF = 0) const override;
103 getCalleeSavedRegs(const MachineFunction *MF = nullptr) const override;
104104 const uint32_t *getCallPreservedMask(CallingConv::ID) const override;
105105 const uint32_t *getNoPreservedMask() const;
106106
185185
186186 void eliminateFrameIndex(MachineBasicBlock::iterator II,
187187 int SPAdj, unsigned FIOperandNum,
188 RegScavenger *RS = NULL) const override;
188 RegScavenger *RS = nullptr) const override;
189189 };
190190
191191 } // end namespace llvm
3434 ARMHazardRecognizer(const InstrItineraryData *ItinData,
3535 const ScheduleDAG *DAG)
3636 : ScoreboardHazardRecognizer(ItinData, DAG, "post-RA-sched"),
37 LastMI(0) {}
37 LastMI(nullptr) {}
3838
3939 HazardType getHazardType(SUnit *SU, int Stalls) override;
4040 void Reset() override;
2222 public:
2323 ARMElfTargetObjectFile() :
2424 TargetLoweringObjectFileELF(),
25 AttributesSection(NULL)
25 AttributesSection(nullptr)
2626 {}
2727
2828 void Initialize(MCContext &Ctx, const TargetMachine &TM) override;
11011101 }
11021102
11031103 void ARMELFStreamer::emitFnStart() {
1104 assert(FnStart == 0);
1104 assert(FnStart == nullptr);
11051105 FnStart = getContext().CreateTempSymbol();
11061106 EmitLabel(FnStart);
11071107 }
5555 unsigned Reg) const override;
5656 void eliminateFrameIndex(MachineBasicBlock::iterator II,
5757 int SPAdj, unsigned FIOperandNum,
58 RegScavenger *RS = NULL) const override;
58 RegScavenger *RS = nullptr) const override;
5959 };
6060 }
6161
189189 /// allowsUnalignedMemoryAccesses - Returns true if the target allows
190190 /// unaligned memory accesses. of the specified type.
191191 bool allowsUnalignedMemoryAccesses(EVT VT, unsigned AddrSpace = 0,
192 bool *Fast = 0) const override {
192 bool *Fast = nullptr) const override {
193193 if (RequireStrictAlign)
194194 return false;
195195 // FIXME: True for Cyclone, but not necessary others.
192192 /// (possibly with @p OutUnscaledOp if OutUseUnscaledOp is true) and that
193193 /// is a legal offset.
194194 int isARM64FrameOffsetLegal(const MachineInstr &MI, int &Offset,
195 bool *OutUseUnscaledOp = NULL,
196 unsigned *OutUnscaledOp = NULL,
197 int *EmittableOffset = NULL);
195 bool *OutUseUnscaledOp = nullptr,
196 unsigned *OutUnscaledOp = nullptr,
197 int *EmittableOffset = nullptr);
198198
199199 static inline bool isUncondBranchOpcode(int Opc) { return Opc == ARM64::B; }
200200
3636
3737 /// Code Generation virtual methods...
3838 const MCPhysReg *
39 getCalleeSavedRegs(const MachineFunction *MF = 0) const override;
39 getCalleeSavedRegs(const MachineFunction *MF = nullptr) const override;
4040 const uint32_t *getCallPreservedMask(CallingConv::ID) const override;
4141
4242 unsigned getCSRFirstUseCost() const {
8181 int64_t Offset) const override;
8282 void eliminateFrameIndex(MachineBasicBlock::iterator II, int SPAdj,
8383 unsigned FIOperandNum,
84 RegScavenger *RS = NULL) const override;
84 RegScavenger *RS = nullptr) const override;
8585 bool cannotEliminateFrame(const MachineFunction &MF) const;
8686
8787 bool requiresVirtualBaseRegisters(const MachineFunction &MF) const override;
4747 case ARM64_AM::ROR: return "ror";
4848 case ARM64_AM::MSL: return "msl";
4949 }
50 return 0;
50 return nullptr;
5151 }
5252
5353 /// getShiftType - Extract the shift type.
103103 case ARM64_AM::SXTW: return "sxtw";
104104 case ARM64_AM::SXTX: return "sxtx";
105105 }
106 return 0;
106 return nullptr;
107107 }
108108
109109 /// getArithShiftValue - get the arithmetic shift value.
3434 AnalysisID StartAfter,
3535 AnalysisID StopAfter);
3636
37 virtual const DataLayout *getDataLayout() const { return 0; }
37 virtual const DataLayout *getDataLayout() const { return nullptr; }
3838 };
3939
4040 extern Target TheCppBackendTarget;
332332
333333 // Check for an exact kill (registers match).
334334 if (I1UseReg && I->killsRegister(I1UseReg)) {
335 assert(KillingInstr == 0 && "Should only see one killing instruction");
335 assert(!KillingInstr && "Should only see one killing instruction");
336336 KilledOperand = I1UseReg;
337337 KillingInstr = &*I;
338338 }
136136 State.addLoc(CCValAssign::getMem(ValNo, ValVT, ofst, LocVT, LocInfo));
137137 return false;
138138 }
139 llvm_unreachable(0);
139 llvm_unreachable(nullptr);
140140 }
141141
142142
110110 MachineInstr* MI,
111111 const SmallVectorImpl &Ops,
112112 MachineInstr* LoadMI) const {
113 return 0;
113 return nullptr;
114114 }
115115
116116 unsigned createVR(MachineFunction* MF, MVT VT) const;
5555 public:
5656 VLIWResourceModel(const TargetMachine &TM, const TargetSchedModel *SM) :
5757 SchedModel(SM), TotalPackets(0) {
58 ResourcesModel = TM.getInstrInfo()->CreateTargetScheduleState(&TM,NULL);
58 ResourcesModel = TM.getInstrInfo()->CreateTargetScheduleState(&TM, nullptr);
5959
6060 // This hard requirement could be relaxed,
6161 // but for now do not let it proceed.
119119 // Best scheduling cost.
120120 int SCost;
121121
122 SchedCandidate(): SU(NULL), SCost(0) {}
122 SchedCandidate(): SU(nullptr), SCost(0) {}
123123 };
124124 /// Represent the type of SchedCandidate found within a single queue.
125125 enum CandResult {
152152 /// Pending queues extend the ready queues with the same ID and the
153153 /// PendingFlag set.
154154 VLIWSchedBoundary(unsigned ID, const Twine &Name):
155 DAG(0), SchedModel(0), Available(ID, Name+".A"),
155 DAG(nullptr), SchedModel(nullptr), Available(ID, Name+".A"),
156156 Pending(ID << ConvergingVLIWScheduler::LogMaxQID, Name+".P"),
157 CheckPending(false), HazardRec(0), ResourceModel(0),
157 CheckPending(false), HazardRec(nullptr), ResourceModel(nullptr),
158158 CurrCycle(0), IssueCount(0),
159159 MinReadyCycle(UINT_MAX), MaxMinLatency(0) {}
160160
202202 LogMaxQID = 2
203203 };
204204
205 ConvergingVLIWScheduler():
206 DAG(0), SchedModel(0), Top(TopQID, "TopQ"), Bot(BotQID, "BotQ") {}
205 ConvergingVLIWScheduler()
206 : DAG(nullptr), SchedModel(nullptr), Top(TopQID, "TopQ"),
207 Bot(BotQID, "BotQ") {}
207208
208209 virtual void initialize(ScheduleDAGMI *dag) override;
209210
4747 HexagonRegisterInfo(HexagonSubtarget &st);
4848
4949 /// Code Generation virtual methods...
50 const MCPhysReg *getCalleeSavedRegs(const MachineFunction *MF = 0) const;
50 const MCPhysReg *
51 getCalleeSavedRegs(const MachineFunction *MF = nullptr) const;
5152
52 const TargetRegisterClass* const* getCalleeSavedRegClasses(
53 const MachineFunction *MF = 0) const;
53 const TargetRegisterClass* const*
54 getCalleeSavedRegClasses(const MachineFunction *MF = nullptr) const;
5455
5556 BitVector getReservedRegs(const MachineFunction &MF) const;
5657
5758 void eliminateFrameIndex(MachineBasicBlock::iterator II,
5859 int SPAdj, unsigned FIOperandNum,
59 RegScavenger *RS = NULL) const;
60 RegScavenger *RS = nullptr) const;
6061
6162 /// determineFrameLayout - Determine the size of the frame and maximum call
6263 /// frame size.
3030
3131 public:
3232 explicit HexagonMCInst():
33 MCInst(), MCID(0), packetStart(0), packetEnd(0) {};
33 MCInst(), MCID(nullptr), packetStart(0), packetEnd(0) {};
3434 HexagonMCInst(const MCInstrDesc& mcid):
3535 MCInst(), MCID(&mcid), packetStart(0), packetEnd(0) {};
3636
4444
4545 void MSP430InstPrinter::printOperand(const MCInst *MI, unsigned OpNo,
4646 raw_ostream &O, const char *Modifier) {
47 assert((Modifier == 0 || Modifier[0] == 0) && "No modifiers supported");
47 assert((Modifier == nullptr || Modifier[0] == 0) && "No modifiers supported");
4848 const MCOperand &Op = MI->getOperand(OpNo);
4949 if (Op.isReg()) {
5050 O << getRegisterName(Op.getReg());
3131 static const char *getRegisterName(unsigned RegNo);
3232
3333 void printOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O,
34 const char *Modifier = 0);
34 const char *Modifier = nullptr);
3535 void printPCRelImmOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O);
3636 void printSrcMemOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O,
37 const char *Modifier = 0);
37 const char *Modifier = nullptr);
3838 void printCCOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O);
3939
4040 };
5050 bool hasFP(const MachineFunction &MF) const;
5151 bool hasReservedCallFrame(const MachineFunction &MF) const;
5252 void processFunctionBeforeFrameFinalized(MachineFunction &MF,
53 RegScavenger *RS = NULL) const;
53 RegScavenger *RS = nullptr) const;
5454 };
5555
5656 } // End llvm namespace
461461 errs() << "LowerFormalArguments Unhandled argument type: "
462462 << RegVT.getSimpleVT().SimpleTy << "\n";
463463 #endif
464 llvm_unreachable(0);
464 llvm_unreachable(nullptr);
465465 }
466466 case MVT::i16:
467467 unsigned VReg = RegInfo.createVirtualRegister(&MSP430::GR16RegClass);
3434 MSP430RegisterInfo(MSP430TargetMachine &tm);
3535
3636 /// Code Generation virtual methods...
37 const MCPhysReg *getCalleeSavedRegs(const MachineFunction *MF = 0) const;
37 const MCPhysReg *
38 getCalleeSavedRegs(const MachineFunction *MF = nullptr) const;
3839
3940 BitVector getReservedRegs(const MachineFunction &MF) const;
4041 const TargetRegisterClass*
4243
4344 void eliminateFrameIndex(MachineBasicBlock::iterator II,
4445 int SPAdj, unsigned FIOperandNum,
45 RegScavenger *RS = NULL) const;
46 RegScavenger *RS = nullptr) const;
4647
4748 // Debug information queries.
4849 unsigned getFrameRegister(const MachineFunction &MF) const;
1717 static const unsigned MIPS_NACL_BUNDLE_ALIGN = 4u;
1818
1919 bool isBasePlusOffsetMemoryAccess(unsigned Opcode, unsigned *AddrIdx,
20 bool *IsStore = NULL);
20 bool *IsStore = nullptr);
2121 bool baseRegNeedsLoadStoreMask(unsigned Reg);
2222
2323 // This function creates an MCELFStreamer for Mips NaCl.
8181 MipsMCInstLower MCInstLowering;
8282
8383 explicit MipsAsmPrinter(TargetMachine &TM, MCStreamer &Streamer)
84 : AsmPrinter(TM, Streamer), MCP(0), InConstantPool(false),
84 : AsmPrinter(TM, Streamer), MCP(nullptr), InConstantPool(false),
8585 MCInstLowering(*this) {
8686 Subtarget = &TM.getSubtarget();
8787 }
121121 void printMemOperand(const MachineInstr *MI, int opNum, raw_ostream &O);
122122 void printMemOperandEA(const MachineInstr *MI, int opNum, raw_ostream &O);
123123 void printFCCOperand(const MachineInstr *MI, int opNum, raw_ostream &O,
124 const char *Modifier = 0);
124 const char *Modifier = nullptr);
125125 void EmitStartOfAsmFile(Module &M);
126126 void EmitEndOfAsmFile(Module &M);
127127 void PrintDebugValueComment(const MachineInstr *MI, raw_ostream &OS);
32673267 dbgs() << "Call operand #" << I << " has unhandled type "
32683268 << EVT(ArgVT).getEVTString();
32693269 #endif
3270 llvm_unreachable(0);
3270 llvm_unreachable(nullptr);
32713271 }
32723272 }
32733273 }
32993299 dbgs() << "Formal Arg #" << I << " has unhandled type "
33003300 << EVT(ArgVT).getEVTString();
33013301 #endif
3302 llvm_unreachable(0);
3302 llvm_unreachable(nullptr);
33033303 }
33043304 }
33053305
33243324 dbgs() << "Call result #" << I << " has unhandled type "
33253325 << EVT(VT).getEVTString() << '\n';
33263326 #endif
3327 llvm_unreachable(0);
3327 llvm_unreachable(nullptr);
33283328 }
33293329 }
33303330 }
2626 MipsCallEntry::MipsCallEntry(const StringRef &N) {
2727 #ifndef NDEBUG
2828 Name = N;
29 Val = 0;
29 Val = nullptr;
3030 #endif
3131 }
3232
154154 }
155155 }
156156
157 llvm_unreachable(0);
157 llvm_unreachable(nullptr);
158158 }
159159
160160 MBBInfo::MBBInfo(MachineDomTreeNode *N) : Node(N), HTScope(nullptr) {}
4646
4747 unsigned getRegPressureLimit(const TargetRegisterClass *RC,
4848 MachineFunction &MF) const;
49 const MCPhysReg *getCalleeSavedRegs(const MachineFunction *MF = 0) const;
49 const MCPhysReg *getCalleeSavedRegs(const MachineFunction *MF =nullptr) const;
5050 const uint32_t *getCallPreservedMask(CallingConv::ID) const;
5151 static const uint32_t *getMips16RetHelperMask();
5252
5959 /// Stack Frame Processing Methods
6060 void eliminateFrameIndex(MachineBasicBlock::iterator II,
6161 int SPAdj, unsigned FIOperandNum,
62 RegScavenger *RS = NULL) const;
62 RegScavenger *RS = nullptr) const;
6363
6464 void processFunctionBeforeFrameFinalized(MachineFunction &MF,
65 RegScavenger *RS = NULL) const;
65 RegScavenger *RS = nullptr) const;
6666
6767 /// Debug information queries.
6868 unsigned getFrameRegister(const MachineFunction &MF) const;
2929 void addMSAFloatType(MVT::SimpleValueType Ty,
3030 const TargetRegisterClass *RC);
3131
32 virtual bool allowsUnalignedMemoryAccesses(EVT VT, unsigned AS = 0,
33 bool *Fast = 0) const override;
32 bool allowsUnalignedMemoryAccesses(EVT VT, unsigned AS = 0,
33 bool *Fast = nullptr) const override;
3434
3535 virtual SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const;
3636
6666 { return &DL;}
6767
6868 virtual const InstrItineraryData *getInstrItineraryData() const {
69 return Subtarget.inMips16Mode() ? 0 : &InstrItins;
69 return Subtarget.inMips16Mode() ? nullptr : &InstrItins;
7070 }
7171
7272 virtual MipsJITInfo *getJITInfo()
3636
3737 void printOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O);
3838 void printCvtMode(const MCInst *MI, int OpNum, raw_ostream &O,
39 const char *Modifier = 0);
39 const char *Modifier = nullptr);
4040 void printCmpMode(const MCInst *MI, int OpNum, raw_ostream &O,
41 const char *Modifier = 0);
41 const char *Modifier = nullptr);
4242 void printLdStCode(const MCInst *MI, int OpNum,
43 raw_ostream &O, const char *Modifier = 0);
43 raw_ostream &O, const char *Modifier = nullptr);
4444 void printMemOperand(const MCInst *MI, int OpNum,
45 raw_ostream &O, const char *Modifier = 0);
45 raw_ostream &O, const char *Modifier = nullptr);
4646 void printProtoIdent(const MCInst *MI, int OpNum,
47 raw_ostream &O, const char *Modifier = 0);
47 raw_ostream &O, const char *Modifier = nullptr);
4848 };
4949
5050 }
207207 MCOperand GetSymbolRef(const MCSymbol *Symbol);
208208 unsigned encodeVirtualRegister(unsigned Reg);
209209
210 void EmitAlignment(unsigned NumBits, const GlobalValue *GV = 0) const {}
210 void EmitAlignment(unsigned NumBits, const GlobalValue *GV = nullptr) const {}
211211
212212 void printVecModifiedImmediate(const MachineOperand &MO, const char *Modifier,
213213 raw_ostream &O);
214214 void printMemOperand(const MachineInstr *MI, int opNum, raw_ostream &O,
215 const char *Modifier = 0);
215 const char *Modifier = nullptr);
216216 void printImplicitDef(const MachineInstr *MI, raw_ostream &O) const;
217217 void printModuleLevelGV(const GlobalVariable *GVar, raw_ostream &O,
218218 bool = false);
235235 unsigned AsmVariant, const char *ExtraCode,
236236 raw_ostream &);
237237 void printOperand(const MachineInstr *MI, int opNum, raw_ostream &O,
238 const char *Modifier = 0);
238 const char *Modifier = nullptr);
239239 bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo,
240240 unsigned AsmVariant, const char *ExtraCode,
241241 raw_ostream &);
311311 : AsmPrinter(TM, Streamer),
312312 nvptxSubtarget(TM.getSubtarget()) {
313313 CurrentBankselLabelInBasicBlock = "";
314 reader = NULL;
314 reader = nullptr;
315315 EmitGeneric = (nvptxSubtarget.getDrvInterface() == NVPTX::CUDA);
316316 }
317317
6767 }
6868 void AddValueSymbols(MCAssembler *) const {};
6969 const MCSection *FindAssociatedSection() const {
70 return NULL;
70 return nullptr;
7171 }
7272
7373 // There are no TLS NVPTXMCExprs at the moment.
4141
4242 // NVPTX callee saved registers
4343 virtual const MCPhysReg *
44 getCalleeSavedRegs(const MachineFunction *MF = 0) const;
44 getCalleeSavedRegs(const MachineFunction *MF = nullptr) const;
4545
4646 // NVPTX callee saved register classes
4747 virtual const TargetRegisterClass *const *
5151
5252 virtual void eliminateFrameIndex(MachineBasicBlock::iterator MI, int SPAdj,
5353 unsigned FIOperandNum,
54 RegScavenger *RS = NULL) const;
54 RegScavenger *RS = nullptr) const;
5555
5656 virtual int getDwarfRegNum(unsigned RegNum, bool isEH) const;
5757 virtual unsigned getFrameRegister(const MachineFunction &MF) const;
2121
2222 public:
2323 NVPTXTargetObjectFile() {
24 TextSection = 0;
25 DataSection = 0;
26 BSSSection = 0;
27 ReadOnlySection = 0;
24 TextSection = nullptr;
25 DataSection = nullptr;
26 BSSSection = nullptr;
27 ReadOnlySection = nullptr;
2828
29 StaticCtorSection = 0;
30 StaticDtorSection = 0;
31 LSDASection = 0;
32 EHFrameSection = 0;
33 DwarfAbbrevSection = 0;
34 DwarfInfoSection = 0;
35 DwarfLineSection = 0;
36 DwarfFrameSection = 0;
37 DwarfPubTypesSection = 0;
38 DwarfDebugInlineSection = 0;
39 DwarfStrSection = 0;
40 DwarfLocSection = 0;
41 DwarfARangesSection = 0;
42 DwarfRangesSection = 0;
43 DwarfMacroInfoSection = 0;
29 StaticCtorSection = nullptr;
30 StaticDtorSection = nullptr;
31 LSDASection = nullptr;
32 EHFrameSection = nullptr;
33 DwarfAbbrevSection = nullptr;
34 DwarfInfoSection = nullptr;
35 DwarfLineSection = nullptr;
36 DwarfFrameSection = nullptr;
37 DwarfPubTypesSection = nullptr;
38 DwarfDebugInlineSection = nullptr;
39 DwarfStrSection = nullptr;
40 DwarfLocSection = nullptr;
41 DwarfARangesSection = nullptr;
42 DwarfRangesSection = nullptr;
43 DwarfMacroInfoSection = nullptr;
4444 }
4545
4646 virtual ~NVPTXTargetObjectFile();
4040
4141 void printOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O);
4242 void printPredicateOperand(const MCInst *MI, unsigned OpNo,
43 raw_ostream &O, const char *Modifier = 0);
43 raw_ostream &O, const char *Modifier = nullptr);
4444
4545 void printU2ImmOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O);
4646 void printS5ImmOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O);
4545 void replaceFPWithRealFP(MachineFunction &MF) const;
4646
4747 void processFunctionBeforeCalleeSavedScan(MachineFunction &MF,
48 RegScavenger *RS = NULL) const;
48 RegScavenger *RS = nullptr) const;
4949 void processFunctionBeforeFrameFinalized(MachineFunction &MF,
50 RegScavenger *RS = NULL) const;
50 RegScavenger *RS = nullptr) const;
5151 void addScavengingSpillSlot(MachineFunction &MF, RegScavenger *RS) const;
5252
5353 bool spillCalleeSavedRegisters(MachineBasicBlock &MBB,
155155 // Early exit if not using the SVR4 ABI.
156156 if (!Subtarget.isSVR4ABI()) {
157157 NumEntries = 0;
158 return 0;
158 return nullptr;
159159 }
160160
161161 // Note that the offsets here overlap, but this is fixed up in
38003800 errs() << "Call operand #" << i << " has unhandled type "
38013801 << EVT(ArgVT).getEVTString() << "\n";
38023802 #endif
3803 llvm_unreachable(0);
3803 llvm_unreachable(nullptr);
38043804 }
38053805 }
38063806 } else {
54865486 SelectionDAG &DAG) const {
54875487 SDLoc dl(Op);
54885488 BuildVectorSDNode *BVN = dyn_cast(Op.getNode());
5489 assert(BVN != 0 && "Expected a BuildVectorSDNode in LowerBUILD_VECTOR");
5489 assert(BVN && "Expected a BuildVectorSDNode in LowerBUILD_VECTOR");
54905490
54915491 // Check if this is a splat of a constant value.
54925492 APInt APSplatBits, APSplatUndef;
491491 /// relative to software emulation.
492492 virtual bool allowsUnalignedMemoryAccesses(EVT VT,
493493 unsigned AddrSpace,
494 bool *Fast = 0) const;
494 bool *Fast = nullptr) const;
495495
496496 /// isFMAFasterThanFMulAndFAdd - Return true if an FMA operation is faster
497497 /// than a pair of fmul and fadd instructions. fmuladd intrinsics will be
4343 getLargestLegalSuperClass(const TargetRegisterClass *RC) const;
4444
4545 /// Code Generation virtual methods...
46 const MCPhysReg *getCalleeSavedRegs(const MachineFunction* MF = 0) const;
46 const MCPhysReg *getCalleeSavedRegs(const MachineFunction* MF =nullptr) const;
4747 const uint32_t *getCallPreservedMask(CallingConv::ID CC) const;
4848 const uint32_t *getNoPreservedMask() const;
4949
8484 int &FrameIdx) const;
8585 void eliminateFrameIndex(MachineBasicBlock::iterator II,
8686 int SPAdj, unsigned FIOperandNum,
87 RegScavenger *RS = NULL) const;
87 RegScavenger *RS = nullptr) const;
8888
8989 // Support for virtual base registers.
9090 bool needsFrameBaseReg(MachineInstr *MI, int64_t Offset) const;
117117 SmallVectorImpl &NewNodes) const;
118118 unsigned getOpcodeAfterMemoryUnfold(unsigned Opc,
119119 bool UnfoldLoad, bool UnfoldStore,
120 unsigned *LoadRegIndex = 0) const;
120 unsigned *LoadRegIndex = nullptr) const;
121121 bool shouldScheduleLoadsNear(SDNode *Load1, SDNode *Load2,
122122 int64_t Offset1, int64_t Offset2,
123123 unsigned NumLoads) const;
4242 /// \returns The ISA reg class that is equivalent to \p RC.
4343 virtual const TargetRegisterClass * getISARegClass(
4444 const TargetRegisterClass * RC) const {
45 assert(!"Unimplemented"); return NULL;
45 assert(!"Unimplemented"); return nullptr;
4646 }
4747
4848 virtual const TargetRegisterClass* getCFGStructurizerRegClass(MVT VT) const {
49 assert(!"Unimplemented"); return NULL;
49 assert(!"Unimplemented"); return nullptr;
5050 }
5151
5252 virtual unsigned getHWRegIndex(unsigned Reg) const {
167167 MLI = &getAnalysis();
168168 DEBUG(dbgs() << "LoopInfo:\n"; PrintLoopinfo(*MLI););
169169 MDT = &getAnalysis();
170 DEBUG(MDT->print(dbgs(), (const llvm::Module*)0););
170 DEBUG(MDT->print(dbgs(), (const llvm::Module*)nullptr););
171171 PDT = &getAnalysis();
172172 DEBUG(PDT->print(dbgs()););
173173 prepare();
3333 class AMDGPUIntrinsicInfo : public TargetIntrinsicInfo {
3434 public:
3535 AMDGPUIntrinsicInfo(TargetMachine *tm);
36 std::string getName(unsigned int IntrId, Type **Tys = 0,
36 std::string getName(unsigned int IntrId, Type **Tys = nullptr,
3737 unsigned int numTys = 0) const;
3838 unsigned int lookupName(const char *Name, unsigned int Len) const;
3939 bool isOverloaded(unsigned int IID) const;
4040 Function *getDeclaration(Module *M, unsigned int ID,
41 Type **Tys = 0,
41 Type **Tys = nullptr,
4242 unsigned int numTys = 0) const;
4343 };
4444
191191
192192 unsigned int getInstrLatency(const InstrItineraryData *ItinData,
193193 const MachineInstr *MI,
194 unsigned *PredCost = 0) const;
194 unsigned *PredCost = nullptr) const;
195195
196196 virtual int getInstrLatency(const InstrItineraryData *ItinData,
197197 SDNode *Node) const { return 1;}
6767
6868 public:
6969 R600SchedStrategy() :
70 DAG(0), TII(0), TRI(0), MRI(0) {
70 DAG(nullptr), TII(nullptr), TRI(nullptr), MRI(nullptr) {
7171 }
7272
7373 virtual ~R600SchedStrategy() {
7878 bool NewMI=false) const;
7979
8080 bool isTriviallyReMaterializable(const MachineInstr *MI,
81 AliasAnalysis *AA = 0) const;
81 AliasAnalysis *AA = nullptr) const;
8282
8383 virtual unsigned getIEQOpcode() const {
8484 llvm_unreachable("Unimplemented");
244244 case k_Immediate: OS << "Imm: " << getImm() << "\n"; break;
245245 case k_MemoryReg: OS << "Mem: " << getMemBase() << "+"
246246 << getMemOffsetReg() << "\n"; break;
247 case k_MemoryImm: assert(getMemOff() != 0);
247 case k_MemoryImm: assert(getMemOff() != nullptr);
248248 OS << "Mem: " << getMemBase()
249249 << "+" << *getMemOff()
250250 << "\n"; break;
4141
4242 void printOperand(const MCInst *MI, int opNum, raw_ostream &OS);
4343 void printMemOperand(const MCInst *MI, int opNum, raw_ostream &OS,
44 const char *Modifier = 0);
44 const char *Modifier = nullptr);
4545 void printCCOperand(const MCInst *MI, int opNum, raw_ostream &OS);
4646 bool printGetPCX(const MCInst *MI, unsigned OpNo, raw_ostream &OS);
4747
4040 bool hasReservedCallFrame(const MachineFunction &MF) const;
4141 bool hasFP(const MachineFunction &MF) const;
4242 void processFunctionBeforeCalleeSavedScan(MachineFunction &MF,
43 RegScavenger *RS = NULL) const;
43 RegScavenger *RS = nullptr) const;
4444
4545 private:
4646 // Remap input registers to output registers for leaf procedure.
3030 SparcRegisterInfo(SparcSubtarget &st);
3131
3232 /// Code Generation virtual methods...
33 const MCPhysReg *getCalleeSavedRegs(const MachineFunction *MF = 0) const;
33 const MCPhysReg *getCalleeSavedRegs(const MachineFunction *MF =nullptr) const;
3434 const uint32_t* getCallPreservedMask(CallingConv::ID CC) const;
3535
3636 const uint32_t* getRTCallPreservedMask(CallingConv::ID CC) const;
4242
4343 void eliminateFrameIndex(MachineBasicBlock::iterator II,
4444 int SPAdj, unsigned FIOperandNum,
45 RegScavenger *RS = NULL) const;
45 RegScavenger *RS = nullptr) const;
4646
4747 void processFunctionBeforeFrameFinalized(MachineFunction &MF,
48 RegScavenger *RS = NULL) const;
48 RegScavenger *RS = nullptr) const;
4949
5050 // Debug information queries.
5151 unsigned getFrameRegister(const MachineFunction &MF) const;
228228 // BRANCH exists, return the opcode for the latter, otherwise return 0.
229229 // MI, if nonnull, is the compare instruction.
230230 unsigned getCompareAndBranch(unsigned Opcode,
231 const MachineInstr *MI = 0) const;
231 const MachineInstr *MI = nullptr) const;
232232
233233 // Emit code before MBBI in MI to move immediate value Value into
234234 // physical register Reg.
4848 bool trackLivenessAfterRegAlloc(const MachineFunction &MF) const override {
4949 return true;
5050 }
51 const MCPhysReg *getCalleeSavedRegs(const MachineFunction *MF = 0) const
51 const MCPhysReg *getCalleeSavedRegs(const MachineFunction *MF = nullptr) const
5252 override;
5353 BitVector getReservedRegs(const MachineFunction &MF) const override;
5454 void eliminateFrameIndex(MachineBasicBlock::iterator MI,
421421 bool AddressOf = false,
422422 SMLoc OffsetOfLoc = SMLoc(),
423423 StringRef SymName = StringRef(),
424 void *OpDecl = 0) {
424 void *OpDecl = nullptr) {
425425 X86Operand *Res = new X86Operand(Register, StartLoc, EndLoc);
426426 Res->Reg.RegNo = RegNo;
427427 Res->AddressOf = AddressOf;
440440 /// Create an absolute memory operand.
441441 static X86Operand *CreateMem(const MCExpr *Disp, SMLoc StartLoc, SMLoc EndLoc,
442442 unsigned Size = 0, StringRef SymName = StringRef(),
443 void *OpDecl = 0) {
443 void *OpDecl = nullptr) {
444444 X86Operand *Res = new X86Operand(Memory, StartLoc, EndLoc);
445445 Res->Mem.SegReg = 0;
446446 Res->Mem.Disp = Disp;
460460 unsigned Scale, SMLoc StartLoc, SMLoc EndLoc,
461461 unsigned Size = 0,
462462 StringRef SymName = StringRef(),
463 void *OpDecl = 0) {
463 void *OpDecl = nullptr) {
464464 // We should never just have a displacement, that should be parsed as an
465465 // absolute memory operand.
466466 assert((SegReg || BaseReg || IndexReg) && "Invalid memory operand!");
7979 static int modRMRequired(OpcodeType type,
8080 InstructionContext insnContext,
8181 uint16_t opcode) {
82 const struct ContextDecision* decision = 0;
82 const struct ContextDecision* decision = nullptr;
8383
8484 switch (type) {
8585 case ONEBYTE:
123123 InstructionContext insnContext,
124124 uint8_t opcode,
125125 uint8_t modRM) {
126 const struct ModRMDecision* dec = 0;
126 const struct ModRMDecision* dec = nullptr;
127127
128128 switch (type) {
129129 case ONEBYTE:
14751475 #ifndef NDEBUG
14761476 dbgs() << "Cannot encode all operands of: " << MI << "\n";
14771477 #endif
1478 llvm_unreachable(0);
1478 llvm_unreachable(nullptr);
14791479 }
14801480
14811481 MCE.processDebugLoc(MI.getDebugLoc(), false);
4646 void adjustForHiPEPrologue(MachineFunction &MF) const override;
4747
4848 void processFunctionBeforeCalleeSavedScan(MachineFunction &MF,
49 RegScavenger *RS = NULL) const override;
49 RegScavenger *RS = nullptr) const override;
5050
5151 bool spillCalleeSavedRegisters(MachineBasicBlock &MBB,
5252 MachineBasicBlock::iterator MI,
103103 void dump() {
104104 dbgs() << "X86ISelAddressMode " << this << '\n';
105105 dbgs() << "Base_Reg ";
106 if (Base_Reg.getNode() != 0)
106 if (Base_Reg.getNode())
107107 Base_Reg.getNode()->dump();
108108 else
109109 dbgs() << "nul";
110110 dbgs() << " Base.FrameIndex " << Base_FrameIndex << '\n'
111111 << " Scale" << Scale << '\n'
112112 << "IndexReg ";
113 if (IndexReg.getNode() != 0)
113 if (IndexReg.getNode())
114114 IndexReg.getNode()->dump();
115115 else
116116 dbgs() << "nul";
27722772 SDNode *ResNode = SelectCode(Node);
27732773
27742774 DEBUG(dbgs() << "=> ";
2775 if (ResNode == NULL || ResNode == Node)
2775 if (ResNode == nullptr || ResNode == Node)
27762776 Node->dump(CurDAG);
27772777 else
27782778 ResNode->dump(CurDAG);
1151411514 ConstantSDNode *ND;
1151511515
1151611516 switch(Opc) {
11517 default: llvm_unreachable(0);
11517 default: llvm_unreachable(nullptr);
1151811518 case X86ISD::VSHLI:
1151911519 for (unsigned i=0; i!=NumElts; ++i) {
1152011520 SDValue CurrentOp = SrcOp->getOperand(i);
782782
783783 /// Intel processors have a unified instruction and data cache
784784 const char * getClearCacheBuiltinName() const {
785 return 0; // nothing to do, move along.
785 return nullptr; // nothing to do, move along.
786786 }
787787
788788 /// createFastISel - This method returns a target specific FastISel object,
5151 unsigned GVOpFlags;
5252
5353 X86AddressMode()
54 : BaseType(RegBase), Scale(1), IndexReg(0), Disp(0), GV(0), GVOpFlags(0) {
54 : BaseType(RegBase), Scale(1), IndexReg(0), Disp(0), GV(nullptr),
55 GVOpFlags(0) {
5556 Base.Reg = 0;
5657 }
5758
324324 /// value.
325325 unsigned getOpcodeAfterMemoryUnfold(unsigned Opc,
326326 bool UnfoldLoad, bool UnfoldStore,
327 unsigned *LoadRegIndex = 0) const override;
327 unsigned *LoadRegIndex = nullptr) const override;
328328
329329 /// areLoadsFromSameBasePtr - This is used by the pre-regalloc scheduler
330330 /// to determine if two loads are loading from the same base address. It
121121
122122 void eliminateFrameIndex(MachineBasicBlock::iterator MI,
123123 int SPAdj, unsigned FIOperandNum,
124 RegScavenger *RS = NULL) const override;
124 RegScavenger *RS = nullptr) const override;
125125
126126 // Debug information queries.
127127 unsigned getFrameRegister(const MachineFunction &MF) const override;
494494 errs() << "eliminateCallFramePseudoInstr size too big: "
495495 << Amount << "\n";
496496 #endif
497 llvm_unreachable(0);
497 llvm_unreachable(nullptr);
498498 }
499499
500500 MachineInstr *New;
4545 bool hasFP(const MachineFunction &MF) const;
4646
4747 void processFunctionBeforeCalleeSavedScan(MachineFunction &MF,
48 RegScavenger *RS = NULL) const;
48 RegScavenger *RS = nullptr) const;
4949
5050 void processFunctionBeforeFrameFinalized(MachineFunction &MF,
51 RegScavenger *RS = NULL) const;
51 RegScavenger *RS = nullptr) const;
5252
5353 //! Stack slot size (4 bytes)
5454 static int stackSlotSize() {
13441344 errs() << "LowerFormalArguments Unhandled argument type: "
13451345 << RegVT.getSimpleVT().SimpleTy << "\n";
13461346 #endif
1347 llvm_unreachable(0);
1347 llvm_unreachable(nullptr);
13481348 }
13491349 case MVT::i32:
13501350 unsigned VReg = RegInfo.createVirtualRegister(&XCore::GRRegsRegClass);
2828
2929 /// Code Generation virtual methods...
3030
31 const MCPhysReg *getCalleeSavedRegs(const MachineFunction *MF = 0) const;
31 const MCPhysReg *getCalleeSavedRegs(const MachineFunction *MF =nullptr) const;
3232
3333 BitVector getReservedRegs(const MachineFunction &MF) const;
3434
4040
4141 void eliminateFrameIndex(MachineBasicBlock::iterator II,
4242 int SPAdj, unsigned FIOperandNum,
43 RegScavenger *RS = NULL) const;
43 RegScavenger *RS = nullptr) const;
4444
4545 // Debug information queries.
4646 unsigned getFrameRegister(const MachineFunction &MF) const;
9797 BuilderTy *Builder;
9898
9999 static char ID; // Pass identification, replacement for typeid
100 InstCombiner() : FunctionPass(ID), DL(0), Builder(0) {
100 InstCombiner() : FunctionPass(ID), DL(nullptr), Builder(nullptr) {
101101 MinimizeSize = false;
102102 initializeInstCombinerPass(*PassRegistry::getPassRegistry());
103103 }
157157 Constant *RHSC);
158158 Instruction *FoldCmpLoadFromIndexedGlobal(GetElementPtrInst *GEP,
159159 GlobalVariable *GV, CmpInst &ICI,
160 ConstantInt *AndCst = 0);
160 ConstantInt *AndCst = nullptr);
161161 Instruction *visitFCmpInst(FCmpInst &I);
162162 Instruction *visitICmpInst(ICmpInst &I);
163163 Instruction *visitICmpInstWithCastAndCast(ICmpInst &ICI);
217217 Instruction *visitLandingPadInst(LandingPadInst &LI);
218218
219219 // visitInstruction - Specify what to return for unhandled instructions...
220 Instruction *visitInstruction(Instruction &I) { return 0; }
220 Instruction *visitInstruction(Instruction &I) { return nullptr; }
221221
222222 private:
223223 bool ShouldChangeType(Type *From, Type *To) const;
252252 // in the program. Add the new instruction to the worklist.
253253 //
254254 Instruction *InsertNewInstBefore(Instruction *New, Instruction &Old) {
255 assert(New && New->getParent() == 0 &&
255 assert(New && !New->getParent() &&
256256 "New instruction already inserted into a basic block!");
257257 BasicBlock *BB = Old.getParent();
258258 BB->getInstList().insert(&Old, New); // Insert inst
307307 Worklist.Remove(&I);
308308 I.eraseFromParent();
309309 MadeIRChange = true;
310 return 0; // Don't do anything with FI
310 return nullptr; // Don't do anything with FI
311311 }
312312
313313 void ComputeMaskedBits(Value *V, APInt &KnownZero,
101101 Value *InstCombiner::SimplifyDemandedUseBits(Value *V, APInt DemandedMask,
102102 APInt &KnownZero, APInt &KnownOne,
103103 unsigned Depth) {
104 assert(V != 0 && "Null pointer of Value???");
104 assert(V != nullptr && "Null pointer of Value???");
105105 assert(Depth <= 6 && "Limit Search Depth");
106106 uint32_t BitWidth = DemandedMask.getBitWidth();
107107 Type *VTy = V->getType();
444444 if (EI->getOperand(0) == PermittedRHS || PermittedRHS == nullptr) {
445445 Value *RHS = EI->getOperand(0);
446446 ShuffleOps LR = CollectShuffleElements(VecOp, Mask, RHS);
447 assert(LR.second == 0 || LR.second == RHS);
447 assert(LR.second == nullptr || LR.second == RHS);
448448
449449 if (LR.first->getType() != RHS->getType()) {
450450 // We tried our best, but we can't find anything compatible with RHS
6868 if (It == WorklistMap.end()) return; // Not in worklist.
6969
7070 // Don't bother moving everything down, just null out the slot.
71 Worklist[It->second] = 0;
71 Worklist[It->second] = nullptr;
7272
7373 WorklistMap.erase(It);
7474 }
21462146 IRB.CreateStore(getOrigin(A),
21472147 getOriginPtrForArgument(A, IRB, ArgOffset));
21482148 (void)Store;
2149 assert(Size != 0 && Store != 0);
2149 assert(Size != 0 && Store != nullptr);
21502150 DEBUG(dbgs() << " Param:" << *Store << "\n");
21512151 ArgOffset += DataLayout::RoundUpAlignment(Size, 8);
21522152 }
4242 EPT_RetainAutoreleaseRV
4343 };
4444
45 ARCRuntimeEntryPoints() : TheModule(0),
46 AutoreleaseRV(0),
47 Release(0),
48 Retain(0),
49 RetainBlock(0),
50 Autorelease(0),
51 StoreStrong(0),
52 RetainRV(0),
53 RetainAutorelease(0),
54 RetainAutoreleaseRV(0) { }
45 ARCRuntimeEntryPoints() : TheModule(nullptr),
46 AutoreleaseRV(nullptr),
47 Release(nullptr),
48 Retain(nullptr),
49 RetainBlock(nullptr),
50 Autorelease(nullptr),
51 StoreStrong(nullptr),
52 RetainRV(nullptr),
53 RetainAutorelease(nullptr),
54 RetainAutoreleaseRV(nullptr) { }
5555
5656 ~ARCRuntimeEntryPoints() { }
5757
5858 void Initialize(Module *M) {
5959 TheModule = M;
60 AutoreleaseRV = 0;
61 Release = 0;
62 Retain = 0;
63 RetainBlock = 0;
64 Autorelease = 0;
65 StoreStrong = 0;
66 RetainRV = 0;
67 RetainAutorelease = 0;
68 RetainAutoreleaseRV = 0;
60 AutoreleaseRV = nullptr;
61 Release = nullptr;
62 Retain = nullptr;
63 RetainBlock = nullptr;
64 Autorelease = nullptr;
65 StoreStrong = nullptr;
66 RetainRV = nullptr;
67 RetainAutorelease = nullptr;
68 RetainAutoreleaseRV = nullptr;
6969 }
7070
7171 Constant *get(const EntryPointType entry) {
72 assert(TheModule != 0 && "Not initialized.");
72 assert(TheModule != nullptr && "Not initialized.");
7373
7474 switch (entry) {
7575 case EPT_AutoreleaseRV:
818818 /// arc annotation processor tool. If the function is an
819819 static MDString *AppendMDNodeToSourcePtr(unsigned NodeId,
820820 Value *Ptr) {
821 MDString *Hash = 0;
821 MDString *Hash = nullptr;
822822
823823 // If pointer is a result of an instruction and it does not have a source
824824 // MDNode it, attach a new MDNode onto it. If pointer is a result of
880880 MDString *PtrSourceMDNodeID,
881881 Sequence OldSeq,
882882 Sequence NewSeq) {
883 MDNode *Node = 0;
883 MDNode *Node = nullptr;
884884 Value *tmp[3] = {PtrSourceMDNodeID,
885885 SequenceToMDString(Inst->getContext(),
886886 OldSeq),
916916
917917 Value *PtrName;
918918 StringRef Tmp = Ptr->getName();
919 if (0 == (PtrName = M->getGlobalVariable(Tmp, true))) {
919 if (nullptr == (PtrName = M->getGlobalVariable(Tmp, true))) {
920920 Value *ActualPtrName = Builder.CreateGlobalStringPtr(Tmp,
921921 Tmp + "_STR");
922922 PtrName = new GlobalVariable(*M, I8X, true, GlobalVariable::InternalLinkage,
925925
926926 Value *S;
927927 std::string SeqStr = SequenceToString(Seq);
928 if (0 == (S = M->getGlobalVariable(SeqStr, true))) {
928 if (nullptr == (S = M->getGlobalVariable(SeqStr, true))) {
929929 Value *ActualPtrName = Builder.CreateGlobalStringPtr(SeqStr,
930930 SeqStr + "_STR");
931931 S = new GlobalVariable(*M, I8X, true, GlobalVariable::InternalLinkage,
959959
960960 Value *PtrName;
961961 StringRef Tmp = Ptr->getName();
962 if (0 == (PtrName = M->getGlobalVariable(Tmp, true))) {
962 if (nullptr == (PtrName = M->getGlobalVariable(Tmp, true))) {
963963 Value *ActualPtrName = Builder.CreateGlobalStringPtr(Tmp,
964964 Tmp + "_STR");
965965 PtrName = new GlobalVariable(*M, I8X, true, GlobalVariable::InternalLinkage,
968968
969969 Value *S;
970970 std::string SeqStr = SequenceToString(Seq);
971 if (0 == (S = M->getGlobalVariable(SeqStr, true))) {
971 if (nullptr == (S = M->getGlobalVariable(SeqStr, true))) {
972972 Value *ActualPtrName = Builder.CreateGlobalStringPtr(SeqStr,
973973 SeqStr + "_STR");
974974 S = new GlobalVariable(*M, I8X, true, GlobalVariable::InternalLinkage,
213213 }
214214
215215 Expression ValueTable::create_extractvalue_expression(ExtractValueInst *EI) {
216 assert(EI != 0 && "Not an ExtractValueInst?");
216 assert(EI && "Not an ExtractValueInst?");
217217 Expression e;
218218 e.type = EI->getType();
219219 e.opcode = 0;
334334 /// iteration.
335335 ///
336336 void LICM::SinkRegion(DomTreeNode *N) {
337 assert(N != 0 && "Null dominator tree node?");
337 assert(N != nullptr && "Null dominator tree node?");
338338 BasicBlock *BB = N->getBlock();
339339
340340 // If this subregion is not in the top level loop at all, exit.
381381 /// before uses, allowing us to hoist a loop body in one pass without iteration.
382382 ///
383383 void LICM::HoistRegion(DomTreeNode *N) {
384 assert(N != 0 && "Null dominator tree node?");
384 assert(N != nullptr && "Null dominator tree node?");
385385 BasicBlock *BB = N->getBlock();
386386
387387 // If this subregion is not in the top level loop at all, exit.
626626 #ifndef NDEBUG
627627 dbgs() << "Unknown terminator instruction: " << *TI << '\n';
628628 #endif
629 llvm_unreachable(0);
629 llvm_unreachable(nullptr);
630630 }
631631
632632 // visit Implementations - Something changed in this instruction, either an
216216 ///
217217 void llvm::ReplaceInstWithInst(BasicBlock::InstListType &BIL,
218218 BasicBlock::iterator &BI, Instruction *I) {
219 assert(I->getParent() == 0 &&
219 assert(I->getParent() == nullptr &&
220220 "ReplaceInstWithInst: Instruction already inserted into basic block!");
221221
222222 // Insert the new instruction into the basic block...
5858 BasicBlock *OrigPH, BasicBlock *NewPH,
5959 ValueToValueMapTy &LVMap, Pass *P) {
6060 BasicBlock *Latch = L->getLoopLatch();
61 assert(Latch != 0 && "Loop must have a latch");
61 assert(Latch && "Loop must have a latch");
6262
6363 // Create a PHI node for each outgoing value from the original loop
6464 // (which means it is an outgoing value from the prolog code too).
110110 new ICmpInst(InsertPt, ICmpInst::ICMP_ULT, TripCount,
111111 ConstantInt::get(TripCount->getType(), Count));
112112 BasicBlock *Exit = L->getUniqueExitBlock();
113 assert(Exit != 0 && "Loop must have a single exit block only");
113 assert(Exit && "Loop must have a single exit block only");
114114 // Split the exit to maintain loop canonicalization guarantees
115115 SmallVector Preds(pred_begin(Exit), pred_end(Exit));
116116 if (!Exit->isLandingPad()) {
5454 }
5555
5656 void SSAUpdater::AddAvailableValue(BasicBlock *BB, Value *V) {
57 assert(ProtoType != 0 && "Need to initialize SSAUpdater");
57 assert(ProtoType && "Need to initialize SSAUpdater");
5858 assert(ProtoType == V->getType() &&
5959 "All rewritten values must have the same type");
6060 getAvailableVals(AV)[BB] = V;
24852485 }
24862486 // Update users.
24872487 if (ReductionPHI) {
2488 assert(ReductionRoot != NULL && "Need a reduction operation");
2488 assert(ReductionRoot && "Need a reduction operation");
24892489 ReductionRoot->setOperand(0, VectorizedTree);
24902490 ReductionRoot->setOperand(1, ReductionPHI);
24912491 } else
115115 // parsed), and false on success.
116116 //
117117 bool BugDriver::addSources(const std::vector &Filenames) {
118 assert(Program == 0 && "Cannot call addSources multiple times!");
118 assert(!Program && "Cannot call addSources multiple times!");
119119 assert(!Filenames.empty() && "Must specify at least on input filename!");
120120
121121 // Load the first input file.
201201 const std::string &BitcodeFile = "",
202202 const std::string &SharedObj = "",
203203 bool RemoveBitcode = false,
204 std::string *Error = 0) const;
204 std::string *Error = nullptr) const;
205205
206206 /// EmitProgressBitcode - This function is used to output M to a file named
207207 /// "bugpoint-ID.bc".
243243 /// this method will never return null.
244244 Module *runPassesOn(Module *M, const std::vector &Passes,
245245 bool AutoDebugCrashes = false, unsigned NumExtraArgs = 0,
246 const char * const *ExtraArgs = NULL);
246 const char * const *ExtraArgs = nullptr);
247247
248248 /// runPasses - Run the specified passes on Program, outputting a bitcode
249249 /// file and writting the filename into OutputFile if successful. If the
258258 const std::vector &PassesToRun,
259259 std::string &OutputFilename, bool DeleteOutput = false,
260260 bool Quiet = false, unsigned NumExtraArgs = 0,
261 const char * const *ExtraArgs = NULL) const;
261 const char * const *ExtraArgs = nullptr) const;
262262
263263 /// runManyPasses - Take the specified pass list and create different
264264 /// combinations of passes to compile the program with. Compile the program with
6262 FileType fileType,
6363 const std::string &InputFile,
6464 const std::string &OutputFile,
65 std::string *Error = 0,
65 std::string *Error = nullptr,
6666 const std::vector &GCCArgs =
6767 std::vector(),
6868 unsigned Timeout = 0,
8888 public:
8989 static LLC *createLLC(const char *Argv0, std::string &Message,
9090 const std::string &GCCBinary,
91 const std::vector *Args = 0,
92 const std::vector *GCCArgs = 0,
91 const std::vector *Args = nullptr,
92 const std::vector *GCCArgs = nullptr,
9393 bool UseIntegratedAssembler = false);
9494
95 static AbstractInterpreter* createLLI(const char *Argv0, std::string &Message,
96 const std::vector *Args=0);
97
98 static AbstractInterpreter* createJIT(const char *Argv0, std::string &Message,
99 const std::vector *Args=0);
95 static AbstractInterpreter*
96 createLLI(const char *Argv0, std::string &Message,
97 const std::vector *Args = nullptr);
98
99 static AbstractInterpreter*
100 createJIT(const char *Argv0, std::string &Message,
101 const std::vector *Args = nullptr);
100102
101103 static AbstractInterpreter*
102104 createCustomCompiler(std::string &Message,
6262 RemoteTarget *Target;
6363
6464 public:
65 RemoteMemoryManager() : Target(NULL) {}
65 RemoteMemoryManager() : Target(nullptr) {}
6666 virtual ~RemoteMemoryManager();
6767
6868 uint8_t *allocateCodeSection(uintptr_t Size, unsigned Alignment,
5959 }
6060
6161 // Execute the child process.
62 char *args[1] = { NULL };
62 char *args[1] = { nullptr };
6363 int rc = execv(ChildName.c_str(), args);
6464 if (rc != 0)
6565 perror("Error executing child process: ");
8383 return true;
8484 }
8585
86 void RPCChannel::Wait() { wait(NULL); }
86 void RPCChannel::Wait() { wait(nullptr); }
8787
8888 static bool CheckError(int rc, size_t Size, const char *Desc) {
8989 if (rc < 0) {
5858 };
5959
6060 DifferenceEngine(Consumer &consumer)
61 : consumer(consumer), globalValueOracle(0) {}
61 : consumer(consumer), globalValueOracle(nullptr) {}
6262
6363 void diff(Module *L, Module *R);
6464 void diff(Function *L, Function *R);
384384 }
385385 }
386386 }
387 return NULL;
387 return nullptr;
388388 }
389389
390390 template