summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/MCAsmInfoDarwin.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2011-04-28 16:09:09 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2011-04-28 16:09:09 +0000
commitc5dac4df2ea91969604a12d418954ab026603c99 (patch)
treed286aeaf901a2f683e062b41fe795319edd5cda0 /llvm/lib/MC/MCAsmInfoDarwin.cpp
parent068730992cf08d7d7e82e7bb147d85f429fc3ddd (diff)
downloadbcm5719-llvm-c5dac4df2ea91969604a12d418954ab026603c99.tar.gz
bcm5719-llvm-c5dac4df2ea91969604a12d418954ab026603c99.zip
Add a getExprForPersonalitySymbol method to MCAsmInfo. Use it when
converting the symbol passed to .cfi_personality into bytes is the file. llvm-svn: 130400
Diffstat (limited to 'llvm/lib/MC/MCAsmInfoDarwin.cpp')
-rw-r--r--llvm/lib/MC/MCAsmInfoDarwin.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/llvm/lib/MC/MCAsmInfoDarwin.cpp b/llvm/lib/MC/MCAsmInfoDarwin.cpp
index 526ad0da42a..04862fae161 100644
--- a/llvm/lib/MC/MCAsmInfoDarwin.cpp
+++ b/llvm/lib/MC/MCAsmInfoDarwin.cpp
@@ -13,6 +13,9 @@
//===----------------------------------------------------------------------===//
#include "llvm/MC/MCAsmInfoDarwin.h"
+#include "llvm/MC/MCContext.h"
+#include "llvm/MC/MCExpr.h"
+#include "llvm/MC/MCStreamer.h"
using namespace llvm;
MCAsmInfoDarwin::MCAsmInfoDarwin() {
@@ -57,3 +60,13 @@ MCAsmInfoDarwin::MCAsmInfoDarwin() {
DwarfUsesLabelOffsetForRanges = false;
}
+const MCExpr *
+MCAsmInfoDarwin::getExprForPersonalitySymbol(const MCSymbol *Sym,
+ MCStreamer &Streamer) const {
+ MCContext &Context = Streamer.getContext();
+ const MCExpr *Res = MCSymbolRefExpr::Create(Sym, Context);
+ MCSymbol *PCSym = Context.CreateTempSymbol();
+ Streamer.EmitLabel(PCSym);
+ const MCExpr *PC = MCSymbolRefExpr::Create(PCSym, Context);
+ return MCBinaryExpr::CreateSub(Res, PC, Context);
+}
OpenPOWER on IntegriCloud