summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaura Ekstrand <laura.d.ekstrand@intel.com>2015-08-12 01:54:16 -0400
committerYang Rong <rong.r.yang@intel.com>2015-08-13 15:51:09 +0800
commit177469094ab63049d0dd3fbfb25bec8f6c6fb905 (patch)
tree8b8761930a4fc61ae5659f2649aaffd285da173c
parentfa394ddb47921cd7024bb80703ff8960697e147d (diff)
backend: Convert outputAssembly to C file I/O.
This unifies the printing of the Gen Assembly to C file I/O, eliminating the use of iostream. This is so that a single stream can be passed into the function to receive all of the output. Signed-off-by: Manasi Navare <manasi.d.navare@intel.com> Signed-off-by: Laura Ekstrand <laura.d.ekstrand@intel.com> Reviewed-by: Song, Ruiling <ruiling.song@intel.com>
-rw-r--r--backend/src/backend/gen_context.cpp20
-rw-r--r--backend/src/backend/gen_context.hpp2
2 files changed, 11 insertions, 11 deletions
diff --git a/backend/src/backend/gen_context.cpp b/backend/src/backend/gen_context.cpp
index 56871365..06601d62 100644
--- a/backend/src/backend/gen_context.cpp
+++ b/backend/src/backend/gen_context.cpp
@@ -2284,7 +2284,7 @@ namespace gbe
genKernel->insns = GBE_NEW_ARRAY_NO_ARG(GenInstruction, genKernel->insnNum);
std::memcpy(genKernel->insns, &p->store[0], genKernel->insnNum * sizeof(GenInstruction));
if (OCL_OUTPUT_ASM)
- outputAssembly(std::cout, genKernel);
+ outputAssembly(stdout, genKernel);
return true;
}
@@ -2293,34 +2293,34 @@ namespace gbe
return GBE_NEW(GenKernel, name, deviceID);
}
- void GenContext::outputAssembly(std::ostream& out, GenKernel* genKernel) {
- out << genKernel->getName() << "'s disassemble begin:" << std::endl;
+ void GenContext::outputAssembly(FILE *file, GenKernel* genKernel) {
+ fprintf(file, "%s's disassemble begin:\n", genKernel->getName());
ir::LabelIndex curLabel = (ir::LabelIndex)0;
GenCompactInstruction * pCom = NULL;
GenInstruction insn[2];
- out << " L0:" << std::endl;
+ fprintf(file, " L0:\n");
for (uint32_t insnID = 0; insnID < genKernel->insnNum; ) {
if (labelPos.find((ir::LabelIndex)(curLabel + 1))->second == insnID &&
curLabel < this->getFunction().labelNum()) {
- out << " L" << curLabel + 1 << ":" << std::endl;
+ fprintf(file, " L%i:\n", curLabel + 1);
curLabel = (ir::LabelIndex)(curLabel + 1);
while(labelPos.find((ir::LabelIndex)(curLabel + 1))->second == insnID) {
- out << " L" << curLabel + 1 << ":" << std::endl;
+ fprintf(file, " L%i:\n", curLabel + 1);
curLabel = (ir::LabelIndex)(curLabel + 1);
}
}
- out << " (" << std::setw(8) << insnID << ") ";
+ fprintf(file, " (%8i) ", insnID);
pCom = (GenCompactInstruction*)&p->store[insnID];
if(pCom->bits1.cmpt_control == 1) {
decompactInstruction(pCom, &insn);
- gen_disasm(stdout, &insn, deviceID, 1);
+ gen_disasm(file, &insn, deviceID, 1);
insnID++;
} else {
- gen_disasm(stdout, &p->store[insnID], deviceID, 0);
+ gen_disasm(file, &p->store[insnID], deviceID, 0);
insnID = insnID + 2;
}
}
- out << genKernel->getName() << "'s disassemble end." << std::endl;
+ fprintf(file, "%s's disassemble end.\n", genKernel->getName());
}
} /* namespace gbe */
diff --git a/backend/src/backend/gen_context.hpp b/backend/src/backend/gen_context.hpp
index 29ec6d08..e9c6366e 100644
--- a/backend/src/backend/gen_context.hpp
+++ b/backend/src/backend/gen_context.hpp
@@ -221,7 +221,7 @@ namespace gbe
/*! Build the curbe patch list for the given kernel */
void buildPatchList(void);
/* Helper for printing the assembly */
- void outputAssembly(std::ostream& out, GenKernel* genKernel);
+ void outputAssembly(FILE *file, GenKernel* genKernel);
/*! Calc the group's slm offset from R0.0, to work around HSW SLM bug*/
virtual void emitSLMOffset(void) { };
/*! new selection of device */