LLVM  8.0.1
Namespaces | Macros | Functions
MCExpr.cpp File Reference
#include "llvm/MC/MCExpr.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/ADT/StringSwitch.h"
#include "llvm/Config/llvm-config.h"
#include "llvm/MC/MCAsmBackend.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCAsmLayout.h"
#include "llvm/MC/MCAssembler.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCObjectWriter.h"
#include "llvm/MC/MCSymbol.h"
#include "llvm/MC/MCValue.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
#include <cassert>
#include <cstdint>
Include dependency graph for MCExpr.cpp:

Go to the source code of this file.

Namespaces

 stats
 

Macros

#define DEBUG_TYPE   "mcexpr"
 

Functions

static void AttemptToFoldSymbolOffsetDifference (const MCAssembler *Asm, const MCAsmLayout *Layout, const SectionAddrMap *Addrs, bool InSet, const MCSymbolRefExpr *&A, const MCSymbolRefExpr *&B, int64_t &Addend)
 Helper method for. More...
 
static bool EvaluateSymbolicAdd (const MCAssembler *Asm, const MCAsmLayout *Layout, const SectionAddrMap *Addrs, bool InSet, const MCValue &LHS, const MCSymbolRefExpr *RHS_A, const MCSymbolRefExpr *RHS_B, int64_t RHS_Cst, MCValue &Res)
 Evaluate the result of an add between (conceptually) two MCValues. More...
 
static bool canExpand (const MCSymbol &Sym, bool InSet)
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "mcexpr"

Definition at line 32 of file MCExpr.cpp.

Function Documentation

◆ AttemptToFoldSymbolOffsetDifference()

static void AttemptToFoldSymbolOffsetDifference ( const MCAssembler Asm,
const MCAsmLayout Layout,
const SectionAddrMap Addrs,
bool  InSet,
const MCSymbolRefExpr *&  A,
const MCSymbolRefExpr *&  B,
int64_t &  Addend 
)
static

Helper method for.

See also
EvaluateSymbolAdd().

Definition at line 506 of file MCExpr.cpp.

◆ canExpand()

static bool canExpand ( const MCSymbol Sym,
bool  InSet 
)
static

◆ EvaluateSymbolicAdd()

static bool EvaluateSymbolicAdd ( const MCAssembler Asm,
const MCAsmLayout Layout,
const SectionAddrMap Addrs,
bool  InSet,
const MCValue LHS,
const MCSymbolRefExpr RHS_A,
const MCSymbolRefExpr RHS_B,
int64_t  RHS_Cst,
MCValue Res 
)
static

Evaluate the result of an add between (conceptually) two MCValues.

This routine conceptually attempts to construct an MCValue: Result = (Result_A - Result_B + Result_Cst) from two MCValue's LHS and RHS where Result = LHS + RHS and Result = (LHS_A - LHS_B + LHS_Cst) + (RHS_A - RHS_B + RHS_Cst).

This routine attempts to aggresively fold the operands such that the result is representable in an MCValue, but may not always succeed.

Returns
True on success, false if the result is not representable in an MCValue. NOTE: It is really important to have both the Asm and Layout arguments. They might look redundant, but this function can be used before layout is done (see the object streamer for example) and having the Asm argument lets us avoid relaxations early.

Definition at line 592 of file MCExpr.cpp.

Referenced by llvm::MCExpr::evaluateAsRelocatableImpl().