add a helper method for creating MCSymbol and MCSymbolRefExpr at
authorChris Lattner <sabre@nondot.org>
Wed, 16 Sep 2009 01:26:31 +0000 (01:26 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 16 Sep 2009 01:26:31 +0000 (01:26 +0000)
the same time.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81984 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/MC/MCExpr.h
lib/MC/MCExpr.cpp

index 859cab52941635be12a8c818cd7072a004229d28..19a32e7addedf33ca3c30bffa670482a41b22c3f 100644 (file)
@@ -19,6 +19,7 @@ class MCContext;
 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 @@ public:
   /// @{
 
   static const MCSymbolRefExpr *Create(const MCSymbol *Symbol, MCContext &Ctx);
-
+  static const MCSymbolRefExpr *Create(const StringRef &Name, MCContext &Ctx);
+  
+  
+  
   /// @}
   /// @name Accessors
   /// @{
index c0ecad0361aff410d11afdf75348ca58e3b88f18..0f3e053de8ec809f90641988bfff560e3aa7d88d 100644 (file)
@@ -133,6 +133,12 @@ const MCSymbolRefExpr *MCSymbolRefExpr::Create(const MCSymbol *Sym,
   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 {