Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
aidanhs committed Feb 14, 2017
1 parent daf38d7 commit bc686ed
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions lib/Target/X86/X86InstrBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,11 @@ addOffset(const MachineInstrBuilder &MIB, int Offset) {
return MIB.addImm(1).addReg(0).addImm(Offset).addReg(0);
}

static inline const MachineInstrBuilder &
addOffset(const MachineInstrBuilder &MIB, const MachineOperand& Offset) {
return MIB.addImm(1).addReg(0).addOperand(Offset).addReg(0);
}

/// addRegOffset - This function is used to add a memory reference of the form
/// [Reg + Offset], i.e., one with no scale or index, but with a
/// displacement. An example is: DWORD PTR [EAX + 4].
Expand Down
6 changes: 3 additions & 3 deletions lib/Target/X86/X86InstrInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3084,7 +3084,7 @@ X86InstrInfo::convertToThreeAddress(MachineFunction::iterator &MFI,
NewMI = addOffset(BuildMI(MF, MI.getDebugLoc(), get(X86::LEA64r))
.addOperand(Dest)
.addOperand(Src),
MI.getOperand(2).getImm());
MI.getOperand(2));
break;
case X86::ADD32ri:
case X86::ADD32ri8:
Expand All @@ -3107,7 +3107,7 @@ X86InstrInfo::convertToThreeAddress(MachineFunction::iterator &MFI,
if (ImplicitOp.getReg() != 0)
MIB.addOperand(ImplicitOp);

NewMI = addOffset(MIB, MI.getOperand(2).getImm());
NewMI = addOffset(MIB, MI.getOperand(2));
break;
}
case X86::ADD16ri:
Expand All @@ -3121,7 +3121,7 @@ X86InstrInfo::convertToThreeAddress(MachineFunction::iterator &MFI,
NewMI = addOffset(BuildMI(MF, MI.getDebugLoc(), get(X86::LEA16r))
.addOperand(Dest)
.addOperand(Src),
MI.getOperand(2).getImm());
MI.getOperand(2));
break;
}

Expand Down

0 comments on commit bc686ed

Please sign in to comment.