Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • opensrc/SMPStaticAnalyzer
1 result
Show changes
Commits on Source (1)
......@@ -193,6 +193,11 @@ extern unsigned long STARS_ReturnSetIncompleteTailCallChainFromOrphanCode;
extern unsigned long STARS_FuncReturnSetComplete;
extern unsigned long STARS_FuncReturnSetIncomplete;
// Loop analysis counters.
extern unsigned long STARS_LoopInductionVarIDSuccesses;
extern unsigned long STARS_LoopInductionVarIDFailures;
extern unsigned long STARS_LoopIterationExprSuccesses;
extern unsigned long STARS_LoopIterationExprFailures;
// strings for printing ZST_SysCallType
......
......@@ -35,7 +35,7 @@ class STARS_op_t
virtual STARS_uval_t GetImmedValue(void) const = 0; // Get value field for immediate operands; uint32 for x86-32, uint64 for x86-64
virtual char GetOpDtyp(void) const = 0; // Get field that determines byte width
virtual uint16_t GetByteWidth(void) const = 0;
virtual void MDExtractAddressFields(int &BaseReg, int &IndexReg, uint16_t &Scale, STARS_ea_t &Offset);
virtual void MDExtractAddressFields(int &BaseReg, int &IndexReg, uint16_t &Scale, STARS_ea_t &Offset) const;
virtual void GetAddressRegs(std::set<STARS_regnum_t> &AddressRegs) const;
// Set methods
......
......@@ -7187,8 +7187,12 @@ STARS_ea_t SMPBasicBlock::FindFixedCallFallThrough(void) const {
bool success = false;
STARS_InstructionID_Set_t ReferencedIDs = CurrInst->GetReferencedIDs(success);
if (success) {
assert(1 == ReferencedIDs.size());
FallThroughAddr = ReferencedIDs.cbegin()->GetIDWithinFile();
if (1 == ReferencedIDs.size()) {
FallThroughAddr = ReferencedIDs.cbegin()->GetIDWithinFile();
}
else {
SMP_msg("ERROR: Fixed call has %zu fall-through addrs.\n", ReferencedIDs.size());
}
}
break;
}
......
......@@ -141,6 +141,12 @@ unsigned long STARS_ReturnSetIncompleteTailCallChainFromOrphanCode;
unsigned long STARS_FuncReturnSetComplete;
unsigned long STARS_FuncReturnSetIncomplete;
// Loop analysis counters.
unsigned long STARS_LoopInductionVarIDSuccesses;
unsigned long STARS_LoopInductionVarIDFailures;
unsigned long STARS_LoopIterationExprSuccesses;
unsigned long STARS_LoopIterationExprFailures;
// strings for printing ZST_SysCallType
const char *CallTypeNames[4] = { "Unrestricted", "High-Privilege", "File-Access", "Network-Access" };
......@@ -7206,6 +7206,7 @@ void SMPFunction::DetectLoopInductionVars(void) {
// same induction var arithmetic.
int HeaderBlockNum = this->LoopHeadBlockNumbers[LoopIndex];
bool FoundBIV = false;
++STARS_LoopInductionVarIDFailures; // decrement later if we succeed
SMPBasicBlock *HeaderBlock = this->GetBlockByNum((size_t) HeaderBlockNum);
// Look at all register Phi functions in the HeaderBlock.
for (PhiSetIter PhiIter = HeaderBlock->GetFirstPhi(); PhiIter != HeaderBlock->GetLastPhi(); ++PhiIter) {
......@@ -7396,6 +7397,8 @@ void SMPFunction::DetectLoopInductionVars(void) {
if (InsideBIVFoundCount == CurrentFamily.BIVInsideLoopDefAddrs.size()) {
this->LoopInductionVars[LoopIndex].push_back(CurrentFamily);
SMP_msg("INFO: BIVFoundCount success for func at %llx for Loop %d \n", (uint64_t) this->GetFirstFuncAddr(), LoopIndex);
++STARS_LoopInductionVarIDSuccesses;
--STARS_LoopInductionVarIDFailures; // undo increment from top of loop
}
} // end for all Phi functions in current loop header block
if (!FoundBIV) {
......@@ -12713,6 +12716,7 @@ void SMPFunction::AnalyzeLoopIterations(void) {
for (size_t LoopIndex = 0; LoopIndex < this->LoopCount; ++LoopIndex) {
this->LoopMemRangeInArgRegsBitmap[LoopIndex] = TempBitset;
this->LoopAnalyzedBIVIters[LoopIndex] = this->LoopInductionVars[LoopIndex].end();
++STARS_LoopIterationExprFailures; // Decrement if we succeed
 
// Find the condition that terminates the loop.
struct LoopComparison CurrentLoopComparisonExpr;
......@@ -12910,6 +12914,8 @@ void SMPFunction::AnalyzeLoopIterations(void) {
(*IVarVecIter).BIVInitExpr = InitExpr;
(*IVarVecIter).BIVLimitExpr = LimitExpr;
this->LoopAnalyzedBIVIters[LoopIndex] = IVarVecIter;
--STARS_LoopIterationExprFailures; // undo top of loop increment
++STARS_LoopIterationExprSuccesses;
if (VerboseOutput) {
SMP_msg("INFO: IterationCount EXPR:");
IterationCountExpr->Dump(0);
......
......@@ -906,6 +906,8 @@ void SMPProgram::Analyze(ProfilerInformation *pi, FILE *AnnotFile, FILE *InfoAnn
#endif // not SMP_REDUCED_ANALYSIS
SMP_msg("INFO: Maximum basic block count in one function: %lu\n", STARS_MaxBlockCount);
SMP_msg("INFO: Loop induction var ID failures: %lu successes: %lu\n", STARS_LoopInductionVarIDFailures, STARS_LoopInductionVarIDSuccesses);
SMP_msg("INFO: Loop iteration expr failures: %lu successes: %lu\n", STARS_LoopIterationExprFailures, STARS_LoopIterationExprSuccesses);
return;
} // end of SMPProgram::Analyze()
......
......@@ -6,7 +6,7 @@
#include <interfaces/STARSTypes.h>
void STARS_op_t::MDExtractAddressFields(int &BaseReg, int &IndexReg, uint16_t &Scale, STARS_ea_t &Offset) {
void STARS_op_t::MDExtractAddressFields(int &BaseReg, int &IndexReg, uint16_t &Scale, STARS_ea_t &Offset) const {
assert(this->IsMemOp());
Scale = 0;
......
......@@ -325,6 +325,10 @@ void STARS_Program_t::InitData(void) {
SCCPConstantOutgoingArgWriteCount = 0;
#endif
STARS_MaxBlockCount = 0;
STARS_LoopInductionVarIDSuccesses = 0;
STARS_LoopInductionVarIDFailures = 0;
STARS_LoopIterationExprSuccesses = 0;
STARS_LoopIterationExprFailures = 0;
(void) memset(this->OptCount, 0, sizeof(this->OptCount));
(void) memset(this->AnnotationCount, 0, sizeof(this->AnnotationCount));
......