LLVM API Documentation
#include <MCExpr.h>
Public Types | |
enum | ExprKind { Binary, Constant, SymbolRef, Unary, Target } |
Public Member Functions | |
Accessors | |
ExprKind | getKind () const |
Utility Methods | |
void | print (raw_ostream &OS) const |
void | dump () const |
Expression Evaluation | |
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 | EvaluateAsRelocatable (MCValue &Res, const MCAsmLayout &Layout) const |
const MCSection * | FindAssociatedSection () const |
Protected Member Functions | |
MCExpr (ExprKind _Kind) | |
bool | EvaluateAsRelocatableImpl (MCValue &Res, const MCAssembler *Asm, const MCAsmLayout *Layout, const SectionAddrMap *Addrs, bool InSet) const |
MCExpr - Base class for the full range of assembler expressions which are needed for parsing.
|
inlineexplicitprotected |
void MCExpr::dump | ( | ) | const |
Definition at line 134 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 430 of file MCExpr.cpp.
bool MCExpr::EvaluateAsAbsolute | ( | int64_t & | Res | ) | const |
Definition at line 421 of file MCExpr.cpp.
bool MCExpr::EvaluateAsAbsolute | ( | int64_t & | Res, |
const MCAssembler & | Asm | ||
) | const |
Definition at line 436 of file MCExpr.cpp.
bool MCExpr::EvaluateAsAbsolute | ( | int64_t & | Res, |
const MCAsmLayout & | Layout | ||
) | const |
Definition at line 425 of file MCExpr.cpp.
bool MCExpr::EvaluateAsRelocatable | ( | MCValue & | Res, |
const MCAsmLayout & | Layout | ||
) | 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. |
Definition at line 603 of file MCExpr.cpp.
References EvaluateAsRelocatableImpl(), and llvm::MCAsmLayout::getAssembler().
Referenced by llvm::PPCMCExpr::EvaluateAsRelocatableImpl(), llvm::AArch64MCExpr::EvaluateAsRelocatableImpl(), llvm::MachObjectWriter::getSymbolAddress(), llvm::MCAsmLayout::getSymbolOffset(), and llvm::MachObjectWriter::markAbsoluteVariableSymbols().
|
protected |
-(a - b + const) ==> (b - a - const)
Definition at line 609 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::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::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::AArch64ISD::Ret, llvm::MCBinaryExpr::Shl, llvm::MCBinaryExpr::Shr, llvm::MCBinaryExpr::Sub, Unary, llvm::MCSymbolRefExpr::VK_None, and llvm::MCBinaryExpr::Xor.
Referenced by EvaluateAsRelocatable(), and EvaluateAsRelocatableImpl().
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.
Definition at line 743 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::ARMMCExpr::FindAssociatedSection(), llvm::PPCMCExpr::FindAssociatedSection(), FindAssociatedSection(), llvm::AArch64MCExpr::FindAssociatedSection(), and llvm::MCSymbol::setVariableValue().
|
inline |
Definition at line 61 of file MCExpr.h.
Referenced by llvm::MCObjectStreamer::AddValueSymbols(), AddValueSymbols_(), AddValueSymbolsImpl(), llvm::MCSymbol::AliasedSymbol(), llvm::ARMMCExpr::classof(), llvm::NVPTXFloatMCExpr::classof(), llvm::PPCMCExpr::classof(), llvm::MCConstantExpr::classof(), llvm::AArch64MCExpr::classof(), llvm::MCSymbolRefExpr::classof(), llvm::MCUnaryExpr::classof(), llvm::MCBinaryExpr::classof(), llvm::MCTargetExpr::classof(), EvaluateAsPCRel(), EvaluateAsRelocatableImpl(), FindAssociatedSection(), fixELFSymbolsInTLSFixupsImpl(), HasSecRelSymbolRef(), isUsedIn(), llvm::MipsGetSymAndOffset(), print(), llvm::ARMMCExpr::PrintImpl(), llvm::AArch64MCExpr::PrintImpl(), and StartsWithGlobalOffsetTable().
void MCExpr::print | ( | raw_ostream & | OS | ) | const |
Definition at line 31 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::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::MCSymbolRefExpr::VK_ARM_GOT, llvm::MCSymbolRefExpr::VK_ARM_GOTOFF, llvm::MCSymbolRefExpr::VK_ARM_GOTTPOFF, llvm::MCSymbolRefExpr::VK_ARM_NONE, llvm::MCSymbolRefExpr::VK_ARM_PLT, llvm::MCSymbolRefExpr::VK_ARM_PREL31, llvm::MCSymbolRefExpr::VK_ARM_TARGET1, llvm::MCSymbolRefExpr::VK_ARM_TARGET2, llvm::MCSymbolRefExpr::VK_ARM_TLSGD, llvm::MCSymbolRefExpr::VK_ARM_TPOFF, and llvm::MCSymbolRefExpr::VK_None.
Referenced by llvm::operator<<(), llvm::MCValue::print(), llvm::DIEExpr::print(), llvm::ARMMCExpr::PrintImpl(), llvm::PPCMCExpr::PrintImpl(), and llvm::AArch64MCExpr::PrintImpl().