OLD | NEW |
1 //===- subzero/src/IceCfg.cpp - Control flow graph implementation ---------===// | 1 //===- subzero/src/IceCfg.cpp - Control flow graph implementation ---------===// |
2 // | 2 // |
3 // The Subzero Code Generator | 3 // The Subzero Code Generator |
4 // | 4 // |
5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
7 // | 7 // |
8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
9 // | 9 // |
10 // This file implements the Cfg class, including constant pool | 10 // This file implements the Cfg class, including constant pool |
11 // management. | 11 // management. |
12 // | 12 // |
13 //===----------------------------------------------------------------------===// | 13 //===----------------------------------------------------------------------===// |
14 | 14 |
15 #include "IceCfg.h" | 15 #include "IceCfg.h" |
16 #include "IceCfgNode.h" | 16 #include "IceCfgNode.h" |
| 17 #include "IceClFlags.h" |
17 #include "IceDefs.h" | 18 #include "IceDefs.h" |
18 #include "IceInst.h" | 19 #include "IceInst.h" |
19 #include "IceLiveness.h" | 20 #include "IceLiveness.h" |
20 #include "IceOperand.h" | 21 #include "IceOperand.h" |
21 #include "IceTargetLowering.h" | 22 #include "IceTargetLowering.h" |
22 | 23 |
23 namespace Ice { | 24 namespace Ice { |
24 | 25 |
25 Cfg::Cfg(GlobalContext *Ctx) | 26 Cfg::Cfg(GlobalContext *Ctx) |
26 : Ctx(Ctx), FunctionName(""), ReturnType(IceType_void), | 27 : Ctx(Ctx), FunctionName(""), ReturnType(IceType_void), |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 // TODO: have the Target emit the header | 294 // TODO: have the Target emit the header |
294 // TODO: need a per-file emit in addition to per-CFG | 295 // TODO: need a per-file emit in addition to per-CFG |
295 Str << "# $LLVM_BIN_PATH/llvm-mc" | 296 Str << "# $LLVM_BIN_PATH/llvm-mc" |
296 << " -arch=x86" | 297 << " -arch=x86" |
297 << " -x86-asm-syntax=intel" | 298 << " -x86-asm-syntax=intel" |
298 << " -filetype=obj" | 299 << " -filetype=obj" |
299 << " -o=MyObj.o" | 300 << " -o=MyObj.o" |
300 << "\n\n"; | 301 << "\n\n"; |
301 } | 302 } |
302 Str << "\t.text\n"; | 303 Str << "\t.text\n"; |
| 304 IceString MangledName = getContext()->mangleName(getFunctionName()); |
| 305 if (Ctx->getFlags().FunctionSections) |
| 306 Str << "\t.section\t.text." << MangledName << "\n"; |
303 if (!getInternal()) { | 307 if (!getInternal()) { |
304 IceString MangledName = getContext()->mangleName(getFunctionName()); | |
305 Str << "\t.globl\t" << MangledName << "\n"; | 308 Str << "\t.globl\t" << MangledName << "\n"; |
306 Str << "\t.type\t" << MangledName << ",@function\n"; | 309 Str << "\t.type\t" << MangledName << ",@function\n"; |
307 } | 310 } |
308 for (NodeList::const_iterator I = Nodes.begin(), E = Nodes.end(); I != E; | 311 for (NodeList::const_iterator I = Nodes.begin(), E = Nodes.end(); I != E; |
309 ++I) { | 312 ++I) { |
310 (*I)->emit(this); | 313 (*I)->emit(this); |
311 } | 314 } |
312 Str << "\n"; | 315 Str << "\n"; |
313 T_emit.printElapsedUs(Ctx, "emit()"); | 316 T_emit.printElapsedUs(Ctx, "emit()"); |
314 } | 317 } |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 for (NodeList::const_iterator I = Nodes.begin(), E = Nodes.end(); I != E; | 362 for (NodeList::const_iterator I = Nodes.begin(), E = Nodes.end(); I != E; |
360 ++I) { | 363 ++I) { |
361 (*I)->dump(this); | 364 (*I)->dump(this); |
362 } | 365 } |
363 if (getContext()->isVerbose(IceV_Instructions)) { | 366 if (getContext()->isVerbose(IceV_Instructions)) { |
364 Str << "}\n"; | 367 Str << "}\n"; |
365 } | 368 } |
366 } | 369 } |
367 | 370 |
368 } // end of namespace Ice | 371 } // end of namespace Ice |
OLD | NEW |