Index: src/IceCfg.cpp |
diff --git a/src/IceCfg.cpp b/src/IceCfg.cpp |
index a3b30eeeaf9016ee1a45d99ec18a19a05d1538d0..bd1894ca72e20d2a029016026b538959940f14de 100644 |
--- a/src/IceCfg.cpp |
+++ b/src/IceCfg.cpp |
@@ -390,6 +390,22 @@ void Cfg::doBranchOpt() { |
// ======================== Dump routines ======================== // |
+void Cfg::emitTextHeader(const IceString &MangledName) { |
+ Ostream &Str = Ctx->getStrEmit(); |
+ Str << "\t.text\n"; |
+ if (Ctx->getFlags().FunctionSections) |
+ Str << "\t.section\t.text." << MangledName << ",\"ax\",@progbits\n"; |
+ if (!getInternal() || Ctx->getFlags().DisableInternal) { |
+ Str << "\t.globl\t" << MangledName << "\n"; |
+ Str << "\t.type\t" << MangledName << ",@function\n"; |
+ } |
+ Str << "\t.p2align " << getTarget()->getBundleAlignLog2Bytes() << ",0x"; |
+ for (AsmCodeByte I : getTarget()->getNonExecBundlePadding()) |
+ Str.write_hex(I); |
+ Str << "\n"; |
+ Str << MangledName << ":\n"; |
+} |
+ |
void Cfg::emit() { |
TimerMarker T(TimerStack::TT_emit, this); |
if (Ctx->getFlags().DecorateAsm) { |
@@ -409,23 +425,23 @@ void Cfg::emit() { |
<< " -o=MyObj.o" |
<< "\n\n"; |
} |
- Str << "\t.text\n"; |
IceString MangledName = getContext()->mangleName(getFunctionName()); |
- if (Ctx->getFlags().FunctionSections) |
- Str << "\t.section\t.text." << MangledName << ",\"ax\",@progbits\n"; |
- if (!getInternal() || Ctx->getFlags().DisableInternal) { |
- Str << "\t.globl\t" << MangledName << "\n"; |
- Str << "\t.type\t" << MangledName << ",@function\n"; |
- } |
- Str << "\t.p2align " << getTarget()->getBundleAlignLog2Bytes() << ",0x"; |
- for (AsmCodeByte I : getTarget()->getNonExecBundlePadding()) |
- Str.write_hex(I); |
- Str << "\n"; |
+ emitTextHeader(MangledName); |
for (CfgNode *Node : Nodes) |
Node->emit(this); |
Str << "\n"; |
} |
+void Cfg::emitIAS() { |
+ TimerMarker T(TimerStack::TT_emit, this); |
+ assert(!Ctx->getFlags().DecorateAsm); |
+ IceString MangledName = getContext()->mangleName(getFunctionName()); |
+ emitTextHeader(MangledName); |
+ for (CfgNode *Node : Nodes) |
+ Node->emitIAS(this); |
+ getAssembler<Assembler>()->emitIASBytes(Ctx); |
+} |
+ |
// Dumps the IR with an optional introductory message. |
void Cfg::dump(const IceString &Message) { |
if (!Ctx->isVerbose()) |