[llvm-commits] [dragonegg] r149693 - in /dragonegg/trunk: README src/Backend.cpp
Duncan Sands
baldrick at free.fr
Fri Feb 3 07:20:28 PST 2012
Author: baldrick
Date: Fri Feb 3 09:20:28 2012
New Revision: 149693
URL: http://llvm.org/viewvc/llvm-project?rev=149693&view=rev
Log:
Make it possible to pass an LLVM command line argument straight through to LLVM.
Modified:
dragonegg/trunk/README
dragonegg/trunk/src/Backend.cpp
Modified: dragonegg/trunk/README
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/README?rev=149693&r1=149692&r2=149693&view=diff
==============================================================================
--- dragonegg/trunk/README (original)
+++ dragonegg/trunk/README Fri Feb 3 09:20:28 2012
@@ -121,3 +121,5 @@
clash with the LLVM output. This option causes GCC output to be written to
a file instead. Good for seeing which GCC output we've failed to turn off.
+-fplugin-arg-dragonegg-llvm-option=option
+ Pass a command line option through to LLVM.
Modified: dragonegg/trunk/src/Backend.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/Backend.cpp?rev=149693&r1=149692&r2=149693&view=diff
==============================================================================
--- dragonegg/trunk/src/Backend.cpp (original)
+++ dragonegg/trunk/src/Backend.cpp Fri Feb 3 09:20:28 2012
@@ -97,6 +97,9 @@
// Non-zero if implicit floating point instructions are disabled.
//TODOstatic int flag_no_implicit_float = 0;
+// LLVM command line arguments specified by the user.
+std::vector<std::string> ArgStrings;
+
/// llvm_asm_file_name - Name of file to use for assembly code output.
static const char *llvm_asm_file_name;
@@ -331,7 +334,6 @@
// If there are options that should be passed through to the LLVM backend
// directly from the command line, do so now. This is mainly for debugging
// purposes, and shouldn't really be for general use.
- std::vector<std::string> ArgStrings;
//TODO if (flag_limited_precision > 0) {
//TODO std::string Arg("--limit-float-precision="+utostr(flag_limited_precision));
@@ -360,6 +362,7 @@
Args.push_back(0); // Null terminator.
int pseudo_argc = Args.size()-1;
llvm::cl::ParseCommandLineOptions(pseudo_argc, const_cast<char**>(&Args[0]));
+ ArgStrings.clear();
}
/// ComputeTargetTriple - Determine the target triple to use.
@@ -2065,8 +2068,8 @@
int argc = plugin_info->argc;
for (int i = 0; i < argc; ++i) {
- if (!strcmp (argv[i].key, "llvm-ir-optimize") ||
- !strcmp (argv[i].key, "llvm-codegen-optimize")) {
+ if (!strcmp(argv[i].key, "llvm-ir-optimize") ||
+ !strcmp(argv[i].key, "llvm-codegen-optimize")) {
if (!argv[i].value) {
error(G_("no value supplied for option '-fplugin-arg-%s-%s'"),
plugin_name, argv[i].key);
@@ -2085,6 +2088,16 @@
continue;
}
+ if (!strcmp(argv[i].key, "llvm-option")) {
+ if (!argv[i].value) {
+ error(G_("no value supplied for option '-fplugin-arg-%s-%s'"),
+ plugin_name, argv[i].key);
+ continue;
+ }
+ ArgStrings.push_back(argv[i].value);
+ continue;
+ }
+
// All remaining options are flags, so complain if there is an argument.
if (argv[i].value) {
error(G_("invalid option argument '-fplugin-arg-%s-%s=%s'"),
More information about the llvm-commits
mailing list