diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2014-04-28 20:53:11 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2014-04-28 20:53:11 +0000 |
commit | 1c509556eeaa0d1bf680551acc52ce44957c592f (patch) | |
tree | 04b37358048394574a9dece7d19cbfb782b0cec5 /include/llvm | |
parent | dc352c105ff951dff69828a83f2c747b1186d3b4 (diff) | |
download | llvm-1c509556eeaa0d1bf680551acc52ce44957c592f.tar.gz llvm-1c509556eeaa0d1bf680551acc52ce44957c592f.tar.bz2 llvm-1c509556eeaa0d1bf680551acc52ce44957c592f.tar.xz |
Add an option for evaluating past symbols.
When evaluating an assembly expression for a relocation, we want to
stop at MCSymbols that are in the symbol table, even if they are variables.
This is needed since the semantics may require that the relocation use them.
That is not the case when computing the value of a symbol in the symbol table.
There are no relocations in this case and we have to keep going until we hit
a section or find out that the expression doesn't have an assembly time
value.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207445 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm')
-rw-r--r-- | include/llvm/MC/MCExpr.h | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/include/llvm/MC/MCExpr.h b/include/llvm/MC/MCExpr.h index 0033a54e42..f28adfa865 100644 --- a/include/llvm/MC/MCExpr.h +++ b/include/llvm/MC/MCExpr.h @@ -53,8 +53,9 @@ protected: bool EvaluateAsRelocatableImpl(MCValue &Res, const MCAssembler *Asm, const MCAsmLayout *Layout, - const SectionAddrMap *Addrs, - bool InSet) const; + const SectionAddrMap *Addrs, bool InSet, + bool ForceVarExpansion) const; + public: /// @name Accessors /// @{ @@ -93,6 +94,14 @@ public: /// @result - True on success. bool EvaluateAsRelocatable(MCValue &Res, const MCAsmLayout *Layout) 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 + /// use is for when relocations are not available, like the symbol value in + /// the symbol table. + bool EvaluateAsValue(MCValue &Res, const MCAsmLayout *Layout) 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 |