mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-04-14 06:37:33 +00:00
MC: Clean up MCExpr naming. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238634 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
3b821159da
commit
586c0042da
include/llvm/MC
lib
CodeGen
MC
ConstantPools.cppMCAsmInfo.cppMCAsmStreamer.cppMCAssembler.cpp
MCDisassembler
MCDwarf.cppMCELFStreamer.cppMCExpr.cppMCObjectStreamer.cppMCParser
MCStreamer.cppMCWin64EH.cppMachObjectWriter.cppWinCOFFStreamer.cppTarget
AArch64
ARM
Hexagon
MSP430
Mips
NVPTX
PowerPC
R600
Sparc
SystemZ
TargetLoweringObjectFile.cppX86
AsmParser
InstPrinter
MCTargetDesc
X86ELFRelocationInfo.cppX86MCAsmInfo.cppX86MCCodeEmitter.cppX86MachORelocationInfo.cppX86MachObjectWriter.cpp
X86AsmPrinter.cppX86ISelLowering.cppX86MCInstLower.cppX86TargetObjectFile.cppXCore
@ -46,7 +46,7 @@ private:
|
||||
MCExpr(const MCExpr&) = delete;
|
||||
void operator=(const MCExpr&) = delete;
|
||||
|
||||
bool EvaluateAsAbsolute(int64_t &Res, const MCAssembler *Asm,
|
||||
bool evaluateAsAbsolute(int64_t &Res, const MCAssembler *Asm,
|
||||
const MCAsmLayout *Layout,
|
||||
const SectionAddrMap *Addrs) const;
|
||||
|
||||
@ -57,7 +57,7 @@ private:
|
||||
protected:
|
||||
explicit MCExpr(ExprKind Kind) : Kind(Kind) {}
|
||||
|
||||
bool EvaluateAsRelocatableImpl(MCValue &Res, const MCAssembler *Asm,
|
||||
bool evaluateAsRelocatableImpl(MCValue &Res, const MCAssembler *Asm,
|
||||
const MCAsmLayout *Layout,
|
||||
const MCFixup *Fixup,
|
||||
const SectionAddrMap *Addrs, bool InSet) const;
|
||||
@ -86,11 +86,11 @@ public:
|
||||
/// values. If not given, then only non-symbolic expressions will be
|
||||
/// evaluated.
|
||||
/// \return - True on success.
|
||||
bool EvaluateAsAbsolute(int64_t &Res, const MCAsmLayout &Layout,
|
||||
bool evaluateAsAbsolute(int64_t &Res, const MCAsmLayout &Layout,
|
||||
const SectionAddrMap &Addrs) const;
|
||||
bool EvaluateAsAbsolute(int64_t &Res) const;
|
||||
bool EvaluateAsAbsolute(int64_t &Res, const MCAssembler &Asm) const;
|
||||
bool EvaluateAsAbsolute(int64_t &Res, const MCAsmLayout &Layout) const;
|
||||
bool evaluateAsAbsolute(int64_t &Res) const;
|
||||
bool evaluateAsAbsolute(int64_t &Res, const MCAssembler &Asm) const;
|
||||
bool evaluateAsAbsolute(int64_t &Res, const MCAsmLayout &Layout) const;
|
||||
|
||||
bool evaluateKnownAbsolute(int64_t &Res, const MCAsmLayout &Layout) const;
|
||||
|
||||
@ -101,13 +101,13 @@ public:
|
||||
/// \param Layout - The assembler layout object to use for evaluating values.
|
||||
/// \param Fixup - The Fixup object if available.
|
||||
/// \return - True on success.
|
||||
bool EvaluateAsRelocatable(MCValue &Res, const MCAsmLayout *Layout,
|
||||
bool evaluateAsRelocatable(MCValue &Res, const MCAsmLayout *Layout,
|
||||
const MCFixup *Fixup) const;
|
||||
|
||||
/// \brief Try to evaluate the expression to the form (a - b + constant) where
|
||||
/// neither a nor b are variables.
|
||||
///
|
||||
/// This is a more aggressive variant of EvaluateAsRelocatable. The intended
|
||||
/// This is a more aggressive variant of evaluateAsRelocatable. The intended
|
||||
/// use is for when relocations are not available, like the .size directive.
|
||||
bool evaluateAsValue(MCValue &Res, const MCAsmLayout &Layout) const;
|
||||
|
||||
@ -115,7 +115,7 @@ public:
|
||||
/// currently defined as the absolute section for constants, or
|
||||
/// otherwise the section associated with the first defined symbol in the
|
||||
/// expression.
|
||||
MCSection *FindAssociatedSection() const;
|
||||
MCSection *findAssociatedSection() const;
|
||||
|
||||
/// @}
|
||||
};
|
||||
@ -136,7 +136,7 @@ public:
|
||||
/// \name Construction
|
||||
/// @{
|
||||
|
||||
static const MCConstantExpr *Create(int64_t Value, MCContext &Ctx);
|
||||
static const MCConstantExpr *create(int64_t Value, MCContext &Ctx);
|
||||
|
||||
/// @}
|
||||
/// \name Accessors
|
||||
@ -312,13 +312,13 @@ public:
|
||||
/// \name Construction
|
||||
/// @{
|
||||
|
||||
static const MCSymbolRefExpr *Create(const MCSymbol *Symbol, MCContext &Ctx) {
|
||||
return MCSymbolRefExpr::Create(Symbol, VK_None, Ctx);
|
||||
static const MCSymbolRefExpr *create(const MCSymbol *Symbol, MCContext &Ctx) {
|
||||
return MCSymbolRefExpr::create(Symbol, VK_None, Ctx);
|
||||
}
|
||||
|
||||
static const MCSymbolRefExpr *Create(const MCSymbol *Symbol, VariantKind Kind,
|
||||
static const MCSymbolRefExpr *create(const MCSymbol *Symbol, VariantKind Kind,
|
||||
MCContext &Ctx);
|
||||
static const MCSymbolRefExpr *Create(StringRef Name, VariantKind Kind,
|
||||
static const MCSymbolRefExpr *create(StringRef Name, VariantKind Kind,
|
||||
MCContext &Ctx);
|
||||
|
||||
/// @}
|
||||
@ -369,19 +369,19 @@ public:
|
||||
/// \name Construction
|
||||
/// @{
|
||||
|
||||
static const MCUnaryExpr *Create(Opcode Op, const MCExpr *Expr,
|
||||
static const MCUnaryExpr *create(Opcode Op, const MCExpr *Expr,
|
||||
MCContext &Ctx);
|
||||
static const MCUnaryExpr *CreateLNot(const MCExpr *Expr, MCContext &Ctx) {
|
||||
return Create(LNot, Expr, Ctx);
|
||||
static const MCUnaryExpr *createLNot(const MCExpr *Expr, MCContext &Ctx) {
|
||||
return create(LNot, Expr, Ctx);
|
||||
}
|
||||
static const MCUnaryExpr *CreateMinus(const MCExpr *Expr, MCContext &Ctx) {
|
||||
return Create(Minus, Expr, Ctx);
|
||||
static const MCUnaryExpr *createMinus(const MCExpr *Expr, MCContext &Ctx) {
|
||||
return create(Minus, Expr, Ctx);
|
||||
}
|
||||
static const MCUnaryExpr *CreateNot(const MCExpr *Expr, MCContext &Ctx) {
|
||||
return Create(Not, Expr, Ctx);
|
||||
static const MCUnaryExpr *createNot(const MCExpr *Expr, MCContext &Ctx) {
|
||||
return create(Not, Expr, Ctx);
|
||||
}
|
||||
static const MCUnaryExpr *CreatePlus(const MCExpr *Expr, MCContext &Ctx) {
|
||||
return Create(Plus, Expr, Ctx);
|
||||
static const MCUnaryExpr *createPlus(const MCExpr *Expr, MCContext &Ctx) {
|
||||
return create(Plus, Expr, Ctx);
|
||||
}
|
||||
|
||||
/// @}
|
||||
@ -441,83 +441,83 @@ public:
|
||||
/// \name Construction
|
||||
/// @{
|
||||
|
||||
static const MCBinaryExpr *Create(Opcode Op, const MCExpr *LHS,
|
||||
static const MCBinaryExpr *create(Opcode Op, const MCExpr *LHS,
|
||||
const MCExpr *RHS, MCContext &Ctx);
|
||||
static const MCBinaryExpr *CreateAdd(const MCExpr *LHS, const MCExpr *RHS,
|
||||
static const MCBinaryExpr *createAdd(const MCExpr *LHS, const MCExpr *RHS,
|
||||
MCContext &Ctx) {
|
||||
return Create(Add, LHS, RHS, Ctx);
|
||||
return create(Add, LHS, RHS, Ctx);
|
||||
}
|
||||
static const MCBinaryExpr *CreateAnd(const MCExpr *LHS, const MCExpr *RHS,
|
||||
static const MCBinaryExpr *createAnd(const MCExpr *LHS, const MCExpr *RHS,
|
||||
MCContext &Ctx) {
|
||||
return Create(And, LHS, RHS, Ctx);
|
||||
return create(And, LHS, RHS, Ctx);
|
||||
}
|
||||
static const MCBinaryExpr *CreateDiv(const MCExpr *LHS, const MCExpr *RHS,
|
||||
static const MCBinaryExpr *createDiv(const MCExpr *LHS, const MCExpr *RHS,
|
||||
MCContext &Ctx) {
|
||||
return Create(Div, LHS, RHS, Ctx);
|
||||
return create(Div, LHS, RHS, Ctx);
|
||||
}
|
||||
static const MCBinaryExpr *CreateEQ(const MCExpr *LHS, const MCExpr *RHS,
|
||||
static const MCBinaryExpr *createEQ(const MCExpr *LHS, const MCExpr *RHS,
|
||||
MCContext &Ctx) {
|
||||
return Create(EQ, LHS, RHS, Ctx);
|
||||
return create(EQ, LHS, RHS, Ctx);
|
||||
}
|
||||
static const MCBinaryExpr *CreateGT(const MCExpr *LHS, const MCExpr *RHS,
|
||||
static const MCBinaryExpr *createGT(const MCExpr *LHS, const MCExpr *RHS,
|
||||
MCContext &Ctx) {
|
||||
return Create(GT, LHS, RHS, Ctx);
|
||||
return create(GT, LHS, RHS, Ctx);
|
||||
}
|
||||
static const MCBinaryExpr *CreateGTE(const MCExpr *LHS, const MCExpr *RHS,
|
||||
static const MCBinaryExpr *createGTE(const MCExpr *LHS, const MCExpr *RHS,
|
||||
MCContext &Ctx) {
|
||||
return Create(GTE, LHS, RHS, Ctx);
|
||||
return create(GTE, LHS, RHS, Ctx);
|
||||
}
|
||||
static const MCBinaryExpr *CreateLAnd(const MCExpr *LHS, const MCExpr *RHS,
|
||||
static const MCBinaryExpr *createLAnd(const MCExpr *LHS, const MCExpr *RHS,
|
||||
MCContext &Ctx) {
|
||||
return Create(LAnd, LHS, RHS, Ctx);
|
||||
return create(LAnd, LHS, RHS, Ctx);
|
||||
}
|
||||
static const MCBinaryExpr *CreateLOr(const MCExpr *LHS, const MCExpr *RHS,
|
||||
static const MCBinaryExpr *createLOr(const MCExpr *LHS, const MCExpr *RHS,
|
||||
MCContext &Ctx) {
|
||||
return Create(LOr, LHS, RHS, Ctx);
|
||||
return create(LOr, LHS, RHS, Ctx);
|
||||
}
|
||||
static const MCBinaryExpr *CreateLT(const MCExpr *LHS, const MCExpr *RHS,
|
||||
static const MCBinaryExpr *createLT(const MCExpr *LHS, const MCExpr *RHS,
|
||||
MCContext &Ctx) {
|
||||
return Create(LT, LHS, RHS, Ctx);
|
||||
return create(LT, LHS, RHS, Ctx);
|
||||
}
|
||||
static const MCBinaryExpr *CreateLTE(const MCExpr *LHS, const MCExpr *RHS,
|
||||
static const MCBinaryExpr *createLTE(const MCExpr *LHS, const MCExpr *RHS,
|
||||
MCContext &Ctx) {
|
||||
return Create(LTE, LHS, RHS, Ctx);
|
||||
return create(LTE, LHS, RHS, Ctx);
|
||||
}
|
||||
static const MCBinaryExpr *CreateMod(const MCExpr *LHS, const MCExpr *RHS,
|
||||
static const MCBinaryExpr *createMod(const MCExpr *LHS, const MCExpr *RHS,
|
||||
MCContext &Ctx) {
|
||||
return Create(Mod, LHS, RHS, Ctx);
|
||||
return create(Mod, LHS, RHS, Ctx);
|
||||
}
|
||||
static const MCBinaryExpr *CreateMul(const MCExpr *LHS, const MCExpr *RHS,
|
||||
static const MCBinaryExpr *createMul(const MCExpr *LHS, const MCExpr *RHS,
|
||||
MCContext &Ctx) {
|
||||
return Create(Mul, LHS, RHS, Ctx);
|
||||
return create(Mul, LHS, RHS, Ctx);
|
||||
}
|
||||
static const MCBinaryExpr *CreateNE(const MCExpr *LHS, const MCExpr *RHS,
|
||||
static const MCBinaryExpr *createNE(const MCExpr *LHS, const MCExpr *RHS,
|
||||
MCContext &Ctx) {
|
||||
return Create(NE, LHS, RHS, Ctx);
|
||||
return create(NE, LHS, RHS, Ctx);
|
||||
}
|
||||
static const MCBinaryExpr *CreateOr(const MCExpr *LHS, const MCExpr *RHS,
|
||||
static const MCBinaryExpr *createOr(const MCExpr *LHS, const MCExpr *RHS,
|
||||
MCContext &Ctx) {
|
||||
return Create(Or, LHS, RHS, Ctx);
|
||||
return create(Or, LHS, RHS, Ctx);
|
||||
}
|
||||
static const MCBinaryExpr *CreateShl(const MCExpr *LHS, const MCExpr *RHS,
|
||||
static const MCBinaryExpr *createShl(const MCExpr *LHS, const MCExpr *RHS,
|
||||
MCContext &Ctx) {
|
||||
return Create(Shl, LHS, RHS, Ctx);
|
||||
return create(Shl, LHS, RHS, Ctx);
|
||||
}
|
||||
static const MCBinaryExpr *CreateAShr(const MCExpr *LHS, const MCExpr *RHS,
|
||||
static const MCBinaryExpr *createAShr(const MCExpr *LHS, const MCExpr *RHS,
|
||||
MCContext &Ctx) {
|
||||
return Create(AShr, LHS, RHS, Ctx);
|
||||
return create(AShr, LHS, RHS, Ctx);
|
||||
}
|
||||
static const MCBinaryExpr *CreateLShr(const MCExpr *LHS, const MCExpr *RHS,
|
||||
static const MCBinaryExpr *createLShr(const MCExpr *LHS, const MCExpr *RHS,
|
||||
MCContext &Ctx) {
|
||||
return Create(LShr, LHS, RHS, Ctx);
|
||||
return create(LShr, LHS, RHS, Ctx);
|
||||
}
|
||||
static const MCBinaryExpr *CreateSub(const MCExpr *LHS, const MCExpr *RHS,
|
||||
static const MCBinaryExpr *createSub(const MCExpr *LHS, const MCExpr *RHS,
|
||||
MCContext &Ctx) {
|
||||
return Create(Sub, LHS, RHS, Ctx);
|
||||
return create(Sub, LHS, RHS, Ctx);
|
||||
}
|
||||
static const MCBinaryExpr *CreateXor(const MCExpr *LHS, const MCExpr *RHS,
|
||||
static const MCBinaryExpr *createXor(const MCExpr *LHS, const MCExpr *RHS,
|
||||
MCContext &Ctx) {
|
||||
return Create(Xor, LHS, RHS, Ctx);
|
||||
return create(Xor, LHS, RHS, Ctx);
|
||||
}
|
||||
|
||||
/// @}
|
||||
@ -552,12 +552,12 @@ protected:
|
||||
virtual ~MCTargetExpr() {}
|
||||
public:
|
||||
|
||||
virtual void PrintImpl(raw_ostream &OS) const = 0;
|
||||
virtual bool EvaluateAsRelocatableImpl(MCValue &Res,
|
||||
virtual void printImpl(raw_ostream &OS) const = 0;
|
||||
virtual bool evaluateAsRelocatableImpl(MCValue &Res,
|
||||
const MCAsmLayout *Layout,
|
||||
const MCFixup *Fixup) const = 0;
|
||||
virtual void visitUsedExpr(MCStreamer& Streamer) const = 0;
|
||||
virtual MCSection *FindAssociatedSection() const = 0;
|
||||
virtual MCSection *findAssociatedSection() const = 0;
|
||||
|
||||
virtual void fixELFSymbolsInTLSFixups(MCAssembler &) const = 0;
|
||||
|
||||
|
@ -108,7 +108,7 @@ private: // MCContext creates and uniques these.
|
||||
MCSection *getSectionPtr() const {
|
||||
if (Section || !Value)
|
||||
return Section;
|
||||
return Section = Value->FindAssociatedSection();
|
||||
return Section = Value->findAssociatedSection();
|
||||
}
|
||||
|
||||
public:
|
||||
|
@ -38,7 +38,7 @@ void AddressPool::emit(AsmPrinter &Asm, MCSection *AddrSection) {
|
||||
Entries[I.second.Number] =
|
||||
I.second.TLS
|
||||
? Asm.getObjFileLowering().getDebugThreadLocalSymbol(I.first)
|
||||
: MCSymbolRefExpr::Create(I.first, Asm.OutContext);
|
||||
: MCSymbolRefExpr::create(I.first, Asm.OutContext);
|
||||
|
||||
for (const MCExpr *Entry : Entries)
|
||||
Asm.OutStreamer->EmitValue(Entry, Asm.getDataLayout().getPointerSize());
|
||||
|
@ -512,7 +512,7 @@ void AsmPrinter::EmitGlobalVariable(const GlobalVariable *GV) {
|
||||
|
||||
if (MAI->hasDotTypeDotSizeDirective())
|
||||
// .size foo, 42
|
||||
OutStreamer->EmitELFSize(GVSym, MCConstantExpr::Create(Size, OutContext));
|
||||
OutStreamer->EmitELFSize(GVSym, MCConstantExpr::create(Size, OutContext));
|
||||
|
||||
OutStreamer->AddBlankLine();
|
||||
}
|
||||
@ -566,7 +566,7 @@ void AsmPrinter::EmitFunctionHeader() {
|
||||
MCSymbol *CurPos = OutContext.createTempSymbol();
|
||||
OutStreamer->EmitLabel(CurPos);
|
||||
OutStreamer->EmitAssignment(CurrentFnBegin,
|
||||
MCSymbolRefExpr::Create(CurPos, OutContext));
|
||||
MCSymbolRefExpr::create(CurPos, OutContext));
|
||||
} else {
|
||||
OutStreamer->EmitLabel(CurrentFnBegin);
|
||||
}
|
||||
@ -776,7 +776,7 @@ void AsmPrinter::emitFrameAlloc(const MachineInstr &MI) {
|
||||
|
||||
// Emit a symbol assignment.
|
||||
OutStreamer->EmitAssignment(FrameAllocSym,
|
||||
MCConstantExpr::Create(FrameOffset, OutContext));
|
||||
MCConstantExpr::create(FrameOffset, OutContext));
|
||||
}
|
||||
|
||||
/// EmitFunctionBody - This method emits the body and trailer for a
|
||||
@ -900,8 +900,8 @@ void AsmPrinter::EmitFunctionBody() {
|
||||
// We can get the size as difference between the function label and the
|
||||
// temp label.
|
||||
const MCExpr *SizeExp =
|
||||
MCBinaryExpr::CreateSub(MCSymbolRefExpr::Create(CurrentFnEnd, OutContext),
|
||||
MCSymbolRefExpr::Create(CurrentFnSymForSize,
|
||||
MCBinaryExpr::createSub(MCSymbolRefExpr::create(CurrentFnEnd, OutContext),
|
||||
MCSymbolRefExpr::create(CurrentFnSymForSize,
|
||||
OutContext),
|
||||
OutContext);
|
||||
OutStreamer->EmitELFSize(CurrentFnSym, SizeExp);
|
||||
@ -1326,9 +1326,9 @@ void AsmPrinter::EmitJumpTableInfo() {
|
||||
|
||||
// .set LJTSet, LBB32-base
|
||||
const MCExpr *LHS =
|
||||
MCSymbolRefExpr::Create(MBB->getSymbol(), OutContext);
|
||||
MCSymbolRefExpr::create(MBB->getSymbol(), OutContext);
|
||||
OutStreamer->EmitAssignment(GetJTSetSymbol(JTI, MBB->getNumber()),
|
||||
MCBinaryExpr::CreateSub(LHS, Base,
|
||||
MCBinaryExpr::createSub(LHS, Base,
|
||||
OutContext));
|
||||
}
|
||||
}
|
||||
@ -1368,14 +1368,14 @@ void AsmPrinter::EmitJumpTableEntry(const MachineJumpTableInfo *MJTI,
|
||||
case MachineJumpTableInfo::EK_BlockAddress:
|
||||
// EK_BlockAddress - Each entry is a plain address of block, e.g.:
|
||||
// .word LBB123
|
||||
Value = MCSymbolRefExpr::Create(MBB->getSymbol(), OutContext);
|
||||
Value = MCSymbolRefExpr::create(MBB->getSymbol(), OutContext);
|
||||
break;
|
||||
case MachineJumpTableInfo::EK_GPRel32BlockAddress: {
|
||||
// EK_GPRel32BlockAddress - Each entry is an address of block, encoded
|
||||
// with a relocation as gp-relative, e.g.:
|
||||
// .gprel32 LBB123
|
||||
MCSymbol *MBBSym = MBB->getSymbol();
|
||||
OutStreamer->EmitGPRel32Value(MCSymbolRefExpr::Create(MBBSym, OutContext));
|
||||
OutStreamer->EmitGPRel32Value(MCSymbolRefExpr::create(MBBSym, OutContext));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1384,7 +1384,7 @@ void AsmPrinter::EmitJumpTableEntry(const MachineJumpTableInfo *MJTI,
|
||||
// with a relocation as gp-relative, e.g.:
|
||||
// .gpdword LBB123
|
||||
MCSymbol *MBBSym = MBB->getSymbol();
|
||||
OutStreamer->EmitGPRel64Value(MCSymbolRefExpr::Create(MBBSym, OutContext));
|
||||
OutStreamer->EmitGPRel64Value(MCSymbolRefExpr::create(MBBSym, OutContext));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1397,14 +1397,14 @@ void AsmPrinter::EmitJumpTableEntry(const MachineJumpTableInfo *MJTI,
|
||||
// .set L4_5_set_123, LBB123 - LJTI1_2
|
||||
// .word L4_5_set_123
|
||||
if (MAI->doesSetDirectiveSuppressesReloc()) {
|
||||
Value = MCSymbolRefExpr::Create(GetJTSetSymbol(UID, MBB->getNumber()),
|
||||
Value = MCSymbolRefExpr::create(GetJTSetSymbol(UID, MBB->getNumber()),
|
||||
OutContext);
|
||||
break;
|
||||
}
|
||||
Value = MCSymbolRefExpr::Create(MBB->getSymbol(), OutContext);
|
||||
Value = MCSymbolRefExpr::create(MBB->getSymbol(), OutContext);
|
||||
const TargetLowering *TLI = MF->getSubtarget().getTargetLowering();
|
||||
const MCExpr *Base = TLI->getPICJumpTableRelocBaseExpr(MF, UID, OutContext);
|
||||
Value = MCBinaryExpr::CreateSub(Value, Base, OutContext);
|
||||
Value = MCBinaryExpr::createSub(Value, Base, OutContext);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1596,8 +1596,8 @@ void AsmPrinter::EmitLabelDifference(const MCSymbol *Hi, const MCSymbol *Lo,
|
||||
|
||||
// Get the Hi-Lo expression.
|
||||
const MCExpr *Diff =
|
||||
MCBinaryExpr::CreateSub(MCSymbolRefExpr::Create(Hi, OutContext),
|
||||
MCSymbolRefExpr::Create(Lo, OutContext),
|
||||
MCBinaryExpr::createSub(MCSymbolRefExpr::create(Hi, OutContext),
|
||||
MCSymbolRefExpr::create(Lo, OutContext),
|
||||
OutContext);
|
||||
|
||||
if (!MAI->doesSetDirectiveSuppressesReloc()) {
|
||||
@ -1623,10 +1623,10 @@ void AsmPrinter::EmitLabelPlusOffset(const MCSymbol *Label, uint64_t Offset,
|
||||
}
|
||||
|
||||
// Emit Label+Offset (or just Label if Offset is zero)
|
||||
const MCExpr *Expr = MCSymbolRefExpr::Create(Label, OutContext);
|
||||
const MCExpr *Expr = MCSymbolRefExpr::create(Label, OutContext);
|
||||
if (Offset)
|
||||
Expr = MCBinaryExpr::CreateAdd(
|
||||
Expr, MCConstantExpr::Create(Offset, OutContext), OutContext);
|
||||
Expr = MCBinaryExpr::createAdd(
|
||||
Expr, MCConstantExpr::create(Offset, OutContext), OutContext);
|
||||
|
||||
OutStreamer->EmitValue(Expr, Size);
|
||||
}
|
||||
@ -1663,16 +1663,16 @@ const MCExpr *AsmPrinter::lowerConstant(const Constant *CV) {
|
||||
MCContext &Ctx = OutContext;
|
||||
|
||||
if (CV->isNullValue() || isa<UndefValue>(CV))
|
||||
return MCConstantExpr::Create(0, Ctx);
|
||||
return MCConstantExpr::create(0, Ctx);
|
||||
|
||||
if (const ConstantInt *CI = dyn_cast<ConstantInt>(CV))
|
||||
return MCConstantExpr::Create(CI->getZExtValue(), Ctx);
|
||||
return MCConstantExpr::create(CI->getZExtValue(), Ctx);
|
||||
|
||||
if (const GlobalValue *GV = dyn_cast<GlobalValue>(CV))
|
||||
return MCSymbolRefExpr::Create(getSymbol(GV), Ctx);
|
||||
return MCSymbolRefExpr::create(getSymbol(GV), Ctx);
|
||||
|
||||
if (const BlockAddress *BA = dyn_cast<BlockAddress>(CV))
|
||||
return MCSymbolRefExpr::Create(GetBlockAddressSymbol(BA), Ctx);
|
||||
return MCSymbolRefExpr::create(GetBlockAddressSymbol(BA), Ctx);
|
||||
|
||||
const ConstantExpr *CE = dyn_cast<ConstantExpr>(CV);
|
||||
if (!CE) {
|
||||
@ -1713,7 +1713,7 @@ const MCExpr *AsmPrinter::lowerConstant(const Constant *CV) {
|
||||
return Base;
|
||||
|
||||
int64_t Offset = OffsetAI.getSExtValue();
|
||||
return MCBinaryExpr::CreateAdd(Base, MCConstantExpr::Create(Offset, Ctx),
|
||||
return MCBinaryExpr::createAdd(Base, MCConstantExpr::create(Offset, Ctx),
|
||||
Ctx);
|
||||
}
|
||||
|
||||
@ -1756,8 +1756,8 @@ const MCExpr *AsmPrinter::lowerConstant(const Constant *CV) {
|
||||
// the high bits so we are sure to get a proper truncation if the input is
|
||||
// a constant expr.
|
||||
unsigned InBits = DL.getTypeAllocSizeInBits(Op->getType());
|
||||
const MCExpr *MaskExpr = MCConstantExpr::Create(~0ULL >> (64-InBits), Ctx);
|
||||
return MCBinaryExpr::CreateAnd(OpExpr, MaskExpr, Ctx);
|
||||
const MCExpr *MaskExpr = MCConstantExpr::create(~0ULL >> (64-InBits), Ctx);
|
||||
return MCBinaryExpr::createAnd(OpExpr, MaskExpr, Ctx);
|
||||
}
|
||||
|
||||
// The MC library also has a right-shift operator, but it isn't consistently
|
||||
@ -1775,15 +1775,15 @@ const MCExpr *AsmPrinter::lowerConstant(const Constant *CV) {
|
||||
const MCExpr *RHS = lowerConstant(CE->getOperand(1));
|
||||
switch (CE->getOpcode()) {
|
||||
default: llvm_unreachable("Unknown binary operator constant cast expr");
|
||||
case Instruction::Add: return MCBinaryExpr::CreateAdd(LHS, RHS, Ctx);
|
||||
case Instruction::Sub: return MCBinaryExpr::CreateSub(LHS, RHS, Ctx);
|
||||
case Instruction::Mul: return MCBinaryExpr::CreateMul(LHS, RHS, Ctx);
|
||||
case Instruction::SDiv: return MCBinaryExpr::CreateDiv(LHS, RHS, Ctx);
|
||||
case Instruction::SRem: return MCBinaryExpr::CreateMod(LHS, RHS, Ctx);
|
||||
case Instruction::Shl: return MCBinaryExpr::CreateShl(LHS, RHS, Ctx);
|
||||
case Instruction::And: return MCBinaryExpr::CreateAnd(LHS, RHS, Ctx);
|
||||
case Instruction::Or: return MCBinaryExpr::CreateOr (LHS, RHS, Ctx);
|
||||
case Instruction::Xor: return MCBinaryExpr::CreateXor(LHS, RHS, Ctx);
|
||||
case Instruction::Add: return MCBinaryExpr::createAdd(LHS, RHS, Ctx);
|
||||
case Instruction::Sub: return MCBinaryExpr::createSub(LHS, RHS, Ctx);
|
||||
case Instruction::Mul: return MCBinaryExpr::createMul(LHS, RHS, Ctx);
|
||||
case Instruction::SDiv: return MCBinaryExpr::createDiv(LHS, RHS, Ctx);
|
||||
case Instruction::SRem: return MCBinaryExpr::createMod(LHS, RHS, Ctx);
|
||||
case Instruction::Shl: return MCBinaryExpr::createShl(LHS, RHS, Ctx);
|
||||
case Instruction::And: return MCBinaryExpr::createAnd(LHS, RHS, Ctx);
|
||||
case Instruction::Or: return MCBinaryExpr::createOr (LHS, RHS, Ctx);
|
||||
case Instruction::Xor: return MCBinaryExpr::createXor(LHS, RHS, Ctx);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2107,13 +2107,13 @@ static void handleIndirectSymViaGOTPCRel(AsmPrinter &AP, const MCExpr **ME,
|
||||
// cstexpr := <gotequiv> - "." + <cst>
|
||||
// cstexpr := <gotequiv> - (<foo> - <offset from @foo base>) + <cst>
|
||||
//
|
||||
// After canonicalization by EvaluateAsRelocatable `ME` turns into:
|
||||
// After canonicalization by evaluateAsRelocatable `ME` turns into:
|
||||
//
|
||||
// cstexpr := <gotequiv> - <foo> + gotpcrelcst, where
|
||||
// gotpcrelcst := <offset from @foo base> + <cst>
|
||||
//
|
||||
MCValue MV;
|
||||
if (!(*ME)->EvaluateAsRelocatable(MV, nullptr, nullptr) || MV.isAbsolute())
|
||||
if (!(*ME)->evaluateAsRelocatable(MV, nullptr, nullptr) || MV.isAbsolute())
|
||||
return;
|
||||
|
||||
const MCSymbol *GOTEquivSym = &MV.getSymA()->getSymbol();
|
||||
|
@ -192,9 +192,9 @@ void DwarfAccelTable::emitOffsets(AsmPrinter *Asm, const MCSymbol *SecBegin) {
|
||||
PrevHash = HashValue;
|
||||
Asm->OutStreamer->AddComment("Offset in Bucket " + Twine(i));
|
||||
MCContext &Context = Asm->OutStreamer->getContext();
|
||||
const MCExpr *Sub = MCBinaryExpr::CreateSub(
|
||||
MCSymbolRefExpr::Create((*HI)->Sym, Context),
|
||||
MCSymbolRefExpr::Create(SecBegin, Context), Context);
|
||||
const MCExpr *Sub = MCBinaryExpr::createSub(
|
||||
MCSymbolRefExpr::create((*HI)->Sym, Context),
|
||||
MCSymbolRefExpr::create(SecBegin, Context), Context);
|
||||
Asm->OutStreamer->EmitValue(Sub, sizeof(uint32_t));
|
||||
}
|
||||
}
|
||||
|
@ -171,10 +171,10 @@ static void EmitLabelDiff(MCStreamer &Streamer,
|
||||
unsigned int Size = 4) {
|
||||
MCSymbolRefExpr::VariantKind Variant = MCSymbolRefExpr::VK_None;
|
||||
MCContext &Context = Streamer.getContext();
|
||||
const MCExpr *FromRef = MCSymbolRefExpr::Create(From, Variant, Context),
|
||||
*ToRef = MCSymbolRefExpr::Create(To, Variant, Context);
|
||||
const MCExpr *FromRef = MCSymbolRefExpr::create(From, Variant, Context),
|
||||
*ToRef = MCSymbolRefExpr::create(To, Variant, Context);
|
||||
const MCExpr *AddrDelta =
|
||||
MCBinaryExpr::Create(MCBinaryExpr::Sub, ToRef, FromRef, Context);
|
||||
MCBinaryExpr::create(MCBinaryExpr::Sub, ToRef, FromRef, Context);
|
||||
Streamer.EmitValue(AddrDelta, Size);
|
||||
}
|
||||
|
||||
|
@ -96,7 +96,7 @@ void WinException::beginFunction(const MachineFunction *MF) {
|
||||
// Emit a symbol assignment.
|
||||
Asm->OutStreamer->EmitAssignment(
|
||||
HandlerTypeParentFrameOffset,
|
||||
MCConstantExpr::Create(I->second, Asm->OutContext));
|
||||
MCConstantExpr::create(I->second, Asm->OutContext));
|
||||
}
|
||||
}
|
||||
|
||||
@ -159,8 +159,8 @@ void WinException::endFunction(const MachineFunction *MF) {
|
||||
|
||||
const MCExpr *WinException::create32bitRef(const MCSymbol *Value) {
|
||||
if (!Value)
|
||||
return MCConstantExpr::Create(0, Asm->OutContext);
|
||||
return MCSymbolRefExpr::Create(Value, useImageRel32
|
||||
return MCConstantExpr::create(0, Asm->OutContext);
|
||||
return MCSymbolRefExpr::create(Value, useImageRel32
|
||||
? MCSymbolRefExpr::VK_COFF_IMGREL32
|
||||
: MCSymbolRefExpr::VK_None,
|
||||
Asm->OutContext);
|
||||
@ -168,7 +168,7 @@ const MCExpr *WinException::create32bitRef(const MCSymbol *Value) {
|
||||
|
||||
const MCExpr *WinException::create32bitRef(const GlobalValue *GV) {
|
||||
if (!GV)
|
||||
return MCConstantExpr::Create(0, Asm->OutContext);
|
||||
return MCConstantExpr::create(0, Asm->OutContext);
|
||||
return create32bitRef(Asm->getSymbol(GV));
|
||||
}
|
||||
|
||||
@ -255,8 +255,8 @@ void WinException::emitCSpecificHandlerTable() {
|
||||
if (CSE.EndLabel) {
|
||||
// The interval is half-open, so we have to add one to include the return
|
||||
// address of the last invoke in the range.
|
||||
End = MCBinaryExpr::CreateAdd(create32bitRef(CSE.EndLabel),
|
||||
MCConstantExpr::Create(1, Asm->OutContext),
|
||||
End = MCBinaryExpr::createAdd(create32bitRef(CSE.EndLabel),
|
||||
MCConstantExpr::create(1, Asm->OutContext),
|
||||
Asm->OutContext);
|
||||
} else {
|
||||
End = create32bitRef(EHFuncEndSym);
|
||||
@ -428,10 +428,10 @@ void WinException::emitCXXFrameHandler3Table(const MachineFunction *MF) {
|
||||
Asm->OutContext.getOrCreateFrameAllocSymbol(
|
||||
GlobalValue::getRealLinkageName(ParentF->getName()),
|
||||
HT.CatchObjRecoverIdx);
|
||||
FrameAllocOffsetRef = MCSymbolRefExpr::Create(
|
||||
FrameAllocOffsetRef = MCSymbolRefExpr::create(
|
||||
FrameAllocOffset, MCSymbolRefExpr::VK_None, Asm->OutContext);
|
||||
} else {
|
||||
FrameAllocOffsetRef = MCConstantExpr::Create(0, Asm->OutContext);
|
||||
FrameAllocOffsetRef = MCConstantExpr::create(0, Asm->OutContext);
|
||||
}
|
||||
|
||||
OS.EmitIntValue(HT.Adjectives, 4); // Adjectives
|
||||
@ -443,7 +443,7 @@ void WinException::emitCXXFrameHandler3Table(const MachineFunction *MF) {
|
||||
MCSymbol *ParentFrameOffset =
|
||||
Asm->OutContext.getOrCreateParentFrameOffsetSymbol(
|
||||
GlobalValue::getRealLinkageName(HT.Handler->getName()));
|
||||
const MCSymbolRefExpr *ParentFrameOffsetRef = MCSymbolRefExpr::Create(
|
||||
const MCSymbolRefExpr *ParentFrameOffsetRef = MCSymbolRefExpr::create(
|
||||
ParentFrameOffset, MCSymbolRefExpr::VK_None, Asm->OutContext);
|
||||
OS.EmitValue(ParentFrameOffsetRef, 4); // ParentFrameOffset
|
||||
}
|
||||
|
@ -254,7 +254,7 @@ const MCExpr *
|
||||
TargetLowering::getPICJumpTableRelocBaseExpr(const MachineFunction *MF,
|
||||
unsigned JTI,MCContext &Ctx) const{
|
||||
// The normal PIC reloc base is the label at the start of the jump table.
|
||||
return MCSymbolRefExpr::Create(MF->getJTISymbol(JTI, Ctx), Ctx);
|
||||
return MCSymbolRefExpr::create(MF->getJTISymbol(JTI, Ctx), Ctx);
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -315,9 +315,9 @@ void StackMaps::recordStackMapOpers(const MachineInstr &MI, uint64_t ID,
|
||||
|
||||
// Create an expression to calculate the offset of the callsite from function
|
||||
// entry.
|
||||
const MCExpr *CSOffsetExpr = MCBinaryExpr::CreateSub(
|
||||
MCSymbolRefExpr::Create(MILabel, OutContext),
|
||||
MCSymbolRefExpr::Create(AP.CurrentFnSymForSize, OutContext),
|
||||
const MCExpr *CSOffsetExpr = MCBinaryExpr::createSub(
|
||||
MCSymbolRefExpr::create(MILabel, OutContext),
|
||||
MCSymbolRefExpr::create(AP.CurrentFnSymForSize, OutContext),
|
||||
OutContext);
|
||||
|
||||
CSInfos.emplace_back(CSOffsetExpr, ID, std::move(Locations),
|
||||
|
@ -75,7 +75,7 @@ void TargetLoweringObjectFileELF::emitPersonalityValue(MCStreamer &Streamer,
|
||||
Streamer.SwitchSection(Sec);
|
||||
Streamer.EmitValueToAlignment(TM.getDataLayout()->getPointerABIAlignment());
|
||||
Streamer.EmitSymbolAttribute(Label, MCSA_ELF_TypeObject);
|
||||
const MCExpr *E = MCConstantExpr::Create(Size, getContext());
|
||||
const MCExpr *E = MCConstantExpr::create(Size, getContext());
|
||||
Streamer.EmitELFSize(Label, E);
|
||||
Streamer.EmitLabel(Label);
|
||||
|
||||
@ -101,7 +101,7 @@ const MCExpr *TargetLoweringObjectFileELF::getTTypeGlobalReference(
|
||||
}
|
||||
|
||||
return TargetLoweringObjectFile::
|
||||
getTTypeReference(MCSymbolRefExpr::Create(SSym, getContext()),
|
||||
getTTypeReference(MCSymbolRefExpr::create(SSym, getContext()),
|
||||
Encoding & ~dwarf::DW_EH_PE_indirect, Streamer);
|
||||
}
|
||||
|
||||
@ -684,7 +684,7 @@ const MCExpr *TargetLoweringObjectFileMachO::getTTypeGlobalReference(
|
||||
}
|
||||
|
||||
return TargetLoweringObjectFile::
|
||||
getTTypeReference(MCSymbolRefExpr::Create(SSym, getContext()),
|
||||
getTTypeReference(MCSymbolRefExpr::create(SSym, getContext()),
|
||||
Encoding & ~dwarf::DW_EH_PE_indirect, Streamer);
|
||||
}
|
||||
|
||||
@ -760,16 +760,16 @@ const MCExpr *TargetLoweringObjectFileMachO::getIndirectSymViaGOTPCRel(
|
||||
StubValueTy(const_cast<MCSymbol *>(Sym), true /* access indirectly */);
|
||||
|
||||
const MCExpr *BSymExpr =
|
||||
MCSymbolRefExpr::Create(BaseSym, MCSymbolRefExpr::VK_None, Ctx);
|
||||
MCSymbolRefExpr::create(BaseSym, MCSymbolRefExpr::VK_None, Ctx);
|
||||
const MCExpr *LHS =
|
||||
MCSymbolRefExpr::Create(Stub, MCSymbolRefExpr::VK_None, Ctx);
|
||||
MCSymbolRefExpr::create(Stub, MCSymbolRefExpr::VK_None, Ctx);
|
||||
|
||||
if (!Offset)
|
||||
return MCBinaryExpr::CreateSub(LHS, BSymExpr, Ctx);
|
||||
return MCBinaryExpr::createSub(LHS, BSymExpr, Ctx);
|
||||
|
||||
const MCExpr *RHS =
|
||||
MCBinaryExpr::CreateAdd(BSymExpr, MCConstantExpr::Create(Offset, Ctx), Ctx);
|
||||
return MCBinaryExpr::CreateSub(LHS, RHS, Ctx);
|
||||
MCBinaryExpr::createAdd(BSymExpr, MCConstantExpr::create(Offset, Ctx), Ctx);
|
||||
return MCBinaryExpr::createSub(LHS, RHS, Ctx);
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
@ -40,7 +40,7 @@ const MCExpr *ConstantPool::addEntry(const MCExpr *Value, MCContext &Context,
|
||||
MCSymbol *CPEntryLabel = Context.createTempSymbol();
|
||||
|
||||
Entries.push_back(ConstantPoolEntry(CPEntryLabel, Value, Size));
|
||||
return MCSymbolRefExpr::Create(CPEntryLabel, Context);
|
||||
return MCSymbolRefExpr::create(CPEntryLabel, Context);
|
||||
}
|
||||
|
||||
bool ConstantPool::empty() { return Entries.empty(); }
|
||||
|
@ -128,12 +128,12 @@ MCAsmInfo::getExprForFDESymbol(const MCSymbol *Sym,
|
||||
unsigned Encoding,
|
||||
MCStreamer &Streamer) const {
|
||||
if (!(Encoding & dwarf::DW_EH_PE_pcrel))
|
||||
return MCSymbolRefExpr::Create(Sym, Streamer.getContext());
|
||||
return MCSymbolRefExpr::create(Sym, Streamer.getContext());
|
||||
|
||||
MCContext &Context = Streamer.getContext();
|
||||
const MCExpr *Res = MCSymbolRefExpr::Create(Sym, Context);
|
||||
const MCExpr *Res = MCSymbolRefExpr::create(Sym, Context);
|
||||
MCSymbol *PCSym = Context.createTempSymbol();
|
||||
Streamer.EmitLabel(PCSym);
|
||||
const MCExpr *PC = MCSymbolRefExpr::Create(PCSym, Context);
|
||||
return MCBinaryExpr::CreateSub(Res, PC, Context);
|
||||
const MCExpr *PC = MCSymbolRefExpr::create(PCSym, Context);
|
||||
return MCBinaryExpr::createSub(Res, PC, Context);
|
||||
}
|
||||
|
@ -643,7 +643,7 @@ void MCAsmStreamer::EmitBytes(StringRef Data) {
|
||||
}
|
||||
|
||||
void MCAsmStreamer::EmitIntValue(uint64_t Value, unsigned Size) {
|
||||
EmitValue(MCConstantExpr::Create(Value, getContext()), Size);
|
||||
EmitValue(MCConstantExpr::create(Value, getContext()), Size);
|
||||
}
|
||||
|
||||
void MCAsmStreamer::EmitValueImpl(const MCExpr *Value, unsigned Size,
|
||||
@ -662,7 +662,7 @@ void MCAsmStreamer::EmitValueImpl(const MCExpr *Value, unsigned Size,
|
||||
|
||||
if (!Directive) {
|
||||
int64_t IntValue;
|
||||
if (!Value->EvaluateAsAbsolute(IntValue))
|
||||
if (!Value->evaluateAsAbsolute(IntValue))
|
||||
report_fatal_error("Don't know how to emit this value.");
|
||||
|
||||
// We couldn't handle the requested integer size so we fallback by breaking
|
||||
@ -703,7 +703,7 @@ void MCAsmStreamer::EmitValueImpl(const MCExpr *Value, unsigned Size,
|
||||
|
||||
void MCAsmStreamer::EmitULEB128Value(const MCExpr *Value) {
|
||||
int64_t IntValue;
|
||||
if (Value->EvaluateAsAbsolute(IntValue)) {
|
||||
if (Value->evaluateAsAbsolute(IntValue)) {
|
||||
EmitULEB128IntValue(IntValue);
|
||||
return;
|
||||
}
|
||||
@ -713,7 +713,7 @@ void MCAsmStreamer::EmitULEB128Value(const MCExpr *Value) {
|
||||
|
||||
void MCAsmStreamer::EmitSLEB128Value(const MCExpr *Value) {
|
||||
int64_t IntValue;
|
||||
if (Value->EvaluateAsAbsolute(IntValue)) {
|
||||
if (Value->evaluateAsAbsolute(IntValue)) {
|
||||
EmitSLEB128IntValue(IntValue);
|
||||
return;
|
||||
}
|
||||
|
@ -137,7 +137,7 @@ static bool getSymbolOffsetImpl(const MCAsmLayout &Layout, const MCSymbol &S,
|
||||
|
||||
// If SD is a variable, evaluate it.
|
||||
MCValue Target;
|
||||
if (!S.getVariableValue()->EvaluateAsRelocatable(Target, &Layout, nullptr))
|
||||
if (!S.getVariableValue()->evaluateAsRelocatable(Target, &Layout, nullptr))
|
||||
report_fatal_error("unable to evaluate offset for variable '" +
|
||||
S.getName() + "'");
|
||||
|
||||
@ -398,7 +398,7 @@ bool MCAssembler::evaluateFixup(const MCAsmLayout &Layout,
|
||||
// probably merge the two into a single callback that tries to evaluate a
|
||||
// fixup and records a relocation if one is needed.
|
||||
const MCExpr *Expr = Fixup.getValue();
|
||||
if (!Expr->EvaluateAsRelocatable(Target, &Layout, &Fixup))
|
||||
if (!Expr->evaluateAsRelocatable(Target, &Layout, &Fixup))
|
||||
getContext().reportFatalError(Fixup.getLoc(), "expected relocatable expression");
|
||||
|
||||
bool IsPCRel = Backend.getFixupKindInfo(
|
||||
@ -491,7 +491,7 @@ uint64_t MCAssembler::computeFragmentSize(const MCAsmLayout &Layout,
|
||||
case MCFragment::FT_Org: {
|
||||
const MCOrgFragment &OF = cast<MCOrgFragment>(F);
|
||||
int64_t TargetLocation;
|
||||
if (!OF.getOffset().EvaluateAsAbsolute(TargetLocation, Layout))
|
||||
if (!OF.getOffset().evaluateAsAbsolute(TargetLocation, Layout))
|
||||
report_fatal_error("expected assembly-time absolute expression");
|
||||
|
||||
// FIXME: We need a way to communicate this error.
|
||||
|
@ -88,9 +88,9 @@ bool MCExternalSymbolizer::tryAddingSymbolicOperand(MCInst &MI,
|
||||
if (SymbolicOp.AddSymbol.Name) {
|
||||
StringRef Name(SymbolicOp.AddSymbol.Name);
|
||||
MCSymbol *Sym = Ctx.getOrCreateSymbol(Name);
|
||||
Add = MCSymbolRefExpr::Create(Sym, Ctx);
|
||||
Add = MCSymbolRefExpr::create(Sym, Ctx);
|
||||
} else {
|
||||
Add = MCConstantExpr::Create((int)SymbolicOp.AddSymbol.Value, Ctx);
|
||||
Add = MCConstantExpr::create((int)SymbolicOp.AddSymbol.Value, Ctx);
|
||||
}
|
||||
}
|
||||
|
||||
@ -99,37 +99,37 @@ bool MCExternalSymbolizer::tryAddingSymbolicOperand(MCInst &MI,
|
||||
if (SymbolicOp.SubtractSymbol.Name) {
|
||||
StringRef Name(SymbolicOp.SubtractSymbol.Name);
|
||||
MCSymbol *Sym = Ctx.getOrCreateSymbol(Name);
|
||||
Sub = MCSymbolRefExpr::Create(Sym, Ctx);
|
||||
Sub = MCSymbolRefExpr::create(Sym, Ctx);
|
||||
} else {
|
||||
Sub = MCConstantExpr::Create((int)SymbolicOp.SubtractSymbol.Value, Ctx);
|
||||
Sub = MCConstantExpr::create((int)SymbolicOp.SubtractSymbol.Value, Ctx);
|
||||
}
|
||||
}
|
||||
|
||||
const MCExpr *Off = nullptr;
|
||||
if (SymbolicOp.Value != 0)
|
||||
Off = MCConstantExpr::Create(SymbolicOp.Value, Ctx);
|
||||
Off = MCConstantExpr::create(SymbolicOp.Value, Ctx);
|
||||
|
||||
const MCExpr *Expr;
|
||||
if (Sub) {
|
||||
const MCExpr *LHS;
|
||||
if (Add)
|
||||
LHS = MCBinaryExpr::CreateSub(Add, Sub, Ctx);
|
||||
LHS = MCBinaryExpr::createSub(Add, Sub, Ctx);
|
||||
else
|
||||
LHS = MCUnaryExpr::CreateMinus(Sub, Ctx);
|
||||
LHS = MCUnaryExpr::createMinus(Sub, Ctx);
|
||||
if (Off)
|
||||
Expr = MCBinaryExpr::CreateAdd(LHS, Off, Ctx);
|
||||
Expr = MCBinaryExpr::createAdd(LHS, Off, Ctx);
|
||||
else
|
||||
Expr = LHS;
|
||||
} else if (Add) {
|
||||
if (Off)
|
||||
Expr = MCBinaryExpr::CreateAdd(Add, Off, Ctx);
|
||||
Expr = MCBinaryExpr::createAdd(Add, Off, Ctx);
|
||||
else
|
||||
Expr = Add;
|
||||
} else {
|
||||
if (Off)
|
||||
Expr = Off;
|
||||
else
|
||||
Expr = MCConstantExpr::Create(0, Ctx);
|
||||
Expr = MCConstantExpr::create(0, Ctx);
|
||||
}
|
||||
|
||||
Expr = RelInfo->createExprForCAPIVariantKind(Expr, SymbolicOp.VariantKind);
|
||||
|
@ -98,15 +98,15 @@ static inline const MCExpr *MakeStartMinusEndExpr(const MCStreamer &MCOS,
|
||||
int IntVal) {
|
||||
MCSymbolRefExpr::VariantKind Variant = MCSymbolRefExpr::VK_None;
|
||||
const MCExpr *Res =
|
||||
MCSymbolRefExpr::Create(&End, Variant, MCOS.getContext());
|
||||
MCSymbolRefExpr::create(&End, Variant, MCOS.getContext());
|
||||
const MCExpr *RHS =
|
||||
MCSymbolRefExpr::Create(&Start, Variant, MCOS.getContext());
|
||||
MCSymbolRefExpr::create(&Start, Variant, MCOS.getContext());
|
||||
const MCExpr *Res1 =
|
||||
MCBinaryExpr::Create(MCBinaryExpr::Sub, Res, RHS, MCOS.getContext());
|
||||
MCBinaryExpr::create(MCBinaryExpr::Sub, Res, RHS, MCOS.getContext());
|
||||
const MCExpr *Res2 =
|
||||
MCConstantExpr::Create(IntVal, MCOS.getContext());
|
||||
MCConstantExpr::create(IntVal, MCOS.getContext());
|
||||
const MCExpr *Res3 =
|
||||
MCBinaryExpr::Create(MCBinaryExpr::Sub, Res1, Res2, MCOS.getContext());
|
||||
MCBinaryExpr::create(MCBinaryExpr::Sub, Res1, Res2, MCOS.getContext());
|
||||
return Res3;
|
||||
}
|
||||
|
||||
@ -247,7 +247,7 @@ static const MCExpr *forceExpAbs(MCStreamer &OS, const MCExpr* Expr) {
|
||||
|
||||
MCSymbol *ABS = Context.createTempSymbol();
|
||||
OS.EmitAssignment(ABS, Expr);
|
||||
return MCSymbolRefExpr::Create(ABS, Context);
|
||||
return MCSymbolRefExpr::create(ABS, Context);
|
||||
}
|
||||
|
||||
static void emitAbsValue(MCStreamer &OS, const MCExpr *Value, unsigned Size) {
|
||||
@ -616,7 +616,7 @@ static void EmitGenDwarfAranges(MCStreamer *MCOS,
|
||||
assert(StartSymbol && "StartSymbol must not be NULL");
|
||||
assert(EndSymbol && "EndSymbol must not be NULL");
|
||||
|
||||
const MCExpr *Addr = MCSymbolRefExpr::Create(
|
||||
const MCExpr *Addr = MCSymbolRefExpr::create(
|
||||
StartSymbol, MCSymbolRefExpr::VK_None, context);
|
||||
const MCExpr *Size = MakeStartMinusEndExpr(*MCOS,
|
||||
*StartSymbol, *EndSymbol, 0);
|
||||
@ -705,12 +705,12 @@ static void EmitGenDwarfInfo(MCStreamer *MCOS,
|
||||
assert(EndSymbol && "EndSymbol must not be NULL");
|
||||
|
||||
// AT_low_pc, the first address of the default .text section.
|
||||
const MCExpr *Start = MCSymbolRefExpr::Create(
|
||||
const MCExpr *Start = MCSymbolRefExpr::create(
|
||||
StartSymbol, MCSymbolRefExpr::VK_None, context);
|
||||
MCOS->EmitValue(Start, AddrSize);
|
||||
|
||||
// AT_high_pc, the last address of the default .text section.
|
||||
const MCExpr *End = MCSymbolRefExpr::Create(
|
||||
const MCExpr *End = MCSymbolRefExpr::create(
|
||||
EndSymbol, MCSymbolRefExpr::VK_None, context);
|
||||
MCOS->EmitValue(End, AddrSize);
|
||||
}
|
||||
@ -772,7 +772,7 @@ static void EmitGenDwarfInfo(MCStreamer *MCOS,
|
||||
MCOS->EmitIntValue(Entry.getLineNumber(), 4);
|
||||
|
||||
// AT_low_pc, start address of the label.
|
||||
const MCExpr *AT_low_pc = MCSymbolRefExpr::Create(Entry.getLabel(),
|
||||
const MCExpr *AT_low_pc = MCSymbolRefExpr::create(Entry.getLabel(),
|
||||
MCSymbolRefExpr::VK_None, context);
|
||||
MCOS->EmitValue(AT_low_pc, AddrSize);
|
||||
|
||||
@ -812,7 +812,7 @@ static void EmitGenDwarfRanges(MCStreamer *MCOS) {
|
||||
assert(EndSymbol && "EndSymbol must not be NULL");
|
||||
|
||||
// Emit a base address selection entry for the start of this section
|
||||
const MCExpr *SectionStartAddr = MCSymbolRefExpr::Create(
|
||||
const MCExpr *SectionStartAddr = MCSymbolRefExpr::create(
|
||||
StartSymbol, MCSymbolRefExpr::VK_None, context);
|
||||
MCOS->EmitFill(AddrSize, 0xFF);
|
||||
MCOS->EmitValue(SectionStartAddr, AddrSize);
|
||||
|
@ -172,7 +172,7 @@ void MCELFStreamer::ChangeSection(MCSection *Section,
|
||||
|
||||
void MCELFStreamer::EmitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol) {
|
||||
getAssembler().registerSymbol(*Symbol);
|
||||
const MCExpr *Value = MCSymbolRefExpr::Create(
|
||||
const MCExpr *Value = MCSymbolRefExpr::create(
|
||||
Symbol, MCSymbolRefExpr::VK_WEAKREF, getContext());
|
||||
Alias->setVariableValue(Value);
|
||||
}
|
||||
@ -333,7 +333,7 @@ void MCELFStreamer::EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
|
||||
Symbol->setCommon(Size, ByteAlignment);
|
||||
}
|
||||
|
||||
Symbol->setSize(MCConstantExpr::Create(Size, getContext()));
|
||||
Symbol->setSize(MCConstantExpr::create(Size, getContext()));
|
||||
}
|
||||
|
||||
void MCELFStreamer::EmitELFSize(MCSymbol *Symbol, const MCExpr *Value) {
|
||||
|
@ -33,7 +33,7 @@ STATISTIC(MCExprEvaluate, "Number of MCExpr evaluations");
|
||||
void MCExpr::print(raw_ostream &OS) const {
|
||||
switch (getKind()) {
|
||||
case MCExpr::Target:
|
||||
return cast<MCTargetExpr>(this)->PrintImpl(OS);
|
||||
return cast<MCTargetExpr>(this)->printImpl(OS);
|
||||
case MCExpr::Constant:
|
||||
OS << cast<MCConstantExpr>(*this).getValue();
|
||||
return;
|
||||
@ -131,17 +131,17 @@ void MCExpr::dump() const {
|
||||
|
||||
/* *** */
|
||||
|
||||
const MCBinaryExpr *MCBinaryExpr::Create(Opcode Opc, const MCExpr *LHS,
|
||||
const MCBinaryExpr *MCBinaryExpr::create(Opcode Opc, const MCExpr *LHS,
|
||||
const MCExpr *RHS, MCContext &Ctx) {
|
||||
return new (Ctx) MCBinaryExpr(Opc, LHS, RHS);
|
||||
}
|
||||
|
||||
const MCUnaryExpr *MCUnaryExpr::Create(Opcode Opc, const MCExpr *Expr,
|
||||
const MCUnaryExpr *MCUnaryExpr::create(Opcode Opc, const MCExpr *Expr,
|
||||
MCContext &Ctx) {
|
||||
return new (Ctx) MCUnaryExpr(Opc, Expr);
|
||||
}
|
||||
|
||||
const MCConstantExpr *MCConstantExpr::Create(int64_t Value, MCContext &Ctx) {
|
||||
const MCConstantExpr *MCConstantExpr::create(int64_t Value, MCContext &Ctx) {
|
||||
return new (Ctx) MCConstantExpr(Value);
|
||||
}
|
||||
|
||||
@ -156,15 +156,15 @@ MCSymbolRefExpr::MCSymbolRefExpr(const MCSymbol *Symbol, VariantKind Kind,
|
||||
assert(Symbol);
|
||||
}
|
||||
|
||||
const MCSymbolRefExpr *MCSymbolRefExpr::Create(const MCSymbol *Sym,
|
||||
const MCSymbolRefExpr *MCSymbolRefExpr::create(const MCSymbol *Sym,
|
||||
VariantKind Kind,
|
||||
MCContext &Ctx) {
|
||||
return new (Ctx) MCSymbolRefExpr(Sym, Kind, Ctx.getAsmInfo());
|
||||
}
|
||||
|
||||
const MCSymbolRefExpr *MCSymbolRefExpr::Create(StringRef Name, VariantKind Kind,
|
||||
const MCSymbolRefExpr *MCSymbolRefExpr::create(StringRef Name, VariantKind Kind,
|
||||
MCContext &Ctx) {
|
||||
return Create(Ctx.getOrCreateSymbol(Name), Kind, Ctx);
|
||||
return create(Ctx.getOrCreateSymbol(Name), Kind, Ctx);
|
||||
}
|
||||
|
||||
StringRef MCSymbolRefExpr::getVariantKindName(VariantKind Kind) {
|
||||
@ -400,23 +400,23 @@ void MCTargetExpr::anchor() {}
|
||||
|
||||
/* *** */
|
||||
|
||||
bool MCExpr::EvaluateAsAbsolute(int64_t &Res) const {
|
||||
return EvaluateAsAbsolute(Res, nullptr, nullptr, nullptr);
|
||||
bool MCExpr::evaluateAsAbsolute(int64_t &Res) const {
|
||||
return evaluateAsAbsolute(Res, nullptr, nullptr, nullptr);
|
||||
}
|
||||
|
||||
bool MCExpr::EvaluateAsAbsolute(int64_t &Res,
|
||||
bool MCExpr::evaluateAsAbsolute(int64_t &Res,
|
||||
const MCAsmLayout &Layout) const {
|
||||
return EvaluateAsAbsolute(Res, &Layout.getAssembler(), &Layout, nullptr);
|
||||
return evaluateAsAbsolute(Res, &Layout.getAssembler(), &Layout, nullptr);
|
||||
}
|
||||
|
||||
bool MCExpr::EvaluateAsAbsolute(int64_t &Res,
|
||||
bool MCExpr::evaluateAsAbsolute(int64_t &Res,
|
||||
const MCAsmLayout &Layout,
|
||||
const SectionAddrMap &Addrs) const {
|
||||
return EvaluateAsAbsolute(Res, &Layout.getAssembler(), &Layout, &Addrs);
|
||||
return evaluateAsAbsolute(Res, &Layout.getAssembler(), &Layout, &Addrs);
|
||||
}
|
||||
|
||||
bool MCExpr::EvaluateAsAbsolute(int64_t &Res, const MCAssembler &Asm) const {
|
||||
return EvaluateAsAbsolute(Res, &Asm, nullptr, nullptr);
|
||||
bool MCExpr::evaluateAsAbsolute(int64_t &Res, const MCAssembler &Asm) const {
|
||||
return evaluateAsAbsolute(Res, &Asm, nullptr, nullptr);
|
||||
}
|
||||
|
||||
bool MCExpr::evaluateKnownAbsolute(int64_t &Res,
|
||||
@ -425,7 +425,7 @@ bool MCExpr::evaluateKnownAbsolute(int64_t &Res,
|
||||
true);
|
||||
}
|
||||
|
||||
bool MCExpr::EvaluateAsAbsolute(int64_t &Res, const MCAssembler *Asm,
|
||||
bool MCExpr::evaluateAsAbsolute(int64_t &Res, const MCAssembler *Asm,
|
||||
const MCAsmLayout *Layout,
|
||||
const SectionAddrMap *Addrs) const {
|
||||
// FIXME: The use if InSet = Addrs is a hack. Setting InSet causes us
|
||||
@ -446,7 +446,7 @@ bool MCExpr::evaluateAsAbsolute(int64_t &Res, const MCAssembler *Asm,
|
||||
}
|
||||
|
||||
bool IsRelocatable =
|
||||
EvaluateAsRelocatableImpl(Value, Asm, Layout, nullptr, Addrs, InSet);
|
||||
evaluateAsRelocatableImpl(Value, Asm, Layout, nullptr, Addrs, InSet);
|
||||
|
||||
// Record the current value.
|
||||
Res = Value.getConstant();
|
||||
@ -586,17 +586,17 @@ EvaluateSymbolicAdd(const MCAssembler *Asm, const MCAsmLayout *Layout,
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MCExpr::EvaluateAsRelocatable(MCValue &Res,
|
||||
bool MCExpr::evaluateAsRelocatable(MCValue &Res,
|
||||
const MCAsmLayout *Layout,
|
||||
const MCFixup *Fixup) const {
|
||||
MCAssembler *Assembler = Layout ? &Layout->getAssembler() : nullptr;
|
||||
return EvaluateAsRelocatableImpl(Res, Assembler, Layout, Fixup, nullptr,
|
||||
return evaluateAsRelocatableImpl(Res, Assembler, Layout, Fixup, nullptr,
|
||||
false);
|
||||
}
|
||||
|
||||
bool MCExpr::evaluateAsValue(MCValue &Res, const MCAsmLayout &Layout) const {
|
||||
MCAssembler *Assembler = &Layout.getAssembler();
|
||||
return EvaluateAsRelocatableImpl(Res, Assembler, &Layout, nullptr, nullptr,
|
||||
return evaluateAsRelocatableImpl(Res, Assembler, &Layout, nullptr, nullptr,
|
||||
true);
|
||||
}
|
||||
|
||||
@ -608,7 +608,7 @@ static bool canExpand(const MCSymbol &Sym, const MCAssembler *Asm, bool InSet) {
|
||||
return !Asm->getWriter().isWeak(Sym);
|
||||
}
|
||||
|
||||
bool MCExpr::EvaluateAsRelocatableImpl(MCValue &Res, const MCAssembler *Asm,
|
||||
bool MCExpr::evaluateAsRelocatableImpl(MCValue &Res, const MCAssembler *Asm,
|
||||
const MCAsmLayout *Layout,
|
||||
const MCFixup *Fixup,
|
||||
const SectionAddrMap *Addrs,
|
||||
@ -617,7 +617,7 @@ bool MCExpr::EvaluateAsRelocatableImpl(MCValue &Res, const MCAssembler *Asm,
|
||||
|
||||
switch (getKind()) {
|
||||
case Target:
|
||||
return cast<MCTargetExpr>(this)->EvaluateAsRelocatableImpl(Res, Layout,
|
||||
return cast<MCTargetExpr>(this)->evaluateAsRelocatableImpl(Res, Layout,
|
||||
Fixup);
|
||||
|
||||
case Constant:
|
||||
@ -632,7 +632,7 @@ bool MCExpr::EvaluateAsRelocatableImpl(MCValue &Res, const MCAssembler *Asm,
|
||||
if (Sym.isVariable() && SRE->getKind() == MCSymbolRefExpr::VK_None &&
|
||||
canExpand(Sym, Asm, InSet)) {
|
||||
bool IsMachO = SRE->hasSubsectionsViaSymbols();
|
||||
if (Sym.getVariableValue()->EvaluateAsRelocatableImpl(
|
||||
if (Sym.getVariableValue()->evaluateAsRelocatableImpl(
|
||||
Res, Asm, Layout, Fixup, Addrs, InSet || IsMachO)) {
|
||||
if (!IsMachO)
|
||||
return true;
|
||||
@ -658,7 +658,7 @@ bool MCExpr::EvaluateAsRelocatableImpl(MCValue &Res, const MCAssembler *Asm,
|
||||
const MCUnaryExpr *AUE = cast<MCUnaryExpr>(this);
|
||||
MCValue Value;
|
||||
|
||||
if (!AUE->getSubExpr()->EvaluateAsRelocatableImpl(Value, Asm, Layout, Fixup,
|
||||
if (!AUE->getSubExpr()->evaluateAsRelocatableImpl(Value, Asm, Layout, Fixup,
|
||||
Addrs, InSet))
|
||||
return false;
|
||||
|
||||
@ -692,9 +692,9 @@ bool MCExpr::EvaluateAsRelocatableImpl(MCValue &Res, const MCAssembler *Asm,
|
||||
const MCBinaryExpr *ABE = cast<MCBinaryExpr>(this);
|
||||
MCValue LHSValue, RHSValue;
|
||||
|
||||
if (!ABE->getLHS()->EvaluateAsRelocatableImpl(LHSValue, Asm, Layout, Fixup,
|
||||
if (!ABE->getLHS()->evaluateAsRelocatableImpl(LHSValue, Asm, Layout, Fixup,
|
||||
Addrs, InSet) ||
|
||||
!ABE->getRHS()->EvaluateAsRelocatableImpl(RHSValue, Asm, Layout, Fixup,
|
||||
!ABE->getRHS()->evaluateAsRelocatableImpl(RHSValue, Asm, Layout, Fixup,
|
||||
Addrs, InSet))
|
||||
return false;
|
||||
|
||||
@ -752,11 +752,11 @@ bool MCExpr::EvaluateAsRelocatableImpl(MCValue &Res, const MCAssembler *Asm,
|
||||
llvm_unreachable("Invalid assembly expression kind!");
|
||||
}
|
||||
|
||||
MCSection *MCExpr::FindAssociatedSection() const {
|
||||
MCSection *MCExpr::findAssociatedSection() const {
|
||||
switch (getKind()) {
|
||||
case Target:
|
||||
// We never look through target specific expressions.
|
||||
return cast<MCTargetExpr>(this)->FindAssociatedSection();
|
||||
return cast<MCTargetExpr>(this)->findAssociatedSection();
|
||||
|
||||
case Constant:
|
||||
return MCSymbol::AbsolutePseudoSection;
|
||||
@ -772,12 +772,12 @@ MCSection *MCExpr::FindAssociatedSection() const {
|
||||
}
|
||||
|
||||
case Unary:
|
||||
return cast<MCUnaryExpr>(this)->getSubExpr()->FindAssociatedSection();
|
||||
return cast<MCUnaryExpr>(this)->getSubExpr()->findAssociatedSection();
|
||||
|
||||
case Binary: {
|
||||
const MCBinaryExpr *BE = cast<MCBinaryExpr>(this);
|
||||
MCSection *LHS_S = BE->getLHS()->FindAssociatedSection();
|
||||
MCSection *RHS_S = BE->getRHS()->FindAssociatedSection();
|
||||
MCSection *LHS_S = BE->getLHS()->findAssociatedSection();
|
||||
MCSection *RHS_S = BE->getRHS()->findAssociatedSection();
|
||||
|
||||
// If either section is absolute, return the other.
|
||||
if (LHS_S == MCSymbol::AbsolutePseudoSection)
|
||||
|
@ -136,7 +136,7 @@ void MCObjectStreamer::EmitValueImpl(const MCExpr *Value, unsigned Size,
|
||||
|
||||
// Avoid fixups when possible.
|
||||
int64_t AbsValue;
|
||||
if (Value->EvaluateAsAbsolute(AbsValue, getAssembler())) {
|
||||
if (Value->evaluateAsAbsolute(AbsValue, getAssembler())) {
|
||||
EmitIntValue(AbsValue, Size);
|
||||
return;
|
||||
}
|
||||
@ -178,7 +178,7 @@ void MCObjectStreamer::EmitLabel(MCSymbol *Symbol) {
|
||||
|
||||
void MCObjectStreamer::EmitULEB128Value(const MCExpr *Value) {
|
||||
int64_t IntValue;
|
||||
if (Value->EvaluateAsAbsolute(IntValue, getAssembler())) {
|
||||
if (Value->evaluateAsAbsolute(IntValue, getAssembler())) {
|
||||
EmitULEB128IntValue(IntValue);
|
||||
return;
|
||||
}
|
||||
@ -187,7 +187,7 @@ void MCObjectStreamer::EmitULEB128Value(const MCExpr *Value) {
|
||||
|
||||
void MCObjectStreamer::EmitSLEB128Value(const MCExpr *Value) {
|
||||
int64_t IntValue;
|
||||
if (Value->EvaluateAsAbsolute(IntValue, getAssembler())) {
|
||||
if (Value->evaluateAsAbsolute(IntValue, getAssembler())) {
|
||||
EmitSLEB128IntValue(IntValue);
|
||||
return;
|
||||
}
|
||||
@ -213,7 +213,7 @@ bool MCObjectStreamer::changeSectionImpl(MCSection *Section,
|
||||
|
||||
int64_t IntSubsection = 0;
|
||||
if (Subsection &&
|
||||
!Subsection->EvaluateAsAbsolute(IntSubsection, getAssembler()))
|
||||
!Subsection->evaluateAsAbsolute(IntSubsection, getAssembler()))
|
||||
report_fatal_error("Cannot evaluate subsection number");
|
||||
if (IntSubsection < 0 || IntSubsection > 8192)
|
||||
report_fatal_error("Subsection number out of range");
|
||||
@ -320,10 +320,10 @@ static const MCExpr *buildSymbolDiff(MCObjectStreamer &OS, const MCSymbol *A,
|
||||
const MCSymbol *B) {
|
||||
MCContext &Context = OS.getContext();
|
||||
MCSymbolRefExpr::VariantKind Variant = MCSymbolRefExpr::VK_None;
|
||||
const MCExpr *ARef = MCSymbolRefExpr::Create(A, Variant, Context);
|
||||
const MCExpr *BRef = MCSymbolRefExpr::Create(B, Variant, Context);
|
||||
const MCExpr *ARef = MCSymbolRefExpr::create(A, Variant, Context);
|
||||
const MCExpr *BRef = MCSymbolRefExpr::create(B, Variant, Context);
|
||||
const MCExpr *AddrDelta =
|
||||
MCBinaryExpr::Create(MCBinaryExpr::Sub, ARef, BRef, Context);
|
||||
MCBinaryExpr::create(MCBinaryExpr::Sub, ARef, BRef, Context);
|
||||
return AddrDelta;
|
||||
}
|
||||
|
||||
@ -349,7 +349,7 @@ void MCObjectStreamer::EmitDwarfAdvanceLineAddr(int64_t LineDelta,
|
||||
}
|
||||
const MCExpr *AddrDelta = buildSymbolDiff(*this, Label, LastLabel);
|
||||
int64_t Res;
|
||||
if (AddrDelta->EvaluateAsAbsolute(Res, getAssembler())) {
|
||||
if (AddrDelta->evaluateAsAbsolute(Res, getAssembler())) {
|
||||
MCDwarfLineAddr::Emit(this, LineDelta, Res);
|
||||
return;
|
||||
}
|
||||
@ -360,7 +360,7 @@ void MCObjectStreamer::EmitDwarfAdvanceFrameAddr(const MCSymbol *LastLabel,
|
||||
const MCSymbol *Label) {
|
||||
const MCExpr *AddrDelta = buildSymbolDiff(*this, Label, LastLabel);
|
||||
int64_t Res;
|
||||
if (AddrDelta->EvaluateAsAbsolute(Res, getAssembler())) {
|
||||
if (AddrDelta->evaluateAsAbsolute(Res, getAssembler())) {
|
||||
MCDwarfFrameEmitter::EmitAdvanceLoc(*this, Res);
|
||||
return;
|
||||
}
|
||||
@ -395,7 +395,7 @@ void MCObjectStreamer::EmitCodeAlignment(unsigned ByteAlignment,
|
||||
bool MCObjectStreamer::EmitValueToOffset(const MCExpr *Offset,
|
||||
unsigned char Value) {
|
||||
int64_t Res;
|
||||
if (Offset->EvaluateAsAbsolute(Res, getAssembler())) {
|
||||
if (Offset->evaluateAsAbsolute(Res, getAssembler())) {
|
||||
insert(new MCOrgFragment(*Offset, Value));
|
||||
return false;
|
||||
}
|
||||
@ -404,11 +404,11 @@ bool MCObjectStreamer::EmitValueToOffset(const MCExpr *Offset,
|
||||
EmitLabel(CurrentPos);
|
||||
MCSymbolRefExpr::VariantKind Variant = MCSymbolRefExpr::VK_None;
|
||||
const MCExpr *Ref =
|
||||
MCSymbolRefExpr::Create(CurrentPos, Variant, getContext());
|
||||
MCSymbolRefExpr::create(CurrentPos, Variant, getContext());
|
||||
const MCExpr *Delta =
|
||||
MCBinaryExpr::Create(MCBinaryExpr::Sub, Offset, Ref, getContext());
|
||||
MCBinaryExpr::create(MCBinaryExpr::Sub, Offset, Ref, getContext());
|
||||
|
||||
if (!Delta->EvaluateAsAbsolute(Res, getAssembler()))
|
||||
if (!Delta->evaluateAsAbsolute(Res, getAssembler()))
|
||||
return true;
|
||||
EmitFill(Res, Value);
|
||||
return false;
|
||||
|
@ -789,7 +789,7 @@ bool AsmParser::parsePrimaryExpr(const MCExpr *&Res, SMLoc &EndLoc) {
|
||||
Lex(); // Eat the operator.
|
||||
if (parsePrimaryExpr(Res, EndLoc))
|
||||
return true;
|
||||
Res = MCUnaryExpr::CreateLNot(Res, getContext());
|
||||
Res = MCUnaryExpr::createLNot(Res, getContext());
|
||||
return false;
|
||||
case AsmToken::Dollar:
|
||||
case AsmToken::At:
|
||||
@ -803,7 +803,7 @@ bool AsmParser::parsePrimaryExpr(const MCExpr *&Res, SMLoc &EndLoc) {
|
||||
// temporary label to the streamer and refer to it.
|
||||
MCSymbol *Sym = Ctx.createTempSymbol();
|
||||
Out.EmitLabel(Sym);
|
||||
Res = MCSymbolRefExpr::Create(Sym, MCSymbolRefExpr::VK_None,
|
||||
Res = MCSymbolRefExpr::create(Sym, MCSymbolRefExpr::VK_None,
|
||||
getContext());
|
||||
EndLoc = FirstTokenLoc;
|
||||
return false;
|
||||
@ -871,7 +871,7 @@ bool AsmParser::parsePrimaryExpr(const MCExpr *&Res, SMLoc &EndLoc) {
|
||||
}
|
||||
|
||||
// Otherwise create a symbol ref.
|
||||
Res = MCSymbolRefExpr::Create(Sym, Variant, getContext());
|
||||
Res = MCSymbolRefExpr::create(Sym, Variant, getContext());
|
||||
return false;
|
||||
}
|
||||
case AsmToken::BigNum:
|
||||
@ -879,7 +879,7 @@ bool AsmParser::parsePrimaryExpr(const MCExpr *&Res, SMLoc &EndLoc) {
|
||||
case AsmToken::Integer: {
|
||||
SMLoc Loc = getTok().getLoc();
|
||||
int64_t IntVal = getTok().getIntVal();
|
||||
Res = MCConstantExpr::Create(IntVal, getContext());
|
||||
Res = MCConstantExpr::create(IntVal, getContext());
|
||||
EndLoc = Lexer.getTok().getEndLoc();
|
||||
Lex(); // Eat token.
|
||||
// Look for 'b' or 'f' following an Integer as a directional label
|
||||
@ -897,7 +897,7 @@ bool AsmParser::parsePrimaryExpr(const MCExpr *&Res, SMLoc &EndLoc) {
|
||||
if (IDVal == "f" || IDVal == "b") {
|
||||
MCSymbol *Sym =
|
||||
Ctx.getDirectionalLocalSymbol(IntVal, IDVal == "b");
|
||||
Res = MCSymbolRefExpr::Create(Sym, Variant, getContext());
|
||||
Res = MCSymbolRefExpr::create(Sym, Variant, getContext());
|
||||
if (IDVal == "b" && Sym->isUndefined())
|
||||
return Error(Loc, "invalid reference to undefined symbol");
|
||||
EndLoc = Lexer.getTok().getEndLoc();
|
||||
@ -909,7 +909,7 @@ bool AsmParser::parsePrimaryExpr(const MCExpr *&Res, SMLoc &EndLoc) {
|
||||
case AsmToken::Real: {
|
||||
APFloat RealVal(APFloat::IEEEdouble, getTok().getString());
|
||||
uint64_t IntVal = RealVal.bitcastToAPInt().getZExtValue();
|
||||
Res = MCConstantExpr::Create(IntVal, getContext());
|
||||
Res = MCConstantExpr::create(IntVal, getContext());
|
||||
EndLoc = Lexer.getTok().getEndLoc();
|
||||
Lex(); // Eat token.
|
||||
return false;
|
||||
@ -919,7 +919,7 @@ bool AsmParser::parsePrimaryExpr(const MCExpr *&Res, SMLoc &EndLoc) {
|
||||
// temporary label to the streamer and refer to it.
|
||||
MCSymbol *Sym = Ctx.createTempSymbol();
|
||||
Out.EmitLabel(Sym);
|
||||
Res = MCSymbolRefExpr::Create(Sym, MCSymbolRefExpr::VK_None, getContext());
|
||||
Res = MCSymbolRefExpr::create(Sym, MCSymbolRefExpr::VK_None, getContext());
|
||||
EndLoc = Lexer.getTok().getEndLoc();
|
||||
Lex(); // Eat identifier.
|
||||
return false;
|
||||
@ -936,19 +936,19 @@ bool AsmParser::parsePrimaryExpr(const MCExpr *&Res, SMLoc &EndLoc) {
|
||||
Lex(); // Eat the operator.
|
||||
if (parsePrimaryExpr(Res, EndLoc))
|
||||
return true;
|
||||
Res = MCUnaryExpr::CreateMinus(Res, getContext());
|
||||
Res = MCUnaryExpr::createMinus(Res, getContext());
|
||||
return false;
|
||||
case AsmToken::Plus:
|
||||
Lex(); // Eat the operator.
|
||||
if (parsePrimaryExpr(Res, EndLoc))
|
||||
return true;
|
||||
Res = MCUnaryExpr::CreatePlus(Res, getContext());
|
||||
Res = MCUnaryExpr::createPlus(Res, getContext());
|
||||
return false;
|
||||
case AsmToken::Tilde:
|
||||
Lex(); // Eat the operator.
|
||||
if (parsePrimaryExpr(Res, EndLoc))
|
||||
return true;
|
||||
Res = MCUnaryExpr::CreateNot(Res, getContext());
|
||||
Res = MCUnaryExpr::createNot(Res, getContext());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -981,7 +981,7 @@ AsmParser::applyModifierToExpr(const MCExpr *E,
|
||||
return E;
|
||||
}
|
||||
|
||||
return MCSymbolRefExpr::Create(&SRE->getSymbol(), Variant, getContext());
|
||||
return MCSymbolRefExpr::create(&SRE->getSymbol(), Variant, getContext());
|
||||
}
|
||||
|
||||
case MCExpr::Unary: {
|
||||
@ -989,7 +989,7 @@ AsmParser::applyModifierToExpr(const MCExpr *E,
|
||||
const MCExpr *Sub = applyModifierToExpr(UE->getSubExpr(), Variant);
|
||||
if (!Sub)
|
||||
return nullptr;
|
||||
return MCUnaryExpr::Create(UE->getOpcode(), Sub, getContext());
|
||||
return MCUnaryExpr::create(UE->getOpcode(), Sub, getContext());
|
||||
}
|
||||
|
||||
case MCExpr::Binary: {
|
||||
@ -1005,7 +1005,7 @@ AsmParser::applyModifierToExpr(const MCExpr *E,
|
||||
if (!RHS)
|
||||
RHS = BE->getRHS();
|
||||
|
||||
return MCBinaryExpr::Create(BE->getOpcode(), LHS, RHS, getContext());
|
||||
return MCBinaryExpr::create(BE->getOpcode(), LHS, RHS, getContext());
|
||||
}
|
||||
}
|
||||
|
||||
@ -1054,8 +1054,8 @@ bool AsmParser::parseExpression(const MCExpr *&Res, SMLoc &EndLoc) {
|
||||
|
||||
// Try to constant fold it up front, if possible.
|
||||
int64_t Value;
|
||||
if (Res->EvaluateAsAbsolute(Value))
|
||||
Res = MCConstantExpr::Create(Value, getContext());
|
||||
if (Res->evaluateAsAbsolute(Value))
|
||||
Res = MCConstantExpr::create(Value, getContext());
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -1072,7 +1072,7 @@ bool AsmParser::parseAbsoluteExpression(int64_t &Res) {
|
||||
if (parseExpression(Expr))
|
||||
return true;
|
||||
|
||||
if (!Expr->EvaluateAsAbsolute(Res))
|
||||
if (!Expr->evaluateAsAbsolute(Res))
|
||||
return Error(StartLoc, "expected absolute expression");
|
||||
|
||||
return false;
|
||||
@ -1183,7 +1183,7 @@ bool AsmParser::parseBinOpRHS(unsigned Precedence, const MCExpr *&Res,
|
||||
return true;
|
||||
|
||||
// Merge LHS and RHS according to operator.
|
||||
Res = MCBinaryExpr::Create(Kind, Res, RHS, getContext());
|
||||
Res = MCBinaryExpr::create(Kind, Res, RHS, getContext());
|
||||
}
|
||||
}
|
||||
|
||||
@ -4378,7 +4378,7 @@ bool AsmParser::parseDirectiveRept(SMLoc DirectiveLoc, StringRef Dir) {
|
||||
return true;
|
||||
|
||||
int64_t Count;
|
||||
if (!CountExpr->EvaluateAsAbsolute(Count)) {
|
||||
if (!CountExpr->evaluateAsAbsolute(Count)) {
|
||||
eatToEndOfStatement();
|
||||
return Error(CountLoc, "unexpected token in '" + Dir + "' directive");
|
||||
}
|
||||
|
@ -663,7 +663,7 @@ bool ELFAsmParser::ParseDirectiveSymver(StringRef, SMLoc) {
|
||||
|
||||
MCSymbol *Alias = getContext().getOrCreateSymbol(AliasName);
|
||||
MCSymbol *Sym = getContext().getOrCreateSymbol(Name);
|
||||
const MCExpr *Value = MCSymbolRefExpr::Create(Sym, getContext());
|
||||
const MCExpr *Value = MCSymbolRefExpr::create(Sym, getContext());
|
||||
|
||||
getStreamer().EmitAssignment(Alias, Value);
|
||||
return false;
|
||||
|
@ -117,7 +117,7 @@ void MCStreamer::EmitSymbolValue(const MCSymbol *Sym, unsigned Size,
|
||||
"SectionRelative value requires 4-bytes");
|
||||
|
||||
if (!IsSectionRelative)
|
||||
EmitValueImpl(MCSymbolRefExpr::Create(Sym, getContext()), Size);
|
||||
EmitValueImpl(MCSymbolRefExpr::create(Sym, getContext()), Size);
|
||||
else
|
||||
EmitCOFFSecRel32(Sym);
|
||||
}
|
||||
@ -133,7 +133,7 @@ void MCStreamer::EmitGPRel32Value(const MCExpr *Value) {
|
||||
/// EmitFill - Emit NumBytes bytes worth of the value specified by
|
||||
/// FillValue. This implements directives such as '.space'.
|
||||
void MCStreamer::EmitFill(uint64_t NumBytes, uint8_t FillValue) {
|
||||
const MCExpr *E = MCConstantExpr::Create(FillValue, getContext());
|
||||
const MCExpr *E = MCConstantExpr::create(FillValue, getContext());
|
||||
for (uint64_t i = 0, e = NumBytes; i != e; ++i)
|
||||
EmitValue(E, 1);
|
||||
}
|
||||
|
@ -51,8 +51,8 @@ static void EmitAbsDifference(MCStreamer &Streamer, const MCSymbol *LHS,
|
||||
const MCSymbol *RHS) {
|
||||
MCContext &Context = Streamer.getContext();
|
||||
const MCExpr *Diff =
|
||||
MCBinaryExpr::CreateSub(MCSymbolRefExpr::Create(LHS, Context),
|
||||
MCSymbolRefExpr::Create(RHS, Context), Context);
|
||||
MCBinaryExpr::createSub(MCSymbolRefExpr::create(LHS, Context),
|
||||
MCSymbolRefExpr::create(RHS, Context), Context);
|
||||
Streamer.EmitValue(Diff, 1);
|
||||
}
|
||||
|
||||
@ -126,13 +126,13 @@ static void EmitSymbolRefWithOfs(MCStreamer &streamer,
|
||||
const MCSymbol *Base,
|
||||
const MCSymbol *Other) {
|
||||
MCContext &Context = streamer.getContext();
|
||||
const MCSymbolRefExpr *BaseRef = MCSymbolRefExpr::Create(Base, Context);
|
||||
const MCSymbolRefExpr *OtherRef = MCSymbolRefExpr::Create(Other, Context);
|
||||
const MCExpr *Ofs = MCBinaryExpr::CreateSub(OtherRef, BaseRef, Context);
|
||||
const MCSymbolRefExpr *BaseRefRel = MCSymbolRefExpr::Create(Base,
|
||||
const MCSymbolRefExpr *BaseRef = MCSymbolRefExpr::create(Base, Context);
|
||||
const MCSymbolRefExpr *OtherRef = MCSymbolRefExpr::create(Other, Context);
|
||||
const MCExpr *Ofs = MCBinaryExpr::createSub(OtherRef, BaseRef, Context);
|
||||
const MCSymbolRefExpr *BaseRefRel = MCSymbolRefExpr::create(Base,
|
||||
MCSymbolRefExpr::VK_COFF_IMGREL32,
|
||||
Context);
|
||||
streamer.EmitValue(MCBinaryExpr::CreateAdd(BaseRefRel, Ofs, Context), 4);
|
||||
streamer.EmitValue(MCBinaryExpr::createAdd(BaseRefRel, Ofs, Context), 4);
|
||||
}
|
||||
|
||||
static void EmitRuntimeFunction(MCStreamer &streamer,
|
||||
@ -142,7 +142,7 @@ static void EmitRuntimeFunction(MCStreamer &streamer,
|
||||
streamer.EmitValueToAlignment(4);
|
||||
EmitSymbolRefWithOfs(streamer, info->Function, info->Begin);
|
||||
EmitSymbolRefWithOfs(streamer, info->Function, info->End);
|
||||
streamer.EmitValue(MCSymbolRefExpr::Create(info->Symbol,
|
||||
streamer.EmitValue(MCSymbolRefExpr::create(info->Symbol,
|
||||
MCSymbolRefExpr::VK_COFF_IMGREL32,
|
||||
context), 4);
|
||||
}
|
||||
@ -207,7 +207,7 @@ static void EmitUnwindInfo(MCStreamer &streamer, WinEH::FrameInfo *info) {
|
||||
EmitRuntimeFunction(streamer, info->ChainedParent);
|
||||
else if (flags &
|
||||
((Win64EH::UNW_TerminateHandler|Win64EH::UNW_ExceptionHandler) << 3))
|
||||
streamer.EmitValue(MCSymbolRefExpr::Create(info->ExceptionHandler,
|
||||
streamer.EmitValue(MCSymbolRefExpr::create(info->ExceptionHandler,
|
||||
MCSymbolRefExpr::VK_COFF_IMGREL32,
|
||||
context), 4);
|
||||
else if (numCodes == 0) {
|
||||
|
@ -81,7 +81,7 @@ uint64_t MachObjectWriter::getSymbolAddress(const MCSymbol &S,
|
||||
|
||||
|
||||
MCValue Target;
|
||||
if (!S.getVariableValue()->EvaluateAsRelocatable(Target, &Layout, nullptr))
|
||||
if (!S.getVariableValue()->evaluateAsRelocatable(Target, &Layout, nullptr))
|
||||
report_fatal_error("unable to evaluate offset for variable '" +
|
||||
S.getName() + "'");
|
||||
|
||||
|
@ -160,7 +160,7 @@ void MCWinCOFFStreamer::EndCOFFSymbolDef() {
|
||||
|
||||
void MCWinCOFFStreamer::EmitCOFFSectionIndex(MCSymbol const *Symbol) {
|
||||
MCDataFragment *DF = getOrCreateDataFragment();
|
||||
const MCSymbolRefExpr *SRE = MCSymbolRefExpr::Create(Symbol, getContext());
|
||||
const MCSymbolRefExpr *SRE = MCSymbolRefExpr::create(Symbol, getContext());
|
||||
MCFixup Fixup = MCFixup::create(DF->getContents().size(), SRE, FK_SecRel_2);
|
||||
DF->getFixups().push_back(Fixup);
|
||||
DF->getContents().resize(DF->getContents().size() + 2, 0);
|
||||
@ -168,7 +168,7 @@ void MCWinCOFFStreamer::EmitCOFFSectionIndex(MCSymbol const *Symbol) {
|
||||
|
||||
void MCWinCOFFStreamer::EmitCOFFSecRel32(MCSymbol const *Symbol) {
|
||||
MCDataFragment *DF = getOrCreateDataFragment();
|
||||
const MCSymbolRefExpr *SRE = MCSymbolRefExpr::Create(Symbol, getContext());
|
||||
const MCSymbolRefExpr *SRE = MCSymbolRefExpr::create(Symbol, getContext());
|
||||
MCFixup Fixup = MCFixup::create(DF->getContents().size(), SRE, FK_SecRel_4);
|
||||
DF->getFixups().push_back(Fixup);
|
||||
DF->getContents().resize(DF->getContents().size() + 4, 0);
|
||||
|
@ -69,10 +69,10 @@ MCOperand AArch64MCInstLower::lowerSymbolOperandDarwin(const MachineOperand &MO,
|
||||
AArch64II::MO_PAGEOFF)
|
||||
RefKind = MCSymbolRefExpr::VK_PAGEOFF;
|
||||
}
|
||||
const MCExpr *Expr = MCSymbolRefExpr::Create(Sym, RefKind, Ctx);
|
||||
const MCExpr *Expr = MCSymbolRefExpr::create(Sym, RefKind, Ctx);
|
||||
if (!MO.isJTI() && MO.getOffset())
|
||||
Expr = MCBinaryExpr::CreateAdd(
|
||||
Expr, MCConstantExpr::Create(MO.getOffset(), Ctx), Ctx);
|
||||
Expr = MCBinaryExpr::createAdd(
|
||||
Expr, MCConstantExpr::create(MO.getOffset(), Ctx), Ctx);
|
||||
return MCOperand::createExpr(Expr);
|
||||
}
|
||||
|
||||
@ -139,14 +139,14 @@ MCOperand AArch64MCInstLower::lowerSymbolOperandELF(const MachineOperand &MO,
|
||||
RefFlags |= AArch64MCExpr::VK_NC;
|
||||
|
||||
const MCExpr *Expr =
|
||||
MCSymbolRefExpr::Create(Sym, MCSymbolRefExpr::VK_None, Ctx);
|
||||
MCSymbolRefExpr::create(Sym, MCSymbolRefExpr::VK_None, Ctx);
|
||||
if (!MO.isJTI() && MO.getOffset())
|
||||
Expr = MCBinaryExpr::CreateAdd(
|
||||
Expr, MCConstantExpr::Create(MO.getOffset(), Ctx), Ctx);
|
||||
Expr = MCBinaryExpr::createAdd(
|
||||
Expr, MCConstantExpr::create(MO.getOffset(), Ctx), Ctx);
|
||||
|
||||
AArch64MCExpr::VariantKind RefKind;
|
||||
RefKind = static_cast<AArch64MCExpr::VariantKind>(RefFlags);
|
||||
Expr = AArch64MCExpr::Create(Expr, RefKind, Ctx);
|
||||
Expr = AArch64MCExpr::create(Expr, RefKind, Ctx);
|
||||
|
||||
return MCOperand::createExpr(Expr);
|
||||
}
|
||||
@ -179,7 +179,7 @@ bool AArch64MCInstLower::lowerOperand(const MachineOperand &MO,
|
||||
break;
|
||||
case MachineOperand::MO_MachineBasicBlock:
|
||||
MCOp = MCOperand::createExpr(
|
||||
MCSymbolRefExpr::Create(MO.getMBB()->getSymbol(), Ctx));
|
||||
MCSymbolRefExpr::create(MO.getMBB()->getSymbol(), Ctx));
|
||||
break;
|
||||
case MachineOperand::MO_GlobalAddress:
|
||||
MCOp = LowerSymbolOperand(MO, GetGlobalAddressSymbol(MO));
|
||||
|
@ -40,11 +40,11 @@ const MCExpr *AArch64_MachoTargetObjectFile::getTTypeGlobalReference(
|
||||
if (Encoding & (DW_EH_PE_indirect | DW_EH_PE_pcrel)) {
|
||||
const MCSymbol *Sym = TM.getSymbol(GV, Mang);
|
||||
const MCExpr *Res =
|
||||
MCSymbolRefExpr::Create(Sym, MCSymbolRefExpr::VK_GOT, getContext());
|
||||
MCSymbolRefExpr::create(Sym, MCSymbolRefExpr::VK_GOT, getContext());
|
||||
MCSymbol *PCSym = getContext().createTempSymbol();
|
||||
Streamer.EmitLabel(PCSym);
|
||||
const MCExpr *PC = MCSymbolRefExpr::Create(PCSym, getContext());
|
||||
return MCBinaryExpr::CreateSub(Res, PC, getContext());
|
||||
const MCExpr *PC = MCSymbolRefExpr::create(PCSym, getContext());
|
||||
return MCBinaryExpr::createSub(Res, PC, getContext());
|
||||
}
|
||||
|
||||
return TargetLoweringObjectFileMachO::getTTypeGlobalReference(
|
||||
@ -65,9 +65,9 @@ const MCExpr *AArch64_MachoTargetObjectFile::getIndirectSymViaGOTPCRel(
|
||||
// On ARM64 Darwin, we can reference symbols with foo@GOT-., which
|
||||
// is an indirect pc-relative reference.
|
||||
const MCExpr *Res =
|
||||
MCSymbolRefExpr::Create(Sym, MCSymbolRefExpr::VK_GOT, getContext());
|
||||
MCSymbolRefExpr::create(Sym, MCSymbolRefExpr::VK_GOT, getContext());
|
||||
MCSymbol *PCSym = getContext().createTempSymbol();
|
||||
Streamer.EmitLabel(PCSym);
|
||||
const MCExpr *PC = MCSymbolRefExpr::Create(PCSym, getContext());
|
||||
return MCBinaryExpr::CreateSub(Res, PC, getContext());
|
||||
const MCExpr *PC = MCSymbolRefExpr::create(PCSym, getContext());
|
||||
return MCBinaryExpr::createSub(Res, PC, getContext());
|
||||
}
|
||||
|
@ -2024,7 +2024,7 @@ AArch64AsmParser::tryParseAdrpLabel(OperandVector &Operands) {
|
||||
// No modifier was specified at all; this is the syntax for an ELF basic
|
||||
// ADRP relocation (unfortunately).
|
||||
Expr =
|
||||
AArch64MCExpr::Create(Expr, AArch64MCExpr::VK_ABS_PAGE, getContext());
|
||||
AArch64MCExpr::create(Expr, AArch64MCExpr::VK_ABS_PAGE, getContext());
|
||||
} else if ((DarwinRefKind == MCSymbolRefExpr::VK_GOTPAGE ||
|
||||
DarwinRefKind == MCSymbolRefExpr::VK_TLVPPAGE) &&
|
||||
Addend != 0) {
|
||||
@ -2157,7 +2157,7 @@ AArch64AsmParser::tryParseAddSubImm(OperandVector &Operands) {
|
||||
if (MCE) {
|
||||
int64_t Val = MCE->getValue();
|
||||
if (Val > 0xfff && (Val & 0xfff) == 0) {
|
||||
Imm = MCConstantExpr::Create(Val >> 12, getContext());
|
||||
Imm = MCConstantExpr::create(Val >> 12, getContext());
|
||||
ShiftAmount = 12;
|
||||
}
|
||||
}
|
||||
@ -2347,14 +2347,14 @@ bool AArch64AsmParser::parseSysAlias(StringRef Name, SMLoc NameLoc,
|
||||
|
||||
#define SYS_ALIAS(op1, Cn, Cm, op2) \
|
||||
do { \
|
||||
Expr = MCConstantExpr::Create(op1, getContext()); \
|
||||
Expr = MCConstantExpr::create(op1, getContext()); \
|
||||
Operands.push_back( \
|
||||
AArch64Operand::CreateImm(Expr, S, getLoc(), getContext())); \
|
||||
Operands.push_back( \
|
||||
AArch64Operand::CreateSysCR(Cn, S, getLoc(), getContext())); \
|
||||
Operands.push_back( \
|
||||
AArch64Operand::CreateSysCR(Cm, S, getLoc(), getContext())); \
|
||||
Expr = MCConstantExpr::Create(op2, getContext()); \
|
||||
Expr = MCConstantExpr::create(op2, getContext()); \
|
||||
Operands.push_back( \
|
||||
AArch64Operand::CreateImm(Expr, S, getLoc(), getContext())); \
|
||||
} while (0)
|
||||
@ -2835,7 +2835,7 @@ bool AArch64AsmParser::parseSymbolicImmVal(const MCExpr *&ImmVal) {
|
||||
return true;
|
||||
|
||||
if (HasELFModifier)
|
||||
ImmVal = AArch64MCExpr::Create(ImmVal, RefKind, getContext());
|
||||
ImmVal = AArch64MCExpr::create(ImmVal, RefKind, getContext());
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -3128,7 +3128,7 @@ bool AArch64AsmParser::parseOperand(OperandVector &Operands, bool isCondCode,
|
||||
if (ShiftAmt <= MaxShiftAmt && Imm <= 0xFFFF) {
|
||||
Operands[0] = AArch64Operand::CreateToken("movz", false, Loc, Ctx);
|
||||
Operands.push_back(AArch64Operand::CreateImm(
|
||||
MCConstantExpr::Create(Imm, Ctx), S, E, Ctx));
|
||||
MCConstantExpr::create(Imm, Ctx), S, E, Ctx));
|
||||
if (ShiftAmt)
|
||||
Operands.push_back(AArch64Operand::CreateShiftExtend(AArch64_AM::LSL,
|
||||
ShiftAmt, true, S, E, Ctx));
|
||||
@ -3634,8 +3634,8 @@ bool AArch64AsmParser::MatchAndEmitInstruction(SMLoc IDLoc, unsigned &Opcode,
|
||||
NewOp4Val = 63 - Op3Val;
|
||||
}
|
||||
|
||||
const MCExpr *NewOp3 = MCConstantExpr::Create(NewOp3Val, getContext());
|
||||
const MCExpr *NewOp4 = MCConstantExpr::Create(NewOp4Val, getContext());
|
||||
const MCExpr *NewOp3 = MCConstantExpr::create(NewOp3Val, getContext());
|
||||
const MCExpr *NewOp4 = MCConstantExpr::create(NewOp4Val, getContext());
|
||||
|
||||
Operands[0] = AArch64Operand::CreateToken(
|
||||
"ubfm", false, Op.getStartLoc(), getContext());
|
||||
@ -3685,8 +3685,8 @@ bool AArch64AsmParser::MatchAndEmitInstruction(SMLoc IDLoc, unsigned &Opcode,
|
||||
return Error(WidthOp.getStartLoc(),
|
||||
"requested insert overflows register");
|
||||
|
||||
const MCExpr *ImmRExpr = MCConstantExpr::Create(ImmR, getContext());
|
||||
const MCExpr *ImmSExpr = MCConstantExpr::Create(ImmS, getContext());
|
||||
const MCExpr *ImmRExpr = MCConstantExpr::create(ImmR, getContext());
|
||||
const MCExpr *ImmSExpr = MCConstantExpr::create(ImmS, getContext());
|
||||
Operands[0] = AArch64Operand::CreateToken(
|
||||
"bfm", false, Op.getStartLoc(), getContext());
|
||||
Operands[2] = AArch64Operand::CreateReg(
|
||||
@ -3742,9 +3742,9 @@ bool AArch64AsmParser::MatchAndEmitInstruction(SMLoc IDLoc, unsigned &Opcode,
|
||||
"requested insert overflows register");
|
||||
|
||||
const MCExpr *NewOp3 =
|
||||
MCConstantExpr::Create(NewOp3Val, getContext());
|
||||
MCConstantExpr::create(NewOp3Val, getContext());
|
||||
const MCExpr *NewOp4 =
|
||||
MCConstantExpr::Create(NewOp4Val, getContext());
|
||||
MCConstantExpr::create(NewOp4Val, getContext());
|
||||
Operands[3] = AArch64Operand::CreateImm(
|
||||
NewOp3, Op3.getStartLoc(), Op3.getEndLoc(), getContext());
|
||||
Operands[4] = AArch64Operand::CreateImm(
|
||||
@ -3800,7 +3800,7 @@ bool AArch64AsmParser::MatchAndEmitInstruction(SMLoc IDLoc, unsigned &Opcode,
|
||||
"requested extract overflows register");
|
||||
|
||||
const MCExpr *NewOp4 =
|
||||
MCConstantExpr::Create(NewOp4Val, getContext());
|
||||
MCConstantExpr::create(NewOp4Val, getContext());
|
||||
Operands[4] = AArch64Operand::CreateImm(
|
||||
NewOp4, Op4.getStartLoc(), Op4.getEndLoc(), getContext());
|
||||
if (Tok == "bfxil")
|
||||
@ -4106,8 +4106,8 @@ bool AArch64AsmParser::parseDirectiveTLSDescCall(SMLoc L) {
|
||||
return Error(L, "expected symbol after directive");
|
||||
|
||||
MCSymbol *Sym = getContext().getOrCreateSymbol(Name);
|
||||
const MCExpr *Expr = MCSymbolRefExpr::Create(Sym, getContext());
|
||||
Expr = AArch64MCExpr::Create(Expr, AArch64MCExpr::VK_TLSDESC, getContext());
|
||||
const MCExpr *Expr = MCSymbolRefExpr::create(Sym, getContext());
|
||||
Expr = AArch64MCExpr::create(Expr, AArch64MCExpr::VK_TLSDESC, getContext());
|
||||
|
||||
MCInst Inst;
|
||||
Inst.setOpcode(AArch64::TLSDESCCALL);
|
||||
|
@ -168,11 +168,11 @@ bool AArch64ExternalSymbolizer::tryAddingSymbolicOperand(
|
||||
MCSymbol *Sym = Ctx.getOrCreateSymbol(Name);
|
||||
MCSymbolRefExpr::VariantKind Variant = getVariant(SymbolicOp.VariantKind);
|
||||
if (Variant != MCSymbolRefExpr::VK_None)
|
||||
Add = MCSymbolRefExpr::Create(Sym, Variant, Ctx);
|
||||
Add = MCSymbolRefExpr::create(Sym, Variant, Ctx);
|
||||
else
|
||||
Add = MCSymbolRefExpr::Create(Sym, Ctx);
|
||||
Add = MCSymbolRefExpr::create(Sym, Ctx);
|
||||
} else {
|
||||
Add = MCConstantExpr::Create(SymbolicOp.AddSymbol.Value, Ctx);
|
||||
Add = MCConstantExpr::create(SymbolicOp.AddSymbol.Value, Ctx);
|
||||
}
|
||||
}
|
||||
|
||||
@ -181,37 +181,37 @@ bool AArch64ExternalSymbolizer::tryAddingSymbolicOperand(
|
||||
if (SymbolicOp.SubtractSymbol.Name) {
|
||||
StringRef Name(SymbolicOp.SubtractSymbol.Name);
|
||||
MCSymbol *Sym = Ctx.getOrCreateSymbol(Name);
|
||||
Sub = MCSymbolRefExpr::Create(Sym, Ctx);
|
||||
Sub = MCSymbolRefExpr::create(Sym, Ctx);
|
||||
} else {
|
||||
Sub = MCConstantExpr::Create(SymbolicOp.SubtractSymbol.Value, Ctx);
|
||||
Sub = MCConstantExpr::create(SymbolicOp.SubtractSymbol.Value, Ctx);
|
||||
}
|
||||
}
|
||||
|
||||
const MCExpr *Off = nullptr;
|
||||
if (SymbolicOp.Value != 0)
|
||||
Off = MCConstantExpr::Create(SymbolicOp.Value, Ctx);
|
||||
Off = MCConstantExpr::create(SymbolicOp.Value, Ctx);
|
||||
|
||||
const MCExpr *Expr;
|
||||
if (Sub) {
|
||||
const MCExpr *LHS;
|
||||
if (Add)
|
||||
LHS = MCBinaryExpr::CreateSub(Add, Sub, Ctx);
|
||||
LHS = MCBinaryExpr::createSub(Add, Sub, Ctx);
|
||||
else
|
||||
LHS = MCUnaryExpr::CreateMinus(Sub, Ctx);
|
||||
LHS = MCUnaryExpr::createMinus(Sub, Ctx);
|
||||
if (Off)
|
||||
Expr = MCBinaryExpr::CreateAdd(LHS, Off, Ctx);
|
||||
Expr = MCBinaryExpr::createAdd(LHS, Off, Ctx);
|
||||
else
|
||||
Expr = LHS;
|
||||
} else if (Add) {
|
||||
if (Off)
|
||||
Expr = MCBinaryExpr::CreateAdd(Add, Off, Ctx);
|
||||
Expr = MCBinaryExpr::createAdd(Add, Off, Ctx);
|
||||
else
|
||||
Expr = Add;
|
||||
} else {
|
||||
if (Off)
|
||||
Expr = Off;
|
||||
else
|
||||
Expr = MCConstantExpr::Create(0, Ctx);
|
||||
Expr = MCConstantExpr::create(0, Ctx);
|
||||
}
|
||||
|
||||
MI.addOperand(MCOperand::createExpr(Expr));
|
||||
|
@ -1264,7 +1264,7 @@ void AArch64InstPrinter::printAlignedLabel(const MCInst *MI, unsigned OpNum,
|
||||
const MCConstantExpr *BranchTarget =
|
||||
dyn_cast<MCConstantExpr>(MI->getOperand(OpNum).getExpr());
|
||||
int64_t Address;
|
||||
if (BranchTarget && BranchTarget->EvaluateAsAbsolute(Address)) {
|
||||
if (BranchTarget && BranchTarget->evaluateAsAbsolute(Address)) {
|
||||
O << "0x";
|
||||
O.write_hex(Address);
|
||||
} else {
|
||||
|
@ -496,7 +496,7 @@ void ELFAArch64AsmBackend::processFixupValue(
|
||||
// FIXME: Should be replaced with something more principled.
|
||||
static bool isByteSwappedFixup(const MCExpr *E) {
|
||||
MCValue Val;
|
||||
if (!E->EvaluateAsRelocatable(Val, nullptr, nullptr))
|
||||
if (!E->evaluateAsRelocatable(Val, nullptr, nullptr))
|
||||
return false;
|
||||
|
||||
if (!Val.getSymA() || Val.getSymA()->getSymbol().isUndefined())
|
||||
|
@ -172,7 +172,7 @@ private:
|
||||
assert(Sec && "need a section");
|
||||
Symbol->setSection(*Sec);
|
||||
|
||||
const MCExpr *Value = MCSymbolRefExpr::Create(Start, getContext());
|
||||
const MCExpr *Value = MCSymbolRefExpr::create(Start, getContext());
|
||||
Symbol->setVariableValue(Value);
|
||||
}
|
||||
|
||||
|
@ -62,11 +62,11 @@ const MCExpr *AArch64MCAsmInfoDarwin::getExprForPersonalitySymbol(
|
||||
// version.
|
||||
MCContext &Context = Streamer.getContext();
|
||||
const MCExpr *Res =
|
||||
MCSymbolRefExpr::Create(Sym, MCSymbolRefExpr::VK_GOT, Context);
|
||||
MCSymbolRefExpr::create(Sym, MCSymbolRefExpr::VK_GOT, Context);
|
||||
MCSymbol *PCSym = Context.createTempSymbol();
|
||||
Streamer.EmitLabel(PCSym);
|
||||
const MCExpr *PC = MCSymbolRefExpr::Create(PCSym, Context);
|
||||
return MCBinaryExpr::CreateSub(Res, PC, Context);
|
||||
const MCExpr *PC = MCSymbolRefExpr::create(PCSym, Context);
|
||||
return MCBinaryExpr::createSub(Res, PC, Context);
|
||||
}
|
||||
|
||||
AArch64MCAsmInfoELF::AArch64MCAsmInfoELF(StringRef TT) {
|
||||
|
@ -26,7 +26,7 @@ using namespace llvm;
|
||||
|
||||
#define DEBUG_TYPE "aarch64symbolrefexpr"
|
||||
|
||||
const AArch64MCExpr *AArch64MCExpr::Create(const MCExpr *Expr, VariantKind Kind,
|
||||
const AArch64MCExpr *AArch64MCExpr::create(const MCExpr *Expr, VariantKind Kind,
|
||||
MCContext &Ctx) {
|
||||
return new (Ctx) AArch64MCExpr(Expr, Kind);
|
||||
}
|
||||
@ -76,7 +76,7 @@ StringRef AArch64MCExpr::getVariantKindName() const {
|
||||
}
|
||||
}
|
||||
|
||||
void AArch64MCExpr::PrintImpl(raw_ostream &OS) const {
|
||||
void AArch64MCExpr::printImpl(raw_ostream &OS) const {
|
||||
if (getKind() != VK_NONE)
|
||||
OS << getVariantKindName();
|
||||
OS << *Expr;
|
||||
@ -86,14 +86,14 @@ void AArch64MCExpr::visitUsedExpr(MCStreamer &Streamer) const {
|
||||
Streamer.visitUsedExpr(*getSubExpr());
|
||||
}
|
||||
|
||||
MCSection *AArch64MCExpr::FindAssociatedSection() const {
|
||||
MCSection *AArch64MCExpr::findAssociatedSection() const {
|
||||
llvm_unreachable("FIXME: what goes here?");
|
||||
}
|
||||
|
||||
bool AArch64MCExpr::EvaluateAsRelocatableImpl(MCValue &Res,
|
||||
bool AArch64MCExpr::evaluateAsRelocatableImpl(MCValue &Res,
|
||||
const MCAsmLayout *Layout,
|
||||
const MCFixup *Fixup) const {
|
||||
if (!getSubExpr()->EvaluateAsRelocatable(Res, Layout, Fixup))
|
||||
if (!getSubExpr()->evaluateAsRelocatable(Res, Layout, Fixup))
|
||||
return false;
|
||||
|
||||
Res =
|
||||
|
@ -112,7 +112,7 @@ public:
|
||||
/// @name Construction
|
||||
/// @{
|
||||
|
||||
static const AArch64MCExpr *Create(const MCExpr *Expr, VariantKind Kind,
|
||||
static const AArch64MCExpr *create(const MCExpr *Expr, VariantKind Kind,
|
||||
MCContext &Ctx);
|
||||
|
||||
/// @}
|
||||
@ -145,13 +145,13 @@ public:
|
||||
/// (e.g. ":got:", ":lo12:").
|
||||
StringRef getVariantKindName() const;
|
||||
|
||||
void PrintImpl(raw_ostream &OS) const override;
|
||||
void printImpl(raw_ostream &OS) const override;
|
||||
|
||||
void visitUsedExpr(MCStreamer &Streamer) const override;
|
||||
|
||||
MCSection *FindAssociatedSection() const override;
|
||||
MCSection *findAssociatedSection() const override;
|
||||
|
||||
bool EvaluateAsRelocatableImpl(MCValue &Res,
|
||||
bool evaluateAsRelocatableImpl(MCValue &Res,
|
||||
const MCAsmLayout *Layout,
|
||||
const MCFixup *Fixup) const override;
|
||||
|
||||
|
@ -300,7 +300,7 @@ void AArch64MachObjectWriter::RecordRelocation(
|
||||
// If the evaluation is an absolute value, just use that directly
|
||||
// to keep things easy.
|
||||
int64_t Res;
|
||||
if (Symbol->getVariableValue()->EvaluateAsAbsolute(
|
||||
if (Symbol->getVariableValue()->evaluateAsAbsolute(
|
||||
Res, Layout, Writer->getSectionAddressMap())) {
|
||||
FixedValue = Res;
|
||||
return;
|
||||
@ -309,7 +309,7 @@ void AArch64MachObjectWriter::RecordRelocation(
|
||||
// FIXME: Will the Target we already have ever have any data in it
|
||||
// we need to preserve and merge with the new Target? How about
|
||||
// the FixedValue?
|
||||
if (!Symbol->getVariableValue()->EvaluateAsRelocatable(Target, &Layout,
|
||||
if (!Symbol->getVariableValue()->evaluateAsRelocatable(Target, &Layout,
|
||||
&Fixup))
|
||||
Asm.getContext().reportFatalError(Fixup.getLoc(),
|
||||
"unable to resolve variable '" +
|
||||
@ -356,7 +356,7 @@ void AArch64MachObjectWriter::RecordRelocation(
|
||||
// Resolve constant variables.
|
||||
if (Symbol->isVariable()) {
|
||||
int64_t Res;
|
||||
if (Symbol->getVariableValue()->EvaluateAsAbsolute(
|
||||
if (Symbol->getVariableValue()->evaluateAsAbsolute(
|
||||
Res, Layout, Writer->getSectionAddressMap())) {
|
||||
FixedValue = Res;
|
||||
return;
|
||||
|
@ -87,7 +87,7 @@ void ARMAsmPrinter::EmitXXStructor(const Constant *CV) {
|
||||
const GlobalValue *GV = dyn_cast<GlobalValue>(CV->stripPointerCasts());
|
||||
assert(GV && "C++ constructor pointer was not a GlobalValue!");
|
||||
|
||||
const MCExpr *E = MCSymbolRefExpr::Create(GetARMGVSymbol(GV,
|
||||
const MCExpr *E = MCSymbolRefExpr::create(GetARMGVSymbol(GV,
|
||||
ARMII::MO_NO_FLAG),
|
||||
(Subtarget->isTargetELF()
|
||||
? MCSymbolRefExpr::VK_ARM_TARGET1
|
||||
@ -467,7 +467,7 @@ emitNonLazySymbolPointer(MCStreamer &OutStreamer, MCSymbol *StubLabel,
|
||||
// using NLPs; however, sometimes the types are local to the file.
|
||||
// We need to fill in the value for the NLP in those cases.
|
||||
OutStreamer.EmitValue(
|
||||
MCSymbolRefExpr::Create(MCSym.getPointer(), OutStreamer.getContext()),
|
||||
MCSymbolRefExpr::create(MCSym.getPointer(), OutStreamer.getContext()),
|
||||
4 /*size*/);
|
||||
}
|
||||
|
||||
@ -895,7 +895,7 @@ EmitMachineConstantPoolValue(MachineConstantPoolValue *MCPV) {
|
||||
|
||||
// Create an MCSymbol for the reference.
|
||||
const MCExpr *Expr =
|
||||
MCSymbolRefExpr::Create(MCSym, getModifierVariantKind(ACPV->getModifier()),
|
||||
MCSymbolRefExpr::create(MCSym, getModifierVariantKind(ACPV->getModifier()),
|
||||
OutContext);
|
||||
|
||||
if (ACPV->getPCAdjustment()) {
|
||||
@ -903,10 +903,10 @@ EmitMachineConstantPoolValue(MachineConstantPoolValue *MCPV) {
|
||||
getFunctionNumber(),
|
||||
ACPV->getLabelId(),
|
||||
OutContext);
|
||||
const MCExpr *PCRelExpr = MCSymbolRefExpr::Create(PCLabel, OutContext);
|
||||
const MCExpr *PCRelExpr = MCSymbolRefExpr::create(PCLabel, OutContext);
|
||||
PCRelExpr =
|
||||
MCBinaryExpr::CreateAdd(PCRelExpr,
|
||||
MCConstantExpr::Create(ACPV->getPCAdjustment(),
|
||||
MCBinaryExpr::createAdd(PCRelExpr,
|
||||
MCConstantExpr::create(ACPV->getPCAdjustment(),
|
||||
OutContext),
|
||||
OutContext);
|
||||
if (ACPV->mustAddCurrentAddress()) {
|
||||
@ -914,10 +914,10 @@ EmitMachineConstantPoolValue(MachineConstantPoolValue *MCPV) {
|
||||
// label, so just emit a local label end reference that instead.
|
||||
MCSymbol *DotSym = OutContext.createTempSymbol();
|
||||
OutStreamer->EmitLabel(DotSym);
|
||||
const MCExpr *DotExpr = MCSymbolRefExpr::Create(DotSym, OutContext);
|
||||
PCRelExpr = MCBinaryExpr::CreateSub(PCRelExpr, DotExpr, OutContext);
|
||||
const MCExpr *DotExpr = MCSymbolRefExpr::create(DotSym, OutContext);
|
||||
PCRelExpr = MCBinaryExpr::createSub(PCRelExpr, DotExpr, OutContext);
|
||||
}
|
||||
Expr = MCBinaryExpr::CreateSub(Expr, PCRelExpr, OutContext);
|
||||
Expr = MCBinaryExpr::createSub(Expr, PCRelExpr, OutContext);
|
||||
}
|
||||
OutStreamer->EmitValue(Expr, Size);
|
||||
}
|
||||
@ -955,16 +955,16 @@ void ARMAsmPrinter::EmitJumpTable(const MachineInstr *MI) {
|
||||
// LJTI_0_0:
|
||||
// .word (LBB0 - LJTI_0_0)
|
||||
// .word (LBB1 - LJTI_0_0)
|
||||
const MCExpr *Expr = MCSymbolRefExpr::Create(MBB->getSymbol(), OutContext);
|
||||
const MCExpr *Expr = MCSymbolRefExpr::create(MBB->getSymbol(), OutContext);
|
||||
|
||||
if (TM.getRelocationModel() == Reloc::PIC_)
|
||||
Expr = MCBinaryExpr::CreateSub(Expr, MCSymbolRefExpr::Create(JTISymbol,
|
||||
Expr = MCBinaryExpr::createSub(Expr, MCSymbolRefExpr::create(JTISymbol,
|
||||
OutContext),
|
||||
OutContext);
|
||||
// If we're generating a table of Thumb addresses in static relocation
|
||||
// model, we need to add one to keep interworking correctly.
|
||||
else if (AFI->isThumbFunction())
|
||||
Expr = MCBinaryExpr::CreateAdd(Expr, MCConstantExpr::Create(1,OutContext),
|
||||
Expr = MCBinaryExpr::createAdd(Expr, MCConstantExpr::create(1,OutContext),
|
||||
OutContext);
|
||||
OutStreamer->EmitValue(Expr, 4);
|
||||
}
|
||||
@ -998,7 +998,7 @@ void ARMAsmPrinter::EmitJump2Table(const MachineInstr *MI) {
|
||||
|
||||
for (unsigned i = 0, e = JTBBs.size(); i != e; ++i) {
|
||||
MachineBasicBlock *MBB = JTBBs[i];
|
||||
const MCExpr *MBBSymbolExpr = MCSymbolRefExpr::Create(MBB->getSymbol(),
|
||||
const MCExpr *MBBSymbolExpr = MCSymbolRefExpr::create(MBB->getSymbol(),
|
||||
OutContext);
|
||||
// If this isn't a TBB or TBH, the entries are direct branch instructions.
|
||||
if (OffsetWidth == 4) {
|
||||
@ -1018,10 +1018,10 @@ void ARMAsmPrinter::EmitJump2Table(const MachineInstr *MI) {
|
||||
// .byte (LBB0 - LJTI_0_0) / 2
|
||||
// .byte (LBB1 - LJTI_0_0) / 2
|
||||
const MCExpr *Expr =
|
||||
MCBinaryExpr::CreateSub(MBBSymbolExpr,
|
||||
MCSymbolRefExpr::Create(JTISymbol, OutContext),
|
||||
MCBinaryExpr::createSub(MBBSymbolExpr,
|
||||
MCSymbolRefExpr::create(JTISymbol, OutContext),
|
||||
OutContext);
|
||||
Expr = MCBinaryExpr::CreateDiv(Expr, MCConstantExpr::Create(2, OutContext),
|
||||
Expr = MCBinaryExpr::createDiv(Expr, MCConstantExpr::create(2, OutContext),
|
||||
OutContext);
|
||||
OutStreamer->EmitValue(Expr, OffsetWidth);
|
||||
}
|
||||
@ -1212,7 +1212,7 @@ void ARMAsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
||||
: (MI->getOpcode() == ARM::tLEApcrel ? ARM::tADR
|
||||
: ARM::ADR))
|
||||
.addReg(MI->getOperand(0).getReg())
|
||||
.addExpr(MCSymbolRefExpr::Create(CPISymbol, OutContext))
|
||||
.addExpr(MCSymbolRefExpr::create(CPISymbol, OutContext))
|
||||
// Add predicate operands.
|
||||
.addImm(MI->getOperand(2).getImm())
|
||||
.addReg(MI->getOperand(3).getReg()));
|
||||
@ -1228,7 +1228,7 @@ void ARMAsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
||||
: (MI->getOpcode() == ARM::tLEApcrelJT ? ARM::tADR
|
||||
: ARM::ADR))
|
||||
.addReg(MI->getOperand(0).getReg())
|
||||
.addExpr(MCSymbolRefExpr::Create(JTIPICSymbol, OutContext))
|
||||
.addExpr(MCSymbolRefExpr::create(JTIPICSymbol, OutContext))
|
||||
// Add predicate operands.
|
||||
.addImm(MI->getOperand(2).getImm())
|
||||
.addReg(MI->getOperand(3).getReg()));
|
||||
@ -1278,7 +1278,7 @@ void ARMAsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
||||
EmitToStreamer(*OutStreamer, MCInstBuilder(ARM::tBL)
|
||||
// Predicate comes first here.
|
||||
.addImm(ARMCC::AL).addReg(0)
|
||||
.addExpr(MCSymbolRefExpr::Create(TRegSym, OutContext)));
|
||||
.addExpr(MCSymbolRefExpr::create(TRegSym, OutContext)));
|
||||
return;
|
||||
}
|
||||
case ARM::BMOVPCRX_CALL: {
|
||||
@ -1315,7 +1315,7 @@ void ARMAsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
||||
const GlobalValue *GV = Op.getGlobal();
|
||||
const unsigned TF = Op.getTargetFlags();
|
||||
MCSymbol *GVSym = GetARMGVSymbol(GV, TF);
|
||||
const MCExpr *GVSymExpr = MCSymbolRefExpr::Create(GVSym, OutContext);
|
||||
const MCExpr *GVSymExpr = MCSymbolRefExpr::create(GVSym, OutContext);
|
||||
EmitToStreamer(*OutStreamer, MCInstBuilder(ARM::Bcc)
|
||||
.addExpr(GVSymExpr)
|
||||
// Add predicate operands.
|
||||
@ -1332,17 +1332,17 @@ void ARMAsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
||||
unsigned TF = MI->getOperand(1).getTargetFlags();
|
||||
const GlobalValue *GV = MI->getOperand(1).getGlobal();
|
||||
MCSymbol *GVSym = GetARMGVSymbol(GV, TF);
|
||||
const MCExpr *GVSymExpr = MCSymbolRefExpr::Create(GVSym, OutContext);
|
||||
const MCExpr *GVSymExpr = MCSymbolRefExpr::create(GVSym, OutContext);
|
||||
|
||||
MCSymbol *LabelSym = getPICLabel(DL->getPrivateGlobalPrefix(),
|
||||
getFunctionNumber(),
|
||||
MI->getOperand(2).getImm(), OutContext);
|
||||
const MCExpr *LabelSymExpr= MCSymbolRefExpr::Create(LabelSym, OutContext);
|
||||
const MCExpr *LabelSymExpr= MCSymbolRefExpr::create(LabelSym, OutContext);
|
||||
unsigned PCAdj = (Opc == ARM::MOVi16_ga_pcrel) ? 8 : 4;
|
||||
const MCExpr *PCRelExpr =
|
||||
ARMMCExpr::CreateLower16(MCBinaryExpr::CreateSub(GVSymExpr,
|
||||
MCBinaryExpr::CreateAdd(LabelSymExpr,
|
||||
MCConstantExpr::Create(PCAdj, OutContext),
|
||||
ARMMCExpr::createLower16(MCBinaryExpr::createSub(GVSymExpr,
|
||||
MCBinaryExpr::createAdd(LabelSymExpr,
|
||||
MCConstantExpr::create(PCAdj, OutContext),
|
||||
OutContext), OutContext), OutContext);
|
||||
TmpInst.addOperand(MCOperand::createExpr(PCRelExpr));
|
||||
|
||||
@ -1365,17 +1365,17 @@ void ARMAsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
||||
unsigned TF = MI->getOperand(2).getTargetFlags();
|
||||
const GlobalValue *GV = MI->getOperand(2).getGlobal();
|
||||
MCSymbol *GVSym = GetARMGVSymbol(GV, TF);
|
||||
const MCExpr *GVSymExpr = MCSymbolRefExpr::Create(GVSym, OutContext);
|
||||
const MCExpr *GVSymExpr = MCSymbolRefExpr::create(GVSym, OutContext);
|
||||
|
||||
MCSymbol *LabelSym = getPICLabel(DL->getPrivateGlobalPrefix(),
|
||||
getFunctionNumber(),
|
||||
MI->getOperand(3).getImm(), OutContext);
|
||||
const MCExpr *LabelSymExpr= MCSymbolRefExpr::Create(LabelSym, OutContext);
|
||||
const MCExpr *LabelSymExpr= MCSymbolRefExpr::create(LabelSym, OutContext);
|
||||
unsigned PCAdj = (Opc == ARM::MOVTi16_ga_pcrel) ? 8 : 4;
|
||||
const MCExpr *PCRelExpr =
|
||||
ARMMCExpr::CreateUpper16(MCBinaryExpr::CreateSub(GVSymExpr,
|
||||
MCBinaryExpr::CreateAdd(LabelSymExpr,
|
||||
MCConstantExpr::Create(PCAdj, OutContext),
|
||||
ARMMCExpr::createUpper16(MCBinaryExpr::createSub(GVSymExpr,
|
||||
MCBinaryExpr::createAdd(LabelSymExpr,
|
||||
MCConstantExpr::create(PCAdj, OutContext),
|
||||
OutContext), OutContext), OutContext);
|
||||
TmpInst.addOperand(MCOperand::createExpr(PCRelExpr));
|
||||
// Add predicate operands.
|
||||
@ -1695,7 +1695,7 @@ void ARMAsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
||||
.addImm(ARMCC::AL)
|
||||
.addReg(0));
|
||||
|
||||
const MCExpr *SymbolExpr = MCSymbolRefExpr::Create(Label, OutContext);
|
||||
const MCExpr *SymbolExpr = MCSymbolRefExpr::create(Label, OutContext);
|
||||
EmitToStreamer(*OutStreamer, MCInstBuilder(ARM::tB)
|
||||
.addExpr(SymbolExpr)
|
||||
.addImm(ARMCC::AL)
|
||||
|
@ -30,35 +30,35 @@ MCOperand ARMAsmPrinter::GetSymbolRef(const MachineOperand &MO,
|
||||
unsigned Option = MO.getTargetFlags() & ARMII::MO_OPTION_MASK;
|
||||
switch (Option) {
|
||||
default: {
|
||||
Expr = MCSymbolRefExpr::Create(Symbol, MCSymbolRefExpr::VK_None,
|
||||
Expr = MCSymbolRefExpr::create(Symbol, MCSymbolRefExpr::VK_None,
|
||||
OutContext);
|
||||
switch (Option) {
|
||||
default: llvm_unreachable("Unknown target flag on symbol operand");
|
||||
case ARMII::MO_NO_FLAG:
|
||||
break;
|
||||
case ARMII::MO_LO16:
|
||||
Expr = MCSymbolRefExpr::Create(Symbol, MCSymbolRefExpr::VK_None,
|
||||
Expr = MCSymbolRefExpr::create(Symbol, MCSymbolRefExpr::VK_None,
|
||||
OutContext);
|
||||
Expr = ARMMCExpr::CreateLower16(Expr, OutContext);
|
||||
Expr = ARMMCExpr::createLower16(Expr, OutContext);
|
||||
break;
|
||||
case ARMII::MO_HI16:
|
||||
Expr = MCSymbolRefExpr::Create(Symbol, MCSymbolRefExpr::VK_None,
|
||||
Expr = MCSymbolRefExpr::create(Symbol, MCSymbolRefExpr::VK_None,
|
||||
OutContext);
|
||||
Expr = ARMMCExpr::CreateUpper16(Expr, OutContext);
|
||||
Expr = ARMMCExpr::createUpper16(Expr, OutContext);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case ARMII::MO_PLT:
|
||||
Expr = MCSymbolRefExpr::Create(Symbol, MCSymbolRefExpr::VK_PLT,
|
||||
Expr = MCSymbolRefExpr::create(Symbol, MCSymbolRefExpr::VK_PLT,
|
||||
OutContext);
|
||||
break;
|
||||
}
|
||||
|
||||
if (!MO.isJTI() && MO.getOffset())
|
||||
Expr = MCBinaryExpr::CreateAdd(Expr,
|
||||
MCConstantExpr::Create(MO.getOffset(),
|
||||
Expr = MCBinaryExpr::createAdd(Expr,
|
||||
MCConstantExpr::create(MO.getOffset(),
|
||||
OutContext),
|
||||
OutContext);
|
||||
return MCOperand::createExpr(Expr);
|
||||
@ -80,7 +80,7 @@ bool ARMAsmPrinter::lowerOperand(const MachineOperand &MO,
|
||||
MCOp = MCOperand::createImm(MO.getImm());
|
||||
break;
|
||||
case MachineOperand::MO_MachineBasicBlock:
|
||||
MCOp = MCOperand::createExpr(MCSymbolRefExpr::Create(
|
||||
MCOp = MCOperand::createExpr(MCSymbolRefExpr::create(
|
||||
MO.getMBB()->getSymbol(), OutContext));
|
||||
break;
|
||||
case MachineOperand::MO_GlobalAddress: {
|
||||
|
@ -50,12 +50,12 @@ const MCExpr *ARMElfTargetObjectFile::getTTypeGlobalReference(
|
||||
|
||||
assert(Encoding == DW_EH_PE_absptr && "Can handle absptr encoding only");
|
||||
|
||||
return MCSymbolRefExpr::Create(TM.getSymbol(GV, Mang),
|
||||
return MCSymbolRefExpr::create(TM.getSymbol(GV, Mang),
|
||||
MCSymbolRefExpr::VK_ARM_TARGET2, getContext());
|
||||
}
|
||||
|
||||
const MCExpr *ARMElfTargetObjectFile::
|
||||
getDebugThreadLocalSymbol(const MCSymbol *Sym) const {
|
||||
return MCSymbolRefExpr::Create(Sym, MCSymbolRefExpr::VK_ARM_TLSLDO,
|
||||
return MCSymbolRefExpr::create(Sym, MCSymbolRefExpr::VK_ARM_TLSLDO,
|
||||
getContext());
|
||||
}
|
||||
|
@ -4252,7 +4252,7 @@ ARMAsmParser::parseSetEndImm(OperandVector &Operands) {
|
||||
Error(S, "'be' or 'le' operand expected");
|
||||
return MatchOperand_ParseFail;
|
||||
}
|
||||
Operands.push_back(ARMOperand::CreateImm(MCConstantExpr::Create(Val,
|
||||
Operands.push_back(ARMOperand::CreateImm(MCConstantExpr::create(Val,
|
||||
getContext()),
|
||||
S, Tok.getEndLoc()));
|
||||
return MatchOperand_Success;
|
||||
@ -4656,7 +4656,7 @@ ARMAsmParser::parseAM3Offset(OperandVector &Operands) {
|
||||
Val = INT32_MIN;
|
||||
|
||||
Operands.push_back(
|
||||
ARMOperand::CreateImm(MCConstantExpr::Create(Val, getContext()), S, E));
|
||||
ARMOperand::CreateImm(MCConstantExpr::create(Val, getContext()), S, E));
|
||||
|
||||
return MatchOperand_Success;
|
||||
}
|
||||
@ -4886,7 +4886,7 @@ bool ARMAsmParser::parseMemory(OperandVector &Operands) {
|
||||
// If the constant was #-0, represent it as INT32_MIN.
|
||||
int32_t Val = CE->getValue();
|
||||
if (isNegative && Val == 0)
|
||||
CE = MCConstantExpr::Create(INT32_MIN, getContext());
|
||||
CE = MCConstantExpr::create(INT32_MIN, getContext());
|
||||
|
||||
// Now we should have the closing ']'
|
||||
if (Parser.getTok().isNot(AsmToken::RBrac))
|
||||
@ -5073,7 +5073,7 @@ ARMAsmParser::parseFPImm(OperandVector &Operands) {
|
||||
IntVal ^= (uint64_t)isNegative << 31;
|
||||
Parser.Lex(); // Eat the token.
|
||||
Operands.push_back(ARMOperand::CreateImm(
|
||||
MCConstantExpr::Create(IntVal, getContext()),
|
||||
MCConstantExpr::create(IntVal, getContext()),
|
||||
S, Parser.getTok().getLoc()));
|
||||
return MatchOperand_Success;
|
||||
}
|
||||
@ -5090,7 +5090,7 @@ ARMAsmParser::parseFPImm(OperandVector &Operands) {
|
||||
Val = APFloat(RealVal).bitcastToAPInt().getZExtValue();
|
||||
|
||||
Operands.push_back(ARMOperand::CreateImm(
|
||||
MCConstantExpr::Create(Val, getContext()), S,
|
||||
MCConstantExpr::create(Val, getContext()), S,
|
||||
Parser.getTok().getLoc()));
|
||||
return MatchOperand_Success;
|
||||
}
|
||||
@ -5179,7 +5179,7 @@ bool ARMAsmParser::parseOperand(OperandVector &Operands, StringRef Mnemonic) {
|
||||
if (CE) {
|
||||
int32_t Val = CE->getValue();
|
||||
if (isNegative && Val == 0)
|
||||
ImmVal = MCConstantExpr::Create(INT32_MIN, getContext());
|
||||
ImmVal = MCConstantExpr::create(INT32_MIN, getContext());
|
||||
}
|
||||
E = SMLoc::getFromPointer(Parser.getTok().getLoc().getPointer() - 1);
|
||||
Operands.push_back(ARMOperand::CreateImm(ImmVal, S, E));
|
||||
@ -5209,7 +5209,7 @@ bool ARMAsmParser::parseOperand(OperandVector &Operands, StringRef Mnemonic) {
|
||||
if (getParser().parseExpression(SubExprVal))
|
||||
return true;
|
||||
|
||||
const MCExpr *ExprVal = ARMMCExpr::Create(RefKind, SubExprVal,
|
||||
const MCExpr *ExprVal = ARMMCExpr::create(RefKind, SubExprVal,
|
||||
getContext());
|
||||
E = SMLoc::getFromPointer(Parser.getTok().getLoc().getPointer() - 1);
|
||||
Operands.push_back(ARMOperand::CreateImm(ExprVal, S, E));
|
||||
@ -5765,7 +5765,7 @@ bool ARMAsmParser::ParseInstruction(ParseInstructionInfo &Info, StringRef Name,
|
||||
// Add the processor imod operand, if necessary.
|
||||
if (ProcessorIMod) {
|
||||
Operands.push_back(ARMOperand::CreateImm(
|
||||
MCConstantExpr::Create(ProcessorIMod, getContext()),
|
||||
MCConstantExpr::create(ProcessorIMod, getContext()),
|
||||
NameLoc, NameLoc));
|
||||
} else if (Mnemonic == "cps" && isMClass()) {
|
||||
return Error(NameLoc, "instruction 'cps' requires effect for M-class");
|
||||
@ -6752,13 +6752,13 @@ bool ARMAsmParser::processInstruction(MCInst &Inst,
|
||||
MCSymbol *Dot = getContext().createTempSymbol();
|
||||
Out.EmitLabel(Dot);
|
||||
const MCExpr *OpExpr = Inst.getOperand(2).getExpr();
|
||||
const MCExpr *InstPC = MCSymbolRefExpr::Create(Dot,
|
||||
const MCExpr *InstPC = MCSymbolRefExpr::create(Dot,
|
||||
MCSymbolRefExpr::VK_None,
|
||||
getContext());
|
||||
const MCExpr *Const8 = MCConstantExpr::Create(8, getContext());
|
||||
const MCExpr *ReadPC = MCBinaryExpr::CreateAdd(InstPC, Const8,
|
||||
const MCExpr *Const8 = MCConstantExpr::create(8, getContext());
|
||||
const MCExpr *ReadPC = MCBinaryExpr::createAdd(InstPC, Const8,
|
||||
getContext());
|
||||
const MCExpr *FixupAddr = MCBinaryExpr::CreateAdd(ReadPC, OpExpr,
|
||||
const MCExpr *FixupAddr = MCBinaryExpr::createAdd(ReadPC, OpExpr,
|
||||
getContext());
|
||||
TmpInst.addOperand(MCOperand::createExpr(FixupAddr));
|
||||
}
|
||||
@ -9804,7 +9804,7 @@ bool ARMAsmParser::parseDirectiveTLSDescSeq(SMLoc L) {
|
||||
}
|
||||
|
||||
const MCSymbolRefExpr *SRE =
|
||||
MCSymbolRefExpr::Create(Parser.getTok().getIdentifier(),
|
||||
MCSymbolRefExpr::create(Parser.getTok().getIdentifier(),
|
||||
MCSymbolRefExpr::VK_ARM_TLSDESCSEQ, getContext());
|
||||
Lex();
|
||||
|
||||
@ -10080,7 +10080,7 @@ unsigned ARMAsmParser::validateTargetOperandClass(MCParsedAsmOperand &AsmOp,
|
||||
if (Op.isImm()) {
|
||||
const MCExpr *SOExpr = Op.getImm();
|
||||
int64_t Value;
|
||||
if (!SOExpr->EvaluateAsAbsolute(Value))
|
||||
if (!SOExpr->evaluateAsAbsolute(Value))
|
||||
return Match_Success;
|
||||
assert((Value >= INT32_MIN && Value <= UINT32_MAX) &&
|
||||
"expression value must be representable in 32 bits");
|
||||
|
@ -337,7 +337,7 @@ void ARMInstPrinter::printOperand(const MCInst *MI, unsigned OpNo,
|
||||
// address.
|
||||
const MCConstantExpr *Constant = cast<MCConstantExpr>(Expr);
|
||||
int64_t TargetAddress;
|
||||
if (!Constant->EvaluateAsAbsolute(TargetAddress)) {
|
||||
if (!Constant->evaluateAsAbsolute(TargetAddress)) {
|
||||
O << '#' << *Expr;
|
||||
} else {
|
||||
O << "0x";
|
||||
|
@ -572,7 +572,7 @@ private:
|
||||
Symbol->setExternal(false);
|
||||
AssignSection(Symbol, getCurrentSection().first);
|
||||
|
||||
const MCExpr *Value = MCSymbolRefExpr::Create(Start, getContext());
|
||||
const MCExpr *Value = MCSymbolRefExpr::create(Start, getContext());
|
||||
Symbol->setVariableValue(Value);
|
||||
}
|
||||
|
||||
@ -1095,7 +1095,7 @@ void ARMELFStreamer::emitFnEnd() {
|
||||
EmitPersonalityFixup(GetAEABIUnwindPersonalityName(PersonalityIndex));
|
||||
|
||||
const MCSymbolRefExpr *FnStartRef =
|
||||
MCSymbolRefExpr::Create(FnStart,
|
||||
MCSymbolRefExpr::create(FnStart,
|
||||
MCSymbolRefExpr::VK_ARM_PREL31,
|
||||
getContext());
|
||||
|
||||
@ -1106,7 +1106,7 @@ void ARMELFStreamer::emitFnEnd() {
|
||||
} else if (ExTab) {
|
||||
// Emit a reference to the unwind opcodes in the ".ARM.extab" section.
|
||||
const MCSymbolRefExpr *ExTabEntryRef =
|
||||
MCSymbolRefExpr::Create(ExTab,
|
||||
MCSymbolRefExpr::create(ExTab,
|
||||
MCSymbolRefExpr::VK_ARM_PREL31,
|
||||
getContext());
|
||||
EmitValue(ExTabEntryRef, 4);
|
||||
@ -1138,7 +1138,7 @@ void ARMELFStreamer::emitCantUnwind() { CantUnwind = true; }
|
||||
void ARMELFStreamer::EmitPersonalityFixup(StringRef Name) {
|
||||
const MCSymbol *PersonalitySym = getContext().getOrCreateSymbol(Name);
|
||||
|
||||
const MCSymbolRefExpr *PersonalityRef = MCSymbolRefExpr::Create(
|
||||
const MCSymbolRefExpr *PersonalityRef = MCSymbolRefExpr::create(
|
||||
PersonalitySym, MCSymbolRefExpr::VK_ARM_NONE, getContext());
|
||||
|
||||
visitUsedExpr(*PersonalityRef);
|
||||
@ -1186,7 +1186,7 @@ void ARMELFStreamer::FlushUnwindOpcodes(bool NoHandlerData) {
|
||||
// Emit personality
|
||||
if (Personality) {
|
||||
const MCSymbolRefExpr *PersonalityRef =
|
||||
MCSymbolRefExpr::Create(Personality,
|
||||
MCSymbolRefExpr::create(Personality,
|
||||
MCSymbolRefExpr::VK_ARM_PREL31,
|
||||
getContext());
|
||||
|
||||
|
@ -16,12 +16,12 @@ using namespace llvm;
|
||||
#define DEBUG_TYPE "armmcexpr"
|
||||
|
||||
const ARMMCExpr*
|
||||
ARMMCExpr::Create(VariantKind Kind, const MCExpr *Expr,
|
||||
ARMMCExpr::create(VariantKind Kind, const MCExpr *Expr,
|
||||
MCContext &Ctx) {
|
||||
return new (Ctx) ARMMCExpr(Kind, Expr);
|
||||
}
|
||||
|
||||
void ARMMCExpr::PrintImpl(raw_ostream &OS) const {
|
||||
void ARMMCExpr::printImpl(raw_ostream &OS) const {
|
||||
switch (Kind) {
|
||||
default: llvm_unreachable("Invalid kind!");
|
||||
case VK_ARM_HI16: OS << ":upper16:"; break;
|
||||
|
@ -33,15 +33,15 @@ public:
|
||||
/// @name Construction
|
||||
/// @{
|
||||
|
||||
static const ARMMCExpr *Create(VariantKind Kind, const MCExpr *Expr,
|
||||
static const ARMMCExpr *create(VariantKind Kind, const MCExpr *Expr,
|
||||
MCContext &Ctx);
|
||||
|
||||
static const ARMMCExpr *CreateUpper16(const MCExpr *Expr, MCContext &Ctx) {
|
||||
return Create(VK_ARM_HI16, Expr, Ctx);
|
||||
static const ARMMCExpr *createUpper16(const MCExpr *Expr, MCContext &Ctx) {
|
||||
return create(VK_ARM_HI16, Expr, Ctx);
|
||||
}
|
||||
|
||||
static const ARMMCExpr *CreateLower16(const MCExpr *Expr, MCContext &Ctx) {
|
||||
return Create(VK_ARM_LO16, Expr, Ctx);
|
||||
static const ARMMCExpr *createLower16(const MCExpr *Expr, MCContext &Ctx) {
|
||||
return create(VK_ARM_LO16, Expr, Ctx);
|
||||
}
|
||||
|
||||
/// @}
|
||||
@ -56,15 +56,15 @@ public:
|
||||
|
||||
/// @}
|
||||
|
||||
void PrintImpl(raw_ostream &OS) const override;
|
||||
bool EvaluateAsRelocatableImpl(MCValue &Res,
|
||||
void printImpl(raw_ostream &OS) const override;
|
||||
bool evaluateAsRelocatableImpl(MCValue &Res,
|
||||
const MCAsmLayout *Layout,
|
||||
const MCFixup *Fixup) const override {
|
||||
return false;
|
||||
}
|
||||
void visitUsedExpr(MCStreamer &Streamer) const override;
|
||||
MCSection *FindAssociatedSection() const override {
|
||||
return getSubExpr()->FindAssociatedSection();
|
||||
MCSection *findAssociatedSection() const override {
|
||||
return getSubExpr()->findAssociatedSection();
|
||||
}
|
||||
|
||||
// There are no TLS ARMMCExprs at the moment.
|
||||
|
@ -26,9 +26,9 @@ public:
|
||||
unsigned VariantKind) override {
|
||||
switch(VariantKind) {
|
||||
case LLVMDisassembler_VariantKind_ARM_HI16:
|
||||
return ARMMCExpr::CreateUpper16(SubExpr, Ctx);
|
||||
return ARMMCExpr::createUpper16(SubExpr, Ctx);
|
||||
case LLVMDisassembler_VariantKind_ARM_LO16:
|
||||
return ARMMCExpr::CreateLower16(SubExpr, Ctx);
|
||||
return ARMMCExpr::createLower16(SubExpr, Ctx);
|
||||
default:
|
||||
return MCRelocationInfo::createExprForCAPIVariantKind(SubExpr,
|
||||
VariantKind);
|
||||
|
@ -401,7 +401,7 @@ void ARMMachObjectWriter::RecordRelocation(MachObjectWriter *Writer,
|
||||
// Resolve constant variables.
|
||||
if (A->isVariable()) {
|
||||
int64_t Res;
|
||||
if (A->getVariableValue()->EvaluateAsAbsolute(
|
||||
if (A->getVariableValue()->evaluateAsAbsolute(
|
||||
Res, Layout, Writer->getSectionAddressMap())) {
|
||||
FixedValue = Res;
|
||||
return;
|
||||
|
@ -31,10 +31,10 @@ static MCOperand GetSymbolRef(const MachineOperand& MO, const MCSymbol* Symbol,
|
||||
MCContext &MC = Printer.OutContext;
|
||||
const MCExpr *ME;
|
||||
|
||||
ME = MCSymbolRefExpr::Create(Symbol, MCSymbolRefExpr::VK_None, MC);
|
||||
ME = MCSymbolRefExpr::create(Symbol, MCSymbolRefExpr::VK_None, MC);
|
||||
|
||||
if (!MO.isJTI() && MO.getOffset())
|
||||
ME = MCBinaryExpr::CreateAdd(ME, MCConstantExpr::Create(MO.getOffset(), MC),
|
||||
ME = MCBinaryExpr::createAdd(ME, MCConstantExpr::create(MO.getOffset(), MC),
|
||||
MC);
|
||||
|
||||
return (MCOperand::createExpr(ME));
|
||||
@ -81,7 +81,7 @@ void llvm::HexagonLowerToMC(MachineInstr const* MI, MCInst& MCB,
|
||||
break;
|
||||
case MachineOperand::MO_MachineBasicBlock:
|
||||
MCO = MCOperand::createExpr
|
||||
(MCSymbolRefExpr::Create(MO.getMBB()->getSymbol(),
|
||||
(MCSymbolRefExpr::create(MO.getMBB()->getSymbol(),
|
||||
AP.OutContext));
|
||||
break;
|
||||
case MachineOperand::MO_GlobalAddress:
|
||||
|
@ -277,7 +277,7 @@ unsigned HexagonMCCodeEmitter::getExprOpValue(const MCInst &MI,
|
||||
{
|
||||
int64_t Res;
|
||||
|
||||
if (ME->EvaluateAsAbsolute(Res))
|
||||
if (ME->evaluateAsAbsolute(Res))
|
||||
return Res;
|
||||
|
||||
MCExpr::ExprKind MK = ME->getKind();
|
||||
|
@ -96,7 +96,7 @@ MCOperand MSP430MCInstLower::
|
||||
LowerSymbolOperand(const MachineOperand &MO, MCSymbol *Sym) const {
|
||||
// FIXME: We would like an efficient form for this, so we don't have to do a
|
||||
// lot of extra uniquing.
|
||||
const MCExpr *Expr = MCSymbolRefExpr::Create(Sym, Ctx);
|
||||
const MCExpr *Expr = MCSymbolRefExpr::create(Sym, Ctx);
|
||||
|
||||
switch (MO.getTargetFlags()) {
|
||||
default: llvm_unreachable("Unknown target flag on GV operand");
|
||||
@ -104,8 +104,8 @@ LowerSymbolOperand(const MachineOperand &MO, MCSymbol *Sym) const {
|
||||
}
|
||||
|
||||
if (!MO.isJTI() && MO.getOffset())
|
||||
Expr = MCBinaryExpr::CreateAdd(Expr,
|
||||
MCConstantExpr::Create(MO.getOffset(), Ctx),
|
||||
Expr = MCBinaryExpr::createAdd(Expr,
|
||||
MCConstantExpr::create(MO.getOffset(), Ctx),
|
||||
Ctx);
|
||||
return MCOperand::createExpr(Expr);
|
||||
}
|
||||
@ -130,7 +130,7 @@ void MSP430MCInstLower::Lower(const MachineInstr *MI, MCInst &OutMI) const {
|
||||
MCOp = MCOperand::createImm(MO.getImm());
|
||||
break;
|
||||
case MachineOperand::MO_MachineBasicBlock:
|
||||
MCOp = MCOperand::createExpr(MCSymbolRefExpr::Create(
|
||||
MCOp = MCOperand::createExpr(MCSymbolRefExpr::create(
|
||||
MO.getMBB()->getSymbol(), Ctx));
|
||||
break;
|
||||
case MachineOperand::MO_GlobalAddress:
|
||||
|
@ -1946,10 +1946,10 @@ void MipsAsmParser::expandLoadAddressSym(
|
||||
unsigned RegNo = DstRegOp.getReg();
|
||||
const MCSymbolRefExpr *Symbol = cast<MCSymbolRefExpr>(SymOp.getExpr());
|
||||
const MCSymbolRefExpr *HiExpr =
|
||||
MCSymbolRefExpr::Create(Symbol->getSymbol().getName(),
|
||||
MCSymbolRefExpr::create(Symbol->getSymbol().getName(),
|
||||
MCSymbolRefExpr::VK_Mips_ABS_HI, getContext());
|
||||
const MCSymbolRefExpr *LoExpr =
|
||||
MCSymbolRefExpr::Create(Symbol->getSymbol().getName(),
|
||||
MCSymbolRefExpr::create(Symbol->getSymbol().getName(),
|
||||
MCSymbolRefExpr::VK_Mips_ABS_LO, getContext());
|
||||
if (!Is32BitSym) {
|
||||
// If it's a 64-bit architecture, expand to:
|
||||
@ -1960,10 +1960,10 @@ void MipsAsmParser::expandLoadAddressSym(
|
||||
// dsll d,d,16
|
||||
// ori d,d,lo16(sym)
|
||||
const MCSymbolRefExpr *HighestExpr =
|
||||
MCSymbolRefExpr::Create(Symbol->getSymbol().getName(),
|
||||
MCSymbolRefExpr::create(Symbol->getSymbol().getName(),
|
||||
MCSymbolRefExpr::VK_Mips_HIGHEST, getContext());
|
||||
const MCSymbolRefExpr *HigherExpr =
|
||||
MCSymbolRefExpr::Create(Symbol->getSymbol().getName(),
|
||||
MCSymbolRefExpr::create(Symbol->getSymbol().getName(),
|
||||
MCSymbolRefExpr::VK_Mips_HIGHER, getContext());
|
||||
|
||||
tmpInst.setOpcode(Mips::LUi);
|
||||
@ -2102,7 +2102,7 @@ void MipsAsmParser::expandMemInst(MCInst &Inst, SMLoc IDLoc,
|
||||
else {
|
||||
if (ExprOffset->getKind() == MCExpr::SymbolRef) {
|
||||
SR = static_cast<const MCSymbolRefExpr *>(ExprOffset);
|
||||
const MCSymbolRefExpr *HiExpr = MCSymbolRefExpr::Create(
|
||||
const MCSymbolRefExpr *HiExpr = MCSymbolRefExpr::create(
|
||||
SR->getSymbol().getName(), MCSymbolRefExpr::VK_Mips_ABS_HI,
|
||||
getContext());
|
||||
TempInst.addOperand(MCOperand::createExpr(HiExpr));
|
||||
@ -2133,7 +2133,7 @@ void MipsAsmParser::expandMemInst(MCInst &Inst, SMLoc IDLoc,
|
||||
TempInst.addOperand(MCOperand::createImm(LoOffset));
|
||||
else {
|
||||
if (ExprOffset->getKind() == MCExpr::SymbolRef) {
|
||||
const MCSymbolRefExpr *LoExpr = MCSymbolRefExpr::Create(
|
||||
const MCSymbolRefExpr *LoExpr = MCSymbolRefExpr::create(
|
||||
SR->getSymbol().getName(), MCSymbolRefExpr::VK_Mips_ABS_LO,
|
||||
getContext());
|
||||
TempInst.addOperand(MCOperand::createExpr(LoExpr));
|
||||
@ -2505,7 +2505,7 @@ bool MipsAsmParser::parseOperand(OperandVector &Operands, StringRef Mnemonic) {
|
||||
MCSymbol *Sym = getContext().getOrCreateSymbol("$" + Identifier);
|
||||
// Otherwise create a symbol reference.
|
||||
const MCExpr *Res =
|
||||
MCSymbolRefExpr::Create(Sym, MCSymbolRefExpr::VK_None, getContext());
|
||||
MCSymbolRefExpr::create(Sym, MCSymbolRefExpr::VK_None, getContext());
|
||||
|
||||
Operands.push_back(MipsOperand::CreateImm(Res, S, E, *this));
|
||||
return false;
|
||||
@ -2565,14 +2565,14 @@ const MCExpr *MipsAsmParser::evaluateRelocExpr(const MCExpr *Expr,
|
||||
default:
|
||||
report_fatal_error("unsupported reloc value");
|
||||
}
|
||||
return MCConstantExpr::Create(Val, getContext());
|
||||
return MCConstantExpr::create(Val, getContext());
|
||||
}
|
||||
|
||||
if (const MCSymbolRefExpr *MSRE = dyn_cast<MCSymbolRefExpr>(Expr)) {
|
||||
// It's a symbol, create a symbolic expression from the symbol.
|
||||
StringRef Symbol = MSRE->getSymbol().getName();
|
||||
MCSymbolRefExpr::VariantKind VK = getVariantKind(RelocStr);
|
||||
Res = MCSymbolRefExpr::Create(Symbol, VK, getContext());
|
||||
Res = MCSymbolRefExpr::create(Symbol, VK, getContext());
|
||||
return Res;
|
||||
}
|
||||
|
||||
@ -2581,17 +2581,17 @@ const MCExpr *MipsAsmParser::evaluateRelocExpr(const MCExpr *Expr,
|
||||
|
||||
// Try to create target expression.
|
||||
if (MipsMCExpr::isSupportedBinaryExpr(VK, BE))
|
||||
return MipsMCExpr::Create(VK, Expr, getContext());
|
||||
return MipsMCExpr::create(VK, Expr, getContext());
|
||||
|
||||
const MCExpr *LExp = evaluateRelocExpr(BE->getLHS(), RelocStr);
|
||||
const MCExpr *RExp = evaluateRelocExpr(BE->getRHS(), RelocStr);
|
||||
Res = MCBinaryExpr::Create(BE->getOpcode(), LExp, RExp, getContext());
|
||||
Res = MCBinaryExpr::create(BE->getOpcode(), LExp, RExp, getContext());
|
||||
return Res;
|
||||
}
|
||||
|
||||
if (const MCUnaryExpr *UN = dyn_cast<MCUnaryExpr>(Expr)) {
|
||||
const MCExpr *UnExp = evaluateRelocExpr(UN->getSubExpr(), RelocStr);
|
||||
Res = MCUnaryExpr::Create(UN->getOpcode(), UnExp, getContext());
|
||||
Res = MCUnaryExpr::create(UN->getOpcode(), UnExp, getContext());
|
||||
return Res;
|
||||
}
|
||||
// Just return the original expression.
|
||||
@ -2779,7 +2779,7 @@ MipsAsmParser::parseMemOperand(OperandVector &Operands) {
|
||||
Parser.Lex(); // Eat the ')' token.
|
||||
|
||||
if (!IdVal)
|
||||
IdVal = MCConstantExpr::Create(0, getContext());
|
||||
IdVal = MCConstantExpr::create(0, getContext());
|
||||
|
||||
// Replace the register operand with the memory operand.
|
||||
std::unique_ptr<MipsOperand> op(
|
||||
@ -2790,10 +2790,10 @@ MipsAsmParser::parseMemOperand(OperandVector &Operands) {
|
||||
// Add the memory operand.
|
||||
if (const MCBinaryExpr *BE = dyn_cast<MCBinaryExpr>(IdVal)) {
|
||||
int64_t Imm;
|
||||
if (IdVal->EvaluateAsAbsolute(Imm))
|
||||
IdVal = MCConstantExpr::Create(Imm, getContext());
|
||||
if (IdVal->evaluateAsAbsolute(Imm))
|
||||
IdVal = MCConstantExpr::create(Imm, getContext());
|
||||
else if (BE->getLHS()->getKind() != MCExpr::SymbolRef)
|
||||
IdVal = MCBinaryExpr::Create(BE->getOpcode(), BE->getRHS(), BE->getLHS(),
|
||||
IdVal = MCBinaryExpr::create(BE->getOpcode(), BE->getRHS(), BE->getLHS(),
|
||||
getContext());
|
||||
}
|
||||
|
||||
@ -3010,7 +3010,7 @@ MipsAsmParser::parseInvNum(OperandVector &Operands) {
|
||||
int64_t Val = MCE->getValue();
|
||||
SMLoc E = SMLoc::getFromPointer(Parser.getTok().getLoc().getPointer() - 1);
|
||||
Operands.push_back(MipsOperand::CreateImm(
|
||||
MCConstantExpr::Create(0 - Val, getContext()), S, E, *this));
|
||||
MCConstantExpr::create(0 - Val, getContext()), S, E, *this));
|
||||
return MatchOperand_Success;
|
||||
}
|
||||
|
||||
@ -3034,7 +3034,7 @@ MipsAsmParser::parseLSAImm(OperandVector &Operands) {
|
||||
return MatchOperand_ParseFail;
|
||||
|
||||
int64_t Val;
|
||||
if (!Expr->EvaluateAsAbsolute(Val)) {
|
||||
if (!Expr->evaluateAsAbsolute(Val)) {
|
||||
Error(S, "expected immediate value");
|
||||
return MatchOperand_ParseFail;
|
||||
}
|
||||
@ -4286,7 +4286,7 @@ bool MipsAsmParser::ParseDirective(AsmToken DirectiveID) {
|
||||
reportParseError("expected number after comma");
|
||||
return false;
|
||||
}
|
||||
if (!DummyNumber->EvaluateAsAbsolute(DummyNumberVal)) {
|
||||
if (!DummyNumber->evaluateAsAbsolute(DummyNumberVal)) {
|
||||
reportParseError("expected an absolute expression after comma");
|
||||
return false;
|
||||
}
|
||||
@ -4366,7 +4366,7 @@ bool MipsAsmParser::ParseDirective(AsmToken DirectiveID) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!FrameSize->EvaluateAsAbsolute(FrameSizeVal)) {
|
||||
if (!FrameSize->evaluateAsAbsolute(FrameSizeVal)) {
|
||||
reportParseError("frame size not an absolute expression");
|
||||
return false;
|
||||
}
|
||||
@ -4427,7 +4427,7 @@ bool MipsAsmParser::ParseDirective(AsmToken DirectiveID) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!BitMask->EvaluateAsAbsolute(BitMaskVal)) {
|
||||
if (!BitMask->evaluateAsAbsolute(BitMaskVal)) {
|
||||
reportParseError("bitmask not an absolute expression");
|
||||
return false;
|
||||
}
|
||||
@ -4448,7 +4448,7 @@ bool MipsAsmParser::ParseDirective(AsmToken DirectiveID) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!FrameOffset->EvaluateAsAbsolute(FrameOffsetVal)) {
|
||||
if (!FrameOffset->evaluateAsAbsolute(FrameOffsetVal)) {
|
||||
reportParseError("frame offset not an absolute expression");
|
||||
return false;
|
||||
}
|
||||
|
@ -467,7 +467,7 @@ getExprOpValue(const MCExpr *Expr, SmallVectorImpl<MCFixup> &Fixups,
|
||||
const MCSubtargetInfo &STI) const {
|
||||
int64_t Res;
|
||||
|
||||
if (Expr->EvaluateAsAbsolute(Res))
|
||||
if (Expr->evaluateAsAbsolute(Res))
|
||||
return Res;
|
||||
|
||||
MCExpr::ExprKind Kind = Expr->getKind();
|
||||
|
@ -41,7 +41,7 @@ bool MipsMCExpr::isSupportedBinaryExpr(MCSymbolRefExpr::VariantKind VK,
|
||||
}
|
||||
|
||||
const MipsMCExpr*
|
||||
MipsMCExpr::Create(MCSymbolRefExpr::VariantKind VK, const MCExpr *Expr,
|
||||
MipsMCExpr::create(MCSymbolRefExpr::VariantKind VK, const MCExpr *Expr,
|
||||
MCContext &Ctx) {
|
||||
VariantKind Kind;
|
||||
switch (VK) {
|
||||
@ -64,7 +64,7 @@ MipsMCExpr::Create(MCSymbolRefExpr::VariantKind VK, const MCExpr *Expr,
|
||||
return new (Ctx) MipsMCExpr(Kind, Expr);
|
||||
}
|
||||
|
||||
void MipsMCExpr::PrintImpl(raw_ostream &OS) const {
|
||||
void MipsMCExpr::printImpl(raw_ostream &OS) const {
|
||||
switch (Kind) {
|
||||
default: llvm_unreachable("Invalid kind!");
|
||||
case VK_Mips_LO: OS << "%lo"; break;
|
||||
@ -79,10 +79,10 @@ void MipsMCExpr::PrintImpl(raw_ostream &OS) const {
|
||||
}
|
||||
|
||||
bool
|
||||
MipsMCExpr::EvaluateAsRelocatableImpl(MCValue &Res,
|
||||
MipsMCExpr::evaluateAsRelocatableImpl(MCValue &Res,
|
||||
const MCAsmLayout *Layout,
|
||||
const MCFixup *Fixup) const {
|
||||
return getSubExpr()->EvaluateAsRelocatable(Res, Layout, Fixup);
|
||||
return getSubExpr()->evaluateAsRelocatable(Res, Layout, Fixup);
|
||||
}
|
||||
|
||||
void MipsMCExpr::visitUsedExpr(MCStreamer &Streamer) const {
|
||||
|
@ -37,7 +37,7 @@ public:
|
||||
static bool isSupportedBinaryExpr(MCSymbolRefExpr::VariantKind VK,
|
||||
const MCBinaryExpr *BE);
|
||||
|
||||
static const MipsMCExpr *Create(MCSymbolRefExpr::VariantKind VK,
|
||||
static const MipsMCExpr *create(MCSymbolRefExpr::VariantKind VK,
|
||||
const MCExpr *Expr, MCContext &Ctx);
|
||||
|
||||
/// getOpcode - Get the kind of this expression.
|
||||
@ -46,13 +46,13 @@ public:
|
||||
/// getSubExpr - Get the child of this expression.
|
||||
const MCExpr *getSubExpr() const { return Expr; }
|
||||
|
||||
void PrintImpl(raw_ostream &OS) const override;
|
||||
bool EvaluateAsRelocatableImpl(MCValue &Res,
|
||||
void printImpl(raw_ostream &OS) const override;
|
||||
bool evaluateAsRelocatableImpl(MCValue &Res,
|
||||
const MCAsmLayout *Layout,
|
||||
const MCFixup *Fixup) const override;
|
||||
void visitUsedExpr(MCStreamer &Streamer) const override;
|
||||
MCSection *FindAssociatedSection() const override {
|
||||
return getSubExpr()->FindAssociatedSection();
|
||||
MCSection *findAssociatedSection() const override {
|
||||
return getSubExpr()->findAssociatedSection();
|
||||
}
|
||||
|
||||
// There are no TLS MipsMCExprs at the moment.
|
||||
|
@ -564,7 +564,7 @@ void MipsTargetELFStreamer::emitDirectiveEnd(StringRef Name) {
|
||||
ELF::SHF_ALLOC | ELF::SHT_REL);
|
||||
|
||||
const MCSymbolRefExpr *ExprRef =
|
||||
MCSymbolRefExpr::Create(Name, MCSymbolRefExpr::VK_None, Context);
|
||||
MCSymbolRefExpr::create(Name, MCSymbolRefExpr::VK_None, Context);
|
||||
|
||||
MCA.registerSection(*Sec);
|
||||
Sec->setAlignment(4);
|
||||
@ -694,7 +694,7 @@ void MipsTargetELFStreamer::emitDirectiveCpLoad(unsigned RegNo) {
|
||||
MCInst TmpInst;
|
||||
TmpInst.setOpcode(Mips::LUi);
|
||||
TmpInst.addOperand(MCOperand::createReg(Mips::GP));
|
||||
const MCSymbolRefExpr *HiSym = MCSymbolRefExpr::Create(
|
||||
const MCSymbolRefExpr *HiSym = MCSymbolRefExpr::create(
|
||||
"_gp_disp", MCSymbolRefExpr::VK_Mips_ABS_HI, MCA.getContext());
|
||||
TmpInst.addOperand(MCOperand::createExpr(HiSym));
|
||||
getStreamer().EmitInstruction(TmpInst, STI);
|
||||
@ -704,7 +704,7 @@ void MipsTargetELFStreamer::emitDirectiveCpLoad(unsigned RegNo) {
|
||||
TmpInst.setOpcode(Mips::ADDiu);
|
||||
TmpInst.addOperand(MCOperand::createReg(Mips::GP));
|
||||
TmpInst.addOperand(MCOperand::createReg(Mips::GP));
|
||||
const MCSymbolRefExpr *LoSym = MCSymbolRefExpr::Create(
|
||||
const MCSymbolRefExpr *LoSym = MCSymbolRefExpr::create(
|
||||
"_gp_disp", MCSymbolRefExpr::VK_Mips_ABS_LO, MCA.getContext());
|
||||
TmpInst.addOperand(MCOperand::createExpr(LoSym));
|
||||
getStreamer().EmitInstruction(TmpInst, STI);
|
||||
@ -748,9 +748,9 @@ void MipsTargetELFStreamer::emitDirectiveCpsetup(unsigned RegNo,
|
||||
getStreamer().EmitInstruction(Inst, STI);
|
||||
Inst.clear();
|
||||
|
||||
const MCSymbolRefExpr *HiExpr = MCSymbolRefExpr::Create(
|
||||
const MCSymbolRefExpr *HiExpr = MCSymbolRefExpr::create(
|
||||
&Sym, MCSymbolRefExpr::VK_Mips_GPOFF_HI, MCA.getContext());
|
||||
const MCSymbolRefExpr *LoExpr = MCSymbolRefExpr::Create(
|
||||
const MCSymbolRefExpr *LoExpr = MCSymbolRefExpr::create(
|
||||
&Sym, MCSymbolRefExpr::VK_Mips_GPOFF_LO, MCA.getContext());
|
||||
|
||||
// lui $gp, %hi(%neg(%gp_rel(funcSym)))
|
||||
|
@ -778,7 +778,7 @@ void MipsAsmPrinter::EmitJal(const MCSubtargetInfo &STI, MCSymbol *Symbol) {
|
||||
MCInst I;
|
||||
I.setOpcode(Mips::JAL);
|
||||
I.addOperand(
|
||||
MCOperand::createExpr(MCSymbolRefExpr::Create(Symbol, OutContext)));
|
||||
MCOperand::createExpr(MCSymbolRefExpr::create(Symbol, OutContext)));
|
||||
OutStreamer->EmitInstruction(I, STI);
|
||||
}
|
||||
|
||||
@ -1028,9 +1028,9 @@ void MipsAsmPrinter::EmitFPCallStub(
|
||||
|
||||
MCSymbol *Tmp = OutContext.createTempSymbol();
|
||||
OutStreamer->EmitLabel(Tmp);
|
||||
const MCSymbolRefExpr *E = MCSymbolRefExpr::Create(Stub, OutContext);
|
||||
const MCSymbolRefExpr *T = MCSymbolRefExpr::Create(Tmp, OutContext);
|
||||
const MCExpr *T_min_E = MCBinaryExpr::CreateSub(T, E, OutContext);
|
||||
const MCSymbolRefExpr *E = MCSymbolRefExpr::create(Stub, OutContext);
|
||||
const MCSymbolRefExpr *T = MCSymbolRefExpr::create(Tmp, OutContext);
|
||||
const MCExpr *T_min_E = MCBinaryExpr::createSub(T, E, OutContext);
|
||||
OutStreamer->EmitELFSize(Stub, T_min_E);
|
||||
TS.emitDirectiveEnd(x);
|
||||
OutStreamer->PopSection();
|
||||
|
@ -101,7 +101,7 @@ MCOperand MipsMCInstLower::LowerSymbolOperand(const MachineOperand &MO,
|
||||
llvm_unreachable("<unknown operand type>");
|
||||
}
|
||||
|
||||
const MCSymbolRefExpr *MCSym = MCSymbolRefExpr::Create(Symbol, Kind, *Ctx);
|
||||
const MCSymbolRefExpr *MCSym = MCSymbolRefExpr::create(Symbol, Kind, *Ctx);
|
||||
|
||||
if (!Offset)
|
||||
return MCOperand::createExpr(MCSym);
|
||||
@ -109,8 +109,8 @@ MCOperand MipsMCInstLower::LowerSymbolOperand(const MachineOperand &MO,
|
||||
// Assume offset is never negative.
|
||||
assert(Offset > 0);
|
||||
|
||||
const MCConstantExpr *OffsetExpr = MCConstantExpr::Create(Offset, *Ctx);
|
||||
const MCBinaryExpr *Add = MCBinaryExpr::CreateAdd(MCSym, OffsetExpr, *Ctx);
|
||||
const MCConstantExpr *OffsetExpr = MCConstantExpr::create(Offset, *Ctx);
|
||||
const MCBinaryExpr *Add = MCBinaryExpr::createAdd(MCSym, OffsetExpr, *Ctx);
|
||||
return MCOperand::createExpr(Add);
|
||||
}
|
||||
|
||||
@ -155,11 +155,11 @@ MCOperand MipsMCInstLower::LowerOperand(const MachineOperand &MO,
|
||||
MCOperand MipsMCInstLower::createSub(MachineBasicBlock *BB1,
|
||||
MachineBasicBlock *BB2,
|
||||
MCSymbolRefExpr::VariantKind Kind) const {
|
||||
const MCSymbolRefExpr *Sym1 = MCSymbolRefExpr::Create(BB1->getSymbol(), *Ctx);
|
||||
const MCSymbolRefExpr *Sym2 = MCSymbolRefExpr::Create(BB2->getSymbol(), *Ctx);
|
||||
const MCBinaryExpr *Sub = MCBinaryExpr::CreateSub(Sym1, Sym2, *Ctx);
|
||||
const MCSymbolRefExpr *Sym1 = MCSymbolRefExpr::create(BB1->getSymbol(), *Ctx);
|
||||
const MCSymbolRefExpr *Sym2 = MCSymbolRefExpr::create(BB2->getSymbol(), *Ctx);
|
||||
const MCBinaryExpr *Sub = MCBinaryExpr::createSub(Sym1, Sym2, *Ctx);
|
||||
|
||||
return MCOperand::createExpr(MipsMCExpr::Create(Kind, Sub, *Ctx));
|
||||
return MCOperand::createExpr(MipsMCExpr::create(Kind, Sub, *Ctx));
|
||||
}
|
||||
|
||||
void MipsMCInstLower::
|
||||
|
@ -266,7 +266,7 @@ bool NVPTXAsmPrinter::lowerOperand(const MachineOperand &MO,
|
||||
MCOp = MCOperand::createImm(MO.getImm());
|
||||
break;
|
||||
case MachineOperand::MO_MachineBasicBlock:
|
||||
MCOp = MCOperand::createExpr(MCSymbolRefExpr::Create(
|
||||
MCOp = MCOperand::createExpr(MCSymbolRefExpr::create(
|
||||
MO.getMBB()->getSymbol(), OutContext));
|
||||
break;
|
||||
case MachineOperand::MO_ExternalSymbol:
|
||||
@ -283,11 +283,11 @@ bool NVPTXAsmPrinter::lowerOperand(const MachineOperand &MO,
|
||||
default: report_fatal_error("Unsupported FP type"); break;
|
||||
case Type::FloatTyID:
|
||||
MCOp = MCOperand::createExpr(
|
||||
NVPTXFloatMCExpr::CreateConstantFPSingle(Val, OutContext));
|
||||
NVPTXFloatMCExpr::createConstantFPSingle(Val, OutContext));
|
||||
break;
|
||||
case Type::DoubleTyID:
|
||||
MCOp = MCOperand::createExpr(
|
||||
NVPTXFloatMCExpr::CreateConstantFPDouble(Val, OutContext));
|
||||
NVPTXFloatMCExpr::createConstantFPDouble(Val, OutContext));
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@ -334,7 +334,7 @@ unsigned NVPTXAsmPrinter::encodeVirtualRegister(unsigned Reg) {
|
||||
|
||||
MCOperand NVPTXAsmPrinter::GetSymbolRef(const MCSymbol *Symbol) {
|
||||
const MCExpr *Expr;
|
||||
Expr = MCSymbolRefExpr::Create(Symbol, MCSymbolRefExpr::VK_None,
|
||||
Expr = MCSymbolRefExpr::create(Symbol, MCSymbolRefExpr::VK_None,
|
||||
OutContext);
|
||||
return MCOperand::createExpr(Expr);
|
||||
}
|
||||
@ -1991,16 +1991,16 @@ NVPTXAsmPrinter::lowerConstantForGV(const Constant *CV, bool ProcessingGeneric)
|
||||
MCContext &Ctx = OutContext;
|
||||
|
||||
if (CV->isNullValue() || isa<UndefValue>(CV))
|
||||
return MCConstantExpr::Create(0, Ctx);
|
||||
return MCConstantExpr::create(0, Ctx);
|
||||
|
||||
if (const ConstantInt *CI = dyn_cast<ConstantInt>(CV))
|
||||
return MCConstantExpr::Create(CI->getZExtValue(), Ctx);
|
||||
return MCConstantExpr::create(CI->getZExtValue(), Ctx);
|
||||
|
||||
if (const GlobalValue *GV = dyn_cast<GlobalValue>(CV)) {
|
||||
const MCSymbolRefExpr *Expr =
|
||||
MCSymbolRefExpr::Create(getSymbol(GV), Ctx);
|
||||
MCSymbolRefExpr::create(getSymbol(GV), Ctx);
|
||||
if (ProcessingGeneric) {
|
||||
return NVPTXGenericMCSymbolRefExpr::Create(Expr, Ctx);
|
||||
return NVPTXGenericMCSymbolRefExpr::create(Expr, Ctx);
|
||||
} else {
|
||||
return Expr;
|
||||
}
|
||||
@ -2057,7 +2057,7 @@ NVPTXAsmPrinter::lowerConstantForGV(const Constant *CV, bool ProcessingGeneric)
|
||||
return Base;
|
||||
|
||||
int64_t Offset = OffsetAI.getSExtValue();
|
||||
return MCBinaryExpr::CreateAdd(Base, MCConstantExpr::Create(Offset, Ctx),
|
||||
return MCBinaryExpr::createAdd(Base, MCConstantExpr::create(Offset, Ctx),
|
||||
Ctx);
|
||||
}
|
||||
|
||||
@ -2100,8 +2100,8 @@ NVPTXAsmPrinter::lowerConstantForGV(const Constant *CV, bool ProcessingGeneric)
|
||||
// the high bits so we are sure to get a proper truncation if the input is
|
||||
// a constant expr.
|
||||
unsigned InBits = DL.getTypeAllocSizeInBits(Op->getType());
|
||||
const MCExpr *MaskExpr = MCConstantExpr::Create(~0ULL >> (64-InBits), Ctx);
|
||||
return MCBinaryExpr::CreateAnd(OpExpr, MaskExpr, Ctx);
|
||||
const MCExpr *MaskExpr = MCConstantExpr::create(~0ULL >> (64-InBits), Ctx);
|
||||
return MCBinaryExpr::createAnd(OpExpr, MaskExpr, Ctx);
|
||||
}
|
||||
|
||||
// The MC library also has a right-shift operator, but it isn't consistently
|
||||
@ -2111,7 +2111,7 @@ NVPTXAsmPrinter::lowerConstantForGV(const Constant *CV, bool ProcessingGeneric)
|
||||
const MCExpr *RHS = lowerConstantForGV(CE->getOperand(1), ProcessingGeneric);
|
||||
switch (CE->getOpcode()) {
|
||||
default: llvm_unreachable("Unknown binary operator constant cast expr");
|
||||
case Instruction::Add: return MCBinaryExpr::CreateAdd(LHS, RHS, Ctx);
|
||||
case Instruction::Add: return MCBinaryExpr::createAdd(LHS, RHS, Ctx);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2121,7 +2121,7 @@ NVPTXAsmPrinter::lowerConstantForGV(const Constant *CV, bool ProcessingGeneric)
|
||||
void NVPTXAsmPrinter::printMCExpr(const MCExpr &Expr, raw_ostream &OS) {
|
||||
switch (Expr.getKind()) {
|
||||
case MCExpr::Target:
|
||||
return cast<MCTargetExpr>(&Expr)->PrintImpl(OS);
|
||||
return cast<MCTargetExpr>(&Expr)->printImpl(OS);
|
||||
case MCExpr::Constant:
|
||||
OS << cast<MCConstantExpr>(Expr).getValue();
|
||||
return;
|
||||
|
@ -16,11 +16,11 @@ using namespace llvm;
|
||||
#define DEBUG_TYPE "nvptx-mcexpr"
|
||||
|
||||
const NVPTXFloatMCExpr*
|
||||
NVPTXFloatMCExpr::Create(VariantKind Kind, APFloat Flt, MCContext &Ctx) {
|
||||
NVPTXFloatMCExpr::create(VariantKind Kind, APFloat Flt, MCContext &Ctx) {
|
||||
return new (Ctx) NVPTXFloatMCExpr(Kind, Flt);
|
||||
}
|
||||
|
||||
void NVPTXFloatMCExpr::PrintImpl(raw_ostream &OS) const {
|
||||
void NVPTXFloatMCExpr::printImpl(raw_ostream &OS) const {
|
||||
bool Ignored;
|
||||
unsigned NumHex;
|
||||
APFloat APF = getAPFloat();
|
||||
@ -47,11 +47,11 @@ void NVPTXFloatMCExpr::PrintImpl(raw_ostream &OS) const {
|
||||
}
|
||||
|
||||
const NVPTXGenericMCSymbolRefExpr*
|
||||
NVPTXGenericMCSymbolRefExpr::Create(const MCSymbolRefExpr *SymExpr,
|
||||
NVPTXGenericMCSymbolRefExpr::create(const MCSymbolRefExpr *SymExpr,
|
||||
MCContext &Ctx) {
|
||||
return new (Ctx) NVPTXGenericMCSymbolRefExpr(SymExpr);
|
||||
}
|
||||
|
||||
void NVPTXGenericMCSymbolRefExpr::PrintImpl(raw_ostream &OS) const {
|
||||
void NVPTXGenericMCSymbolRefExpr::printImpl(raw_ostream &OS) const {
|
||||
OS << "generic(" << *SymExpr << ")";
|
||||
}
|
||||
|
@ -36,17 +36,17 @@ public:
|
||||
/// @name Construction
|
||||
/// @{
|
||||
|
||||
static const NVPTXFloatMCExpr *Create(VariantKind Kind, APFloat Flt,
|
||||
static const NVPTXFloatMCExpr *create(VariantKind Kind, APFloat Flt,
|
||||
MCContext &Ctx);
|
||||
|
||||
static const NVPTXFloatMCExpr *CreateConstantFPSingle(APFloat Flt,
|
||||
static const NVPTXFloatMCExpr *createConstantFPSingle(APFloat Flt,
|
||||
MCContext &Ctx) {
|
||||
return Create(VK_NVPTX_SINGLE_PREC_FLOAT, Flt, Ctx);
|
||||
return create(VK_NVPTX_SINGLE_PREC_FLOAT, Flt, Ctx);
|
||||
}
|
||||
|
||||
static const NVPTXFloatMCExpr *CreateConstantFPDouble(APFloat Flt,
|
||||
static const NVPTXFloatMCExpr *createConstantFPDouble(APFloat Flt,
|
||||
MCContext &Ctx) {
|
||||
return Create(VK_NVPTX_DOUBLE_PREC_FLOAT, Flt, Ctx);
|
||||
return create(VK_NVPTX_DOUBLE_PREC_FLOAT, Flt, Ctx);
|
||||
}
|
||||
|
||||
/// @}
|
||||
@ -61,14 +61,14 @@ public:
|
||||
|
||||
/// @}
|
||||
|
||||
void PrintImpl(raw_ostream &OS) const override;
|
||||
bool EvaluateAsRelocatableImpl(MCValue &Res,
|
||||
void printImpl(raw_ostream &OS) const override;
|
||||
bool evaluateAsRelocatableImpl(MCValue &Res,
|
||||
const MCAsmLayout *Layout,
|
||||
const MCFixup *Fixup) const override {
|
||||
return false;
|
||||
}
|
||||
void visitUsedExpr(MCStreamer &Streamer) const override {};
|
||||
MCSection *FindAssociatedSection() const override { return nullptr; }
|
||||
MCSection *findAssociatedSection() const override { return nullptr; }
|
||||
|
||||
// There are no TLS NVPTXMCExprs at the moment.
|
||||
void fixELFSymbolsInTLSFixups(MCAssembler &Asm) const override {}
|
||||
@ -92,7 +92,7 @@ public:
|
||||
/// @{
|
||||
|
||||
static const NVPTXGenericMCSymbolRefExpr
|
||||
*Create(const MCSymbolRefExpr *SymExpr, MCContext &Ctx);
|
||||
*create(const MCSymbolRefExpr *SymExpr, MCContext &Ctx);
|
||||
|
||||
/// @}
|
||||
/// @name Accessors
|
||||
@ -103,14 +103,14 @@ public:
|
||||
|
||||
/// @}
|
||||
|
||||
void PrintImpl(raw_ostream &OS) const override;
|
||||
bool EvaluateAsRelocatableImpl(MCValue &Res,
|
||||
void printImpl(raw_ostream &OS) const override;
|
||||
bool evaluateAsRelocatableImpl(MCValue &Res,
|
||||
const MCAsmLayout *Layout,
|
||||
const MCFixup *Fixup) const override {
|
||||
return false;
|
||||
}
|
||||
void visitUsedExpr(MCStreamer &Streamer) const override {};
|
||||
MCSection *FindAssociatedSection() const override { return nullptr; }
|
||||
MCSection *findAssociatedSection() const override { return nullptr; }
|
||||
|
||||
// There are no TLS NVPTXMCExprs at the moment.
|
||||
void fixELFSymbolsInTLSFixups(MCAssembler &Asm) const override {}
|
||||
|
@ -772,7 +772,7 @@ public:
|
||||
|
||||
if (const PPCMCExpr *TE = dyn_cast<PPCMCExpr>(Val)) {
|
||||
int64_t Res;
|
||||
if (TE->EvaluateAsConstant(Res))
|
||||
if (TE->evaluateAsConstant(Res))
|
||||
return CreateContextImm(Res, S, E, IsPPC64);
|
||||
}
|
||||
|
||||
@ -814,13 +814,13 @@ addNegOperand(MCInst &Inst, MCOperand &Op, MCContext &Ctx) {
|
||||
}
|
||||
} else if (const MCBinaryExpr *BinExpr = dyn_cast<MCBinaryExpr>(Expr)) {
|
||||
if (BinExpr->getOpcode() == MCBinaryExpr::Sub) {
|
||||
const MCExpr *NE = MCBinaryExpr::CreateSub(BinExpr->getRHS(),
|
||||
const MCExpr *NE = MCBinaryExpr::createSub(BinExpr->getRHS(),
|
||||
BinExpr->getLHS(), Ctx);
|
||||
Inst.addOperand(MCOperand::createExpr(NE));
|
||||
return;
|
||||
}
|
||||
}
|
||||
Inst.addOperand(MCOperand::createExpr(MCUnaryExpr::CreateMinus(Expr, Ctx)));
|
||||
Inst.addOperand(MCOperand::createExpr(MCUnaryExpr::createMinus(Expr, Ctx)));
|
||||
}
|
||||
|
||||
void PPCAsmParser::ProcessInstruction(MCInst &Inst,
|
||||
@ -1330,7 +1330,7 @@ ExtractModifierFromExpr(const MCExpr *E,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return MCSymbolRefExpr::Create(&SRE->getSymbol(), Context);
|
||||
return MCSymbolRefExpr::create(&SRE->getSymbol(), Context);
|
||||
}
|
||||
|
||||
case MCExpr::Unary: {
|
||||
@ -1338,7 +1338,7 @@ ExtractModifierFromExpr(const MCExpr *E,
|
||||
const MCExpr *Sub = ExtractModifierFromExpr(UE->getSubExpr(), Variant);
|
||||
if (!Sub)
|
||||
return nullptr;
|
||||
return MCUnaryExpr::Create(UE->getOpcode(), Sub, Context);
|
||||
return MCUnaryExpr::create(UE->getOpcode(), Sub, Context);
|
||||
}
|
||||
|
||||
case MCExpr::Binary: {
|
||||
@ -1362,7 +1362,7 @@ ExtractModifierFromExpr(const MCExpr *E,
|
||||
else
|
||||
return nullptr;
|
||||
|
||||
return MCBinaryExpr::Create(BE->getOpcode(), LHS, RHS, Context);
|
||||
return MCBinaryExpr::create(BE->getOpcode(), LHS, RHS, Context);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1396,7 +1396,7 @@ FixupVariantKind(const MCExpr *E) {
|
||||
default:
|
||||
return E;
|
||||
}
|
||||
return MCSymbolRefExpr::Create(&SRE->getSymbol(), Variant, Context);
|
||||
return MCSymbolRefExpr::create(&SRE->getSymbol(), Variant, Context);
|
||||
}
|
||||
|
||||
case MCExpr::Unary: {
|
||||
@ -1404,7 +1404,7 @@ FixupVariantKind(const MCExpr *E) {
|
||||
const MCExpr *Sub = FixupVariantKind(UE->getSubExpr());
|
||||
if (Sub == UE->getSubExpr())
|
||||
return E;
|
||||
return MCUnaryExpr::Create(UE->getOpcode(), Sub, Context);
|
||||
return MCUnaryExpr::create(UE->getOpcode(), Sub, Context);
|
||||
}
|
||||
|
||||
case MCExpr::Binary: {
|
||||
@ -1413,7 +1413,7 @@ FixupVariantKind(const MCExpr *E) {
|
||||
const MCExpr *RHS = FixupVariantKind(BE->getRHS());
|
||||
if (LHS == BE->getLHS() && RHS == BE->getRHS())
|
||||
return E;
|
||||
return MCBinaryExpr::Create(BE->getOpcode(), LHS, RHS, Context);
|
||||
return MCBinaryExpr::create(BE->getOpcode(), LHS, RHS, Context);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1438,7 +1438,7 @@ ParseExpression(const MCExpr *&EVal) {
|
||||
PPCMCExpr::VariantKind Variant;
|
||||
const MCExpr *E = ExtractModifierFromExpr(EVal, Variant);
|
||||
if (E)
|
||||
EVal = PPCMCExpr::Create(Variant, E, false, getParser().getContext());
|
||||
EVal = PPCMCExpr::create(Variant, E, false, getParser().getContext());
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -1485,7 +1485,7 @@ ParseDarwinExpression(const MCExpr *&EVal) {
|
||||
if (getLexer().isNot(AsmToken::RParen))
|
||||
return Error(Parser.getTok().getLoc(), "expected ')'");
|
||||
Parser.Lex(); // Eat the ')'
|
||||
EVal = PPCMCExpr::Create(Variant, EVal, false, getParser().getContext());
|
||||
EVal = PPCMCExpr::create(Variant, EVal, false, getParser().getContext());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -1936,19 +1936,19 @@ PPCAsmParser::applyModifierToExpr(const MCExpr *E,
|
||||
MCContext &Ctx) {
|
||||
switch (Variant) {
|
||||
case MCSymbolRefExpr::VK_PPC_LO:
|
||||
return PPCMCExpr::Create(PPCMCExpr::VK_PPC_LO, E, false, Ctx);
|
||||
return PPCMCExpr::create(PPCMCExpr::VK_PPC_LO, E, false, Ctx);
|
||||
case MCSymbolRefExpr::VK_PPC_HI:
|
||||
return PPCMCExpr::Create(PPCMCExpr::VK_PPC_HI, E, false, Ctx);
|
||||
return PPCMCExpr::create(PPCMCExpr::VK_PPC_HI, E, false, Ctx);
|
||||
case MCSymbolRefExpr::VK_PPC_HA:
|
||||
return PPCMCExpr::Create(PPCMCExpr::VK_PPC_HA, E, false, Ctx);
|
||||
return PPCMCExpr::create(PPCMCExpr::VK_PPC_HA, E, false, Ctx);
|
||||
case MCSymbolRefExpr::VK_PPC_HIGHER:
|
||||
return PPCMCExpr::Create(PPCMCExpr::VK_PPC_HIGHER, E, false, Ctx);
|
||||
return PPCMCExpr::create(PPCMCExpr::VK_PPC_HIGHER, E, false, Ctx);
|
||||
case MCSymbolRefExpr::VK_PPC_HIGHERA:
|
||||
return PPCMCExpr::Create(PPCMCExpr::VK_PPC_HIGHERA, E, false, Ctx);
|
||||
return PPCMCExpr::create(PPCMCExpr::VK_PPC_HIGHERA, E, false, Ctx);
|
||||
case MCSymbolRefExpr::VK_PPC_HIGHEST:
|
||||
return PPCMCExpr::Create(PPCMCExpr::VK_PPC_HIGHEST, E, false, Ctx);
|
||||
return PPCMCExpr::create(PPCMCExpr::VK_PPC_HIGHEST, E, false, Ctx);
|
||||
case MCSymbolRefExpr::VK_PPC_HIGHESTA:
|
||||
return PPCMCExpr::Create(PPCMCExpr::VK_PPC_HIGHESTA, E, false, Ctx);
|
||||
return PPCMCExpr::create(PPCMCExpr::VK_PPC_HIGHESTA, E, false, Ctx);
|
||||
default:
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -19,12 +19,12 @@ using namespace llvm;
|
||||
#define DEBUG_TYPE "ppcmcexpr"
|
||||
|
||||
const PPCMCExpr*
|
||||
PPCMCExpr::Create(VariantKind Kind, const MCExpr *Expr,
|
||||
PPCMCExpr::create(VariantKind Kind, const MCExpr *Expr,
|
||||
bool isDarwin, MCContext &Ctx) {
|
||||
return new (Ctx) PPCMCExpr(Kind, Expr, isDarwin);
|
||||
}
|
||||
|
||||
void PPCMCExpr::PrintImpl(raw_ostream &OS) const {
|
||||
void PPCMCExpr::printImpl(raw_ostream &OS) const {
|
||||
if (isDarwinSyntax()) {
|
||||
switch (Kind) {
|
||||
default: llvm_unreachable("Invalid kind!");
|
||||
@ -53,21 +53,21 @@ void PPCMCExpr::PrintImpl(raw_ostream &OS) const {
|
||||
}
|
||||
|
||||
bool
|
||||
PPCMCExpr::EvaluateAsConstant(int64_t &Res) const {
|
||||
PPCMCExpr::evaluateAsConstant(int64_t &Res) const {
|
||||
MCValue Value;
|
||||
|
||||
if (!getSubExpr()->EvaluateAsRelocatable(Value, nullptr, nullptr))
|
||||
if (!getSubExpr()->evaluateAsRelocatable(Value, nullptr, nullptr))
|
||||
return false;
|
||||
|
||||
if (!Value.isAbsolute())
|
||||
return false;
|
||||
|
||||
Res = EvaluateAsInt64(Value.getConstant());
|
||||
Res = evaluateAsInt64(Value.getConstant());
|
||||
return true;
|
||||
}
|
||||
|
||||
int64_t
|
||||
PPCMCExpr::EvaluateAsInt64(int64_t Value) const {
|
||||
PPCMCExpr::evaluateAsInt64(int64_t Value) const {
|
||||
switch (Kind) {
|
||||
case VK_PPC_LO:
|
||||
return Value & 0xffff;
|
||||
@ -90,16 +90,16 @@ PPCMCExpr::EvaluateAsInt64(int64_t Value) const {
|
||||
}
|
||||
|
||||
bool
|
||||
PPCMCExpr::EvaluateAsRelocatableImpl(MCValue &Res,
|
||||
PPCMCExpr::evaluateAsRelocatableImpl(MCValue &Res,
|
||||
const MCAsmLayout *Layout,
|
||||
const MCFixup *Fixup) const {
|
||||
MCValue Value;
|
||||
|
||||
if (!getSubExpr()->EvaluateAsRelocatable(Value, Layout, Fixup))
|
||||
if (!getSubExpr()->evaluateAsRelocatable(Value, Layout, Fixup))
|
||||
return false;
|
||||
|
||||
if (Value.isAbsolute()) {
|
||||
int64_t Result = EvaluateAsInt64(Value.getConstant());
|
||||
int64_t Result = evaluateAsInt64(Value.getConstant());
|
||||
if ((Fixup == nullptr || (unsigned)Fixup->getKind() != PPC::fixup_ppc_half16) &&
|
||||
(Result >= 0x8000))
|
||||
return false;
|
||||
@ -138,7 +138,7 @@ PPCMCExpr::EvaluateAsRelocatableImpl(MCValue &Res,
|
||||
Modifier = MCSymbolRefExpr::VK_PPC_HIGHESTA;
|
||||
break;
|
||||
}
|
||||
Sym = MCSymbolRefExpr::Create(&Sym->getSymbol(), Modifier, Context);
|
||||
Sym = MCSymbolRefExpr::create(&Sym->getSymbol(), Modifier, Context);
|
||||
Res = MCValue::get(Sym, Value.getSymB(), Value.getConstant());
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ private:
|
||||
const MCExpr *Expr;
|
||||
bool IsDarwin;
|
||||
|
||||
int64_t EvaluateAsInt64(int64_t Value) const;
|
||||
int64_t evaluateAsInt64(int64_t Value) const;
|
||||
|
||||
explicit PPCMCExpr(VariantKind Kind, const MCExpr *Expr, bool IsDarwin)
|
||||
: Kind(Kind), Expr(Expr), IsDarwin(IsDarwin) {}
|
||||
@ -43,22 +43,22 @@ public:
|
||||
/// @name Construction
|
||||
/// @{
|
||||
|
||||
static const PPCMCExpr *Create(VariantKind Kind, const MCExpr *Expr,
|
||||
static const PPCMCExpr *create(VariantKind Kind, const MCExpr *Expr,
|
||||
bool isDarwin, MCContext &Ctx);
|
||||
|
||||
static const PPCMCExpr *CreateLo(const MCExpr *Expr,
|
||||
static const PPCMCExpr *createLo(const MCExpr *Expr,
|
||||
bool isDarwin, MCContext &Ctx) {
|
||||
return Create(VK_PPC_LO, Expr, isDarwin, Ctx);
|
||||
return create(VK_PPC_LO, Expr, isDarwin, Ctx);
|
||||
}
|
||||
|
||||
static const PPCMCExpr *CreateHi(const MCExpr *Expr,
|
||||
static const PPCMCExpr *createHi(const MCExpr *Expr,
|
||||
bool isDarwin, MCContext &Ctx) {
|
||||
return Create(VK_PPC_HI, Expr, isDarwin, Ctx);
|
||||
return create(VK_PPC_HI, Expr, isDarwin, Ctx);
|
||||
}
|
||||
|
||||
static const PPCMCExpr *CreateHa(const MCExpr *Expr,
|
||||
static const PPCMCExpr *createHa(const MCExpr *Expr,
|
||||
bool isDarwin, MCContext &Ctx) {
|
||||
return Create(VK_PPC_HA, Expr, isDarwin, Ctx);
|
||||
return create(VK_PPC_HA, Expr, isDarwin, Ctx);
|
||||
}
|
||||
|
||||
/// @}
|
||||
@ -77,19 +77,19 @@ public:
|
||||
|
||||
/// @}
|
||||
|
||||
void PrintImpl(raw_ostream &OS) const override;
|
||||
bool EvaluateAsRelocatableImpl(MCValue &Res,
|
||||
void printImpl(raw_ostream &OS) const override;
|
||||
bool evaluateAsRelocatableImpl(MCValue &Res,
|
||||
const MCAsmLayout *Layout,
|
||||
const MCFixup *Fixup) const override;
|
||||
void visitUsedExpr(MCStreamer &Streamer) const override;
|
||||
MCSection *FindAssociatedSection() const override {
|
||||
return getSubExpr()->FindAssociatedSection();
|
||||
MCSection *findAssociatedSection() const override {
|
||||
return getSubExpr()->findAssociatedSection();
|
||||
}
|
||||
|
||||
// There are no TLS PPCMCExprs at the moment.
|
||||
void fixELFSymbolsInTLSFixups(MCAssembler &Asm) const override {}
|
||||
|
||||
bool EvaluateAsConstant(int64_t &Res) const;
|
||||
bool evaluateAsConstant(int64_t &Res) const;
|
||||
|
||||
static bool classof(const MCExpr *E) {
|
||||
return E->getKind() == MCExpr::Target;
|
||||
|
@ -163,7 +163,7 @@ public:
|
||||
MCAssembler &MCA = getStreamer().getAssembler();
|
||||
|
||||
int64_t Res;
|
||||
if (!LocalOffset->EvaluateAsAbsolute(Res, MCA))
|
||||
if (!LocalOffset->evaluateAsAbsolute(Res, MCA))
|
||||
report_fatal_error(".localentry expression must be absolute.");
|
||||
|
||||
unsigned Encoded = ELF::encodePPC64LocalEntryOffset(Res);
|
||||
|
@ -251,7 +251,7 @@ bool PPCMachObjectWriter::RecordScatteredRelocation(
|
||||
}
|
||||
|
||||
// Is this supposed to follow MCTarget/PPCAsmBackend.cpp:adjustFixupValue()?
|
||||
// see PPCMCExpr::EvaluateAsRelocatableImpl()
|
||||
// see PPCMCExpr::evaluateAsRelocatableImpl()
|
||||
uint32_t other_half = 0;
|
||||
switch (Type) {
|
||||
case MachO::PPC_RELOC_LO16_SECTDIFF:
|
||||
@ -344,7 +344,7 @@ void PPCMachObjectWriter::RecordPPCRelocation(
|
||||
// Resolve constant variables.
|
||||
if (A->isVariable()) {
|
||||
int64_t Res;
|
||||
if (A->getVariableValue()->EvaluateAsAbsolute(
|
||||
if (A->getVariableValue()->evaluateAsAbsolute(
|
||||
Res, Layout, Writer->getSectionAddressMap())) {
|
||||
FixedValue = Res;
|
||||
return;
|
||||
|
@ -422,11 +422,11 @@ void PPCAsmPrinter::EmitTlsCall(const MachineInstr *MI,
|
||||
TM.getRelocationModel() == Reloc::PIC_)
|
||||
Kind = MCSymbolRefExpr::VK_PLT;
|
||||
const MCSymbolRefExpr *TlsRef =
|
||||
MCSymbolRefExpr::Create(TlsGetAddr, Kind, OutContext);
|
||||
MCSymbolRefExpr::create(TlsGetAddr, Kind, OutContext);
|
||||
const MachineOperand &MO = MI->getOperand(2);
|
||||
const GlobalValue *GValue = MO.getGlobal();
|
||||
MCSymbol *MOSymbol = getSymbol(GValue);
|
||||
const MCExpr *SymVar = MCSymbolRefExpr::Create(MOSymbol, VK, OutContext);
|
||||
const MCExpr *SymVar = MCSymbolRefExpr::create(MOSymbol, VK, OutContext);
|
||||
EmitToStreamer(*OutStreamer,
|
||||
MCInstBuilder(Subtarget->isPPC64() ?
|
||||
PPC::BL8_NOP_TLS : PPC::BL_TLS)
|
||||
@ -464,10 +464,10 @@ void PPCAsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
||||
MCSymbol *GOTSymbol =
|
||||
OutContext.getOrCreateSymbol(StringRef("_GLOBAL_OFFSET_TABLE_"));
|
||||
const MCExpr *OffsExpr =
|
||||
MCBinaryExpr::CreateSub(MCSymbolRefExpr::Create(GOTSymbol,
|
||||
MCBinaryExpr::createSub(MCSymbolRefExpr::create(GOTSymbol,
|
||||
MCSymbolRefExpr::VK_PPC_LOCAL,
|
||||
OutContext),
|
||||
MCConstantExpr::Create(4, OutContext),
|
||||
MCConstantExpr::create(4, OutContext),
|
||||
OutContext);
|
||||
|
||||
// Emit the 'bl'.
|
||||
@ -486,7 +486,7 @@ void PPCAsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
||||
EmitToStreamer(*OutStreamer, MCInstBuilder(PPC::BL)
|
||||
// FIXME: We would like an efficient form for this, so we don't have to do
|
||||
// a lot of extra uniquing.
|
||||
.addExpr(MCSymbolRefExpr::Create(PICBase, OutContext)));
|
||||
.addExpr(MCSymbolRefExpr::create(PICBase, OutContext)));
|
||||
|
||||
// Emit the label.
|
||||
OutStreamer->EmitLabel(PICBase);
|
||||
@ -502,9 +502,9 @@ void PPCAsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
||||
MF->getInfo<PPCFunctionInfo>()->getPICOffsetSymbol();
|
||||
TmpInst.setOpcode(PPC::LWZ);
|
||||
const MCExpr *Exp =
|
||||
MCSymbolRefExpr::Create(PICOffset, MCSymbolRefExpr::VK_None, OutContext);
|
||||
MCSymbolRefExpr::create(PICOffset, MCSymbolRefExpr::VK_None, OutContext);
|
||||
const MCExpr *PB =
|
||||
MCSymbolRefExpr::Create(MF->getPICBaseSymbol(),
|
||||
MCSymbolRefExpr::create(MF->getPICBaseSymbol(),
|
||||
MCSymbolRefExpr::VK_None,
|
||||
OutContext);
|
||||
const MCOperand TR = TmpInst.getOperand(1);
|
||||
@ -512,7 +512,7 @@ void PPCAsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
||||
|
||||
// Step 1: lwz %Rt, .L$poff - .L$pb(%Ri)
|
||||
TmpInst.getOperand(1) =
|
||||
MCOperand::createExpr(MCBinaryExpr::CreateSub(Exp, PB, OutContext));
|
||||
MCOperand::createExpr(MCBinaryExpr::createSub(Exp, PB, OutContext));
|
||||
TmpInst.getOperand(0) = TR;
|
||||
TmpInst.getOperand(2) = PICR;
|
||||
EmitToStreamer(*OutStreamer, TmpInst);
|
||||
@ -547,19 +547,19 @@ void PPCAsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
||||
|
||||
if (PL == PICLevel::Small) {
|
||||
const MCExpr *Exp =
|
||||
MCSymbolRefExpr::Create(MOSymbol, MCSymbolRefExpr::VK_GOT,
|
||||
MCSymbolRefExpr::create(MOSymbol, MCSymbolRefExpr::VK_GOT,
|
||||
OutContext);
|
||||
TmpInst.getOperand(1) = MCOperand::createExpr(Exp);
|
||||
} else {
|
||||
MCSymbol *TOCEntry = lookUpOrCreateTOCEntry(MOSymbol);
|
||||
|
||||
const MCExpr *Exp =
|
||||
MCSymbolRefExpr::Create(TOCEntry, MCSymbolRefExpr::VK_None,
|
||||
MCSymbolRefExpr::create(TOCEntry, MCSymbolRefExpr::VK_None,
|
||||
OutContext);
|
||||
const MCExpr *PB =
|
||||
MCSymbolRefExpr::Create(OutContext.getOrCreateSymbol(Twine(".LTOC")),
|
||||
MCSymbolRefExpr::create(OutContext.getOrCreateSymbol(Twine(".LTOC")),
|
||||
OutContext);
|
||||
Exp = MCBinaryExpr::CreateSub(Exp, PB, OutContext);
|
||||
Exp = MCBinaryExpr::createSub(Exp, PB, OutContext);
|
||||
TmpInst.getOperand(1) = MCOperand::createExpr(Exp);
|
||||
}
|
||||
EmitToStreamer(*OutStreamer, TmpInst);
|
||||
@ -592,7 +592,7 @@ void PPCAsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
||||
MCSymbol *TOCEntry = lookUpOrCreateTOCEntry(MOSymbol);
|
||||
|
||||
const MCExpr *Exp =
|
||||
MCSymbolRefExpr::Create(TOCEntry, MCSymbolRefExpr::VK_PPC_TOC,
|
||||
MCSymbolRefExpr::create(TOCEntry, MCSymbolRefExpr::VK_PPC_TOC,
|
||||
OutContext);
|
||||
TmpInst.getOperand(1) = MCOperand::createExpr(Exp);
|
||||
EmitToStreamer(*OutStreamer, TmpInst);
|
||||
@ -639,7 +639,7 @@ void PPCAsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
||||
MOSymbol = lookUpOrCreateTOCEntry(MOSymbol);
|
||||
|
||||
const MCExpr *Exp =
|
||||
MCSymbolRefExpr::Create(MOSymbol, MCSymbolRefExpr::VK_PPC_TOC_HA,
|
||||
MCSymbolRefExpr::create(MOSymbol, MCSymbolRefExpr::VK_PPC_TOC_HA,
|
||||
OutContext);
|
||||
TmpInst.getOperand(2) = MCOperand::createExpr(Exp);
|
||||
EmitToStreamer(*OutStreamer, TmpInst);
|
||||
@ -681,7 +681,7 @@ void PPCAsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
||||
}
|
||||
|
||||
const MCExpr *Exp =
|
||||
MCSymbolRefExpr::Create(MOSymbol, MCSymbolRefExpr::VK_PPC_TOC_LO,
|
||||
MCSymbolRefExpr::create(MOSymbol, MCSymbolRefExpr::VK_PPC_TOC_LO,
|
||||
OutContext);
|
||||
TmpInst.getOperand(1) = MCOperand::createExpr(Exp);
|
||||
EmitToStreamer(*OutStreamer, TmpInst);
|
||||
@ -715,7 +715,7 @@ void PPCAsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
||||
MOSymbol = lookUpOrCreateTOCEntry(MOSymbol);
|
||||
|
||||
const MCExpr *Exp =
|
||||
MCSymbolRefExpr::Create(MOSymbol, MCSymbolRefExpr::VK_PPC_TOC_LO,
|
||||
MCSymbolRefExpr::create(MOSymbol, MCSymbolRefExpr::VK_PPC_TOC_LO,
|
||||
OutContext);
|
||||
TmpInst.getOperand(2) = MCOperand::createExpr(Exp);
|
||||
EmitToStreamer(*OutStreamer, TmpInst);
|
||||
@ -729,7 +729,7 @@ void PPCAsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
||||
const GlobalValue *GValue = MO.getGlobal();
|
||||
MCSymbol *MOSymbol = getSymbol(GValue);
|
||||
const MCExpr *SymGotTprel =
|
||||
MCSymbolRefExpr::Create(MOSymbol, MCSymbolRefExpr::VK_PPC_GOT_TPREL_HA,
|
||||
MCSymbolRefExpr::create(MOSymbol, MCSymbolRefExpr::VK_PPC_GOT_TPREL_HA,
|
||||
OutContext);
|
||||
EmitToStreamer(*OutStreamer, MCInstBuilder(PPC::ADDIS8)
|
||||
.addReg(MI->getOperand(0).getReg())
|
||||
@ -748,7 +748,7 @@ void PPCAsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
||||
const GlobalValue *GValue = MO.getGlobal();
|
||||
MCSymbol *MOSymbol = getSymbol(GValue);
|
||||
const MCExpr *Exp =
|
||||
MCSymbolRefExpr::Create(MOSymbol, MCSymbolRefExpr::VK_PPC_GOT_TPREL_LO,
|
||||
MCSymbolRefExpr::create(MOSymbol, MCSymbolRefExpr::VK_PPC_GOT_TPREL_LO,
|
||||
OutContext);
|
||||
TmpInst.getOperand(1) = MCOperand::createExpr(Exp);
|
||||
EmitToStreamer(*OutStreamer, TmpInst);
|
||||
@ -763,10 +763,10 @@ void PPCAsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
||||
EmitToStreamer(*OutStreamer, MCInstBuilder(PPC::BL)
|
||||
// FIXME: We would like an efficient form for this, so we don't have to do
|
||||
// a lot of extra uniquing.
|
||||
.addExpr(MCSymbolRefExpr::Create(NextInstr, OutContext)));
|
||||
.addExpr(MCSymbolRefExpr::create(NextInstr, OutContext)));
|
||||
const MCExpr *OffsExpr =
|
||||
MCBinaryExpr::CreateSub(MCSymbolRefExpr::Create(GOTSymbol, OutContext),
|
||||
MCSymbolRefExpr::Create(GOTRef, OutContext),
|
||||
MCBinaryExpr::createSub(MCSymbolRefExpr::create(GOTSymbol, OutContext),
|
||||
MCSymbolRefExpr::create(GOTRef, OutContext),
|
||||
OutContext);
|
||||
OutStreamer->EmitLabel(GOTRef);
|
||||
OutStreamer->EmitValue(OffsExpr, 4);
|
||||
@ -786,10 +786,10 @@ void PPCAsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
||||
case PPC::PPC32GOT: {
|
||||
MCSymbol *GOTSymbol = OutContext.getOrCreateSymbol(StringRef("_GLOBAL_OFFSET_TABLE_"));
|
||||
const MCExpr *SymGotTlsL =
|
||||
MCSymbolRefExpr::Create(GOTSymbol, MCSymbolRefExpr::VK_PPC_LO,
|
||||
MCSymbolRefExpr::create(GOTSymbol, MCSymbolRefExpr::VK_PPC_LO,
|
||||
OutContext);
|
||||
const MCExpr *SymGotTlsHA =
|
||||
MCSymbolRefExpr::Create(GOTSymbol, MCSymbolRefExpr::VK_PPC_HA,
|
||||
MCSymbolRefExpr::create(GOTSymbol, MCSymbolRefExpr::VK_PPC_HA,
|
||||
OutContext);
|
||||
EmitToStreamer(*OutStreamer, MCInstBuilder(PPC::LI)
|
||||
.addReg(MI->getOperand(0).getReg())
|
||||
@ -808,7 +808,7 @@ void PPCAsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
||||
const GlobalValue *GValue = MO.getGlobal();
|
||||
MCSymbol *MOSymbol = getSymbol(GValue);
|
||||
const MCExpr *SymGotTlsGD =
|
||||
MCSymbolRefExpr::Create(MOSymbol, MCSymbolRefExpr::VK_PPC_GOT_TLSGD_HA,
|
||||
MCSymbolRefExpr::create(MOSymbol, MCSymbolRefExpr::VK_PPC_GOT_TLSGD_HA,
|
||||
OutContext);
|
||||
EmitToStreamer(*OutStreamer, MCInstBuilder(PPC::ADDIS8)
|
||||
.addReg(MI->getOperand(0).getReg())
|
||||
@ -825,7 +825,7 @@ void PPCAsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
||||
const MachineOperand &MO = MI->getOperand(2);
|
||||
const GlobalValue *GValue = MO.getGlobal();
|
||||
MCSymbol *MOSymbol = getSymbol(GValue);
|
||||
const MCExpr *SymGotTlsGD = MCSymbolRefExpr::Create(
|
||||
const MCExpr *SymGotTlsGD = MCSymbolRefExpr::create(
|
||||
MOSymbol, Subtarget->isPPC64() ? MCSymbolRefExpr::VK_PPC_GOT_TLSGD_LO
|
||||
: MCSymbolRefExpr::VK_PPC_GOT_TLSGD,
|
||||
OutContext);
|
||||
@ -853,7 +853,7 @@ void PPCAsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
||||
const GlobalValue *GValue = MO.getGlobal();
|
||||
MCSymbol *MOSymbol = getSymbol(GValue);
|
||||
const MCExpr *SymGotTlsLD =
|
||||
MCSymbolRefExpr::Create(MOSymbol, MCSymbolRefExpr::VK_PPC_GOT_TLSLD_HA,
|
||||
MCSymbolRefExpr::create(MOSymbol, MCSymbolRefExpr::VK_PPC_GOT_TLSLD_HA,
|
||||
OutContext);
|
||||
EmitToStreamer(*OutStreamer, MCInstBuilder(PPC::ADDIS8)
|
||||
.addReg(MI->getOperand(0).getReg())
|
||||
@ -870,7 +870,7 @@ void PPCAsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
||||
const MachineOperand &MO = MI->getOperand(2);
|
||||
const GlobalValue *GValue = MO.getGlobal();
|
||||
MCSymbol *MOSymbol = getSymbol(GValue);
|
||||
const MCExpr *SymGotTlsLD = MCSymbolRefExpr::Create(
|
||||
const MCExpr *SymGotTlsLD = MCSymbolRefExpr::create(
|
||||
MOSymbol, Subtarget->isPPC64() ? MCSymbolRefExpr::VK_PPC_GOT_TLSLD_LO
|
||||
: MCSymbolRefExpr::VK_PPC_GOT_TLSLD,
|
||||
OutContext);
|
||||
@ -900,7 +900,7 @@ void PPCAsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
||||
const GlobalValue *GValue = MO.getGlobal();
|
||||
MCSymbol *MOSymbol = getSymbol(GValue);
|
||||
const MCExpr *SymDtprel =
|
||||
MCSymbolRefExpr::Create(MOSymbol, MCSymbolRefExpr::VK_PPC_DTPREL_HA,
|
||||
MCSymbolRefExpr::create(MOSymbol, MCSymbolRefExpr::VK_PPC_DTPREL_HA,
|
||||
OutContext);
|
||||
EmitToStreamer(
|
||||
*OutStreamer,
|
||||
@ -920,7 +920,7 @@ void PPCAsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
||||
const GlobalValue *GValue = MO.getGlobal();
|
||||
MCSymbol *MOSymbol = getSymbol(GValue);
|
||||
const MCExpr *SymDtprel =
|
||||
MCSymbolRefExpr::Create(MOSymbol, MCSymbolRefExpr::VK_PPC_DTPREL_LO,
|
||||
MCSymbolRefExpr::create(MOSymbol, MCSymbolRefExpr::VK_PPC_DTPREL_LO,
|
||||
OutContext);
|
||||
EmitToStreamer(*OutStreamer,
|
||||
MCInstBuilder(Subtarget->isPPC64() ? PPC::ADDI8 : PPC::ADDI)
|
||||
@ -1012,8 +1012,8 @@ void PPCLinuxAsmPrinter::EmitStartOfAsmFile(Module &M) {
|
||||
// The GOT pointer points to the middle of the GOT, in order to reference the
|
||||
// entire 64kB range. 0x8000 is the midpoint.
|
||||
const MCExpr *tocExpr =
|
||||
MCBinaryExpr::CreateAdd(MCSymbolRefExpr::Create(CurrentPos, OutContext),
|
||||
MCConstantExpr::Create(0x8000, OutContext),
|
||||
MCBinaryExpr::createAdd(MCSymbolRefExpr::create(CurrentPos, OutContext),
|
||||
MCConstantExpr::create(0x8000, OutContext),
|
||||
OutContext);
|
||||
|
||||
OutStreamer->EmitAssignment(TOCSym, tocExpr);
|
||||
@ -1036,10 +1036,10 @@ void PPCLinuxAsmPrinter::EmitFunctionEntryLabel() {
|
||||
OutStreamer->EmitLabel(RelocSymbol);
|
||||
|
||||
const MCExpr *OffsExpr =
|
||||
MCBinaryExpr::CreateSub(
|
||||
MCSymbolRefExpr::Create(OutContext.getOrCreateSymbol(Twine(".LTOC")),
|
||||
MCBinaryExpr::createSub(
|
||||
MCSymbolRefExpr::create(OutContext.getOrCreateSymbol(Twine(".LTOC")),
|
||||
OutContext),
|
||||
MCSymbolRefExpr::Create(PICBase, OutContext),
|
||||
MCSymbolRefExpr::create(PICBase, OutContext),
|
||||
OutContext);
|
||||
OutStreamer->EmitValue(OffsExpr, 4);
|
||||
OutStreamer->EmitLabel(CurrentFnSym);
|
||||
@ -1062,12 +1062,12 @@ void PPCLinuxAsmPrinter::EmitFunctionEntryLabel() {
|
||||
MCSymbol *Symbol1 = CurrentFnSymForSize;
|
||||
// Generates a R_PPC64_ADDR64 (from FK_DATA_8) relocation for the function
|
||||
// entry point.
|
||||
OutStreamer->EmitValue(MCSymbolRefExpr::Create(Symbol1, OutContext),
|
||||
OutStreamer->EmitValue(MCSymbolRefExpr::create(Symbol1, OutContext),
|
||||
8 /*size*/);
|
||||
MCSymbol *Symbol2 = OutContext.getOrCreateSymbol(StringRef(".TOC."));
|
||||
// Generates a R_PPC64_TOC relocation for TOC base insertion.
|
||||
OutStreamer->EmitValue(
|
||||
MCSymbolRefExpr::Create(Symbol2, MCSymbolRefExpr::VK_PPC_TOCBASE, OutContext),
|
||||
MCSymbolRefExpr::create(Symbol2, MCSymbolRefExpr::VK_PPC_TOCBASE, OutContext),
|
||||
8/*size*/);
|
||||
// Emit a null environment pointer.
|
||||
OutStreamer->EmitIntValue(0, 8 /* size */);
|
||||
@ -1133,22 +1133,22 @@ void PPCLinuxAsmPrinter::EmitFunctionBodyStart() {
|
||||
MCSymbol *GlobalEntryLabel = OutContext.createTempSymbol();
|
||||
OutStreamer->EmitLabel(GlobalEntryLabel);
|
||||
const MCSymbolRefExpr *GlobalEntryLabelExp =
|
||||
MCSymbolRefExpr::Create(GlobalEntryLabel, OutContext);
|
||||
MCSymbolRefExpr::create(GlobalEntryLabel, OutContext);
|
||||
|
||||
MCSymbol *TOCSymbol = OutContext.getOrCreateSymbol(StringRef(".TOC."));
|
||||
const MCExpr *TOCDeltaExpr =
|
||||
MCBinaryExpr::CreateSub(MCSymbolRefExpr::Create(TOCSymbol, OutContext),
|
||||
MCBinaryExpr::createSub(MCSymbolRefExpr::create(TOCSymbol, OutContext),
|
||||
GlobalEntryLabelExp, OutContext);
|
||||
|
||||
const MCExpr *TOCDeltaHi =
|
||||
PPCMCExpr::CreateHa(TOCDeltaExpr, false, OutContext);
|
||||
PPCMCExpr::createHa(TOCDeltaExpr, false, OutContext);
|
||||
EmitToStreamer(*OutStreamer, MCInstBuilder(PPC::ADDIS)
|
||||
.addReg(PPC::X2)
|
||||
.addReg(PPC::X12)
|
||||
.addExpr(TOCDeltaHi));
|
||||
|
||||
const MCExpr *TOCDeltaLo =
|
||||
PPCMCExpr::CreateLo(TOCDeltaExpr, false, OutContext);
|
||||
PPCMCExpr::createLo(TOCDeltaExpr, false, OutContext);
|
||||
EmitToStreamer(*OutStreamer, MCInstBuilder(PPC::ADDI)
|
||||
.addReg(PPC::X2)
|
||||
.addReg(PPC::X2)
|
||||
@ -1157,9 +1157,9 @@ void PPCLinuxAsmPrinter::EmitFunctionBodyStart() {
|
||||
MCSymbol *LocalEntryLabel = OutContext.createTempSymbol();
|
||||
OutStreamer->EmitLabel(LocalEntryLabel);
|
||||
const MCSymbolRefExpr *LocalEntryLabelExp =
|
||||
MCSymbolRefExpr::Create(LocalEntryLabel, OutContext);
|
||||
MCSymbolRefExpr::create(LocalEntryLabel, OutContext);
|
||||
const MCExpr *LocalOffsetExp =
|
||||
MCBinaryExpr::CreateSub(LocalEntryLabelExp,
|
||||
MCBinaryExpr::createSub(LocalEntryLabelExp,
|
||||
GlobalEntryLabelExp, OutContext);
|
||||
|
||||
PPCTargetStreamer *TS =
|
||||
@ -1305,10 +1305,10 @@ EmitFunctionStubs(const MachineModuleInfoMachO::SymbolListTy &Stubs) {
|
||||
OutStreamer->EmitLabel(Stub);
|
||||
OutStreamer->EmitSymbolAttribute(RawSym, MCSA_IndirectSymbol);
|
||||
|
||||
const MCExpr *Anon = MCSymbolRefExpr::Create(AnonSymbol, OutContext);
|
||||
const MCExpr *LazyPtrExpr = MCSymbolRefExpr::Create(LazyPtr, OutContext);
|
||||
const MCExpr *Anon = MCSymbolRefExpr::create(AnonSymbol, OutContext);
|
||||
const MCExpr *LazyPtrExpr = MCSymbolRefExpr::create(LazyPtr, OutContext);
|
||||
const MCExpr *Sub =
|
||||
MCBinaryExpr::CreateSub(LazyPtrExpr, Anon, OutContext);
|
||||
MCBinaryExpr::createSub(LazyPtrExpr, Anon, OutContext);
|
||||
|
||||
// mflr r0
|
||||
EmitToStreamer(*OutStreamer, MCInstBuilder(PPC::MFLR).addReg(PPC::R0));
|
||||
@ -1318,7 +1318,7 @@ EmitFunctionStubs(const MachineModuleInfoMachO::SymbolListTy &Stubs) {
|
||||
// mflr r11
|
||||
EmitToStreamer(*OutStreamer, MCInstBuilder(PPC::MFLR).addReg(PPC::R11));
|
||||
// addis r11, r11, ha16(LazyPtr - AnonSymbol)
|
||||
const MCExpr *SubHa16 = PPCMCExpr::CreateHa(Sub, true, OutContext);
|
||||
const MCExpr *SubHa16 = PPCMCExpr::createHa(Sub, true, OutContext);
|
||||
EmitToStreamer(*OutStreamer, MCInstBuilder(PPC::ADDIS)
|
||||
.addReg(PPC::R11)
|
||||
.addReg(PPC::R11)
|
||||
@ -1328,7 +1328,7 @@ EmitFunctionStubs(const MachineModuleInfoMachO::SymbolListTy &Stubs) {
|
||||
|
||||
// ldu r12, lo16(LazyPtr - AnonSymbol)(r11)
|
||||
// lwzu r12, lo16(LazyPtr - AnonSymbol)(r11)
|
||||
const MCExpr *SubLo16 = PPCMCExpr::CreateLo(Sub, true, OutContext);
|
||||
const MCExpr *SubLo16 = PPCMCExpr::createLo(Sub, true, OutContext);
|
||||
EmitToStreamer(*OutStreamer, MCInstBuilder(isPPC64 ? PPC::LDU : PPC::LWZU)
|
||||
.addReg(PPC::R12)
|
||||
.addExpr(SubLo16).addExpr(SubLo16)
|
||||
@ -1364,7 +1364,7 @@ EmitFunctionStubs(const MachineModuleInfoMachO::SymbolListTy &Stubs) {
|
||||
MCSymbol *Stub = Stubs[i].first;
|
||||
MCSymbol *RawSym = Stubs[i].second.getPointer();
|
||||
MCSymbol *LazyPtr = GetLazyPtr(Stub, OutContext);
|
||||
const MCExpr *LazyPtrExpr = MCSymbolRefExpr::Create(LazyPtr, OutContext);
|
||||
const MCExpr *LazyPtrExpr = MCSymbolRefExpr::create(LazyPtr, OutContext);
|
||||
|
||||
OutStreamer->SwitchSection(StubSection);
|
||||
EmitAlignment(4);
|
||||
@ -1373,7 +1373,7 @@ EmitFunctionStubs(const MachineModuleInfoMachO::SymbolListTy &Stubs) {
|
||||
|
||||
// lis r11, ha16(LazyPtr)
|
||||
const MCExpr *LazyPtrHa16 =
|
||||
PPCMCExpr::CreateHa(LazyPtrExpr, true, OutContext);
|
||||
PPCMCExpr::createHa(LazyPtrExpr, true, OutContext);
|
||||
EmitToStreamer(*OutStreamer, MCInstBuilder(PPC::LIS)
|
||||
.addReg(PPC::R11)
|
||||
.addExpr(LazyPtrHa16));
|
||||
@ -1381,7 +1381,7 @@ EmitFunctionStubs(const MachineModuleInfoMachO::SymbolListTy &Stubs) {
|
||||
// ldu r12, lo16(LazyPtr)(r11)
|
||||
// lwzu r12, lo16(LazyPtr)(r11)
|
||||
const MCExpr *LazyPtrLo16 =
|
||||
PPCMCExpr::CreateLo(LazyPtrExpr, true, OutContext);
|
||||
PPCMCExpr::createLo(LazyPtrExpr, true, OutContext);
|
||||
EmitToStreamer(*OutStreamer, MCInstBuilder(isPPC64 ? PPC::LDU : PPC::LWZU)
|
||||
.addReg(PPC::R12)
|
||||
.addExpr(LazyPtrLo16).addExpr(LazyPtrLo16)
|
||||
@ -1465,7 +1465,7 @@ bool PPCDarwinAsmPrinter::doFinalization(Module &M) {
|
||||
// need to be indirect and pc-rel. We accomplish this by using NLPs.
|
||||
// However, sometimes the types are local to the file. So we need to
|
||||
// fill in the value for the NLP in those cases.
|
||||
OutStreamer->EmitValue(MCSymbolRefExpr::Create(MCSym.getPointer(),
|
||||
OutStreamer->EmitValue(MCSymbolRefExpr::create(MCSym.getPointer(),
|
||||
OutContext),
|
||||
isPPC64 ? 8 : 4/*size*/);
|
||||
}
|
||||
@ -1484,7 +1484,7 @@ bool PPCDarwinAsmPrinter::doFinalization(Module &M) {
|
||||
OutStreamer->EmitLabel(Stubs[i].first);
|
||||
// .long _foo
|
||||
OutStreamer->EmitValue(MCSymbolRefExpr::
|
||||
Create(Stubs[i].second.getPointer(),
|
||||
create(Stubs[i].second.getPointer(),
|
||||
OutContext),
|
||||
isPPC64 ? 8 : 4/*size*/);
|
||||
}
|
||||
|
@ -142,28 +142,28 @@ static MCOperand GetSymbolRef(const MachineOperand &MO, const MCSymbol *Symbol,
|
||||
if (MO.getTargetFlags() == PPCII::MO_PLT_OR_STUB && !isDarwin)
|
||||
RefKind = MCSymbolRefExpr::VK_PLT;
|
||||
|
||||
const MCExpr *Expr = MCSymbolRefExpr::Create(Symbol, RefKind, Ctx);
|
||||
const MCExpr *Expr = MCSymbolRefExpr::create(Symbol, RefKind, Ctx);
|
||||
|
||||
if (!MO.isJTI() && MO.getOffset())
|
||||
Expr = MCBinaryExpr::CreateAdd(Expr,
|
||||
MCConstantExpr::Create(MO.getOffset(), Ctx),
|
||||
Expr = MCBinaryExpr::createAdd(Expr,
|
||||
MCConstantExpr::create(MO.getOffset(), Ctx),
|
||||
Ctx);
|
||||
|
||||
// Subtract off the PIC base if required.
|
||||
if (MO.getTargetFlags() & PPCII::MO_PIC_FLAG) {
|
||||
const MachineFunction *MF = MO.getParent()->getParent()->getParent();
|
||||
|
||||
const MCExpr *PB = MCSymbolRefExpr::Create(MF->getPICBaseSymbol(), Ctx);
|
||||
Expr = MCBinaryExpr::CreateSub(Expr, PB, Ctx);
|
||||
const MCExpr *PB = MCSymbolRefExpr::create(MF->getPICBaseSymbol(), Ctx);
|
||||
Expr = MCBinaryExpr::createSub(Expr, PB, Ctx);
|
||||
}
|
||||
|
||||
// Add ha16() / lo16() markers if required.
|
||||
switch (access) {
|
||||
case PPCII::MO_LO:
|
||||
Expr = PPCMCExpr::CreateLo(Expr, isDarwin, Ctx);
|
||||
Expr = PPCMCExpr::createLo(Expr, isDarwin, Ctx);
|
||||
break;
|
||||
case PPCII::MO_HA:
|
||||
Expr = PPCMCExpr::CreateHa(Expr, isDarwin, Ctx);
|
||||
Expr = PPCMCExpr::createHa(Expr, isDarwin, Ctx);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -193,7 +193,7 @@ void llvm::LowerPPCMachineInstrToMCInst(const MachineInstr *MI, MCInst &OutMI,
|
||||
MCOp = MCOperand::createImm(MO.getImm());
|
||||
break;
|
||||
case MachineOperand::MO_MachineBasicBlock:
|
||||
MCOp = MCOperand::createExpr(MCSymbolRefExpr::Create(
|
||||
MCOp = MCOperand::createExpr(MCSymbolRefExpr::create(
|
||||
MO.getMBB()->getSymbol(), AP.OutContext));
|
||||
break;
|
||||
case MachineOperand::MO_GlobalAddress:
|
||||
|
@ -55,9 +55,9 @@ MCSection *PPC64LinuxTargetObjectFile::SelectSectionForGlobal(
|
||||
const MCExpr *PPC64LinuxTargetObjectFile::
|
||||
getDebugThreadLocalSymbol(const MCSymbol *Sym) const {
|
||||
const MCExpr *Expr =
|
||||
MCSymbolRefExpr::Create(Sym, MCSymbolRefExpr::VK_PPC_DTPREL, getContext());
|
||||
return MCBinaryExpr::CreateAdd(Expr,
|
||||
MCConstantExpr::Create(0x8000, getContext()),
|
||||
MCSymbolRefExpr::create(Sym, MCSymbolRefExpr::VK_PPC_DTPREL, getContext());
|
||||
return MCBinaryExpr::createAdd(Expr,
|
||||
MCConstantExpr::create(0x8000, getContext()),
|
||||
getContext());
|
||||
}
|
||||
|
||||
|
@ -64,25 +64,25 @@ void AMDGPUMCInstLower::lower(const MachineInstr *MI, MCInst &OutMI) const {
|
||||
MCOp = MCOperand::createReg(MO.getReg());
|
||||
break;
|
||||
case MachineOperand::MO_MachineBasicBlock:
|
||||
MCOp = MCOperand::createExpr(MCSymbolRefExpr::Create(
|
||||
MCOp = MCOperand::createExpr(MCSymbolRefExpr::create(
|
||||
MO.getMBB()->getSymbol(), Ctx));
|
||||
break;
|
||||
case MachineOperand::MO_GlobalAddress: {
|
||||
const GlobalValue *GV = MO.getGlobal();
|
||||
MCSymbol *Sym = Ctx.getOrCreateSymbol(StringRef(GV->getName()));
|
||||
MCOp = MCOperand::createExpr(MCSymbolRefExpr::Create(Sym, Ctx));
|
||||
MCOp = MCOperand::createExpr(MCSymbolRefExpr::create(Sym, Ctx));
|
||||
break;
|
||||
}
|
||||
case MachineOperand::MO_TargetIndex: {
|
||||
assert(MO.getIndex() == AMDGPU::TI_CONSTDATA_START);
|
||||
MCSymbol *Sym = Ctx.getOrCreateSymbol(StringRef(END_OF_TEXT_LABEL_NAME));
|
||||
const MCSymbolRefExpr *Expr = MCSymbolRefExpr::Create(Sym, Ctx);
|
||||
const MCSymbolRefExpr *Expr = MCSymbolRefExpr::create(Sym, Ctx);
|
||||
MCOp = MCOperand::createExpr(Expr);
|
||||
break;
|
||||
}
|
||||
case MachineOperand::MO_ExternalSymbol: {
|
||||
MCSymbol *Sym = Ctx.getOrCreateSymbol(StringRef(MO.getSymbolName()));
|
||||
const MCSymbolRefExpr *Expr = MCSymbolRefExpr::Create(Sym, Ctx);
|
||||
const MCSymbolRefExpr *Expr = MCSymbolRefExpr::create(Sym, Ctx);
|
||||
MCOp = MCOperand::createExpr(Expr);
|
||||
break;
|
||||
}
|
||||
|
@ -1084,7 +1084,7 @@ AMDGPUAsmParser::parseSOppBrTarget(OperandVector &Operands) {
|
||||
|
||||
case AsmToken::Identifier:
|
||||
Operands.push_back(AMDGPUOperand::CreateExpr(
|
||||
MCSymbolRefExpr::Create(getContext().getOrCreateSymbol(
|
||||
MCSymbolRefExpr::create(getContext().getOrCreateSymbol(
|
||||
Parser.getTok().getString()), getContext()), S));
|
||||
Parser.Lex();
|
||||
return MatchOperand_Success;
|
||||
|
@ -408,7 +408,7 @@ void SparcAsmParser::expandSET(MCInst &Inst, SMLoc IDLoc,
|
||||
uint64_t ImmValue = IsImm ? MCValOp.getImm() : 0;
|
||||
const MCExpr *ValExpr;
|
||||
if (IsImm)
|
||||
ValExpr = MCConstantExpr::Create(ImmValue, getContext());
|
||||
ValExpr = MCConstantExpr::create(ImmValue, getContext());
|
||||
else
|
||||
ValExpr = MCValOp.getExpr();
|
||||
|
||||
@ -417,7 +417,7 @@ void SparcAsmParser::expandSET(MCInst &Inst, SMLoc IDLoc,
|
||||
if (!IsImm || (ImmValue & ~0x1fff)) {
|
||||
MCInst TmpInst;
|
||||
const MCExpr *Expr =
|
||||
SparcMCExpr::Create(SparcMCExpr::VK_Sparc_HI, ValExpr, getContext());
|
||||
SparcMCExpr::create(SparcMCExpr::VK_Sparc_HI, ValExpr, getContext());
|
||||
TmpInst.setLoc(IDLoc);
|
||||
TmpInst.setOpcode(SP::SETHIi);
|
||||
TmpInst.addOperand(MCRegOp);
|
||||
@ -429,7 +429,7 @@ void SparcAsmParser::expandSET(MCInst &Inst, SMLoc IDLoc,
|
||||
if (!IsImm || ((ImmValue & 0x1fff) != 0 || ImmValue == 0)) {
|
||||
MCInst TmpInst;
|
||||
const MCExpr *Expr =
|
||||
SparcMCExpr::Create(SparcMCExpr::VK_Sparc_LO, ValExpr, getContext());
|
||||
SparcMCExpr::create(SparcMCExpr::VK_Sparc_LO, ValExpr, getContext());
|
||||
TmpInst.setLoc(IDLoc);
|
||||
TmpInst.setOpcode(SP::ORri);
|
||||
TmpInst.addOperand(MCRegOp);
|
||||
@ -774,11 +774,11 @@ SparcAsmParser::parseSparcAsmOperand(std::unique_ptr<SparcOperand> &Op,
|
||||
E = SMLoc::getFromPointer(Parser.getTok().getLoc().getPointer() - 1);
|
||||
MCSymbol *Sym = getContext().getOrCreateSymbol(Identifier);
|
||||
|
||||
const MCExpr *Res = MCSymbolRefExpr::Create(Sym, MCSymbolRefExpr::VK_None,
|
||||
const MCExpr *Res = MCSymbolRefExpr::create(Sym, MCSymbolRefExpr::VK_None,
|
||||
getContext());
|
||||
if (isCall &&
|
||||
getContext().getObjectFileInfo()->getRelocM() == Reloc::PIC_)
|
||||
Res = SparcMCExpr::Create(SparcMCExpr::VK_Sparc_WPLT30, Res,
|
||||
Res = SparcMCExpr::create(SparcMCExpr::VK_Sparc_WPLT30, Res,
|
||||
getContext());
|
||||
Op = SparcOperand::CreateImm(Res, S, E);
|
||||
}
|
||||
@ -1010,7 +1010,7 @@ bool SparcAsmParser::matchSparcAsmModifiers(const MCExpr *&EVal,
|
||||
break;
|
||||
}
|
||||
|
||||
EVal = SparcMCExpr::Create(VK, subExpr, getContext());
|
||||
EVal = SparcMCExpr::create(VK, subExpr, getContext());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -51,8 +51,8 @@ SparcELFMCAsmInfo::getExprForPersonalitySymbol(const MCSymbol *Sym,
|
||||
MCStreamer &Streamer) const {
|
||||
if (Encoding & dwarf::DW_EH_PE_pcrel) {
|
||||
MCContext &Ctx = Streamer.getContext();
|
||||
return SparcMCExpr::Create(SparcMCExpr::VK_Sparc_R_DISP32,
|
||||
MCSymbolRefExpr::Create(Sym, Ctx), Ctx);
|
||||
return SparcMCExpr::create(SparcMCExpr::VK_Sparc_R_DISP32,
|
||||
MCSymbolRefExpr::create(Sym, Ctx), Ctx);
|
||||
}
|
||||
|
||||
return MCAsmInfo::getExprForPersonalitySymbol(Sym, Encoding, Streamer);
|
||||
@ -64,8 +64,8 @@ SparcELFMCAsmInfo::getExprForFDESymbol(const MCSymbol *Sym,
|
||||
MCStreamer &Streamer) const {
|
||||
if (Encoding & dwarf::DW_EH_PE_pcrel) {
|
||||
MCContext &Ctx = Streamer.getContext();
|
||||
return SparcMCExpr::Create(SparcMCExpr::VK_Sparc_R_DISP32,
|
||||
MCSymbolRefExpr::Create(Sym, Ctx), Ctx);
|
||||
return SparcMCExpr::create(SparcMCExpr::VK_Sparc_R_DISP32,
|
||||
MCSymbolRefExpr::create(Sym, Ctx), Ctx);
|
||||
}
|
||||
return MCAsmInfo::getExprForFDESymbol(Sym, Encoding, Streamer);
|
||||
}
|
||||
|
@ -137,7 +137,7 @@ getMachineOpValue(const MCInst &MI, const MCOperand &MO,
|
||||
}
|
||||
|
||||
int64_t Res;
|
||||
if (Expr->EvaluateAsAbsolute(Res))
|
||||
if (Expr->evaluateAsAbsolute(Res))
|
||||
return Res;
|
||||
|
||||
llvm_unreachable("Unhandled expression!");
|
||||
|
@ -26,14 +26,14 @@ using namespace llvm;
|
||||
#define DEBUG_TYPE "sparcmcexpr"
|
||||
|
||||
const SparcMCExpr*
|
||||
SparcMCExpr::Create(VariantKind Kind, const MCExpr *Expr,
|
||||
SparcMCExpr::create(VariantKind Kind, const MCExpr *Expr,
|
||||
MCContext &Ctx) {
|
||||
return new (Ctx) SparcMCExpr(Kind, Expr);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SparcMCExpr::PrintImpl(raw_ostream &OS) const
|
||||
void SparcMCExpr::printImpl(raw_ostream &OS) const
|
||||
{
|
||||
|
||||
bool closeParen = printVariantKind(OS, Kind);
|
||||
@ -160,10 +160,10 @@ Sparc::Fixups SparcMCExpr::getFixupKind(SparcMCExpr::VariantKind Kind) {
|
||||
}
|
||||
|
||||
bool
|
||||
SparcMCExpr::EvaluateAsRelocatableImpl(MCValue &Res,
|
||||
SparcMCExpr::evaluateAsRelocatableImpl(MCValue &Res,
|
||||
const MCAsmLayout *Layout,
|
||||
const MCFixup *Fixup) const {
|
||||
return getSubExpr()->EvaluateAsRelocatable(Res, Layout, Fixup);
|
||||
return getSubExpr()->evaluateAsRelocatable(Res, Layout, Fixup);
|
||||
}
|
||||
|
||||
static void fixELFSymbolsInTLSFixupsImpl(const MCExpr *Expr, MCAssembler &Asm) {
|
||||
|
@ -69,7 +69,7 @@ public:
|
||||
/// @name Construction
|
||||
/// @{
|
||||
|
||||
static const SparcMCExpr *Create(VariantKind Kind, const MCExpr *Expr,
|
||||
static const SparcMCExpr *create(VariantKind Kind, const MCExpr *Expr,
|
||||
MCContext &Ctx);
|
||||
/// @}
|
||||
/// @name Accessors
|
||||
@ -85,13 +85,13 @@ public:
|
||||
Sparc::Fixups getFixupKind() const { return getFixupKind(Kind); }
|
||||
|
||||
/// @}
|
||||
void PrintImpl(raw_ostream &OS) const override;
|
||||
bool EvaluateAsRelocatableImpl(MCValue &Res,
|
||||
void printImpl(raw_ostream &OS) const override;
|
||||
bool evaluateAsRelocatableImpl(MCValue &Res,
|
||||
const MCAsmLayout *Layout,
|
||||
const MCFixup *Fixup) const override;
|
||||
void visitUsedExpr(MCStreamer &Streamer) const override;
|
||||
MCSection *FindAssociatedSection() const override {
|
||||
return getSubExpr()->FindAssociatedSection();
|
||||
MCSection *findAssociatedSection() const override {
|
||||
return getSubExpr()->findAssociatedSection();
|
||||
}
|
||||
|
||||
void fixELFSymbolsInTLSFixups(MCAssembler &Asm) const override;
|
||||
|
@ -78,9 +78,9 @@ namespace {
|
||||
|
||||
static MCOperand createSparcMCOperand(SparcMCExpr::VariantKind Kind,
|
||||
MCSymbol *Sym, MCContext &OutContext) {
|
||||
const MCSymbolRefExpr *MCSym = MCSymbolRefExpr::Create(Sym,
|
||||
const MCSymbolRefExpr *MCSym = MCSymbolRefExpr::create(Sym,
|
||||
OutContext);
|
||||
const SparcMCExpr *expr = SparcMCExpr::Create(Kind, MCSym, OutContext);
|
||||
const SparcMCExpr *expr = SparcMCExpr::create(Kind, MCSym, OutContext);
|
||||
return MCOperand::createExpr(expr);
|
||||
|
||||
}
|
||||
@ -94,15 +94,15 @@ static MCOperand createPCXRelExprOp(SparcMCExpr::VariantKind Kind,
|
||||
MCSymbol *CurLabel,
|
||||
MCContext &OutContext)
|
||||
{
|
||||
const MCSymbolRefExpr *GOT = MCSymbolRefExpr::Create(GOTLabel, OutContext);
|
||||
const MCSymbolRefExpr *Start = MCSymbolRefExpr::Create(StartLabel,
|
||||
const MCSymbolRefExpr *GOT = MCSymbolRefExpr::create(GOTLabel, OutContext);
|
||||
const MCSymbolRefExpr *Start = MCSymbolRefExpr::create(StartLabel,
|
||||
OutContext);
|
||||
const MCSymbolRefExpr *Cur = MCSymbolRefExpr::Create(CurLabel,
|
||||
const MCSymbolRefExpr *Cur = MCSymbolRefExpr::create(CurLabel,
|
||||
OutContext);
|
||||
|
||||
const MCBinaryExpr *Sub = MCBinaryExpr::CreateSub(Cur, Start, OutContext);
|
||||
const MCBinaryExpr *Add = MCBinaryExpr::CreateAdd(GOT, Sub, OutContext);
|
||||
const SparcMCExpr *expr = SparcMCExpr::Create(Kind,
|
||||
const MCBinaryExpr *Sub = MCBinaryExpr::createSub(Cur, Start, OutContext);
|
||||
const MCBinaryExpr *Add = MCBinaryExpr::createAdd(GOT, Sub, OutContext);
|
||||
const SparcMCExpr *expr = SparcMCExpr::create(Kind,
|
||||
Add, OutContext);
|
||||
return MCOperand::createExpr(expr);
|
||||
}
|
||||
@ -199,7 +199,7 @@ void SparcAsmPrinter::LowerGETPCXAndEmitMCInsts(const MachineInstr *MI,
|
||||
EmitHiLo(*OutStreamer, GOTLabel,
|
||||
SparcMCExpr::VK_Sparc_H44, SparcMCExpr::VK_Sparc_M44,
|
||||
MCRegOP, OutContext, STI);
|
||||
MCOperand imm = MCOperand::createExpr(MCConstantExpr::Create(12,
|
||||
MCOperand imm = MCOperand::createExpr(MCConstantExpr::create(12,
|
||||
OutContext));
|
||||
EmitSHL(*OutStreamer, MCRegOP, imm, MCRegOP, STI);
|
||||
MCOperand lo = createSparcMCOperand(SparcMCExpr::VK_Sparc_L44,
|
||||
@ -211,7 +211,7 @@ void SparcAsmPrinter::LowerGETPCXAndEmitMCInsts(const MachineInstr *MI,
|
||||
EmitHiLo(*OutStreamer, GOTLabel,
|
||||
SparcMCExpr::VK_Sparc_HH, SparcMCExpr::VK_Sparc_HM,
|
||||
MCRegOP, OutContext, STI);
|
||||
MCOperand imm = MCOperand::createExpr(MCConstantExpr::Create(32,
|
||||
MCOperand imm = MCOperand::createExpr(MCConstantExpr::create(32,
|
||||
OutContext));
|
||||
EmitSHL(*OutStreamer, MCRegOP, imm, MCRegOP, STI);
|
||||
// Use register %o7 to load the lower 32 bits.
|
||||
|
@ -59,9 +59,9 @@ static MCOperand LowerSymbolOperand(const MachineInstr *MI,
|
||||
break;
|
||||
}
|
||||
|
||||
const MCSymbolRefExpr *MCSym = MCSymbolRefExpr::Create(Symbol,
|
||||
const MCSymbolRefExpr *MCSym = MCSymbolRefExpr::create(Symbol,
|
||||
AP.OutContext);
|
||||
const SparcMCExpr *expr = SparcMCExpr::Create(Kind, MCSym,
|
||||
const SparcMCExpr *expr = SparcMCExpr::create(Kind, MCSym,
|
||||
AP.OutContext);
|
||||
return MCOperand::createExpr(expr);
|
||||
}
|
||||
|
@ -34,8 +34,8 @@ const MCExpr *SparcELFTargetObjectFile::getTTypeGlobalReference(
|
||||
}
|
||||
|
||||
MCContext &Ctx = getContext();
|
||||
return SparcMCExpr::Create(SparcMCExpr::VK_Sparc_R_DISP32,
|
||||
MCSymbolRefExpr::Create(SSym, Ctx), Ctx);
|
||||
return SparcMCExpr::create(SparcMCExpr::VK_Sparc_R_DISP32,
|
||||
MCSymbolRefExpr::create(SSym, Ctx), Ctx);
|
||||
}
|
||||
|
||||
return TargetLoweringObjectFileELF::getTTypeGlobalReference(
|
||||
|
@ -865,9 +865,9 @@ SystemZAsmParser::parsePCRel(OperandVector &Operands, int64_t MinVal,
|
||||
}
|
||||
MCSymbol *Sym = Ctx.createTempSymbol();
|
||||
Out.EmitLabel(Sym);
|
||||
const MCExpr *Base = MCSymbolRefExpr::Create(Sym, MCSymbolRefExpr::VK_None,
|
||||
const MCExpr *Base = MCSymbolRefExpr::create(Sym, MCSymbolRefExpr::VK_None,
|
||||
Ctx);
|
||||
Expr = Value == 0 ? Base : MCBinaryExpr::CreateAdd(Base, Expr, Ctx);
|
||||
Expr = Value == 0 ? Base : MCBinaryExpr::createAdd(Base, Expr, Ctx);
|
||||
}
|
||||
|
||||
// Optionally match :tls_gdcall: or :tls_ldcall: followed by a TLS symbol.
|
||||
@ -904,7 +904,7 @@ SystemZAsmParser::parsePCRel(OperandVector &Operands, int64_t MinVal,
|
||||
}
|
||||
|
||||
StringRef Identifier = Parser.getTok().getString();
|
||||
Sym = MCSymbolRefExpr::Create(Ctx.getOrCreateSymbol(Identifier),
|
||||
Sym = MCSymbolRefExpr::create(Ctx.getOrCreateSymbol(Identifier),
|
||||
Kind, Ctx);
|
||||
Parser.Lex();
|
||||
}
|
||||
|
@ -217,7 +217,7 @@ SystemZMCCodeEmitter::getPCRelEncoding(const MCInst &MI, unsigned OpNum,
|
||||
const MCOperand &MO = MI.getOperand(OpNum);
|
||||
const MCExpr *Expr;
|
||||
if (MO.isImm())
|
||||
Expr = MCConstantExpr::Create(MO.getImm() + Offset, Ctx);
|
||||
Expr = MCConstantExpr::create(MO.getImm() + Offset, Ctx);
|
||||
else {
|
||||
Expr = MO.getExpr();
|
||||
if (Offset) {
|
||||
@ -225,8 +225,8 @@ SystemZMCCodeEmitter::getPCRelEncoding(const MCInst &MI, unsigned OpNum,
|
||||
// is relative to the operand field itself, which is Offset bytes
|
||||
// into MI. Add Offset to the relocation value to cancel out
|
||||
// this difference.
|
||||
const MCExpr *OffsetExpr = MCConstantExpr::Create(Offset, Ctx);
|
||||
Expr = MCBinaryExpr::CreateAdd(Expr, OffsetExpr, Ctx);
|
||||
const MCExpr *OffsetExpr = MCConstantExpr::create(Offset, Ctx);
|
||||
Expr = MCBinaryExpr::createAdd(Expr, OffsetExpr, Ctx);
|
||||
}
|
||||
}
|
||||
Fixups.push_back(MCFixup::create(Offset, Expr, (MCFixupKind)Kind));
|
||||
|
@ -68,14 +68,14 @@ static MCInst lowerRIEfLow(const MachineInstr *MI, unsigned Opcode) {
|
||||
|
||||
static const MCSymbolRefExpr *getTLSGetOffset(MCContext &Context) {
|
||||
StringRef Name = "__tls_get_offset";
|
||||
return MCSymbolRefExpr::Create(Context.getOrCreateSymbol(Name),
|
||||
return MCSymbolRefExpr::create(Context.getOrCreateSymbol(Name),
|
||||
MCSymbolRefExpr::VK_PLT,
|
||||
Context);
|
||||
}
|
||||
|
||||
static const MCSymbolRefExpr *getGlobalOffsetTable(MCContext &Context) {
|
||||
StringRef Name = "_GLOBAL_OFFSET_TABLE_";
|
||||
return MCSymbolRefExpr::Create(Context.getOrCreateSymbol(Name),
|
||||
return MCSymbolRefExpr::create(Context.getOrCreateSymbol(Name),
|
||||
MCSymbolRefExpr::VK_None,
|
||||
Context);
|
||||
}
|
||||
@ -285,7 +285,7 @@ EmitMachineConstantPoolValue(MachineConstantPoolValue *MCPV) {
|
||||
auto *ZCPV = static_cast<SystemZConstantPoolValue*>(MCPV);
|
||||
|
||||
const MCExpr *Expr =
|
||||
MCSymbolRefExpr::Create(getSymbol(ZCPV->getGlobalValue()),
|
||||
MCSymbolRefExpr::create(getSymbol(ZCPV->getGlobalValue()),
|
||||
getModifierVariantKind(ZCPV->getModifier()),
|
||||
OutContext);
|
||||
uint64_t Size = TM.getDataLayout()->getTypeAllocSize(ZCPV->getType());
|
||||
|
@ -68,11 +68,11 @@ SystemZMCInstLower::getExpr(const MachineOperand &MO,
|
||||
default:
|
||||
llvm_unreachable("unknown operand type");
|
||||
}
|
||||
const MCExpr *Expr = MCSymbolRefExpr::Create(Symbol, Kind, Ctx);
|
||||
const MCExpr *Expr = MCSymbolRefExpr::create(Symbol, Kind, Ctx);
|
||||
if (HasOffset)
|
||||
if (int64_t Offset = MO.getOffset()) {
|
||||
const MCExpr *OffsetExpr = MCConstantExpr::Create(Offset, Ctx);
|
||||
Expr = MCBinaryExpr::CreateAdd(Expr, OffsetExpr, Ctx);
|
||||
const MCExpr *OffsetExpr = MCConstantExpr::create(Offset, Ctx);
|
||||
Expr = MCBinaryExpr::createAdd(Expr, OffsetExpr, Ctx);
|
||||
}
|
||||
return Expr;
|
||||
}
|
||||
|
@ -313,7 +313,7 @@ const MCExpr *TargetLoweringObjectFile::getTTypeGlobalReference(
|
||||
const TargetMachine &TM, MachineModuleInfo *MMI,
|
||||
MCStreamer &Streamer) const {
|
||||
const MCSymbolRefExpr *Ref =
|
||||
MCSymbolRefExpr::Create(TM.getSymbol(GV, Mang), getContext());
|
||||
MCSymbolRefExpr::create(TM.getSymbol(GV, Mang), getContext());
|
||||
|
||||
return getTTypeReference(Ref, Encoding, Streamer);
|
||||
}
|
||||
@ -332,8 +332,8 @@ getTTypeReference(const MCSymbolRefExpr *Sym, unsigned Encoding,
|
||||
// .-foo addressing.
|
||||
MCSymbol *PCSym = getContext().createTempSymbol();
|
||||
Streamer.EmitLabel(PCSym);
|
||||
const MCExpr *PC = MCSymbolRefExpr::Create(PCSym, getContext());
|
||||
return MCBinaryExpr::CreateSub(Sym, PC, getContext());
|
||||
const MCExpr *PC = MCSymbolRefExpr::create(PCSym, getContext());
|
||||
return MCBinaryExpr::createSub(Sym, PC, getContext());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -341,7 +341,7 @@ getTTypeReference(const MCSymbolRefExpr *Sym, unsigned Encoding,
|
||||
const MCExpr *TargetLoweringObjectFile::getDebugThreadLocalSymbol(const MCSymbol *Sym) const {
|
||||
// FIXME: It's not clear what, if any, default this should have - perhaps a
|
||||
// null return could mean 'no location' & we should just do that here.
|
||||
return MCSymbolRefExpr::Create(Sym, *Ctx);
|
||||
return MCSymbolRefExpr::create(Sym, *Ctx);
|
||||
}
|
||||
|
||||
void TargetLoweringObjectFile::getNameWithPrefix(
|
||||
|
@ -315,7 +315,7 @@ void X86AddressSanitizer::InstrumentMOVSBase(unsigned DstReg, unsigned SrcReg,
|
||||
|
||||
// Test (%SrcReg)
|
||||
{
|
||||
const MCExpr *Disp = MCConstantExpr::Create(0, Ctx);
|
||||
const MCExpr *Disp = MCConstantExpr::create(0, Ctx);
|
||||
std::unique_ptr<X86Operand> Op(X86Operand::CreateMem(
|
||||
getPointerWidth(), 0, Disp, SrcReg, 0, AccessSize, SMLoc(), SMLoc()));
|
||||
InstrumentMemOperand(*Op, AccessSize, false /* IsWrite */, RegCtx, Ctx,
|
||||
@ -324,7 +324,7 @@ void X86AddressSanitizer::InstrumentMOVSBase(unsigned DstReg, unsigned SrcReg,
|
||||
|
||||
// Test -1(%SrcReg, %CntReg, AccessSize)
|
||||
{
|
||||
const MCExpr *Disp = MCConstantExpr::Create(-1, Ctx);
|
||||
const MCExpr *Disp = MCConstantExpr::create(-1, Ctx);
|
||||
std::unique_ptr<X86Operand> Op(X86Operand::CreateMem(
|
||||
getPointerWidth(), 0, Disp, SrcReg, CntReg, AccessSize, SMLoc(),
|
||||
SMLoc()));
|
||||
@ -334,7 +334,7 @@ void X86AddressSanitizer::InstrumentMOVSBase(unsigned DstReg, unsigned SrcReg,
|
||||
|
||||
// Test (%DstReg)
|
||||
{
|
||||
const MCExpr *Disp = MCConstantExpr::Create(0, Ctx);
|
||||
const MCExpr *Disp = MCConstantExpr::create(0, Ctx);
|
||||
std::unique_ptr<X86Operand> Op(X86Operand::CreateMem(
|
||||
getPointerWidth(), 0, Disp, DstReg, 0, AccessSize, SMLoc(), SMLoc()));
|
||||
InstrumentMemOperand(*Op, AccessSize, true /* IsWrite */, RegCtx, Ctx, Out);
|
||||
@ -342,7 +342,7 @@ void X86AddressSanitizer::InstrumentMOVSBase(unsigned DstReg, unsigned SrcReg,
|
||||
|
||||
// Test -1(%DstReg, %CntReg, AccessSize)
|
||||
{
|
||||
const MCExpr *Disp = MCConstantExpr::Create(-1, Ctx);
|
||||
const MCExpr *Disp = MCConstantExpr::create(-1, Ctx);
|
||||
std::unique_ptr<X86Operand> Op(X86Operand::CreateMem(
|
||||
getPointerWidth(), 0, Disp, DstReg, CntReg, AccessSize, SMLoc(),
|
||||
SMLoc()));
|
||||
@ -461,7 +461,7 @@ void X86AddressSanitizer::ComputeMemOperandAddress(X86Operand &Op,
|
||||
|
||||
while (Residue != 0) {
|
||||
const MCConstantExpr *Disp =
|
||||
MCConstantExpr::Create(ApplyDisplacementBounds(Residue), Ctx);
|
||||
MCConstantExpr::create(ApplyDisplacementBounds(Residue), Ctx);
|
||||
std::unique_ptr<X86Operand> DispOp =
|
||||
X86Operand::CreateMem(getPointerWidth(), 0, Disp, Reg, 0, 1, SMLoc(),
|
||||
SMLoc());
|
||||
@ -493,7 +493,7 @@ X86AddressSanitizer::AddDisplacement(X86Operand &Op, int64_t Displacement,
|
||||
CheckDisplacementBounds(NewDisplacement);
|
||||
|
||||
*Residue = Displacement - NewDisplacement;
|
||||
const MCExpr *Disp = MCConstantExpr::Create(NewDisplacement, Ctx);
|
||||
const MCExpr *Disp = MCConstantExpr::create(NewDisplacement, Ctx);
|
||||
return X86Operand::CreateMem(Op.getMemModeSize(), Op.getMemSegReg(), Disp,
|
||||
Op.getMemBaseReg(), Op.getMemIndexReg(),
|
||||
Op.getMemScale(), SMLoc(), SMLoc());
|
||||
@ -615,7 +615,7 @@ private:
|
||||
const std::string &Fn = FuncName(AccessSize, IsWrite);
|
||||
MCSymbol *FnSym = Ctx.getOrCreateSymbol(StringRef(Fn));
|
||||
const MCSymbolRefExpr *FnExpr =
|
||||
MCSymbolRefExpr::Create(FnSym, MCSymbolRefExpr::VK_PLT, Ctx);
|
||||
MCSymbolRefExpr::create(FnSym, MCSymbolRefExpr::VK_PLT, Ctx);
|
||||
EmitInstruction(Out, MCInstBuilder(X86::CALLpcrel32).addExpr(FnExpr));
|
||||
}
|
||||
};
|
||||
@ -643,7 +643,7 @@ void X86AddressSanitizer32::InstrumentMemOperandSmall(
|
||||
MCInst Inst;
|
||||
Inst.setOpcode(X86::MOV8rm);
|
||||
Inst.addOperand(MCOperand::createReg(ShadowRegI8));
|
||||
const MCExpr *Disp = MCConstantExpr::Create(kShadowOffset, Ctx);
|
||||
const MCExpr *Disp = MCConstantExpr::create(kShadowOffset, Ctx);
|
||||
std::unique_ptr<X86Operand> Op(
|
||||
X86Operand::CreateMem(getPointerWidth(), 0, Disp, ShadowRegI32, 0, 1,
|
||||
SMLoc(), SMLoc()));
|
||||
@ -654,7 +654,7 @@ void X86AddressSanitizer32::InstrumentMemOperandSmall(
|
||||
EmitInstruction(
|
||||
Out, MCInstBuilder(X86::TEST8rr).addReg(ShadowRegI8).addReg(ShadowRegI8));
|
||||
MCSymbol *DoneSym = Ctx.createTempSymbol();
|
||||
const MCExpr *DoneExpr = MCSymbolRefExpr::Create(DoneSym, Ctx);
|
||||
const MCExpr *DoneExpr = MCSymbolRefExpr::create(DoneSym, Ctx);
|
||||
EmitInstruction(Out, MCInstBuilder(X86::JE_1).addExpr(DoneExpr));
|
||||
|
||||
EmitInstruction(Out, MCInstBuilder(X86::MOV32rr).addReg(ScratchRegI32).addReg(
|
||||
@ -669,7 +669,7 @@ void X86AddressSanitizer32::InstrumentMemOperandSmall(
|
||||
case 1:
|
||||
break;
|
||||
case 2: {
|
||||
const MCExpr *Disp = MCConstantExpr::Create(1, Ctx);
|
||||
const MCExpr *Disp = MCConstantExpr::create(1, Ctx);
|
||||
std::unique_ptr<X86Operand> Op(
|
||||
X86Operand::CreateMem(getPointerWidth(), 0, Disp, ScratchRegI32, 0, 1,
|
||||
SMLoc(), SMLoc()));
|
||||
@ -720,7 +720,7 @@ void X86AddressSanitizer32::InstrumentMemOperandLarge(
|
||||
Inst.setOpcode(X86::CMP16mi);
|
||||
break;
|
||||
}
|
||||
const MCExpr *Disp = MCConstantExpr::Create(kShadowOffset, Ctx);
|
||||
const MCExpr *Disp = MCConstantExpr::create(kShadowOffset, Ctx);
|
||||
std::unique_ptr<X86Operand> Op(
|
||||
X86Operand::CreateMem(getPointerWidth(), 0, Disp, ShadowRegI32, 0, 1,
|
||||
SMLoc(), SMLoc()));
|
||||
@ -729,7 +729,7 @@ void X86AddressSanitizer32::InstrumentMemOperandLarge(
|
||||
EmitInstruction(Out, Inst);
|
||||
}
|
||||
MCSymbol *DoneSym = Ctx.createTempSymbol();
|
||||
const MCExpr *DoneExpr = MCSymbolRefExpr::Create(DoneSym, Ctx);
|
||||
const MCExpr *DoneExpr = MCSymbolRefExpr::create(DoneSym, Ctx);
|
||||
EmitInstruction(Out, MCInstBuilder(X86::JE_1).addExpr(DoneExpr));
|
||||
|
||||
EmitCallAsanReport(AccessSize, IsWrite, Ctx, Out, RegCtx);
|
||||
@ -743,7 +743,7 @@ void X86AddressSanitizer32::InstrumentMOVSImpl(unsigned AccessSize,
|
||||
|
||||
// No need to test when ECX is equals to zero.
|
||||
MCSymbol *DoneSym = Ctx.createTempSymbol();
|
||||
const MCExpr *DoneExpr = MCSymbolRefExpr::Create(DoneSym, Ctx);
|
||||
const MCExpr *DoneExpr = MCSymbolRefExpr::create(DoneSym, Ctx);
|
||||
EmitInstruction(
|
||||
Out, MCInstBuilder(X86::TEST32rr).addReg(X86::ECX).addReg(X86::ECX));
|
||||
EmitInstruction(Out, MCInstBuilder(X86::JE_1).addExpr(DoneExpr));
|
||||
@ -860,7 +860,7 @@ public:
|
||||
|
||||
private:
|
||||
void EmitAdjustRSP(MCContext &Ctx, MCStreamer &Out, long Offset) {
|
||||
const MCExpr *Disp = MCConstantExpr::Create(Offset, Ctx);
|
||||
const MCExpr *Disp = MCConstantExpr::create(Offset, Ctx);
|
||||
std::unique_ptr<X86Operand> Op(
|
||||
X86Operand::CreateMem(getPointerWidth(), 0, Disp, X86::RSP, 0, 1,
|
||||
SMLoc(), SMLoc()));
|
||||
@ -885,7 +885,7 @@ private:
|
||||
const std::string &Fn = FuncName(AccessSize, IsWrite);
|
||||
MCSymbol *FnSym = Ctx.getOrCreateSymbol(StringRef(Fn));
|
||||
const MCSymbolRefExpr *FnExpr =
|
||||
MCSymbolRefExpr::Create(FnSym, MCSymbolRefExpr::VK_PLT, Ctx);
|
||||
MCSymbolRefExpr::create(FnSym, MCSymbolRefExpr::VK_PLT, Ctx);
|
||||
EmitInstruction(Out, MCInstBuilder(X86::CALL64pcrel32).addExpr(FnExpr));
|
||||
}
|
||||
};
|
||||
@ -914,7 +914,7 @@ void X86AddressSanitizer64::InstrumentMemOperandSmall(
|
||||
MCInst Inst;
|
||||
Inst.setOpcode(X86::MOV8rm);
|
||||
Inst.addOperand(MCOperand::createReg(ShadowRegI8));
|
||||
const MCExpr *Disp = MCConstantExpr::Create(kShadowOffset, Ctx);
|
||||
const MCExpr *Disp = MCConstantExpr::create(kShadowOffset, Ctx);
|
||||
std::unique_ptr<X86Operand> Op(
|
||||
X86Operand::CreateMem(getPointerWidth(), 0, Disp, ShadowRegI64, 0, 1,
|
||||
SMLoc(), SMLoc()));
|
||||
@ -925,7 +925,7 @@ void X86AddressSanitizer64::InstrumentMemOperandSmall(
|
||||
EmitInstruction(
|
||||
Out, MCInstBuilder(X86::TEST8rr).addReg(ShadowRegI8).addReg(ShadowRegI8));
|
||||
MCSymbol *DoneSym = Ctx.createTempSymbol();
|
||||
const MCExpr *DoneExpr = MCSymbolRefExpr::Create(DoneSym, Ctx);
|
||||
const MCExpr *DoneExpr = MCSymbolRefExpr::create(DoneSym, Ctx);
|
||||
EmitInstruction(Out, MCInstBuilder(X86::JE_1).addExpr(DoneExpr));
|
||||
|
||||
EmitInstruction(Out, MCInstBuilder(X86::MOV32rr).addReg(ScratchRegI32).addReg(
|
||||
@ -940,7 +940,7 @@ void X86AddressSanitizer64::InstrumentMemOperandSmall(
|
||||
case 1:
|
||||
break;
|
||||
case 2: {
|
||||
const MCExpr *Disp = MCConstantExpr::Create(1, Ctx);
|
||||
const MCExpr *Disp = MCConstantExpr::create(1, Ctx);
|
||||
std::unique_ptr<X86Operand> Op(
|
||||
X86Operand::CreateMem(getPointerWidth(), 0, Disp, ScratchRegI32, 0, 1,
|
||||
SMLoc(), SMLoc()));
|
||||
@ -991,7 +991,7 @@ void X86AddressSanitizer64::InstrumentMemOperandLarge(
|
||||
Inst.setOpcode(X86::CMP16mi);
|
||||
break;
|
||||
}
|
||||
const MCExpr *Disp = MCConstantExpr::Create(kShadowOffset, Ctx);
|
||||
const MCExpr *Disp = MCConstantExpr::create(kShadowOffset, Ctx);
|
||||
std::unique_ptr<X86Operand> Op(
|
||||
X86Operand::CreateMem(getPointerWidth(), 0, Disp, ShadowRegI64, 0, 1,
|
||||
SMLoc(), SMLoc()));
|
||||
@ -1001,7 +1001,7 @@ void X86AddressSanitizer64::InstrumentMemOperandLarge(
|
||||
}
|
||||
|
||||
MCSymbol *DoneSym = Ctx.createTempSymbol();
|
||||
const MCExpr *DoneExpr = MCSymbolRefExpr::Create(DoneSym, Ctx);
|
||||
const MCExpr *DoneExpr = MCSymbolRefExpr::create(DoneSym, Ctx);
|
||||
EmitInstruction(Out, MCInstBuilder(X86::JE_1).addExpr(DoneExpr));
|
||||
|
||||
EmitCallAsanReport(AccessSize, IsWrite, Ctx, Out, RegCtx);
|
||||
@ -1015,7 +1015,7 @@ void X86AddressSanitizer64::InstrumentMOVSImpl(unsigned AccessSize,
|
||||
|
||||
// No need to test when RCX is equals to zero.
|
||||
MCSymbol *DoneSym = Ctx.createTempSymbol();
|
||||
const MCExpr *DoneExpr = MCSymbolRefExpr::Create(DoneSym, Ctx);
|
||||
const MCExpr *DoneExpr = MCSymbolRefExpr::create(DoneSym, Ctx);
|
||||
EmitInstruction(
|
||||
Out, MCInstBuilder(X86::TEST64rr).addReg(X86::RCX).addReg(X86::RCX));
|
||||
EmitInstruction(Out, MCInstBuilder(X86::JE_1).addExpr(DoneExpr));
|
||||
|
@ -973,7 +973,7 @@ void X86AsmParser::SetFrameRegister(unsigned RegNo) {
|
||||
std::unique_ptr<X86Operand> X86AsmParser::DefaultMemSIOperand(SMLoc Loc) {
|
||||
unsigned basereg =
|
||||
is64BitMode() ? X86::RSI : (is32BitMode() ? X86::ESI : X86::SI);
|
||||
const MCExpr *Disp = MCConstantExpr::Create(0, getContext());
|
||||
const MCExpr *Disp = MCConstantExpr::create(0, getContext());
|
||||
return X86Operand::CreateMem(getPointerWidth(), /*SegReg=*/0, Disp,
|
||||
/*BaseReg=*/basereg, /*IndexReg=*/0, /*Scale=*/1,
|
||||
Loc, Loc, 0);
|
||||
@ -982,7 +982,7 @@ std::unique_ptr<X86Operand> X86AsmParser::DefaultMemSIOperand(SMLoc Loc) {
|
||||
std::unique_ptr<X86Operand> X86AsmParser::DefaultMemDIOperand(SMLoc Loc) {
|
||||
unsigned basereg =
|
||||
is64BitMode() ? X86::RDI : (is32BitMode() ? X86::EDI : X86::DI);
|
||||
const MCExpr *Disp = MCConstantExpr::Create(0, getContext());
|
||||
const MCExpr *Disp = MCConstantExpr::create(0, getContext());
|
||||
return X86Operand::CreateMem(getPointerWidth(), /*SegReg=*/0, Disp,
|
||||
/*BaseReg=*/basereg, /*IndexReg=*/0, /*Scale=*/1,
|
||||
Loc, Loc, 0);
|
||||
@ -1195,7 +1195,7 @@ bool X86AsmParser::ParseIntelExpression(IntelExprStateMachine &SM, SMLoc &End) {
|
||||
getContext().getDirectionalLocalSymbol(IntVal, IDVal == "b");
|
||||
MCSymbolRefExpr::VariantKind Variant = MCSymbolRefExpr::VK_None;
|
||||
const MCExpr *Val =
|
||||
MCSymbolRefExpr::Create(Sym, Variant, getContext());
|
||||
MCSymbolRefExpr::create(Sym, Variant, getContext());
|
||||
if (IDVal == "b" && Sym->isUndefined())
|
||||
return Error(Loc, "invalid reference to undefined symbol");
|
||||
StringRef Identifier = Sym->getName();
|
||||
@ -1265,9 +1265,9 @@ X86AsmParser::ParseIntelBracExpression(unsigned SegReg, SMLoc Start,
|
||||
}
|
||||
|
||||
if (SM.getImm() || !Disp) {
|
||||
const MCExpr *Imm = MCConstantExpr::Create(SM.getImm(), getContext());
|
||||
const MCExpr *Imm = MCConstantExpr::create(SM.getImm(), getContext());
|
||||
if (Disp)
|
||||
Disp = MCBinaryExpr::CreateAdd(Disp, Imm, getContext());
|
||||
Disp = MCBinaryExpr::createAdd(Disp, Imm, getContext());
|
||||
else
|
||||
Disp = Imm; // An immediate displacement only.
|
||||
}
|
||||
@ -1354,7 +1354,7 @@ bool X86AsmParser::ParseIntelIdentifier(const MCExpr *&Val,
|
||||
// Create the symbol reference.
|
||||
MCSymbol *Sym = getContext().getOrCreateSymbol(Identifier);
|
||||
MCSymbolRefExpr::VariantKind Variant = MCSymbolRefExpr::VK_None;
|
||||
Val = MCSymbolRefExpr::Create(Sym, Variant, getParser().getContext());
|
||||
Val = MCSymbolRefExpr::create(Sym, Variant, getParser().getContext());
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1382,7 +1382,7 @@ X86AsmParser::ParseIntelSegmentOverride(unsigned SegReg, SMLoc Start,
|
||||
// An immediate following a 'segment register', 'colon' token sequence can
|
||||
// be followed by a bracketed expression. If it isn't we know we have our
|
||||
// final segment override.
|
||||
const MCExpr *Disp = MCConstantExpr::Create(ImmDisp, getContext());
|
||||
const MCExpr *Disp = MCConstantExpr::create(ImmDisp, getContext());
|
||||
return X86Operand::CreateMem(getPointerWidth(), SegReg, Disp,
|
||||
/*BaseReg=*/0, /*IndexReg=*/0, /*Scale=*/1,
|
||||
Start, ImmDispToken.getEndLoc(), Size);
|
||||
@ -1435,7 +1435,7 @@ X86AsmParser::ParseRoundingModeOp(SMLoc Start, SMLoc End) {
|
||||
return ErrorOperand(Tok.getLoc(), "Expected } at this point");
|
||||
Parser.Lex(); // Eat "}"
|
||||
const MCExpr *RndModeOp =
|
||||
MCConstantExpr::Create(rndMode, Parser.getContext());
|
||||
MCConstantExpr::create(rndMode, Parser.getContext());
|
||||
return X86Operand::CreateImm(RndModeOp, Start, End);
|
||||
}
|
||||
if(Tok.getIdentifier().equals("sae")){
|
||||
@ -1499,7 +1499,7 @@ std::unique_ptr<X86Operand> X86AsmParser::ParseIntelMemOperand(int64_t ImmDisp,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const MCExpr *Disp = MCConstantExpr::Create(SM.getImm(), getContext());
|
||||
const MCExpr *Disp = MCConstantExpr::create(SM.getImm(), getContext());
|
||||
// BaseReg is non-zero to avoid assertions. In the context of inline asm,
|
||||
// we're pointing to a local variable in memory, so the base register is
|
||||
// really the frame or stack pointer.
|
||||
@ -1549,7 +1549,7 @@ bool X86AsmParser::ParseIntelDotOperator(const MCExpr *Disp,
|
||||
Val));
|
||||
}
|
||||
|
||||
NewDisp = MCConstantExpr::Create(OrigDispVal + DotDispVal, getContext());
|
||||
NewDisp = MCConstantExpr::create(OrigDispVal + DotDispVal, getContext());
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1623,7 +1623,7 @@ std::unique_ptr<X86Operand> X86AsmParser::ParseIntelOperator(unsigned OpKind) {
|
||||
unsigned Len = End.getPointer() - TypeLoc.getPointer();
|
||||
InstInfo->AsmRewrites->push_back(AsmRewrite(AOK_Imm, TypeLoc, Len, CVal));
|
||||
|
||||
const MCExpr *Imm = MCConstantExpr::Create(CVal, getContext());
|
||||
const MCExpr *Imm = MCConstantExpr::create(CVal, getContext());
|
||||
return X86Operand::CreateImm(Imm, Start, End);
|
||||
}
|
||||
|
||||
@ -1683,7 +1683,7 @@ std::unique_ptr<X86Operand> X86AsmParser::ParseIntelOperand() {
|
||||
return X86Operand::CreateMem(getPointerWidth(), SM.getSym(), Start, End,
|
||||
Size);
|
||||
|
||||
const MCExpr *ImmExpr = MCConstantExpr::Create(Imm, getContext());
|
||||
const MCExpr *ImmExpr = MCConstantExpr::create(Imm, getContext());
|
||||
return X86Operand::CreateImm(ImmExpr, Start, End);
|
||||
}
|
||||
|
||||
@ -1841,7 +1841,7 @@ std::unique_ptr<X86Operand> X86AsmParser::ParseMemOperand(unsigned SegReg,
|
||||
// of a memory operand with a missing displacement "(%ebx)" or "(,%eax)". The
|
||||
// only way to do this without lookahead is to eat the '(' and see what is
|
||||
// after it.
|
||||
const MCExpr *Disp = MCConstantExpr::Create(0, getParser().getContext());
|
||||
const MCExpr *Disp = MCConstantExpr::create(0, getParser().getContext());
|
||||
if (getLexer().isNot(AsmToken::LParen)) {
|
||||
SMLoc ExprEnd;
|
||||
if (getParser().parseExpression(Disp, ExprEnd)) return nullptr;
|
||||
@ -2061,7 +2061,7 @@ bool X86AsmParser::ParseInstruction(ParseInstructionInfo &Info, StringRef Name,
|
||||
Operands.push_back(X86Operand::CreateToken(PatchedName.slice(0, CCIdx),
|
||||
NameLoc));
|
||||
|
||||
const MCExpr *ImmOp = MCConstantExpr::Create(ComparisonCode,
|
||||
const MCExpr *ImmOp = MCConstantExpr::create(ComparisonCode,
|
||||
getParser().getContext());
|
||||
Operands.push_back(X86Operand::CreateImm(ImmOp, NameLoc, NameLoc));
|
||||
|
||||
@ -2088,7 +2088,7 @@ bool X86AsmParser::ParseInstruction(ParseInstructionInfo &Info, StringRef Name,
|
||||
if (ComparisonCode != ~0U && (ComparisonCode != 0 || CCIdx == 2)) {
|
||||
Operands.push_back(X86Operand::CreateToken("vpcmp", NameLoc));
|
||||
|
||||
const MCExpr *ImmOp = MCConstantExpr::Create(ComparisonCode,
|
||||
const MCExpr *ImmOp = MCConstantExpr::create(ComparisonCode,
|
||||
getParser().getContext());
|
||||
Operands.push_back(X86Operand::CreateImm(ImmOp, NameLoc, NameLoc));
|
||||
|
||||
@ -2115,7 +2115,7 @@ bool X86AsmParser::ParseInstruction(ParseInstructionInfo &Info, StringRef Name,
|
||||
if (ComparisonCode != ~0U) {
|
||||
Operands.push_back(X86Operand::CreateToken("vpcom", NameLoc));
|
||||
|
||||
const MCExpr *ImmOp = MCConstantExpr::Create(ComparisonCode,
|
||||
const MCExpr *ImmOp = MCConstantExpr::create(ComparisonCode,
|
||||
getParser().getContext());
|
||||
Operands.push_back(X86Operand::CreateImm(ImmOp, NameLoc, NameLoc));
|
||||
|
||||
@ -2375,7 +2375,7 @@ bool X86AsmParser::validateInstruction(MCInst &Inst, const OperandVector &Ops) {
|
||||
X86Operand &Op = static_cast<X86Operand &>(*Ops[1]);
|
||||
assert(Op.isImm() && "expected immediate");
|
||||
int64_t Res;
|
||||
if (!Op.getImm()->EvaluateAsAbsolute(Res) || Res > 255) {
|
||||
if (!Op.getImm()->evaluateAsAbsolute(Res) || Res > 255) {
|
||||
Error(Op.getStartLoc(), "interrupt vector must be in range [0-255]");
|
||||
return false;
|
||||
}
|
||||
|
@ -150,7 +150,7 @@ void X86ATTInstPrinter::printPCRelImm(const MCInst *MI, unsigned OpNo,
|
||||
// that address in hex.
|
||||
const MCConstantExpr *BranchTarget = dyn_cast<MCConstantExpr>(Op.getExpr());
|
||||
int64_t Address;
|
||||
if (BranchTarget && BranchTarget->EvaluateAsAbsolute(Address)) {
|
||||
if (BranchTarget && BranchTarget->evaluateAsAbsolute(Address)) {
|
||||
O << formatHex((uint64_t)Address);
|
||||
} else {
|
||||
// Otherwise, just print the expression.
|
||||
|
@ -131,7 +131,7 @@ void X86IntelInstPrinter::printPCRelImm(const MCInst *MI, unsigned OpNo,
|
||||
// that address in hex.
|
||||
const MCConstantExpr *BranchTarget = dyn_cast<MCConstantExpr>(Op.getExpr());
|
||||
int64_t Address;
|
||||
if (BranchTarget && BranchTarget->EvaluateAsAbsolute(Address)) {
|
||||
if (BranchTarget && BranchTarget->evaluateAsAbsolute(Address)) {
|
||||
O << formatHex((uint64_t)Address);
|
||||
}
|
||||
else {
|
||||
|
@ -37,7 +37,7 @@ public:
|
||||
MCSymbol *Sym = Ctx.getOrCreateSymbol(SymName);
|
||||
// FIXME: check that the value is actually the same.
|
||||
if (!Sym->isVariable())
|
||||
Sym->setVariableValue(MCConstantExpr::Create(SymAddr, Ctx));
|
||||
Sym->setVariableValue(MCConstantExpr::create(SymAddr, Ctx));
|
||||
|
||||
const MCExpr *Expr = nullptr;
|
||||
// If hasAddend is true, then we need to add Addend (r_addend) to Expr.
|
||||
@ -76,7 +76,7 @@ public:
|
||||
case R_X86_64_PC64:
|
||||
// S + A - P (P/pcrel is implicit)
|
||||
hasAddend = true;
|
||||
Expr = MCSymbolRefExpr::Create(Sym, Ctx);
|
||||
Expr = MCSymbolRefExpr::create(Sym, Ctx);
|
||||
break;
|
||||
case R_X86_64_GOT32:
|
||||
case R_X86_64_GOT64:
|
||||
@ -85,27 +85,27 @@ public:
|
||||
case R_X86_64_GOTPLT64:
|
||||
// G + A
|
||||
hasAddend = true;
|
||||
Expr = MCSymbolRefExpr::Create(Sym, MCSymbolRefExpr::VK_GOT, Ctx);
|
||||
Expr = MCSymbolRefExpr::create(Sym, MCSymbolRefExpr::VK_GOT, Ctx);
|
||||
break;
|
||||
case R_X86_64_PLT32:
|
||||
// L + A - P -> S@PLT + A
|
||||
hasAddend = true;
|
||||
Expr = MCSymbolRefExpr::Create(Sym, MCSymbolRefExpr::VK_PLT, Ctx);
|
||||
Expr = MCSymbolRefExpr::create(Sym, MCSymbolRefExpr::VK_PLT, Ctx);
|
||||
break;
|
||||
case R_X86_64_GLOB_DAT:
|
||||
case R_X86_64_JUMP_SLOT:
|
||||
// S
|
||||
Expr = MCSymbolRefExpr::Create(Sym, Ctx);
|
||||
Expr = MCSymbolRefExpr::create(Sym, Ctx);
|
||||
break;
|
||||
case R_X86_64_GOTPCREL:
|
||||
case R_X86_64_GOTPCREL64:
|
||||
// G + GOT + A - P -> S@GOTPCREL + A
|
||||
hasAddend = true;
|
||||
Expr = MCSymbolRefExpr::Create(Sym, MCSymbolRefExpr::VK_GOTPCREL, Ctx);
|
||||
Expr = MCSymbolRefExpr::create(Sym, MCSymbolRefExpr::VK_GOTPCREL, Ctx);
|
||||
break;
|
||||
case R_X86_64_GOTOFF64:
|
||||
// S + A - GOT
|
||||
Expr = MCSymbolRefExpr::Create(Sym, MCSymbolRefExpr::VK_GOTOFF, Ctx);
|
||||
Expr = MCSymbolRefExpr::create(Sym, MCSymbolRefExpr::VK_GOTOFF, Ctx);
|
||||
break;
|
||||
case R_X86_64_PLTOFF64:
|
||||
// L + A - GOT
|
||||
@ -113,15 +113,15 @@ public:
|
||||
case R_X86_64_SIZE32:
|
||||
case R_X86_64_SIZE64:
|
||||
// Z + A
|
||||
Expr = MCConstantExpr::Create(SymSize, Ctx);
|
||||
Expr = MCConstantExpr::create(SymSize, Ctx);
|
||||
break;
|
||||
default:
|
||||
Expr = MCSymbolRefExpr::Create(Sym, Ctx);
|
||||
Expr = MCSymbolRefExpr::create(Sym, Ctx);
|
||||
break;
|
||||
}
|
||||
if (Expr && hasAddend && Addend != 0)
|
||||
Expr = MCBinaryExpr::CreateAdd(Expr,
|
||||
MCConstantExpr::Create(Addend, Ctx),
|
||||
Expr = MCBinaryExpr::createAdd(Expr,
|
||||
MCConstantExpr::create(Addend, Ctx),
|
||||
Ctx);
|
||||
return Expr;
|
||||
}
|
||||
|
@ -119,9 +119,9 @@ X86_64MCAsmInfoDarwin::getExprForPersonalitySymbol(const MCSymbol *Sym,
|
||||
MCStreamer &Streamer) const {
|
||||
MCContext &Context = Streamer.getContext();
|
||||
const MCExpr *Res =
|
||||
MCSymbolRefExpr::Create(Sym, MCSymbolRefExpr::VK_GOTPCREL, Context);
|
||||
const MCExpr *Four = MCConstantExpr::Create(4, Context);
|
||||
return MCBinaryExpr::CreateAdd(Res, Four, Context);
|
||||
MCSymbolRefExpr::create(Sym, MCSymbolRefExpr::VK_GOTPCREL, Context);
|
||||
const MCExpr *Four = MCConstantExpr::create(4, Context);
|
||||
return MCBinaryExpr::createAdd(Res, Four, Context);
|
||||
}
|
||||
|
||||
void X86MCAsmInfoMicrosoft::anchor() { }
|
||||
|
@ -304,7 +304,7 @@ EmitImmediate(const MCOperand &DispOp, SMLoc Loc, unsigned Size,
|
||||
EmitConstant(DispOp.getImm()+ImmOffset, Size, CurByte, OS);
|
||||
return;
|
||||
}
|
||||
Expr = MCConstantExpr::Create(DispOp.getImm(), Ctx);
|
||||
Expr = MCConstantExpr::create(DispOp.getImm(), Ctx);
|
||||
} else {
|
||||
Expr = DispOp.getExpr();
|
||||
}
|
||||
@ -351,7 +351,7 @@ EmitImmediate(const MCOperand &DispOp, SMLoc Loc, unsigned Size,
|
||||
ImmOffset -= 1;
|
||||
|
||||
if (ImmOffset)
|
||||
Expr = MCBinaryExpr::CreateAdd(Expr, MCConstantExpr::Create(ImmOffset, Ctx),
|
||||
Expr = MCBinaryExpr::createAdd(Expr, MCConstantExpr::create(ImmOffset, Ctx),
|
||||
Ctx);
|
||||
|
||||
// Emit a symbolic constant as a fixup and 4 zeros.
|
||||
|
@ -39,33 +39,33 @@ public:
|
||||
MCSymbol *Sym = Ctx.getOrCreateSymbol(SymName);
|
||||
// FIXME: check that the value is actually the same.
|
||||
if (!Sym->isVariable())
|
||||
Sym->setVariableValue(MCConstantExpr::Create(SymAddr, Ctx));
|
||||
Sym->setVariableValue(MCConstantExpr::create(SymAddr, Ctx));
|
||||
const MCExpr *Expr = nullptr;
|
||||
|
||||
switch(RelType) {
|
||||
case X86_64_RELOC_TLV:
|
||||
Expr = MCSymbolRefExpr::Create(Sym, MCSymbolRefExpr::VK_TLVP, Ctx);
|
||||
Expr = MCSymbolRefExpr::create(Sym, MCSymbolRefExpr::VK_TLVP, Ctx);
|
||||
break;
|
||||
case X86_64_RELOC_SIGNED_4:
|
||||
Expr = MCBinaryExpr::CreateAdd(MCSymbolRefExpr::Create(Sym, Ctx),
|
||||
MCConstantExpr::Create(4, Ctx),
|
||||
Expr = MCBinaryExpr::createAdd(MCSymbolRefExpr::create(Sym, Ctx),
|
||||
MCConstantExpr::create(4, Ctx),
|
||||
Ctx);
|
||||
break;
|
||||
case X86_64_RELOC_SIGNED_2:
|
||||
Expr = MCBinaryExpr::CreateAdd(MCSymbolRefExpr::Create(Sym, Ctx),
|
||||
MCConstantExpr::Create(2, Ctx),
|
||||
Expr = MCBinaryExpr::createAdd(MCSymbolRefExpr::create(Sym, Ctx),
|
||||
MCConstantExpr::create(2, Ctx),
|
||||
Ctx);
|
||||
break;
|
||||
case X86_64_RELOC_SIGNED_1:
|
||||
Expr = MCBinaryExpr::CreateAdd(MCSymbolRefExpr::Create(Sym, Ctx),
|
||||
MCConstantExpr::Create(1, Ctx),
|
||||
Expr = MCBinaryExpr::createAdd(MCSymbolRefExpr::create(Sym, Ctx),
|
||||
MCConstantExpr::create(1, Ctx),
|
||||
Ctx);
|
||||
break;
|
||||
case X86_64_RELOC_GOT_LOAD:
|
||||
Expr = MCSymbolRefExpr::Create(Sym, MCSymbolRefExpr::VK_GOTPCREL, Ctx);
|
||||
Expr = MCSymbolRefExpr::create(Sym, MCSymbolRefExpr::VK_GOTPCREL, Ctx);
|
||||
break;
|
||||
case X86_64_RELOC_GOT:
|
||||
Expr = MCSymbolRefExpr::Create(Sym, isPCRel ?
|
||||
Expr = MCSymbolRefExpr::create(Sym, isPCRel ?
|
||||
MCSymbolRefExpr::VK_GOTPCREL :
|
||||
MCSymbolRefExpr::VK_GOT,
|
||||
Ctx);
|
||||
@ -84,7 +84,7 @@ public:
|
||||
report_fatal_error("Expected X86_64_RELOC_UNSIGNED after "
|
||||
"X86_64_RELOC_SUBTRACTOR.");
|
||||
|
||||
const MCExpr *LHS = MCSymbolRefExpr::Create(Sym, Ctx);
|
||||
const MCExpr *LHS = MCSymbolRefExpr::create(Sym, Ctx);
|
||||
|
||||
symbol_iterator RSymI = Rel.getSymbol();
|
||||
uint64_t RSymAddr;
|
||||
@ -94,15 +94,15 @@ public:
|
||||
|
||||
MCSymbol *RSym = Ctx.getOrCreateSymbol(RSymName);
|
||||
if (!RSym->isVariable())
|
||||
RSym->setVariableValue(MCConstantExpr::Create(RSymAddr, Ctx));
|
||||
RSym->setVariableValue(MCConstantExpr::create(RSymAddr, Ctx));
|
||||
|
||||
const MCExpr *RHS = MCSymbolRefExpr::Create(RSym, Ctx);
|
||||
const MCExpr *RHS = MCSymbolRefExpr::create(RSym, Ctx);
|
||||
|
||||
Expr = MCBinaryExpr::CreateSub(LHS, RHS, Ctx);
|
||||
Expr = MCBinaryExpr::createSub(LHS, RHS, Ctx);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
Expr = MCSymbolRefExpr::Create(Sym, Ctx);
|
||||
Expr = MCSymbolRefExpr::create(Sym, Ctx);
|
||||
break;
|
||||
}
|
||||
return Expr;
|
||||
|
@ -240,7 +240,7 @@ void X86MachObjectWriter::RecordX86_64Relocation(
|
||||
} else if (Symbol->isVariable()) {
|
||||
const MCExpr *Value = Symbol->getVariableValue();
|
||||
int64_t Res;
|
||||
bool isAbs = Value->EvaluateAsAbsolute(Res, Layout,
|
||||
bool isAbs = Value->evaluateAsAbsolute(Res, Layout,
|
||||
Writer->getSectionAddressMap());
|
||||
if (isAbs) {
|
||||
FixedValue = Res;
|
||||
@ -533,7 +533,7 @@ void X86MachObjectWriter::RecordX86Relocation(MachObjectWriter *Writer,
|
||||
// Resolve constant variables.
|
||||
if (A->isVariable()) {
|
||||
int64_t Res;
|
||||
if (A->getVariableValue()->EvaluateAsAbsolute(
|
||||
if (A->getVariableValue()->evaluateAsAbsolute(
|
||||
Res, Layout, Writer->getSectionAddressMap())) {
|
||||
FixedValue = Res;
|
||||
return;
|
||||
|
@ -525,7 +525,7 @@ void X86AsmPrinter::EmitStartOfAsmFile(Module &M) {
|
||||
// register any SEH handlers, so its object files should be safe.
|
||||
OutStreamer->EmitSymbolAttribute(S, MCSA_Global);
|
||||
OutStreamer->EmitAssignment(
|
||||
S, MCConstantExpr::Create(int64_t(1), MMI->getContext()));
|
||||
S, MCConstantExpr::create(int64_t(1), MMI->getContext()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -549,7 +549,7 @@ emitNonLazySymbolPointer(MCStreamer &OutStreamer, MCSymbol *StubLabel,
|
||||
// using NLPs; however, sometimes the types are local to the file.
|
||||
// We need to fill in the value for the NLP in those cases.
|
||||
OutStreamer.EmitValue(
|
||||
MCSymbolRefExpr::Create(MCSym.getPointer(), OutStreamer.getContext()),
|
||||
MCSymbolRefExpr::create(MCSym.getPointer(), OutStreamer.getContext()),
|
||||
4 /*size*/);
|
||||
}
|
||||
|
||||
|
@ -1842,7 +1842,7 @@ X86TargetLowering::LowerCustomJumpTableEntry(const MachineJumpTableInfo *MJTI,
|
||||
Subtarget->isPICStyleGOT());
|
||||
// In 32-bit ELF systems, our jump table entries are formed with @GOTOFF
|
||||
// entries.
|
||||
return MCSymbolRefExpr::Create(MBB->getSymbol(),
|
||||
return MCSymbolRefExpr::create(MBB->getSymbol(),
|
||||
MCSymbolRefExpr::VK_GOTOFF, Ctx);
|
||||
}
|
||||
|
||||
@ -1866,7 +1866,7 @@ getPICJumpTableRelocBaseExpr(const MachineFunction *MF, unsigned JTI,
|
||||
return TargetLowering::getPICJumpTableRelocBaseExpr(MF, JTI, Ctx);
|
||||
|
||||
// Otherwise, the reference is relative to the PIC base.
|
||||
return MCSymbolRefExpr::Create(MF->getPICBaseSymbol(), Ctx);
|
||||
return MCSymbolRefExpr::create(MF->getPICBaseSymbol(), Ctx);
|
||||
}
|
||||
|
||||
std::pair<const TargetRegisterClass *, uint8_t>
|
||||
|
@ -240,10 +240,10 @@ MCOperand X86MCInstLower::LowerSymbolOperand(const MachineOperand &MO,
|
||||
|
||||
case X86II::MO_TLVP: RefKind = MCSymbolRefExpr::VK_TLVP; break;
|
||||
case X86II::MO_TLVP_PIC_BASE:
|
||||
Expr = MCSymbolRefExpr::Create(Sym, MCSymbolRefExpr::VK_TLVP, Ctx);
|
||||
Expr = MCSymbolRefExpr::create(Sym, MCSymbolRefExpr::VK_TLVP, Ctx);
|
||||
// Subtract the pic base.
|
||||
Expr = MCBinaryExpr::CreateSub(Expr,
|
||||
MCSymbolRefExpr::Create(MF.getPICBaseSymbol(),
|
||||
Expr = MCBinaryExpr::createSub(Expr,
|
||||
MCSymbolRefExpr::create(MF.getPICBaseSymbol(),
|
||||
Ctx),
|
||||
Ctx);
|
||||
break;
|
||||
@ -264,10 +264,10 @@ MCOperand X86MCInstLower::LowerSymbolOperand(const MachineOperand &MO,
|
||||
case X86II::MO_PIC_BASE_OFFSET:
|
||||
case X86II::MO_DARWIN_NONLAZY_PIC_BASE:
|
||||
case X86II::MO_DARWIN_HIDDEN_NONLAZY_PIC_BASE:
|
||||
Expr = MCSymbolRefExpr::Create(Sym, Ctx);
|
||||
Expr = MCSymbolRefExpr::create(Sym, Ctx);
|
||||
// Subtract the pic base.
|
||||
Expr = MCBinaryExpr::CreateSub(Expr,
|
||||
MCSymbolRefExpr::Create(MF.getPICBaseSymbol(), Ctx),
|
||||
Expr = MCBinaryExpr::createSub(Expr,
|
||||
MCSymbolRefExpr::create(MF.getPICBaseSymbol(), Ctx),
|
||||
Ctx);
|
||||
if (MO.isJTI()) {
|
||||
assert(MAI.doesSetDirectiveSuppressesReloc());
|
||||
@ -277,17 +277,17 @@ MCOperand X86MCInstLower::LowerSymbolOperand(const MachineOperand &MO,
|
||||
// section so we are restricting it to jumptable references.
|
||||
MCSymbol *Label = Ctx.createTempSymbol();
|
||||
AsmPrinter.OutStreamer->EmitAssignment(Label, Expr);
|
||||
Expr = MCSymbolRefExpr::Create(Label, Ctx);
|
||||
Expr = MCSymbolRefExpr::create(Label, Ctx);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (!Expr)
|
||||
Expr = MCSymbolRefExpr::Create(Sym, RefKind, Ctx);
|
||||
Expr = MCSymbolRefExpr::create(Sym, RefKind, Ctx);
|
||||
|
||||
if (!MO.isJTI() && !MO.isMBB() && MO.getOffset())
|
||||
Expr = MCBinaryExpr::CreateAdd(Expr,
|
||||
MCConstantExpr::Create(MO.getOffset(), Ctx),
|
||||
Expr = MCBinaryExpr::createAdd(Expr,
|
||||
MCConstantExpr::create(MO.getOffset(), Ctx),
|
||||
Ctx);
|
||||
return MCOperand::createExpr(Expr);
|
||||
}
|
||||
@ -710,7 +710,7 @@ void X86AsmPrinter::LowerTlsAddr(X86MCInstLower &MCInstLowering,
|
||||
}
|
||||
|
||||
MCSymbol *sym = MCInstLowering.GetSymbolFromOperand(MI.getOperand(3));
|
||||
const MCSymbolRefExpr *symRef = MCSymbolRefExpr::Create(sym, SRVK, context);
|
||||
const MCSymbolRefExpr *symRef = MCSymbolRefExpr::create(sym, SRVK, context);
|
||||
|
||||
MCInst LEA;
|
||||
if (is64Bits) {
|
||||
@ -749,7 +749,7 @@ void X86AsmPrinter::LowerTlsAddr(X86MCInstLower &MCInstLowering,
|
||||
StringRef name = is64Bits ? "__tls_get_addr" : "___tls_get_addr";
|
||||
MCSymbol *tlsGetAddr = context.getOrCreateSymbol(name);
|
||||
const MCSymbolRefExpr *tlsRef =
|
||||
MCSymbolRefExpr::Create(tlsGetAddr,
|
||||
MCSymbolRefExpr::create(tlsGetAddr,
|
||||
MCSymbolRefExpr::VK_PLT,
|
||||
context);
|
||||
|
||||
@ -1071,7 +1071,7 @@ void X86AsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
||||
// FIXME: We would like an efficient form for this, so we don't have to do a
|
||||
// lot of extra uniquing.
|
||||
EmitAndCountInstruction(MCInstBuilder(X86::CALLpcrel32)
|
||||
.addExpr(MCSymbolRefExpr::Create(PICBase, OutContext)));
|
||||
.addExpr(MCSymbolRefExpr::create(PICBase, OutContext)));
|
||||
|
||||
// Emit the label.
|
||||
OutStreamer->EmitLabel(PICBase);
|
||||
@ -1100,12 +1100,12 @@ void X86AsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
||||
// Now that we have emitted the label, lower the complex operand expression.
|
||||
MCSymbol *OpSym = MCInstLowering.GetSymbolFromOperand(MI->getOperand(2));
|
||||
|
||||
const MCExpr *DotExpr = MCSymbolRefExpr::Create(DotSym, OutContext);
|
||||
const MCExpr *DotExpr = MCSymbolRefExpr::create(DotSym, OutContext);
|
||||
const MCExpr *PICBase =
|
||||
MCSymbolRefExpr::Create(MF->getPICBaseSymbol(), OutContext);
|
||||
DotExpr = MCBinaryExpr::CreateSub(DotExpr, PICBase, OutContext);
|
||||
MCSymbolRefExpr::create(MF->getPICBaseSymbol(), OutContext);
|
||||
DotExpr = MCBinaryExpr::createSub(DotExpr, PICBase, OutContext);
|
||||
|
||||
DotExpr = MCBinaryExpr::CreateAdd(MCSymbolRefExpr::Create(OpSym,OutContext),
|
||||
DotExpr = MCBinaryExpr::createAdd(MCSymbolRefExpr::create(OpSym,OutContext),
|
||||
DotExpr, OutContext);
|
||||
|
||||
EmitAndCountInstruction(MCInstBuilder(X86::ADD32ri)
|
||||
|
@ -32,9 +32,9 @@ const MCExpr *X86_64MachoTargetObjectFile::getTTypeGlobalReference(
|
||||
if ((Encoding & DW_EH_PE_indirect) && (Encoding & DW_EH_PE_pcrel)) {
|
||||
const MCSymbol *Sym = TM.getSymbol(GV, Mang);
|
||||
const MCExpr *Res =
|
||||
MCSymbolRefExpr::Create(Sym, MCSymbolRefExpr::VK_GOTPCREL, getContext());
|
||||
const MCExpr *Four = MCConstantExpr::Create(4, getContext());
|
||||
return MCBinaryExpr::CreateAdd(Res, Four, getContext());
|
||||
MCSymbolRefExpr::create(Sym, MCSymbolRefExpr::VK_GOTPCREL, getContext());
|
||||
const MCExpr *Four = MCConstantExpr::create(4, getContext());
|
||||
return MCBinaryExpr::createAdd(Res, Four, getContext());
|
||||
}
|
||||
|
||||
return TargetLoweringObjectFileMachO::getTTypeGlobalReference(
|
||||
@ -55,14 +55,14 @@ const MCExpr *X86_64MachoTargetObjectFile::getIndirectSymViaGOTPCRel(
|
||||
// foo@GOTPCREL+4+<offset>.
|
||||
unsigned FinalOff = Offset+MV.getConstant()+4;
|
||||
const MCExpr *Res =
|
||||
MCSymbolRefExpr::Create(Sym, MCSymbolRefExpr::VK_GOTPCREL, getContext());
|
||||
const MCExpr *Off = MCConstantExpr::Create(FinalOff, getContext());
|
||||
return MCBinaryExpr::CreateAdd(Res, Off, getContext());
|
||||
MCSymbolRefExpr::create(Sym, MCSymbolRefExpr::VK_GOTPCREL, getContext());
|
||||
const MCExpr *Off = MCConstantExpr::create(FinalOff, getContext());
|
||||
return MCBinaryExpr::createAdd(Res, Off, getContext());
|
||||
}
|
||||
|
||||
const MCExpr *X86ELFTargetObjectFile::getDebugThreadLocalSymbol(
|
||||
const MCSymbol *Sym) const {
|
||||
return MCSymbolRefExpr::Create(Sym, MCSymbolRefExpr::VK_DTPOFF, getContext());
|
||||
return MCSymbolRefExpr::create(Sym, MCSymbolRefExpr::VK_DTPOFF, getContext());
|
||||
}
|
||||
|
||||
void
|
||||
@ -116,7 +116,7 @@ const MCExpr *X86WindowsTargetObjectFile::getExecutableRelativeSymbol(
|
||||
if (GOLHS->isThreadLocal())
|
||||
return nullptr;
|
||||
|
||||
return MCSymbolRefExpr::Create(TM.getSymbol(GOLHS, Mang),
|
||||
return MCSymbolRefExpr::create(TM.getSymbol(GOLHS, Mang),
|
||||
MCSymbolRefExpr::VK_COFF_IMGREL32,
|
||||
getContext());
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ void XCoreAsmPrinter::emitArrayBound(MCSymbol *Sym, const GlobalVariable *GV) {
|
||||
Twine(Sym->getName() + StringRef(".globound")));
|
||||
OutStreamer->EmitSymbolAttribute(SymGlob, MCSA_Global);
|
||||
OutStreamer->EmitAssignment(SymGlob,
|
||||
MCConstantExpr::Create(ATy->getNumElements(),
|
||||
MCConstantExpr::create(ATy->getNumElements(),
|
||||
OutContext));
|
||||
if (GV->hasWeakLinkage() || GV->hasLinkOnceLinkage() ||
|
||||
GV->hasCommonLinkage()) {
|
||||
@ -157,7 +157,7 @@ void XCoreAsmPrinter::EmitGlobalVariable(const GlobalVariable *GV) {
|
||||
unsigned Size = TD->getTypeAllocSize(C->getType());
|
||||
if (MAI->hasDotTypeDotSizeDirective()) {
|
||||
OutStreamer->EmitSymbolAttribute(GVSym, MCSA_ELF_TypeObject);
|
||||
OutStreamer->EmitELFSize(GVSym, MCConstantExpr::Create(Size, OutContext));
|
||||
OutStreamer->EmitELFSize(GVSym, MCConstantExpr::create(Size, OutContext));
|
||||
}
|
||||
OutStreamer->EmitLabel(GVSym);
|
||||
|
||||
|
@ -65,7 +65,7 @@ MCOperand XCoreMCInstLower::LowerSymbolOperand(const MachineOperand &MO,
|
||||
llvm_unreachable("<unknown operand type>");
|
||||
}
|
||||
|
||||
const MCSymbolRefExpr *MCSym = MCSymbolRefExpr::Create(Symbol, Kind, *Ctx);
|
||||
const MCSymbolRefExpr *MCSym = MCSymbolRefExpr::create(Symbol, Kind, *Ctx);
|
||||
|
||||
if (!Offset)
|
||||
return MCOperand::createExpr(MCSym);
|
||||
@ -73,8 +73,8 @@ MCOperand XCoreMCInstLower::LowerSymbolOperand(const MachineOperand &MO,
|
||||
// Assume offset is never negative.
|
||||
assert(Offset > 0);
|
||||
|
||||
const MCConstantExpr *OffsetExpr = MCConstantExpr::Create(Offset, *Ctx);
|
||||
const MCBinaryExpr *Add = MCBinaryExpr::CreateAdd(MCSym, OffsetExpr, *Ctx);
|
||||
const MCConstantExpr *OffsetExpr = MCConstantExpr::create(Offset, *Ctx);
|
||||
const MCBinaryExpr *Add = MCBinaryExpr::createAdd(MCSym, OffsetExpr, *Ctx);
|
||||
return MCOperand::createExpr(Add);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user