diff options
Diffstat (limited to 'compiler/x86/rax86.pas')
-rw-r--r-- | compiler/x86/rax86.pas | 28 |
1 files changed, 8 insertions, 20 deletions
diff --git a/compiler/x86/rax86.pas b/compiler/x86/rax86.pas index 391ed7ad05..e3b91a0ac0 100644 --- a/compiler/x86/rax86.pas +++ b/compiler/x86/rax86.pas @@ -47,8 +47,9 @@ type Function CheckOperand: boolean; override; end; + { Operands are always in AT&T order. + Intel reader attaches them right-to-left, then shifts to start with 1 } Tx86Instruction=class(TInstruction) - OpOrder : TOperandOrder; opsize : topsize; constructor Create(optype : tcoperand);override; { Operand sizes } @@ -56,7 +57,6 @@ type procedure SetInstructionOpsize; procedure CheckOperandSizes; procedure CheckNonCommutativeOpcodes; - procedure SwapOperands; { Additional actions required by specific reader } procedure FixupOpcode;virtual; { opcode adding } @@ -295,16 +295,6 @@ begin end; -procedure Tx86Instruction.SwapOperands; -begin - Inherited SwapOperands; - { mark the correct order } - if OpOrder=op_intel then - OpOrder:=op_att - else - OpOrder:=op_intel; -end; - const {$ifdef x86_64} topsize2memsize: array[topsize] of integer = @@ -437,7 +427,11 @@ begin memopsize := 0; case operands[i].opr.typ of OPR_LOCAL: memopsize := operands[i].opr.localvarsize * 8; - OPR_REFERENCE: memopsize := operands[i].opr.varsize * 8; + OPR_REFERENCE: + if operands[i].opr.ref.refaddr = addr_pic then + memopsize := sizeof(pint) * 8 + else + memopsize := operands[i].opr.varsize * 8; end; if memopsize = 0 then memopsize := topsize2memsize[tx86operand(operands[i]).opsize]; @@ -800,8 +794,6 @@ procedure Tx86Instruction.SetInstructionOpsize; begin if opsize<>S_NO then exit; - if (OpOrder=op_intel) then - SwapOperands; case ops of 0 : ; 1 : @@ -937,8 +929,6 @@ end; but before swapping in the NASM and TASM writers PM } procedure Tx86Instruction.CheckNonCommutativeOpcodes; begin - if (OpOrder=op_intel) then - SwapOperands; if ( (ops=2) and (operands[1].opr.typ=OPR_REGISTER) and @@ -998,8 +988,6 @@ var ai : taicpu; begin ConcatInstruction:=nil; - if (OpOrder=op_intel) then - SwapOperands; ai:=nil; for i:=1 to Ops do @@ -1160,7 +1148,7 @@ begin ai:=taicpu.op_none(opcode,siz); ai.fileinfo:=filepos; - ai.SetOperandOrder(OpOrder); + ai.SetOperandOrder(op_att); ai.Ops:=Ops; ai.Allocate_oper(Ops); for i:=1 to Ops do |