summaryrefslogtreecommitdiffstats
path: root/include/llvm/MC/MCValue.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/llvm/MC/MCValue.h')
-rw-r--r--include/llvm/MC/MCValue.h23
1 files changed, 16 insertions, 7 deletions
diff --git a/include/llvm/MC/MCValue.h b/include/llvm/MC/MCValue.h
index d032f17..62aca6e 100644
--- a/include/llvm/MC/MCValue.h
+++ b/include/llvm/MC/MCValue.h
@@ -20,6 +20,7 @@
namespace llvm {
class MCSymbol;
+class raw_ostream;
/// MCValue - This represents an "assembler immediate". In its most general
/// form, this can hold "SymbolA - SymbolB + imm64". Not all targets supports
@@ -32,13 +33,13 @@ class MCSymbol;
/// Note that this class must remain a simple POD value class, because we need
/// it to live in unions etc.
class MCValue {
- MCSymbol *SymA, *SymB;
+ const MCSymbol *SymA, *SymB;
int64_t Cst;
public:
int64_t getConstant() const { return Cst; }
- MCSymbol *getSymA() const { return SymA; }
- MCSymbol *getSymB() const { return SymB; }
+ const MCSymbol *getSymA() const { return SymA; }
+ const MCSymbol *getSymB() const { return SymB; }
/// isAbsolute - Is this an absolute (as opposed to relocatable) value.
bool isAbsolute() const { return !SymA && !SymB; }
@@ -48,11 +49,19 @@ public:
///
/// @result - The value's associated section, or null for external or constant
/// values.
- MCSection *getAssociatedSection() const {
- return SymA ? SymA->getSection() : 0;
- }
+ //
+ // FIXME: Switch to a tagged section, so this can return the tagged section
+ // value.
+ const MCSection *getAssociatedSection() const;
+
+ /// print - Print the value to the stream \arg OS.
+ void print(raw_ostream &OS, const MCAsmInfo *MAI) const;
+
+ /// dump - Print the value to stderr.
+ void dump() const;
- static MCValue get(MCSymbol *SymA, MCSymbol *SymB = 0, int64_t Val = 0) {
+ static MCValue get(const MCSymbol *SymA, const MCSymbol *SymB = 0,
+ int64_t Val = 0) {
MCValue R;
assert((!SymB || SymA) && "Invalid relocatable MCValue!");
R.Cst = Val;
OpenPOWER on IntegriCloud