Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1086)

Unified Diff: src/IceCfg.cpp

Issue 700263003: Rearrange emit vs emitIAS. Wait till function is done before dumping text. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: remove comment... might end up using the iterator Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/IceCfg.h ('k') | src/IceCfgNode.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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())
« no previous file with comments | « src/IceCfg.h ('k') | src/IceCfgNode.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698