Index: src/llvm2ice.cpp |
diff --git a/src/llvm2ice.cpp b/src/llvm2ice.cpp |
index 3546b84c87bfacfc63c77f757103f0fd2ca225df..f930511436f7c5bf3d9662471d2f2ae7582848fa 100644 |
--- a/src/llvm2ice.cpp |
+++ b/src/llvm2ice.cpp |
@@ -161,12 +161,78 @@ static cl::opt<bool> AlwaysExitSuccess( |
"exit-success", cl::desc("Exit with success status, even if errors found"), |
cl::init(false)); |
+static cl::opt<bool> GenerateBuildAtts( |
+ "build-atts", cl::desc("Generate list of build attributes associated with " |
+ "this executable."), |
+ cl::init(false)); |
+ |
static int GetReturnValue(int Val) { |
if (AlwaysExitSuccess) |
return 0; |
return Val; |
} |
+static bool GenerateBuildAttributes(raw_os_ostream &Stream) { |
+ if (!GenerateBuildAtts) |
+ return false; |
+ |
+ // TODO(kschimpf): Conditionalize this once we have multiple targets. |
+ Stream << "x86-32\n"; |
+ |
+#if defined NO_TEXT_ASM && !defined ALLOW_TEXT_ASM |
+ Stream << "no_text_asm\n"; |
+#elif !defined NO_DUMP && defined ALLOW_TEXT_ASM |
jvoung (off chromium)
2014/10/21 19:12:00
NO_TEXT_ASM instead of NO_DUMP?
Maybe there can b
Karl
2014/10/21 21:14:18
After simplifying the define flags (see Makefile.s
|
+ Stream << "allow_text_asm\n"; |
+#elif defined NO_TEXT_ASM |
+#error Can't define both NO_TEXT_ASM and ALLOW_TEXT_ASM |
+#else |
+#error Must define either NO_TEXT_ASM or ALLOW_TEXT_ASM |
+#endif |
+ |
+#if defined NO_DUMP && !defined ALLOW_DUMP |
+ Stream << "no_dump\n"; |
+#elif !defined NO_DUMP && defined ALLOW_DUMP |
+ Stream << "allow_dump\n"; |
+#elif defined DO_DUMP |
jvoung (off chromium)
2014/10/21 19:12:00
DO_DUMP -> NO_DUMP?
Karl
2014/10/21 21:14:18
Done.
|
+#error Can't define both NO_DUMP and ALLOW_DUMP |
+#else |
+#error Must define either NO_DUMP or ALLOW_DUMP |
+#endif |
+ |
+#if defined NO_LLVM_CL && !defined ALLOW_LLVM_CL |
+ Stream << "no_llvm_cl\n"; |
+#elif !defined NO_LLVM_CL && defined ALLOW_LLVM_CL |
+ Stream << "allow_llvm_cl\n"; |
+#elif defined NO_LLVM_CL |
+#error Can't define both NO_LLVM_CL and ALLOW_LLVM_CL |
+#else |
+#error Must define either NO_LLVM_CL or ALLOW_LLVM_CL |
+#endif |
+ |
+#if defined NO_LLVM_IR && !defined ALLOW_LLVM_IR |
+ Stream << "no_llvm_ir\n"; |
+#elif !defined NO_LLMV_IR && defined ALLOW_LLVM_IR |
+ Stream << "allow_llvm_ir\n"; |
+#elif defined NO_LLVM_IR |
+#error Can't define both NO_LLVM_IR and ALLOW_LLVM_IR |
+#else |
+#error Must define either NO_LLVM_IR or ALLOW_LLVM_IR |
+#endif |
+ |
+ |
+#if defined NO_LLVM_IR_AS_INPUT && !defined ALLOW_LLVM_IR_AS_INPUT |
+ Stream << "no_llvm_ir_as_input\n"; |
+#elif !defined NO_LLMV_IR_AS_INPUT && defined ALLOW_LLVM_IR_AS_INPUT |
+ Stream << "allow_llvm_ir_as_input\n"; |
+#elif defined NO_LLVM_IR_AS_INPUT |
+#error Can't define both NO_LLVM_IR_AS_INPUT and ALLOW_LLVM_IR_AS_INPUT |
+#else |
+#error Must define either NO_LLVM_IR_AS_INPUT or ALLOW_LLVM_IR_AS_INPUT |
+#endif |
+ |
+ return true; |
+} |
+ |
int main(int argc, char **argv) { |
cl::ParseCommandLineOptions(argc, argv); |
@@ -182,6 +248,11 @@ int main(int argc, char **argv) { |
raw_os_ostream *Os = |
new raw_os_ostream(OutputFilename == "-" ? std::cout : Ofs); |
Os->SetUnbuffered(); |
+ |
+ |
jvoung (off chromium)
2014/10/21 19:12:00
could squash it to one newline instead of two
Karl
2014/10/21 21:14:18
Done.
|
+ if (GenerateBuildAttributes(*Os)) |
+ return GetReturnValue(0); |
+ |
std::ofstream Lfs; |
if (LogFilename != "-") { |
Lfs.open(LogFilename.c_str(), std::ofstream::out); |