[llvm-commits] [llvm] r81984 - in /llvm/trunk: include/llvm/MC/MCExpr.h lib/MC/MCExpr.cpp

Chris Lattner sabre at nondot.org
Tue Sep 15 18:26:31 PDT 2009


Author: lattner
Date: Tue Sep 15 20:26:31 2009
New Revision: 81984

URL: http://llvm.org/viewvc/llvm-project?rev=81984&view=rev
Log:
add a helper method for creating MCSymbol and MCSymbolRefExpr at
the same time.

Modified:
    llvm/trunk/include/llvm/MC/MCExpr.h
    llvm/trunk/lib/MC/MCExpr.cpp

Modified: llvm/trunk/include/llvm/MC/MCExpr.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCExpr.h?rev=81984&r1=81983&r2=81984&view=diff

==============================================================================
--- llvm/trunk/include/llvm/MC/MCExpr.h (original)
+++ llvm/trunk/include/llvm/MC/MCExpr.h Tue Sep 15 20:26:31 2009
@@ -19,6 +19,7 @@
 class MCSymbol;
 class MCValue;
 class raw_ostream;
+class StringRef;
 
 /// MCExpr - Base class for the full range of assembler expressions which are
 /// needed for parsing.
@@ -119,7 +120,10 @@
   /// @{
 
   static const MCSymbolRefExpr *Create(const MCSymbol *Symbol, MCContext &Ctx);
-
+  static const MCSymbolRefExpr *Create(const StringRef &Name, MCContext &Ctx);
+  
+  
+  
   /// @}
   /// @name Accessors
   /// @{

Modified: llvm/trunk/lib/MC/MCExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCExpr.cpp?rev=81984&r1=81983&r2=81984&view=diff

==============================================================================
--- llvm/trunk/lib/MC/MCExpr.cpp (original)
+++ llvm/trunk/lib/MC/MCExpr.cpp Tue Sep 15 20:26:31 2009
@@ -133,6 +133,12 @@
   return new (Ctx) MCSymbolRefExpr(Sym);
 }
 
+const MCSymbolRefExpr *MCSymbolRefExpr::Create(const StringRef &Name,
+                                               MCContext &Ctx) {
+  return Create(Ctx.GetOrCreateSymbol(Name), Ctx);
+}
+
+
 /* *** */
 
 bool MCExpr::EvaluateAsAbsolute(MCContext &Ctx, int64_t &Res) const {





More information about the llvm-commits mailing list