[PowerPC] Add extra r2 read deps on @toc@l relocations
[oota-llvm.git] / lib / Target / PowerPC / PPCTargetMachine.cpp
index fa501e0206ae5ad8c214610698a1193aef6b29be..50d4395dfbe8c66a45d57b46c380fbf67095312e 100644 (file)
@@ -52,6 +52,11 @@ EnablePrefetch("enable-ppc-prefetching",
                   cl::desc("disable software prefetching on PPC"),
                   cl::init(false), cl::Hidden);
 
+static cl::opt<bool>
+EnableExtraTOCRegDeps("enable-ppc-extra-toc-reg-deps",
+                      cl::desc("Add extra TOC register dependencies"),
+                      cl::init(true), cl::Hidden);
+
 extern "C" void LLVMInitializePowerPCTarget() {
   // Register the targets
   RegisterTargetMachine<PPC32TargetMachine> A(ThePPC32Target);
@@ -326,6 +331,8 @@ void PPCPassConfig::addPreRegAlloc() {
              &PPCVSXFMAMutateID);
   if (getPPCTargetMachine().getRelocationModel() == Reloc::PIC_)
     addPass(createPPCTLSDynamicCallPass());
+  if (EnableExtraTOCRegDeps)
+    addPass(createPPCTOCRegDepsPass());
 }
 
 void PPCPassConfig::addPreSched2() {