ART: Use CmdlineParser in dex2oat

Refactor dex2oat and the compiler to use the cmdline parser. In
an effort to standardize command-line parsing and make it easier
to add new properties in a principled manner.

Test: m test-art-host
Change-Id: Ia077a56234dbf579d7ca3430fef325b57aa06333
diff --git a/compiler/driver/compiler_options_map.def b/compiler/driver/compiler_options_map.def
new file mode 100644
index 0000000..570bc5a
--- /dev/null
+++ b/compiler/driver/compiler_options_map.def
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License")
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef COMPILER_OPTIONS_KEY
+#error "Please #define COMPILER_OPTIONS_KEY before #including this file"
+#define COMPILER_OPTIONS_KEY(...)  // Don't display errors in this file in IDEs.
+#endif
+
+// This file defines the list of keys for CompilerOptionsMap.
+// These can be used with CompilerOptionsMap.Get/Set/etc, once that template class has been
+// instantiated.
+//
+// Column Descriptions:
+//                    <<Type>>                     <<Key Name>>                  (<<Default Value>>)
+//
+// Default values are only used by Map::GetOrDefault(K<T>).
+// If a default value is omitted here, T{} is used as the default value, which is
+// almost-always the value of the type as if it was memset to all 0.
+//
+// Please keep the columns aligned if possible when adding new rows.
+//
+
+// Parse-able keys from the command line.
+
+// TODO: Add type parser.
+COMPILER_OPTIONS_KEY (std::string,                 CompilerFilter)
+COMPILER_OPTIONS_KEY (Unit,                        PIC)
+COMPILER_OPTIONS_KEY (unsigned int,                HugeMethodMaxThreshold)
+COMPILER_OPTIONS_KEY (unsigned int,                LargeMethodMaxThreshold)
+COMPILER_OPTIONS_KEY (unsigned int,                SmallMethodMaxThreshold)
+COMPILER_OPTIONS_KEY (unsigned int,                TinyMethodMaxThreshold)
+COMPILER_OPTIONS_KEY (unsigned int,                NumDexMethodsThreshold)
+COMPILER_OPTIONS_KEY (unsigned int,                InlineMaxCodeUnitsThreshold)
+COMPILER_OPTIONS_KEY (bool,                        GenerateDebugInfo)
+COMPILER_OPTIONS_KEY (bool,                        GenerateMiniDebugInfo)
+COMPILER_OPTIONS_KEY (bool,                        GenerateBuildID)
+COMPILER_OPTIONS_KEY (Unit,                        Debuggable)
+COMPILER_OPTIONS_KEY (double,                      TopKProfileThreshold)
+COMPILER_OPTIONS_KEY (bool,                        AbortOnHardVerifierFailure)
+COMPILER_OPTIONS_KEY (std::string,                 DumpInitFailures)
+COMPILER_OPTIONS_KEY (std::string,                 DumpCFG)
+COMPILER_OPTIONS_KEY (Unit,                        DumpCFGAppend)
+// TODO: Add type parser.
+COMPILER_OPTIONS_KEY (std::string,                 RegisterAllocationStrategy)
+COMPILER_OPTIONS_KEY (ParseStringList<','>,        VerboseMethods)
+
+#undef COMPILER_OPTIONS_KEY