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;
109 if (
Value.isAbsolute()) {
110 int64_t Result = evaluateAsInt64(
Value.getConstant());
116 bool IsHalf = IsHalf16 || IsHalf16DS || IsHalf16DQ;
118 if (!IsHalf && Result >= 0x8000)
120 if ((IsHalf16DS && (Result & 0x3)) || (IsHalf16DQ && (Result & 0xf)))
125 if (!Asm || !Asm->hasLayout())
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...
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 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.
static const MCSymbolRefExpr * create(const MCSymbol *Symbol, MCContext &Ctx)
This represents an "assembler immediate".
static MCValue get(const MCSymbolRefExpr *SymA, const MCSymbolRefExpr *SymB=nullptr, int64_t Val=0, uint32_t RefKind=0)
bool evaluateAsRelocatableImpl(MCValue &Res, const MCAssembler *Asm, const MCFixup *Fixup) const override
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.
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.