Remove DIGlobal.
[oota-llvm.git] / tools / llc / llc.cpp
index 810ba4220099e7dad5a33d5cf88dbb4feea1d3d7..82cea946455bcc1cfe336da8bb56920fe151af84 100644 (file)
 #include "llvm/CodeGen/LinkAllAsmWriterComponents.h"
 #include "llvm/CodeGen/LinkAllCodegenComponents.h"
 #include "llvm/Config/config.h"
-#include "llvm/LinkAllVMCore.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/Debug.h"
-#include "llvm/Support/FileUtilities.h"
 #include "llvm/Support/FormattedStream.h"
 #include "llvm/Support/ManagedStatic.h"
-#include "llvm/Support/MemoryBuffer.h"
 #include "llvm/Support/PluginLoader.h"
 #include "llvm/Support/PrettyStackTrace.h"
 #include "llvm/System/Host.h"
@@ -39,7 +36,6 @@
 #include "llvm/Target/TargetMachine.h"
 #include "llvm/Target/TargetRegistry.h"
 #include "llvm/Target/TargetSelect.h"
-#include "llvm/Transforms/Scalar.h"
 #include <memory>
 using namespace llvm;
 
@@ -53,9 +49,6 @@ InputFilename(cl::Positional, cl::desc("<input bitcode>"), cl::init("-"));
 static cl::opt<std::string>
 OutputFilename("o", cl::desc("Output filename"), cl::value_desc("filename"));
 
-static cl::opt<bool>
-Force("f", cl::desc("Enable binary output on terminals"));
-
 // Determine optimization level.
 static cl::opt<char>
 OptLevel("O",
@@ -126,7 +119,8 @@ GetFileNameRoot(const std::string &InputFilename) {
   return outputFilename;
 }
 
-static formatted_raw_ostream *GetOutputStream(const char *TargetName, 
+static formatted_raw_ostream *GetOutputStream(const char *TargetName,
+                                              Triple::OSType OS,
                                               const char *ProgName) {
   if (OutputFilename != "") {
     if (OutputFilename == "-")
@@ -173,7 +167,10 @@ static formatted_raw_ostream *GetOutputStream(const char *TargetName,
       OutputFilename += ".s";
     break;
   case TargetMachine::CGFT_ObjectFile:
-    OutputFilename += ".o";
+    if (OS == Triple::Win32)
+      OutputFilename += ".obj";
+    else
+      OutputFilename += ".o";
     Binary = true;
     break;
   case TargetMachine::CGFT_Null:
@@ -218,6 +215,7 @@ int main(int argc, char **argv) {
   // Initialize targets first, so that --version shows registered targets.
   InitializeAllTargets();
   InitializeAllAsmPrinters();
+  InitializeAllAsmParsers();
 
   cl::ParseCommandLineOptions(argc, argv, "llvm system compiler\n");
   
@@ -290,7 +288,8 @@ int main(int argc, char **argv) {
   TargetMachine &Target = *target.get();
 
   // Figure out where we are going to send the output...
-  formatted_raw_ostream *Out = GetOutputStream(TheTarget->getName(), argv[0]);
+  formatted_raw_ostream *Out = GetOutputStream(TheTarget->getName(),
+                                               TheTriple.getOS(), argv[0]);
   if (Out == 0) return 1;
 
   CodeGenOpt::Level OLvl = CodeGenOpt::Default;