[llvm-commits] [llvm] r80078 - in /llvm/trunk: include/llvm/MC/MCValue.h tools/llvm-mc/AsmExpr.cpp

Daniel Dunbar daniel at zuster.org
Wed Aug 26 02:16:46 PDT 2009


Author: ddunbar
Date: Wed Aug 26 04:16:46 2009
New Revision: 80078

URL: http://llvm.org/viewvc/llvm-project?rev=80078&view=rev
Log:
llvm-mc: Make MCValue take const MCSymbol*s.

Modified:
    llvm/trunk/include/llvm/MC/MCValue.h
    llvm/trunk/tools/llvm-mc/AsmExpr.cpp

Modified: llvm/trunk/include/llvm/MC/MCValue.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCValue.h?rev=80078&r1=80077&r2=80078&view=diff

==============================================================================
--- llvm/trunk/include/llvm/MC/MCValue.h (original)
+++ llvm/trunk/include/llvm/MC/MCValue.h Wed Aug 26 04:16:46 2009
@@ -33,13 +33,13 @@
 /// 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 @@
   /// 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;

Modified: llvm/trunk/tools/llvm-mc/AsmExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmExpr.cpp?rev=80078&r1=80077&r2=80078&view=diff

==============================================================================
--- llvm/trunk/tools/llvm-mc/AsmExpr.cpp (original)
+++ llvm/trunk/tools/llvm-mc/AsmExpr.cpp Wed Aug 26 04:16:46 2009
@@ -26,16 +26,16 @@
   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





More information about the llvm-commits mailing list