Merge remote-tracking branch 'origin/GP-5863_FixLanedParameters'

This commit is contained in:
Ryan Kurtz 2025-07-24 06:33:32 -04:00
commit 66cecdf954
5 changed files with 43 additions and 5 deletions

View file

@ -4597,6 +4597,11 @@ int4 ActionInputPrototype::apply(Funcdata &data)
for(int4 i=0;i<active.getNumTrials();++i) { for(int4 i=0;i<active.getNumTrials();++i) {
ParamTrial &paramtrial(active.getTrial(i)); ParamTrial &paramtrial(active.getTrial(i));
if (paramtrial.isUnref() && paramtrial.isUsed()) { if (paramtrial.isUnref() && paramtrial.isUsed()) {
if (data.hasInputIntersection(paramtrial.getSize(), paramtrial.getAddress())) {
// There is something in the way of the unreferenced parameter, don't create it
paramtrial.markNoUse();
}
else {
vn = data.newVarnode(paramtrial.getSize(),paramtrial.getAddress()); vn = data.newVarnode(paramtrial.getSize(),paramtrial.getAddress());
vn = data.setInputVarnode(vn); vn = data.setInputVarnode(vn);
int4 slot = triallist.size(); int4 slot = triallist.size();
@ -4604,6 +4609,7 @@ int4 ActionInputPrototype::apply(Funcdata &data)
paramtrial.setSlot(slot + 1); paramtrial.setSlot(slot + 1);
} }
} }
}
if (data.isHighOn()) if (data.isHighOn())
data.getFuncProto().updateInputTypes(data,triallist,&active); data.getFuncProto().updateInputTypes(data,triallist,&active);
else else

View file

@ -309,6 +309,13 @@ public:
/// \return the matching Varnode or NULL /// \return the matching Varnode or NULL
Varnode *findCoveringInput(int4 s,const Address &loc) const { return vbank.findCoveringInput(s,loc); } Varnode *findCoveringInput(int4 s,const Address &loc) const { return vbank.findCoveringInput(s,loc); }
/// \brief Check if an input Varnode exists that overlaps the given range
///
/// \param s is the size of the range in bytes
/// \param loc is the starting address of the given range
/// \return \b true if there is an input Varnode that overlaps the range
bool hasInputIntersection(int4 s,const Address &loc) const { return vbank.hasInputIntersection(s, loc); }
/// \brief Find the input Varnode with the given size and storage address /// \brief Find the input Varnode with the given size and storage address
/// ///
/// \param s is the size in bytes /// \param s is the size in bytes

View file

@ -1757,6 +1757,7 @@ int4 RuleAndCompare::applyOp(PcodeOp *op,Funcdata &data)
switch(subop->code()) { switch(subop->code()) {
case CPUI_SUBPIECE: case CPUI_SUBPIECE:
basevn = subop->getIn(0); basevn = subop->getIn(0);
if (basevn->getSize() > sizeof(uintb)) return 0;
baseconst = andop->getIn(1)->getOffset(); baseconst = andop->getIn(1)->getOffset();
andconst = baseconst << subop->getIn(1)->getOffset() * 8; andconst = baseconst << subop->getIn(1)->getOffset() * 8;
break; break;

View file

@ -1530,6 +1530,29 @@ Varnode *VarnodeBank::findCoveringInput(int4 s,const Address &loc) const
return (Varnode *)0; return (Varnode *)0;
} }
/// \param s is the number of bytes in the given range
/// \param loc is the starting address of the given range
/// \return \b true if there is an input Varnode that overlaps the range
bool VarnodeBank::hasInputIntersection(int4 s,const Address &loc) const
{
VarnodeDefSet::const_iterator iter;
Varnode *vn;
iter = beginDef(Varnode::input,loc);
if (iter != def_tree.end()) {
vn = *iter;
if (vn->isInput() && vn->intersects(loc, s))
return true;
}
if (iter != def_tree.begin()) {
--iter;
vn = *iter;
if (vn->isInput() && vn->intersects(loc,s))
return true;
}
return false;
}
/// \brief Beginning of Varnodes in given address space sorted by location /// \brief Beginning of Varnodes in given address space sorted by location
/// ///
/// \param spaceid is the given address space /// \param spaceid is the given address space

View file

@ -390,6 +390,7 @@ public:
Varnode *findInput(int4 s,const Address &loc) const; ///< Find an input Varnode Varnode *findInput(int4 s,const Address &loc) const; ///< Find an input Varnode
Varnode *findCoveredInput(int4 s,const Address &loc) const; ///< Find an input Varnode contained within this range Varnode *findCoveredInput(int4 s,const Address &loc) const; ///< Find an input Varnode contained within this range
Varnode *findCoveringInput(int4 s,const Address &loc) const; ///< Find an input Varnode covering a range Varnode *findCoveringInput(int4 s,const Address &loc) const; ///< Find an input Varnode covering a range
bool hasInputIntersection(int4 s,const Address &loc) const; ///< Check for input Varnode that overlaps the given range
uint4 getCreateIndex(void) const { return create_index; } ///< Get the next creation index to be assigned uint4 getCreateIndex(void) const { return create_index; } ///< Get the next creation index to be assigned
VarnodeLocSet::const_iterator beginLoc(void) const { return loc_tree.begin(); } ///< Beginning of location list VarnodeLocSet::const_iterator beginLoc(void) const { return loc_tree.begin(); } ///< Beginning of location list
VarnodeLocSet::const_iterator endLoc(void) const { return loc_tree.end(); } ///< End of location list VarnodeLocSet::const_iterator endLoc(void) const { return loc_tree.end(); } ///< End of location list