summaryrefslogtreecommitdiffstats
path: root/include/llvm/MC
diff options
context:
space:
mode:
authorrdivacky <rdivacky@FreeBSD.org>2009-10-23 14:19:52 +0000
committerrdivacky <rdivacky@FreeBSD.org>2009-10-23 14:19:52 +0000
commit9643cca39fb9fb3b49a8912926de98acf882283c (patch)
tree22cc59e4b240d84c3a5a60531119c4eca914a256 /include/llvm/MC
parent1adacceba9c9ee0f16e54388e56c9a249b296f75 (diff)
downloadFreeBSD-src-9643cca39fb9fb3b49a8912926de98acf882283c.zip
FreeBSD-src-9643cca39fb9fb3b49a8912926de98acf882283c.tar.gz
Update LLVM to r84949.
Diffstat (limited to 'include/llvm/MC')
-rw-r--r--include/llvm/MC/MCAssembler.h28
-rw-r--r--include/llvm/MC/MCContext.h27
-rw-r--r--include/llvm/MC/MCExpr.h8
-rw-r--r--include/llvm/MC/MCSymbol.h31
4 files changed, 49 insertions, 45 deletions
diff --git a/include/llvm/MC/MCAssembler.h b/include/llvm/MC/MCAssembler.h
index 892f548..76ed3df 100644
--- a/include/llvm/MC/MCAssembler.h
+++ b/include/llvm/MC/MCAssembler.h
@@ -13,7 +13,6 @@
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/ilist.h"
#include "llvm/ADT/ilist_node.h"
-#include "llvm/MC/MCValue.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/DataTypes.h"
#include <vector> // FIXME: Shouldn't be needed.
@@ -22,8 +21,10 @@ namespace llvm {
class raw_ostream;
class MCAssembler;
class MCContext;
+class MCExpr;
class MCSection;
class MCSectionData;
+class MCSymbol;
class MCFragment : public ilist_node<MCFragment> {
MCFragment(const MCFragment&); // DO NOT IMPLEMENT
@@ -174,7 +175,7 @@ public:
class MCFillFragment : public MCFragment {
/// Value - Value to use for filling bytes.
- MCValue Value;
+ const MCExpr *Value;
/// ValueSize - The size (in bytes) of \arg Value to use when filling.
unsigned ValueSize;
@@ -183,10 +184,10 @@ class MCFillFragment : public MCFragment {
uint64_t Count;
public:
- MCFillFragment(MCValue _Value, unsigned _ValueSize, uint64_t _Count,
+ MCFillFragment(const MCExpr &_Value, unsigned _ValueSize, uint64_t _Count,
MCSectionData *SD = 0)
: MCFragment(FT_Fill, SD),
- Value(_Value), ValueSize(_ValueSize), Count(_Count) {}
+ Value(&_Value), ValueSize(_ValueSize), Count(_Count) {}
/// @name Accessors
/// @{
@@ -195,7 +196,7 @@ public:
return ValueSize * Count;
}
- MCValue getValue() const { return Value; }
+ const MCExpr &getValue() const { return *Value; }
unsigned getValueSize() const { return ValueSize; }
@@ -211,15 +212,15 @@ public:
class MCOrgFragment : public MCFragment {
/// Offset - The offset this fragment should start at.
- MCValue Offset;
+ const MCExpr *Offset;
/// Value - Value to use for filling bytes.
int8_t Value;
public:
- MCOrgFragment(MCValue _Offset, int8_t _Value, MCSectionData *SD = 0)
+ MCOrgFragment(const MCExpr &_Offset, int8_t _Value, MCSectionData *SD = 0)
: MCFragment(FT_Org, SD),
- Offset(_Offset), Value(_Value) {}
+ Offset(&_Offset), Value(_Value) {}
/// @name Accessors
/// @{
@@ -229,7 +230,7 @@ public:
return ~UINT64_C(0);
}
- MCValue getOffset() const { return Offset; }
+ const MCExpr &getOffset() const { return *Offset; }
uint8_t getValue() const { return Value; }
@@ -294,10 +295,7 @@ public:
uint64_t Offset;
/// Value - The expression to eventually write into the fragment.
- //
- // FIXME: We could probably get away with requiring the client to pass in an
- // owned reference whose lifetime extends past that of the fixup.
- MCValue Value;
+ const MCExpr *Value;
/// Size - The fixup size.
unsigned Size;
@@ -308,9 +306,9 @@ public:
uint64_t FixedValue;
public:
- Fixup(MCFragment &_Fragment, uint64_t _Offset, const MCValue &_Value,
+ Fixup(MCFragment &_Fragment, uint64_t _Offset, const MCExpr &_Value,
unsigned _Size)
- : Fragment(&_Fragment), Offset(_Offset), Value(_Value), Size(_Size),
+ : Fragment(&_Fragment), Offset(_Offset), Value(&_Value), Size(_Size),
FixedValue(0) {}
};
diff --git a/include/llvm/MC/MCContext.h b/include/llvm/MC/MCContext.h
index 955aa8b..fa20f45 100644
--- a/include/llvm/MC/MCContext.h
+++ b/include/llvm/MC/MCContext.h
@@ -15,10 +15,11 @@
#include "llvm/Support/Allocator.h"
namespace llvm {
- class MCValue;
+ class MCExpr;
class MCSection;
class MCSymbol;
class StringRef;
+ class Twine;
/// MCContext - Context object for machine code objects. This class owns all
/// of the sections that it creates.
@@ -33,11 +34,6 @@ namespace llvm {
/// Symbols - Bindings of names to symbols.
StringMap<MCSymbol*> Symbols;
- /// SymbolValues - Bindings of symbols to values.
- //
- // FIXME: Is there a good reason to not just put this in the MCSymbol?
- DenseMap<const MCSymbol*, MCValue> SymbolValues;
-
/// Allocator - Allocator object used for creating machine code objects.
///
/// We use a bump pointer allocator to avoid the need to track all allocated
@@ -63,7 +59,8 @@ namespace llvm {
/// @param IsTemporary - Whether this symbol is an assembler temporary,
/// which should not survive into the symbol table for the translation unit.
MCSymbol *GetOrCreateSymbol(const StringRef &Name);
-
+ MCSymbol *GetOrCreateSymbol(const Twine &Name);
+
/// CreateTemporarySymbol - Create a new temporary symbol with the specified
/// @param Name.
///
@@ -76,25 +73,11 @@ namespace llvm {
MCSymbol *LookupSymbol(const StringRef &Name) const;
/// @}
- /// @name Symbol Value Table
- /// @{
-
- /// ClearSymbolValue - Erase a value binding for @arg Symbol, if one exists.
- void ClearSymbolValue(const MCSymbol *Symbol);
-
- /// SetSymbolValue - Set the value binding for @arg Symbol to @arg Value.
- void SetSymbolValue(const MCSymbol *Symbol, const MCValue &Value);
-
- /// GetSymbolValue - Return the current value for @arg Symbol, or null if
- /// none exists.
- const MCValue *GetSymbolValue(const MCSymbol *Symbol) const;
-
- /// @}
void *Allocate(unsigned Size, unsigned Align = 8) {
return Allocator.Allocate(Size, Align);
}
- void Deallocate(void *Ptr) {
+ void Deallocate(void *Ptr) {
}
};
diff --git a/include/llvm/MC/MCExpr.h b/include/llvm/MC/MCExpr.h
index 19a32e7..7a2a0d5 100644
--- a/include/llvm/MC/MCExpr.h
+++ b/include/llvm/MC/MCExpr.h
@@ -62,14 +62,14 @@ public:
///
/// @param Res - The absolute value, if evaluation succeeds.
/// @result - True on success.
- bool EvaluateAsAbsolute(MCContext &Ctx, int64_t &Res) const;
+ bool EvaluateAsAbsolute(int64_t &Res) const;
/// EvaluateAsRelocatable - Try to evaluate the expression to a relocatable
/// value, i.e. an expression of the fixed form (a - b + constant).
///
/// @param Res - The relocatable value, if evaluation succeeds.
/// @result - True on success.
- bool EvaluateAsRelocatable(MCContext &Ctx, MCValue &Res) const;
+ bool EvaluateAsRelocatable(MCValue &Res) const;
/// @}
@@ -121,9 +121,7 @@ public:
static const MCSymbolRefExpr *Create(const MCSymbol *Symbol, MCContext &Ctx);
static const MCSymbolRefExpr *Create(const StringRef &Name, MCContext &Ctx);
-
-
-
+
/// @}
/// @name Accessors
/// @{
diff --git a/include/llvm/MC/MCSymbol.h b/include/llvm/MC/MCSymbol.h
index 5dd7d68..d08f0e5 100644
--- a/include/llvm/MC/MCSymbol.h
+++ b/include/llvm/MC/MCSymbol.h
@@ -20,6 +20,7 @@
namespace llvm {
class MCAsmInfo;
+ class MCExpr;
class MCSection;
class MCContext;
class raw_ostream;
@@ -45,6 +46,9 @@ namespace llvm {
/// absolute symbols.
const MCSection *Section;
+ /// Value - If non-null, the value for a variable symbol.
+ const MCExpr *Value;
+
/// IsTemporary - True if this is an assembler temporary label, which
/// typically does not survive in the .o file's symbol table. Usually
/// "Lfoo" or ".foo".
@@ -52,9 +56,9 @@ namespace llvm {
private: // MCContext creates and uniques these.
friend class MCContext;
- MCSymbol(const StringRef &_Name, bool _IsTemporary)
- : Name(_Name), Section(0), IsTemporary(_IsTemporary) {}
-
+ MCSymbol(const StringRef &_Name, bool _IsTemporary)
+ : Name(_Name), Section(0), Value(0), IsTemporary(_IsTemporary) {}
+
MCSymbol(const MCSymbol&); // DO NOT IMPLEMENT
void operator=(const MCSymbol&); // DO NOT IMPLEMENT
public:
@@ -69,6 +73,10 @@ namespace llvm {
return IsTemporary;
}
+ /// @}
+ /// @name Associated Sections
+ /// @{
+
/// isDefined - Check if this symbol is defined (i.e., it has an address).
///
/// Defined symbols are either absolute or in some section.
@@ -105,6 +113,23 @@ namespace llvm {
void setAbsolute() { Section = AbsolutePseudoSection; }
/// @}
+ /// @name Variable Symbols
+ /// @{
+
+ /// isVariable - Check if this is a variable symbol.
+ bool isVariable() const {
+ return Value != 0;
+ }
+
+ /// getValue() - Get the value for variable symbols, or null if the symbol
+ /// is not a variable.
+ const MCExpr *getValue() const { return Value; }
+
+ void setValue(const MCExpr *Value) {
+ this->Value = Value;
+ }
+
+ /// @}
/// print - Print the value to the stream \arg OS.
void print(raw_ostream &OS, const MCAsmInfo *MAI) const;
OpenPOWER on IntegriCloud