Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to remove div instructions #105

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading