Skip to content

Commit

Permalink
Issue #28: fix stackarg popping bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
lialan committed Nov 18, 2019
1 parent b5c6e71 commit 4325524
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/Target/EVM/EVMArgumentMove.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ void EVMArgumentMove::arrangeStackArgs(MachineFunction& MF) const {
MachineRegisterInfo &MRI = MF.getRegInfo();

unsigned numStackArgs = MFI->getNumStackArgs();
BitVector stackargs(numStackArgs, false);

// we plus one so that the return address is included
BitVector stackargs(numStackArgs + 1, false);

MachineBasicBlock &EntryMBB = MF.front();

Expand All @@ -89,7 +91,9 @@ void EVMArgumentMove::arrangeStackArgs(MachineFunction& MF) const {
unsigned returnAddrReg = 0;

// the stack arrangement is:
// (top) 1st argument, 2nd argument, 3rd argument, ..., return address (bottom)
// (top) 1st argument, 2nd argument, 3rd argument, ..., return address
// (bottom) Iterate over stack args, excluding the index zero one (return
// address slot)
for (int i = stackargs.size() - 1; i >= 1 ; --i) {
// create the instruction, and insert it
if (!stackargs[i]) {
Expand Down

0 comments on commit 4325524

Please sign in to comment.