Chromium Code Reviews| Index: src/IceConverter.cpp |
| diff --git a/src/IceConverter.cpp b/src/IceConverter.cpp |
| index 654d5e87532022dc27d5db8220de8a768c33de46..fc51c2373aaac33fe657d9912bf92b1b8f8a4b41 100644 |
| --- a/src/IceConverter.cpp |
| +++ b/src/IceConverter.cpp |
| @@ -15,11 +15,11 @@ |
| #include "IceCfg.h" |
| #include "IceCfgNode.h" |
| +#include "IceClFlags.h" |
| #include "IceDefs.h" |
| #include "IceGlobalContext.h" |
| #include "IceInst.h" |
| #include "IceOperand.h" |
| -#include "IceTargetLowering.h" |
| #include "IceTypes.h" |
| #include "llvm/IR/Constant.h" |
| @@ -615,65 +615,24 @@ private: |
| std::map<const Value *, Ice::Variable *> VarMap; |
| std::map<const BasicBlock *, Ice::CfgNode *> NodeMap; |
| }; |
| - |
| } |
|
Jim Stichnoth
2014/07/07 20:50:23
Add "end of anonymous namespace" comment.
Karl
2014/07/07 21:50:55
Done.
|
| int Ice::Converter::convertToIce(llvm::Module *Mod) { |
| - int ExitStatus = 0; |
| - |
| - // Ideally, Func would be declared inside the loop and its object |
| - // would be automatically deleted at the end of the loop iteration. |
| - // However, emitting the constant pool requires a valid Cfg object, |
| - // so we need to defer deleting the last non-empty Cfg object until |
| - // outside the loop and after emitting the constant pool. TODO: |
| - // Since all constants are globally pooled in the Ice::GlobalContext |
| - // object, change all Ice::Constant related functions to use |
| - // GlobalContext instead of Cfg, and then clean up this loop. |
| - OwningPtr<Ice::Cfg> Func; |
| - |
| for (Module::const_iterator I = Mod->begin(), E = Mod->end(); I != E; ++I) { |
| if (I->empty()) |
| continue; |
| LLVM2ICEConverter FunctionConverter(Ctx); |
| Ice::Timer TConvert; |
| - Func.reset(FunctionConverter.convertFunction(I)); |
| - if (DisableInternal) |
| - Func->setInternal(false); |
| - |
| - if (SubzeroTimingEnabled) { |
| + Ice::Cfg *Fcn = FunctionConverter.convertFunction(I); |
| + if (Flags.SubzeroTimingEnabled) { |
| std::cerr << "[Subzero timing] Convert function " |
| - << Func->getFunctionName() << ": " << TConvert.getElapsedSec() |
| + << Fcn->getFunctionName() << ": " << TConvert.getElapsedSec() |
| << " sec\n"; |
| } |
| - |
| - if (DisableTranslation) { |
| - Func->dump(); |
| - } else { |
| - Ice::Timer TTranslate; |
| - Func->translate(); |
| - if (SubzeroTimingEnabled) { |
| - std::cerr << "[Subzero timing] Translate function " |
| - << Func->getFunctionName() << ": " |
| - << TTranslate.getElapsedSec() << " sec\n"; |
| - } |
| - if (Func->hasError()) { |
| - errs() << "ICE translation error: " << Func->getError() << "\n"; |
| - ExitStatus = 1; |
| - } |
| - |
| - Ice::Timer TEmit; |
| - Func->emit(); |
| - if (SubzeroTimingEnabled) { |
| - std::cerr << "[Subzero timing] Emit function " |
| - << Func->getFunctionName() << ": " << TEmit.getElapsedSec() |
| - << " sec\n"; |
| - } |
| - } |
| + translateFcn(Fcn); |
| } |
| - if (!DisableTranslation && Func) |
| - Func->getTarget()->emitConstants(); |
| - |
| + emitConstants(); |
| return ExitStatus; |
| } |