Merge commit 'dcd2c021a5ac91d38187d397914e5f51e2fc8819'

Conflicts:
	tools/import-trace/RegisterImporter.cc

Change-Id: I4f49c976bd60badba73c15746aa03c420cb9f77b
This commit is contained in:
Horst Schirmeier
2013-09-11 14:38:55 +02:00
33 changed files with 690 additions and 174 deletions

View File

@ -17,22 +17,21 @@ static Logger LOG("RegisterImporter");
bool RegisterImporter::cb_commandline_init() {
CommandLine &cmd = CommandLine::Inst();
NO_GP = cmd.addOption("", "no-gp", Arg::None,
"--no-gp\t RegisterImporter: do not inject general purpose registers\n");
NO_GP = cmd.addOption("", "no-gp", Arg::None,
"--no-gp \tRegisterImporter: do not inject general purpose registers");
FLAGS = cmd.addOption("", "flags", Arg::None,
"--flags: RegisterImporter: trace flags register\n");
IP = cmd.addOption("", "ip", Arg::None,
"--ip: RegisterImporter: trace instruction pointer\n");
NO_SPLIT = cmd.addOption("", "do-not-split", Arg::None,
"--do-not-split: RegisterImporter: Do not split the registers into one byte chunks\n");
"--flags \tRegisterImporter: inject flags register");
IP = cmd.addOption("", "ip", Arg::None,
"--ip \tRegisterImporter: inject instruction pointer");
NO_SPLIT = cmd.addOption("", "do-not-split", Arg::None,
"--do-not-split \tRegisterImporter: Do not split the registers into one byte chunks");
return true;
}
bool RegisterImporter::addRegisterTrace(simtime_t curtime, instruction_count_t instr,
const Trace_Event &ev,
Trace_Event &ev,
const LLVMtoFailTranslator::reginfo_t &info,
char access_type) {
address_t from, to;
@ -75,11 +74,20 @@ bool RegisterImporter::addRegisterTrace(simtime_t curtime, instruction_count_t i
// we're currently looking at; the EC is defined by
// data_address, dynamic instruction start/end, the absolute PC at
// the end, and time start/end
<<<<<<< HEAD
access_info_t access;
access.access_type = access_type; // instruction fetch is always a read
access.data_address = data_address;
access.data_width = chunk_width;
if (!add_trace_event(left_margin, right_margin, access)) {
=======
// pass through potentially available extended trace information
ev.set_width(1); // exactly one byte
ev.set_memaddr(data_address);
ev.set_accesstype(access_type == 'R' ? ev.READ : ev.WRITE);
if (!add_trace_event(left_margin, right_margin, ev)) {
>>>>>>> dcd2c021a5ac91d38187d397914e5f51e2fc8819
LOG << "add_trace_event failed" << std::endl;
return false;
}
@ -93,7 +101,7 @@ bool RegisterImporter::addRegisterTrace(simtime_t curtime, instruction_count_t i
bool RegisterImporter::handle_ip_event(fail::simtime_t curtime, instruction_count_t instr,
const Trace_Event &ev) {
Trace_Event &ev) {
if (!binary) {
// Parse command line again, for jump-from and jump-to
// operations
@ -102,6 +110,7 @@ bool RegisterImporter::handle_ip_event(fail::simtime_t curtime, instruction_coun
std::cerr << "Error parsing arguments." << std::endl;
return false;
}
<<<<<<< HEAD
// Read FROM memory file
if (cmd[NO_GP].count() > 0) {
@ -117,6 +126,11 @@ bool RegisterImporter::handle_ip_event(fail::simtime_t curtime, instruction_coun
do_split_registers = false;
}
=======
do_gp = !cmd[NO_GP];
do_flags = cmd[FLAGS];
do_ip = cmd[IP];
>>>>>>> dcd2c021a5ac91d38187d397914e5f51e2fc8819
/* Disassemble the binary if necessary */
llvm::InitializeAllTargetInfos();
@ -146,7 +160,7 @@ bool RegisterImporter::handle_ip_event(fail::simtime_t curtime, instruction_coun
const LLVMDisassembler::Instr &opcode = instr_map.at(ev.ip());
//const MCRegisterInfo &reg_info = disas->getRegisterInfo();
fail::LLVMtoFailTranslator & ltof = disas->getTranslator() ;
fail::LLVMtoFailTranslator & ltof = disas->getTranslator() ;
for (std::vector<LLVMDisassembler::register_t>::const_iterator it = opcode.reg_uses.begin();
it != opcode.reg_uses.end(); ++it) {