diff options
author | Eric Astor <epastor@google.com> | 2019-12-30 14:33:56 -0500 |
---|---|---|
committer | Eric Astor <epastor@google.com> | 2019-12-30 14:35:26 -0500 |
commit | 4a7aa252a32a94b1bb61b3dc7f027b4a27ae334f (patch) | |
tree | 3f0579bbc96ff818ae4bc5de945b687f72d2f586 /llvm/lib/Target/X86/AsmParser/X86Operand.h | |
parent | 7fa0bfe7d580e2b96b8d7f5bd0470287857e84cc (diff) | |
download | bcm5719-llvm-4a7aa252a32a94b1bb61b3dc7f027b4a27ae334f.tar.gz bcm5719-llvm-4a7aa252a32a94b1bb61b3dc7f027b4a27ae334f.zip |
[X86][AsmParser] re-introduce 'offset' operator
Summary:
Amend MS offset operator implementation, to more closely fit with its MS counterpart:
1. InlineAsm: evaluate non-local source entities to their (address) location
2. Provide a mean with which one may acquire the address of an assembly label via MS syntax, rather than yielding a memory reference (i.e. "offset asm_label" and "$asm_label" should be synonymous
3. address PR32530
Based on http://llvm.org/D37461
Fix broken test where the break appears unrelated.
- Set up appropriate memory-input rewrites for variable references.
- Intel-dialect assembly printing now correctly handles addresses by adding "offset".
- Pass offsets as immediate operands (using "r" constraint for offsets of locals).
Reviewed By: rnk
Differential Revision: https://reviews.llvm.org/D71436
Diffstat (limited to 'llvm/lib/Target/X86/AsmParser/X86Operand.h')
-rw-r--r-- | llvm/lib/Target/X86/AsmParser/X86Operand.h | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/llvm/lib/Target/X86/AsmParser/X86Operand.h b/llvm/lib/Target/X86/AsmParser/X86Operand.h index 93626f8254e..36b8bc4e65f 100644 --- a/llvm/lib/Target/X86/AsmParser/X86Operand.h +++ b/llvm/lib/Target/X86/AsmParser/X86Operand.h @@ -53,6 +53,7 @@ struct X86Operand final : public MCParsedAsmOperand { struct ImmOp { const MCExpr *Val; + bool LocalRef; }; struct MemOp { @@ -279,13 +280,9 @@ struct X86Operand final : public MCParsedAsmOperand { return isImmUnsignedi8Value(CE->getValue()); } - bool isOffsetOf() const override { - return OffsetOfLoc.getPointer(); - } + bool isOffsetOfLocal() const override { return isImm() && Imm.LocalRef; } - bool needAddressOf() const override { - return AddressOf; - } + bool needAddressOf() const override { return AddressOf; } bool isCallOperand() const override { return CallOperand; } void setCallOperand(bool IsCallOperand) { CallOperand = IsCallOperand; } @@ -617,9 +614,16 @@ struct X86Operand final : public MCParsedAsmOperand { } static std::unique_ptr<X86Operand> CreateImm(const MCExpr *Val, - SMLoc StartLoc, SMLoc EndLoc) { + SMLoc StartLoc, SMLoc EndLoc, + StringRef SymName = StringRef(), + void *OpDecl = nullptr, + bool GlobalRef = true) { auto Res = std::make_unique<X86Operand>(Immediate, StartLoc, EndLoc); - Res->Imm.Val = Val; + Res->Imm.Val = Val; + Res->Imm.LocalRef = !GlobalRef; + Res->SymName = SymName; + Res->OpDecl = OpDecl; + Res->AddressOf = true; return Res; } |