summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-08-26 09:16:46 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-08-26 09:16:46 +0000
commit90398bd222f6e619c46f39847d345be19938eb4f (patch)
treeed354c7878dce89dd82c0229fd5c7d85e0c3c5f3
parent18f3c9b9941f374d5455534cb6b0df5e6f6f6e03 (diff)
downloadbcm5719-llvm-90398bd222f6e619c46f39847d345be19938eb4f.tar.gz
bcm5719-llvm-90398bd222f6e619c46f39847d345be19938eb4f.zip
llvm-mc: Make MCValue take const MCSymbol*s.
llvm-svn: 80078
-rw-r--r--llvm/include/llvm/MC/MCValue.h9
-rw-r--r--llvm/tools/llvm-mc/AsmExpr.cpp8
2 files changed, 9 insertions, 8 deletions
diff --git a/llvm/include/llvm/MC/MCValue.h b/llvm/include/llvm/MC/MCValue.h
index af56eedece0..9d71209f807 100644
--- a/llvm/include/llvm/MC/MCValue.h
+++ b/llvm/include/llvm/MC/MCValue.h
@@ -33,13 +33,13 @@ class raw_ostream;
/// 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; }
@@ -60,7 +60,8 @@ public:
/// 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;
diff --git a/llvm/tools/llvm-mc/AsmExpr.cpp b/llvm/tools/llvm-mc/AsmExpr.cpp
index fbb0c53b1cf..226dd130b1e 100644
--- a/llvm/tools/llvm-mc/AsmExpr.cpp
+++ b/llvm/tools/llvm-mc/AsmExpr.cpp
@@ -26,16 +26,16 @@ bool AsmExpr::EvaluateAsAbsolute(MCContext &Ctx, int64_t &Res) const {
return true;
}
-static bool EvaluateSymbolicAdd(const MCValue &LHS, MCSymbol *RHS_A,
- MCSymbol *RHS_B, int64_t RHS_Cst,
+static bool EvaluateSymbolicAdd(const MCValue &LHS, const MCSymbol *RHS_A,
+ const MCSymbol *RHS_B, int64_t RHS_Cst,
MCValue &Res) {
// We can't add or subtract two symbols.
if ((LHS.getSymA() && RHS_A) ||
(LHS.getSymB() && RHS_B))
return false;
- MCSymbol *A = LHS.getSymA() ? LHS.getSymA() : RHS_A;
- MCSymbol *B = LHS.getSymB() ? LHS.getSymB() : RHS_B;
+ const MCSymbol *A = LHS.getSymA() ? LHS.getSymA() : RHS_A;
+ const MCSymbol *B = LHS.getSymB() ? LHS.getSymB() : RHS_B;
if (B) {
// If we have a negated symbol, then we must have also have a non-negated
// symbol in order to encode the expression. We can do this check later to
OpenPOWER on IntegriCloud