llvm-mc: Change MCContext value table to take const MCSymbol*s.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80079 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Daniel Dunbar 2009-08-26 09:16:57 +00:00
parent d644c32a52
commit 383cbff031
2 changed files with 11 additions and 13 deletions

View File

@ -36,7 +36,7 @@ namespace llvm {
/// SymbolValues - Bindings of symbols to values. /// SymbolValues - Bindings of symbols to values.
// //
// FIXME: Is there a good reason to not just put this in the MCSymbol? // FIXME: Is there a good reason to not just put this in the MCSymbol?
DenseMap<MCSymbol*, MCValue> SymbolValues; DenseMap<const MCSymbol*, MCValue> SymbolValues;
/// Allocator - Allocator object used for creating machine code objects. /// Allocator - Allocator object used for creating machine code objects.
/// ///
@ -70,17 +70,15 @@ namespace llvm {
/// LookupSymbol - Get the symbol for @param Name, or null. /// LookupSymbol - Get the symbol for @param Name, or null.
MCSymbol *LookupSymbol(const StringRef &Name) const; MCSymbol *LookupSymbol(const StringRef &Name) const;
/// ClearSymbolValue - Erase a value binding for @param Symbol, if one /// ClearSymbolValue - Erase a value binding for @arg Symbol, if one exists.
/// exists. void ClearSymbolValue(const MCSymbol *Symbol);
void ClearSymbolValue(MCSymbol *Symbol);
/// SetSymbolValue - Set the value binding for @param Symbol to @param /// SetSymbolValue - Set the value binding for @arg Symbol to @arg Value.
/// Value. void SetSymbolValue(const MCSymbol *Symbol, const MCValue &Value);
void SetSymbolValue(MCSymbol *Symbol, const MCValue &Value);
/// GetSymbolValue - Return the current value for @param Symbol, or null if /// GetSymbolValue - Return the current value for @arg Symbol, or null if
/// none exists. /// none exists.
const MCValue *GetSymbolValue(MCSymbol *Symbol) const; const MCValue *GetSymbolValue(const MCSymbol *Symbol) const;
void *Allocate(unsigned Size, unsigned Align = 8) { void *Allocate(unsigned Size, unsigned Align = 8) {
return Allocator.Allocate(Size, Align); return Allocator.Allocate(Size, Align);

View File

@ -54,16 +54,16 @@ MCSymbol *MCContext::LookupSymbol(const StringRef &Name) const {
return Symbols.lookup(Name); return Symbols.lookup(Name);
} }
void MCContext::ClearSymbolValue(MCSymbol *Sym) { void MCContext::ClearSymbolValue(const MCSymbol *Sym) {
SymbolValues.erase(Sym); SymbolValues.erase(Sym);
} }
void MCContext::SetSymbolValue(MCSymbol *Sym, const MCValue &Value) { void MCContext::SetSymbolValue(const MCSymbol *Sym, const MCValue &Value) {
SymbolValues[Sym] = Value; SymbolValues[Sym] = Value;
} }
const MCValue *MCContext::GetSymbolValue(MCSymbol *Sym) const { const MCValue *MCContext::GetSymbolValue(const MCSymbol *Sym) const {
DenseMap<MCSymbol*, MCValue>::iterator it = SymbolValues.find(Sym); DenseMap<const MCSymbol*, MCValue>::iterator it = SymbolValues.find(Sym);
if (it == SymbolValues.end()) if (it == SymbolValues.end())
return 0; return 0;