29 #define DEBUG_TYPE "riscvmcexpr" 60 const auto *
DF = dyn_cast_or_null<MCDataFragment>(AUIPCSymbol->
getFragment());
66 if (
DF->getContents().size() ==
Offset) {
67 DF = dyn_cast_or_null<MCDataFragment>(
DF->getNextNode());
77 switch ((
unsigned)
F.getKind()) {
153 return "got_pcrel_hi";
161 return "tls_ie_pcrel_hi";
163 return "tls_gd_pcrel_hi";
229 int64_t RISCVMCExpr::evaluateAsInt64(int64_t
Value)
const {
234 return SignExtend64<12>(
Value);
237 return ((Value + 0x800) >> 12) & 0xfffff;
bool evaluateAsConstant(int64_t &Res) const
This class represents lattice values for constants.
This represents an "assembler immediate".
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
static void fixELFSymbolsInTLSFixupsImpl(const MCExpr *Expr, MCAssembler &Asm)
void printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const override
VariantKind getKind() const
const MCExpr * getLHS() const
Get the left-hand side expression of the binary operator.
bool isAbsolute() const
Is this an absolute (as opposed to relocatable) value.
static StringRef getVariantKindName(VariantKind Kind)
StringSwitch & Case(StringLiteral S, T Value)
Encode information on a single operation to perform on a byte sequence (e.g., an encoded instruction)...
int64_t getConstant() const
const MCSymbolRefExpr * getSymB() const
Encapsulates the layout of an assembly file at a particular point in time.
Base class for the full range of assembler expressions which are needed for parsing.
LLVM_NODISCARD R Default(T Value)
Represent a reference to a symbol from inside an expression.
Context object for machine code objects.
bool evaluateAsRelocatable(MCValue &Res, const MCAsmLayout *Layout, const MCFixup *Fixup) const
Try to evaluate the expression to a relocatable value, i.e.
const MCExpr * getRHS() const
Get the right-hand side expression of the binary operator.
const MCExpr * getSubExpr() const
This class is intended to be used as a base class for asm properties and features specific to the tar...
A switch()-like statement whose cases are string literals.
Streaming machine code generation interface.
void print(raw_ostream &OS, const MCAsmInfo *MAI, bool InParens=false) const
const MCSymbolRefExpr * getSymA() const
uint64_t getOffset() const
Binary assembler expressions.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
static RegisterPass< DebugifyFunctionPass > DF("debugify-function", "Attach debug info to a function")
const MCSymbol & getSymbol() const
MCFragment * getFragment(bool SetUsed=true) const
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(const MCExpr &Expr)
bool evaluateAsRelocatableImpl(MCValue &Res, const MCAsmLayout *Layout, const MCFixup *Fixup) const override
void fixELFSymbolsInTLSFixups(MCAssembler &Asm) const override
static VariantKind getVariantKindForName(StringRef name)
References to labels and assigned expressions.
LLVM Value Representation.
This class implements an extremely fast bulk output stream that can only output to a stream...
StringRef - Represent a constant reference to a string, i.e.
Target specific expression.
void visitUsedExpr(MCStreamer &Streamer) const override
static const RISCVMCExpr * create(const MCExpr *Expr, VariantKind Kind, MCContext &Ctx)