Skip to content

Commit

Permalink
Add common/arch-power.C
Browse files Browse the repository at this point in the history
  • Loading branch information
hainest committed Apr 3, 2024
1 parent 76c7942 commit 1dfa972
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
8 changes: 0 additions & 8 deletions common/src/arch-power.C
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ Dyninst::Address instruction::getTarget(Dyninst::Address addr) const {
return 0;
}

// TODO: argument _needs_ to be an int, or ABS() doesn't work.
void instruction::setBranchOffset(Dyninst::Address newOffset) {
if (isUncondBranch()) {
assert(ABS((int) newOffset) < MAX_BRANCH);
Expand Down Expand Up @@ -134,7 +133,6 @@ unsigned instruction::jumpSize(Dyninst::Address from, Dyninst::Address to, unsig
return jumpSize(disp, addr_width);
}

// -1 is infinite, don't ya know.
unsigned instruction::jumpSize(Dyninst::Address disp, unsigned addr_width) {
if (ABS(disp) >= MAX_BRANCH) {
return maxInterFunctionJumpSize(addr_width);
Expand Down Expand Up @@ -207,12 +205,6 @@ bool instruction::getUsedRegs(std::vector<int> &) {
return false;
}

// A thunk is a "get PC" operation. We consider
// an instruction to be a thunk if it fulfills the following
// requirements:
// 1) It is unconditional or a "branch always" conditional
// 2) It has an offset of 4
// 3) It saves the return address in the link register
bool instruction::isThunk() const {
switch (BFORM_OP(*this)) {
case Bop:
Expand Down
3 changes: 3 additions & 0 deletions docs/common/developer/arch-power.h.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ arch-power.h
.. cpp:function:: static unsigned size()
.. cpp:function:: Dyninst::Address getBranchOffset() const
.. cpp:function:: void setBranchOffset(Dyninst::Address newOffset)

TODO: argument *needs* to be an int, or ``ABS()`` doesn't work.

.. cpp:function:: static unsigned jumpSize(Dyninst::Address from, Dyninst::Address to, unsigned addr_width)
.. cpp:function:: static unsigned jumpSize(Dyninst::Address disp, unsigned addr_width)
.. cpp:function:: static unsigned maxJumpSize(unsigned addr_width)
Expand Down

0 comments on commit 1dfa972

Please sign in to comment.