[PATCH] D47545: [MC][X86] Allow assembler variable assignment to register name.
Reid Kleckner via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed May 30 14:21:58 PDT 2018
rnk added inline comments.
================
Comment at: llvm/lib/MC/MCParser/AsmParser.cpp:1114-1121
// If this is an absolute variable reference, substitute it now to preserve
// semantics in the face of reassignment.
- if (Sym->isVariable() &&
- isa<MCConstantExpr>(Sym->getVariableValue(/*SetUsed*/ false))) {
- if (Variant)
- return Error(EndLoc, "unexpected modifier on variable reference");
-
- Res = Sym->getVariableValue(/*SetUsed*/ false);
- return false;
+ if (Sym->isVariable()) {
+ auto V = Sym->getVariableValue(/*SetUsed*/ false);
+ bool DoInline = isa<MCConstantExpr>(V);
+ if (auto TV = dyn_cast<MCTargetExpr>(V))
+ DoInline = TV->inlineAssignedExpr();
----------------
Given that we already have logic like this, I'm OK with this. I guess gnu as treats `=` assignments much more textually than we do.
================
Comment at: llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp:2197
+ SMLoc StartLoc = Parser.getTok().getLoc();
+ // Normal Expression parse fails, check if it could be a register.
+ unsigned RegNo;
----------------
Does this generalize to more than just registers? Could it include things like `foo = $42`, or `foo = 0x40(%rcx)` as some kind of alias for an accessor? We might want to allow these things so that we don't have to do this fire drill again the next time a Linux developer writes some creative GNU as.
Repository:
rL LLVM
https://reviews.llvm.org/D47545
More information about the llvm-commits
mailing list