return 0;
}
-int gen_disasm (FILE *file, const void *opaque_insn, uint32_t deviceID)
+int gen_disasm (FILE *file, const void *opaque_insn, uint32_t deviceID, uint32_t compacted)
{
const union GenNativeInstruction *inst = (const union GenNativeInstruction *) opaque_insn;
int err = 0;
inst->header.opcode == GEN_OPCODE_SENDC)
err |= control (file, "end of thread", end_of_thread,
inst->bits3.generic_gen5.end_of_thread, &space);
+
+ if(compacted) {
+ string(file, " Compacted");
+ }
if (space)
string (file, " ");
string (file, "}");
extern "C" {
#endif /* __cplusplus */
-extern int gen_disasm(FILE *file, const void *opaque_insn, uint32_t deviceID);
+extern int gen_disasm(FILE *file, const void *opaque_insn, uint32_t deviceID, uint32_t compacted);
#ifdef __cplusplus
}
namespace gbe
{
- extern void decompactInstruction(union GenCompactInstruction *p, union GenNativeInstruction *pOut);
///////////////////////////////////////////////////////////////////////////
// GenContext implementation
///////////////////////////////////////////////////////////////////////////
pCom = (GenCompactInstruction*)&p->store[insnID];
if(pCom->bits1.cmpt_control == 1) {
decompactInstruction(pCom, &insn);
- gen_disasm(stdout, &insn, deviceID);
+ gen_disasm(stdout, &insn, deviceID, 1);
insnID++;
} else {
- gen_disasm(stdout, &p->store[insnID], deviceID);
+ gen_disasm(stdout, &p->store[insnID], deviceID, 0);
insnID = insnID + 2;
}
}
FILE *f = fopen("/dev/null", "w");
char *buf = new char[4096];
setbuffer(f, buf, 4096);
-
- for (uint32_t i = 0; i < insnNum; i++) {
- gen_disasm(f, insns+i, deviceID);
+ GenCompactInstruction * pCom = NULL;
+ GenNativeInstruction nativeInsn;
+
+ for (uint32_t i = 0; i < insnNum;) {
+ pCom = (GenCompactInstruction*)(insns+i);
+ if(pCom->bits1.cmpt_control == 1) {
+ decompactInstruction(pCom, &nativeInsn);
+ gen_disasm(f, &nativeInsn, deviceID, 1);
+ i++;
+ } else {
+ gen_disasm(f, insns+i, deviceID, 0);
+ i = i + 2;
+ }
outs << buf;
fflush(f);
setbuffer(f, NULL, 0);
#include "backend/program.h"
#include "backend/program.hpp"
+#include "backend/gen_defs.hpp"
// Gen ISA instruction
struct GenInstruction;
/*! Use custom allocators */
GBE_CLASS(GenProgram);
};
-
+ /*! decompact GEN ASM if it is in compacted format */
+ extern void decompactInstruction(union GenCompactInstruction *p, union GenNativeInstruction *pOut);
} /* namespace gbe */
#endif /* __GBE_GEN_PROGRAM_HPP__ */