summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--llvm/include/llvm/MC/MCExpr.h6
-rw-r--r--llvm/lib/MC/MCExpr.cpp6
2 files changed, 11 insertions, 1 deletions
diff --git a/llvm/include/llvm/MC/MCExpr.h b/llvm/include/llvm/MC/MCExpr.h
index 859cab52941..19a32e7adde 100644
--- a/llvm/include/llvm/MC/MCExpr.h
+++ b/llvm/include/llvm/MC/MCExpr.h
@@ -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
/// @{
diff --git a/llvm/lib/MC/MCExpr.cpp b/llvm/lib/MC/MCExpr.cpp
index c0ecad0361a..0f3e053de8e 100644
--- a/llvm/lib/MC/MCExpr.cpp
+++ b/llvm/lib/MC/MCExpr.cpp
@@ -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 {
OpenPOWER on IntegriCloud