Subzero: Change the name llvm2ice to the more appropriate pnacl-sz. Most of this is a mechanical change of 'llvm2ice' to 'pnacl-sz'. This is a convenient naming choice because both strings are the same length which minimizes the need for line length reformatting. Python variables needed to use pnacl_sz instead, and sometimes pnacl_sz_ . The IceConverter still uses LLVM2Ice naming, which is actually appropriate there since it actually converts LLVM IR into ICE. I will rename tests_lit/llvm2ice_tests/ in a separate CL, otherwise this CL will look misleadingly massive and no one will review it. BUG= none R=kschimpf@google.com Review URL: https://codereview.chromium.org/956123002
diff --git a/.gitignore b/.gitignore index 0d1d959..062ad19 100644 --- a/.gitignore +++ b/.gitignore
@@ -8,6 +8,6 @@ \#* # Ignore specific patterns at the top-level directory -/llvm2ice +/pnacl-sz /build/ /crosstest/Output/
diff --git a/Makefile.standalone b/Makefile.standalone index 5f652bd..afaec7e 100644 --- a/Makefile.standalone +++ b/Makefile.standalone
@@ -127,7 +127,7 @@ IceTimerTree.cpp \ IceTranslator.cpp \ IceTypes.cpp \ - llvm2ice.cpp \ + main.cpp \ PNaClTranslator.cpp ifndef MINIMAL @@ -143,23 +143,23 @@ IceParseInstsTest.cpp UNITTEST_OBJS = $(patsubst %.cpp, $(OBJDIR)/unittest/%.o, $(UNITTEST_SRCS)) -UNITTEST_LIB_OBJS = $(filter-out $(OBJDIR)/llvm2ice.o,$(OBJS)) +UNITTEST_LIB_OBJS = $(filter-out $(OBJDIR)/main.o,$(OBJS)) # Keep all the first target so it's the default. -all: $(OBJDIR)/llvm2ice make_symlink runtime +all: $(OBJDIR)/pnacl-sz make_symlink runtime # Creates symbolic link so that testing is easier. Also runs -# llvm2ice to verify that the defines flags have valid values, +# pnacl-sz to verify that the defines flags have valid values, # as well as describe the corresponding build attributes. -make_symlink: $(OBJDIR)/llvm2ice - rm -rf llvm2ice - ln -s $(OBJDIR)/llvm2ice +make_symlink: $(OBJDIR)/pnacl-sz + rm -rf pnacl-sz + ln -s $(OBJDIR)/pnacl-sz @echo "Build Attributes:" - @$(OBJDIR)/llvm2ice --build-atts + @$(OBJDIR)/pnacl-sz --build-atts .PHONY: all make_symlink runtime bloat -$(OBJDIR)/llvm2ice: $(OBJS) +$(OBJDIR)/pnacl-sz: $(OBJS) $(CXX) $(LDFLAGS) -o $@ $^ $(LLVM_LDFLAGS) \ -Wl,-rpath=$(abspath $(LIBCXX_INSTALL_PATH)/lib) @@ -202,7 +202,7 @@ @echo ================ Building Subzero runtime ================ ./pydir/build-runtime.py -v -check-lit: $(OBJDIR)/llvm2ice make_symlink +check-lit: $(OBJDIR)/pnacl-sz make_symlink LLVM_BIN_PATH=$(LLVM_BIN_PATH) \ BINUTILS_BIN_PATH=$(BINUTILS_BIN_PATH) \ $(LLVM_SRC_PATH)/utils/lit/lit.py -sv tests_lit @@ -232,12 +232,12 @@ -p1 -style=LLVM -i bloat: make_symlink - nm -C -S -l llvm2ice | \ - bloat/bloat.py --nm-output=/dev/stdin syms > build/llvm2ice.bloat.json - @echo See Subzero size breakdown in bloat/llvm2ice.bloat.html + nm -C -S -l pnacl-sz | \ + bloat/bloat.py --nm-output=/dev/stdin syms > build/pnacl-sz.bloat.json + @echo See Subzero size breakdown in bloat/pnacl-sz.bloat.html clean: - rm -rf llvm2ice *.o $(OBJDIR) build/llvm2ice.bloat.json + rm -rf pnacl-sz *.o $(OBJDIR) build/pnacl-sz.bloat.json clean-all: clean rm -rf build/
diff --git a/README.rst b/README.rst index e84dda9..2deea75 100644 --- a/README.rst +++ b/README.rst
@@ -32,23 +32,23 @@ configuration for performance testing the translator. ``MINIMAL=1`` attempts to minimize the size of the translator by compiling out everything unnecessary. -The result of the ``make`` command is the target ``llvm2ice`` in the current +The result of the ``make`` command is the target ``pnacl-sz`` in the current directory. -``llvm2ice`` +``pnacl-sz`` ------------ -The ``llvm2ice`` program parses a pexe or an LLVM bitcode file and translates it +The ``pnacl-sz`` program parses a pexe or an LLVM bitcode file and translates it into ICE (Subzero's intermediate representation). It then invokes the ICE translate method to lower it to target-specific machine code, optionally dumping the intermediate representation at various stages of the translation. The program can be run as follows:: - ../llvm2ice ./path/to/<file>.pexe - ../llvm2ice ./tests_lit/llvm2ice_tests/<file>.ll + ../pnacl-sz ./path/to/<file>.pexe + ../pnacl-sz ./tests_lit/pnacl-sz_tests/<file>.ll -At this time, ``llvm2ice`` accepts a number of arguments, including the +At this time, ``pnacl-sz`` accepts a number of arguments, including the following: ``-help`` -- Show available arguments and possible values. (Note: this @@ -105,12 +105,12 @@ make -f Makefile.standalone check -Assembling ``llvm2ice`` output as needed +Assembling ``pnacl-sz`` output as needed ---------------------------------------- -``llvm2ice`` can now produce a native ELF binary using ``-filetype=obj``. +``pnacl-sz`` can now produce a native ELF binary using ``-filetype=obj``. -``llvm2ice`` can also produce textual assembly code in a structure suitable for +``pnacl-sz`` can also produce textual assembly code in a structure suitable for input to ``llvm-mc``, using ``-filetype=asm`` or ``-filetype=iasm``. An object file can then be produced using the command::
diff --git a/bloat/README.chromium b/bloat/README.chromium index 26b7a36..4242842 100644 --- a/bloat/README.chromium +++ b/bloat/README.chromium
@@ -32,4 +32,4 @@ Local Modifications: webtreemap.{js,css} are used with no modifications. demo/demo.html -was used as the basis for llvm2ice.bloat.html. +was used as the basis for pnacl-sz.bloat.html.
diff --git a/bloat/llvm2ice.bloat.html b/bloat/pnacl-sz.bloat.html similarity index 96% rename from bloat/llvm2ice.bloat.html rename to bloat/pnacl-sz.bloat.html index b8575ec..2fceee2 100644 --- a/bloat/llvm2ice.bloat.html +++ b/bloat/pnacl-sz.bloat.html
@@ -1,7 +1,7 @@ <!DOCTYPE html> <head> <title>Subzero size breakdown</title> -<script src='../build/llvm2ice.bloat.json'></script> +<script src='../build/pnacl-sz.bloat.json'></script> <link rel='stylesheet' href='webtreemap.css'> <style> body {
diff --git a/pydir/crosstest.py b/pydir/crosstest.py index ffa78c0..ae3b50e 100755 --- a/pydir/crosstest.py +++ b/pydir/crosstest.py
@@ -102,7 +102,7 @@ asm_sz = os.path.join(args.dir, base_sz + '.sz.s') obj_sz = os.path.join(args.dir, base_sz + '.sz.o') obj_llc = os.path.join(args.dir, base + '.llc.o') - shellcmd(['../llvm2ice', + shellcmd(['../pnacl-sz', '-O' + args.optlevel, '-mattr=' + args.attr, '--target=' + args.target,
diff --git a/pydir/run-llvm2ice.py b/pydir/run-pnacl-sz.py similarity index 95% rename from pydir/run-llvm2ice.py rename to pydir/run-pnacl-sz.py index 31535b8..65eb22b 100755 --- a/pydir/run-llvm2ice.py +++ b/pydir/run-pnacl-sz.py
@@ -11,7 +11,7 @@ from utils import shellcmd def main(): - """Run the llvm2ice compiler on an llvm file. + """Run the pnacl-sz compiler on an llvm file. Takes an llvm input file, freezes it into a pexe file, converts it to a Subzero program, and finally compiles it. @@ -38,8 +38,8 @@ '(without generating a pexe), then ' + 'convert to Subzero') argparser.add_argument( - '--llvm2ice', required=False, default='./llvm2ice', metavar='LLVM2ICE', - help="Subzero translator 'llvm2ice'") + '--pnacl-sz', required=False, default='./pnacl-sz', metavar='PNACL-SZ', + help="Subzero translator 'pnacl-sz'") argparser.add_argument('--llvm-bin-path', required=False, default=None, metavar='LLVM_BIN_PATH', help='Path to LLVM executables ' + @@ -64,7 +64,7 @@ help='Trace command that generates ICE instructions') argparser.add_argument('--args', '-a', nargs=argparse.REMAINDER, default=[], - help='Remaining arguments are passed to llvm2ice') + help='Remaining arguments are passed to pnacl-sz') args = argparser.parse_args() llvm_bin_path = args.llvm_bin_path @@ -85,7 +85,7 @@ if not args.no_local_syms: cmd += ['--allow-local-symbol-tables'] cmd += ['|'] - cmd += [args.llvm2ice] + cmd += [args.pnacl_sz] if args.insts: # If the tests are based on '-verbose inst' output, force # single-threaded translation because dump output does not get
diff --git a/pydir/szbuild.py b/pydir/szbuild.py index cad4e7d..eaba32b 100755 --- a/pydir/szbuild.py +++ b/pydir/szbuild.py
@@ -121,7 +121,7 @@ entirely using Subzero, without using llc or linker tricks. This script uses file modification timestamps to determine whether llc and - Subzero re-translation are needed. It checks timestamps of llc, llvm2ice, + Subzero re-translation are needed. It checks timestamps of llc, pnacl-sz, and the pexe against the translated object files to determine the minimal work necessary. The --force option suppresses those checks and re-translates everything. @@ -169,8 +169,8 @@ sym_sz_unescaped = pexe_base_unescaped + '.sym.sz.txt' whitelist_sz = pexe_base + '.wl.sz.txt' whitelist_sz_unescaped = pexe_base_unescaped + '.wl.sz.txt' - llvm2ice = ( - '{root}/toolchain_build/src/subzero/llvm2ice' + pnacl_sz = ( + '{root}/toolchain_build/src/subzero/pnacl-sz' ).format(root=nacl_root) llcbin = 'llc' gold = 'le32-nacl-ld.gold' @@ -206,9 +206,9 @@ if (args.force or NewerThanOrNotThere(pexe, obj_sz) or - NewerThanOrNotThere(llvm2ice, obj_sz)): - # Run llvm2ice regardless of hybrid mode. - shellcmd([llvm2ice, + NewerThanOrNotThere(pnacl_sz, obj_sz)): + # Run pnacl-sz regardless of hybrid mode. + shellcmd([pnacl_sz, '-O' + opt_level, '-bitcode-format=pnacl', '-filetype=' + args.filetype,
diff --git a/src/IceGlobalInits.h b/src/IceGlobalInits.h index d51d587..8b06041 100644 --- a/src/IceGlobalInits.h +++ b/src/IceGlobalInits.h
@@ -72,7 +72,7 @@ virtual bool getSuppressMangling() const = 0; // Mangles name for cross tests, unless external and not defined locally - // (so that relocations accross llvm2ice and pnacl-llc will work). + // (so that relocations accross pnacl-sz and pnacl-llc will work). virtual IceString mangleName(GlobalContext *Ctx) const { return getSuppressMangling() ? Name : Ctx->mangleName(Name); }
diff --git a/src/IceTargetLowering.cpp b/src/IceTargetLowering.cpp index d2da333..3ea9e6d 100644 --- a/src/IceTargetLowering.cpp +++ b/src/IceTargetLowering.cpp
@@ -29,7 +29,7 @@ namespace { -// TODO(stichnot): Move this machinery into llvm2ice.cpp. +// TODO(stichnot): Move this machinery into main.cpp. namespace cl = llvm::cl; cl::opt<bool> DoNopInsertion("nop-insertion", cl::desc("Randomly insert NOPs"), cl::init(false));
diff --git a/src/Makefile b/src/Makefile index b6c9d0d..6f6d085 100644 --- a/src/Makefile +++ b/src/Makefile
@@ -1,7 +1,7 @@ SUBZERO_LEVEL := .. -TOOLNAME := llvm2ice +TOOLNAME := pnacl-sz LINK_COMPONENTS := support # This tool has no plugins, optimize startup time.
diff --git a/src/llvm2ice.cpp b/src/main.cpp similarity index 97% rename from src/llvm2ice.cpp rename to src/main.cpp index 8b73de8..604be3d 100644 --- a/src/llvm2ice.cpp +++ b/src/main.cpp
@@ -1,4 +1,4 @@ -//===- subzero/src/llvm2ice.cpp - Driver for testing ----------------------===// +//===- subzero/src/main.cpp - Driver for bitcode translation --------------===// // // The Subzero Code Generator // @@ -7,9 +7,11 @@ // //===----------------------------------------------------------------------===// // -// This file defines a driver that uses LLVM capabilities to parse a -// bitcode file and build the LLVM IR, and then convert the LLVM basic -// blocks, instructions, and operands into their Subzero equivalents. +// This file defines a driver for translating PNaCl bitcode into native code. +// It can either directly parse the binary bitcode file, or use LLVM routines to +// parse a textual bitcode file into LLVM IR and then convert LLVM IR into ICE. +// In either case, the high-level ICE is then compiled down to native code, as +// either an ELF object file or a textual asm file. // //===----------------------------------------------------------------------===//
diff --git a/tests_lit/lit.cfg b/tests_lit/lit.cfg index 3817ebb..5ac51d8 100644 --- a/tests_lit/lit.cfg +++ b/tests_lit/lit.cfg
@@ -69,28 +69,28 @@ # Find binutils tools. This is used for objdump. binutilsbinpath = os.path.abspath(os.environ.get('BINUTILS_BIN_PATH')) -# Define the location of the llvm2ice tool. -llvm2icetool = os.path.join(bin_root, 'llvm2ice') -llvm2iceatts = shellcmd(' '.join([llvm2icetool, '--build-atts']), +# Define the location of the pnacl-sz tool. +pnacl_sz_tool = os.path.join(bin_root, 'pnacl-sz') +pnacl_sz_atts = shellcmd(' '.join([pnacl_sz_tool, '--build-atts']), echo=False).split() -# Add build attributes of llvm2ice tool to the set of available features. -config.available_features.update(llvm2iceatts) +# Add build attributes of pnacl-sz tool to the set of available features. +config.available_features.update(pnacl_sz_atts) def if_cond_flag(Value): return '--cond=true' if Value else '--cond=false' # shell conditional commands. if_atts = [os.path.join(pydir, 'if.py')] -if_atts_cmd = if_atts + ['--have=' + att for att in llvm2iceatts] -ifl2i_atts_cmd = if_atts + [if_cond_flag('allow_llvm_ir' in llvm2iceatts), +if_atts_cmd = if_atts + ['--have=' + att for att in pnacl_sz_atts] +ifl2i_atts_cmd = if_atts + [if_cond_flag('allow_llvm_ir' in pnacl_sz_atts), '--command'] iflc2i_atts_cmd = if_atts + [if_cond_flag('allow_llvm_ir_as_input' - in llvm2iceatts), '--command'] + in pnacl_sz_atts), '--command'] -# Base command for running llvm2ice -llvm2ice_cmd = [os.path.join(pydir, 'run-llvm2ice.py'), - '--llvm2ice', llvm2icetool, +# Base command for running pnacl-sz +pnacl_sz_cmd = [os.path.join(pydir, 'run-pnacl-sz.py'), + '--pnacl-sz', pnacl_sz_tool, '--llvm-bin-path', llvmbinpath, '--binutils-bin-path', binutilsbinpath] @@ -102,13 +102,13 @@ config.substitutions.append(('%if', ' '.join(if_atts_cmd))) # Translate LLVM source for each compiler setup. -config.substitutions.append(('%p2i', ' '.join(llvm2ice_cmd))) -config.substitutions.append(('%l2i', ' '.join(ifl2i_atts_cmd + llvm2ice_cmd +config.substitutions.append(('%p2i', ' '.join(pnacl_sz_cmd))) +config.substitutions.append(('%l2i', ' '.join(ifl2i_atts_cmd + pnacl_sz_cmd + ['--llvm']))) -config.substitutions.append(('%lc2i', ' '.join(iflc2i_atts_cmd + llvm2ice_cmd +config.substitutions.append(('%lc2i', ' '.join(iflc2i_atts_cmd + pnacl_sz_cmd + ['--llvm-source']))) -config.substitutions.append(('%llvm2ice', llvm2icetool)) +config.substitutions.append(('%pnacl_sz', pnacl_sz_tool)) llvmbintools = [r"\bFileCheck\b", r"\bllvm-as\b", @@ -150,4 +150,4 @@ dbg('bin_root = %s' % bin_root) dbg('llvmbinpath = %s' % llvmbinpath) dbg('binutilsbinpath = %s' % binutilsbinpath) -dbg("Build attributes = %s" % llvm2iceatts) +dbg("Build attributes = %s" % pnacl_sz_atts)
diff --git a/tests_lit/llvm2ice_tests/mangle.ll b/tests_lit/llvm2ice_tests/mangle.ll index cae1d1f..1ba73f7 100644 --- a/tests_lit/llvm2ice_tests/mangle.ll +++ b/tests_lit/llvm2ice_tests/mangle.ll
@@ -1,4 +1,4 @@ -; Tests the Subzero "name mangling" when using the "llvm2ice --prefix" +; Tests the Subzero "name mangling" when using the "pnacl-sz --prefix" ; option. Also does a quick smoke test of -ffunction-sections. ; REQUIRES: allow_dump
diff --git a/tests_lit/parse_errs/insertextract-err.ll b/tests_lit/parse_errs/insertextract-err.ll index e20e114..206067a 100644 --- a/tests_lit/parse_errs/insertextract-err.ll +++ b/tests_lit/parse_errs/insertextract-err.ll
@@ -2,13 +2,13 @@ ; RUN: %if --need=allow_dump --command llvm-as < %s \ ; RUN: | %if --need=allow_dump --command pnacl-freeze \ -; RUN: | %if --need=allow_dump --command not %llvm2ice -notranslate \ +; RUN: | %if --need=allow_dump --command not %pnacl_sz -notranslate \ ; RUN: -build-on-read -allow-pnacl-reader-error-recovery \ ; RUN: | %if --need=allow_dump --command FileCheck %s ; RUN: %if --need=no_dump --command llvm-as < %s \ ; RUN: | %if --need=no_dump --command pnacl-freeze \ -; RUN: | %if --need=no_dump --command not %llvm2ice -notranslate \ +; RUN: | %if --need=no_dump --command not %pnacl_sz -notranslate \ ; RUN: -build-on-read -allow-pnacl-reader-error-recovery \ ; RUN: | %if --need=no_dump --command FileCheck %s --check-prefix=MIN
diff --git a/tests_lit/parse_errs/nacl-fake-intrinsic.ll b/tests_lit/parse_errs/nacl-fake-intrinsic.ll index eabb149..3312cfc 100644 --- a/tests_lit/parse_errs/nacl-fake-intrinsic.ll +++ b/tests_lit/parse_errs/nacl-fake-intrinsic.ll
@@ -1,12 +1,12 @@ ; Tests that we don't get fooled by a fake NaCl intrinsic. ; TODO(kschimpf) Find way to run this through p2i. Note: Can't do this -; currently because run-llvm2ice.py raises exception on error, +; currently because run-pnacl-sz.py raises exception on error, ; and output is lost. ; RUN: %if --need=allow_dump --command llvm-as < %s \ ; RUN: | %if --need=allow_dump --command pnacl-freeze \ ; RUN -allow-local-symbol-tables \ -; RUN: | %if --need=allow_dump --command not %llvm2ice -notranslate \ +; RUN: | %if --need=allow_dump --command not %pnacl_sz -notranslate \ ; RUN: -verbose=inst -build-on-read \ ; RUN: -allow-pnacl-reader-error-recovery \ ; RUN: -allow-local-symbol-tables \ @@ -15,7 +15,7 @@ ; RUN: %if --need=no_dump --command llvm-as < %s \ ; RUN: | %if --need=no_dump --command pnacl-freeze \ ; RUN -allow-local-symbol-tables \ -; RUN: | %if --need=no_dump --command not %llvm2ice -notranslate \ +; RUN: | %if --need=no_dump --command not %pnacl_sz -notranslate \ ; RUN: -verbose=inst -build-on-read \ ; RUN: -allow-pnacl-reader-error-recovery \ ; RUN: -allow-local-symbol-tables \