llvm.org GIT mirror llvm / b8768dc
ARM handle :lower16: and :upper16: after a '#' prefix. rdar://11252521 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@154862 91177308-0d34-0410-b5e6-96231b3b80d8 Jim Grosbach 8 years ago
1 changed file(s) with 18 addition(s) and 14 deletion(s). Raw diff Collapse all Expand all
45254525 case AsmToken::Dollar:
45264526 case AsmToken::Hash: {
45274527 // #42 -> immediate.
4528 // TODO: ":lower16:" and ":upper16:" modifiers after # before immediate
45294528 S = Parser.getTok().getLoc();
45304529 Parser.Lex();
4531 bool isNegative = Parser.getTok().is(AsmToken::Minus);
4532 const MCExpr *ImmVal;
4533 if (getParser().ParseExpression(ImmVal))
4534 return true;
4535 const MCConstantExpr *CE = dyn_cast(ImmVal);
4536 if (CE) {
4537 int32_t Val = CE->getValue();
4538 if (isNegative && Val == 0)
4539 ImmVal = MCConstantExpr::Create(INT32_MIN, getContext());
4540 }
4541 E = SMLoc::getFromPointer(Parser.getTok().getLoc().getPointer() - 1);
4542 Operands.push_back(ARMOperand::CreateImm(ImmVal, S, E));
4543 return false;
4530
4531 if (Parser.getTok().isNot(AsmToken::Colon)) {
4532 bool isNegative = Parser.getTok().is(AsmToken::Minus);
4533 const MCExpr *ImmVal;
4534 if (getParser().ParseExpression(ImmVal))
4535 return true;
4536 const MCConstantExpr *CE = dyn_cast(ImmVal);
4537 if (CE) {
4538 int32_t Val = CE->getValue();
4539 if (isNegative && Val == 0)
4540 ImmVal = MCConstantExpr::Create(INT32_MIN, getContext());
4541 }
4542 E = SMLoc::getFromPointer(Parser.getTok().getLoc().getPointer() - 1);
4543 Operands.push_back(ARMOperand::CreateImm(ImmVal, S, E));
4544 return false;
4545 }
4546 // w/ a ':' after the '#', it's just like a plain ':'.
4547 // FALLTHROUGH
45444548 }
45454549 case AsmToken::Colon: {
45464550 // ":lower16:" and ":upper16:" expression prefixes