aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target/X86/X86InstrInfo.cpp
diff options
context:
space:
mode:
authorNicolas Geoffray <nicolas.geoffray@lip6.fr>2008-04-20 23:36:47 +0000
committerNicolas Geoffray <nicolas.geoffray@lip6.fr>2008-04-20 23:36:47 +0000
commit546e36a2c17f9eb7b2b1f2f19e522673153948aa (patch)
treec8244dda473f7ebc93cffb19055980878160d1b4 /lib/Target/X86/X86InstrInfo.cpp
parentbd3401fa98b578080e227afce940bca80137dea6 (diff)
downloadexternal_llvm-546e36a2c17f9eb7b2b1f2f19e522673153948aa.zip
external_llvm-546e36a2c17f9eb7b2b1f2f19e522673153948aa.tar.gz
external_llvm-546e36a2c17f9eb7b2b1f2f19e522673153948aa.tar.bz2
Don't forget to update the current operand when getting the size of an instruction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50007 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/X86/X86InstrInfo.cpp')
-rw-r--r--lib/Target/X86/X86InstrInfo.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/lib/Target/X86/X86InstrInfo.cpp b/lib/Target/X86/X86InstrInfo.cpp
index 280809d..8b31f5d 100644
--- a/lib/Target/X86/X86InstrInfo.cpp
+++ b/lib/Target/X86/X86InstrInfo.cpp
@@ -2670,6 +2670,7 @@ static unsigned GetInstSizeWithDesc(const MachineInstr &MI,
case X86II::AddRegFrm:
++FinalSize;
+ ++CurOp;
if (CurOp != NumOps) {
const MachineOperand &MO1 = MI.getOperand(CurOp++);
@@ -2696,16 +2697,20 @@ static unsigned GetInstSizeWithDesc(const MachineInstr &MI,
++FinalSize;
FinalSize += sizeRegModRMByte();
CurOp += 2;
- if (CurOp != NumOps)
+ if (CurOp != NumOps) {
+ ++CurOp;
FinalSize += sizeConstant(X86InstrInfo::sizeOfImm(Desc));
+ }
break;
}
case X86II::MRMDestMem: {
++FinalSize;
FinalSize += getMemModRMByteSize(MI, CurOp, IsPIC, Is64BitMode);
CurOp += 5;
- if (CurOp != NumOps)
+ if (CurOp != NumOps) {
+ ++CurOp;
FinalSize += sizeConstant(X86InstrInfo::sizeOfImm(Desc));
+ }
break;
}
@@ -2713,8 +2718,10 @@ static unsigned GetInstSizeWithDesc(const MachineInstr &MI,
++FinalSize;
FinalSize += sizeRegModRMByte();
CurOp += 2;
- if (CurOp != NumOps)
+ if (CurOp != NumOps) {
+ ++CurOp;
FinalSize += sizeConstant(X86InstrInfo::sizeOfImm(Desc));
+ }
break;
case X86II::MRMSrcMem: {
@@ -2722,8 +2729,10 @@ static unsigned GetInstSizeWithDesc(const MachineInstr &MI,
++FinalSize;
FinalSize += getMemModRMByteSize(MI, CurOp+1, IsPIC, Is64BitMode);
CurOp += 5;
- if (CurOp != NumOps)
+ if (CurOp != NumOps) {
+ ++CurOp;
FinalSize += sizeConstant(X86InstrInfo::sizeOfImm(Desc));
+ }
break;
}
@@ -2732,6 +2741,7 @@ static unsigned GetInstSizeWithDesc(const MachineInstr &MI,
case X86II::MRM4r: case X86II::MRM5r:
case X86II::MRM6r: case X86II::MRM7r:
++FinalSize;
+ ++CurOp;
FinalSize += sizeRegModRMByte();
if (CurOp != NumOps) {