[C++] Use 'nullptr'.

llvm-svn: 207394
This commit is contained in:
Craig Topper 2014-04-28 04:05:08 +00:00
parent 09ced5f66b
commit e73658ddbb
124 changed files with 350 additions and 341 deletions

View File

@ -86,14 +86,14 @@ class EquivalenceClasses {
} }
void setNext(const ECValue *NewNext) const { void setNext(const ECValue *NewNext) const {
assert(getNext() == 0 && "Already has a next pointer!"); assert(getNext() == nullptr && "Already has a next pointer!");
Next = (const ECValue*)((intptr_t)NewNext | (intptr_t)isLeader()); Next = (const ECValue*)((intptr_t)NewNext | (intptr_t)isLeader());
} }
public: public:
ECValue(const ECValue &RHS) : Leader(this), Next((ECValue*)(intptr_t)1), ECValue(const ECValue &RHS) : Leader(this), Next((ECValue*)(intptr_t)1),
Data(RHS.Data) { Data(RHS.Data) {
// Only support copying of singleton nodes. // Only support copying of singleton nodes.
assert(RHS.isLeader() && RHS.getNext() == 0 && "Not a singleton!"); assert(RHS.isLeader() && RHS.getNext() == nullptr && "Not a singleton!");
} }
bool operator<(const ECValue &UFN) const { return Data < UFN.Data; } bool operator<(const ECValue &UFN) const { return Data < UFN.Data; }
@ -251,13 +251,13 @@ public:
explicit member_iterator(const ECValue *N) : Node(N) {} explicit member_iterator(const ECValue *N) : Node(N) {}
reference operator*() const { reference operator*() const {
assert(Node != 0 && "Dereferencing end()!"); assert(Node != nullptr && "Dereferencing end()!");
return Node->getData(); return Node->getData();
} }
reference operator->() const { return operator*(); } reference operator->() const { return operator*(); }
member_iterator &operator++() { member_iterator &operator++() {
assert(Node != 0 && "++'d off the end of the list!"); assert(Node != nullptr && "++'d off the end of the list!");
Node = Node->getNext(); Node = Node->getNext();
return *this; return *this;
} }

View File

