Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SMPStaticAnalyzer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Open Source Software
SMPStaticAnalyzer
Commits
71af0441
Commit
71af0441
authored
8 years ago
by
clc5q
Browse files
Options
Downloads
Patches
Plain Diff
Fixes for induction var analysis; code cleanup for cGC.
Former-commit-id: 0fb0ae8c5cc0841458a435d70e534a1dcd00a9b0
parent
536986e5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/base/SMPFunction.cpp
+9
-19
9 additions, 19 deletions
src/base/SMPFunction.cpp
src/base/SMPInstr.cpp
+16
-7
16 additions, 7 deletions
src/base/SMPInstr.cpp
with
25 additions
and
26 deletions
src/base/SMPFunction.cpp
+
9
−
19
View file @
71af0441
...
...
@@ -3978,13 +3978,13 @@ void SMPFunction::AnalyzeFunc(void) {
CurrInst->SetBlock(CurrBlock->GetThisBlock());
// jdh hack: redo syscall analysis as block may not be set
// when syscall analysis was done first time.
if (CurrInst->GetDataFlowType() == INDIR_CALL) {
if (CurrInst->MDIsSystemCall()) {
this->SetHasSystemCalls();
}
}
// jdh hack: redo syscall analysis as block may not be set
// when syscall analysis was done first time.
if (CurrInst->GetDataFlowType() == INDIR_CALL) {
if (CurrInst->MDIsSystemCall()) {
this->SetHasSystemCalls();
}
}
SMPitype InstDataFlowType = CurrInst->GetDataFlowType();
if ((CALL == InstDataFlowType) || (INDIR_CALL == InstDataFlowType)) {
...
...
@@ -5992,6 +5992,7 @@ void SMPFunction::DetectLoopInductionVars(void) {
int SecondOpSSANum = SMP_SSA_UNINIT;
if (!BIVarFound && MDIsDataFlowOpnd(SecondOp, UseFP) && this->IsGlobalName(SecondOp)) {
STARSOpndTypePtr SearchOp = CloneIfNecessary(SecondOp, UseFP);
CanonicalizeOpnd(SearchOp);
STARSDefUseIter SecondOpUseIter = InsideDefInst->FindUse(SearchOp);
assert(SecondOpUseIter != InsideDefInst->GetLastUse());
SecondOpSSANum = SecondOpUseIter->GetSSANum();
...
...
@@ -6000,7 +6001,7 @@ void SMPFunction::DetectLoopInductionVars(void) {
// Note that block-local names are loop-variant and are already excluded.
SMPBasicBlock *InsideDefBlock = this->GetBlockByNum((size_t) PhiUseDefBlockNum1);
assert(NULL != InsideDefBlock);
STARS_ea_t SecondOpDefAddr = InsideDefBlock->GetDefAddrFromUseAddr(Se
cond
Op, InsideDefAddr, UseIter->GetSSANum(), false);
STARS_ea_t SecondOpDefAddr = InsideDefBlock->GetDefAddrFromUseAddr(Se
arch
Op, InsideDefAddr,
SecondOp
UseIter->GetSSANum(), false);
assert(STARS_BADADDR != SecondOpDefAddr);
int SecondOpDefBlockNum = SMP_BLOCKNUM_UNINIT;
bool SecondOpDEFIsInst = false;
...
...
@@ -8702,16 +8703,6 @@ void SMPFunction::AnalyzeSystemCalls(void) {
if (!UnresolvedCallee) {
// We have an instruction addr in EAXDefAddr.
SMPInstr *EAXDefInst = this->GetInstFromAddr(EAXDefAddr);
#if 0
STARSDefUseIter DefIter = EAXDefInst->FindDef(EAXOpnd);
assert(DefIter != EAXDefInst->GetLastDef());
STARSOpndTypePtr DefOp = DefIter->GetOp();
UnresolvedCallee = (!DefOp->IsImmedOp());
if (!UnresolvedCallee) {
SysCallNumber = DefOp->GetImmedValue();
SMP_msg("INFO: System call number %u found at %llx\n", (unsigned int)SysCallNumber, (unsigned long long) EAXDefAddr);
}
#else
if (EAXDefInst == NULL)
UnresolvedCallee = true;
...
...
@@ -8745,7 +8736,6 @@ void SMPFunction::AnalyzeSystemCalls(void) {
SMP_msg("INFO: System call set of EAX determined solid. number: %u at: %llx\n",
(unsigned int) SysCallNumber, (unsigned long long) EAXDefAddr);
}
#endif
}
if (!UnresolvedCallee) { // we have a good SysCallNumber
#define CGC_RECEIVE_SYSCALL 3
...
...
This diff is collapsed.
Click to expand it.
src/base/SMPInstr.cpp
+
16
−
7
View file @
71af0441
...
...
@@ -3969,13 +3969,22 @@ bool SMPInstr::IsDependentInductionVarArithmetic(STARSOpndTypePtr &Mult1, STARSO
STARS_ea_t offset;
LeaOpnd->MDExtractAddressFields(BaseReg, IndexReg, Scale, offset);
if (STARS_x86_R_none == IndexReg) {
// Simple case: Lhs := BaseReg + offset
STARS_uval_t ImmedValue = (STARS_uval_t) offset;
Add1 = this->MakeRegOpnd((STARS_regnum_t) BaseReg);
Add2 = this->MakeImmediateOpnd(ImmedValue);
Mult1 = nullptr;
Mult2 = nullptr;
DIVOperation = true;
if (STARS_x86_R_none != BaseReg) {
// Simple case: Lhs := BaseReg + offset
STARS_uval_t ImmedValue = (STARS_uval_t)offset;
Add1 = this->MakeRegOpnd((STARS_regnum_t)BaseReg);
Add2 = this->MakeImmediateOpnd(ImmedValue);
Mult1 = nullptr;
Mult2 = nullptr;
DIVOperation = true;
}
else { // both regs are null, e.g. PC-relative expression
Add1 = nullptr;
Add2 = nullptr;
Mult1 = nullptr;
Mult2 = nullptr;
DIVOperation = false;
}
}
else {
STARS_uval_t ImmedValue = (STARS_uval_t) offset;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment