28#define DEBUG_TYPE "riscvmcexpr"
57 const auto *
DF = dyn_cast_or_null<MCDataFragment>(AUIPCSymbol->
getFragment());
63 if (
DF->getContents().size() ==
Offset) {
64 DF = dyn_cast_or_null<MCDataFragment>(
DF->getNext());
74 switch ((
unsigned)
F.getKind()) {
143 return "got_pcrel_hi";
151 return "tls_ie_pcrel_hi";
155 return "tlsdesc_load_lo";
157 return "tlsdesc_add_lo";
159 return "tlsdesc_call";
161 return "tls_gd_pcrel_hi";
230 if (!
Value.isAbsolute())
233 Res = evaluateAsInt64(
Value.getConstant());
237int64_t RISCVMCExpr::evaluateAsInt64(int64_t
Value)
const {
242 return SignExtend64<12>(
Value);
245 return ((
Value + 0x800) >> 12) & 0xfffff;
static void fixELFSymbolsInTLSFixupsImpl(const MCExpr *Expr, MCAssembler &Asm)
static RegisterPass< DebugifyFunctionPass > DF("debugify-function", "Attach debug info to a function")
PowerPC TLS Dynamic Call Fixup
This class is intended to be used as a base class for asm properties and features specific to the tar...
Binary assembler expressions.
const MCExpr * getLHS() const
Get the left-hand side expression of the binary operator.
const MCExpr * getRHS() const
Get the right-hand side expression of the binary operator.
Context object for machine code objects.
Base class for the full range of assembler expressions which are needed for parsing.
@ Unary
Unary expressions.
@ Constant
Constant expressions.
@ SymbolRef
References to labels and assigned expressions.
@ Target
Target specific expression.
@ Binary
Binary expressions.
bool evaluateAsRelocatable(MCValue &Res, const MCAssembler *Asm, const MCFixup *Fixup) const
Try to evaluate the expression to a relocatable value, i.e.
void print(raw_ostream &OS, const MCAsmInfo *MAI, bool InParens=false) const
Encode information on a single operation to perform on a byte sequence (e.g., an encoded instruction)...
Streaming machine code generation interface.
void visitUsedExpr(const MCExpr &Expr)
Represent a reference to a symbol from inside an expression.
const MCSymbol & getSymbol() const
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
uint64_t getOffset() const
MCFragment * getFragment(bool SetUsed=true) const
This represents an "assembler immediate".
int64_t getConstant() const
static MCValue get(const MCSymbolRefExpr *SymA, const MCSymbolRefExpr *SymB=nullptr, int64_t Val=0, uint32_t RefKind=0)
const MCSymbolRefExpr * getSymB() const
const MCSymbolRefExpr * getSymA() const
VariantKind getKind() const
void fixELFSymbolsInTLSFixups(MCAssembler &Asm) const override
static const RISCVMCExpr * create(const MCExpr *Expr, VariantKind Kind, MCContext &Ctx)
void printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const override
const MCFixup * getPCRelHiFixup(const MCFragment **DFOut) const
Get the corresponding PC-relative HI fixup that a VK_RISCV_PCREL_LO points to, and optionally the fra...
void visitUsedExpr(MCStreamer &Streamer) const override
@ VK_RISCV_TLSDESC_ADD_LO
@ VK_RISCV_TLSDESC_LOAD_LO
bool evaluateAsConstant(int64_t &Res) const
static StringRef getVariantKindName(VariantKind Kind)
bool evaluateAsRelocatableImpl(MCValue &Res, const MCAssembler *Asm, const MCFixup *Fixup) const override
const MCExpr * getSubExpr() const
static VariantKind getVariantKindForName(StringRef name)
StringRef - Represent a constant reference to a string, i.e.
A switch()-like statement whose cases are string literals.
StringSwitch & Case(StringLiteral S, T Value)
LLVM Value Representation.
This class implements an extremely fast bulk output stream that can only output to a stream.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
@ fixup_riscv_tls_got_hi20
@ fixup_riscv_tls_gd_hi20
@ fixup_riscv_tlsdesc_hi20
This is an optimization pass for GlobalISel generic memory operations.