Commit ae953202 by Jim Stichnoth

Subzero: Convert NULL->nullptr.

This is limited to the src directory, and not (yet) the crosstest directory. BUG= none R=jfb@chromium.org Review URL: https://codereview.chromium.org/814353002
parent 31c95590
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
namespace Ice { namespace Ice {
thread_local const Cfg *Cfg::CurrentCfg = NULL; thread_local const Cfg *Cfg::CurrentCfg = nullptr;
ArenaAllocator *getCurrentCfgAllocator() { ArenaAllocator *getCurrentCfgAllocator() {
return Cfg::getCurrentCfgAllocator(); return Cfg::getCurrentCfgAllocator();
...@@ -32,23 +32,23 @@ ArenaAllocator *getCurrentCfgAllocator() { ...@@ -32,23 +32,23 @@ ArenaAllocator *getCurrentCfgAllocator() {
Cfg::Cfg(GlobalContext *Ctx) Cfg::Cfg(GlobalContext *Ctx)
: Ctx(Ctx), FunctionName(""), ReturnType(IceType_void), : Ctx(Ctx), FunctionName(""), ReturnType(IceType_void),
IsInternalLinkage(false), HasError(false), FocusedTiming(false), IsInternalLinkage(false), HasError(false), FocusedTiming(false),
ErrorMessage(""), Entry(NULL), NextInstNumber(Inst::NumberInitial), ErrorMessage(""), Entry(nullptr), NextInstNumber(Inst::NumberInitial),
Allocator(new ArenaAllocator()), Live(nullptr), Allocator(new ArenaAllocator()), Live(nullptr),
Target(TargetLowering::createLowering(Ctx->getTargetArch(), this)), Target(TargetLowering::createLowering(Ctx->getTargetArch(), this)),
VMetadata(new VariablesMetadata(this)), VMetadata(new VariablesMetadata(this)),
TargetAssembler( TargetAssembler(
TargetLowering::createAssembler(Ctx->getTargetArch(), this)), TargetLowering::createAssembler(Ctx->getTargetArch(), this)),
CurrentNode(NULL) { CurrentNode(nullptr) {
assert(!Ctx->isIRGenerationDisabled() && assert(!Ctx->isIRGenerationDisabled() &&
"Attempt to build cfg when IR generation disabled"); "Attempt to build cfg when IR generation disabled");
} }
Cfg::~Cfg() { Cfg::~Cfg() {
// TODO(stichnot,kschimpf): Set CurrentCfg=NULL in the dtor for // TODO(stichnot,kschimpf): Set CurrentCfg=nullptr in the dtor for
// safety. This can't be done currently because the translator // safety. This can't be done currently because the translator
// manages the Cfg by creating a new Cfg (which sets CurrentCfg to // manages the Cfg by creating a new Cfg (which sets CurrentCfg to
// the new value), then deleting the old Cfg (which would then reset // the new value), then deleting the old Cfg (which would then reset
// CurrentCfg to NULL). // CurrentCfg to nullptr).
} }
void Cfg::setError(const IceString &Message) { void Cfg::setError(const IceString &Message) {
...@@ -338,12 +338,12 @@ bool Cfg::validateLiveness() const { ...@@ -338,12 +338,12 @@ bool Cfg::validateLiveness() const {
bool Valid = true; bool Valid = true;
Ostream &Str = Ctx->getStrDump(); Ostream &Str = Ctx->getStrDump();
for (CfgNode *Node : Nodes) { for (CfgNode *Node : Nodes) {
Inst *FirstInst = NULL; Inst *FirstInst = nullptr;
for (auto Inst = Node->getInsts().begin(), E = Node->getInsts().end(); for (auto Inst = Node->getInsts().begin(), E = Node->getInsts().end();
Inst != E; ++Inst) { Inst != E; ++Inst) {
if (Inst->isDeleted()) if (Inst->isDeleted())
continue; continue;
if (FirstInst == NULL) if (FirstInst == nullptr)
FirstInst = Inst; FirstInst = Inst;
InstNumberT InstNumber = Inst->getNumber(); InstNumberT InstNumber = Inst->getNumber();
if (Variable *Dest = Inst->getDest()) { if (Variable *Dest = Inst->getDest()) {
...@@ -410,7 +410,7 @@ void Cfg::doBranchOpt() { ...@@ -410,7 +410,7 @@ void Cfg::doBranchOpt() {
for (auto I = Nodes.begin(), E = Nodes.end(); I != E; ++I) { for (auto I = Nodes.begin(), E = Nodes.end(); I != E; ++I) {
auto NextNode = I; auto NextNode = I;
++NextNode; ++NextNode;
(*I)->doBranchOpt(NextNode == E ? NULL : *NextNode); (*I)->doBranchOpt(NextNode == E ? nullptr : *NextNode);
} }
} }
......
...@@ -154,7 +154,7 @@ public: ...@@ -154,7 +154,7 @@ public:
// Manage the CurrentNode field, which is used for validating the // Manage the CurrentNode field, which is used for validating the
// Variable::DefNode field during dumping/emitting. // Variable::DefNode field during dumping/emitting.
void setCurrentNode(const CfgNode *Node) { CurrentNode = Node; } void setCurrentNode(const CfgNode *Node) { CurrentNode = Node; }
void resetCurrentNode() { setCurrentNode(NULL); } void resetCurrentNode() { setCurrentNode(nullptr); }
const CfgNode *getCurrentNode() const { return CurrentNode; } const CfgNode *getCurrentNode() const { return CurrentNode; }
void emit(); void emit();
......
...@@ -164,7 +164,7 @@ void CfgNode::placePhiStores() { ...@@ -164,7 +164,7 @@ void CfgNode::placePhiStores() {
// Keep track of the dest variable of a compare instruction, so that // Keep track of the dest variable of a compare instruction, so that
// we insert the new instruction at the SafeInsertionPoint if the // we insert the new instruction at the SafeInsertionPoint if the
// compare's dest matches the Phi-lowered assignment's source. // compare's dest matches the Phi-lowered assignment's source.
Variable *CmpInstDest = NULL; Variable *CmpInstDest = nullptr;
// If the current insertion point is at a conditional branch // If the current insertion point is at a conditional branch
// instruction, and the previous instruction is a compare // instruction, and the previous instruction is a compare
// instruction, then we move the insertion point before the compare // instruction, then we move the insertion point before the compare
...@@ -553,8 +553,8 @@ void CfgNode::livenessLightweight() { ...@@ -553,8 +553,8 @@ void CfgNode::livenessLightweight() {
bool CfgNode::liveness(Liveness *Liveness) { bool CfgNode::liveness(Liveness *Liveness) {
SizeT NumVars = Liveness->getNumVarsInNode(this); SizeT NumVars = Liveness->getNumVarsInNode(this);
LivenessBV Live(NumVars); LivenessBV Live(NumVars);
LiveBeginEndMap *LiveBegin = NULL; LiveBeginEndMap *LiveBegin = nullptr;
LiveBeginEndMap *LiveEnd = NULL; LiveBeginEndMap *LiveEnd = nullptr;
// Mark the beginning and ending of each variable's live range // Mark the beginning and ending of each variable's live range
// with the sentinel instruction number 0. // with the sentinel instruction number 0.
if (Liveness->getMode() == Liveness_Intervals) { if (Liveness->getMode() == Liveness_Intervals) {
...@@ -723,7 +723,7 @@ void CfgNode::livenessAddIntervals(Liveness *Liveness, InstNumberT FirstInstNum, ...@@ -723,7 +723,7 @@ void CfgNode::livenessAddIntervals(Liveness *Liveness, InstNumberT FirstInstNum,
void CfgNode::contractIfEmpty() { void CfgNode::contractIfEmpty() {
if (InEdges.empty()) if (InEdges.empty())
return; return;
Inst *Branch = NULL; Inst *Branch = nullptr;
for (auto I = Insts.begin(), E = Insts.end(); I != E; ++I) { for (auto I = Insts.begin(), E = Insts.end(); I != E; ++I) {
if (I->isDeleted()) if (I->isDeleted())
continue; continue;
......
...@@ -78,7 +78,7 @@ public: ...@@ -78,7 +78,7 @@ public:
UndefPool() : NextPoolID(0), Pool(IceType_NUM) {} UndefPool() : NextPoolID(0), Pool(IceType_NUM) {}
ConstantUndef *getOrAdd(GlobalContext *Ctx, Type Ty) { ConstantUndef *getOrAdd(GlobalContext *Ctx, Type Ty) {
if (Pool[Ty] == NULL) if (Pool[Ty] == nullptr)
Pool[Ty] = ConstantUndef::create(Ctx, Ty, NextPoolID++); Pool[Ty] = ConstantUndef::create(Ctx, Ty, NextPoolID++);
return Pool[Ty]; return Pool[Ty];
} }
...@@ -325,7 +325,7 @@ Constant *GlobalContext::getConstantInt(Type Ty, int64_t Value) { ...@@ -325,7 +325,7 @@ Constant *GlobalContext::getConstantInt(Type Ty, int64_t Value) {
default: default:
llvm_unreachable("Bad integer type for getConstant"); llvm_unreachable("Bad integer type for getConstant");
} }
return NULL; return nullptr;
} }
Constant *GlobalContext::getConstantInt1(int8_t ConstantInt1) { Constant *GlobalContext::getConstantInt1(int8_t ConstantInt1) {
......
...@@ -235,18 +235,18 @@ InstAssign::InstAssign(Cfg *Func, Variable *Dest, Operand *Source) ...@@ -235,18 +235,18 @@ InstAssign::InstAssign(Cfg *Func, Variable *Dest, Operand *Source)
// semantics, there is at most one edge from one node to another. // semantics, there is at most one edge from one node to another.
InstBr::InstBr(Cfg *Func, Operand *Source, CfgNode *TargetTrue, InstBr::InstBr(Cfg *Func, Operand *Source, CfgNode *TargetTrue,
CfgNode *TargetFalse) CfgNode *TargetFalse)
: InstHighLevel(Func, Inst::Br, 1, NULL), TargetFalse(TargetFalse), : InstHighLevel(Func, Inst::Br, 1, nullptr), TargetFalse(TargetFalse),
TargetTrue(TargetTrue) { TargetTrue(TargetTrue) {
if (TargetTrue == TargetFalse) { if (TargetTrue == TargetFalse) {
TargetTrue = NULL; // turn into unconditional version TargetTrue = nullptr; // turn into unconditional version
} else { } else {
addSource(Source); addSource(Source);
} }
} }
InstBr::InstBr(Cfg *Func, CfgNode *Target) InstBr::InstBr(Cfg *Func, CfgNode *Target)
: InstHighLevel(Func, Inst::Br, 0, NULL), TargetFalse(Target), : InstHighLevel(Func, Inst::Br, 0, nullptr), TargetFalse(Target),
TargetTrue(NULL) {} TargetTrue(nullptr) {}
NodeList InstBr::getTerminatorEdges() const { NodeList InstBr::getTerminatorEdges() const {
NodeList OutEdges; NodeList OutEdges;
...@@ -331,7 +331,7 @@ Operand *InstPhi::getOperandForTarget(CfgNode *Target) const { ...@@ -331,7 +331,7 @@ Operand *InstPhi::getOperandForTarget(CfgNode *Target) const {
return getSrc(I); return getSrc(I);
} }
llvm_unreachable("Phi target not found"); llvm_unreachable("Phi target not found");
return NULL; return nullptr;
} }
// Updates liveness for a particular operand based on the given // Updates liveness for a particular operand based on the given
...@@ -369,7 +369,7 @@ Inst *InstPhi::lower(Cfg *Func) { ...@@ -369,7 +369,7 @@ Inst *InstPhi::lower(Cfg *Func) {
} }
InstRet::InstRet(Cfg *Func, Operand *RetValue) InstRet::InstRet(Cfg *Func, Operand *RetValue)
: InstHighLevel(Func, Ret, RetValue ? 1 : 0, NULL) { : InstHighLevel(Func, Ret, RetValue ? 1 : 0, nullptr) {
if (RetValue) if (RetValue)
addSource(RetValue); addSource(RetValue);
} }
...@@ -384,14 +384,14 @@ InstSelect::InstSelect(Cfg *Func, Variable *Dest, Operand *Condition, ...@@ -384,14 +384,14 @@ InstSelect::InstSelect(Cfg *Func, Variable *Dest, Operand *Condition,
} }
InstStore::InstStore(Cfg *Func, Operand *Data, Operand *Addr) InstStore::InstStore(Cfg *Func, Operand *Data, Operand *Addr)
: InstHighLevel(Func, Inst::Store, 2, NULL) { : InstHighLevel(Func, Inst::Store, 2, nullptr) {
addSource(Data); addSource(Data);
addSource(Addr); addSource(Addr);
} }
InstSwitch::InstSwitch(Cfg *Func, SizeT NumCases, Operand *Source, InstSwitch::InstSwitch(Cfg *Func, SizeT NumCases, Operand *Source,
CfgNode *LabelDefault) CfgNode *LabelDefault)
: InstHighLevel(Func, Inst::Switch, 1, NULL), LabelDefault(LabelDefault), : InstHighLevel(Func, Inst::Switch, 1, nullptr), LabelDefault(LabelDefault),
NumCases(NumCases) { NumCases(NumCases) {
addSource(Source); addSource(Source);
Values = Func->allocateArrayOf<uint64_t>(NumCases); Values = Func->allocateArrayOf<uint64_t>(NumCases);
...@@ -399,7 +399,7 @@ InstSwitch::InstSwitch(Cfg *Func, SizeT NumCases, Operand *Source, ...@@ -399,7 +399,7 @@ InstSwitch::InstSwitch(Cfg *Func, SizeT NumCases, Operand *Source,
// Initialize in case buggy code doesn't set all entries // Initialize in case buggy code doesn't set all entries
for (SizeT I = 0; I < NumCases; ++I) { for (SizeT I = 0; I < NumCases; ++I) {
Values[I] = 0; Values[I] = 0;
Labels[I] = NULL; Labels[I] = nullptr;
} }
} }
...@@ -434,7 +434,7 @@ bool InstSwitch::repointEdge(CfgNode *OldNode, CfgNode *NewNode) { ...@@ -434,7 +434,7 @@ bool InstSwitch::repointEdge(CfgNode *OldNode, CfgNode *NewNode) {
} }
InstUnreachable::InstUnreachable(Cfg *Func) InstUnreachable::InstUnreachable(Cfg *Func)
: InstHighLevel(Func, Inst::Unreachable, 0, NULL) {} : InstHighLevel(Func, Inst::Unreachable, 0, nullptr) {}
InstFakeDef::InstFakeDef(Cfg *Func, Variable *Dest, Variable *Src) InstFakeDef::InstFakeDef(Cfg *Func, Variable *Dest, Variable *Src)
: InstHighLevel(Func, Inst::FakeDef, Src ? 1 : 0, Dest) { : InstHighLevel(Func, Inst::FakeDef, Src ? 1 : 0, Dest) {
...@@ -444,16 +444,16 @@ InstFakeDef::InstFakeDef(Cfg *Func, Variable *Dest, Variable *Src) ...@@ -444,16 +444,16 @@ InstFakeDef::InstFakeDef(Cfg *Func, Variable *Dest, Variable *Src)
} }
InstFakeUse::InstFakeUse(Cfg *Func, Variable *Src) InstFakeUse::InstFakeUse(Cfg *Func, Variable *Src)
: InstHighLevel(Func, Inst::FakeUse, 1, NULL) { : InstHighLevel(Func, Inst::FakeUse, 1, nullptr) {
assert(Src); assert(Src);
addSource(Src); addSource(Src);
} }
InstFakeKill::InstFakeKill(Cfg *Func, const Inst *Linked) InstFakeKill::InstFakeKill(Cfg *Func, const Inst *Linked)
: InstHighLevel(Func, Inst::FakeKill, 0, NULL), Linked(Linked) {} : InstHighLevel(Func, Inst::FakeKill, 0, nullptr), Linked(Linked) {}
Type InstCall::getReturnType() const { Type InstCall::getReturnType() const {
if (Dest == NULL) if (Dest == nullptr)
return IceType_void; return IceType_void;
return Dest->getType(); return Dest->getType();
} }
......
...@@ -321,7 +321,7 @@ public: ...@@ -321,7 +321,7 @@ public:
static InstBr *create(Cfg *Func, CfgNode *Target) { static InstBr *create(Cfg *Func, CfgNode *Target) {
return new (Func->allocate<InstBr>()) InstBr(Func, Target); return new (Func->allocate<InstBr>()) InstBr(Func, Target);
} }
bool isUnconditional() const { return getTargetTrue() == NULL; } bool isUnconditional() const { return getTargetTrue() == nullptr; }
Operand *getCondition() const { Operand *getCondition() const {
assert(!isUnconditional()); assert(!isUnconditional());
return getSrc(0); return getSrc(0);
...@@ -346,7 +346,7 @@ private: ...@@ -346,7 +346,7 @@ private:
~InstBr() override {} ~InstBr() override {}
CfgNode *TargetFalse; // Doubles as unconditional branch target CfgNode *TargetFalse; // Doubles as unconditional branch target
CfgNode *TargetTrue; // NULL if unconditional branch CfgNode *TargetTrue; // nullptr if unconditional branch
}; };
// Call instruction. The call target is captured as getSrc(0), and // Call instruction. The call target is captured as getSrc(0), and
...@@ -615,7 +615,7 @@ class InstRet : public InstHighLevel { ...@@ -615,7 +615,7 @@ class InstRet : public InstHighLevel {
InstRet &operator=(const InstRet &) = delete; InstRet &operator=(const InstRet &) = delete;
public: public:
static InstRet *create(Cfg *Func, Operand *RetValue = NULL) { static InstRet *create(Cfg *Func, Operand *RetValue = nullptr) {
return new (Func->allocate<InstRet>()) InstRet(Func, RetValue); return new (Func->allocate<InstRet>()) InstRet(Func, RetValue);
} }
bool hasRetValue() const { return getSrcSize(); } bool hasRetValue() const { return getSrcSize(); }
...@@ -760,7 +760,8 @@ class InstFakeDef : public InstHighLevel { ...@@ -760,7 +760,8 @@ class InstFakeDef : public InstHighLevel {
InstFakeDef &operator=(const InstFakeDef &) = delete; InstFakeDef &operator=(const InstFakeDef &) = delete;
public: public:
static InstFakeDef *create(Cfg *Func, Variable *Dest, Variable *Src = NULL) { static InstFakeDef *create(Cfg *Func, Variable *Dest,
Variable *Src = nullptr) {
return new (Func->allocate<InstFakeDef>()) InstFakeDef(Func, Dest, Src); return new (Func->allocate<InstFakeDef>()) InstFakeDef(Func, Dest, Src);
} }
void emit(const Cfg *Func) const override; void emit(const Cfg *Func) const override;
......
...@@ -90,7 +90,7 @@ OperandX8632Mem::OperandX8632Mem(Cfg *Func, Type Ty, Variable *Base, ...@@ -90,7 +90,7 @@ OperandX8632Mem::OperandX8632Mem(Cfg *Func, Type Ty, Variable *Base,
: OperandX8632(kMem, Ty), Base(Base), Offset(Offset), Index(Index), : OperandX8632(kMem, Ty), Base(Base), Offset(Offset), Index(Index),
Shift(Shift), SegmentReg(SegmentReg) { Shift(Shift), SegmentReg(SegmentReg) {
assert(Shift <= 3); assert(Shift <= 3);
Vars = NULL; Vars = nullptr;
NumVars = 0; NumVars = 0;
if (Base) if (Base)
++NumVars; ++NumVars;
...@@ -137,7 +137,7 @@ InstX8632Shrd::InstX8632Shrd(Cfg *Func, Variable *Dest, Variable *Source1, ...@@ -137,7 +137,7 @@ InstX8632Shrd::InstX8632Shrd(Cfg *Func, Variable *Dest, Variable *Source1,
} }
InstX8632Label::InstX8632Label(Cfg *Func, TargetX8632 *Target) InstX8632Label::InstX8632Label(Cfg *Func, TargetX8632 *Target)
: InstX8632(Func, InstX8632::Label, 0, NULL), : InstX8632(Func, InstX8632::Label, 0, nullptr),
Number(Target->makeNextLabelNumber()) {} Number(Target->makeNextLabelNumber()) {}
IceString InstX8632Label::getName(const Cfg *Func) const { IceString InstX8632Label::getName(const Cfg *Func) const {
...@@ -147,13 +147,13 @@ IceString InstX8632Label::getName(const Cfg *Func) const { ...@@ -147,13 +147,13 @@ IceString InstX8632Label::getName(const Cfg *Func) const {
InstX8632Br::InstX8632Br(Cfg *Func, const CfgNode *TargetTrue, InstX8632Br::InstX8632Br(Cfg *Func, const CfgNode *TargetTrue,
const CfgNode *TargetFalse, const CfgNode *TargetFalse,
const InstX8632Label *Label, CondX86::BrCond Condition) const InstX8632Label *Label, CondX86::BrCond Condition)
: InstX8632(Func, InstX8632::Br, 0, NULL), Condition(Condition), : InstX8632(Func, InstX8632::Br, 0, nullptr), Condition(Condition),
TargetTrue(TargetTrue), TargetFalse(TargetFalse), Label(Label) {} TargetTrue(TargetTrue), TargetFalse(TargetFalse), Label(Label) {}
bool InstX8632Br::optimizeBranch(const CfgNode *NextNode) { bool InstX8632Br::optimizeBranch(const CfgNode *NextNode) {
// If there is no next block, then there can be no fallthrough to // If there is no next block, then there can be no fallthrough to
// optimize. // optimize.
if (NextNode == NULL) if (NextNode == nullptr)
return false; return false;
// Intra-block conditional branches can't be optimized. // Intra-block conditional branches can't be optimized.
if (Label) if (Label)
...@@ -161,29 +161,29 @@ bool InstX8632Br::optimizeBranch(const CfgNode *NextNode) { ...@@ -161,29 +161,29 @@ bool InstX8632Br::optimizeBranch(const CfgNode *NextNode) {
// If there is no fallthrough node, such as a non-default case label // If there is no fallthrough node, such as a non-default case label
// for a switch instruction, then there is no opportunity to // for a switch instruction, then there is no opportunity to
// optimize. // optimize.
if (getTargetFalse() == NULL) if (getTargetFalse() == nullptr)
return false; return false;
// Unconditional branch to the next node can be removed. // Unconditional branch to the next node can be removed.
if (Condition == CondX86::Br_None && getTargetFalse() == NextNode) { if (Condition == CondX86::Br_None && getTargetFalse() == NextNode) {
assert(getTargetTrue() == NULL); assert(getTargetTrue() == nullptr);
setDeleted(); setDeleted();
return true; return true;
} }
// If the fallthrough is to the next node, set fallthrough to NULL // If the fallthrough is to the next node, set fallthrough to nullptr
// to indicate. // to indicate.
if (getTargetFalse() == NextNode) { if (getTargetFalse() == NextNode) {
TargetFalse = NULL; TargetFalse = nullptr;
return true; return true;
} }
// If TargetTrue is the next node, and TargetFalse is non-NULL // If TargetTrue is the next node, and TargetFalse is not nullptr
// (which was already tested above), then invert the branch // (which was already tested above), then invert the branch
// condition, swap the targets, and set new fallthrough to NULL. // condition, swap the targets, and set new fallthrough to nullptr.
if (getTargetTrue() == NextNode) { if (getTargetTrue() == NextNode) {
assert(Condition != CondX86::Br_None); assert(Condition != CondX86::Br_None);
Condition = InstX8632BrAttributes[Condition].Opposite; Condition = InstX8632BrAttributes[Condition].Opposite;
TargetTrue = getTargetFalse(); TargetTrue = getTargetFalse();
TargetFalse = NULL; TargetFalse = nullptr;
return true; return true;
} }
return false; return false;
...@@ -237,7 +237,7 @@ InstX8632Cmpxchg8b::InstX8632Cmpxchg8b(Cfg *Func, OperandX8632Mem *Addr, ...@@ -237,7 +237,7 @@ InstX8632Cmpxchg8b::InstX8632Cmpxchg8b(Cfg *Func, OperandX8632Mem *Addr,
Variable *Edx, Variable *Eax, Variable *Edx, Variable *Eax,
Variable *Ecx, Variable *Ebx, Variable *Ecx, Variable *Ebx,
bool Locked) bool Locked)
: InstX8632Lockable(Func, InstX8632::Cmpxchg, 5, NULL, Locked) { : InstX8632Lockable(Func, InstX8632::Cmpxchg, 5, nullptr, Locked) {
assert(Edx->getRegNum() == RegX8632::Reg_edx); assert(Edx->getRegNum() == RegX8632::Reg_edx);
assert(Eax->getRegNum() == RegX8632::Reg_eax); assert(Eax->getRegNum() == RegX8632::Reg_eax);
assert(Ecx->getRegNum() == RegX8632::Reg_ecx); assert(Ecx->getRegNum() == RegX8632::Reg_ecx);
...@@ -256,56 +256,56 @@ InstX8632Cvt::InstX8632Cvt(Cfg *Func, Variable *Dest, Operand *Source, ...@@ -256,56 +256,56 @@ InstX8632Cvt::InstX8632Cvt(Cfg *Func, Variable *Dest, Operand *Source,
} }
InstX8632Icmp::InstX8632Icmp(Cfg *Func, Operand *Src0, Operand *Src1) InstX8632Icmp::InstX8632Icmp(Cfg *Func, Operand *Src0, Operand *Src1)
: InstX8632(Func, InstX8632::Icmp, 2, NULL) { : InstX8632(Func, InstX8632::Icmp, 2, nullptr) {
addSource(Src0); addSource(Src0);
addSource(Src1); addSource(Src1);
} }
InstX8632Ucomiss::InstX8632Ucomiss(Cfg *Func, Operand *Src0, Operand *Src1) InstX8632Ucomiss::InstX8632Ucomiss(Cfg *Func, Operand *Src0, Operand *Src1)
: InstX8632(Func, InstX8632::Ucomiss, 2, NULL) { : InstX8632(Func, InstX8632::Ucomiss, 2, nullptr) {
addSource(Src0); addSource(Src0);
addSource(Src1); addSource(Src1);
} }
InstX8632UD2::InstX8632UD2(Cfg *Func) InstX8632UD2::InstX8632UD2(Cfg *Func)
: InstX8632(Func, InstX8632::UD2, 0, NULL) {} : InstX8632(Func, InstX8632::UD2, 0, nullptr) {}
InstX8632Test::InstX8632Test(Cfg *Func, Operand *Src1, Operand *Src2) InstX8632Test::InstX8632Test(Cfg *Func, Operand *Src1, Operand *Src2)
: InstX8632(Func, InstX8632::Test, 2, NULL) { : InstX8632(Func, InstX8632::Test, 2, nullptr) {
addSource(Src1); addSource(Src1);
addSource(Src2); addSource(Src2);
} }
InstX8632Mfence::InstX8632Mfence(Cfg *Func) InstX8632Mfence::InstX8632Mfence(Cfg *Func)
: InstX8632(Func, InstX8632::Mfence, 0, NULL) { : InstX8632(Func, InstX8632::Mfence, 0, nullptr) {
HasSideEffects = true; HasSideEffects = true;
} }
InstX8632Store::InstX8632Store(Cfg *Func, Operand *Value, OperandX8632 *Mem) InstX8632Store::InstX8632Store(Cfg *Func, Operand *Value, OperandX8632 *Mem)
: InstX8632(Func, InstX8632::Store, 2, NULL) { : InstX8632(Func, InstX8632::Store, 2, nullptr) {
addSource(Value); addSource(Value);
addSource(Mem); addSource(Mem);
} }
InstX8632StoreP::InstX8632StoreP(Cfg *Func, Variable *Value, InstX8632StoreP::InstX8632StoreP(Cfg *Func, Variable *Value,
OperandX8632Mem *Mem) OperandX8632Mem *Mem)
: InstX8632(Func, InstX8632::StoreP, 2, NULL) { : InstX8632(Func, InstX8632::StoreP, 2, nullptr) {
addSource(Value); addSource(Value);
addSource(Mem); addSource(Mem);
} }
InstX8632StoreQ::InstX8632StoreQ(Cfg *Func, Variable *Value, InstX8632StoreQ::InstX8632StoreQ(Cfg *Func, Variable *Value,
OperandX8632Mem *Mem) OperandX8632Mem *Mem)
: InstX8632(Func, InstX8632::StoreQ, 2, NULL) { : InstX8632(Func, InstX8632::StoreQ, 2, nullptr) {
addSource(Value); addSource(Value);
addSource(Mem); addSource(Mem);
} }
InstX8632Nop::InstX8632Nop(Cfg *Func, InstX8632Nop::NopVariant Variant) InstX8632Nop::InstX8632Nop(Cfg *Func, InstX8632Nop::NopVariant Variant)
: InstX8632(Func, InstX8632::Nop, 0, NULL), Variant(Variant) {} : InstX8632(Func, InstX8632::Nop, 0, nullptr), Variant(Variant) {}
InstX8632Fld::InstX8632Fld(Cfg *Func, Operand *Src) InstX8632Fld::InstX8632Fld(Cfg *Func, Operand *Src)
: InstX8632(Func, InstX8632::Fld, 1, NULL) { : InstX8632(Func, InstX8632::Fld, 1, nullptr) {
addSource(Src); addSource(Src);
} }
...@@ -316,12 +316,12 @@ InstX8632Pop::InstX8632Pop(Cfg *Func, Variable *Dest) ...@@ -316,12 +316,12 @@ InstX8632Pop::InstX8632Pop(Cfg *Func, Variable *Dest)
: InstX8632(Func, InstX8632::Pop, 0, Dest) {} : InstX8632(Func, InstX8632::Pop, 0, Dest) {}
InstX8632Push::InstX8632Push(Cfg *Func, Variable *Source) InstX8632Push::InstX8632Push(Cfg *Func, Variable *Source)
: InstX8632(Func, InstX8632::Push, 1, NULL) { : InstX8632(Func, InstX8632::Push, 1, nullptr) {
addSource(Source); addSource(Source);
} }
InstX8632Ret::InstX8632Ret(Cfg *Func, Variable *Source) InstX8632Ret::InstX8632Ret(Cfg *Func, Variable *Source)
: InstX8632(Func, InstX8632::Ret, Source ? 1 : 0, NULL) { : InstX8632(Func, InstX8632::Ret, Source ? 1 : 0, nullptr) {
if (Source) if (Source)
addSource(Source); addSource(Source);
} }
......
...@@ -67,7 +67,7 @@ public: ...@@ -67,7 +67,7 @@ public:
SegReg_NUM SegReg_NUM
}; };
static OperandX8632Mem *create(Cfg *Func, Type Ty, Variable *Base, static OperandX8632Mem *create(Cfg *Func, Type Ty, Variable *Base,
Constant *Offset, Variable *Index = NULL, Constant *Offset, Variable *Index = nullptr,
uint16_t Shift = 0, uint16_t Shift = 0,
SegmentRegisters SegmentReg = DefaultSegment) { SegmentRegisters SegmentReg = DefaultSegment) {
return new (Func->allocate<OperandX8632Mem>()) return new (Func->allocate<OperandX8632Mem>())
...@@ -165,7 +165,7 @@ public: ...@@ -165,7 +165,7 @@ public:
// Inherit dump() and emit() from Variable. // Inherit dump() and emit() from Variable.
private: private:
SpillVariable(Type Ty, SizeT Index) SpillVariable(Type Ty, SizeT Index)
: Variable(SpillVariableKind, Ty, Index), LinkedTo(NULL) {} : Variable(SpillVariableKind, Ty, Index), LinkedTo(nullptr) {}
Variable *LinkedTo; Variable *LinkedTo;
}; };
...@@ -344,14 +344,14 @@ public: ...@@ -344,14 +344,14 @@ public:
static InstX8632Br *create(Cfg *Func, CfgNode *TargetTrue, static InstX8632Br *create(Cfg *Func, CfgNode *TargetTrue,
CfgNode *TargetFalse, CondX86::BrCond Condition) { CfgNode *TargetFalse, CondX86::BrCond Condition) {
assert(Condition != CondX86::Br_None); assert(Condition != CondX86::Br_None);
const InstX8632Label *NoLabel = NULL; const InstX8632Label *NoLabel = nullptr;
return new (Func->allocate<InstX8632Br>()) return new (Func->allocate<InstX8632Br>())
InstX8632Br(Func, TargetTrue, TargetFalse, NoLabel, Condition); InstX8632Br(Func, TargetTrue, TargetFalse, NoLabel, Condition);
} }
// Create an unconditional branch to a node. // Create an unconditional branch to a node.
static InstX8632Br *create(Cfg *Func, CfgNode *Target) { static InstX8632Br *create(Cfg *Func, CfgNode *Target) {
const CfgNode *NoCondTarget = NULL; const CfgNode *NoCondTarget = nullptr;
const InstX8632Label *NoLabel = NULL; const InstX8632Label *NoLabel = nullptr;
return new (Func->allocate<InstX8632Br>()) return new (Func->allocate<InstX8632Br>())
InstX8632Br(Func, NoCondTarget, Target, NoLabel, CondX86::Br_None); InstX8632Br(Func, NoCondTarget, Target, NoLabel, CondX86::Br_None);
} }
...@@ -361,8 +361,8 @@ public: ...@@ -361,8 +361,8 @@ public:
static InstX8632Br *create(Cfg *Func, CfgNode *Target, static InstX8632Br *create(Cfg *Func, CfgNode *Target,
CondX86::BrCond Condition) { CondX86::BrCond Condition) {
assert(Condition != CondX86::Br_None); assert(Condition != CondX86::Br_None);
const CfgNode *NoUncondTarget = NULL; const CfgNode *NoUncondTarget = nullptr;
const InstX8632Label *NoLabel = NULL; const InstX8632Label *NoLabel = nullptr;
return new (Func->allocate<InstX8632Br>()) return new (Func->allocate<InstX8632Br>())
InstX8632Br(Func, Target, NoUncondTarget, NoLabel, Condition); InstX8632Br(Func, Target, NoUncondTarget, NoLabel, Condition);
} }
...@@ -370,8 +370,8 @@ public: ...@@ -370,8 +370,8 @@ public:
// Condition==Br_None) to a label in the current block. // Condition==Br_None) to a label in the current block.
static InstX8632Br *create(Cfg *Func, InstX8632Label *Label, static InstX8632Br *create(Cfg *Func, InstX8632Label *Label,
CondX86::BrCond Condition) { CondX86::BrCond Condition) {
const CfgNode *NoCondTarget = NULL; const CfgNode *NoCondTarget = nullptr;
const CfgNode *NoUncondTarget = NULL; const CfgNode *NoUncondTarget = nullptr;
return new (Func->allocate<InstX8632Br>()) return new (Func->allocate<InstX8632Br>())
InstX8632Br(Func, NoCondTarget, NoUncondTarget, Label, Condition); InstX8632Br(Func, NoCondTarget, NoUncondTarget, Label, Condition);
} }
...@@ -1486,7 +1486,7 @@ class InstX8632Ret : public InstX8632 { ...@@ -1486,7 +1486,7 @@ class InstX8632Ret : public InstX8632 {
InstX8632Ret &operator=(const InstX8632Ret &) = delete; InstX8632Ret &operator=(const InstX8632Ret &) = delete;
public: public:
static InstX8632Ret *create(Cfg *Func, Variable *Source = NULL) { static InstX8632Ret *create(Cfg *Func, Variable *Source = nullptr) {
return new (Func->allocate<InstX8632Ret>()) InstX8632Ret(Func, Source); return new (Func->allocate<InstX8632Ret>()) InstX8632Ret(Func, Source);
} }
void emit(const Cfg *Func) const override; void emit(const Cfg *Func) const override;
......
...@@ -217,7 +217,7 @@ const Intrinsics::FullIntrinsicInfo * ...@@ -217,7 +217,7 @@ const Intrinsics::FullIntrinsicInfo *
Intrinsics::find(const IceString &Name) const { Intrinsics::find(const IceString &Name) const {
auto it = Map.find(Name); auto it = Map.find(Name);
if (it == Map.end()) if (it == Map.end())
return NULL; return nullptr;
return &it->second; return &it->second;
} }
...@@ -231,7 +231,7 @@ Intrinsics::FullIntrinsicInfo::validateCall(const Ice::InstCall *Call, ...@@ -231,7 +231,7 @@ Intrinsics::FullIntrinsicInfo::validateCall(const Ice::InstCall *Call,
SizeT &ArgIndex) const { SizeT &ArgIndex) const {
assert(NumTypes >= 1); assert(NumTypes >= 1);
Variable *Result = Call->getDest(); Variable *Result = Call->getDest();
if (Result == NULL) { if (Result == nullptr) {
if (Signature[0] != Ice::IceType_void) if (Signature[0] != Ice::IceType_void)
return Intrinsics::BadReturnType; return Intrinsics::BadReturnType;
} else if (Signature[0] != Result->getType()) { } else if (Signature[0] != Result->getType()) {
......
...@@ -51,11 +51,11 @@ void Liveness::init() { ...@@ -51,11 +51,11 @@ void Liveness::init() {
// Resize each LivenessNode::LiveToVarMap, and the global // Resize each LivenessNode::LiveToVarMap, and the global
// LiveToVarMap. Reset the counts to 0. // LiveToVarMap. Reset the counts to 0.
for (SizeT i = 0; i < NumNodes; ++i) { for (SizeT i = 0; i < NumNodes; ++i) {
Nodes[i].LiveToVarMap.assign(Nodes[i].NumLocals, NULL); Nodes[i].LiveToVarMap.assign(Nodes[i].NumLocals, nullptr);
Nodes[i].NumLocals = 0; Nodes[i].NumLocals = 0;
Nodes[i].NumNonDeadPhis = 0; Nodes[i].NumNonDeadPhis = 0;
} }
LiveToVarMap.assign(NumGlobals, NULL); LiveToVarMap.assign(NumGlobals, nullptr);
// Sort each variable into the appropriate LiveToVarMap. Also set // Sort each variable into the appropriate LiveToVarMap. Also set
// VarToLiveMap. // VarToLiveMap.
......
...@@ -179,7 +179,7 @@ void VariableTracking::markUse(MetadataKind TrackingKind, const Inst *Instr, ...@@ -179,7 +179,7 @@ void VariableTracking::markUse(MetadataKind TrackingKind, const Inst *Instr,
if (MakeMulti) { if (MakeMulti) {
MultiBlock = MBS_MultiBlock; MultiBlock = MBS_MultiBlock;
SingleUseNode = NULL; SingleUseNode = nullptr;
} }
} }
...@@ -195,7 +195,7 @@ void VariableTracking::markDef(MetadataKind TrackingKind, const Inst *Instr, ...@@ -195,7 +195,7 @@ void VariableTracking::markDef(MetadataKind TrackingKind, const Inst *Instr,
if (TrackingKind == VMK_All) { if (TrackingKind == VMK_All) {
const Inst *LastInstruction = const Inst *LastInstruction =
Definitions.empty() ? FirstOrSingleDefinition : Definitions.back(); Definitions.empty() ? FirstOrSingleDefinition : Definitions.back();
assert(LastInstruction == NULL || assert(LastInstruction == nullptr ||
Instr->getNumber() >= LastInstruction->getNumber()); Instr->getNumber() >= LastInstruction->getNumber());
} }
#endif #endif
...@@ -204,13 +204,13 @@ void VariableTracking::markDef(MetadataKind TrackingKind, const Inst *Instr, ...@@ -204,13 +204,13 @@ void VariableTracking::markDef(MetadataKind TrackingKind, const Inst *Instr,
markUse(TrackingKind, Instr, Node, IsFromDef, IsImplicit); markUse(TrackingKind, Instr, Node, IsFromDef, IsImplicit);
if (TrackingKind == VMK_Uses) if (TrackingKind == VMK_Uses)
return; return;
if (FirstOrSingleDefinition == NULL) if (FirstOrSingleDefinition == nullptr)
FirstOrSingleDefinition = Instr; FirstOrSingleDefinition = Instr;
else if (TrackingKind == VMK_All) else if (TrackingKind == VMK_All)
Definitions.push_back(Instr); Definitions.push_back(Instr);
switch (MultiDef) { switch (MultiDef) {
case MDS_Unknown: case MDS_Unknown:
assert(SingleDefNode == NULL); assert(SingleDefNode == nullptr);
MultiDef = MDS_SingleDef; MultiDef = MDS_SingleDef;
SingleDefNode = Node; SingleDefNode = Node;
break; break;
...@@ -220,18 +220,18 @@ void VariableTracking::markDef(MetadataKind TrackingKind, const Inst *Instr, ...@@ -220,18 +220,18 @@ void VariableTracking::markDef(MetadataKind TrackingKind, const Inst *Instr,
MultiDef = MDS_MultiDefSingleBlock; MultiDef = MDS_MultiDefSingleBlock;
} else { } else {
MultiDef = MDS_MultiDefMultiBlock; MultiDef = MDS_MultiDefMultiBlock;
SingleDefNode = NULL; SingleDefNode = nullptr;
} }
break; break;
case MDS_MultiDefSingleBlock: case MDS_MultiDefSingleBlock:
assert(SingleDefNode); assert(SingleDefNode);
if (Node != SingleDefNode) { if (Node != SingleDefNode) {
MultiDef = MDS_MultiDefMultiBlock; MultiDef = MDS_MultiDefMultiBlock;
SingleDefNode = NULL; SingleDefNode = nullptr;
} }
break; break;
case MDS_MultiDefMultiBlock: case MDS_MultiDefMultiBlock:
assert(SingleDefNode == NULL); assert(SingleDefNode == nullptr);
break; break;
} }
} }
...@@ -240,13 +240,13 @@ const Inst *VariableTracking::getFirstDefinition() const { ...@@ -240,13 +240,13 @@ const Inst *VariableTracking::getFirstDefinition() const {
switch (MultiDef) { switch (MultiDef) {
case MDS_Unknown: case MDS_Unknown:
case MDS_MultiDefMultiBlock: case MDS_MultiDefMultiBlock:
return NULL; return nullptr;
case MDS_SingleDef: case MDS_SingleDef:
case MDS_MultiDefSingleBlock: case MDS_MultiDefSingleBlock:
assert(FirstOrSingleDefinition); assert(FirstOrSingleDefinition);
return FirstOrSingleDefinition; return FirstOrSingleDefinition;
} }
return NULL; return nullptr;
} }
const Inst *VariableTracking::getSingleDefinition() const { const Inst *VariableTracking::getSingleDefinition() const {
...@@ -254,12 +254,12 @@ const Inst *VariableTracking::getSingleDefinition() const { ...@@ -254,12 +254,12 @@ const Inst *VariableTracking::getSingleDefinition() const {
case MDS_Unknown: case MDS_Unknown:
case MDS_MultiDefMultiBlock: case MDS_MultiDefMultiBlock:
case MDS_MultiDefSingleBlock: case MDS_MultiDefSingleBlock:
return NULL; return nullptr;
case MDS_SingleDef: case MDS_SingleDef:
assert(FirstOrSingleDefinition); assert(FirstOrSingleDefinition);
return FirstOrSingleDefinition; return FirstOrSingleDefinition;
} }
return NULL; return nullptr;
} }
void VariablesMetadata::init(MetadataKind TrackingKind) { void VariablesMetadata::init(MetadataKind TrackingKind) {
...@@ -270,7 +270,7 @@ void VariablesMetadata::init(MetadataKind TrackingKind) { ...@@ -270,7 +270,7 @@ void VariablesMetadata::init(MetadataKind TrackingKind) {
// Mark implicit args as being used in the entry node. // Mark implicit args as being used in the entry node.
for (Variable *Var : Func->getImplicitArgs()) { for (Variable *Var : Func->getImplicitArgs()) {
const Inst *NoInst = NULL; const Inst *NoInst = nullptr;
const CfgNode *EntryNode = Func->getEntryNode(); const CfgNode *EntryNode = Func->getEntryNode();
const bool IsFromDef = false; const bool IsFromDef = false;
const bool IsImplicit = true; const bool IsImplicit = true;
...@@ -356,7 +356,7 @@ bool VariablesMetadata::isMultiBlock(const Variable *Var) const { ...@@ -356,7 +356,7 @@ bool VariablesMetadata::isMultiBlock(const Variable *Var) const {
const Inst *VariablesMetadata::getFirstDefinition(const Variable *Var) const { const Inst *VariablesMetadata::getFirstDefinition(const Variable *Var) const {
assert(Kind != VMK_Uses); assert(Kind != VMK_Uses);
if (!isTracked(Var)) if (!isTracked(Var))
return NULL; // conservative answer return nullptr; // conservative answer
SizeT VarNum = Var->getIndex(); SizeT VarNum = Var->getIndex();
return Metadata[VarNum].getFirstDefinition(); return Metadata[VarNum].getFirstDefinition();
} }
...@@ -364,7 +364,7 @@ const Inst *VariablesMetadata::getFirstDefinition(const Variable *Var) const { ...@@ -364,7 +364,7 @@ const Inst *VariablesMetadata::getFirstDefinition(const Variable *Var) const {
const Inst *VariablesMetadata::getSingleDefinition(const Variable *Var) const { const Inst *VariablesMetadata::getSingleDefinition(const Variable *Var) const {
assert(Kind != VMK_Uses); assert(Kind != VMK_Uses);
if (!isTracked(Var)) if (!isTracked(Var))
return NULL; // conservative answer return nullptr; // conservative answer
SizeT VarNum = Var->getIndex(); SizeT VarNum = Var->getIndex();
return Metadata[VarNum].getSingleDefinition(); return Metadata[VarNum].getSingleDefinition();
} }
...@@ -380,7 +380,7 @@ VariablesMetadata::getLatterDefinitions(const Variable *Var) const { ...@@ -380,7 +380,7 @@ VariablesMetadata::getLatterDefinitions(const Variable *Var) const {
const CfgNode *VariablesMetadata::getLocalUseNode(const Variable *Var) const { const CfgNode *VariablesMetadata::getLocalUseNode(const Variable *Var) const {
if (!isTracked(Var)) if (!isTracked(Var))
return NULL; // conservative answer return nullptr; // conservative answer
SizeT VarNum = Var->getIndex(); SizeT VarNum = Var->getIndex();
return Metadata[VarNum].getNode(); return Metadata[VarNum].getNode();
} }
...@@ -397,7 +397,7 @@ void Variable::emit(const Cfg *Func) const { ...@@ -397,7 +397,7 @@ void Variable::emit(const Cfg *Func) const {
void Variable::dump(const Cfg *Func, Ostream &Str) const { void Variable::dump(const Cfg *Func, Ostream &Str) const {
if (!ALLOW_DUMP) if (!ALLOW_DUMP)
return; return;
if (Func == NULL) { if (Func == nullptr) {
Str << "%" << getName(Func); Str << "%" << getName(Func);
return; return;
} }
......
...@@ -62,7 +62,7 @@ public: ...@@ -62,7 +62,7 @@ public:
} }
virtual void emit(const Cfg *Func) const = 0; virtual void emit(const Cfg *Func) const = 0;
// The dump(Func,Str) implementation must be sure to handle the // The dump(Func,Str) implementation must be sure to handle the
// situation where Func==NULL. // situation where Func==nullptr.
virtual void dump(const Cfg *Func, Ostream &Str) const = 0; virtual void dump(const Cfg *Func, Ostream &Str) const = 0;
void dump(const Cfg *Func) const { void dump(const Cfg *Func) const {
if (!ALLOW_DUMP) if (!ALLOW_DUMP)
...@@ -72,7 +72,7 @@ public: ...@@ -72,7 +72,7 @@ public:
} }
void dump(Ostream &Str) const { void dump(Ostream &Str) const {
if (ALLOW_DUMP) if (ALLOW_DUMP)
dump(NULL, Str); dump(nullptr, Str);
} }
// Query whether this object was allocated in isolation, or added to // Query whether this object was allocated in isolation, or added to
...@@ -86,7 +86,7 @@ public: ...@@ -86,7 +86,7 @@ public:
protected: protected:
Operand(OperandKind Kind, Type Ty) Operand(OperandKind Kind, Type Ty)
: Ty(Ty), Kind(Kind), NumVars(0), Vars(NULL) {} : Ty(Ty), Kind(Kind), NumVars(0), Vars(nullptr) {}
const Type Ty; const Type Ty;
const OperandKind Kind; const OperandKind Kind;
...@@ -122,7 +122,7 @@ public: ...@@ -122,7 +122,7 @@ public:
protected: protected:
Constant(OperandKind Kind, Type Ty, uint32_t PoolEntryID) Constant(OperandKind Kind, Type Ty, uint32_t PoolEntryID)
: Operand(Kind, Ty), PoolEntryID(PoolEntryID) { : Operand(Kind, Ty), PoolEntryID(PoolEntryID) {
Vars = NULL; Vars = nullptr;
NumVars = 0; NumVars = 0;
} }
~Constant() override {} ~Constant() override {}
...@@ -457,8 +457,8 @@ public: ...@@ -457,8 +457,8 @@ public:
Variable *getLo() const { return LoVar; } Variable *getLo() const { return LoVar; }
Variable *getHi() const { return HiVar; } Variable *getHi() const { return HiVar; }
void setLoHi(Variable *Lo, Variable *Hi) { void setLoHi(Variable *Lo, Variable *Hi) {
assert(LoVar == NULL); assert(LoVar == nullptr);
assert(HiVar == NULL); assert(HiVar == nullptr);
LoVar = Lo; LoVar = Lo;
HiVar = Hi; HiVar = Hi;
} }
...@@ -483,7 +483,7 @@ protected: ...@@ -483,7 +483,7 @@ protected:
: Operand(K, Ty), Number(Index), NameIndex(Cfg::IdentifierIndexInvalid), : Operand(K, Ty), Number(Index), NameIndex(Cfg::IdentifierIndexInvalid),
IsArgument(false), IsImplicitArgument(false), IgnoreLiveness(false), IsArgument(false), IsImplicitArgument(false), IgnoreLiveness(false),
StackOffset(0), RegNum(NoRegister), RegNumTmp(NoRegister), Weight(1), StackOffset(0), RegNum(NoRegister), RegNumTmp(NoRegister), Weight(1),
LoVar(NULL), HiVar(NULL) { LoVar(nullptr), HiVar(nullptr) {
Vars = VarsReal; Vars = VarsReal;
Vars[0] = this; Vars[0] = this;
NumVars = 1; NumVars = 1;
...@@ -550,8 +550,8 @@ public: ...@@ -550,8 +550,8 @@ public:
MBS_MultiBlock MBS_MultiBlock
}; };
VariableTracking() VariableTracking()
: MultiDef(MDS_Unknown), MultiBlock(MBS_Unknown), SingleUseNode(NULL), : MultiDef(MDS_Unknown), MultiBlock(MBS_Unknown), SingleUseNode(nullptr),
SingleDefNode(NULL), FirstOrSingleDefinition(NULL) {} SingleDefNode(nullptr), FirstOrSingleDefinition(nullptr) {}
MultiDefState getMultiDef() const { return MultiDef; } MultiDefState getMultiDef() const { return MultiDef; }
MultiBlockState getMultiBlock() const { return MultiBlock; } MultiBlockState getMultiBlock() const { return MultiBlock; }
const Inst *getFirstDefinition() const; const Inst *getFirstDefinition() const;
...@@ -603,10 +603,10 @@ public: ...@@ -603,10 +603,10 @@ public:
// the same block, e.g. T after the lowered sequence "T=B; T+=C; // the same block, e.g. T after the lowered sequence "T=B; T+=C;
// A=T", for which getFirstDefinition(T) would return the "T=B" // A=T", for which getFirstDefinition(T) would return the "T=B"
// instruction. For variables with definitions span multiple // instruction. For variables with definitions span multiple
// blocks, NULL is returned. // blocks, nullptr is returned.
const Inst *getFirstDefinition(const Variable *Var) const; const Inst *getFirstDefinition(const Variable *Var) const;
// Returns the definition instruction of the given Variable, when // Returns the definition instruction of the given Variable, when
// the variable has exactly one definition. Otherwise, NULL is // the variable has exactly one definition. Otherwise, nullptr is
// returned. // returned.
const Inst *getSingleDefinition(const Variable *Var) const; const Inst *getSingleDefinition(const Variable *Var) const;
// Returns the list of all definition instructions of the given // Returns the list of all definition instructions of the given
...@@ -622,7 +622,7 @@ public: ...@@ -622,7 +622,7 @@ public:
// entry block. // entry block.
bool isMultiBlock(const Variable *Var) const; bool isMultiBlock(const Variable *Var) const;
// Returns the node that the given Variable is used in, assuming // Returns the node that the given Variable is used in, assuming
// isMultiBlock() returns false. Otherwise, NULL is returned. // isMultiBlock() returns false. Otherwise, nullptr is returned.
const CfgNode *getLocalUseNode(const Variable *Var) const; const CfgNode *getLocalUseNode(const Variable *Var) const;
private: private:
......
...@@ -410,7 +410,7 @@ void LinearScan::scan(const llvm::SmallBitVector &RegMaskFull, ...@@ -410,7 +410,7 @@ void LinearScan::scan(const llvm::SmallBitVector &RegMaskFull,
// but is never modified. Furthermore, overlap is only allowed // but is never modified. Furthermore, overlap is only allowed
// when preferred Variable definition instructions do not appear // when preferred Variable definition instructions do not appear
// within the current Variable's live range. // within the current Variable's live range.
Variable *Prefer = NULL; Variable *Prefer = nullptr;
int32_t PreferReg = Variable::NoRegister; int32_t PreferReg = Variable::NoRegister;
bool AllowOverlap = false; bool AllowOverlap = false;
if (FindPreference) { if (FindPreference) {
......
...@@ -98,7 +98,7 @@ TargetLowering *TargetLowering::createLowering(TargetArch Target, Cfg *Func) { ...@@ -98,7 +98,7 @@ TargetLowering *TargetLowering::createLowering(TargetArch Target, Cfg *Func) {
return IceTargetARM64::create(Func); return IceTargetARM64::create(Func);
#endif #endif
Func->setError("Unsupported target"); Func->setError("Unsupported target");
return NULL; return nullptr;
} }
TargetLowering::TargetLowering(Cfg *Func) TargetLowering::TargetLowering(Cfg *Func)
...@@ -113,7 +113,7 @@ Assembler *TargetLowering::createAssembler(TargetArch Target, Cfg *Func) { ...@@ -113,7 +113,7 @@ Assembler *TargetLowering::createAssembler(TargetArch Target, Cfg *Func) {
if (Target == Target_X8632) if (Target == Target_X8632)
return new x86::AssemblerX86(); return new x86::AssemblerX86();
Func->setError("Unsupported target"); Func->setError("Unsupported target");
return NULL; return nullptr;
} }
void TargetLowering::doAddressOpt() { void TargetLowering::doAddressOpt() {
...@@ -267,7 +267,7 @@ TargetGlobalInitLowering::createLowering(TargetArch Target, ...@@ -267,7 +267,7 @@ TargetGlobalInitLowering::createLowering(TargetArch Target,
return IceTargetGlobalInitARM64::create(Ctx); return IceTargetGlobalInitARM64::create(Ctx);
#endif #endif
llvm_unreachable("Unsupported target"); llvm_unreachable("Unsupported target");
return NULL; return nullptr;
} }
TargetGlobalInitLowering::~TargetGlobalInitLowering() {} TargetGlobalInitLowering::~TargetGlobalInitLowering() {}
......
...@@ -37,18 +37,18 @@ class LoweringContext { ...@@ -37,18 +37,18 @@ class LoweringContext {
LoweringContext &operator=(const LoweringContext &) = delete; LoweringContext &operator=(const LoweringContext &) = delete;
public: public:
LoweringContext() : Node(NULL), LastInserted(NULL) {} LoweringContext() : Node(nullptr), LastInserted(nullptr) {}
~LoweringContext() {} ~LoweringContext() {}
void init(CfgNode *Node); void init(CfgNode *Node);
Inst *getNextInst() const { Inst *getNextInst() const {
if (Next == End) if (Next == End)
return NULL; return nullptr;
return Next; return Next;
} }
Inst *getNextInst(InstList::iterator &Iter) const { Inst *getNextInst(InstList::iterator &Iter) const {
advanceForward(Iter); advanceForward(Iter);
if (Iter == End) if (Iter == End)
return NULL; return nullptr;
return Iter; return Iter;
} }
CfgNode *getNode() const { return Node; } CfgNode *getNode() const { return Node; }
......
...@@ -292,12 +292,12 @@ protected: ...@@ -292,12 +292,12 @@ protected:
Context.insert(InstX8632Lea::create(Func, Dest, Src0)); Context.insert(InstX8632Lea::create(Func, Dest, Src0));
} }
void _mfence() { Context.insert(InstX8632Mfence::create(Func)); } void _mfence() { Context.insert(InstX8632Mfence::create(Func)); }
// If Dest=NULL is passed in, then a new variable is created, marked // If Dest=nullptr is passed in, then a new variable is created,
// as infinite register allocation weight, and returned through the // marked as infinite register allocation weight, and returned
// in/out Dest argument. // through the in/out Dest argument.
void _mov(Variable *&Dest, Operand *Src0, void _mov(Variable *&Dest, Operand *Src0,
int32_t RegNum = Variable::NoRegister) { int32_t RegNum = Variable::NoRegister) {
if (Dest == NULL) if (Dest == nullptr)
Dest = makeReg(Src0->getType(), RegNum); Dest = makeReg(Src0->getType(), RegNum);
Context.insert(InstX8632Mov::create(Func, Dest, Src0)); Context.insert(InstX8632Mov::create(Func, Dest, Src0));
} }
...@@ -396,7 +396,7 @@ protected: ...@@ -396,7 +396,7 @@ protected:
void _pxor(Variable *Dest, Operand *Src0) { void _pxor(Variable *Dest, Operand *Src0) {
Context.insert(InstX8632Pxor::create(Func, Dest, Src0)); Context.insert(InstX8632Pxor::create(Func, Dest, Src0));
} }
void _ret(Variable *Src0 = NULL) { void _ret(Variable *Src0 = nullptr) {
Context.insert(InstX8632Ret::create(Func, Src0)); Context.insert(InstX8632Ret::create(Func, Src0));
} }
void _rol(Variable *Dest, Operand *Src0) { void _rol(Variable *Dest, Operand *Src0) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment