OLD | NEW |
(Empty) | |
| 1 //===- subzero/src/IceTranslator.cpp - Translate IR to ICE ------*- C++ -*-===// |
| 2 // |
| 3 // The Subzero Code Generator |
| 4 // |
| 5 // This file is distributed under the University of Illinois Open Source |
| 6 // License. See LICENSE.TXT for details. |
| 7 // |
| 8 //===----------------------------------------------------------------------===// |
| 9 // |
| 10 // This file defines the general driver class for translating IR to ICE. |
| 11 // |
| 12 //===----------------------------------------------------------------------===// |
| 13 |
| 14 #include "IceTranslator.h" |
| 15 |
| 16 #include "IceCfg.h" |
| 17 #include "IceTargetLowering.h" |
| 18 |
| 19 #include <iostream> |
| 20 |
| 21 using namespace Ice; |
| 22 |
| 23 Translator::~Translator() {} |
| 24 |
| 25 void Translator::translateFcn(Ice::Cfg *Fcn) { |
| 26 Func.reset(Fcn); |
| 27 if (Flags.DisableInternal) |
| 28 Func->setInternal(false); |
| 29 if (Flags.DisableTranslation) { |
| 30 Func->dump(); |
| 31 } else { |
| 32 Ice::Timer TTranslate; |
| 33 Func->translate(); |
| 34 if (Flags.SubzeroTimingEnabled) { |
| 35 std::cerr << "[Subzero timing] Translate function " |
| 36 << Func->getFunctionName() << ": " |
| 37 << TTranslate.getElapsedSec() << " sec\n"; |
| 38 } |
| 39 if (Func->hasError()) { |
| 40 std::cerr << "ICE translation error: " << Func->getError() << "\n"; |
| 41 ExitStatus = 1; |
| 42 } |
| 43 |
| 44 Ice::Timer TEmit; |
| 45 Func->emit(); |
| 46 if (Flags.SubzeroTimingEnabled) { |
| 47 std::cerr << "[Subzero timing] Emit function " |
| 48 << Func->getFunctionName() << ": " << TEmit.getElapsedSec() |
| 49 << " sec\n"; |
| 50 } |
| 51 } |
| 52 } |
| 53 |
| 54 void Translator::emitConstants() { |
| 55 if (!Flags.DisableTranslation && Func) |
| 56 Func->getTarget()->emitConstants(); |
| 57 } |
OLD | NEW |