System/Path/Windows: Make GetSystemLibraryPaths more generic.
[oota-llvm.git] / lib / CodeGen / LLVMTargetMachine.cpp
index b856d9093ebc26f136f9ce8c43d3f319ec5cf431..3ba1b89a802172e83081a173355bbf0405e11f4a 100644 (file)
@@ -30,6 +30,7 @@
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/FormattedStream.h"
+#include "llvm/Support/StandardPasses.h"
 using namespace llvm;
 
 namespace llvm {
@@ -74,16 +75,6 @@ static cl::opt<bool> EnableMCLogging("enable-mc-api-logging", cl::Hidden,
 static cl::opt<bool> VerifyMachineCode("verify-machineinstrs", cl::Hidden,
     cl::desc("Verify generated machine code"),
     cl::init(getenv("LLVM_VERIFY_MACHINEINSTRS")!=NULL));
-// Enabled or disable local stack object block allocation. This is an
-// experimental pass that allocates locals relative to one another before
-// register allocation and then assigns them to actual stack slots as a block
-// later in PEI. This will eventually allow targets with limited index offset
-// range to allocate additional base registers (not just FP and SP) to
-// more efficiently reference locals, as well as handle situations where
-// locals cannot be referenced via SP or FP at all (dynamic stack realignment
-// together with variable sized objects, for example).
-cl::opt<bool> EnableLocalStackAlloc("enable-local-stack-alloc", cl::init(false),
-    cl::Hidden, cl::desc("Enable pre-regalloc stack frame index allocation"));
 
 static cl::opt<cl::boolOrDefault>
 AsmVerbose("asm-verbose", cl::desc("Add comments to directives."),
@@ -153,10 +144,11 @@ bool LLVMTargetMachine::addPassesToEmitFile(PassManagerBase &PM,
     if (ShowMCEncoding)
       MCE = getTarget().createCodeEmitter(*this, *Context);
 
-    AsmStreamer.reset(createAsmStreamer(*Context, Out,
-                                        getTargetData()->isLittleEndian(),
-                                        getVerboseAsm(), InstPrinter,
-                                        MCE, ShowMCInst));
+    AsmStreamer.reset(getTarget().createAsmStreamer(*Context, Out,
+                                                    getTargetData()->isLittleEndian(),
+                                                    getVerboseAsm(),
+                                                    InstPrinter, MCE,
+                                                    ShowMCInst));
     break;
   }
   case CGFT_ObjectFile: {
@@ -170,6 +162,7 @@ bool LLVMTargetMachine::addPassesToEmitFile(PassManagerBase &PM,
     AsmStreamer.reset(getTarget().createObjectStreamer(TargetTriple, *Context,
                                                        *TAB, Out, MCE,
                                                        hasMCRelaxAll()));
+    AsmStreamer.get()->InitSections();
     break;
   }
   case CGFT_Null:
@@ -263,6 +256,9 @@ bool LLVMTargetMachine::addCommonCodeGenPasses(PassManagerBase &PM,
                                                MCContext *&OutContext) {
   // Standard LLVM-Level Passes.
 
+  // Basic AliasAnalysis support.
+  createStandardAliasAnalysisPasses(&PM);
+
   // Before running any passes, run the verifier to determine if the input
   // coming from the front-end and/or optimizer is valid.
   if (!DisableVerify)
@@ -299,7 +295,7 @@ bool LLVMTargetMachine::addCommonCodeGenPasses(PassManagerBase &PM,
     PM.add(createSjLjEHPass(getTargetLowering()));
     // FALLTHROUGH
   case ExceptionHandling::Dwarf:
-    PM.add(createDwarfEHPass(this, OptLevel==CodeGenOpt::None));
+    PM.add(createDwarfEHPass(this));
     break;
   case ExceptionHandling::None:
     PM.add(createLowerInvokePass(getTargetLowering()));
@@ -354,11 +350,9 @@ bool LLVMTargetMachine::addCommonCodeGenPasses(PassManagerBase &PM,
   if (OptLevel != CodeGenOpt::None)
     PM.add(createOptimizePHIsPass());
 
-  // Assign local variables to stack slots relative to one another and simplify
-  // frame index references where possible. Final stack slot locations will be
-  // assigned in PEI.
-  if (EnableLocalStackAlloc)
-    PM.add(createLocalStackSlotAllocationPass());
+  // If the target requests it, assign local variables to stack slots relative
+  // to one another and simplify frame index references where possible.
+  PM.add(createLocalStackSlotAllocationPass());
 
   if (OptLevel != CodeGenOpt::None) {
     // With optimization, dead code should already be eliminated. However