Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Z
Zipr Toolchain
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
Zipr Toolchain
Commits
a189207e
Commit
a189207e
authored
5 years ago
by
Jason Hiser
Browse files
Options
Downloads
Patches
Plain Diff
added fallthrough for uncond branchs/rets for mips due to delay slotting
parent
42d75e71
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
irdb-libs/ir_builders/fill_in_cfg.cpp
+23
-18
23 additions, 18 deletions
irdb-libs/ir_builders/fill_in_cfg.cpp
with
23 additions
and
18 deletions
irdb-libs/ir_builders/fill_in_cfg.cpp
+
23
−
18
View file @
a189207e
...
@@ -68,7 +68,9 @@ void PopulateCFG::populate_instruction_map
...
@@ -68,7 +68,9 @@ void PopulateCFG::populate_instruction_map
void
PopulateCFG
::
set_fallthrough
void
PopulateCFG
::
set_fallthrough
(
(
InstructionMap_t
&
insnMap
,
InstructionMap_t
&
insnMap
,
DecodedInstruction_t
*
disasm
,
Instruction_t
*
insn
,
FileIR_t
*
firp
DecodedInstruction_t
*
disasm
,
Instruction_t
*
insn
,
FileIR_t
*
firp
)
)
{
{
assert
(
disasm
);
assert
(
disasm
);
...
@@ -77,14 +79,20 @@ void PopulateCFG::set_fallthrough
...
@@ -77,14 +79,20 @@ void PopulateCFG::set_fallthrough
if
(
insn
->
getFallthrough
())
if
(
insn
->
getFallthrough
())
return
;
return
;
// check for branches with targets
const
auto
is_mips
=
firp
->
getArchitecture
()
->
getMachineType
()
==
admtMips32
;
if
(
// always set fallthrough for mips
(
disasm
->
isUnconditionalBranch
()
)
||
// it is a unconditional branch
// other platforms can end fallthroughs ofr uncond branches and returns
(
disasm
->
isReturn
())
// or a return
if
(
!
is_mips
)
)
{
{
// this is a branch with no fallthrough instruction
// check for branches with targets
return
;
if
(
(
disasm
->
isUnconditionalBranch
()
)
||
// it is a unconditional branch
(
disasm
->
isReturn
())
// or a return
)
{
// this is a branch with no fallthrough instruction
return
;
}
}
}
/* get the address of the next instrution */
/* get the address of the next instrution */
...
@@ -127,17 +135,14 @@ void PopulateCFG::set_delay_slots
...
@@ -127,17 +135,14 @@ void PopulateCFG::set_delay_slots
if
(
!
is_mips
)
if
(
!
is_mips
)
return
;
return
;
for
(
auto
&
insn
:
firp
->
getInstructions
())
// using df=DecodedInstruction_t::factory;
const
auto
d
=
DecodedInstruction_t
::
factory
(
insn
);
if
(
d
->
isBranch
())
{
{
// using df=DecodedInstruction_t::factory;
const
auto
branch_addr
=
insn
->
getAddress
();
const
auto
d
=
DecodedInstruction_t
::
factory
(
insn
);
const
auto
delay_slot_insn
=
insnMap
[
{
branch_addr
->
getFileID
(),
branch_addr
->
getVirtualOffset
()
+
4
}];
if
(
d
->
isBranch
())
assert
(
delay_slot_insn
);
{
(
void
)
firp
->
addNewRelocation
(
insn
,
0
,
"delay_slot1"
,
delay_slot_insn
,
0
);
const
auto
branch_addr
=
insn
->
getAddress
();
const
auto
delay_slot_insn
=
insnMap
[
{
branch_addr
->
getFileID
(),
branch_addr
->
getVirtualOffset
()
+
4
}];
assert
(
delay_slot_insn
);
(
void
)
firp
->
addNewRelocation
(
insn
,
0
,
"delay_slot1"
,
delay_slot_insn
,
0
);
}
}
}
}
}
...
...
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