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 Jul 26, 2024
1 parent 43c942b commit ad54a28
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions gematria/datasets/process_and_filter_bbs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ static cl::opt<unsigned> ReportProgressEvery(
cl::desc("The interval at which to report progress in blocks"),
cl::init(std::numeric_limits<unsigned>::max()), 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 @@ -91,6 +96,15 @@ Expected<std::string> processBasicBlock(
if (FilterMemoryAccessingBlocks &&
(InstDesc.mayLoad() || InstDesc.mayStore()))
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 ad54a28

Please sign in to comment.