Skip to content
Snippets Groups Projects
Commit 5f919da1 authored by Jason Hiser's avatar Jason Hiser :tractor:
Browse files

updates to set USEFP or NOFP

Former-commit-id: 3a528c97bb34e178d59e412bba93367cf7182a64
parent e662e418
No related branches found
No related tags found
No related merge requests found
......@@ -344,11 +344,31 @@ class CreateFunctions_t
const auto size=max.second-min.first;
cout<<"Function "<<dec<<i++<<" is "<<hex<<min.first<<" "<<dec<<max.second-min.first<<endl;
const auto usefp=getUseFp(scc);
outfile<<hex<<"\t"<<min.first<<"\t"<<dec<<size<<"\tFUNC GLOBAL\t"<<funcNames[scc]<<endl;
outfile<<hex<<"\t"<<min.first<<"\t"<<dec<<size<<"\tFUNC GLOBAL\t"<<funcNames[scc]<<" "<< usefp << endl;
doBelongTos(scc);
}
}
string getUseFp(const RangeSet_t scc)
{
assert(scc.begin()!=scc.end());
const auto startAddr=scc.begin()->first;
const auto fde=ehp->findFDE(startAddr);
if(!fde) return "NOFP";
const auto &ehprogram=fde->getProgram();
const auto ehprogramInstructions=ehprogram.getInstructions();
const auto def_cfa_rbp_it = find_if(ALLOF(*ehprogramInstructions), [](const shared_ptr<EHProgramInstruction_t> insn)
{
assert(insn);
const auto &insnBytes=insn->getBytes();
// 0xd, 0x6 is "def_cfa_register rbp"
return insnBytes==EHProgramInstructionByteVector_t({(uint8_t)0xd,(uint8_t)0x6});
});
return def_cfa_rbp_it == ehprogramInstructions->end() ? "NOFP" : "USEFP";
}
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment