diff options
author | Dan Gohman <sunfish@mozilla.com> | 2014-03-04 15:05:27 -0800 |
---|---|---|
committer | Dan Gohman <sunfish@mozilla.com> | 2014-03-04 21:19:33 -0800 |
commit | b0180f577b7fd17af324781bfd2ab5b2d66cb204 (patch) | |
tree | 67edf13f89401d7f3f5d874bce0832449b475af0 /lib/Target/JSBackend/JSBackend.cpp | |
parent | b516d172312af1ff8efddfdf1f825897bd4ea9c6 (diff) |
Perform alloca coloring only at -O1 and higher.
Diffstat (limited to 'lib/Target/JSBackend/JSBackend.cpp')
-rw-r--r-- | lib/Target/JSBackend/JSBackend.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/Target/JSBackend/JSBackend.cpp b/lib/Target/JSBackend/JSBackend.cpp index b440980010..9bc1764042 100644 --- a/lib/Target/JSBackend/JSBackend.cpp +++ b/lib/Target/JSBackend/JSBackend.cpp @@ -139,13 +139,16 @@ namespace { bool UsesSIMD; int InvokeState; // cycles between 0, 1 after preInvoke, 2 after call, 0 again after postInvoke. hackish, no argument there. + CodeGenOpt::Level OptLevel; DataLayout *DL; #include "CallHandlers.h" public: static char ID; - explicit JSWriter(formatted_raw_ostream &o) : ModulePass(ID), Out(o), UniqueNum(0), UsesSIMD(false), InvokeState(0) {} + JSWriter(formatted_raw_ostream &o, CodeGenOpt::Level OptLevel) + : ModulePass(ID), Out(o), UniqueNum(0), UsesSIMD(false), InvokeState(0), + OptLevel(OptLevel) {} virtual const char *getPassName() const { return "JavaScript backend"; } @@ -1847,7 +1850,9 @@ void JSWriter::printFunction(const Function *F) { UsedVars.clear(); UniqueNum = 0; calculateNativizedVars(F); - Allocas.analyze(*F, *DL); + + // Do alloca coloring at -O1 and higher. + Allocas.analyze(*F, *DL, OptLevel != CodeGenOpt::None); // Emit the function @@ -2335,7 +2340,7 @@ bool JSTargetMachine::addPassesToEmitFile(PassManagerBase &PM, PM.add(createExpandI64Pass()); PM.add(createSimplifyAllocasPass()); - PM.add(new JSWriter(o)); + PM.add(new JSWriter(o, getOptLevel())); return false; } |