Index: src/IceCfg.cpp |
diff --git a/src/IceCfg.cpp b/src/IceCfg.cpp |
index 950a3f8ee6e9572abf6fbe4f64399264ff9d4be2..fe7db5a000cdedd7ee32862139ea78ce826db520 100644 |
--- a/src/IceCfg.cpp |
+++ b/src/IceCfg.cpp |
@@ -405,8 +405,9 @@ void Cfg::emitTextHeader(const IceString &MangledName) { |
Str << "\t.globl\t" << MangledName << "\n"; |
Str << "\t.type\t" << MangledName << ",@function\n"; |
} |
- Str << "\t.p2align " << getTarget()->getBundleAlignLog2Bytes() << ",0x"; |
- for (AsmCodeByte I : getTarget()->getNonExecBundlePadding()) |
+ Assembler *Asm = getAssembler<Assembler>(); |
+ Str << "\t.p2align " << Asm->getBundleAlignLog2Bytes() << ",0x"; |
+ for (uint8_t I : Asm->getNonExecBundlePadding()) |
Str.write_hex(I); |
Str << "\n"; |
Str << MangledName << ":\n"; |
@@ -444,10 +445,19 @@ void Cfg::emitIAS() { |
TimerMarker T(TimerStack::TT_emit, this); |
assert(!Ctx->getFlags().DecorateAsm); |
IceString MangledName = getContext()->mangleName(getFunctionName()); |
- emitTextHeader(MangledName); |
+ if (!Ctx->getFlags().UseELFWriter) |
+ emitTextHeader(MangledName); |
for (CfgNode *Node : Nodes) |
Node->emitIAS(this); |
- getAssembler<Assembler>()->emitIASBytes(Ctx); |
+ // Now write the function to the file and track. |
+ if (Ctx->getFlags().UseELFWriter) { |
+ getAssembler<Assembler>()->alignFunction(); |
+ Ctx->getObjectWriter()->writeFunctionCode( |
+ MangledName, getInternal(), getAssembler<Assembler>()->getBufferView()); |
+ // Transfer remaining fixups too. They may need their offsets adjusted. |
Jim Stichnoth
2014/11/21 21:32:22
Is this a TODO, or ... ?
jvoung (off chromium)
2014/11/24 21:35:45
Yes, a TODO and made that explicit.
Currently the
|
+ } else { |
+ getAssembler<Assembler>()->emitIASBytes(Ctx); |
+ } |
} |
// Dumps the IR with an optional introductory message. |