Skip to content

Commit

Permalink
Add option to remove div instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
boomanaiden154 committed Apr 6, 2024
1 parent 296c575 commit 71655c0
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions gematria/datasets/process_and_filter_bbs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ static cl::opt<bool> FilterImplicitOutputEflags(
cl::desc("Whether or not to filter instructions that have an eflags implicit output"),
cl::init(false), cl::cat(ProcessFilterCat));

static cl::opt<bool> FilterVariableLatencyInstructions(
"filter-variable-latency-instructions",
cl::desc("Whether or not to filter variable latency instructions"),
cl::init(false), cl::cat(ProcessFilterCat));

Expected<std::string> ProcessBasicBlock(
const std::string &BasicBlock,
const gematria::LlvmArchitectureSupport &LLVMSupport,
Expand Down Expand Up @@ -124,6 +129,13 @@ Expected<std::string> ProcessBasicBlock(
if (UsesEflags)
continue;
}
if (FilterVariableLatencyInstructions) {
// Kind of a hacky solution, but can't figure out a better way to get a
// list of all the variable latency instructions, and div seems like the
// main one currently.
if (Instruction.assembly.find("DIV") != std::string::npos)
continue;
}
OutputBlock += toHex(Instruction.machine_code);
}

Expand Down

0 comments on commit 71655c0

Please sign in to comment.