@ -1395,7 +1395,7 @@ public:
void doFunction(const FunctionT *F, const BranchProbabilityInfoT *BPI, void doFunction(const FunctionT *F, const BranchProbabilityInfoT *BPI,
const LoopInfoT *LI); const LoopInfoT *LI);
BlockFrequencyInfoImpl() : BPI(0), LI(0), F(0) {} BlockFrequencyInfoImpl() : BPI(nullptr), LI(nullptr), F(nullptr) {}
using BlockFrequencyInfoImplBase::getEntryFreq; using BlockFrequencyInfoImplBase::getEntryFreq;
BlockFrequency getBlockFreq(const BlockT *BB) const { BlockFrequency getBlockFreq(const BlockT *BB) const {

View File

@ -280,7 +280,7 @@ void CallGraphWrapperPass::print(raw_ostream &OS, const Module *) const {
} }
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
void CallGraphWrapperPass::dump() const { print(dbgs(), 0); } void CallGraphWrapperPass::dump() const { print(dbgs(), nullptr); }
#endif #endif
// Enuse that users of CallGraph.h also link with this file // Enuse that users of CallGraph.h also link with this file

View File

@ -224,13 +224,13 @@ public:
} }
explicit BitcodeReader(MemoryBuffer *buffer, LLVMContext &C) explicit BitcodeReader(MemoryBuffer *buffer, LLVMContext &C)
: Context(C), TheModule(0), Buffer(buffer), BufferOwned(false), : Context(C), TheModule(nullptr), Buffer(buffer), BufferOwned(false),
LazyStreamer(0), NextUnreadBit(0), SeenValueSymbolTable(false), LazyStreamer(nullptr), NextUnreadBit(0), SeenValueSymbolTable(false),
ValueList(C), MDValueList(C), ValueList(C), MDValueList(C),
SeenFirstFunctionBody(false), UseRelativeIDs(false) { SeenFirstFunctionBody(false), UseRelativeIDs(false) {
} }
explicit BitcodeReader(DataStreamer *streamer, LLVMContext &C) explicit BitcodeReader(DataStreamer *streamer, LLVMContext &C)
: Context(C), TheModule(0), Buffer(0), BufferOwned(false), : Context(C), TheModule(nullptr), Buffer(nullptr), BufferOwned(false),
LazyStreamer(streamer), NextUnreadBit(0), SeenValueSymbolTable(false), LazyStreamer(streamer), NextUnreadBit(0), SeenValueSymbolTable(false),
ValueList(C), MDValueList(C), ValueList(C), MDValueList(C),
SeenFirstFunctionBody(false), UseRelativeIDs(false) { SeenFirstFunctionBody(false), UseRelativeIDs(false) {
@ -271,7 +271,7 @@ private:
return ValueList.getValueFwdRef(ID, Ty); return ValueList.getValueFwdRef(ID, Ty);
} }
BasicBlock *getBasicBlock(unsigned ID) const { BasicBlock *getBasicBlock(unsigned ID) const {
if (ID >= FunctionBBs.size()) return 0; // Invalid ID if (ID >= FunctionBBs.size()) return nullptr; // Invalid ID
return FunctionBBs[ID]; return FunctionBBs[ID];
} }
AttributeSet getAttributes(unsigned i) const { AttributeSet getAttributes(unsigned i) const {
@ -293,15 +293,15 @@ private:
if (ValNo < InstNum) { if (ValNo < InstNum) {
// If this is not a forward reference, just return the value we already // If this is not a forward reference, just return the value we already
// have. // have.
ResVal = getFnValueByID(ValNo, 0); ResVal = getFnValueByID(ValNo, nullptr);
return ResVal == 0; return ResVal == nullptr;
} else if (Slot == Record.size()) { } else if (Slot == Record.size()) {
return true; return true;
} }
unsigned TypeNo = (unsigned)Record[Slot++]; unsigned TypeNo = (unsigned)Record[Slot++];
ResVal = getFnValueByID(ValNo, getTypeByID(TypeNo)); ResVal = getFnValueByID(ValNo, getTypeByID(TypeNo));
return ResVal == 0; return ResVal == nullptr;
} }
/// popValue - Read a value out of the specified record from slot 'Slot'. /// popValue - Read a value out of the specified record from slot 'Slot'.
@ -320,14 +320,14 @@ private:
bool getValue(SmallVectorImpl<uint64_t> &Record, unsigned Slot, bool getValue(SmallVectorImpl<uint64_t> &Record, unsigned Slot,
unsigned InstNum, Type *Ty, Value *&ResVal) { unsigned InstNum, Type *Ty, Value *&ResVal) {
ResVal = getValue(Record, Slot, InstNum, Ty); ResVal = getValue(Record, Slot, InstNum, Ty);
return ResVal == 0; return ResVal == nullptr;
} }
/// getValue -- Version of getValue that returns ResVal directly, /// getValue -- Version of getValue that returns ResVal directly,
/// or 0 if there is an error. /// or 0 if there is an error.
Value *getValue(SmallVectorImpl<uint64_t> &Record, unsigned Slot, Value *getValue(SmallVectorImpl<uint64_t> &Record, unsigned Slot,
unsigned InstNum, Type *Ty) { unsigned InstNum, Type *Ty) {
if (Slot == Record.size()) return 0; if (Slot == Record.size()) return nullptr;
unsigned ValNo = (unsigned)Record[Slot]; unsigned ValNo = (unsigned)Record[Slot];
// Adjust the ValNo, if it was encoded relative to the InstNum. // Adjust the ValNo, if it was encoded relative to the InstNum.
if (UseRelativeIDs) if (UseRelativeIDs)
@ -338,7 +338,7 @@ private:
/// getValueSigned -- Like getValue, but decodes signed VBRs. /// getValueSigned -- Like getValue, but decodes signed VBRs.
Value *getValueSigned(SmallVectorImpl<uint64_t> &Record, unsigned Slot, Value *getValueSigned(SmallVectorImpl<uint64_t> &Record, unsigned Slot,
unsigned InstNum, Type *Ty) { unsigned InstNum, Type *Ty) {
if (Slot == Record.size()) return 0; if (Slot == Record.size()) return nullptr;
unsigned ValNo = (unsigned)decodeSignRotatedValue(Record[Slot]); unsigned ValNo = (unsigned)decodeSignRotatedValue(Record[Slot]);
// Adjust the ValNo, if it was encoded relative to the InstNum. // Adjust the ValNo, if it was encoded relative to the InstNum.
if (UseRelativeIDs) if (UseRelativeIDs)

View File

@ -110,7 +110,7 @@ AsmPrinter::AsmPrinter(TargetMachine &tm, MCStreamer &Streamer)
} }
AsmPrinter::~AsmPrinter() { AsmPrinter::~AsmPrinter() {
assert(DD == 0 && Handlers.empty() && "Debug/EH info didn't get finalized"); assert(!DD && Handlers.empty() && "Debug/EH info didn't get finalized");
if (GCMetadataPrinters) { if (GCMetadataPrinters) {
gcp_map_type &GCMap = getGCMap(GCMetadataPrinters); gcp_map_type &GCMap = getGCMap(GCMetadataPrinters);

View File

@ -94,7 +94,7 @@ private:
const DwarfCompileUnit *Unit; const DwarfCompileUnit *Unit;
public: public:
DebugLocEntry() : Begin(0), End(0), Unit(0) {} DebugLocEntry() : Begin(nullptr), End(nullptr), Unit(nullptr) {}
DebugLocEntry(const MCSymbol *B, const MCSymbol *E, DebugLocEntry(const MCSymbol *B, const MCSymbol *E,
Value Val, const DwarfCompileUnit *U) Value Val, const DwarfCompileUnit *U)
: Begin(B), End(E), Unit(U) { : Begin(B), End(E), Unit(U) {

View File

@ -994,8 +994,8 @@ void DwarfDebug::endSections() {
// Emit all Dwarf sections that should come after the content. // Emit all Dwarf sections that should come after the content.
void DwarfDebug::endModule() { void DwarfDebug::endModule() {
assert(CurFn == 0); assert(CurFn == nullptr);
assert(CurMI == 0); assert(CurMI == nullptr);
if (!FirstCU) if (!FirstCU)
return; return;
@ -1279,7 +1279,7 @@ MCSymbol *DwarfDebug::getLabelAfterInsn(const MachineInstr *MI) {
// Process beginning of an instruction. // Process beginning of an instruction.
void DwarfDebug::beginInstruction(const MachineInstr *MI) { void DwarfDebug::beginInstruction(const MachineInstr *MI) {
assert(CurMI == 0); assert(CurMI == nullptr);
CurMI = MI; CurMI = MI;
// Check if source location changes, but ignore DBG_VALUE locations. // Check if source location changes, but ignore DBG_VALUE locations.
if (!MI->isDebugValue()) { if (!MI->isDebugValue()) {
@ -1323,7 +1323,7 @@ void DwarfDebug::beginInstruction(const MachineInstr *MI) {
// Process end of an instruction. // Process end of an instruction.
void DwarfDebug::endInstruction() { void DwarfDebug::endInstruction() {
assert(CurMI != 0); assert(CurMI != nullptr);
// Don't create a new label after DBG_VALUE instructions. // Don't create a new label after DBG_VALUE instructions.
// They don't generate code. // They don't generate code.
if (!CurMI->isDebugValue()) if (!CurMI->isDebugValue())
@ -1608,7 +1608,7 @@ void DwarfDebug::endFunction(const MachineFunction *MF) {
CurFn = MF; CurFn = MF;
else else
assert(CurFn == MF); assert(CurFn == MF);
assert(CurFn != 0); assert(CurFn != nullptr);
if (!MMI->hasDebugInfo() || LScopes.empty()) { if (!MMI->hasDebugInfo() || LScopes.empty()) {
// If we don't have a lexical scope for this function then there will // If we don't have a lexical scope for this function then there will

View File

@ -78,8 +78,8 @@ class DbgVariable {
public: public:
// AbsVar may be NULL. // AbsVar may be NULL.
DbgVariable(DIVariable V, DbgVariable *AV, DwarfDebug *DD) DbgVariable(DIVariable V, DbgVariable *AV, DwarfDebug *DD)
: Var(V), TheDIE(0), DotDebugLocOffset(~0U), AbsVar(AV), MInsn(0), : Var(V), TheDIE(nullptr), DotDebugLocOffset(~0U), AbsVar(AV),
FrameIndex(~0), DD(DD) {} MInsn(nullptr), FrameIndex(~0), DD(DD) {}
// Accessors. // Accessors.
DIVariable getVariable() const { return Var; } DIVariable getVariable() const { return Var; }
@ -523,7 +523,7 @@ class DwarfDebug : public AsmPrinterHandler {
/// \brief Ensure that a label will be emitted before MI. /// \brief Ensure that a label will be emitted before MI.
void requestLabelBeforeInsn(const MachineInstr *MI) { void requestLabelBeforeInsn(const MachineInstr *MI) {
LabelsBeforeInsn.insert(std::make_pair(MI, (MCSymbol *)0)); LabelsBeforeInsn.insert(std::make_pair(MI, nullptr));
} }
/// \brief Return Label preceding the instruction. /// \brief Return Label preceding the instruction.
@ -531,7 +531,7 @@ class DwarfDebug : public AsmPrinterHandler {
/// \brief Ensure that a label will be emitted after MI. /// \brief Ensure that a label will be emitted after MI.
void requestLabelAfterInsn(const MachineInstr *MI) { void requestLabelAfterInsn(const MachineInstr *MI) {
LabelsAfterInsn.insert(std::make_pair(MI, (MCSymbol *)0)); LabelsAfterInsn.insert(std::make_pair(MI, nullptr));
} }
/// \brief Return Label immediately following the instruction. /// \brief Return Label immediately following the instruction.

View File

@ -216,7 +216,7 @@ void WinCodeViewLineTables::endModule() {
if (FnDebugInfo.empty()) if (FnDebugInfo.empty())
return; return;
assert(Asm != 0); assert(Asm != nullptr);
Asm->OutStreamer.SwitchSection( Asm->OutStreamer.SwitchSection(
Asm->getObjFileLowering().getCOFFDebugSymbolsSection()); Asm->getObjFileLowering().getCOFFDebugSymbolsSection());
Asm->EmitInt32(COFF::DEBUG_SECTION_MAGIC); Asm->EmitInt32(COFF::DEBUG_SECTION_MAGIC);

View File

@ -38,7 +38,7 @@ class WinCodeViewLineTables : public AsmPrinterHandler {
struct FunctionInfo { struct FunctionInfo {
SmallVector<MCSymbol *, 10> Instrs; SmallVector<MCSymbol *, 10> Instrs;
MCSymbol *End; MCSymbol *End;
FunctionInfo() : End(0) {} FunctionInfo() : End(nullptr) {}
} *CurFn; } *CurFn;
typedef DenseMap<const Function *, FunctionInfo> FnDebugInfoTy; typedef DenseMap<const Function *, FunctionInfo> FnDebugInfoTy;
@ -104,7 +104,7 @@ class WinCodeViewLineTables : public AsmPrinterHandler {
void maybeRecordLocation(DebugLoc DL, const MachineFunction *MF); void maybeRecordLocation(DebugLoc DL, const MachineFunction *MF);
void clear() { void clear() {
assert(CurFn == 0); assert(CurFn == nullptr);
FileNameRegistry.clear(); FileNameRegistry.clear();
InstrInfo.clear(); InstrInfo.clear();
} }

View File

@ -39,7 +39,7 @@ class DWARFDebugInfoEntryMinimal {
const DWARFAbbreviationDeclaration *AbbrevDecl; const DWARFAbbreviationDeclaration *AbbrevDecl;
public: public:
DWARFDebugInfoEntryMinimal() DWARFDebugInfoEntryMinimal()
: Offset(0), ParentIdx(0), SiblingIdx(0), AbbrevDecl(0) {} : Offset(0), ParentIdx(0), SiblingIdx(0), AbbrevDecl(nullptr) {}
void dump(raw_ostream &OS, const DWARFUnit *u, unsigned recurseDepth, void dump(raw_ostream &OS, const DWARFUnit *u, unsigned recurseDepth,
unsigned indent = 0) const; unsigned indent = 0) const;
@ -52,7 +52,7 @@ public:
bool extractFast(const DWARFUnit *U, uint32_t *OffsetPtr); bool extractFast(const DWARFUnit *U, uint32_t *OffsetPtr);
uint32_t getTag() const { return AbbrevDecl ? AbbrevDecl->getTag() : 0; } uint32_t getTag() const { return AbbrevDecl ? AbbrevDecl->getTag() : 0; }
bool isNULL() const { return AbbrevDecl == 0; } bool isNULL() const { return AbbrevDecl == nullptr; }
/// Returns true if DIE represents a subprogram (not inlined). /// Returns true if DIE represents a subprogram (not inlined).
bool isSubprogramDIE() const; bool isSubprogramDIE() const;
@ -66,27 +66,27 @@ public:
// We know we are kept in a vector of contiguous entries, so we know // We know we are kept in a vector of contiguous entries, so we know
// our parent will be some index behind "this". // our parent will be some index behind "this".
DWARFDebugInfoEntryMinimal *getParent() { DWARFDebugInfoEntryMinimal *getParent() {
return ParentIdx > 0 ? this - ParentIdx : 0; return ParentIdx > 0 ? this - ParentIdx : nullptr;
} }
const DWARFDebugInfoEntryMinimal *getParent() const { const DWARFDebugInfoEntryMinimal *getParent() const {
return ParentIdx > 0 ? this - ParentIdx : 0; return ParentIdx > 0 ? this - ParentIdx : nullptr;
} }
// We know we are kept in a vector of contiguous entries, so we know // We know we are kept in a vector of contiguous entries, so we know
// our sibling will be some index after "this". // our sibling will be some index after "this".
DWARFDebugInfoEntryMinimal *getSibling() { DWARFDebugInfoEntryMinimal *getSibling() {
return SiblingIdx > 0 ? this + SiblingIdx : 0; return SiblingIdx > 0 ? this + SiblingIdx : nullptr;
} }
const DWARFDebugInfoEntryMinimal *getSibling() const { const DWARFDebugInfoEntryMinimal *getSibling() const {
return SiblingIdx > 0 ? this + SiblingIdx : 0; return SiblingIdx > 0 ? this + SiblingIdx : nullptr;
} }
// We know we are kept in a vector of contiguous entries, so we know // We know we are kept in a vector of contiguous entries, so we know
// we don't need to store our child pointer, if we have a child it will // we don't need to store our child pointer, if we have a child it will
// be the next entry in the list... // be the next entry in the list...
DWARFDebugInfoEntryMinimal *getFirstChild() { DWARFDebugInfoEntryMinimal *getFirstChild() {
return hasChildren() ? this + 1 : 0; return hasChildren() ? this + 1 : nullptr;
} }
const DWARFDebugInfoEntryMinimal *getFirstChild() const { const DWARFDebugInfoEntryMinimal *getFirstChild() const {
return hasChildren() ? this + 1 : 0; return hasChildren() ? this + 1 : nullptr;
} }
void setParent(DWARFDebugInfoEntryMinimal *parent) { void setParent(DWARFDebugInfoEntryMinimal *parent) {
@ -168,7 +168,7 @@ public:
/// (except the last DIE) in this chain is contained in address /// (except the last DIE) in this chain is contained in address
/// range for next DIE in the chain. /// range for next DIE in the chain.
struct DWARFDebugInfoEntryInlinedChain { struct DWARFDebugInfoEntryInlinedChain {
DWARFDebugInfoEntryInlinedChain() : U(0) {} DWARFDebugInfoEntryInlinedChain() : U(nullptr) {}
SmallVector<DWARFDebugInfoEntryMinimal, 4> DIEs; SmallVector<DWARFDebugInfoEntryMinimal, 4> DIEs;
const DWARFUnit *U; const DWARFUnit *U;
}; };

View File

@ -24,7 +24,7 @@ class DWARFDebugLine {
public: public:
DWARFDebugLine(const RelocAddrMap* LineInfoRelocMap) : RelocMap(LineInfoRelocMap) {} DWARFDebugLine(const RelocAddrMap* LineInfoRelocMap) : RelocMap(LineInfoRelocMap) {}
struct FileNameEntry { struct FileNameEntry {
FileNameEntry() : Name(0), DirIdx(0), ModTime(0), Length(0) {} FileNameEntry() : Name(nullptr), DirIdx(0), ModTime(0), Length(0) {}
const char *Name; const char *Name;
uint64_t DirIdx; uint64_t DirIdx;

View File

@ -118,7 +118,7 @@ public:
const DWARFDebugInfoEntryMinimal * const DWARFDebugInfoEntryMinimal *
getCompileUnitDIE(bool extract_cu_die_only = true) { getCompileUnitDIE(bool extract_cu_die_only = true) {
extractDIEsIfNeeded(extract_cu_die_only); extractDIEsIfNeeded(extract_cu_die_only);
return DieArray.empty() ? NULL : &DieArray[0]; return DieArray.empty() ? nullptr : &DieArray[0];
} }
const char *getCompilationDir(); const char *getCompilationDir();

View File

@ -58,7 +58,7 @@ static void executeFAddInst(GenericValue &Dest, GenericValue Src1,
IMPLEMENT_BINARY_OPERATOR(+, Double); IMPLEMENT_BINARY_OPERATOR(+, Double);
default: default:
dbgs() << "Unhandled type for FAdd instruction: " << *Ty << "\n"; dbgs() << "Unhandled type for FAdd instruction: " << *Ty << "\n";
llvm_unreachable(0); llvm_unreachable(nullptr);
} }
} }
@ -69,7 +69,7 @@ static void executeFSubInst(GenericValue &Dest, GenericValue Src1,
IMPLEMENT_BINARY_OPERATOR(-, Double); IMPLEMENT_BINARY_OPERATOR(-, Double);
default: default:
dbgs() << "Unhandled type for FSub instruction: " << *Ty << "\n"; dbgs() << "Unhandled type for FSub instruction: " << *Ty << "\n";
llvm_unreachable(0); llvm_unreachable(nullptr);
} }
} }
@ -80,7 +80,7 @@ static void executeFMulInst(GenericValue &Dest, GenericValue Src1,
IMPLEMENT_BINARY_OPERATOR(*, Double); IMPLEMENT_BINARY_OPERATOR(*, Double);
default: default:
dbgs() << "Unhandled type for FMul instruction: " << *Ty << "\n"; dbgs() << "Unhandled type for FMul instruction: " << *Ty << "\n";
llvm_unreachable(0); llvm_unreachable(nullptr);
} }
} }
@ -91,7 +91,7 @@ static void executeFDivInst(GenericValue &Dest, GenericValue Src1,
IMPLEMENT_BINARY_OPERATOR(/, Double); IMPLEMENT_BINARY_OPERATOR(/, Double);
default: default:
dbgs() << "Unhandled type for FDiv instruction: " << *Ty << "\n"; dbgs() << "Unhandled type for FDiv instruction: " << *Ty << "\n";
llvm_unreachable(0); llvm_unreachable(nullptr);
} }
} }
@ -106,7 +106,7 @@ static void executeFRemInst(GenericValue &Dest, GenericValue Src1,
break; break;
default: default:
dbgs() << "Unhandled type for Rem instruction: " << *Ty << "\n"; dbgs() << "Unhandled type for Rem instruction: " << *Ty << "\n";
llvm_unreachable(0); llvm_unreachable(nullptr);
} }
} }
@ -143,7 +143,7 @@ static GenericValue executeICMP_EQ(GenericValue Src1, GenericValue Src2,
IMPLEMENT_POINTER_ICMP(==); IMPLEMENT_POINTER_ICMP(==);
default: default:
dbgs() << "Unhandled type for ICMP_EQ predicate: " << *Ty << "\n"; dbgs() << "Unhandled type for ICMP_EQ predicate: " << *Ty << "\n";
llvm_unreachable(0); llvm_unreachable(nullptr);
} }
return Dest; return Dest;
} }
@ -157,7 +157,7 @@ static GenericValue executeICMP_NE(GenericValue Src1, GenericValue Src2,
IMPLEMENT_POINTER_ICMP(!=); IMPLEMENT_POINTER_ICMP(!=);
default: default:
dbgs() << "Unhandled type for ICMP_NE predicate: " << *Ty << "\n"; dbgs() << "Unhandled type for ICMP_NE predicate: " << *Ty << "\n";
llvm_unreachable(0); llvm_unreachable(nullptr);
} }
return Dest; return Dest;
} }
@ -171,7 +171,7 @@ static GenericValue executeICMP_ULT(GenericValue Src1, GenericValue Src2,
IMPLEMENT_POINTER_ICMP(<); IMPLEMENT_POINTER_ICMP(<);
default: default:
dbgs() << "Unhandled type for ICMP_ULT predicate: " << *Ty << "\n"; dbgs() << "Unhandled type for ICMP_ULT predicate: " << *Ty << "\n";
llvm_unreachable(0); llvm_unreachable(nullptr);
} }
return Dest; return Dest;
} }
@ -185,7 +185,7 @@ static GenericValue executeICMP_SLT(GenericValue Src1, GenericValue Src2,
IMPLEMENT_POINTER_ICMP(<); IMPLEMENT_POINTER_ICMP(<);
default: default:
dbgs() << "Unhandled type for ICMP_SLT predicate: " << *Ty << "\n"; dbgs() << "Unhandled type for ICMP_SLT predicate: " << *Ty << "\n";
llvm_unreachable(0); llvm_unreachable(nullptr);
} }
return Dest; return Dest;
} }
@ -199,7 +199,7 @@ static GenericValue executeICMP_UGT(GenericValue Src1, GenericValue Src2,
IMPLEMENT_POINTER_ICMP(>); IMPLEMENT_POINTER_ICMP(>);
default: default:
dbgs() << "Unhandled type for ICMP_UGT predicate: " << *Ty << "\n"; dbgs() << "Unhandled type for ICMP_UGT predicate: " << *Ty << "\n";
llvm_unreachable(0); llvm_unreachable(nullptr);
} }
return Dest; return Dest;
} }
@ -213,7 +213,7 @@ static GenericValue executeICMP_SGT(GenericValue Src1, GenericValue Src2,
IMPLEMENT_POINTER_ICMP(>); IMPLEMENT_POINTER_ICMP(>);
default: default:
dbgs() << "Unhandled type for ICMP_SGT predicate: " << *Ty << "\n"; dbgs() << "Unhandled type for ICMP_SGT predicate: " << *Ty << "\n";
llvm_unreachable(0); llvm_unreachable(nullptr);
} }
return Dest; return Dest;
} }
@ -227,7 +227,7 @@ static GenericValue executeICMP_ULE(GenericValue Src1, GenericValue Src2,
IMPLEMENT_POINTER_ICMP(<=); IMPLEMENT_POINTER_ICMP(<=);
default: default:
dbgs() << "Unhandled type for ICMP_ULE predicate: " << *Ty << "\n"; dbgs() << "Unhandled type for ICMP_ULE predicate: " << *Ty << "\n";
llvm_unreachable(0); llvm_unreachable(nullptr);
} }
return Dest; return Dest;
} }
@ -241,7 +241,7 @@ static GenericValue executeICMP_SLE(GenericValue Src1, GenericValue Src2,
IMPLEMENT_POINTER_ICMP(<=); IMPLEMENT_POINTER_ICMP(<=);
default: default:
dbgs() << "Unhandled type for ICMP_SLE predicate: " << *Ty << "\n"; dbgs() << "Unhandled type for ICMP_SLE predicate: " << *Ty << "\n";
llvm_unreachable(0); llvm_unreachable(nullptr);
} }
return Dest; return Dest;
} }
@ -255,7 +255,7 @@ static GenericValue executeICMP_UGE(GenericValue Src1, GenericValue Src2,
IMPLEMENT_POINTER_ICMP(>=); IMPLEMENT_POINTER_ICMP(>=);
default: default:
dbgs() << "Unhandled type for ICMP_UGE predicate: " << *Ty << "\n"; dbgs() << "Unhandled type for ICMP_UGE predicate: " << *Ty << "\n";
llvm_unreachable(0); llvm_unreachable(nullptr);
} }
return Dest; return Dest;
} }
@ -269,7 +269,7 @@ static GenericValue executeICMP_SGE(GenericValue Src1, GenericValue Src2,
IMPLEMENT_POINTER_ICMP(>=); IMPLEMENT_POINTER_ICMP(>=);
default: default:
dbgs() << "Unhandled type for ICMP_SGE predicate: " << *Ty << "\n"; dbgs() << "Unhandled type for ICMP_SGE predicate: " << *Ty << "\n";
llvm_unreachable(0); llvm_unreachable(nullptr);
} }
return Dest; return Dest;
} }
@ -294,7 +294,7 @@ void Interpreter::visitICmpInst(ICmpInst &I) {
case ICmpInst::ICMP_SGE: R = executeICMP_SGE(Src1, Src2, Ty); break; case ICmpInst::ICMP_SGE: R = executeICMP_SGE(Src1, Src2, Ty); break;
default: default:
dbgs() << "Don't know how to handle this ICmp predicate!\n-->" << I; dbgs() << "Don't know how to handle this ICmp predicate!\n-->" << I;
llvm_unreachable(0); llvm_unreachable(nullptr);
} }
SetValue(&I, R, SF); SetValue(&I, R, SF);
@ -330,7 +330,7 @@ static GenericValue executeFCMP_OEQ(GenericValue Src1, GenericValue Src2,
IMPLEMENT_VECTOR_FCMP(==); IMPLEMENT_VECTOR_FCMP(==);
default: default:
dbgs() << "Unhandled type for FCmp EQ instruction: " << *Ty << "\n"; dbgs() << "Unhandled type for FCmp EQ instruction: " << *Ty << "\n";
llvm_unreachable(0); llvm_unreachable(nullptr);
} }
return Dest; return Dest;
} }
@ -386,7 +386,7 @@ static GenericValue executeFCMP_ONE(GenericValue Src1, GenericValue Src2,
IMPLEMENT_VECTOR_FCMP(!=); IMPLEMENT_VECTOR_FCMP(!=);
default: default:
dbgs() << "Unhandled type for FCmp NE instruction: " << *Ty << "\n"; dbgs() << "Unhandled type for FCmp NE instruction: " << *Ty << "\n";
llvm_unreachable(0); llvm_unreachable(nullptr);
} }
// in vector case mask out NaN elements // in vector case mask out NaN elements
if (Ty->isVectorTy()) if (Ty->isVectorTy())
@ -406,7 +406,7 @@ static GenericValue executeFCMP_OLE(GenericValue Src1, GenericValue Src2,
IMPLEMENT_VECTOR_FCMP(<=); IMPLEMENT_VECTOR_FCMP(<=);
default: default:
dbgs() << "Unhandled type for FCmp LE instruction: " << *Ty << "\n"; dbgs() << "Unhandled type for FCmp LE instruction: " << *Ty << "\n";
llvm_unreachable(0); llvm_unreachable(nullptr);
} }
return Dest; return Dest;
} }
@ -420,7 +420,7 @@ static GenericValue executeFCMP_OGE(GenericValue Src1, GenericValue Src2,
IMPLEMENT_VECTOR_FCMP(>=); IMPLEMENT_VECTOR_FCMP(>=);
default: default:
dbgs() << "Unhandled type for FCmp GE instruction: " << *Ty << "\n"; dbgs() << "Unhandled type for FCmp GE instruction: " << *Ty << "\n";
llvm_unreachable(0); llvm_unreachable(nullptr);
} }
return Dest; return Dest;
} }
@ -434,7 +434,7 @@ static GenericValue executeFCMP_OLT(GenericValue Src1, GenericValue Src2,
IMPLEMENT_VECTOR_FCMP(<); IMPLEMENT_VECTOR_FCMP(<);
default: default:
dbgs() << "Unhandled type for FCmp LT instruction: " << *Ty << "\n"; dbgs() << "Unhandled type for FCmp LT instruction: " << *Ty << "\n";
llvm_unreachable(0); llvm_unreachable(nullptr);
} }
return Dest; return Dest;
} }
@ -448,7 +448,7 @@ static GenericValue executeFCMP_OGT(GenericValue Src1, GenericValue Src2,
IMPLEMENT_VECTOR_FCMP(>); IMPLEMENT_VECTOR_FCMP(>);
default: default:
dbgs() << "Unhandled type for FCmp GT instruction: " << *Ty << "\n"; dbgs() << "Unhandled type for FCmp GT instruction: " << *Ty << "\n";
llvm_unreachable(0); llvm_unreachable(nullptr);
} }
return Dest; return Dest;
} }
@ -616,7 +616,7 @@ void Interpreter::visitFCmpInst(FCmpInst &I) {
switch (I.getPredicate()) { switch (I.getPredicate()) {
default: default:
dbgs() << "Don't know how to handle this FCmp predicate!\n-->" << I; dbgs() << "Don't know how to handle this FCmp predicate!\n-->" << I;
llvm_unreachable(0); llvm_unreachable(nullptr);
break; break;
case FCmpInst::FCMP_FALSE: R = executeFCMP_BOOL(Src1, Src2, Ty, false); case FCmpInst::FCMP_FALSE: R = executeFCMP_BOOL(Src1, Src2, Ty, false);
break; break;
@ -673,7 +673,7 @@ static GenericValue executeCmpInst(unsigned predicate, GenericValue Src1,
case FCmpInst::FCMP_TRUE: return executeFCMP_BOOL(Src1, Src2, Ty, true); case FCmpInst::FCMP_TRUE: return executeFCMP_BOOL(Src1, Src2, Ty, true);
default: default:
dbgs() << "Unhandled Cmp predicate\n"; dbgs() << "Unhandled Cmp predicate\n";
llvm_unreachable(0); llvm_unreachable(nullptr);
} }
} }
@ -727,7 +727,7 @@ void Interpreter::visitBinaryOperator(BinaryOperator &I) {
switch(I.getOpcode()){ switch(I.getOpcode()){
default: default:
dbgs() << "Don't know how to handle this binary operator!\n-->" << I; dbgs() << "Don't know how to handle this binary operator!\n-->" << I;
llvm_unreachable(0); llvm_unreachable(nullptr);
break; break;
case Instruction::Add: INTEGER_VECTOR_OPERATION(+) break; case Instruction::Add: INTEGER_VECTOR_OPERATION(+) break;
case Instruction::Sub: INTEGER_VECTOR_OPERATION(-) break; case Instruction::Sub: INTEGER_VECTOR_OPERATION(-) break;
@ -755,7 +755,7 @@ void Interpreter::visitBinaryOperator(BinaryOperator &I) {
fmod(Src1.AggregateVal[i].DoubleVal, Src2.AggregateVal[i].DoubleVal); fmod(Src1.AggregateVal[i].DoubleVal, Src2.AggregateVal[i].DoubleVal);
else { else {
dbgs() << "Unhandled type for Rem instruction: " << *Ty << "\n"; dbgs() << "Unhandled type for Rem instruction: " << *Ty << "\n";
llvm_unreachable(0); llvm_unreachable(nullptr);
} }
} }
break; break;
@ -764,7 +764,7 @@ void Interpreter::visitBinaryOperator(BinaryOperator &I) {
switch (I.getOpcode()) { switch (I.getOpcode()) {
default: default:
dbgs() << "Don't know how to handle this binary operator!\n-->" << I; dbgs() << "Don't know how to handle this binary operator!\n-->" << I;
llvm_unreachable(0); llvm_unreachable(nullptr);
break; break;
case Instruction::Add: R.IntVal = Src1.IntVal + Src2.IntVal; break; case Instruction::Add: R.IntVal = Src1.IntVal + Src2.IntVal; break;
case Instruction::Sub: R.IntVal = Src1.IntVal - Src2.IntVal; break; case Instruction::Sub: R.IntVal = Src1.IntVal - Src2.IntVal; break;
@ -980,7 +980,7 @@ void Interpreter::visitAllocaInst(AllocaInst &I) {
<< uintptr_t(Memory) << '\n'); << uintptr_t(Memory) << '\n');
GenericValue Result = PTOGV(Memory); GenericValue Result = PTOGV(Memory);
assert(Result.PointerVal != 0 && "Null pointer returned by malloc!"); assert(Result.PointerVal && "Null pointer returned by malloc!");
SetValue(&I, Result, SF); SetValue(&I, Result, SF);
if (I.getOpcode() == Instruction::Alloca) if (I.getOpcode() == Instruction::Alloca)
@ -1733,7 +1733,7 @@ void Interpreter::visitVAArgInst(VAArgInst &I) {
IMPLEMENT_VAARG(Double); IMPLEMENT_VAARG(Double);
default: default:
dbgs() << "Unhandled dest type for vaarg instruction: " << *Ty << "\n"; dbgs() << "Unhandled dest type for vaarg instruction: " << *Ty << "\n";
llvm_unreachable(0); llvm_unreachable(nullptr);
} }
// Set the Value of this Instruction. // Set the Value of this Instruction.
@ -1757,7 +1757,7 @@ void Interpreter::visitExtractElementInst(ExtractElementInst &I) {
default: default:
dbgs() << "Unhandled destination type for extractelement instruction: " dbgs() << "Unhandled destination type for extractelement instruction: "
<< *Ty << "\n"; << *Ty << "\n";
llvm_unreachable(0); llvm_unreachable(nullptr);
break; break;
case Type::IntegerTyID: case Type::IntegerTyID:
Dest.IntVal = Src1.AggregateVal[indx].IntVal; Dest.IntVal = Src1.AggregateVal[indx].IntVal;
@ -2074,7 +2074,7 @@ GenericValue Interpreter::getOperandValue(Value *V, ExecutionContext &SF) {
// //
void Interpreter::callFunction(Function *F, void Interpreter::callFunction(Function *F,
const std::vector<GenericValue> &ArgVals) { const std::vector<GenericValue> &ArgVals) {
assert((ECStack.empty() || ECStack.back().Caller.getInstruction() == 0 || assert((ECStack.empty() || !ECStack.back().Caller.getInstruction() ||
ECStack.back().Caller.arg_size() == ArgVals.size()) && ECStack.back().Caller.arg_size() == ArgVals.size()) &&
"Incorrect number of arguments passed into function call!"); "Incorrect number of arguments passed into function call!");
// Make a new stack frame... and fill it in. // Make a new stack frame... and fill it in.

View File

@ -108,7 +108,7 @@ public:
/// create - Create an interpreter ExecutionEngine. This can never fail. /// create - Create an interpreter ExecutionEngine. This can never fail.
/// ///
static ExecutionEngine *create(Module *M, std::string *ErrorStr = 0); static ExecutionEngine *create(Module *M, std::string *ErrorStr = nullptr);
/// run - Start execution with the specified function and arguments. /// run - Start execution with the specified function and arguments.
/// ///
@ -118,7 +118,7 @@ public:
void *getPointerToNamedFunction(const std::string &Name, void *getPointerToNamedFunction(const std::string &Name,
bool AbortOnFailure = true) override { bool AbortOnFailure = true) override {
// FIXME: not implemented. // FIXME: not implemented.
return 0; return nullptr;
} }
/// recompileAndRelinkFunction - For the interpreter, functions are always /// recompileAndRelinkFunction - For the interpreter, functions are always

View File

@ -189,7 +189,7 @@ public:
TargetMachine *TM); TargetMachine *TM);
// Run the JIT on F and return information about the generated code // Run the JIT on F and return information about the generated code
void runJITOnFunction(Function *F, MachineCodeInfo *MCI = 0) override; void runJITOnFunction(Function *F, MachineCodeInfo *MCI = nullptr) override;
void RegisterJITEventListener(JITEventListener *L) override; void RegisterJITEventListener(JITEventListener *L) override;
void UnregisterJITEventListener(JITEventListener *L) override; void UnregisterJITEventListener(JITEventListener *L) override;

View File

@ -643,7 +643,7 @@ DefaultJITMemoryManager::DefaultJITMemoryManager()
} }
void DefaultJITMemoryManager::AllocateGOT() { void DefaultJITMemoryManager::AllocateGOT() {
assert(GOTBase == 0 && "Cannot allocate the got multiple times"); assert(!GOTBase && "Cannot allocate the got multiple times");
GOTBase = new uint8_t[sizeof(void*) * 8192]; GOTBase = new uint8_t[sizeof(void*) * 8192];
HasGOT = true; HasGOT = true;
} }

View File

@ -71,7 +71,7 @@ public:
ClientMM->deregisterEHFrames(Addr, LoadAddr, Size); ClientMM->deregisterEHFrames(Addr, LoadAddr, Size);
} }
bool finalizeMemory(std::string *ErrMsg = 0) override { bool finalizeMemory(std::string *ErrMsg = nullptr) override {
return ClientMM->finalizeMemory(ErrMsg); return ClientMM->finalizeMemory(ErrMsg);
} }

View File

@ -48,7 +48,7 @@ public:
object::ObjectFile::createObjectFile(Buffer->getMemBuffer()).get(); object::ObjectFile::createObjectFile(Buffer->getMemBuffer()).get();
} }
ObjectImageCommon(object::ObjectFile* Input) ObjectImageCommon(object::ObjectFile* Input)
: ObjectImage(NULL), ObjFile(Input) {} : ObjectImage(nullptr), ObjFile(Input) {}
virtual ~ObjectImageCommon() { delete ObjFile; } virtual ~ObjectImageCommon() { delete ObjFile; }
object::symbol_iterator begin_symbols() const override object::symbol_iterator begin_symbols() const override

