R600/SI: Fix assertion from copying a TargetGlobalAddress
[oota-llvm.git] / lib / Target / PowerPC / PPCMachineFunctionInfo.cpp
index 238e4d134a39c7f12b77d901509bb601a0d0a7f8..4aff95a8a65718c967f0b4143fbb2b58c58ed72f 100644 (file)
@@ -1,4 +1,4 @@
-//=-- PPCMachineFunctionInfo.cpp - Private data used for PowerPC --*- C++ -*-=//
+//===-- PPCMachineFunctionInfo.cpp - Private data used for PowerPC --------===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -8,8 +8,17 @@
 //===----------------------------------------------------------------------===//
 
 #include "PPCMachineFunctionInfo.h"
+#include "llvm/IR/DataLayout.h"
+#include "llvm/MC/MCContext.h"
+#include "llvm/Target/TargetMachine.h"
+#include "llvm/Target/TargetSubtargetInfo.h"
 
 using namespace llvm;
 
 void PPCFunctionInfo::anchor() { }
 
+MCSymbol *PPCFunctionInfo::getPICOffsetSymbol() const {
+  const DataLayout *DL = MF.getSubtarget().getDataLayout();
+  return MF.getContext().GetOrCreateSymbol(Twine(DL->getPrivateGlobalPrefix())+
+    Twine(MF.getFunctionNumber())+"$poff");
+}