LLVM API Documentation
#include <MCExpr.h>
MCExpr - Base class for the full range of assembler expressions which are needed for parsing.
llvm::MCExpr::MCExpr | ( | ExprKind | _Kind | ) | [inline, explicit, protected] |
void MCExpr::dump | ( | ) | const |
Definition at line 129 of file MCExpr.cpp.
bool MCExpr::EvaluateAsAbsolute | ( | int64_t & | Res, |
const MCAsmLayout & | Layout, | ||
const SectionAddrMap & | Addrs | ||
) | const |
EvaluateAsAbsolute - Try to evaluate the expression to an absolute value.
Res | - The absolute value, if evaluation succeeds. |
Layout | - The assembler layout object to use for evaluating symbol values. If not given, then only non-symbolic expressions will be evaluated. |
Definition at line 460 of file MCExpr.cpp.
Referenced by llvm::AArch64InstPrinter::printAlignedLabel(), and llvm::ARMInstPrinter::printOperand().
bool MCExpr::EvaluateAsAbsolute | ( | int64_t & | Res | ) | const |
Definition at line 451 of file MCExpr.cpp.
bool MCExpr::EvaluateAsAbsolute | ( | int64_t & | Res, |
const MCAssembler & | Asm | ||
) | const |
Definition at line 466 of file MCExpr.cpp.
bool MCExpr::EvaluateAsAbsolute | ( | int64_t & | Res, |
const MCAsmLayout & | Layout | ||
) | const |
Definition at line 455 of file MCExpr.cpp.
bool MCExpr::EvaluateAsRelocatable | ( | MCValue & | Res, |
const MCAsmLayout * | Layout, | ||
const MCFixup * | Fixup | ||
) | const |
EvaluateAsRelocatable - Try to evaluate the expression to a relocatable value, i.e. an expression of the fixed form (a - b + constant).
Res | - The relocatable value, if evaluation succeeds. |
Layout | - The assembler layout object to use for evaluating values. |
Fixup | - The Fixup object if available. |
Definition at line 648 of file MCExpr.cpp.
References EvaluateAsRelocatableImpl(), and llvm::MCAsmLayout::getAssembler().
Referenced by evaluate(), llvm::PPCMCExpr::EvaluateAsConstant(), llvm::MipsMCExpr::EvaluateAsRelocatableImpl(), llvm::PPCMCExpr::EvaluateAsRelocatableImpl(), llvm::SparcMCExpr::EvaluateAsRelocatableImpl(), llvm::AArch64MCExpr::EvaluateAsRelocatableImpl(), llvm::MachObjectWriter::getSymbolAddress(), and llvm::MachObjectWriter::markAbsoluteVariableSymbols().
bool MCExpr::EvaluateAsRelocatableImpl | ( | MCValue & | Res, |
const MCAssembler * | Asm, | ||
const MCAsmLayout * | Layout, | ||
const MCFixup * | Fixup, | ||
const SectionAddrMap * | Addrs, | ||
bool | InSet, | ||
bool | ForceVarExpansion | ||
) | const [protected] |
-(a - b + const) ==> (b - a - const)
Definition at line 663 of file MCExpr.cpp.
References llvm::MCBinaryExpr::Add, llvm::MCBinaryExpr::And, llvm::MCBinaryExpr::Div, llvm::MCBinaryExpr::EQ, EvaluateAsRelocatableImpl(), EvaluateSymbolicAdd(), llvm::MCValue::get(), getKind(), llvm::MCSymbolRefExpr::getKind(), llvm::MCBinaryExpr::getLHS(), llvm::MCSymbolRefExpr::getMCAsmInfo(), llvm::MCUnaryExpr::getOpcode(), llvm::MCBinaryExpr::getOpcode(), llvm::MCBinaryExpr::getRHS(), llvm::MCUnaryExpr::getSubExpr(), llvm::MCValue::getSymA(), llvm::MCValue::getSymB(), llvm::MCSymbolRefExpr::getSymbol(), llvm::MCBinaryExpr::GT, llvm::MCBinaryExpr::GTE, llvm::MCAsmInfo::hasSubsectionsViaSymbols(), llvm::MCSymbol::isDefined(), llvm::MCBinaryExpr::LAnd, llvm_unreachable, llvm::MCUnaryExpr::LNot, llvm::MCBinaryExpr::LOr, llvm::MCBinaryExpr::LT, llvm::MCBinaryExpr::LTE, llvm::MCUnaryExpr::Minus, llvm::MCBinaryExpr::Mod, llvm::MCBinaryExpr::Mul, llvm::MCBinaryExpr::NE, llvm::MCUnaryExpr::Not, llvm::MCBinaryExpr::Or, llvm::MCUnaryExpr::Plus, llvm::MCBinaryExpr::Shl, llvm::MCBinaryExpr::Shr, llvm::MCBinaryExpr::Sub, Unary, llvm::MCSymbolRefExpr::VK_None, and llvm::MCBinaryExpr::Xor.
Referenced by EvaluateAsRelocatable(), EvaluateAsRelocatableImpl(), and EvaluateAsValue().
bool MCExpr::EvaluateAsValue | ( | MCValue & | Res, |
const MCAsmLayout * | Layout, | ||
const MCFixup * | Fixup | ||
) | const |
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 use is for when relocations are not available, like the symbol value in the symbol table.
Definition at line 656 of file MCExpr.cpp.
References EvaluateAsRelocatableImpl(), and llvm::MCAsmLayout::getAssembler().
Referenced by evaluate(), llvm::MCAsmLayout::getBaseSymbol(), and getSymbolOffsetImpl().
int64_t MCExpr::evaluateKnownAbsolute | ( | const MCAsmLayout & | Layout | ) | const |
Definition at line 470 of file MCExpr.cpp.
const MCSection * MCExpr::FindAssociatedSection | ( | ) | const |
FindAssociatedSection - Find the "associated section" for this expression, which is currently defined as the absolute section for constants, or otherwise the section associated with the first defined symbol in the expression.
Reimplemented in llvm::MCTargetExpr, llvm::AArch64MCExpr, llvm::SparcMCExpr, llvm::PPCMCExpr, llvm::NVPTXFloatMCExpr, llvm::ARMMCExpr, and llvm::MipsMCExpr.
Definition at line 816 of file MCExpr.cpp.
References FindAssociatedSection(), getKind(), llvm::MCBinaryExpr::getLHS(), llvm::MCBinaryExpr::getRHS(), llvm::MCSymbol::getSection(), llvm::MCSymbolRefExpr::getSymbol(), llvm_unreachable, and Unary.
Referenced by llvm::MipsMCExpr::FindAssociatedSection(), FindAssociatedSection(), and llvm::MCSymbol::setVariableValue().
ExprKind llvm::MCExpr::getKind | ( | ) | const [inline] |
Reimplemented in llvm::MCSymbolRefExpr, llvm::AArch64MCExpr, llvm::SparcMCExpr, llvm::PPCMCExpr, llvm::NVPTXFloatMCExpr, llvm::ARMMCExpr, and llvm::MipsMCExpr.
Definition at line 71 of file MCExpr.h.
Referenced by llvm::MCSymbol::AliasedSymbol(), llvm::MipsMCExpr::classof(), llvm::MCConstantExpr::classof(), llvm::AArch64MCExpr::classof(), llvm::MCUnaryExpr::classof(), llvm::MCBinaryExpr::classof(), llvm::MCTargetExpr::classof(), llvm::MipsTargetELFStreamer::emitAssignment(), EvaluateAsRelocatableImpl(), FindAssociatedSection(), fixELFSymbolsInTLSFixupsImpl(), getAccessVariant(), hasGOTReference(), HasSecRelSymbolRef(), isUsedIn(), print(), llvm::ARMMCExpr::PrintImpl(), StartsWithGlobalOffsetTable(), and llvm::MCStreamer::visitUsedExpr().
void MCExpr::print | ( | raw_ostream & | OS | ) | const |
Definition at line 33 of file MCExpr.cpp.
References llvm::MCBinaryExpr::Add, llvm::MCBinaryExpr::And, Binary, Constant, llvm::MCBinaryExpr::Div, llvm::MCBinaryExpr::EQ, getKind(), llvm::MCSymbolRefExpr::getKind(), llvm::MCBinaryExpr::getLHS(), llvm::MCSymbolRefExpr::getMCAsmInfo(), llvm::MCSymbol::getName(), llvm::MCUnaryExpr::getOpcode(), llvm::MCBinaryExpr::getOpcode(), llvm::MCBinaryExpr::getRHS(), llvm::MCUnaryExpr::getSubExpr(), llvm::MCSymbolRefExpr::getSymbol(), llvm::MCSymbolRefExpr::getVariantKindName(), llvm::MCBinaryExpr::GT, llvm::MCUnaryExpr::LNot, llvm::MCUnaryExpr::Minus, llvm::MCUnaryExpr::Not, llvm::MCUnaryExpr::Plus, SymbolRef, Target, Unary, llvm::MCAsmInfo::useParensForSymbolVariant(), and llvm::MCSymbolRefExpr::VK_None.
Referenced by llvm::operator<<(), llvm::MCValue::print(), llvm::DIEExpr::print(), llvm::MipsMCExpr::PrintImpl(), llvm::ARMMCExpr::PrintImpl(), llvm::PPCMCExpr::PrintImpl(), llvm::SparcMCExpr::PrintImpl(), and llvm::SparcInstPrinter::printOperand().