View File

@ -121,7 +121,8 @@ public:
uint64_t Offset; uint64_t Offset;
int64_t Addend; int64_t Addend;
const char *SymbolName; const char *SymbolName;
RelocationValueRef() : SectionID(0), Offset(0), Addend(0), SymbolName(0) {} RelocationValueRef() : SectionID(0), Offset(0), Addend(0),
SymbolName(nullptr) {}
inline bool operator==(const RelocationValueRef &Other) const { inline bool operator==(const RelocationValueRef &Other) const {
return SectionID == Other.SectionID && Offset == Other.Offset && return SectionID == Other.SectionID && Offset == Other.Offset &&
@ -335,7 +336,7 @@ public:
// Work in progress. // Work in progress.
SymbolTableMap::const_iterator pos = GlobalSymbolTable.find(Name); SymbolTableMap::const_iterator pos = GlobalSymbolTable.find(Name);
if (pos == GlobalSymbolTable.end()) if (pos == GlobalSymbolTable.end())
return 0; return nullptr;
SymbolLoc Loc = pos->second; SymbolLoc Loc = pos->second;
return getSectionAddress(Loc.first) + Loc.second; return getSectionAddress(Loc.first) + Loc.second;
} }

View File

@ -586,7 +586,7 @@ public:
/// necessary. /// necessary.
ConstantClass *getOrCreate(TypeClass *Ty, ValRefType V) { ConstantClass *getOrCreate(TypeClass *Ty, ValRefType V) {
MapKey Lookup(Ty, V); MapKey Lookup(Ty, V);
ConstantClass* Result = 0; ConstantClass* Result = nullptr;
typename MapTy::iterator I = Map.find(Lookup); typename MapTy::iterator I = Map.find(Lookup);
// Is it in the map? // Is it in the map?
@ -722,7 +722,7 @@ public:
/// necessary. /// necessary.
ConstantClass *getOrCreate(TypeClass *Ty, Operands V) { ConstantClass *getOrCreate(TypeClass *Ty, Operands V) {
LookupKey Lookup(Ty, V); LookupKey Lookup(Ty, V);
ConstantClass* Result = 0; ConstantClass* Result = nullptr;
typename MapTy::iterator I = Map.find_as(Lookup); typename MapTy::iterator I = Map.find_as(Lookup);
// Is it in the map? // Is it in the map?

View File

@ -56,8 +56,8 @@ struct DenseMapAPIntKeyInfo {
return hash_combine(Key.type, Key.val); return hash_combine(Key.type, Key.val);
} }
}; };
static inline KeyTy getEmptyKey() { return KeyTy(APInt(1,0), 0); } static inline KeyTy getEmptyKey() { return KeyTy(APInt(1,0), nullptr); }
static inline KeyTy getTombstoneKey() { return KeyTy(APInt(1,1), 0); } static inline KeyTy getTombstoneKey() { return KeyTy(APInt(1,1), nullptr); }
static unsigned getHashValue(const KeyTy &Key) { static unsigned getHashValue(const KeyTy &Key) {
return static_cast<unsigned>(hash_value(Key)); return static_cast<unsigned>(hash_value(Key));
} }

View File

@ -34,10 +34,10 @@ struct PrinterTrait<Value> {
template <typename T> template <typename T>
struct LeakDetectorImpl { struct LeakDetectorImpl {
explicit LeakDetectorImpl(const char* const name = "") : explicit LeakDetectorImpl(const char* const name = "") :
Cache(0), Name(name) { } Cache(nullptr), Name(name) { }
void clear() { void clear() {
Cache = 0; Cache = nullptr;
Ts.clear(); Ts.clear();
} }
@ -61,15 +61,15 @@ struct LeakDetectorImpl {
void removeGarbage(const T* o) { void removeGarbage(const T* o) {
if (o == Cache) if (o == Cache)
Cache = 0; // Cache hit Cache = nullptr; // Cache hit
else else
Ts.erase(o); Ts.erase(o);
} }
bool hasGarbage(const std::string& Message) { bool hasGarbage(const std::string& Message) {
addGarbage(0); // Flush the Cache addGarbage(nullptr); // Flush the Cache
assert(Cache == 0 && "No value should be cached anymore!"); assert(!Cache && "No value should be cached anymore!");
if (!Ts.empty()) { if (!Ts.empty()) {
errs() << "Leaked " << Name << " objects found: " << Message << ":\n"; errs() << "Leaked " << Name << " objects found: " << Message << ":\n";

View File

@ -65,7 +65,7 @@ void SymbolTableListTraits<ValueSubClass,ItemParentClass>
template<typename ValueSubClass, typename ItemParentClass> template<typename ValueSubClass, typename ItemParentClass>
void SymbolTableListTraits<ValueSubClass,ItemParentClass> void SymbolTableListTraits<ValueSubClass,ItemParentClass>
::addNodeToList(ValueSubClass *V) { ::addNodeToList(ValueSubClass *V) {
assert(V->getParent() == 0 && "Value already in a container!!"); assert(!V->getParent() && "Value already in a container!!");
ItemParentClass *Owner = getListOwner(); ItemParentClass *Owner = getListOwner();
V->setParent(Owner); V->setParent(Owner);
if (V->hasName()) if (V->hasName())
@ -76,7 +76,7 @@ void SymbolTableListTraits<ValueSubClass,ItemParentClass>
template<typename ValueSubClass, typename ItemParentClass> template<typename ValueSubClass, typename ItemParentClass>
void SymbolTableListTraits<ValueSubClass,ItemParentClass> void SymbolTableListTraits<ValueSubClass,ItemParentClass>
::removeNodeFromList(ValueSubClass *V) { ::removeNodeFromList(ValueSubClass *V) {
V->setParent(0); V->setParent(nullptr);
if (V->hasName()) if (V->hasName())
if (ValueSymbolTable *ST = TraitsClass::getSymTab(getListOwner())) if (ValueSymbolTable *ST = TraitsClass::getSymTab(getListOwner()))
ST->removeValueName(V->getValueName()); ST->removeValueName(V->getValueName());

View File

@ -121,7 +121,7 @@ Memory::allocateMappedMemory(size_t NumBytes,
Protect, MMFlags, fd, 0); Protect, MMFlags, fd, 0);
if (Addr == MAP_FAILED) { if (Addr == MAP_FAILED) {
if (NearBlock) //Try again without a near hint if (NearBlock) //Try again without a near hint
return allocateMappedMemory(NumBytes, 0, PFlags, EC); return allocateMappedMemory(NumBytes, nullptr, PFlags, EC);
EC = error_code(errno, system_category()); EC = error_code(errno, system_category());
return MemoryBlock(); return MemoryBlock();
@ -139,13 +139,13 @@ Memory::allocateMappedMemory(size_t NumBytes,
error_code error_code
Memory::releaseMappedMemory(MemoryBlock &M) { Memory::releaseMappedMemory(MemoryBlock &M) {
if (M.Address == 0 || M.Size == 0) if (M.Address == nullptr || M.Size == 0)
return error_code::success(); return error_code::success();
if (0 != ::munmap(M.Address, M.Size)) if (0 != ::munmap(M.Address, M.Size))
return error_code(errno, system_category()); return error_code(errno, system_category());
M.Address = 0; M.Address = nullptr;
M.Size = 0; M.Size = 0;
return error_code::success(); return error_code::success();
@ -153,7 +153,7 @@ Memory::releaseMappedMemory(MemoryBlock &M) {
error_code error_code
Memory::protectMappedMemory(const MemoryBlock &M, unsigned Flags) { Memory::protectMappedMemory(const MemoryBlock &M, unsigned Flags) {
if (M.Address == 0 || M.Size == 0) if (M.Address == nullptr || M.Size == 0)
return error_code::success(); return error_code::success();
if (!Flags) if (!Flags)
@ -203,7 +203,7 @@ Memory::AllocateRWX(size_t NumBytes, const MemoryBlock* NearBlock,
; ;
void* start = NearBlock ? (unsigned char*)NearBlock->base() + void* start = NearBlock ? (unsigned char*)NearBlock->base() +
NearBlock->size() : 0; NearBlock->size() : nullptr;
#if defined(__APPLE__) && (defined(__arm__) || defined(__arm64__)) #if defined(__APPLE__) && (defined(__arm__) || defined(__arm64__))
void *pa = ::mmap(start, PageSize*NumPages, PROT_READ|PROT_EXEC, void *pa = ::mmap(start, PageSize*NumPages, PROT_READ|PROT_EXEC,
@ -214,7 +214,7 @@ Memory::AllocateRWX(size_t NumBytes, const MemoryBlock* NearBlock,
#endif #endif
if (pa == MAP_FAILED) { if (pa == MAP_FAILED) {
if (NearBlock) //Try again without a near hint if (NearBlock) //Try again without a near hint
return AllocateRWX(NumBytes, 0); return AllocateRWX(NumBytes, nullptr);
MakeErrMsg(ErrMsg, "Can't allocate RWX Memory"); MakeErrMsg(ErrMsg, "Can't allocate RWX Memory");
return MemoryBlock(); return MemoryBlock();
@ -246,7 +246,7 @@ Memory::AllocateRWX(size_t NumBytes, const MemoryBlock* NearBlock,
} }
bool Memory::ReleaseRWX(MemoryBlock &M, std::string *ErrMsg) { bool Memory::ReleaseRWX(MemoryBlock &M, std::string *ErrMsg) {
if (M.Address == 0 || M.Size == 0) return false; if (M.Address == nullptr || M.Size == 0) return false;
if (0 != ::munmap(M.Address, M.Size)) if (0 != ::munmap(M.Address, M.Size))
return MakeErrMsg(ErrMsg, "Can't release RWX Memory"); return MakeErrMsg(ErrMsg, "Can't release RWX Memory");
return false; return false;

View File

@ -89,7 +89,7 @@ namespace {
static error_code TempDir(SmallVectorImpl<char> &result) { static error_code TempDir(SmallVectorImpl<char> &result) {
// FIXME: Don't use TMPDIR if program is SUID or SGID enabled. // FIXME: Don't use TMPDIR if program is SUID or SGID enabled.
const char *dir = 0; const char *dir = nullptr;
(dir = std::getenv("TMPDIR")) || (dir = std::getenv("TMP")) || (dir = std::getenv("TMPDIR")) || (dir = std::getenv("TMP")) ||
(dir = std::getenv("TEMP")) || (dir = std::getenv("TEMPDIR")) || (dir = std::getenv("TEMP")) || (dir = std::getenv("TEMPDIR")) ||
#ifdef P_tmpdir #ifdef P_tmpdir
@ -246,7 +246,7 @@ error_code current_path(SmallVectorImpl<char> &result) {
#endif #endif
while (true) { while (true) {
if (::getcwd(result.data(), result.capacity()) == 0) { if (::getcwd(result.data(), result.capacity()) == nullptr) {
// See if there was a real error. // See if there was a real error.
if (errno != errc::not_enough_memory) if (errno != errc::not_enough_memory)
return error_code(errno, system_category()); return error_code(errno, system_category());
@ -494,7 +494,7 @@ error_code mapped_file_region::init(int FD, bool CloseFD, uint64_t Offset) {
#ifdef MAP_FILE #ifdef MAP_FILE
flags |= MAP_FILE; flags |= MAP_FILE;
#endif #endif
Mapping = ::mmap(0, Size, prot, flags, FD, Offset); Mapping = ::mmap(nullptr, Size, prot, flags, FD, Offset);
if (Mapping == MAP_FAILED) if (Mapping == MAP_FAILED)
return error_code(errno, system_category()); return error_code(errno, system_category());
return error_code::success(); return error_code::success();
@ -525,7 +525,7 @@ mapped_file_region::mapped_file_region(const Twine &path,
ec = init(ofd, true, offset); ec = init(ofd, true, offset);
if (ec) if (ec)
Mapping = 0; Mapping = nullptr;
} }
mapped_file_region::mapped_file_region(int fd, mapped_file_region::mapped_file_region(int fd,
@ -545,7 +545,7 @@ mapped_file_region::mapped_file_region(int fd,
ec = init(fd, closefd, offset); ec = init(fd, closefd, offset);
if (ec) if (ec)
Mapping = 0; Mapping = nullptr;
} }
mapped_file_region::~mapped_file_region() { mapped_file_region::~mapped_file_region() {
@ -555,7 +555,7 @@ mapped_file_region::~mapped_file_region() {
mapped_file_region::mapped_file_region(mapped_file_region &&other) mapped_file_region::mapped_file_region(mapped_file_region &&other)
: Mode(other.Mode), Size(other.Size), Mapping(other.Mapping) { : Mode(other.Mode), Size(other.Size), Mapping(other.Mapping) {
other.Mapping = 0; other.Mapping = nullptr;
} }
mapped_file_region::mapmode mapped_file_region::flags() const { mapped_file_region::mapmode mapped_file_region::flags() const {
@ -587,7 +587,7 @@ error_code detail::directory_iterator_construct(detail::DirIterState &it,
StringRef path){ StringRef path){
SmallString<128> path_null(path); SmallString<128> path_null(path);
DIR *directory = ::opendir(path_null.c_str()); DIR *directory = ::opendir(path_null.c_str());
if (directory == 0) if (!directory)
return error_code(errno, system_category()); return error_code(errno, system_category());
it.IterationHandle = reinterpret_cast<intptr_t>(directory); it.IterationHandle = reinterpret_cast<intptr_t>(directory);
@ -608,9 +608,9 @@ error_code detail::directory_iterator_destruct(detail::DirIterState &it) {
error_code detail::directory_iterator_increment(detail::DirIterState &it) { error_code detail::directory_iterator_increment(detail::DirIterState &it) {
errno = 0; errno = 0;
dirent *cur_dir = ::readdir(reinterpret_cast<DIR *>(it.IterationHandle)); dirent *cur_dir = ::readdir(reinterpret_cast<DIR *>(it.IterationHandle));
if (cur_dir == 0 && errno != 0) { if (cur_dir == nullptr && errno != 0) {
return error_code(errno, system_category()); return error_code(errno, system_category());
} else if (cur_dir != 0) { } else if (cur_dir != nullptr) {
StringRef name(cur_dir->d_name, NAMLEN(cur_dir)); StringRef name(cur_dir->d_name, NAMLEN(cur_dir));
if ((name.size() == 1 && name[0] == '.') || if ((name.size() == 1 && name[0] == '.') ||
(name.size() == 2 && name[0] == '.' && name[1] == '.')) (name.size() == 2 && name[0] == '.' && name[1] == '.'))
@ -630,7 +630,7 @@ error_code get_magic(const Twine &path, uint32_t len,
// Open path. // Open path.
std::FILE *file = std::fopen(Path.data(), "rb"); std::FILE *file = std::fopen(Path.data(), "rb");
if (file == 0) if (!file)
return error_code(errno, system_category()); return error_code(errno, system_category());
// Reserve storage. // Reserve storage.
@ -667,7 +667,7 @@ error_code map_file_pages(const Twine &path, off_t file_offset, size_t size,
#ifdef MAP_FILE #ifdef MAP_FILE
flags |= MAP_FILE; flags |= MAP_FILE;
#endif #endif
result = ::mmap(0, size, prot, flags, fd, file_offset); result = ::mmap(nullptr, size, prot, flags, fd, file_offset);
if (result == MAP_FAILED) { if (result == MAP_FAILED) {
return error_code(errno, system_category()); return error_code(errno, system_category());
} }

View File

@ -270,7 +270,7 @@ static bool terminalHasColors(int fd) {
MutexGuard G(M); MutexGuard G(M);
int errret = 0; int errret = 0;
if (setupterm((char *)0, fd, &errret) != 0) if (setupterm((char *)nullptr, fd, &errret) != 0)
// Regardless of why, if we can't get terminfo, we shouldn't try to print // Regardless of why, if we can't get terminfo, we shouldn't try to print
// colors. // colors.
return false; return false;
@ -292,7 +292,7 @@ static bool terminalHasColors(int fd) {
// Now extract the structure allocated by setupterm and free its memory // Now extract the structure allocated by setupterm and free its memory
// through a really silly dance. // through a really silly dance.
struct term *termp = set_curterm((struct term *)0); struct term *termp = set_curterm((struct term *)nullptr);
(void)del_curterm(termp); // Drop any errors here. (void)del_curterm(termp); // Drop any errors here.
// Return true if we found a color capabilities for the current terminal. // Return true if we found a color capabilities for the current terminal.

View File

@ -70,7 +70,7 @@ sys::FindProgramByName(const std::string& progName) {
// Get the path. If its empty, we can't do anything to find it. // Get the path. If its empty, we can't do anything to find it.
const char *PathStr = getenv("PATH"); const char *PathStr = getenv("PATH");
if (PathStr == 0) if (!PathStr)
return ""; return "";
// Now we have a colon separated list of directories to search; try them. // Now we have a colon separated list of directories to search; try them.
@ -99,7 +99,7 @@ sys::FindProgramByName(const std::string& progName) {
} }
static bool RedirectIO(const StringRef *Path, int FD, std::string* ErrMsg) { static bool RedirectIO(const StringRef *Path, int FD, std::string* ErrMsg) {
if (Path == 0) // Noop if (!Path) // Noop
return false; return false;
std::string File; std::string File;
if (Path->empty()) if (Path->empty())
@ -129,7 +129,7 @@ static bool RedirectIO(const StringRef *Path, int FD, std::string* ErrMsg) {
#ifdef HAVE_POSIX_SPAWN #ifdef HAVE_POSIX_SPAWN
static bool RedirectIO_PS(const std::string *Path, int FD, std::string *ErrMsg, static bool RedirectIO_PS(const std::string *Path, int FD, std::string *ErrMsg,
posix_spawn_file_actions_t *FileActions) { posix_spawn_file_actions_t *FileActions) {
if (Path == 0) // Noop if (!Path) // Noop
return false; return false;
const char *File; const char *File;
if (Path->empty()) if (Path->empty())
@ -195,7 +195,7 @@ static bool Execute(ProcessInfo &PI, StringRef Program, const char **args,
#ifdef HAVE_POSIX_SPAWN #ifdef HAVE_POSIX_SPAWN
if (memoryLimit == 0) { if (memoryLimit == 0) {
posix_spawn_file_actions_t FileActionsStore; posix_spawn_file_actions_t FileActionsStore;
posix_spawn_file_actions_t *FileActions = 0; posix_spawn_file_actions_t *FileActions = nullptr;
// If we call posix_spawn_file_actions_addopen we have to make sure the // If we call posix_spawn_file_actions_addopen we have to make sure the
// c strings we pass to it stay alive until the call to posix_spawn, // c strings we pass to it stay alive until the call to posix_spawn,
@ -203,7 +203,7 @@ static bool Execute(ProcessInfo &PI, StringRef Program, const char **args,
std::string RedirectsStorage[3]; std::string RedirectsStorage[3];
if (redirects) { if (redirects) {
std::string *RedirectsStr[3] = {0, 0, 0}; std::string *RedirectsStr[3] = {nullptr, nullptr, nullptr};
for (int I = 0; I < 3; ++I) { for (int I = 0; I < 3; ++I) {
if (redirects[I]) { if (redirects[I]) {
RedirectsStorage[I] = *redirects[I]; RedirectsStorage[I] = *redirects[I];
@ -218,7 +218,7 @@ static bool Execute(ProcessInfo &PI, StringRef Program, const char **args,
if (RedirectIO_PS(RedirectsStr[0], 0, ErrMsg, FileActions) || if (RedirectIO_PS(RedirectsStr[0], 0, ErrMsg, FileActions) ||
RedirectIO_PS(RedirectsStr[1], 1, ErrMsg, FileActions)) RedirectIO_PS(RedirectsStr[1], 1, ErrMsg, FileActions))
return false; return false;
if (redirects[1] == 0 || redirects[2] == 0 || if (redirects[1] == nullptr || redirects[2] == nullptr ||
*redirects[1] != *redirects[2]) { *redirects[1] != *redirects[2]) {
// Just redirect stderr // Just redirect stderr
if (RedirectIO_PS(RedirectsStr[2], 2, ErrMsg, FileActions)) if (RedirectIO_PS(RedirectsStr[2], 2, ErrMsg, FileActions))
@ -242,8 +242,9 @@ static bool Execute(ProcessInfo &PI, StringRef Program, const char **args,
// Explicitly initialized to prevent what appears to be a valgrind false // Explicitly initialized to prevent what appears to be a valgrind false
// positive. // positive.
pid_t PID = 0; pid_t PID = 0;
int Err = posix_spawn(&PID, Program.str().c_str(), FileActions, /*attrp*/0, int Err = posix_spawn(&PID, Program.str().c_str(), FileActions,
const_cast<char **>(args), const_cast<char **>(envp)); /*attrp*/nullptr, const_cast<char **>(args),
const_cast<char **>(envp));
if (FileActions) if (FileActions)
posix_spawn_file_actions_destroy(FileActions); posix_spawn_file_actions_destroy(FileActions);
@ -294,7 +295,7 @@ static bool Execute(ProcessInfo &PI, StringRef Program, const char **args,
// Execute! // Execute!
std::string PathStr = Program; std::string PathStr = Program;
if (envp != 0) if (envp != nullptr)
execve(PathStr.c_str(), execve(PathStr.c_str(),
const_cast<char **>(args), const_cast<char **>(args),
const_cast<char **>(envp)); const_cast<char **>(envp));
@ -360,7 +361,7 @@ ProcessInfo sys::Wait(const ProcessInfo &PI, unsigned SecondsToWait,
// Turn off the alarm and restore the signal handler // Turn off the alarm and restore the signal handler
alarm(0); alarm(0);
sigaction(SIGALRM, &Old, 0); sigaction(SIGALRM, &Old, nullptr);
// Wait for child to die // Wait for child to die
if (wait(&status) != ChildPid) if (wait(&status) != ChildPid)
@ -381,7 +382,7 @@ ProcessInfo sys::Wait(const ProcessInfo &PI, unsigned SecondsToWait,
// We exited normally without timeout, so turn off the timer. // We exited normally without timeout, so turn off the timer.
if (SecondsToWait && !WaitUntilTerminates) { if (SecondsToWait && !WaitUntilTerminates) {
alarm(0); alarm(0);
sigaction(SIGALRM, &Old, 0); sigaction(SIGALRM, &Old, nullptr);
} }
// Return the proper exit status. Detect error conditions // Return the proper exit status. Detect error conditions

View File

@ -44,7 +44,7 @@ static RETSIGTYPE SignalHandler(int Sig); // defined below.
static SmartMutex<true> SignalsMutex; static SmartMutex<true> SignalsMutex;
/// InterruptFunction - The function to call if ctrl-c is pressed. /// InterruptFunction - The function to call if ctrl-c is pressed.
static void (*InterruptFunction)() = 0; static void (*InterruptFunction)() = nullptr;
static std::vector<std::string> FilesToRemove; static std::vector<std::string> FilesToRemove;
static std::vector<std::pair<void(*)(void*), void*> > CallBacksToRun; static std::vector<std::pair<void(*)(void*), void*> > CallBacksToRun;
@ -113,7 +113,7 @@ static void UnregisterHandlers() {
// Restore all of the signal handlers to how they were before we showed up. // Restore all of the signal handlers to how they were before we showed up.
for (unsigned i = 0, e = NumRegisteredSignals; i != e; ++i) for (unsigned i = 0, e = NumRegisteredSignals; i != e; ++i)
sigaction(RegisteredSignalInfo[i].SigNo, sigaction(RegisteredSignalInfo[i].SigNo,
&RegisteredSignalInfo[i].SA, 0); &RegisteredSignalInfo[i].SA, nullptr);
NumRegisteredSignals = 0; NumRegisteredSignals = 0;
} }
@ -160,7 +160,7 @@ static RETSIGTYPE SignalHandler(int Sig) {
// Unmask all potentially blocked kill signals. // Unmask all potentially blocked kill signals.
sigset_t SigMask; sigset_t SigMask;
sigfillset(&SigMask); sigfillset(&SigMask);
sigprocmask(SIG_UNBLOCK, &SigMask, 0); sigprocmask(SIG_UNBLOCK, &SigMask, nullptr);
SignalsMutex.acquire(); SignalsMutex.acquire();
RemoveFilesToRemove(); RemoveFilesToRemove();
@ -169,7 +169,7 @@ static RETSIGTYPE SignalHandler(int Sig) {
if (InterruptFunction) { if (InterruptFunction) {
void (*IF)() = InterruptFunction; void (*IF)() = InterruptFunction;
SignalsMutex.release(); SignalsMutex.release();
InterruptFunction = 0; InterruptFunction = nullptr;
IF(); // run the interrupt function. IF(); // run the interrupt function.
return; return;
} }
@ -212,7 +212,7 @@ void llvm::sys::SetInterruptFunction(void (*IF)()) {
bool llvm::sys::RemoveFileOnSignal(StringRef Filename, bool llvm::sys::RemoveFileOnSignal(StringRef Filename,
std::string* ErrMsg) { std::string* ErrMsg) {
SignalsMutex.acquire(); SignalsMutex.acquire();
std::string *OldPtr = FilesToRemove.empty() ? 0 : &FilesToRemove[0]; std::string *OldPtr = FilesToRemove.empty() ? nullptr : &FilesToRemove[0];
FilesToRemove.push_back(Filename); FilesToRemove.push_back(Filename);
// We want to call 'c_str()' on every std::string in this vector so that if // We want to call 'c_str()' on every std::string in this vector so that if
@ -279,8 +279,8 @@ void llvm::sys::PrintStackTrace(FILE *FD) {
const char* name = strrchr(dlinfo.dli_fname, '/'); const char* name = strrchr(dlinfo.dli_fname, '/');
int nwidth; int nwidth;
if (name == NULL) nwidth = strlen(dlinfo.dli_fname); if (!name) nwidth = strlen(dlinfo.dli_fname);
else nwidth = strlen(name) - 1; else nwidth = strlen(name) - 1;
if (nwidth > width) width = nwidth; if (nwidth > width) width = nwidth;
} }
@ -292,22 +292,22 @@ void llvm::sys::PrintStackTrace(FILE *FD) {
fprintf(FD, "%-2d", i); fprintf(FD, "%-2d", i);
const char* name = strrchr(dlinfo.dli_fname, '/'); const char* name = strrchr(dlinfo.dli_fname, '/');
if (name == NULL) fprintf(FD, " %-*s", width, dlinfo.dli_fname); if (!name) fprintf(FD, " %-*s", width, dlinfo.dli_fname);
else fprintf(FD, " %-*s", width, name+1); else fprintf(FD, " %-*s", width, name+1);
fprintf(FD, " %#0*lx", fprintf(FD, " %#0*lx",
(int)(sizeof(void*) * 2) + 2, (unsigned long)StackTrace[i]); (int)(sizeof(void*) * 2) + 2, (unsigned long)StackTrace[i]);
if (dlinfo.dli_sname != NULL) { if (dlinfo.dli_sname != nullptr) {
fputc(' ', FD); fputc(' ', FD);
# if HAVE_CXXABI_H # if HAVE_CXXABI_H
int res; int res;
char* d = abi::__cxa_demangle(dlinfo.dli_sname, NULL, NULL, &res); char* d = abi::__cxa_demangle(dlinfo.dli_sname, nullptr, nullptr, &res);
# else # else
char* d = NULL; char* d = NULL;
# endif # endif
if (d == NULL) fputs(dlinfo.dli_sname, FD); if (!d) fputs(dlinfo.dli_sname, FD);
else fputs(d, FD); else fputs(d, FD);
free(d); free(d);
// FIXME: When we move to C++11, use %t length modifier. It's not in // FIXME: When we move to C++11, use %t length modifier. It's not in
@ -331,7 +331,7 @@ static void PrintStackTraceSignalHandler(void *) {
/// PrintStackTraceOnErrorSignal - When an error signal (such as SIGABRT or /// PrintStackTraceOnErrorSignal - When an error signal (such as SIGABRT or
/// SIGSEGV) is delivered to the process, print a stack trace and then exit. /// SIGSEGV) is delivered to the process, print a stack trace and then exit.
void llvm::sys::PrintStackTraceOnErrorSignal() { void llvm::sys::PrintStackTraceOnErrorSignal() {
AddSignalHandler(PrintStackTraceSignalHandler, 0); AddSignalHandler(PrintStackTraceSignalHandler, nullptr);
#if defined(__APPLE__) && defined(ENABLE_CRASH_OVERRIDES) #if defined(__APPLE__) && defined(ENABLE_CRASH_OVERRIDES)
// Environment variable to disable any kind of crash dialog. // Environment variable to disable any kind of crash dialog.

View File

@ -36,7 +36,7 @@ std::string TimeValue::str() const {
TimeValue TimeValue::now() { TimeValue TimeValue::now() {
struct timeval the_time; struct timeval the_time;
timerclear(&the_time); timerclear(&the_time);
if (0 != ::gettimeofday(&the_time,0)) { if (0 != ::gettimeofday(&the_time,nullptr)) {
// This is *really* unlikely to occur because the only gettimeofday // This is *really* unlikely to occur because the only gettimeofday
// errors concern the timezone parameter which we're passing in as 0. // errors concern the timezone parameter which we're passing in as 0.
// In the unlikely case it does happen, just return MinTime, no error // In the unlikely case it does happen, just return MinTime, no error

View File

@ -115,7 +115,7 @@ bool TGParser::SetValue(Record *CurRec, SMLoc Loc, Init *ValName,
// We should have a BitsInit type now. // We should have a BitsInit type now.
BitsInit *BInit = dyn_cast<BitsInit>(BI); BitsInit *BInit = dyn_cast<BitsInit>(BI);
assert(BInit != 0); assert(BInit != nullptr);
SmallVector<Init *, 16> NewBits(CurVal->getNumBits()); SmallVector<Init *, 16> NewBits(CurVal->getNumBits());

View File

@ -85,7 +85,7 @@ class TGParser {
public: public:
TGParser(SourceMgr &SrcMgr, RecordKeeper &records) TGParser(SourceMgr &SrcMgr, RecordKeeper &records)
: Lex(SrcMgr), CurMultiClass(0), Records(records), AnonCounter(0) {} : Lex(SrcMgr), CurMultiClass(nullptr), Records(records), AnonCounter(0) {}
/// ParseFile - Main entrypoint for parsing a tblgen file. These parser /// ParseFile - Main entrypoint for parsing a tblgen file. These parser
/// routines return true on error, or false on success. /// routines return true on error, or false on success.
@ -131,7 +131,7 @@ private: // Semantic analysis methods.
bool ProcessForeachDefs(Record *CurRec, SMLoc Loc, IterSet &IterVals); bool ProcessForeachDefs(Record *CurRec, SMLoc Loc, IterSet &IterVals);
private: // Parser methods. private: // Parser methods.
bool ParseObjectList(MultiClass *MC = 0); bool ParseObjectList(MultiClass *MC = nullptr);
bool ParseObject(MultiClass *MC); bool ParseObject(MultiClass *MC);
bool ParseClass(); bool ParseClass();
bool ParseMultiClass(); bool ParseMultiClass();
@ -169,12 +169,12 @@ private: // Parser methods.
Init *ParseIDValue(Record *CurRec, const std::string &Name, SMLoc NameLoc, Init *ParseIDValue(Record *CurRec, const std::string &Name, SMLoc NameLoc,
IDParseMode Mode = ParseValueMode); IDParseMode Mode = ParseValueMode);
Init *ParseSimpleValue(Record *CurRec, RecTy *ItemType = 0, Init *ParseSimpleValue(Record *CurRec, RecTy *ItemType = nullptr,
IDParseMode Mode = ParseValueMode); IDParseMode Mode = ParseValueMode);
Init *ParseValue(Record *CurRec, RecTy *ItemType = 0, Init *ParseValue(Record *CurRec, RecTy *ItemType = nullptr,
IDParseMode Mode = ParseValueMode); IDParseMode Mode = ParseValueMode);
std::vector<Init*> ParseValueList(Record *CurRec, Record *ArgsRec = 0, std::vector<Init*> ParseValueList(Record *CurRec, Record *ArgsRec = nullptr,
RecTy *EltTy = 0); RecTy *EltTy = nullptr);
std::vector<std::pair<llvm::Init*, std::string> > ParseDagArgList(Record *); std::vector<std::pair<llvm::Init*, std::string> > ParseDagArgList(Record *);
bool ParseOptionalRangeList(std::vector<unsigned> &Ranges); bool ParseOptionalRangeList(std::vector<unsigned> &Ranges);
bool ParseOptionalBitList(std::vector<unsigned> &Ranges); bool ParseOptionalBitList(std::vector<unsigned> &Ranges);

View File

@ -1559,7 +1559,7 @@ SDNode *AArch64DAGToDAGISel::Select(SDNode *Node) {
SDNode *ResNode = SelectCode(Node); SDNode *ResNode = SelectCode(Node);
DEBUG(dbgs() << "=> "; DEBUG(dbgs() << "=> ";
if (ResNode == NULL || ResNode == Node) if (ResNode == nullptr || ResNode == Node)
Node->dump(CurDAG); Node->dump(CurDAG);
else else
ResNode->dump(CurDAG); ResNode->dump(CurDAG);

View File

@ -27,7 +27,7 @@ class AArch64Subtarget;
struct AArch64RegisterInfo : public AArch64GenRegisterInfo { struct AArch64RegisterInfo : public AArch64GenRegisterInfo {
AArch64RegisterInfo(); AArch64RegisterInfo();
const MCPhysReg *getCalleeSavedRegs(const MachineFunction *MF = 0) const; const MCPhysReg *getCalleeSavedRegs(const MachineFunction *MF =nullptr) const;
const uint32_t *getCallPreservedMask(CallingConv::ID) const; const uint32_t *getCallPreservedMask(CallingConv::ID) const;
unsigned getCSRFirstUseCost() const { unsigned getCSRFirstUseCost() const {
@ -44,7 +44,7 @@ struct AArch64RegisterInfo : public AArch64GenRegisterInfo {
void eliminateFrameIndex(MachineBasicBlock::iterator II, int SPAdj, void eliminateFrameIndex(MachineBasicBlock::iterator II, int SPAdj,
unsigned FIOperandNum, unsigned FIOperandNum,
RegScavenger *Rs = NULL) const; RegScavenger *Rs = nullptr) const;
/// getCrossCopyRegClass - Returns a legal register class to copy a register /// getCrossCopyRegClass - Returns a legal register class to copy a register
/// in the specified class to or from. Returns original class if it is /// in the specified class to or from. Returns original class if it is

View File

@ -47,16 +47,17 @@ class LLVM_LIBRARY_VISIBILITY ARMAsmPrinter : public AsmPrinter {
bool InConstantPool; bool InConstantPool;
public: public:
explicit ARMAsmPrinter(TargetMachine &TM, MCStreamer &Streamer) explicit ARMAsmPrinter(TargetMachine &TM, MCStreamer &Streamer)
: AsmPrinter(TM, Streamer), AFI(NULL), MCP(NULL), InConstantPool(false) { : AsmPrinter(TM, Streamer), AFI(nullptr), MCP(nullptr),
Subtarget = &TM.getSubtarget<ARMSubtarget>(); InConstantPool(false) {
} Subtarget = &TM.getSubtarget<ARMSubtarget>();
}
const char *getPassName() const override { const char *getPassName() const override {
return "ARM Assembly / Object Emitter"; return "ARM Assembly / Object Emitter";
} }
void printOperand(const MachineInstr *MI, int OpNum, raw_ostream &O, void printOperand(const MachineInstr *MI, int OpNum, raw_ostream &O,
const char *Modifier = 0); const char *Modifier = nullptr);
bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNum, bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNum,
unsigned AsmVariant, const char *ExtraCode, unsigned AsmVariant, const char *ExtraCode,

View File

@ -624,7 +624,7 @@ unsigned ARMBaseInstrInfo::GetInstSizeInBytes(const MachineInstr *MI) const {
MI->getOperand(NumOps - (MI->isPredicable() ? 3 : 2)); MI->getOperand(NumOps - (MI->isPredicable() ? 3 : 2));
unsigned JTI = JTOP.getIndex(); unsigned JTI = JTOP.getIndex();
const MachineJumpTableInfo *MJTI = MF->getJumpTableInfo(); const MachineJumpTableInfo *MJTI = MF->getJumpTableInfo();
assert(MJTI != 0); assert(MJTI != nullptr);
const std::vector<MachineJumpTableEntry> &JT = MJTI->getJumpTables(); const std::vector<MachineJumpTableEntry> &JT = MJTI->getJumpTables();
assert(JTI < JT.size()); assert(JTI < JT.size());
// Thumb instructions are 2 byte aligned, but JT entries are 4 byte // Thumb instructions are 2 byte aligned, but JT entries are 4 byte

View File

@ -261,7 +261,7 @@ private:
unsigned getInstrLatency(const InstrItineraryData *ItinData, unsigned getInstrLatency(const InstrItineraryData *ItinData,
const MachineInstr *MI, const MachineInstr *MI,
unsigned *PredCost = 0) const override; unsigned *PredCost = nullptr) const override;
int getInstrLatency(const InstrItineraryData *ItinData, int getInstrLatency(const InstrItineraryData *ItinData,
SDNode *Node) const override; SDNode *Node) const override;

View File

@ -101,7 +101,7 @@ protected:
public: public:
/// Code Generation virtual methods... /// Code Generation virtual methods...
const MCPhysReg * const MCPhysReg *
getCalleeSavedRegs(const MachineFunction *MF = 0) const override; getCalleeSavedRegs(const MachineFunction *MF = nullptr) const override;
const uint32_t *getCallPreservedMask(CallingConv::ID) const override; const uint32_t *getCallPreservedMask(CallingConv::ID) const override;
const uint32_t *getNoPreservedMask() const; const uint32_t *getNoPreservedMask() const;
@ -186,7 +186,7 @@ public:
void eliminateFrameIndex(MachineBasicBlock::iterator II, void eliminateFrameIndex(MachineBasicBlock::iterator II,
int SPAdj, unsigned FIOperandNum, int SPAdj, unsigned FIOperandNum,
RegScavenger *RS = NULL) const override; RegScavenger *RS = nullptr) const override;
}; };
} // end namespace llvm } // end namespace llvm

View File

@ -35,7 +35,7 @@ public:
ARMHazardRecognizer(const InstrItineraryData *ItinData, ARMHazardRecognizer(const InstrItineraryData *ItinData,
const ScheduleDAG *DAG) const ScheduleDAG *DAG)
: ScoreboardHazardRecognizer(ItinData, DAG, "post-RA-sched"), : ScoreboardHazardRecognizer(ItinData, DAG, "post-RA-sched"),
LastMI(0) {} LastMI(nullptr) {}
HazardType getHazardType(SUnit *SU, int Stalls) override; HazardType getHazardType(SUnit *SU, int Stalls) override;
void Reset() override; void Reset() override;

View File

@ -23,7 +23,7 @@ protected:
public: public:
ARMElfTargetObjectFile() : ARMElfTargetObjectFile() :
TargetLoweringObjectFileELF(), TargetLoweringObjectFileELF(),
AttributesSection(NULL) AttributesSection(nullptr)
{} {}
void Initialize(MCContext &Ctx, const TargetMachine &TM) override; void Initialize(MCContext &Ctx, const TargetMachine &TM) override;

View File

@ -1102,7 +1102,7 @@ void ARMELFStreamer::Reset() {
} }
void ARMELFStreamer::emitFnStart() { void ARMELFStreamer::emitFnStart() {
assert(FnStart == 0); assert(FnStart == nullptr);
FnStart = getContext().CreateTempSymbol(); FnStart = getContext().CreateTempSymbol();
EmitLabel(FnStart); EmitLabel(FnStart);
} }

View File

@ -56,7 +56,7 @@ public:
unsigned Reg) const override; unsigned Reg) const override;
void eliminateFrameIndex(MachineBasicBlock::iterator II, void eliminateFrameIndex(MachineBasicBlock::iterator II,
int SPAdj, unsigned FIOperandNum, int SPAdj, unsigned FIOperandNum,
RegScavenger *RS = NULL) const override; RegScavenger *RS = nullptr) const override;
}; };
} }

View File

@ -190,7 +190,7 @@ public:
/// allowsUnalignedMemoryAccesses - Returns true if the target allows /// allowsUnalignedMemoryAccesses - Returns true if the target allows
/// unaligned memory accesses. of the specified type. /// unaligned memory accesses. of the specified type.
bool allowsUnalignedMemoryAccesses(EVT VT, unsigned AddrSpace = 0, bool allowsUnalignedMemoryAccesses(EVT VT, unsigned AddrSpace = 0,
bool *Fast = 0) const override { bool *Fast = nullptr) const override {
if (RequireStrictAlign) if (RequireStrictAlign)
return false; return false;
// FIXME: True for Cyclone, but not necessary others. // FIXME: True for Cyclone, but not necessary others.

View File

@ -193,9 +193,9 @@ enum ARM64FrameOffsetStatus {
/// (possibly with @p OutUnscaledOp if OutUseUnscaledOp is true) and that /// (possibly with @p OutUnscaledOp if OutUseUnscaledOp is true) and that
/// is a legal offset. /// is a legal offset.
int isARM64FrameOffsetLegal(const MachineInstr &MI, int &Offset, int isARM64FrameOffsetLegal(const MachineInstr &MI, int &Offset,
bool *OutUseUnscaledOp = NULL, bool *OutUseUnscaledOp = nullptr,
unsigned *OutUnscaledOp = NULL, unsigned *OutUnscaledOp = nullptr,
int *EmittableOffset = NULL); int *EmittableOffset = nullptr);
static inline bool isUncondBranchOpcode(int Opc) { return Opc == ARM64::B; } static inline bool isUncondBranchOpcode(int Opc) { return Opc == ARM64::B; }

View File

@ -37,7 +37,7 @@ public:
/// Code Generation virtual methods... /// Code Generation virtual methods...
const MCPhysReg * const MCPhysReg *
getCalleeSavedRegs(const MachineFunction *MF = 0) const override; getCalleeSavedRegs(const MachineFunction *MF = nullptr) const override;
const uint32_t *getCallPreservedMask(CallingConv::ID) const override; const uint32_t *getCallPreservedMask(CallingConv::ID) const override;
unsigned getCSRFirstUseCost() const { unsigned getCSRFirstUseCost() const {
@ -82,7 +82,7 @@ public:
int64_t Offset) const override; int64_t Offset) const override;
void eliminateFrameIndex(MachineBasicBlock::iterator II, int SPAdj, void eliminateFrameIndex(MachineBasicBlock::iterator II, int SPAdj,
unsigned FIOperandNum, unsigned FIOperandNum,
RegScavenger *RS = NULL) const override; RegScavenger *RS = nullptr) const override;
bool cannotEliminateFrame(const MachineFunction &MF) const; bool cannotEliminateFrame(const MachineFunction &MF) const;
bool requiresVirtualBaseRegisters(const MachineFunction &MF) const override; bool requiresVirtualBaseRegisters(const MachineFunction &MF) const override;

View File

@ -48,7 +48,7 @@ static inline const char *getShiftName(ARM64_AM::ShiftType ST) {
case ARM64_AM::ROR: return "ror"; case ARM64_AM::ROR: return "ror";
case ARM64_AM::MSL: return "msl"; case ARM64_AM::MSL: return "msl";
} }
return 0; return nullptr;
} }
/// getShiftType - Extract the shift type. /// getShiftType - Extract the shift type.
@ -104,7 +104,7 @@ static inline const char *getExtendName(ARM64_AM::ExtendType ET) {
case ARM64_AM::SXTW: return "sxtw"; case ARM64_AM::SXTW: return "sxtw";
case ARM64_AM::SXTX: return "sxtx"; case ARM64_AM::SXTX: return "sxtx";
} }
return 0; return nullptr;
} }
/// getArithShiftValue - get the arithmetic shift value. /// getArithShiftValue - get the arithmetic shift value.

View File

@ -35,7 +35,7 @@ struct CPPTargetMachine : public TargetMachine {
AnalysisID StartAfter, AnalysisID StartAfter,
AnalysisID StopAfter); AnalysisID StopAfter);
virtual const DataLayout *getDataLayout() const { return 0; } virtual const DataLayout *getDataLayout() const { return nullptr; }
}; };
extern Target TheCppBackendTarget; extern Target TheCppBackendTarget;

View File

@ -333,7 +333,7 @@ bool HexagonCopyToCombine::isSafeToMoveTogether(MachineInstr *I1,
// Check for an exact kill (registers match). // Check for an exact kill (registers match).
if (I1UseReg && I->killsRegister(I1UseReg)) { if (I1UseReg && I->killsRegister(I1UseReg)) {
assert(KillingInstr == 0 && "Should only see one killing instruction"); assert(!KillingInstr && "Should only see one killing instruction");
KilledOperand = I1UseReg; KilledOperand = I1UseReg;
KillingInstr = &*I; KillingInstr = &*I;
} }

View File

@ -137,7 +137,7 @@ CC_Hexagon_VarArg (unsigned ValNo, MVT ValVT,
State.addLoc(CCValAssign::getMem(ValNo, ValVT, ofst, LocVT, LocInfo)); State.addLoc(CCValAssign::getMem(ValNo, ValVT, ofst, LocVT, LocInfo));
return false; return false;
} }
llvm_unreachable(0); llvm_unreachable(nullptr);
} }

View File

@ -111,7 +111,7 @@ public:
MachineInstr* MI, MachineInstr* MI,
const SmallVectorImpl<unsigned> &Ops, const SmallVectorImpl<unsigned> &Ops,
MachineInstr* LoadMI) const { MachineInstr* LoadMI) const {
return 0; return nullptr;
} }
unsigned createVR(MachineFunction* MF, MVT VT) const; unsigned createVR(MachineFunction* MF, MVT VT) const;

View File

@ -56,7 +56,7 @@ class VLIWResourceModel {
public: public:
VLIWResourceModel(const TargetMachine &TM, const TargetSchedModel *SM) : VLIWResourceModel(const TargetMachine &TM, const TargetSchedModel *SM) :
SchedModel(SM), TotalPackets(0) { SchedModel(SM), TotalPackets(0) {
ResourcesModel = TM.getInstrInfo()->CreateTargetScheduleState(&TM,NULL); ResourcesModel = TM.getInstrInfo()->CreateTargetScheduleState(&TM, nullptr);
// This hard requirement could be relaxed, // This hard requirement could be relaxed,
// but for now do not let it proceed. // but for now do not let it proceed.
@ -120,7 +120,7 @@ class ConvergingVLIWScheduler : public MachineSchedStrategy {
// Best scheduling cost. // Best scheduling cost.
int SCost; int SCost;
SchedCandidate(): SU(NULL), SCost(0) {} SchedCandidate(): SU(nullptr), SCost(0) {}
}; };
/// Represent the type of SchedCandidate found within a single queue. /// Represent the type of SchedCandidate found within a single queue.
enum CandResult { enum CandResult {
@ -153,9 +153,9 @@ class ConvergingVLIWScheduler : public MachineSchedStrategy {
/// Pending queues extend the ready queues with the same ID and the /// Pending queues extend the ready queues with the same ID and the
/// PendingFlag set. /// PendingFlag set.
VLIWSchedBoundary(unsigned ID, const Twine &Name): VLIWSchedBoundary(unsigned ID, const Twine &Name):
DAG(0), SchedModel(0), Available(ID, Name+".A"), DAG(nullptr), SchedModel(nullptr), Available(ID, Name+".A"),
Pending(ID << ConvergingVLIWScheduler::LogMaxQID, Name+".P"), Pending(ID << ConvergingVLIWScheduler::LogMaxQID, Name+".P"),
CheckPending(false), HazardRec(0), ResourceModel(0), CheckPending(false), HazardRec(nullptr), ResourceModel(nullptr),
CurrCycle(0), IssueCount(0), CurrCycle(0), IssueCount(0),
MinReadyCycle(UINT_MAX), MaxMinLatency(0) {} MinReadyCycle(UINT_MAX), MaxMinLatency(0) {}
@ -203,8 +203,9 @@ public:
LogMaxQID = 2 LogMaxQID = 2
}; };
ConvergingVLIWScheduler(): ConvergingVLIWScheduler()
DAG(0), SchedModel(0), Top(TopQID, "TopQ"), Bot(BotQID, "BotQ") {} : DAG(nullptr), SchedModel(nullptr), Top(TopQID, "TopQ"),
Bot(BotQID, "BotQ") {}
virtual void initialize(ScheduleDAGMI *dag) override; virtual void initialize(ScheduleDAGMI *dag) override;

View File

@ -48,16 +48,17 @@ struct HexagonRegisterInfo : public HexagonGenRegisterInfo {
HexagonRegisterInfo(HexagonSubtarget &st); HexagonRegisterInfo(HexagonSubtarget &st);
/// Code Generation virtual methods... /// Code Generation virtual methods...
const MCPhysReg *getCalleeSavedRegs(const MachineFunction *MF = 0) const; const MCPhysReg *
getCalleeSavedRegs(const MachineFunction *MF = nullptr) const;
const TargetRegisterClass* const* getCalleeSavedRegClasses( const TargetRegisterClass* const*
const MachineFunction *MF = 0) const; getCalleeSavedRegClasses(const MachineFunction *MF = nullptr) const;
BitVector getReservedRegs(const MachineFunction &MF) const; BitVector getReservedRegs(const MachineFunction &MF) const;
void eliminateFrameIndex(MachineBasicBlock::iterator II, void eliminateFrameIndex(MachineBasicBlock::iterator II,
int SPAdj, unsigned FIOperandNum, int SPAdj, unsigned FIOperandNum,
RegScavenger *RS = NULL) const; RegScavenger *RS = nullptr) const;
/// determineFrameLayout - Determine the size of the frame and maximum call /// determineFrameLayout - Determine the size of the frame and maximum call
/// frame size. /// frame size.

View File

@ -31,7 +31,7 @@ namespace llvm {
public: public:
explicit HexagonMCInst(): explicit HexagonMCInst():
MCInst(), MCID(0), packetStart(0), packetEnd(0) {}; MCInst(), MCID(nullptr), packetStart(0), packetEnd(0) {};
HexagonMCInst(const MCInstrDesc& mcid): HexagonMCInst(const MCInstrDesc& mcid):
MCInst(), MCID(&mcid), packetStart(0), packetEnd(0) {}; MCInst(), MCID(&mcid), packetStart(0), packetEnd(0) {};

View File

@ -45,7 +45,7 @@ void MSP430InstPrinter::printPCRelImmOperand(const MCInst *MI, unsigned OpNo,
void MSP430InstPrinter::printOperand(const MCInst *MI, unsigned OpNo, void MSP430InstPrinter::printOperand(const MCInst *MI, unsigned OpNo,
raw_ostream &O, const char *Modifier) { raw_ostream &O, const char *Modifier) {
assert((Modifier == 0 || Modifier[0] == 0) && "No modifiers supported"); assert((Modifier == nullptr || Modifier[0] == 0) && "No modifiers supported");
const MCOperand &Op = MI->getOperand(OpNo); const MCOperand &Op = MI->getOperand(OpNo);
if (Op.isReg()) { if (Op.isReg()) {
O << getRegisterName(Op.getReg()); O << getRegisterName(Op.getReg());

View File

@ -32,10 +32,10 @@ namespace llvm {
static const char *getRegisterName(unsigned RegNo); static const char *getRegisterName(unsigned RegNo);
void printOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O, void printOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O,
const char *Modifier = 0); const char *Modifier = nullptr);
void printPCRelImmOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O); void printPCRelImmOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O);
void printSrcMemOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O, void printSrcMemOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O,
const char *Modifier = 0); const char *Modifier = nullptr);
void printCCOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O); void printCCOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O);
}; };

View File

@ -51,7 +51,7 @@ public:
bool hasFP(const MachineFunction &MF) const; bool hasFP(const MachineFunction &MF) const;
bool hasReservedCallFrame(const MachineFunction &MF) const; bool hasReservedCallFrame(const MachineFunction &MF) const;
void processFunctionBeforeFrameFinalized(MachineFunction &MF, void processFunctionBeforeFrameFinalized(MachineFunction &MF,
RegScavenger *RS = NULL) const; RegScavenger *RS = nullptr) const;
}; };
} // End llvm namespace } // End llvm namespace

View File

@ -462,7 +462,7 @@ MSP430TargetLowering::LowerCCCArguments(SDValue Chain,
errs() << "LowerFormalArguments Unhandled argument type: " errs() << "LowerFormalArguments Unhandled argument type: "
<< RegVT.getSimpleVT().SimpleTy << "\n"; << RegVT.getSimpleVT().SimpleTy << "\n";
#endif #endif
llvm_unreachable(0); llvm_unreachable(nullptr);
} }
case MVT::i16: case MVT::i16:
unsigned VReg = RegInfo.createVirtualRegister(&MSP430::GR16RegClass); unsigned VReg = RegInfo.createVirtualRegister(&MSP430::GR16RegClass);

View File

@ -35,7 +35,8 @@ public:
MSP430RegisterInfo(MSP430TargetMachine &tm); MSP430RegisterInfo(MSP430TargetMachine &tm);
/// Code Generation virtual methods... /// Code Generation virtual methods...
const MCPhysReg *getCalleeSavedRegs(const MachineFunction *MF = 0) const; const MCPhysReg *
getCalleeSavedRegs(const MachineFunction *MF = nullptr) const;
BitVector getReservedRegs(const MachineFunction &MF) const; BitVector getReservedRegs(const MachineFunction &MF) const;
const TargetRegisterClass* const TargetRegisterClass*
@ -43,7 +44,7 @@ public:
void eliminateFrameIndex(MachineBasicBlock::iterator II, void eliminateFrameIndex(MachineBasicBlock::iterator II,
int SPAdj, unsigned FIOperandNum, int SPAdj, unsigned FIOperandNum,
RegScavenger *RS = NULL) const; RegScavenger *RS = nullptr) const;
// Debug information queries. // Debug information queries.
unsigned getFrameRegister(const MachineFunction &MF) const; unsigned getFrameRegister(const MachineFunction &MF) const;

View File

@ -18,7 +18,7 @@ namespace llvm {
static const unsigned MIPS_NACL_BUNDLE_ALIGN = 4u; static const unsigned MIPS_NACL_BUNDLE_ALIGN = 4u;
bool isBasePlusOffsetMemoryAccess(unsigned Opcode, unsigned *AddrIdx, bool isBasePlusOffsetMemoryAccess(unsigned Opcode, unsigned *AddrIdx,
bool *IsStore = NULL); bool *IsStore = nullptr);
bool baseRegNeedsLoadStoreMask(unsigned Reg); bool baseRegNeedsLoadStoreMask(unsigned Reg);
// This function creates an MCELFStreamer for Mips NaCl. // This function creates an MCELFStreamer for Mips NaCl.

View File

@ -82,7 +82,7 @@ public:
MipsMCInstLower MCInstLowering; MipsMCInstLower MCInstLowering;
explicit MipsAsmPrinter(TargetMachine &TM, MCStreamer &Streamer) explicit MipsAsmPrinter(TargetMachine &TM, MCStreamer &Streamer)
: AsmPrinter(TM, Streamer), MCP(0), InConstantPool(false), : AsmPrinter(TM, Streamer), MCP(nullptr), InConstantPool(false),
MCInstLowering(*this) { MCInstLowering(*this) {
Subtarget = &TM.getSubtarget<MipsSubtarget>(); Subtarget = &TM.getSubtarget<MipsSubtarget>();
} }
@ -122,7 +122,7 @@ public:
void printMemOperand(const MachineInstr *MI, int opNum, raw_ostream &O); void printMemOperand(const MachineInstr *MI, int opNum, raw_ostream &O);
void printMemOperandEA(const MachineInstr *MI, int opNum, raw_ostream &O); void printMemOperandEA(const MachineInstr *MI, int opNum, raw_ostream &O);
void printFCCOperand(const MachineInstr *MI, int opNum, raw_ostream &O, void printFCCOperand(const MachineInstr *MI, int opNum, raw_ostream &O,
const char *Modifier = 0); const char *Modifier = nullptr);
void EmitStartOfAsmFile(Module &M); void EmitStartOfAsmFile(Module &M);
void EmitEndOfAsmFile(Module &M); void EmitEndOfAsmFile(Module &M);
void PrintDebugValueComment(const MachineInstr *MI, raw_ostream &OS); void PrintDebugValueComment(const MachineInstr *MI, raw_ostream &OS);

View File

@ -3268,7 +3268,7 @@ analyzeCallOperands(const SmallVectorImpl<ISD::OutputArg> &Args,
dbgs() << "Call operand #" << I << " has unhandled type " dbgs() << "Call operand #" << I << " has unhandled type "
<< EVT(ArgVT).getEVTString(); << EVT(ArgVT).getEVTString();
#endif #endif
llvm_unreachable(0); llvm_unreachable(nullptr);
} }
} }
} }
@ -3300,7 +3300,7 @@ analyzeFormalArguments(const SmallVectorImpl<ISD::InputArg> &Args,
dbgs() << "Formal Arg #" << I << " has unhandled type " dbgs() << "Formal Arg #" << I << " has unhandled type "
<< EVT(ArgVT).getEVTString(); << EVT(ArgVT).getEVTString();
#endif #endif
llvm_unreachable(0); llvm_unreachable(nullptr);
} }
} }
@ -3325,7 +3325,7 @@ analyzeReturn(const SmallVectorImpl<Ty> &RetVals, bool IsSoftFloat,
dbgs() << "Call result #" << I << " has unhandled type " dbgs() << "Call result #" << I << " has unhandled type "
<< EVT(VT).getEVTString() << '\n'; << EVT(VT).getEVTString() << '\n';
#endif #endif
llvm_unreachable(0); llvm_unreachable(nullptr);
} }
} }
} }

View File

@ -27,7 +27,7 @@ FixGlobalBaseReg("mips-fix-global-base-reg", cl::Hidden, cl::init(true),
MipsCallEntry::MipsCallEntry(const StringRef &N) { MipsCallEntry::MipsCallEntry(const StringRef &N) {
#ifndef NDEBUG #ifndef NDEBUG
Name = N; Name = N;
Val = 0; Val = nullptr;
#endif #endif
} }

View File

@ -155,7 +155,7 @@ static void eraseGPOpnd(MachineInstr &MI) {
} }
} }
llvm_unreachable(0); llvm_unreachable(nullptr);
} }
MBBInfo::MBBInfo(MachineDomTreeNode *N) : Node(N), HTScope(nullptr) {} MBBInfo::MBBInfo(MachineDomTreeNode *N) : Node(N), HTScope(nullptr) {}

View File

@ -47,7 +47,7 @@ public:
unsigned getRegPressureLimit(const TargetRegisterClass *RC, unsigned getRegPressureLimit(const TargetRegisterClass *RC,
MachineFunction &MF) const; MachineFunction &MF) const;
const MCPhysReg *getCalleeSavedRegs(const MachineFunction *MF = 0) const; const MCPhysReg *getCalleeSavedRegs(const MachineFunction *MF =nullptr) const;
const uint32_t *getCallPreservedMask(CallingConv::ID) const; const uint32_t *getCallPreservedMask(CallingConv::ID) const;
static const uint32_t *getMips16RetHelperMask(); static const uint32_t *getMips16RetHelperMask();
@ -60,10 +60,10 @@ public:
/// Stack Frame Processing Methods /// Stack Frame Processing Methods
void eliminateFrameIndex(MachineBasicBlock::iterator II, void eliminateFrameIndex(MachineBasicBlock::iterator II,
int SPAdj, unsigned FIOperandNum, int SPAdj, unsigned FIOperandNum,
RegScavenger *RS = NULL) const; RegScavenger *RS = nullptr) const;
void processFunctionBeforeFrameFinalized(MachineFunction &MF, void processFunctionBeforeFrameFinalized(MachineFunction &MF,
RegScavenger *RS = NULL) const; RegScavenger *RS = nullptr) const;
/// Debug information queries. /// Debug information queries.
unsigned getFrameRegister(const MachineFunction &MF) const; unsigned getFrameRegister(const MachineFunction &MF) const;

View File

@ -30,8 +30,8 @@ namespace llvm {
void addMSAFloatType(MVT::SimpleValueType Ty, void addMSAFloatType(MVT::SimpleValueType Ty,
const TargetRegisterClass *RC); const TargetRegisterClass *RC);
virtual bool allowsUnalignedMemoryAccesses(EVT VT, unsigned AS = 0, bool allowsUnalignedMemoryAccesses(EVT VT, unsigned AS = 0,
bool *Fast = 0) const override; bool *Fast = nullptr) const override;
virtual SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const; virtual SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const;

View File

@ -67,7 +67,7 @@ public:
{ return &DL;} { return &DL;}
virtual const InstrItineraryData *getInstrItineraryData() const { virtual const InstrItineraryData *getInstrItineraryData() const {
return Subtarget.inMips16Mode() ? 0 : &InstrItins; return Subtarget.inMips16Mode() ? nullptr : &InstrItins;
} }
virtual MipsJITInfo *getJITInfo() virtual MipsJITInfo *getJITInfo()

View File

@ -37,15 +37,15 @@ public:
void printOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O); void printOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O);
void printCvtMode(const MCInst *MI, int OpNum, raw_ostream &O, void printCvtMode(const MCInst *MI, int OpNum, raw_ostream &O,
const char *Modifier = 0); const char *Modifier = nullptr);
void printCmpMode(const MCInst *MI, int OpNum, raw_ostream &O, void printCmpMode(const MCInst *MI, int OpNum, raw_ostream &O,
const char *Modifier = 0); const char *Modifier = nullptr);
void printLdStCode(const MCInst *MI, int OpNum, void printLdStCode(const MCInst *MI, int OpNum,
raw_ostream &O, const char *Modifier = 0); raw_ostream &O, const char *Modifier = nullptr);
void printMemOperand(const MCInst *MI, int OpNum, void printMemOperand(const MCInst *MI, int OpNum,
raw_ostream &O, const char *Modifier = 0); raw_ostream &O, const char *Modifier = nullptr);
void printProtoIdent(const MCInst *MI, int OpNum, void printProtoIdent(const MCInst *MI, int OpNum,
raw_ostream &O, const char *Modifier = 0); raw_ostream &O, const char *Modifier = nullptr);
}; };
} }

View File

@ -208,12 +208,12 @@ private:
MCOperand GetSymbolRef(const MCSymbol *Symbol); MCOperand GetSymbolRef(const MCSymbol *Symbol);
unsigned encodeVirtualRegister(unsigned Reg); unsigned encodeVirtualRegister(unsigned Reg);
void EmitAlignment(unsigned NumBits, const GlobalValue *GV = 0) const {} void EmitAlignment(unsigned NumBits, const GlobalValue *GV = nullptr) const {}
void printVecModifiedImmediate(const MachineOperand &MO, const char *Modifier, void printVecModifiedImmediate(const MachineOperand &MO, const char *Modifier,
raw_ostream &O); raw_ostream &O);
void printMemOperand(const MachineInstr *MI, int opNum, raw_ostream &O, void printMemOperand(const MachineInstr *MI, int opNum, raw_ostream &O,
const char *Modifier = 0); const char *Modifier = nullptr);
void printImplicitDef(const MachineInstr *MI, raw_ostream &O) const; void printImplicitDef(const MachineInstr *MI, raw_ostream &O) const;
void printModuleLevelGV(const GlobalVariable *GVar, raw_ostream &O, void printModuleLevelGV(const GlobalVariable *GVar, raw_ostream &O,
bool = false); bool = false);
@ -236,7 +236,7 @@ private:
unsigned AsmVariant, const char *ExtraCode, unsigned AsmVariant, const char *ExtraCode,
raw_ostream &); raw_ostream &);
void printOperand(const MachineInstr *MI, int opNum, raw_ostream &O, void printOperand(const MachineInstr *MI, int opNum, raw_ostream &O,
const char *Modifier = 0); const char *Modifier = nullptr);
bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo, bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo,
unsigned AsmVariant, const char *ExtraCode, unsigned AsmVariant, const char *ExtraCode,
raw_ostream &); raw_ostream &);
@ -312,7 +312,7 @@ public:
: AsmPrinter(TM, Streamer), : AsmPrinter(TM, Streamer),
nvptxSubtarget(TM.getSubtarget<NVPTXSubtarget>()) { nvptxSubtarget(TM.getSubtarget<NVPTXSubtarget>()) {
CurrentBankselLabelInBasicBlock = ""; CurrentBankselLabelInBasicBlock = "";
reader = NULL; reader = nullptr;
EmitGeneric = (nvptxSubtarget.getDrvInterface() == NVPTX::CUDA); EmitGeneric = (nvptxSubtarget.getDrvInterface() == NVPTX::CUDA);
} }

View File

@ -68,7 +68,7 @@ public:
} }
void AddValueSymbols(MCAssembler *) const {}; void AddValueSymbols(MCAssembler *) const {};
const MCSection *FindAssociatedSection() const { const MCSection *FindAssociatedSection() const {
return NULL; return nullptr;
} }
// There are no TLS NVPTXMCExprs at the moment. // There are no TLS NVPTXMCExprs at the moment.

View File

@ -42,7 +42,7 @@ public:
// NVPTX callee saved registers // NVPTX callee saved registers
virtual const MCPhysReg * virtual const MCPhysReg *
getCalleeSavedRegs(const MachineFunction *MF = 0) const; getCalleeSavedRegs(const MachineFunction *MF = nullptr) const;
// NVPTX callee saved register classes // NVPTX callee saved register classes
virtual const TargetRegisterClass *const * virtual const TargetRegisterClass *const *
@ -52,7 +52,7 @@ public:
virtual void eliminateFrameIndex(MachineBasicBlock::iterator MI, int SPAdj, virtual void eliminateFrameIndex(MachineBasicBlock::iterator MI, int SPAdj,
unsigned FIOperandNum, unsigned FIOperandNum,
RegScavenger *RS = NULL) const; RegScavenger *RS = nullptr) const;
virtual int getDwarfRegNum(unsigned RegNum, bool isEH) const; virtual int getDwarfRegNum(unsigned RegNum, bool isEH) const;
virtual unsigned getFrameRegister(const MachineFunction &MF) const; virtual unsigned getFrameRegister(const MachineFunction &MF) const;

View File

@ -22,26 +22,26 @@ class NVPTXTargetObjectFile : public TargetLoweringObjectFile {
public: public:
NVPTXTargetObjectFile() { NVPTXTargetObjectFile() {
TextSection = 0; TextSection = nullptr;
DataSection = 0; DataSection = nullptr;
BSSSection = 0; BSSSection = nullptr;
ReadOnlySection = 0; ReadOnlySection = nullptr;
StaticCtorSection = 0; StaticCtorSection = nullptr;
StaticDtorSection = 0; StaticDtorSection = nullptr;
LSDASection = 0; LSDASection = nullptr;
EHFrameSection = 0; EHFrameSection = nullptr;
DwarfAbbrevSection = 0; DwarfAbbrevSection = nullptr;
DwarfInfoSection = 0; DwarfInfoSection = nullptr;
DwarfLineSection = 0; DwarfLineSection = nullptr;
DwarfFrameSection = 0; DwarfFrameSection = nullptr;
DwarfPubTypesSection = 0; DwarfPubTypesSection = nullptr;
DwarfDebugInlineSection = 0; DwarfDebugInlineSection = nullptr;
DwarfStrSection = 0; DwarfStrSection = nullptr;
DwarfLocSection = 0; DwarfLocSection = nullptr;
DwarfARangesSection = 0; DwarfARangesSection = nullptr;
DwarfRangesSection = 0; DwarfRangesSection = nullptr;
DwarfMacroInfoSection = 0; DwarfMacroInfoSection = nullptr;
} }
virtual ~NVPTXTargetObjectFile(); virtual ~NVPTXTargetObjectFile();

View File

@ -41,7 +41,7 @@ public:
void printOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O); void printOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O);
void printPredicateOperand(const MCInst *MI, unsigned OpNo, void printPredicateOperand(const MCInst *MI, unsigned OpNo,
raw_ostream &O, const char *Modifier = 0); raw_ostream &O, const char *Modifier = nullptr);
void printU2ImmOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O); void printU2ImmOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O);
void printS5ImmOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O); void printS5ImmOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O);

View File

@ -46,9 +46,9 @@ public:
void replaceFPWithRealFP(MachineFunction &MF) const; void replaceFPWithRealFP(MachineFunction &MF) const;
void processFunctionBeforeCalleeSavedScan(MachineFunction &MF, void processFunctionBeforeCalleeSavedScan(MachineFunction &MF,
RegScavenger *RS = NULL) const; RegScavenger *RS = nullptr) const;
void processFunctionBeforeFrameFinalized(MachineFunction &MF, void processFunctionBeforeFrameFinalized(MachineFunction &MF,
RegScavenger *RS = NULL) const; RegScavenger *RS = nullptr) const;
void addScavengingSpillSlot(MachineFunction &MF, RegScavenger *RS) const; void addScavengingSpillSlot(MachineFunction &MF, RegScavenger *RS) const;
bool spillCalleeSavedRegisters(MachineBasicBlock &MBB, bool spillCalleeSavedRegisters(MachineBasicBlock &MBB,
@ -156,7 +156,7 @@ public:
// Early exit if not using the SVR4 ABI. // Early exit if not using the SVR4 ABI.
if (!Subtarget.isSVR4ABI()) { if (!Subtarget.isSVR4ABI()) {
NumEntries = 0; NumEntries = 0;
return 0; return nullptr;
} }
// Note that the offsets here overlap, but this is fixed up in // Note that the offsets here overlap, but this is fixed up in

View File

@ -3801,7 +3801,7 @@ PPCTargetLowering::LowerCall_32SVR4(SDValue Chain, SDValue Callee,
errs() << "Call operand #" << i << " has unhandled type " errs() << "Call operand #" << i << " has unhandled type "
<< EVT(ArgVT).getEVTString() << "\n"; << EVT(ArgVT).getEVTString() << "\n";
#endif #endif
llvm_unreachable(0); llvm_unreachable(nullptr);
} }
} }
} else { } else {
@ -5487,7 +5487,7 @@ SDValue PPCTargetLowering::LowerBUILD_VECTOR(SDValue Op,
SelectionDAG &DAG) const { SelectionDAG &DAG) const {
SDLoc dl(Op); SDLoc dl(Op);
BuildVectorSDNode *BVN = dyn_cast<BuildVectorSDNode>(Op.getNode()); BuildVectorSDNode *BVN = dyn_cast<BuildVectorSDNode>(Op.getNode());
assert(BVN != 0 && "Expected a BuildVectorSDNode in LowerBUILD_VECTOR"); assert(BVN && "Expected a BuildVectorSDNode in LowerBUILD_VECTOR");
// Check if this is a splat of a constant value. // Check if this is a splat of a constant value.
APInt APSplatBits, APSplatUndef; APInt APSplatBits, APSplatUndef;

View File

@ -492,7 +492,7 @@ namespace llvm {
/// relative to software emulation. /// relative to software emulation.
virtual bool allowsUnalignedMemoryAccesses(EVT VT, virtual bool allowsUnalignedMemoryAccesses(EVT VT,
unsigned AddrSpace, unsigned AddrSpace,
bool *Fast = 0) const; bool *Fast = nullptr) const;
/// isFMAFasterThanFMulAndFAdd - Return true if an FMA operation is faster /// isFMAFasterThanFMulAndFAdd - Return true if an FMA operation is faster
/// than a pair of fmul and fadd instructions. fmuladd intrinsics will be /// than a pair of fmul and fadd instructions. fmuladd intrinsics will be

View File

@ -44,7 +44,7 @@ public:
getLargestLegalSuperClass(const TargetRegisterClass *RC) const; getLargestLegalSuperClass(const TargetRegisterClass *RC) const;
/// Code Generation virtual methods... /// Code Generation virtual methods...
const MCPhysReg *getCalleeSavedRegs(const MachineFunction* MF = 0) const; const MCPhysReg *getCalleeSavedRegs(const MachineFunction* MF =nullptr) const;
const uint32_t *getCallPreservedMask(CallingConv::ID CC) const; const uint32_t *getCallPreservedMask(CallingConv::ID CC) const;
const uint32_t *getNoPreservedMask() const; const uint32_t *getNoPreservedMask() const;
@ -85,7 +85,7 @@ public:
int &FrameIdx) const; int &FrameIdx) const;
void eliminateFrameIndex(MachineBasicBlock::iterator II, void eliminateFrameIndex(MachineBasicBlock::iterator II,
int SPAdj, unsigned FIOperandNum, int SPAdj, unsigned FIOperandNum,
RegScavenger *RS = NULL) const; RegScavenger *RS = nullptr) const;
// Support for virtual base registers. // Support for virtual base registers.
bool needsFrameBaseReg(MachineInstr *MI, int64_t Offset) const; bool needsFrameBaseReg(MachineInstr *MI, int64_t Offset) const;

View File

@ -118,7 +118,7 @@ public:
SmallVectorImpl<SDNode *> &NewNodes) const; SmallVectorImpl<SDNode *> &NewNodes) const;
unsigned getOpcodeAfterMemoryUnfold(unsigned Opc, unsigned getOpcodeAfterMemoryUnfold(unsigned Opc,
bool UnfoldLoad, bool UnfoldStore, bool UnfoldLoad, bool UnfoldStore,
unsigned *LoadRegIndex = 0) const; unsigned *LoadRegIndex = nullptr) const;
bool shouldScheduleLoadsNear(SDNode *Load1, SDNode *Load2, bool shouldScheduleLoadsNear(SDNode *Load1, SDNode *Load2,
int64_t Offset1, int64_t Offset2, int64_t Offset1, int64_t Offset2,
unsigned NumLoads) const; unsigned NumLoads) const;

View File

@ -43,11 +43,11 @@ struct AMDGPURegisterInfo : public AMDGPUGenRegisterInfo {
/// \returns The ISA reg class that is equivalent to \p RC. /// \returns The ISA reg class that is equivalent to \p RC.
virtual const TargetRegisterClass * getISARegClass( virtual const TargetRegisterClass * getISARegClass(
const TargetRegisterClass * RC) const { const TargetRegisterClass * RC) const {
assert(!"Unimplemented"); return NULL; assert(!"Unimplemented"); return nullptr;
} }
virtual const TargetRegisterClass* getCFGStructurizerRegClass(MVT VT) const { virtual const TargetRegisterClass* getCFGStructurizerRegClass(MVT VT) const {
assert(!"Unimplemented"); return NULL; assert(!"Unimplemented"); return nullptr;
} }
virtual unsigned getHWRegIndex(unsigned Reg) const { virtual unsigned getHWRegIndex(unsigned Reg) const {

View File

@ -168,7 +168,7 @@ public:
MLI = &getAnalysis<MachineLoopInfo>(); MLI = &getAnalysis<MachineLoopInfo>();
DEBUG(dbgs() << "LoopInfo:\n"; PrintLoopinfo(*MLI);); DEBUG(dbgs() << "LoopInfo:\n"; PrintLoopinfo(*MLI););
MDT = &getAnalysis<MachineDominatorTree>(); MDT = &getAnalysis<MachineDominatorTree>();
DEBUG(MDT->print(dbgs(), (const llvm::Module*)0);); DEBUG(MDT->print(dbgs(), (const llvm::Module*)nullptr););
PDT = &getAnalysis<MachinePostDominatorTree>(); PDT = &getAnalysis<MachinePostDominatorTree>();
DEBUG(PDT->print(dbgs());); DEBUG(PDT->print(dbgs()););
prepare(); prepare();

View File

@ -34,12 +34,12 @@ enum ID {
class AMDGPUIntrinsicInfo : public TargetIntrinsicInfo { class AMDGPUIntrinsicInfo : public TargetIntrinsicInfo {
public: public:
AMDGPUIntrinsicInfo(TargetMachine *tm); AMDGPUIntrinsicInfo(TargetMachine *tm);
std::string getName(unsigned int IntrId, Type **Tys = 0, std::string getName(unsigned int IntrId, Type **Tys = nullptr,
unsigned int numTys = 0) const; unsigned int numTys = 0) const;
unsigned int lookupName(const char *Name, unsigned int Len) const; unsigned int lookupName(const char *Name, unsigned int Len) const;
bool isOverloaded(unsigned int IID) const; bool isOverloaded(unsigned int IID) const;
Function *getDeclaration(Module *M, unsigned int ID, Function *getDeclaration(Module *M, unsigned int ID,
Type **Tys = 0, Type **Tys = nullptr,
unsigned int numTys = 0) const; unsigned int numTys = 0) const;
}; };

View File

@ -192,7 +192,7 @@ namespace llvm {
unsigned int getInstrLatency(const InstrItineraryData *ItinData, unsigned int getInstrLatency(const InstrItineraryData *ItinData,
const MachineInstr *MI, const MachineInstr *MI,
unsigned *PredCost = 0) const; unsigned *PredCost = nullptr) const;
virtual int getInstrLatency(const InstrItineraryData *ItinData, virtual int getInstrLatency(const InstrItineraryData *ItinData,
SDNode *Node) const { return 1;} SDNode *Node) const { return 1;}

View File

@ -68,7 +68,7 @@ class R600SchedStrategy : public MachineSchedStrategy {
public: public:
R600SchedStrategy() : R600SchedStrategy() :
DAG(0), TII(0), TRI(0), MRI(0) { DAG(nullptr), TII(nullptr), TRI(nullptr), MRI(nullptr) {
} }
virtual ~R600SchedStrategy() { virtual ~R600SchedStrategy() {

View File

@ -79,7 +79,7 @@ public:
bool NewMI=false) const; bool NewMI=false) const;
bool isTriviallyReMaterializable(const MachineInstr *MI, bool isTriviallyReMaterializable(const MachineInstr *MI,
AliasAnalysis *AA = 0) const; AliasAnalysis *AA = nullptr) const;
virtual unsigned getIEQOpcode() const { virtual unsigned getIEQOpcode() const {
llvm_unreachable("Unimplemented"); llvm_unreachable("Unimplemented");

View File

@ -245,7 +245,7 @@ public:
case k_Immediate: OS << "Imm: " << getImm() << "\n"; break; case k_Immediate: OS << "Imm: " << getImm() << "\n"; break;
case k_MemoryReg: OS << "Mem: " << getMemBase() << "+" case k_MemoryReg: OS << "Mem: " << getMemBase() << "+"
<< getMemOffsetReg() << "\n"; break; << getMemOffsetReg() << "\n"; break;
case k_MemoryImm: assert(getMemOff() != 0); case k_MemoryImm: assert(getMemOff() != nullptr);
OS << "Mem: " << getMemBase() OS << "Mem: " << getMemBase()
<< "+" << *getMemOff() << "+" << *getMemOff()
<< "\n"; break; << "\n"; break;

View File

@ -42,7 +42,7 @@ public:
void printOperand(const MCInst *MI, int opNum, raw_ostream &OS); void printOperand(const MCInst *MI, int opNum, raw_ostream &OS);
void printMemOperand(const MCInst *MI, int opNum, raw_ostream &OS, void printMemOperand(const MCInst *MI, int opNum, raw_ostream &OS,
const char *Modifier = 0); const char *Modifier = nullptr);
void printCCOperand(const MCInst *MI, int opNum, raw_ostream &OS); void printCCOperand(const MCInst *MI, int opNum, raw_ostream &OS);
bool printGetPCX(const MCInst *MI, unsigned OpNo, raw_ostream &OS); bool printGetPCX(const MCInst *MI, unsigned OpNo, raw_ostream &OS);

View File

@ -41,7 +41,7 @@ public:
bool hasReservedCallFrame(const MachineFunction &MF) const; bool hasReservedCallFrame(const MachineFunction &MF) const;
bool hasFP(const MachineFunction &MF) const; bool hasFP(const MachineFunction &MF) const;
void processFunctionBeforeCalleeSavedScan(MachineFunction &MF, void processFunctionBeforeCalleeSavedScan(MachineFunction &MF,
RegScavenger *RS = NULL) const; RegScavenger *RS = nullptr) const;
private: private:
// Remap input registers to output registers for leaf procedure. // Remap input registers to output registers for leaf procedure.

View File

@ -31,7 +31,7 @@ struct SparcRegisterInfo : public SparcGenRegisterInfo {
SparcRegisterInfo(SparcSubtarget &st); SparcRegisterInfo(SparcSubtarget &st);
/// Code Generation virtual methods... /// Code Generation virtual methods...
const MCPhysReg *getCalleeSavedRegs(const MachineFunction *MF = 0) const; const MCPhysReg *getCalleeSavedRegs(const MachineFunction *MF =nullptr) const;
const uint32_t* getCallPreservedMask(CallingConv::ID CC) const; const uint32_t* getCallPreservedMask(CallingConv::ID CC) const;
const uint32_t* getRTCallPreservedMask(CallingConv::ID CC) const; const uint32_t* getRTCallPreservedMask(CallingConv::ID CC) const;
@ -43,10 +43,10 @@ struct SparcRegisterInfo : public SparcGenRegisterInfo {
void eliminateFrameIndex(MachineBasicBlock::iterator II, void eliminateFrameIndex(MachineBasicBlock::iterator II,
int SPAdj, unsigned FIOperandNum, int SPAdj, unsigned FIOperandNum,
RegScavenger *RS = NULL) const; RegScavenger *RS = nullptr) const;
void processFunctionBeforeFrameFinalized(MachineFunction &MF, void processFunctionBeforeFrameFinalized(MachineFunction &MF,
RegScavenger *RS = NULL) const; RegScavenger *RS = nullptr) const;
// Debug information queries. // Debug information queries.
unsigned getFrameRegister(const MachineFunction &MF) const; unsigned getFrameRegister(const MachineFunction &MF) const;

View File

@ -229,7 +229,7 @@ public:
// BRANCH exists, return the opcode for the latter, otherwise return 0. // BRANCH exists, return the opcode for the latter, otherwise return 0.
// MI, if nonnull, is the compare instruction. // MI, if nonnull, is the compare instruction.
unsigned getCompareAndBranch(unsigned Opcode, unsigned getCompareAndBranch(unsigned Opcode,
const MachineInstr *MI = 0) const; const MachineInstr *MI = nullptr) const;
// Emit code before MBBI in MI to move immediate value Value into // Emit code before MBBI in MI to move immediate value Value into
// physical register Reg. // physical register Reg.

View File

@ -49,7 +49,7 @@ public:
bool trackLivenessAfterRegAlloc(const MachineFunction &MF) const override { bool trackLivenessAfterRegAlloc(const MachineFunction &MF) const override {
return true; return true;
} }
const MCPhysReg *getCalleeSavedRegs(const MachineFunction *MF = 0) const const MCPhysReg *getCalleeSavedRegs(const MachineFunction *MF = nullptr) const
override; override;
BitVector getReservedRegs(const MachineFunction &MF) const override; BitVector getReservedRegs(const MachineFunction &MF) const override;
void eliminateFrameIndex(MachineBasicBlock::iterator MI, void eliminateFrameIndex(MachineBasicBlock::iterator MI,

View File

@ -422,7 +422,7 @@ struct X86Operand : public MCParsedAsmOperand {
bool AddressOf = false, bool AddressOf = false,
SMLoc OffsetOfLoc = SMLoc(), SMLoc OffsetOfLoc = SMLoc(),
StringRef SymName = StringRef(), StringRef SymName = StringRef(),
void *OpDecl = 0) { void *OpDecl = nullptr) {
X86Operand *Res = new X86Operand(Register, StartLoc, EndLoc); X86Operand *Res = new X86Operand(Register, StartLoc, EndLoc);
Res->Reg.RegNo = RegNo; Res->Reg.RegNo = RegNo;
Res->AddressOf = AddressOf; Res->AddressOf = AddressOf;
@ -441,7 +441,7 @@ struct X86Operand : public MCParsedAsmOperand {
/// Create an absolute memory operand. /// Create an absolute memory operand.
static X86Operand *CreateMem(const MCExpr *Disp, SMLoc StartLoc, SMLoc EndLoc, static X86Operand *CreateMem(const MCExpr *Disp, SMLoc StartLoc, SMLoc EndLoc,
unsigned Size = 0, StringRef SymName = StringRef(), unsigned Size = 0, StringRef SymName = StringRef(),
void *OpDecl = 0) { void *OpDecl = nullptr) {
X86Operand *Res = new X86Operand(Memory, StartLoc, EndLoc); X86Operand *Res = new X86Operand(Memory, StartLoc, EndLoc);
Res->Mem.SegReg = 0; Res->Mem.SegReg = 0;
Res->Mem.Disp = Disp; Res->Mem.Disp = Disp;
@ -461,7 +461,7 @@ struct X86Operand : public MCParsedAsmOperand {
unsigned Scale, SMLoc StartLoc, SMLoc EndLoc, unsigned Scale, SMLoc StartLoc, SMLoc EndLoc,
unsigned Size = 0, unsigned Size = 0,
StringRef SymName = StringRef(), StringRef SymName = StringRef(),
void *OpDecl = 0) { void *OpDecl = nullptr) {
// We should never just have a displacement, that should be parsed as an // We should never just have a displacement, that should be parsed as an
// absolute memory operand. // absolute memory operand.
assert((SegReg || BaseReg || IndexReg) && "Invalid memory operand!"); assert((SegReg || BaseReg || IndexReg) && "Invalid memory operand!");

View File

@ -80,7 +80,7 @@ static InstructionContext contextForAttrs(uint16_t attrMask) {
static int modRMRequired(OpcodeType type, static int modRMRequired(OpcodeType type,
InstructionContext insnContext, InstructionContext insnContext,
uint16_t opcode) { uint16_t opcode) {
const struct ContextDecision* decision = 0; const struct ContextDecision* decision = nullptr;
switch (type) { switch (type) {
case ONEBYTE: case ONEBYTE:
@ -124,7 +124,7 @@ static InstrUID decode(OpcodeType type,
InstructionContext insnContext, InstructionContext insnContext,
uint8_t opcode, uint8_t opcode,
uint8_t modRM) { uint8_t modRM) {
const struct ModRMDecision* dec = 0; const struct ModRMDecision* dec = nullptr;
switch (type) { switch (type) {
case ONEBYTE: case ONEBYTE:

View File

@ -1476,7 +1476,7 @@ void Emitter<CodeEmitter>::emitInstruction(MachineInstr &MI,
#ifndef NDEBUG #ifndef NDEBUG
dbgs() << "Cannot encode all operands of: " << MI << "\n"; dbgs() << "Cannot encode all operands of: " << MI << "\n";
#endif #endif
llvm_unreachable(0); llvm_unreachable(nullptr);
} }
MCE.processDebugLoc(MI.getDebugLoc(), false); MCE.processDebugLoc(MI.getDebugLoc(), false);

View File

@ -47,7 +47,7 @@ public:
void adjustForHiPEPrologue(MachineFunction &MF) const override; void adjustForHiPEPrologue(MachineFunction &MF) const override;
void processFunctionBeforeCalleeSavedScan(MachineFunction &MF, void processFunctionBeforeCalleeSavedScan(MachineFunction &MF,
RegScavenger *RS = NULL) const override; RegScavenger *RS = nullptr) const override;
bool spillCalleeSavedRegisters(MachineBasicBlock &MBB, bool spillCalleeSavedRegisters(MachineBasicBlock &MBB,
MachineBasicBlock::iterator MI, MachineBasicBlock::iterator MI,

View File

@ -104,14 +104,14 @@ namespace {
void dump() { void dump() {
dbgs() << "X86ISelAddressMode " << this << '\n'; dbgs() << "X86ISelAddressMode " << this << '\n';
dbgs() << "Base_Reg "; dbgs() << "Base_Reg ";
if (Base_Reg.getNode() != 0) if (Base_Reg.getNode())
Base_Reg.getNode()->dump(); Base_Reg.getNode()->dump();
else else
dbgs() << "nul"; dbgs() << "nul";
dbgs() << " Base.FrameIndex " << Base_FrameIndex << '\n' dbgs() << " Base.FrameIndex " << Base_FrameIndex << '\n'
<< " Scale" << Scale << '\n' << " Scale" << Scale << '\n'
<< "IndexReg "; << "IndexReg ";
if (IndexReg.getNode() != 0) if (IndexReg.getNode())
IndexReg.getNode()->dump(); IndexReg.getNode()->dump();
else else
dbgs() << "nul"; dbgs() << "nul";
@ -2773,7 +2773,7 @@ SDNode *X86DAGToDAGISel::Select(SDNode *Node) {
SDNode *ResNode = SelectCode(Node); SDNode *ResNode = SelectCode(Node);
DEBUG(dbgs() << "=> "; DEBUG(dbgs() << "=> ";
if (ResNode == NULL || ResNode == Node) if (ResNode == nullptr || ResNode == Node)
Node->dump(CurDAG); Node->dump(CurDAG);
else else
ResNode->dump(CurDAG); ResNode->dump(CurDAG);

View File

@ -11515,7 +11515,7 @@ static SDValue getTargetVShiftByConstNode(unsigned Opc, SDLoc dl, MVT VT,
ConstantSDNode *ND; ConstantSDNode *ND;
switch(Opc) { switch(Opc) {
default: llvm_unreachable(0); default: llvm_unreachable(nullptr);
case X86ISD::VSHLI: case X86ISD::VSHLI:
for (unsigned i=0; i!=NumElts; ++i) { for (unsigned i=0; i!=NumElts; ++i) {
SDValue CurrentOp = SrcOp->getOperand(i); SDValue CurrentOp = SrcOp->getOperand(i);

View File

@ -783,7 +783,7 @@ namespace llvm {
/// Intel processors have a unified instruction and data cache /// Intel processors have a unified instruction and data cache
const char * getClearCacheBuiltinName() const { const char * getClearCacheBuiltinName() const {
return 0; // nothing to do, move along. return nullptr; // nothing to do, move along.
} }
/// createFastISel - This method returns a target specific FastISel object, /// createFastISel - This method returns a target specific FastISel object,

View File

@ -52,7 +52,8 @@ struct X86AddressMode {
unsigned GVOpFlags; unsigned GVOpFlags;
X86AddressMode() X86AddressMode()
: BaseType(RegBase), Scale(1), IndexReg(0), Disp(0), GV(0), GVOpFlags(0) { : BaseType(RegBase), Scale(1), IndexReg(0), Disp(0), GV(nullptr),
GVOpFlags(0) {
Base.Reg = 0; Base.Reg = 0;
} }

View File

@ -325,7 +325,7 @@ public:
/// value. /// value.
unsigned getOpcodeAfterMemoryUnfold(unsigned Opc, unsigned getOpcodeAfterMemoryUnfold(unsigned Opc,
bool UnfoldLoad, bool UnfoldStore, bool UnfoldLoad, bool UnfoldStore,
unsigned *LoadRegIndex = 0) const override; unsigned *LoadRegIndex = nullptr) const override;
/// areLoadsFromSameBasePtr - This is used by the pre-regalloc scheduler /// areLoadsFromSameBasePtr - This is used by the pre-regalloc scheduler
/// to determine if two loads are loading from the same base address. It /// to determine if two loads are loading from the same base address. It

View File

@ -122,7 +122,7 @@ public:
void eliminateFrameIndex(MachineBasicBlock::iterator MI, void eliminateFrameIndex(MachineBasicBlock::iterator MI,
int SPAdj, unsigned FIOperandNum, int SPAdj, unsigned FIOperandNum,
RegScavenger *RS = NULL) const override; RegScavenger *RS = nullptr) const override;
// Debug information queries. // Debug information queries.
unsigned getFrameRegister(const MachineFunction &MF) const override; unsigned getFrameRegister(const MachineFunction &MF) const override;

View File

@ -495,7 +495,7 @@ eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB,
errs() << "eliminateCallFramePseudoInstr size too big: " errs() << "eliminateCallFramePseudoInstr size too big: "
<< Amount << "\n"; << Amount << "\n";
#endif #endif
llvm_unreachable(0); llvm_unreachable(nullptr);
} }
MachineInstr *New; MachineInstr *New;

Some files were not shown because too many files have changed in this diff Show More