Suggestions from github issue #382

This commit is contained in:
caheckman 2019-04-12 09:44:53 -04:00
parent ba98e85429
commit 933e16f751
10 changed files with 19 additions and 17 deletions

View File

@ -116,8 +116,6 @@ public:
class Architecture : public AddrSpaceManager {
public:
string archid; ///< ID string uniquely describing this architecture
string description; ///< Description of architecture
string version; ///< Configuration version
// Configuration data
int4 trim_recurse_max; ///< How many levels to let parameter trims recurse
@ -178,6 +176,8 @@ public:
void restoreFlowOverride(const Element *el); ///< Set flow overrides from XML
virtual ~Architecture(void); ///< Destructor
virtual string getDescription(void) const { return archid; } ///< Get a string describing \b this architecture
/// \brief Print an error message to console
///
/// Write the given message to whatever the registered error stream is

View File

@ -100,7 +100,7 @@ void IfcLoadFile::execute(istream &s)
#ifdef OPACTION_DEBUG
dcp->conf->setDebugStream(status->optr);
#endif
*status->optr << filename << " successfully loaded: " << dcp->conf->description << endl;
*status->optr << filename << " successfully loaded: " << dcp->conf->getDescription() << endl;
}
void IfcAddpath::execute(istream &s)
@ -162,7 +162,7 @@ void IfcRestore::execute(istream &s)
#ifdef OPACTION_DEBUG
dcp->conf->setDebugStream(status->optr);
#endif
*status->optr << savefile << " successfully loaded: " << dcp->conf->description << endl;
*status->optr << savefile << " successfully loaded: " << dcp->conf->getDescription() << endl;
}
int main(int argc,char **argv)

View File

@ -2282,7 +2282,7 @@ ProtoStoreSymbol::ProtoStoreSymbol(Scope *sc,const Address &usepoint)
ParameterPieces pieces;
pieces.type = scope->getArch()->types->getTypeVoid();
pieces.flags = 0;
setOutput(pieces);
ProtoStoreSymbol::setOutput(pieces);
}
ProtoStoreSymbol::~ProtoStoreSymbol(void)
@ -2465,7 +2465,7 @@ ProtoStoreInternal::ProtoStoreInternal(Datatype *vt)
ParameterPieces pieces;
pieces.type = voidtype;
pieces.flags = 0;
setOutput(pieces);
ProtoStoreInternal::setOutput(pieces);
}
ProtoStoreInternal::~ProtoStoreInternal(void)

View File

@ -281,9 +281,8 @@ void InjectPayloadDynamic::inject(InjectContext &context,PcodeEmit &emit) const
PcodeInjectLibrarySleigh::PcodeInjectLibrarySleigh(Architecture *g,uintb tmpbase)
: PcodeInjectLibrary(g,tmpbase)
{
glb = g;
slgh = (const SleighBase *)glb->translate;
contextCache.glb = glb;
slgh = (const SleighBase *)g->translate;
contextCache.glb = g;
}
int4 PcodeInjectLibrarySleigh::registerDynamicInject(InjectPayload *payload)

View File

@ -87,7 +87,6 @@ public:
};
class PcodeInjectLibrarySleigh : public PcodeInjectLibrary {
Architecture *glb;
const SleighBase *slgh;
vector<OpBehavior *> inst;
InjectContextSleigh contextCache;

View File

@ -125,6 +125,12 @@ SleighArchitecture::~SleighArchitecture(void)
translate = (const Translate *)0;
}
string SleighArchitecture::getDescription(void) const
{
return description[languageindex].getDescription();
}
/// If the current \b languageindex matches the \b last_languageindex,
/// try to reuse the previous Sleigh object, so we don't reload
/// the .sla file.
@ -198,8 +204,6 @@ void SleighArchitecture::buildSpecFile(DocumentStorage &store)
{ // Given a specific language, make sure relevant spec files are loaded
bool language_reuse = isTranslateReused();
const LanguageDescription &language(description[languageindex]);
Architecture::description = language.getDescription();
version = language.getVersion();
string compiler = archid.substr(archid.rfind(':')+1);
const CompilerTag &compilertag( language.getCompiler(compiler));

View File

@ -112,6 +112,7 @@ public:
void restoreXmlHeader(const Element *el); ///< Restore from XML basic attributes of an executable
virtual void printMessage(const string &message) const { *errorstream << message << endl; }
virtual ~SleighArchitecture(void);
virtual string getDescription(void) const;
static string normalizeProcessor(const string &nm); ///< Try to recover a \e language \e id processor field
static string normalizeEndian(const string &nm); ///< Try to recover a \e language \e id endianess field

View File

@ -2062,10 +2062,10 @@ int4 DecisionNode::getNumFixed(int4 low,int4 size,bool context)
double DecisionNode::getScore(int4 low,int4 size,bool context)
{
int4 numBins = 1 << size;
int4 numBins = 1 << size; // size is between 1 and 8
int4 i;
uintm val,mask;
uintm m = (size==8*sizeof(uintm)) ? 0 : (((uintm)1)<<size);
uintm m = ((uintm)1)<<size;
m = m-1;
int4 total = 0;

View File

@ -1986,8 +1986,7 @@ Varnode *SubfloatFlow::getReplaceVarnode(ReplaceVarnode *rvn)
// Here we artificially truncate the location, which isn't realistic
if (addr.isBigEndian())
addr = addr + (rvn->vn->getSize() - precision);
if (isinput)
replaceInput(rvn); // Replace input to avoid overlap errors
replaceInput(rvn); // Replace input to avoid overlap errors
rvn->replacement = fd->newVarnode(precision,addr);
}
else

View File

@ -91,7 +91,7 @@ UnifyDatatype::~UnifyDatatype(void)
delete storespot.cn;
break;
default:
throw LowlevelError("Bad unify datatype");
break;
}
}