Add OpSize16 flags to 32-bit CRC32 instructions so they can be encoded correctly...
[oota-llvm.git] / lib / Target / TargetLoweringObjectFile.cpp
index 7b8d1108f1bf86963066c9a5b86080814a0d962f..b62577e0801a634834688fa0b9b8f188f96af180 100644 (file)
@@ -18,6 +18,8 @@
 #include "llvm/IR/DerivedTypes.h"
 #include "llvm/IR/Function.h"
 #include "llvm/IR/GlobalVariable.h"
+#include "llvm/IR/Mangler.h"
+#include "llvm/MC/MCAsmInfo.h"
 #include "llvm/MC/MCContext.h"
 #include "llvm/MC/MCExpr.h"
 #include "llvm/MC/MCStreamer.h"
@@ -25,7 +27,6 @@
 #include "llvm/Support/Dwarf.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/raw_ostream.h"
-#include "llvm/Target/Mangler.h"
 #include "llvm/Target/TargetMachine.h"
 #include "llvm/Target/TargetOptions.h"
 using namespace llvm;
@@ -40,6 +41,7 @@ using namespace llvm;
 void TargetLoweringObjectFile::Initialize(MCContext &ctx,
                                           const TargetMachine &TM) {
   Ctx = &ctx;
+  DL = TM.getDataLayout();
   InitMCObjectFileInfo(TM.getTargetTriple(),
                        TM.getRelocationModel(), TM.getCodeModel(), *Ctx);
 }
@@ -102,10 +104,20 @@ static bool IsNullTerminatedString(const Constant *C) {
 MCSymbol *TargetLoweringObjectFile::getSymbol(Mangler &M, 
                                               const GlobalValue *GV) const {
   SmallString<60> NameStr;
-  M.getNameWithPrefix(NameStr, GV, false);
+  M.getNameWithPrefix(NameStr, GV);
   return Ctx->GetOrCreateSymbol(NameStr.str());
 }
 
+MCSymbol *TargetLoweringObjectFile::getSymbolWithGlobalValueBase(
+    Mangler &M, const GlobalValue *GV, StringRef Suffix) const {
+  assert(!Suffix.empty());
+
+  SmallString<60> NameStr;
+  NameStr += DL->getPrivateGlobalPrefix();
+  M.getNameWithPrefix(NameStr, GV);
+  NameStr.append(Suffix.begin(), Suffix.end());
+  return Ctx->GetOrCreateSymbol(NameStr.str());
+}
 
 MCSymbol *TargetLoweringObjectFile::
 getCFIPersonalitySymbol(const GlobalValue *GV, Mangler *Mang,