Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
2
2024_compilation_Bazizi_Zaynoune
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Insights
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
BAZIZI Zakaria
2024_compilation_Bazizi_Zaynoune
Commits
5c49e733
Commit
5c49e733
authored
1 year ago
by
ZaynouneFatimaZahrae
Browse files
Options
Downloads
Patches
Plain Diff
Fg
parent
e4ecba3e
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/fg/Fg.java
+64
-6
64 additions, 6 deletions
src/fg/Fg.java
with
64 additions
and
6 deletions
src/fg/Fg.java
+
64
−
6
View file @
5c49e733
...
@@ -48,15 +48,73 @@ public class Fg implements NasmVisitor <Void> {
...
@@ -48,15 +48,73 @@ public class Fg implements NasmVisitor <Void> {
}
}
public
Void
visit
(
NasmAdd
inst
){
public
Void
visit
(
NasmAdd
inst
){
for
(
int
i
=
0
;
i
<
inst2Node
.
size
();
i
++)
return
null
;
{
NasmInst
nasmInst
=
nasm
.
sectionText
.
get
(
i
);
if
(
nasmInst
instanceof
NasmAdd
)
{
}
}
private
void
initFg
()
{
int
nbInst
=
nasm
.
sectionText
.
size
();
for
(
int
i
=
0
;
i
<
nbInst
;
i
++)
{
NasmInst
inst
=
nasm
.
sectionText
.
get
(
i
);
if
(
inst
instanceof
NasmJg
)
{
this
.
graph
.
addEdge
(
this
.
inst2Node
.
get
(
inst
),
this
.
inst2Node
.
get
(
this
.
label2Inst
.
get
(((
NasmLabel
)
inst
.
address
).
val
)));
if
(
nasm
.
sectionText
.
get
(
i
+
1
)
!=
null
)
{
NasmInst
prochaineInst
=
nasm
.
sectionText
.
get
(
i
+
1
);
this
.
graph
.
addEdge
(
this
.
inst2Node
.
get
(
inst
),
this
.
inst2Node
.
get
(
prochaineInst
));
}
}
if
(
inst
instanceof
NasmJle
)
{
this
.
graph
.
addEdge
(
this
.
inst2Node
.
get
(
inst
),
this
.
inst2Node
.
get
(
this
.
label2Inst
.
get
(((
NasmLabel
)
inst
.
address
).
val
)));
if
(
nasm
.
sectionText
.
get
(
i
+
1
)
!=
null
)
{
NasmInst
prochaineInst
=
nasm
.
sectionText
.
get
(
i
+
1
);
this
.
graph
.
addEdge
(
this
.
inst2Node
.
get
(
inst
),
this
.
inst2Node
.
get
(
prochaineInst
));
}
}
if
(
inst
instanceof
NasmJne
)
{
this
.
graph
.
addEdge
(
this
.
inst2Node
.
get
(
inst
),
this
.
inst2Node
.
get
(
this
.
label2Inst
.
get
(((
NasmLabel
)
inst
.
address
).
val
)));
if
(
nasm
.
sectionText
.
get
(
i
+
1
)
!=
null
)
{
NasmInst
prochaineInst
=
nasm
.
sectionText
.
get
(
i
+
1
);
this
.
graph
.
addEdge
(
this
.
inst2Node
.
get
(
inst
),
this
.
inst2Node
.
get
(
prochaineInst
));
}
}
if
(!
this
.
inst2Node
.
containsKey
(
inst
))
{
continue
;
}
if
(
inst
instanceof
NasmJmp
)
{
this
.
graph
.
addEdge
(
this
.
inst2Node
.
get
(
inst
),
this
.
inst2Node
.
get
(
this
.
label2Inst
.
get
(((
NasmLabel
)
(
inst
).
address
).
val
)));
continue
;
}
if
(
inst
instanceof
NasmJe
)
{
this
.
graph
.
addEdge
(
this
.
inst2Node
.
get
(
inst
),
this
.
inst2Node
.
get
(
this
.
label2Inst
.
get
(((
NasmLabel
)
inst
.
address
).
val
)));
if
(
nasm
.
sectionText
.
get
(
i
+
1
)
!=
null
)
{
NasmInst
prochaineInst
=
nasm
.
sectionText
.
get
(
i
+
1
);
this
.
graph
.
addEdge
(
this
.
inst2Node
.
get
(
inst
),
this
.
inst2Node
.
get
(
prochaineInst
));
}
}
return
null
;
}
}
if
(
inst
instanceof
NasmJe
)
{
this
.
graph
.
addEdge
(
this
.
inst2Node
.
get
(
inst
),
this
.
inst2Node
.
get
(
this
.
label2Inst
.
get
(((
NasmLabel
)
inst
.
address
).
val
)));
if
(
nasm
.
sectionText
.
get
(
i
+
1
)
!=
null
)
{
NasmInst
prochaineInst
=
nasm
.
sectionText
.
get
(
i
+
1
);
this
.
graph
.
addEdge
(
this
.
inst2Node
.
get
(
inst
),
this
.
inst2Node
.
get
(
prochaineInst
));
}
}
if
(
inst
instanceof
NasmRet
)
{
if
(
i
<
nbInst
-
1
)
{
NasmLabel
destination
=
(
NasmLabel
)
inst
.
address
;
if
(
destination
!=
null
&&
!
destination
.
val
.
equals
(
"iprintLF"
)
&&
!
destination
.
val
.
equals
(
"atoi"
)
&&
!
destination
.
val
.
equals
(
"readline"
))
{
this
.
graph
.
addEdge
(
this
.
inst2Node
.
get
(
inst
),
this
.
inst2Node
.
get
(
nasm
.
sectionText
.
get
(
i
+
1
)));
}
}
continue
;
}
if
(
inst
instanceof
NasmRet
)
{
continue
;
}
if
(
i
<
nasm
.
sectionText
.
size
()
-
1
)
{
NasmInst
InstPro
=
nasm
.
sectionText
.
get
(
i
+
1
);
this
.
graph
.
addEdge
(
this
.
inst2Node
.
get
(
inst
),
this
.
inst2Node
.
get
(
InstPro
));
}
}
}
public
Void
visit
(
NasmCall
inst
){
public
Void
visit
(
NasmCall
inst
){
return
null
;
return
null
;
}
}
...
...
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