Author: minz
Date: 2010-11-08 20:49:24 -0500 (Mon, 08 Nov 2010)
New Revision: 3390
Added:
trunk/osprey/be/com/comp_driver.cxx
trunk/osprey/be/com/comp_driver.h
trunk/osprey/common/com/comp_decl.cxx
trunk/osprey/common/com/comp_decl.h
Modified:
trunk/osprey/be/be/Makefile.gbase
trunk/osprey/be/be/driver.cxx
trunk/osprey/common/com/config.h
trunk/osprey/common/util/flags.h
trunk/osprey/driver/OPTIONS
Log:
Implement basic support for phase componentization, which provides a
template to add new optimization phase. This template enables the
consistent handling of trace, dump, option handling and statistics.
Each optimization phase should derive from the base O64_Component class.
As the initial step, this checkin does not change the existing
optimization phase or adding new optimization phase to use the new
interface.
Code Review: Mei, Sun, Bergstrom.
Modified: trunk/osprey/be/be/Makefile.gbase
===================================================================
--- trunk/osprey/be/be/Makefile.gbase 2010-11-04 02:23:28 UTC (rev 3389)
+++ trunk/osprey/be/be/Makefile.gbase 2010-11-09 01:49:24 UTC (rev 3390)
@@ -314,6 +314,7 @@
opcode_core.cxx \
wutil.cxx \
DaVinci.cxx \
+ comp_decl.cxx
COMMON_COM_PCH_CXX_SRCS = \
const.cxx \
@@ -495,7 +496,8 @@
wn_instrument.cxx \
wn_cfg.cxx \
tls.cxx \
- be_memop_annot.cxx
+ be_memop_annot.cxx \
+ comp_driver.cxx
ifneq ($(BUILD_SKIP_LNO), TRUE)
BE_COM_CXX_SRCS += \
@@ -552,7 +554,6 @@
clone.cxx \
clone_DST_utils.cxx \
-
BE_LNO_CXX_SRCS = \
soe.cxx \
mat.cxx
Modified: trunk/osprey/be/be/driver.cxx
===================================================================
--- trunk/osprey/be/be/driver.cxx 2010-11-04 02:23:28 UTC (rev 3389)
+++ trunk/osprey/be/be/driver.cxx 2010-11-09 01:49:24 UTC (rev 3390)
@@ -1,3 +1,7 @@
+/*
+ * Copyright (C) 2010, Hewlett-Packard Development Company, L.P. All Rights
Reserved.
+ */
+
/*
* Copyright (C) 2008-2010 Advanced Micro Devices, Inc. All Rights Reserved.
*/
@@ -159,6 +163,7 @@
#include "isr.h"
#endif
#include "wn_mp.h" // for Verify_No_MP()
+#include "comp_decl.h"
extern ERROR_DESC EDESC_BE[], EDESC_CG[];
@@ -2246,7 +2251,10 @@
Set_Error_Phase ( "Back End Driver" );
Preconfigure ();
+ // setup options from the command line to O64_Driver
+ O64_Driver::GetInstance()->SetupOptions(argc, argv);
Process_Command_Line (argc, argv);
+
if (Inhibit_EH_opt && Opt_Level > 1) Opt_Level = 1;
Reset_Timers ();
Start_Timer(T_BE_Comp);
Added: trunk/osprey/be/com/comp_driver.cxx
===================================================================
--- trunk/osprey/be/com/comp_driver.cxx (rev 0)
+++ trunk/osprey/be/com/comp_driver.cxx 2010-11-09 01:49:24 UTC (rev 3390)
@@ -0,0 +1,558 @@
+/*
+
+ Copyright (C) 2010, Hewlett-Packard Development Company, L.P. All Rights
Reserved.
+
+ Open64 is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation; either version 2
+ of the License, or (at your option) any later version.
+
+ Open64 is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301, USA.
+
+*/
+
+/* ====================================================================
+ *
+ * Module: comp_driver.cxx
+ *
+ * Revision history:
+ * Oct-10 - Original Version
+ *
+ * Description:
+ * O64_Driver and O64_Option class implementation
+ *
+ * ====================================================================
+ */
+
+#include "comp_driver.h"
+#include "errors.h"
+#include "mempool.h"
+#include "cxx_memory.h"
+
+O64_Driver * O64_Driver::_theInstance = NULL;
+
+// initialize the driver
+static O64_DriverInitializer initialize_driver;
+
+// driver's component descriptor
+const O64_ComponentDescriptor O64_Driver::ComponentDescriptor =
+{
+ O64_COMPONENT_DESC("O64 driver", "DRIVER", OptionDescriptors)
+};
+
+// driver's option descriptors
+const O64_OptionDescriptor O64_Driver::OptionDescriptors[] =
+{
+ // O64_OPTION_DESC(id, description, name, abbreviation, kind, visibility,
changed by pragma,
+ // default value, minimal value, maximal value)
+
+ O64_OPTION_DESC(OPT_driver_tstats, "compile time statistics",
+ "tstats", "tstats", OVK_NONE, OV_INTERNAL, false, false, 0, 0),
+ O64_OPTION_DESC(OPT_driver_mstats, "memory usage statistics",
+ "mstats", "mstats", OVK_NONE, OV_INTERNAL, false, false, 0, 0),
+ O64_OPTION_DESC(OPT_driver_last, "end marker", 0, 0, OVK_INVALID,
OV_INTERNAL, false, 0, 0, 0)
+};
+
+// register the driver component descriptor to list
+static O64_ComponentInitializer driver_init(
+ COMPONENT_driver, &O64_Driver::ComponentDescriptor);
+
+
+// =======================================================================
+// O64_Driver Implementation
+// =======================================================================
+
+O64_Driver::O64_Driver()
+ :_NumRegisteredComponents(COMPONENT_first),
+ _CurrentWN(NULL)
+{
+ MEM_POOL_Initialize(&_DriverPool, "DriverPool", FALSE);
+ MEM_POOL_Initialize(&_LocalPool, "LocalMemPool", FALSE);
+
+ MEM_POOL_Push(&_DriverPool);
+
+ _ComponentDescriptorList.NumOfComponents = COMPONENT_last;
+ _ComponentDescriptorList.ComponentDescriptors = (O64_ComponentDescriptor
**)
+ MEM_POOL_Alloc(&_DriverPool,
sizeof(O64_ComponentDescriptor*)*COMPONENT_last);
+
+}
+
+O64_Driver::~O64_Driver()
+{
+ MEM_POOL_Pop(&_DriverPool);
+ MEM_POOL_Delete(&_DriverPool);
+ MEM_POOL_Delete(&_LocalPool);
+}
+
+O64_Driver*
+O64_Driver::GetInstance()
+{
+ if (_theInstance) return _theInstance;
+
+ _theInstance = new O64_Driver();
+ return _theInstance;
+
+}
+
+void
+O64_Driver::Destroy()
+{
+ if (_theInstance) delete _theInstance;
+ _theInstance = NULL;
+
+}
+
+
+// register the component descriptor into the list maintained in O64_Driver
+void
+O64_Driver::RegisterComponent(O64_COMPONENT component, const
O64_ComponentDescriptor* desc)
+{
+ Is_True((COMPONENT_first <= component) &&
+ (component < COMPONENT_last) && desc, ("RegisterComponent: invalid
component"));
+
+ _ComponentDescriptorList.ComponentDescriptors[component]=
+ const_cast<O64_ComponentDescriptor*>(desc);
+
+ _NumRegisteredComponents++;
+}
+
+// Setup O64_Option class to store option values from the command line.
+// The new option handling mechnisam co-exists with the old option handling
+// mechnisam. The option is changed to " ", if it is handled by new mechnisam.
+void
+O64_Driver::SetupOptions(INT32 argc, char ** argv)
+{
+ FmtAssert(_NumRegisteredComponents == COMPONENT_last,
+ ("[O64_Driver] Component Registration Error"));
+
+ _CurrentOption = CXX_NEW(O64_Option, &_DriverPool);
+
+ Is_True(_CurrentOption, ("[O64_Driver] Null CurrentOption"));
+
+ for (INT32 i = 1; i < argc; i++) {
+ if (argv[i] != NULL) {
+ if (_CurrentOption->ProcessComponentOption_(argv[i]))
+ argv[i] = " ";
+ }
+ }
+}
+
+
+TRACE_OPTION_KIND
+O64_Driver::GetTraceKind()
+{
+ return _CurrentOption->GetEnumOption<TRACE_OPTION_KIND>(COMPONENT_driver,
OPT_trace);
+}
+
+BOOL
+O64_Driver::TimeStats()
+{
+ return _CurrentOption->GetBoolOption(COMPONENT_driver, OPT_driver_tstats);
+}
+
+BOOL
+O64_Driver::MemStats()
+{
+ return _CurrentOption->GetBoolOption(COMPONENT_driver, OPT_driver_mstats);
+}
+
+// =======================================================================
+// O64_Option Implementation
+// =======================================================================
+
+// names for trace option (OVK_ENUM)
+// keep in sync with TRACE_OPTION_KIND definition in common/util/flags.h
+const char * TraceOptionNames[] =
+{
+ "none",
+ "info",
+ "min",
+ "med",
+ "max"
+};
+
+// names for dump option (OVK_ENUM)
+// keep in sync with DUMP_KIND definition in common/util/flags.h
+const char * DumpOptionNames[] =
+{
+ "none",
+ "ir",
+ "cfg",
+ "max"
+};
+
+// option descriptors for common options
+static const O64_OptionDescriptor
+CommonOptionDescriptors[OPT_common_last+1] =
+{
+ // O64_OPTION_DESC(id, description, name, abbreviation, kind, visibility,
changed by pragma,
+ // default value, minimal value, maximal value)
+
+ O64_OPTION_DESC(OPT_enable, "enable the component",
+ "ENABLE", "enable", OVK_NONE, OV_INTERNAL, false, false, 0,
0),
+ O64_OPTION_DESC(OPT_disable, "disable the component",
+ "DISABLE", "disable", OVK_NONE, OV_INTERNAL, false, false, 0,
0),
+
+ // O64_ENUM_OPTION_DESC(id, description, name, abbreviation, visibility,
changed by pragma,
+ // default value, minimal value, maximal value, default set value, names
for each enum).
+ // default value is when the option is not specified;
+ // default set value is when the option is specified with "".
+ // for example, if dump_before is not specified, the following option is
DUMP_none;
+ // if -COMP:db is specified, this option is DUMP_ir;
+ // if -COMP:db=ir is specified, this option is DUMP_ir;
+ // if -COMP:db=cfg is specified, this option is DUMP_cfg;
+
+ O64_ENUM_OPTION_DESC(OPT_dump_before, "dump [ir|cfg|max] before the
component",
+ "dump_before", "db",OV_INTERNAL, false, DUMP_none, DUMP_none,
DUMP_maximal,
+ DUMP_ir, DumpOptionNames),
+ O64_ENUM_OPTION_DESC(OPT_dump_after, "dump [ir|cfg|max] after the
component",
+ "dump_after", "da", OV_INTERNAL, false, DUMP_none, DUMP_none,
DUMP_maximal,
+ DUMP_ir, DumpOptionNames),
+ O64_ENUM_OPTION_DESC(OPT_trace, "dump out trace information
[info|min|med|max]",
+ "TRACE", "trace", OV_INTERNAL, false, TRACE_none, TRACE_none,
TRACE_maximal,
+ TRACE_maximal, TraceOptionNames),
+ O64_OPTION_DESC(OPT_stats, "gather and print component statistics",
+ "STATS", "stats", OVK_NONE, OV_INTERNAL, false, false, 0, 0),
+ O64_OPTION_DESC(OPT_common_last, "end marker", 0, 0, OVK_INVALID,
OV_INTERNAL, false, 0, 0, 0)
+};
+
+O64_Option::O64_Option()
+ :_CommonOptionDescriptors(CommonOptionDescriptors)
+{
+
+ _ComponentDescriptorList =
O64_Driver::GetInstance()->GetComponentDescriptorList();
+ _MemPool = O64_Driver::GetInstance()->GetDriverMemPool();
+
+ _Options = (_Value **) MEM_POOL_Alloc(_MemPool, sizeof(_Value*)
*GetNumOfComponents_());
+
+ for (UINT32 component = 0; component < GetNumOfComponents_(); ++component)
+ {
+ UINT32 option;
+ for (option = 0; GetOptionName_(component, option); ++option);
+
+
+ _Options[component] = (_Value *) MEM_POOL_Alloc(_MemPool,
sizeof(_Value) * option);
+
+ for (option = 0; GetOptionName_(component, option); ++option)
+ {
+ Is_True(GetOptionDescriptor_(component, option)->OptionId ==
option,
+ ("Inconsistent option declaration"));
+ SetDefaultOption_(component, option);
+ }
+ }
+
+}
+
+O64_Option::~O64_Option()
+{
+ for (INT32 component = 0; component < GetNumOfComponents_(); ++component)
+ {
+ for (INT32 option = 0; GetOptionName_(component, option); ++option)
+ {
+ // free the strings that are generated by STRDUP
+ if (GetOptionKind_(component, option) == OVK_NAME ||
+ GetOptionKind_(component, option) == OVK_SELF)
+ if (_Options[component][option]._StringVal)
+ free(_Options[component][option]._StringVal);
+ }
+
+ MEM_POOL_FREE(_MemPool, _Options[component]);
+ }
+
+ MEM_POOL_FREE(_MemPool, _Options);
+}
+
+//
+// Process component-option
+// "-component-name:option-list"
+//
+bool
+O64_Option::ProcessComponentOption_(char * component_options)
+{
+ if (!component_options) return true;
+
+ char * option_dup, * option_start;
+ option_dup = STRDUP(component_options);
+ option_start = STRTOK(option_dup, "-:");
+ if (!STRCMP("OPTIONS", option_start)) {
+ PrintOptionsUsage_();
+ return true;
+ }
+
+ while (option_start != NULL) {
+ bool component_found = false;
+ for (INT32 component = 0; component <= GetNumOfComponents_();
++component)
+ if (!STRCASECMP(GetComponentName_(component), option_start)) {
+ option_start = STRTOK(NULL, "-:");
+ if (ProcessOptionList_(component, option_start))
+ component_found = true;
+ }
+
+ if (component_found) return true;
+ option_start = STRTOK(NULL, "-:");
+ }
+
+ return false;
+};
+
+// Process a list of options
+// option['+'option]*
+//
+bool
+O64_Option::ProcessOptionList_(INT32 component, char* options)
+{
+ if (!options) return true;
+
+ bool return_value = true;
+
+ char *option_dup, *option_start;
+
+ option_dup = STRDUP(options);
+ option_start = STRTOK(option_dup, "+");
+ while (option_start != NULL) {
+ if (!STRCASECMP("OPTIONS", option_start)) {
+ PrintOptionsUsage_(component);
+ }
+ else {
+ if (!ProcessOption_(component, option_start))
+ return_value = false;
+ }
+ option_start = STRTOK(NULL, "+");
+ }
+ return return_value;
+}
+
+// Process a option
+// option_name[=option_value]
+bool
+O64_Option::ProcessOption_(INT32 component, char *option_str)
+{
+ if (!option_str) return true;
+
+ char *option_dup, *option_start;
+ char *option_name, *option_value;
+
+ option_dup = STRDUP(option_str);
+ option_start = STRCHR(option_dup, '=');
+ if (!option_start) {
+ option_name = option_dup;
+ option_value = NULL;
+ }
+ else {
+ option_value = option_start+1;
+ *option_start = '\0';
+ option_name = option_dup;
+ }
+
+ bool option_found = false;
+ for (INT32 option = 0; GetOptionName_(component, option); ++option) {
+ if (!STRCASECMP(GetOptionName_(component, option), option_name) ||
+ !STRCASECMP(GetOptionAbbrev_(component, option), option_name)) {
+ if (SetOptionValue_(component, option, option_value))
+ option_found = true;
+ break;
+ }
+ }
+ if (!option_found) {
+ FmtAssert(false, ("invalid option"));
+ return false;
+ }
+
+ return true;
+}
+
+// set up the default value for options
+//
+bool
+O64_Option::SetOptionValue_(INT32 component, INT32 option, char * option_value)
+{
+ bool return_value = false;
+
+ INT32 int32_value;
+ INT64 int64_value;
+ UINT32 uint32_value;
+ UINT64 uint64_value;
+
+ switch (GetOptionKind_(component, option)) {
+ case OVK_NONE:
+ Is_True(!option_value, ("OVK_NONE should have no value"));
+ _Options[component][option]._BoolVal = true;
+ break;
+ case OVK_BOOL:
+ Is_True(option_value, ("OVK_BOOL should have value"));
+ if (!STRCASECMP(option_value, "ON") ||
+ !STRCASECMP(option_value, "YES") ||
+ !STRCASECMP(option_value, "TRUE"))
+ _Options[component][option]._BoolVal = true;
+ else if (!STRCASECMP(option_value, "OFF") ||
+ !STRCASECMP(option_value, "NO") ||
+ !STRCASECMP(option_value, "FALSE"))
+ _Options[component][option]._BoolVal = false;
+ else
+ {
+ Is_True(false,
+ ("wrong option value \"%s\", use ON|OFF or YES|NO or
TRUE|FALSE",
+ option_value));
+ return false;
+ }
+ break;
+ case OVK_INT32:
+ Is_True(option_value, ("OVK_INT32 should have value"));
+ int32_value = (INT32) STRTOL(option_value, (char**) NULL, 0);
+ Is_True((GetMinVal_(component, option) <= int32_value) &&
+ (GetMaxVal_(component, option) >= int32_value), ("OVK_INT32
out of range"));
+ _Options[component][option]._IntVal = int32_value;
+ break;
+ case OVK_INT64:
+ Is_True(option_value, ("OVK_INT64 should have value"));
+ int64_value = (INT64) STRTOL(option_value, (char**) NULL, 0);
+ Is_True((GetMinVal_(component, option) <= int64_value) &&
+ (GetMaxVal_(component, option) >= int64_value), ("OVK_INT64
out of range"));
+ _Options[component][option]._IntVal = int64_value;
+ break;
+ case OVK_UINT32:
+ Is_True(option_value, ("OVK_UINT32 should have value"));
+ uint32_value = (UINT32) STRTOL(option_value, (char**) NULL, 0);
+ Is_True((GetMinVal_(component, option) <= uint32_value) &&
+ (GetMaxVal_(component, option) >= uint32_value), ("OVK_UINT32
out of range"));
+ _Options[component][option]._UIntVal = uint32_value;
+ break;
+ case OVK_UINT64:
+ Is_True(option_value, ("OVK_UINT64 should have value"));
+ uint64_value = (UINT64) STRTOL(option_value, (char**) NULL, 0);
+ Is_True((GetMinVal_(component, option) <= uint64_value) &&
+ (GetMaxVal_(component, option) >= uint64_value), ("OVK_UINT64
out of range"));
+ _Options[component][option]._UIntVal = uint64_value;
+ break;
+ case OVK_NAME:
+ case OVK_SELF:
+ Is_True(option_value, ("OVK_NAME should have value"));
+ _Options[component][option]._StringVal = STRDUP(option_value);
+ break;
+ case OVK_LIST:
+ break;
+ case OVK_ENUM:
+ if (option_value)
+ {
+ const INT32 from = GetMinVal_(component, option);
+ const INT32 to = GetMaxVal_(component, option);
+ const char * const * names = GetValueNames_ (component, option);
+ INT32 enumval;
+ for (enumval = from; enumval <= to; ++enumval)
+ if (!STRCASECMP(option_value, names[enumval - from])) {
+ _Options[component][option]._EnumVal = enumval;
+ break;
+ }
+ if (enumval > to)
+ {
+ Is_True(false, ("Unrecognized enumerator option %s",
option_value));
+ return false;
+ }
+ }
+ else
+ _Options[component][option]._EnumVal =
GetDefaultSetVal_(component, option);
+ break;
+ default:
+ Is_True(false, ("Unimplemented option kind"));
+ break;
+ }
+}
+
+// the print name for each option kind
+//
+static const char *
+KindName(OPTION_KIND kind)
+{
+ // Keep this array in sync with the OPTION_KIND in flags.h
+ static const char * const kind_name[OVK_ENUM - OVK_INVALID+1] = {
+ "",
+ "OVK_NONE",
+ "OVK_BOOL",
+ "OVK_INT32",
+ "OVK_INT64",
+ "OVK_UINT32",
+ "OVK_UINT64",
+ "OVK_NAME",
+ "OVK_SELF",
+ "OVK_LIST",
+ "OVK_OBSOLETE",
+ "OVK_OLD_COUNT",
+ "OVK_REPLACED",
+ "OVK_UNIMPLEMENTED",
+ "OVK_ENUM"
+ };
+
+ return ((kind >= OVK_INVALID ) && (kind <= OVK_ENUM))
+ ? kind_name[kind]
+ : "???";
+}
+
+// print out the option usage
+//
+void
+O64_Option::PrintOptionsUsage_()
+{
+ // print the usage for common options
+ PrintOptionsUsage_(GetNumOfComponents_());
+
+ for (INT32 component = 0; component < GetNumOfComponents_(); ++component)
+ PrintOptionsUsage_(component);
+}
+
+void
+O64_Option::PrintOptionsUsage_(INT32 component)
+{
+ bool common = (component == GetNumOfComponents_());
+
+ INT32 first = common ? OPT_common_first : OPT_component_first;
+ INT32 last = common ? OPT_common_last : INT32_MAX;
+
+ fprintf(stderr, "[%s]", GetComponentName_(component));
+ fprintf(stderr, " %s",
+ common ? "Common options" :
GetComponentDescriptor_(component)->CompDesc);
+ fprintf(stderr, "\n");
+
+ if (common) component = 0;
+ const char * name, * abbr;
+ int max_name_len = 1, max_abbr_len=1;
+ for (INT32 option = first; (option < last) && (name =
GetOptionName_(component, option));
+ ++option)
+ {
+ abbr = GetOptionAbbrev_(component, option);
+ size_t name_len = STRLEN(name);
+ size_t abbr_len = STRLEN(abbr);
+ if (name_len > max_name_len)
+ max_name_len = (int)name_len;
+ if (abbr_len > max_abbr_len)
+ max_abbr_len = (int) abbr_len;
+ }
+ for (INT32 option = first; (option < last) && (name =
GetOptionName_(component, option));
+ ++option)
+ {
+ abbr = GetOptionAbbrev_(component, option);
+ fprintf(stderr, " o %-*s", max_name_len, name);
+ fprintf(stderr, " : %-*s", max_abbr_len, abbr);
+ fprintf(stderr, " : %-6s : %s",
+ KindName(GetOptionKind_(component, option)),
+ GetOptionDescriptor_(component, option)->OptionDesc);
+ fprintf(stderr, "\n");
+ }
+}
+
+// =======================================================================
+// O64_ComponentInitializer Implementation
+// =======================================================================
+
+O64_ComponentInitializer::O64_ComponentInitializer(
+ O64_COMPONENT component, const O64_ComponentDescriptor* comp_descr)
+{
+ O64_Driver::GetInstance()->RegisterComponent(component, comp_descr);
+}
Added: trunk/osprey/be/com/comp_driver.h
===================================================================
--- trunk/osprey/be/com/comp_driver.h (rev 0)
+++ trunk/osprey/be/com/comp_driver.h 2010-11-09 01:49:24 UTC (rev 3390)
@@ -0,0 +1,477 @@
+/*
+
+ Copyright (C) 2010, Hewlett-Packard Development Company, L.P. All Rights
Reserved.
+
+ Open64 is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License,
+ or (at your option) any later version.
+
+ Open64 is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301, USA.
+
+*/
+
+
+/* ====================================================================
+ *
+ * Module: comp_driver.h
+ *
+ * Revision history:
+ * Oct-10 - Original Version
+ *
+ * Description:
+ * Define the base class to support phase componentization.
+ *
+ * Exported classes:
+ * O64_Driver
+ * O64_Option
+ * O64_ComponentInitializer
+ *
+ * SEE ALSO:
+ * common/util/flags.h (option kind)
+ * common/com/comp_decl.h (O64_Component)
+ *
+ * ====================================================================
+ */
+
+#ifndef comp_driver_INCLUDED
+#define comp_driver_INCLUDED
+
+#include "defs.h"
+#include "flags.h"
+#include "resource.h"
+#include "mempool.h"
+#include "errors.h"
+#include "wn.h"
+
+struct O64_OptionDescriptor
+{
+ O64_OptionDescriptor(INT32 id, const char * desc,
+ const char * name, const char * abbrev, OPTION_KIND kind,
+ OPTION_VISIBILITY visibility, BOOL pragma, INT64 def,
+ INT64 min, INT64 max):
+ OptionId(id), OptionDesc(desc),
+ OptionName(name), OptionAbbrev(abbrev), OptionKind(kind),
+ OptionVisibility(visibility), OptionPragma(pragma),
+ DefaultVal(def), MinVal(min), MaxVal(max),
+ OptionSet(false) { Is_True(kind != OVK_ENUM, ("kind should not be
OVK_ENUM")); };
+
+ template <typename enum_type>
+ O64_OptionDescriptor(INT32 id, const char * desc,
+ const char * name, const char * abbrev,
+ OPTION_VISIBILITY visibility, BOOL pragma,
+ enum_type def, enum_type min, enum_type max, enum_type defset,
+ const char * const * valuenames):
+ OptionId(id), OptionDesc(desc),
+ OptionName(name), OptionAbbrev(abbrev), OptionKind(OVK_ENUM),
+ OptionVisibility(visibility), OptionPragma(pragma),
+ DefaultVal(def), MinVal(min), MaxVal(max),
+ DefaultSetVal(defset), ValueNames(valuenames),
+ OptionSet(false) {};
+
+ INT32 OptionId;
+ OPTION_KIND OptionKind;
+ OPTION_VISIBILITY OptionVisibility;
+ BOOL OptionPragma; /* options pragma */
+
+ const char * OptionName;
+ const char * OptionAbbrev;
+ const char * OptionDesc;
+ BOOL OptionSet; /* the value is set from command line */
+
+ INT64 DefaultVal;
+ INT64 MinVal;
+ INT64 MaxVal;
+ INT64 DefaultSetVal; /* only for OVK_ENUM */
+ const char * const* ValueNames; /* only for OVK_ENUM */
+};
+
+struct O64_ComponentDescriptor
+{
+ const char* CompDesc; /* component description */
+ const char* CompName; /* component name */
+ const O64_OptionDescriptor* OptionDescriptors; /* option descriptors */
+};
+
+#define O64_OPTION_DESC(id, desc, name, abbrev, kind, visibility, pragma, def,
min, max) \
+ O64_OptionDescriptor(id, desc, name, abbrev, kind, visibility, pragma,
def, min, max)
+
+#define O64_ENUM_OPTION_DESC(id, desc, name, abbrev, visibility, pragma, \
+ def, min, max, defset, valuename) \
+ O64_OptionDescriptor(id, desc, name, abbrev, visibility, pragma, \
+ def, min, max, defset, valuename)
+
+#define O64_COMPONENT_DESC(desc, name, opt_desc) desc, name, opt_desc
+
+struct O64_ComponentDescriptorList
+{
+ INT32 NumOfComponents;
+ O64_ComponentDescriptor ** ComponentDescriptors;
+};
+
+class O64_ComponentInitializer
+{
+public:
+ O64_ComponentInitializer(O64_COMPONENT, const O64_ComponentDescriptor*) ;
+};
+
+class O64_Option; /* forward declaration */
+
+class O64_Driver
+{
+public:
+
+ enum OPTION
+ {
+ OPT_driver_first = OPT_component_first,
+ OPT_driver_tstats = OPT_driver_first,
+ OPT_driver_mstats,
+ OPT_driver_last
+ };
+ static const O64_ComponentDescriptor ComponentDescriptor;
+ static const O64_OptionDescriptor
+ OptionDescriptors[OPT_driver_last - OPT_driver_first + 1];
+
+ static O64_Driver* GetInstance();
+ static void Destroy();
+
+public:
+
+ void RegisterComponent(O64_COMPONENT, const
O64_ComponentDescriptor*);
+ O64_Option* GetCurrentOption () { return _CurrentOption; };
+ MEM_POOL * GetDriverMemPool() { return &_DriverPool;};
+ MEM_POOL * GetLocalMemPool() { return &_LocalPool; };
+ WN* GetCurrentWN() { return _CurrentWN; };
+ void SetCurrentWN(WN* wn){ _CurrentWN = wn; };
+ void SetupOptions(INT32 argc, char ** argv);
+ TRACE_OPTION_KIND GetTraceKind();
+ BOOL TimeStats();
+ BOOL MemStats();
+
+ O64_ComponentDescriptorList* GetComponentDescriptorList()
+ { return &_ComponentDescriptorList; };
+
+private:
+
+ static O64_Driver* _theInstance;
+
+ O64_ComponentDescriptorList _ComponentDescriptorList; /* all component
descriptors */
+ MEM_POOL _DriverPool; /* for data structure across
component boundary */
+ MEM_POOL _LocalPool; /* for each component */
+ INT64 _NumRegisteredComponents;
+
+ O64_Option* _CurrentOption;
+ WN* _CurrentWN;
+
+ O64_Driver();
+ ~O64_Driver();
+
+ friend class O64_Component;
+ friend class O64_Option;
+
+};
+
+struct O64_DriverInitializer
+{
+ O64_DriverInitializer() { O64_Driver::GetInstance(); }
+ ~O64_DriverInitializer() { O64_Driver::Destroy(); }
+};
+
+// ====================================================================
+// Command line O64 option format
+//
+// command-line-options ::= component-option[' 'component-option]*
+// component-option ::= '-'component-name':'option-list
+// option-list ::= option['+'option]*
+// option ::= option-name['='option-values]
+// option-values ::= option-value[','option-value]*
+// component-name ::= ['A'-'Z']+
+// option-name ::= ['a'-'z'|'A'-'Z']+
+// option-value ::= signed integer | unsigned integer |
+// boolean | string | enum_value
+// boolean ::= 'TRUE' | 'FALSE' | 'true' | 'false' |
+// 'ON' | 'OFF' | 'on' | 'off' |
+// 'YES' | 'NO' | 'yes' | 'no'
+//
+// o component names are upper letter
+// o option names are case-insensitive
+// o '-OPTIONS' or '-component-name:OPTIONS' will print out the option
+// usage information.
+// =====================================================================
+
+class O64_Option
+{
+public:
+
+ O64_Option();
+ ~O64_Option();
+
+ BOOL GetBoolOption(INT32 component, INT32 option);
+ INT64 GetIntOption(INT32 component, INT32 option);
+ UINT64 GetUIntOption(INT32 component, INT32 option);
+ char * GetStringOption(INT32 component, INT32 option);
+ OPTION_LIST * GetListOption(INT32 component, INT32 option);
+ template <typename enum_ret>
+ enum_ret GetEnumOption(INT32 component, INT32 option);
+
+private:
+
+ union _Value
+ {
+ BOOL _BoolVal;
+ INT64 _IntVal;
+ UINT64 _UIntVal;
+ char * _StringVal;
+ OPTION_LIST * _ListVal;
+ INT32 _EnumVal;
+ };
+
+ INT32 GetNumOfComponents_() const;
+ const O64_ComponentDescriptor* GetComponentDescriptor_(INT32 component);
+ const O64_OptionDescriptor * GetOptionDescriptor_(INT32 component,
INT32 option);
+
+ const char * GetComponentName_(INT32 component);
+ const char * GetOptionName_ (INT32 component, INT32 option);
+ const char * GetOptionAbbrev_(INT32 component, INT32 option);
+ const char * GetOptionDesc_(INT32 component, INT32 option);
+ const OPTION_KIND GetOptionKind_(INT32 component, INT32 option);
+ INT64 GetDefaultVal_(INT32 component, INT32 option);
+ INT64 GetMinVal_(INT32 component, INT32 option);
+ INT64 GetMaxVal_(INT32 component, INT32 option);
+ BOOL GetOptionSet_(INT32 component, INT32 option);
+ const char * const* GetValueNames_(INT32 component, INT32 option);
+ INT64 GetDefaultSetVal_(INT32 component, INT32 option);
+ void SetDefaultOption_(INT32 component, INT32 option);
+
+ bool ProcessComponentOption_(char * options);
+ bool ProcessOptionList_(INT32 component, char* options);
+ bool ProcessOption_(INT32 component, char *value);
+ bool SetOptionValue_(INT32 component, INT32 option, char
*value);
+ void PrintOptionsUsage_();
+ void PrintOptionsUsage_(INT32 component);
+
+private:
+
+ _Value ** _Options; /* store value for each option for each
component */
+ MEM_POOL * _MemPool; /* point to O64_Driver's _DriverPool */
+
+ const O64_OptionDescriptor* _CommonOptionDescriptors;
+ const O64_ComponentDescriptorList * _ComponentDescriptorList; /* to
component descriptor list */
+
+ friend class O64_Driver;
+ friend class O64_Component;
+
+};
+
+// =======================================================================
+// O64_Option inline function implementations
+// =======================================================================
+
+inline const O64_ComponentDescriptor*
+O64_Option::GetComponentDescriptor_(INT32 component)
+{
+ return _ComponentDescriptorList->ComponentDescriptors[component];
+}
+
+inline const char *
+O64_Option::GetComponentName_(INT32 component)
+{
+ if (component == GetNumOfComponents_())
+ return "COMMON";
+ else
+ return GetComponentDescriptor_(component)->CompName;
+}
+
+inline BOOL
+O64_Option::GetBoolOption(INT32 component, INT32 option)
+{
+ OPTION_KIND kind = GetOptionKind_(component, option);
+ Is_True(kind == OVK_NONE || kind == OVK_BOOL,
+ ("GetBoolOption invalid option"));
+ return _Options[component][option]._BoolVal;
+}
+
+template <typename enum_type>
+inline enum_type
+O64_Option::GetEnumOption(INT32 component, INT32 option)
+{
+ OPTION_KIND kind = GetOptionKind_(component, option);
+ Is_True(kind == OVK_ENUM, ("GetEnumOption invalid option"));
+ return enum_type (_Options[component][option]._EnumVal);
+}
+
+inline INT64
+O64_Option::GetIntOption(INT32 component, INT32 option)
+{
+ OPTION_KIND kind = GetOptionKind_(component, option);
+ Is_True(kind == OVK_INT32 || kind == OVK_INT64,
+ ("GetIntOption invalid option"));
+ return _Options[component][option]._IntVal;
+}
+
+inline UINT64
+O64_Option::GetUIntOption(INT32 component, INT32 option)
+{
+ OPTION_KIND kind = GetOptionKind_(component, option);
+ Is_True(kind == OVK_UINT32 || kind == OVK_UINT64,
+ ("GetUIntOption invalid option"));
+ return _Options[component][option]._UIntVal;
+}
+
+inline char *
+O64_Option::GetStringOption(INT32 component, INT32 option)
+{
+ OPTION_KIND kind = GetOptionKind_(component, option);
+ Is_True(kind == OVK_NAME || kind == OVK_SELF,
+ ("GetStingOption invalid option"));
+ return _Options[component][option]._StringVal;
+}
+
+inline OPTION_LIST *
+O64_Option::GetListOption(INT32 component, INT32 option)
+{
+ OPTION_KIND kind = GetOptionKind_(component, option);
+ Is_True(kind == OVK_LIST, ("GetListOption invalid option"));
+ return _Options[component][option]._ListVal;
+}
+
+inline const OPTION_KIND
+O64_Option::GetOptionKind_(INT32 component, INT32 option)
+{
+ return GetOptionDescriptor_(component,option)->OptionKind;
+}
+
+inline const O64_OptionDescriptor *
+O64_Option::GetOptionDescriptor_(INT32 component, INT32 option)
+{
+ // The common options are from _CommonOptionDescriptors
+ if ((option < OPT_common_last ) || (option == OPT_common_last)
+ && (component == GetNumOfComponents_()))
+ return &_CommonOptionDescriptors[option];
+ else
+ return
+ &GetComponentDescriptor_(component)->OptionDescriptors[option -
OPT_common_last];
+}
+
+inline INT32
+O64_Option::GetNumOfComponents_() const
+{
+ return _ComponentDescriptorList->NumOfComponents;
+}
+
+inline void
+O64_Option::SetDefaultOption_(INT32 component, INT32 option)
+{
+ switch (GetOptionKind_(component, option))
+ {
+ case OVK_NONE:
+ case OVK_BOOL:
+ _Options[component][option]._BoolVal=
+ (UINT32) GetDefaultVal_(component, option);
+ break;
+
+ case OVK_INT32:
+ _Options[component][option]._IntVal=
+ (INT32) GetDefaultVal_(component, option);
+ break;
+
+ case OVK_INT64:
+ _Options[component][option]._IntVal =
+ GetDefaultVal_(component, option);
+
+ case OVK_UINT32:
+ _Options[component][option]._UIntVal =
+ (UINT32) GetDefaultVal_(component, option);
+ break;
+
+ case OVK_UINT64:
+ _Options[component][option]._UIntVal =
+ (UINT64) GetDefaultVal_(component, option);
+ break;
+
+ case OVK_NAME:
+ case OVK_SELF:
+ _Options[component][option]._StringVal = NULL;
+ break;
+
+ case OVK_LIST:
+ _Options[component][option]._ListVal = NULL;
+ break;
+
+ case OVK_ENUM:
+ _Options[component][option]._EnumVal =
+ (INT32) GetDefaultVal_(component, option);
+ break;
+ default:
+ Is_True(false, ("Unimplemented option kind"));
+ break;
+ }
+};
+
+inline INT64
+O64_Option::GetDefaultVal_(INT32 component, INT32 option)
+{
+ return GetOptionDescriptor_(component, option)->DefaultVal;
+}
+
+inline const char *
+O64_Option::GetOptionName_ (INT32 component, INT32 option)
+{
+ return GetOptionDescriptor_(component, option)->OptionName;
+}
+
+inline BOOL
+O64_Option::GetOptionSet_(INT32 component, INT32 option)
+{
+ return GetOptionDescriptor_(component, option)->OptionSet;
+}
+
+inline INT64
+O64_Option::GetMinVal_(INT32 component, INT32 option)
+{
+ return GetOptionDescriptor_(component, option)->MinVal;
+}
+
+inline INT64
+O64_Option::GetMaxVal_(INT32 component, INT32 option)
+{
+ return GetOptionDescriptor_(component, option)->MaxVal;
+}
+
+
+inline const char*
+O64_Option::GetOptionAbbrev_(INT32 component, INT32 option)
+{
+ return GetOptionDescriptor_(component, option)->OptionAbbrev;
+
+}
+
+inline const char *
+O64_Option::GetOptionDesc_(INT32 component, INT32 option)
+{
+ return GetOptionDescriptor_(component, option)->OptionDesc;
+}
+
+inline const char * const *
+O64_Option::GetValueNames_(INT32 component, INT32 option)
+{
+ Is_True(GetOptionKind_(component, option) == OVK_ENUM, ("should be
OVK_ENUM"));
+ return GetOptionDescriptor_(component, option)->ValueNames;
+}
+
+inline INT64
+O64_Option::GetDefaultSetVal_(INT32 component, INT32 option)
+{
+ Is_True(GetOptionKind_(component, option) == OVK_ENUM, ("should be
OVK_ENUM"));
+ return GetOptionDescriptor_(component, option)->DefaultSetVal;
+}
+
+#endif /* comp_driver_INCLUDED */
Added: trunk/osprey/common/com/comp_decl.cxx
===================================================================
--- trunk/osprey/common/com/comp_decl.cxx (rev 0)
+++ trunk/osprey/common/com/comp_decl.cxx 2010-11-09 01:49:24 UTC (rev
3390)
@@ -0,0 +1,165 @@
+/*
+
+ Copyright (C) 2010, Hewlett-Packard Development Company, L.P. All Rights
Reserved.
+
+ Open64 is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation; either version 2
+ of the License, or (at your option) any later version.
+
+ Open64 is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301, USA.
+
+*/
+
+/* ====================================================================
+ *
+ * Module: comp_decl.cxx
+ *
+ * Revision history:
+ * Oct-10 - Original Version
+ *
+ * Description:
+ * Implementation for O64_Component
+ *
+ * ====================================================================
+ */
+
+#include "comp_decl.h"
+#include "opt_wn.h"
+#include "glob.h"
+
+O64_Component::O64_Component(O64_COMPONENT component)
+{
+ _CurrentComponent = component;
+ _canBeDisabled = ComponentDisableable_(_CurrentComponent);
+ _Driver = O64_Driver::GetInstance();
+ _CurrentOption = _Driver->GetCurrentOption();
+
+ _enable = _CurrentOption->GetBoolOption(_CurrentComponent, OPT_enable);
+ _disable = _CurrentOption->GetBoolOption(_CurrentComponent, OPT_disable);
+
+ if (_disable) return;
+
+ _LocalMemPool = _Driver->GetLocalMemPool();
+ MEM_POOL_Push(_LocalMemPool);
+
+ _doStats = _CurrentOption->GetBoolOption(_CurrentComponent, OPT_stats);
+ _TraceKind =
_CurrentOption->GetEnumOption<TRACE_OPTION_KIND>(_CurrentComponent, OPT_trace);
+ _doTrace = (_TraceKind != TRACE_none);
+
+ ProcessDumpOptions_(
+ _CurrentOption->GetEnumOption<DUMP_KIND>(_CurrentComponent,
OPT_dump_before));
+
+ // driver level trace
+ StartEndMessage_(true);
+}
+
+O64_Component::~O64_Component()
+{
+ if (_disable) return;
+
+ ProcessDumpOptions_(
+ _CurrentOption->GetEnumOption<DUMP_KIND>(_CurrentComponent,
OPT_dump_after));
+
+ // driver-level trace
+ StartEndMessage_(false);
+
+ MEM_POOL_Pop(_LocalMemPool);
+
+ // TODO: invalidate data structure (e.g., cfg) when they are ready
+
+}
+
+void
+O64_Component::StartEndMessage_(bool isStart)
+{
+ if (_Driver->GetTraceKind() != TRACE_maximal) return;
+
+ fprintf(TFile, "[DRIVER]%s %-10s",
+ isStart ? "starting" : "finished",
+ _CurrentOption->GetComponentName_(_CurrentComponent));
+
+ if (isStart)
+ fprintf(TFile, " for \"%s\" ", Cur_PU_Name);
+
+ fprintf(TFile, "\n");
+}
+
+void
+O64_Component::ProcessDumpOptions_(DUMP_KIND dumpKind)
+{
+ bool dump_ir = false, dump_cfg = false;
+
+ switch(dumpKind) {
+ case DUMP_none:
+ return;
+ case DUMP_ir:
+ dump_ir = true;
+ break;
+ case DUMP_cfg:
+ dump_cfg = true;
+ break;
+ case DUMP_maximal:
+ dump_ir = true;
+ dump_cfg = true;
+ break;
+ default:
+ break;
+ }
+
+ if (dump_ir) {
+ fdump_tree(TFile, _Driver->GetCurrentWN());
+ }
+}
+
+static O64_COMPONENT NonDisableAbles[] =
+{
+ COMPONENT_driver,
+ COMPONENT_invalid /* sentinel */
+};
+
+bool
+O64_Component::LookupDisableable_(INT32 comp)
+{
+ int index = 0;
+
+ while(NonDisableAbles[index] != COMPONENT_invalid)
+ {
+ if (NonDisableAbles[index] == comp)
+ return false;
+ ++index;
+ }
+ return true;
+}
+
+bool
+O64_Component::ComponentDisableable_(O64_COMPONENT comp)
+{
+ // prepare lookup table (only once)
+ //
+ static bool tableInitialized = false;
+ static bool table[COMPONENT_last];
+
+ if (!tableInitialized)
+ {
+ Is_True(COMPONENT_first == 0, ("COMPONENT_first should be zero"));
+
+ for (INT32 comp = COMPONENT_first; comp < COMPONENT_last; ++comp)
+ table[comp] = LookupDisableable_(comp);
+
+ tableInitialized = true;
+ }
+
+ // lookup
+ return table[comp];
+}
+
+
Added: trunk/osprey/common/com/comp_decl.h
===================================================================
--- trunk/osprey/common/com/comp_decl.h (rev 0)
+++ trunk/osprey/common/com/comp_decl.h 2010-11-09 01:49:24 UTC (rev 3390)
@@ -0,0 +1,87 @@
+/*
+
+ Copyright (C) 2010, Hewlett-Packard Development Company, L.P. All Rights
Reserved.
+
+ Open64 is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation; either version 2
+ of the License, or (at your option) any later version.
+
+ Open64 is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301, USA.
+
+*/
+
+/* ====================================================================
+ *
+ * Module: comp_decl.h
+ *
+ * Revision history:
+ * Oct-10 - Original Version
+ *
+ * Description:
+ * Define the base O64_Component class to support phase componentization.
+ *
+ * Exported classes:
+ * O64_Component
+ *
+ * SEE ALSO:
+ * be/com/comp_driver.h (OptionDescriptor, O64_Driver)
+ *
+ * ====================================================================
+ */
+
+#ifndef comp_decl_INCLUDED
+#define comp_decl_INCLUDED
+
+#include "defs.h"
+#include "flags.h"
+#include "comp_driver.h"
+#include "mempool.h"
+#include "wn.h"
+
+class O64_Component
+{
+protected:
+
+ O64_COMPONENT _CurrentComponent;
+ O64_Driver* _Driver;
+ MEM_POOL* _LocalMemPool; /* local memory pool */
+ O64_Option* _CurrentOption; /* option handling */
+
+ bool _enable;
+ bool _disable;
+ bool _canBeDisabled;
+ bool _doStats;
+ bool _doTrace; /* whether to print trace information */
+ TRACE_OPTION_KIND _TraceKind;
+
+ bool _invalidCFG; /* CFG needs to be invalidated after this
opt */
+ bool _invalidSSA; /* SSA needs to be invalidated after this
opt */
+
+ void StartEndMessage_(bool);
+ void ProcessDumpOptions_(DUMP_KIND);
+
+ bool LookupDisableable_(INT32 comp);
+ bool ComponentDisableable_(O64_COMPONENT comp);
+
+public:
+
+ O64_Component(O64_COMPONENT component);
+ ~O64_Component();
+
+ O64_Option* GetCurrentOption () { return _CurrentOption; }
+
+};
+
+// Declare the public interface for each component
+// extern void OPT_Perform();
+
+#endif /* comp_decl_INCLUDED */
Modified: trunk/osprey/common/com/config.h
===================================================================
--- trunk/osprey/common/com/config.h 2010-11-04 02:23:28 UTC (rev 3389)
+++ trunk/osprey/common/com/config.h 2010-11-09 01:49:24 UTC (rev 3390)
@@ -946,6 +946,27 @@
#define Is_Target_ISA_I1Plus() (0)
#endif
+#ifndef STRTOK
+#define STRTOK(a,b) strtok(a,b)
+#endif
+#ifndef STRDUP
+#define STRDUP(a) strdup(a)
+#endif
+#ifndef STRCMP
+#define STRCMP(a,b) strcmp(a,b)
+#endif
+#ifndef STRCASECMP
+#define STRCASECMP(a,b) strcasecmp(a,b)
+#endif
+#ifndef STRLEN
+#define STRLEN(a) strlen(a)
+#endif
+#ifndef STRTOL
+#define STRTOL(a,b,c) strtol(a,b,c)
+#endif
+#ifndef STRCHR
+#define STRCHR(a,b) strchr(a,b)
+#endif
#ifdef __cplusplus
}
#endif
Modified: trunk/osprey/common/util/flags.h
===================================================================
--- trunk/osprey/common/util/flags.h 2010-11-04 02:23:28 UTC (rev 3389)
+++ trunk/osprey/common/util/flags.h 2010-11-09 01:49:24 UTC (rev 3390)
@@ -1,5 +1,7 @@
/*
+ Copyright (C) 2010, Hewlett-Packard Development Company, L.P. All Rights
Reserved.
+
Copyright (C) 2000, 2001 Silicon Graphics, Inc. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it
@@ -162,6 +164,11 @@
* OVK_UNIMPLEMENTED Option is unimplemented.
* OVK_REPLACED Option is obsolete, replaced by another,
* named by its ODESC_variable field.
+ * OVK_ENUM Options takes string value, which should be
+ * one of the names defined for a enum, defaulting to
+ * the specified default value. It also has a default
+ * set value, which is used when a "" string is passed
+ * to the option.
* OVK_COUNT Dummy value used to mark end of option
* descriptor array.
* TODO: 64-bit option values not yet implemented.
@@ -317,7 +324,8 @@
*/
OVK_REPLACED, /* Option is obsolete, replaced by another */
OVK_UNIMPLEMENTED, /* Option is unimplemented */
-
+ OVK_ENUM,
+
OVK_COUNT=63 /* end of list marker */
} OPTION_KIND;
@@ -433,6 +441,47 @@
extern void Save_or_restore_options(char *, INT32, BOOL);
+typedef enum
+{
+ OPT_invalid = -1,
+ OPT_common_first = 0,
+ OPT_enable = OPT_common_first,
+ OPT_disable,
+ OPT_dump_before,
+ OPT_dump_after,
+ OPT_trace,
+ OPT_stats,
+ OPT_common_last,
+ OPT_component_first = OPT_common_last
+
+} O64_COMMON_OPTION;
+
+typedef enum
+{
+ TRACE_none = 0,
+ TRACE_info,
+ TRACE_minimal,
+ TRACE_medium,
+ TRACE_maximal
+} TRACE_OPTION_KIND;
+
+typedef enum
+{
+ DUMP_none =0,
+ DUMP_ir,
+ DUMP_cfg,
+ DUMP_maximal
+} DUMP_KIND;
+
+typedef enum
+{
+ COMPONENT_invalid = -1,
+ COMPONENT_first = 0,
+ COMPONENT_driver = COMPONENT_first,
+ COMPONENT_last
+
+} O64_COMPONENT;
+
#ifdef __cplusplus
}
#endif
Modified: trunk/osprey/driver/OPTIONS
===================================================================
--- trunk/osprey/driver/OPTIONS 2010-11-04 02:23:28 UTC (rev 3389)
+++ trunk/osprey/driver/OPTIONS 2010-11-09 01:49:24 UTC (rev 3390)
@@ -357,6 +357,8 @@
% Basic option groups:
% See opt_actions.c::Process_Ofast if you change the -OPT: item.
+-OPTIONS ; ALL be "-OPTIONS"
+ "print out all be option usage"
-OPT:%s Process_Opt_Group(optargs); ALL CMP,ipap
"-OPT:%s"
"option group to control optimization"
-OPT:unroll_level=n ; ALL be ""
@@ -405,7 +407,8 @@
"equivalent to -HP:"
-HUGEPAGE Process_Hugepage_Default(); ALL be ""
"equivalent to -HP"
-
+-DRIVER:%s ; ALL be "-DRIVER:%s"
+ "options for internal use in driver"
#ifndef KEY
-MP:%s Process_Mp_Group(optargs); ALL NONE ""
""
------------------------------------------------------------------------------
The Next 800 Companies to Lead America's Growth: New Video Whitepaper
David G. Thomson, author of the best-selling book "Blueprint to a
Billion" shares his insights and actions to help propel your
business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev
_______________________________________________
Open64-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/open64-devel