diff options
author | Nick Bofferding <bofferdn@us.ibm.com> | 2012-06-21 11:38:42 -0500 |
---|---|---|
committer | A. Patrick Williams III <iawillia@us.ibm.com> | 2012-06-22 11:30:36 -0500 |
commit | d3751578876a7a37d29d6492c2c02a2039547f2d (patch) | |
tree | 42e5a67817a2689b878aefa218c7b16aec3a3e6a /src/usr/targeting/common/xmltohb/xmltohb.pl | |
parent | 5b191e6a866b23f825045f610d8d6e7cbeab1588 (diff) | |
download | talos-hostboot-d3751578876a7a37d29d6492c2c02a2039547f2d.tar.gz talos-hostboot-d3751578876a7a37d29d6492c2c02a2039547f2d.zip |
Support to control enum optimization in targeting compiler output
- Fix for defect CMVC 841050, CQ SW148881
- Added command line support for enum optimization flag
- Updated verbose output to indicate flag value
- Updated help documentation wrt flag
- Updated enum space computation to take flag into account
Change-Id: I78c1ec1443da6d4b1a8977b2ca65aa41b84504e5
Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/1231
Reviewed-by: Andrew J. Geissler <andrewg@us.ibm.com>
Tested-by: Jenkins Server
Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/usr/targeting/common/xmltohb/xmltohb.pl')
-rwxr-xr-x | src/usr/targeting/common/xmltohb/xmltohb.pl | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/src/usr/targeting/common/xmltohb/xmltohb.pl b/src/usr/targeting/common/xmltohb/xmltohb.pl index 8c058e8c9..a097ab54d 100755 --- a/src/usr/targeting/common/xmltohb/xmltohb.pl +++ b/src/usr/targeting/common/xmltohb/xmltohb.pl @@ -67,6 +67,7 @@ my $cfgImgOutputFile = "./targeting.bin"; my $cfgHelp = 0; my $cfgMan = 0; my $cfgVerbose = 0; +my $cfgShortEnums = 1; GetOptions("hb-xml-file:s" => \$cfgHbXmlFile, "src-output-dir:s" => \$cfgSrcOutputDir, @@ -74,6 +75,7 @@ GetOptions("hb-xml-file:s" => \$cfgHbXmlFile, "fapi-attributes-xml-file:s" => \$cfgFapiAttributesXmlFile, "img-output-file:s" => \$cfgImgOutputFile, "vmm-consts-file:s" => \$cfgVmmConstsFile, + "short-enums!" => \$cfgShortEnums, "help" => \$cfgHelp, "man" => \$cfgMan, "verbose" => \$cfgVerbose ) || pod2usage(-verbose => 0); @@ -99,6 +101,7 @@ if($cfgVerbose) print STDOUT "Source output dir = $cfgSrcOutputDir\n"; print STDOUT "Image output dir = $cfgImgOutputDir\n"; print STDOUT "VMM constants file = $cfgVmmConstsFile\n"; + print STDOUT "Short enums = $cfgShortEnums\n"; } ################################################################################ @@ -2221,16 +2224,17 @@ sub enumSpace { # Enum needs at least one byte $maxEnumVal++; } - my $space = ceil(log($maxEnumVal+1) / (8 * log(2))); - # NOTE: enable the code below to force the code generator to generated - # 4-byte enums instead of optimized enums. Note there are a few + # NOTE: Pass --noshort-enums command line option to force the code generator + # to generate 4-byte enums instead of optimized enums. Note there are a few # enumerations (primarily in PNOR header, etc.) that do not change size. # That is intentional in order to make this the single point of control over # binary compatibility. Note that both FSP and Hostboot should always have # this policy in sync. Also note that when Hostboot and FSP use optimized - # enums, they must also be compiled with -fshort-enums - # $space = 4; + # enums, they must also be compiled with -fshort-enums compile option + + my $space = ($cfgShortEnums == 1) ? + ceil(log($maxEnumVal+1) / (8 * log(2))) : 4; return $space; } @@ -3611,6 +3615,20 @@ Indicates the file containing the base virtual address of the attributes (default is src/include/usr/vmmconst.h). Only used when generating the PNOR targeting image +=item B<--short-enums> + +Writes optimially sized enumerations to binary image (default). Any code which +uses the binary image or enumerations from generated header files must also +be compiled with short enumeration support. This saves at minimum 0 and at most +3 bytes for each enumeration value. + +=item B<--noshort-enums> + +Writes maximum sized enumerations to binary image (default). Any code which +uses the binary image or enumerations from generated header files must not +be compiled with short enumeration support. Every enumeration will consume 4 +bytes by default + =item B<--verbose> Prints out some internal workings |