Lines Matching full:llvm
22 #include <llvm/ADT/STLExtras.h>
23 #include <llvm/ADT/SmallString.h>
24 #include <llvm/Config/config.h>
25 #include <llvm/Support/CommandLine.h>
26 #include <llvm/Support/FileSystem.h>
27 #include <llvm/Support/Path.h>
28 #include <llvm/Support/raw_ostream.h>
50 llvm::cl::list<std::string>
51 OptInputFilenames(llvm::cl::Positional, llvm::cl::OneOrMore,
52 llvm::cl::desc("<input bitcode files>"));
54 llvm::cl::opt<std::string>
55 OptOutputFilename("o", llvm::cl::desc("Specify the output filename"),
56 llvm::cl::value_desc("filename"));
58 llvm::cl::opt<std::string>
59 OptRuntimePath("rt-path", llvm::cl::desc("Specify the runtime library path"),
60 llvm::cl::value_desc("path"));
62 llvm::cl::opt<std::string>
64 llvm::cl::desc("Specify the target triple (default: "
66 llvm::cl::init(DEFAULT_TARGET_TRIPLE_STRING),
67 llvm::cl::value_desc("triple"));
69 llvm::cl::alias OptTargetTripleC("C", llvm::cl::NotHidden,
70 llvm::cl::desc("Alias for -mtriple"),
71 llvm::cl::aliasopt(OptTargetTriple));
76 llvm::cl::opt<bool>
77 OptPIC("fPIC", llvm::cl::desc("Generate fully relocatable, position independent"
80 llvm::cl::opt<char>
81 OptOptLevel("O", llvm::cl::desc("Optimization level. [-O0, -O1, -O2, or -O3] "
83 llvm::cl::Prefix, llvm::cl::ZeroOrMore, llvm::cl::init('2'));
85 llvm::cl::opt<bool>
86 OptC("c", llvm::cl::desc("Compile and assemble, but do not link."));
94 llvm::cl::opt<std::string>
95 OptImmObjectOutput("or", llvm::cl::desc("Specify the filename for output the "
98 "library"), llvm::cl::ValueRequired);
100 llvm::cl::opt<bool>
101 OptShared("shared", llvm::cl::desc("Create a shared library from input bitcode "
105 // Override "bcc -version" since the LLVM version information is not correct on
108 llvm::raw_ostream &os = llvm::outs();
111 << "LLVM (http://llvm.org/):\n"
119 const llvm::cl::list<std::string> &pBitcodeFiles) {
126 llvm::errs() << "Failed to load llvm module from file `" << input_bitcode
133 llvm::errs() << "Failed to merge the llvm module `" << input_bitcode
141 llvm::errs() << "Out of memory when create script for file `"
159 llvm::errs() << "Out of memory when create the compiler configuration!\n";
180 config->setRelocationModel(llvm::Reloc::PIC_);
183 case '0': config->setOptimizationLevel(llvm::CodeGenOpt::None); break;
184 case '1': config->setOptimizationLevel(llvm::CodeGenOpt::Less); break;
185 case '3': config->setOptimizationLevel(llvm::CodeGenOpt::Aggressive); break;
188 config->setOptimizationLevel(llvm::CodeGenOpt::Default);
197 llvm::errs() << "Failed to configure the compiler! (detail: "
214 llvm::errs() << "Use " DEFAULT_OUTPUT_PATH " for output file!\n";
220 llvm::SmallString<200> output_path(input_path);
222 std::error_code err = llvm::sys::fs::make_absolute(output_path);
224 llvm::errs() << "Failed to determine the absolute path of `" << input_path
231 llvm::sys::path::replace_extension(output_path, "o");
235 llvm::sys::path::remove_filename(output_path);
236 llvm::sys::path::append(output_path, "a.out");
243 llvm::cl::SetVersionPrinter(BCCVersionPrinter);
244 llvm::cl::ParseCommandLineOptions(argc, argv);