llvm.org GIT mirror llvm / 3e08131
Intel syntax: Parse memory operand with empty base reg, e.g. DWORD PTR [4*RDI] git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148721 91177308-0d34-0410-b5e6-96231b3b80d8 Devang Patel 8 years ago
2 changed file(s) with 19 addition(s) and 7 deletion(s). Raw diff Collapse all Expand all
617617 return X86Operand::CreateMem(Disp, Start, End, Size);
618618 }
619619 } else if (getLexer().is(AsmToken::Integer)) {
620 // Handle '[' number ']'
621 const MCExpr *Disp = MCConstantExpr::Create(0, getParser().getContext());
622 if (getParser().ParseExpression(Disp, End)) return 0;
623 if (getLexer().isNot(AsmToken::RBrac))
624 return ErrorOperand(Start, "Expected ']' token!");
620 int64_t Val = Parser.getTok().getIntVal();
625621 Parser.Lex();
626 return X86Operand::CreateMem(Disp, Start, End, Size);
622 SMLoc Loc = Parser.getTok().getLoc();
623 if (getLexer().is(AsmToken::RBrac)) {
624 // Handle '[' number ']'
625 Parser.Lex();
626 return X86Operand::CreateMem(MCConstantExpr::Create(Val, getContext()),
627 Start, End, Size);
628 } else if (getLexer().is(AsmToken::Star)) {
629 // Handle '[' Scale*IndexReg ']'
630 Parser.Lex();
631 SMLoc IdxRegLoc = Parser.getTok().getLoc();
632 if (ParseRegister(IndexReg, IdxRegLoc, End))
633 return ErrorOperand(IdxRegLoc, "Expected register");
634 Scale = Val;
635 } else
636 return ErrorOperand(Loc, "Unepxeted token");
627637 }
628638
629639 if (getLexer().is(AsmToken::Plus) || getLexer().is(AsmToken::Minus)) {
5555 // CHECK: fld %st(0)
5656 fld ST(0)
5757 // CHECK: movl %fs:(%rdi), %eax
58 mov EAX, DWORD PTR FS:[RDI]
58 mov EAX, DWORD PTR FS:[RDI]
59 // CHECK: leal (,%rdi,4), %r8d
60 lea R8D, DWORD PTR [4*RDI]
5961 ret