Skip to content

[PPC] Make assembler.cpp compile over 30 times faster #7120

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

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
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
7 changes: 4 additions & 3 deletions arch/powerpc/assembler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ struct info {
uint32_t mask; /* which bits to mutate */
};

map<string, info> lookup = {
static const map<string_view, info> lookup = {
{ "tdi NUM , GPR , NUM",{0x0800000A,0x03FFFFFF}}, // 000010xxxxxxxxxxxxxxxxxxxxxxxxxx tdi 0, r0, 0xa
{ "tdlgti GPR , NUM",{0x08200000,0x001FFFFF}}, // 00001000001xxxxxxxxxxxxxxxxxxxxx tdlgti r0, 0
{ "tdllti GPR , NUM",{0x08400000,0x001FFFFF}}, // 00001000010xxxxxxxxxxxxxxxxxxxxx tdllti r0, 0
Expand Down Expand Up @@ -2932,12 +2932,13 @@ int assemble_single(string src, uint32_t addr, uint8_t *result, string& err,

MYLOG("src:%s has signature:%s\n", src.c_str(), sig_src.c_str());

if(lookup.find(sig_src) == lookup.end()) {
auto it = lookup.find(sig_src);
if(it == lookup.end()) {
err = "invalid syntax in " + sig_src;
return -1;
}

auto info = lookup[sig_src];
auto info = it->second;
uint32_t vary_mask = info.mask;

/* for relative branches, shift the target address to 0 */
Expand Down