18#define DEBUG_TYPE "ppcmcexpr"
68 if (!
Value.isAbsolute())
71 Res = evaluateAsInt64(
Value.getConstant());
76PPCMCExpr::evaluateAsInt64(int64_t
Value)
const {
79 return Value & 0xffff;
81 return (
Value >> 16) & 0xffff;
83 return ((
Value + 0x8000) >> 16) & 0xffff;
85 return (
Value >> 16) & 0xffff;
87 return ((
Value + 0x8000) >> 16) & 0xffff;
89 return (
Value >> 32) & 0xffff;
91 return ((
Value + 0x8000) >> 32) & 0xffff;
93 return (
Value >> 48) & 0xffff;
95 return ((
Value + 0x8000) >> 48) & 0xffff;
111 if (
Value.isAbsolute()) {
112 int64_t Result = evaluateAsInt64(
Value.getConstant());
118 bool IsHalf = IsHalf16 || IsHalf16DS || IsHalf16DQ;
120 if (!IsHalf && Result >= 0x8000)
122 if ((IsHalf16DS && (Result & 0x3)) || (IsHalf16DQ && (Result & 0xf)))
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...
Encapsulates the layout of an assembly file at a particular point in time.
MCAssembler & getAssembler() const
Get the assembler object this is a layout for.
MCContext & getContext() const
Context object for machine code objects.
Base class for the full range of assembler expressions which are needed for parsing.
bool evaluateAsRelocatable(MCValue &Res, const MCAsmLayout *Layout, 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
static const MCSymbolRefExpr * create(const MCSymbol *Symbol, MCContext &Ctx)
VariantKind getKind() const
This represents an "assembler immediate".
static MCValue get(const MCSymbolRefExpr *SymA, const MCSymbolRefExpr *SymB=nullptr, int64_t Val=0, uint32_t RefKind=0)
void printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const override
static const PPCMCExpr * create(VariantKind Kind, const MCExpr *Expr, MCContext &Ctx)
const MCExpr * getSubExpr() const
getSubExpr - Get the child of this expression.
bool evaluateAsRelocatableImpl(MCValue &Res, const MCAsmLayout *Layout, const MCFixup *Fixup) const override
void visitUsedExpr(MCStreamer &Streamer) const override
bool evaluateAsConstant(int64_t &Res) const
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_ppc_half16
A 16-bit fixup corresponding to lo16(_foo) or ha16(_foo) for instrs like 'li' or 'addis'.
@ fixup_ppc_half16dq
A 16-bit fixup corresponding to lo16(_foo) with implied 3 zero bits for instrs like 'lxv'.
@ fixup_ppc_half16ds
A 14-bit fixup corresponding to lo16(_foo) with implied 2 zero bits for instrs like 'std'.
This is an optimization pass for GlobalISel generic memory operations.