OLD | NEW |
---|---|
(Empty) | |
1 //===- subzero/src/IceTranslator.cpp - Translate IR to ICE ------*- C++ -*-===// | |
jvoung (off chromium)
2014/07/02 22:07:33
ICE to machine code
Karl
2014/07/07 21:50:55
Done.
| |
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 ICE to | |
11 // machine code. | |
12 // | |
13 //===----------------------------------------------------------------------===// | |
14 | |
15 #include "IceTranslator.h" | |
16 | |
17 #include "IceCfg.h" | |
18 #include "IceClFlags.h" | |
19 #include "IceTargetLowering.h" | |
20 | |
21 #include <iostream> | |
22 | |
23 using namespace Ice; | |
24 | |
25 Translator::~Translator() {} | |
26 | |
27 void Translator::translateFcn(Ice::Cfg *Fcn) { | |
28 Func.reset(Fcn); | |
29 if (Flags.DisableInternal) | |
30 Func->setInternal(false); | |
31 if (Flags.DisableTranslation) { | |
32 Func->dump(); | |
33 } else { | |
34 Ice::Timer TTranslate; | |
35 Func->translate(); | |
36 if (Flags.SubzeroTimingEnabled) { | |
37 std::cerr << "[Subzero timing] Translate function " | |
38 << Func->getFunctionName() << ": " << TTranslate.getElapsedSec() | |
39 << " sec\n"; | |
40 } | |
41 if (Func->hasError()) { | |
42 std::cerr << "ICE translation error: " << Func->getError() << "\n"; | |
43 ExitStatus = 1; | |
44 } | |
45 | |
46 Ice::Timer TEmit; | |
47 Func->emit(); | |
48 if (Flags.SubzeroTimingEnabled) { | |
49 std::cerr << "[Subzero timing] Emit function " << Func->getFunctionName() | |
50 << ": " << TEmit.getElapsedSec() << " sec\n"; | |
51 } | |
52 } | |
53 } | |
54 | |
55 void Translator::emitConstants() { | |
56 if (!Flags.DisableTranslation && Func) | |
57 Func->getTarget()->emitConstants(); | |
58 } | |
OLD | NEW |