Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(23)

Unified Diff: src/IceCfg.cpp

Issue 589003002: Subzero: Refactor tracking of Defs and block-local Variables. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: "Mark args as being used in the entry node" was unnecessary. Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/IceCfg.h ('k') | src/IceCfgNode.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceCfg.cpp
diff --git a/src/IceCfg.cpp b/src/IceCfg.cpp
index a08bebb31dbc86e66eea5777860e57b99e584791..e1255df54d30b635431b2ebb3f26026f1516de3e 100644
--- a/src/IceCfg.cpp
+++ b/src/IceCfg.cpp
@@ -28,7 +28,7 @@ Cfg::Cfg(GlobalContext *Ctx)
IsInternalLinkage(false), HasError(false), ErrorMessage(""), Entry(NULL),
NextInstNumber(1), Live(NULL),
Target(TargetLowering::createLowering(Ctx->getTargetArch(), this)),
- CurrentNode(NULL) {}
+ VMetadata(new VariablesMetadata(this)), CurrentNode(NULL) {}
Cfg::~Cfg() {}
@@ -45,16 +45,20 @@ CfgNode *Cfg::makeNode(const IceString &Name) {
return Node;
}
-Variable *Cfg::makeVariable(Type Ty, const CfgNode *Node,
- const IceString &Name) {
- return makeVariable<Variable>(Ty, Node, Name);
+Variable *Cfg::makeVariable(Type Ty, const IceString &Name) {
+ return makeVariable<Variable>(Ty, Name);
}
void Cfg::addArg(Variable *Arg) {
- Arg->setIsArg(this);
+ Arg->setIsArg();
Args.push_back(Arg);
}
+void Cfg::addImplicitArg(Variable *Arg) {
+ Arg->setIsImplicitArg();
+ ImplicitArgs.push_back(Arg);
+}
+
// Returns whether the stack frame layout has been computed yet. This
// is used for dumping the stack frame location of Variables.
bool Cfg::hasComputedFrame() const { return getTarget()->hasComputedFrame(); }
@@ -147,6 +151,7 @@ void Cfg::genFrame() {
// completely with a single block. It is a quick single pass and
// doesn't need to iterate until convergence.
void Cfg::livenessLightweight() {
+ getVMetadata()->init();
for (NodeList::iterator I = Nodes.begin(), E = Nodes.end(); I != E; ++I) {
(*I)->livenessLightweight();
}
@@ -154,6 +159,7 @@ void Cfg::livenessLightweight() {
void Cfg::liveness(LivenessMode Mode) {
Live.reset(new Liveness(this, Mode));
+ getVMetadata()->init();
Live->init();
// Initialize with all nodes needing to be processed.
llvm::BitVector NeedToProcess(Nodes.size(), true);
@@ -361,9 +367,12 @@ void Cfg::dump(const IceString &Message) {
for (VarList::const_iterator I = Variables.begin(), E = Variables.end();
I != E; ++I) {
Variable *Var = *I;
- Str << "//"
- << " multiblock=" << Var->isMultiblockLife() << " "
- << " weight=" << Var->getWeight() << " ";
+ Str << "// multiblock=";
+ if (getVMetadata()->isTracked(Var))
+ Str << getVMetadata()->isMultiBlock(Var);
+ else
+ Str << "?";
+ Str << " weight=" << Var->getWeight() << " ";
Var->dump(this);
if (Variable *Pref = Var->getPreferredRegister()) {
Str << " pref=";
« no previous file with comments | « src/IceCfg.h ('k') | src/IceCfgNode.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698