LLVM API Documentation

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Protected Member Functions | List of all members
llvm::MCExpr Class Reference

#include <MCExpr.h>

Inheritance diagram for llvm::MCExpr:
Inheritance graph
[legend]

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 MCSectionFindAssociatedSection () const
 

Protected Member Functions

 MCExpr (ExprKind _Kind)
 
bool EvaluateAsRelocatableImpl (MCValue &Res, const MCAssembler *Asm, const MCAsmLayout *Layout, const SectionAddrMap *Addrs, bool InSet) const
 

Detailed Description

MCExpr - Base class for the full range of assembler expressions which are needed for parsing.

Definition at line 31 of file MCExpr.h.

Member Enumeration Documentation

Enumerator
Binary 

Binary expressions.

Constant 

Constant expressions.

SymbolRef 

References to labels and assigned expressions.

Unary 

Unary expressions.

Target 

Target specific expression.

Definition at line 33 of file MCExpr.h.

Constructor & Destructor Documentation

llvm::MCExpr::MCExpr ( ExprKind  _Kind)
inlineexplicitprotected

Definition at line 51 of file MCExpr.h.

Member Function Documentation

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.

Parameters
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.
Returns
- True on success.

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).

Parameters
Res- The relocatable value, if evaluation succeeds.
Layout- The assembler layout object to use for evaluating values.
Returns
- True on success.

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().

bool MCExpr::EvaluateAsRelocatableImpl ( MCValue Res,
const MCAssembler Asm,
const MCAsmLayout Layout,
const SectionAddrMap Addrs,
bool  InSet 
) const
protected
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().

ExprKind llvm::MCExpr::getKind ( ) const
inline
void MCExpr::print ( raw_ostream OS) const

The documentation for this class was generated from the following files: