aboutsummaryrefslogtreecommitdiff
path: root/tools
AgeCommit message (Collapse)Author
2014-02-26NoExitRuntimeAlon Zakai
2013-12-04boilerplate for ExpandI64PassAlon Zakai
2013-11-20pnacl-benchmark - an ad-hoc tool to benchmark PNaCl translation-related stuff.Eli Bendersky
For now benchmarks reading/parsing/LLVM IR forming from PNaCl bitcode BUG=None R=stichnot@chromium.org Review URL: https://codereview.chromium.org/76973002
2013-11-07Factor out bitcode parser from pnacl-bcanalyzer.Karl Schimpf
Factors out bitcode parser from pnacl-bcanalyzer, so that it can also be used for PNaCl bitcode to bitcode rewriters. BUG= https://code.google.com/p/nativeclient/issues/detail?id=3720 R=jvoung@chromium.org Review URL: https://codereview.chromium.org/48623003
2013-10-23Remove obsolete bitcode wrapper codeDerek Schuff
We are using our own bitcode reader now, and no longer need this. R=jvoung@chromium.org, kschimpf@google.com BUG=cleanup Review URL: https://codereview.chromium.org/32943005
2013-10-16Add PNaClSjLjEH pass to implement C++ exception handling using ↵Mark Seaborn
setjmp()+longjmp() There are two parts to this: * PNaClSjLjEH.cpp expands out the "invoke", "landingpad" and "resume" instructions, modifying the control flow to use setjmp(). * ExceptionInfoWriter.cpp lowers landingpads' clause lists to data that PNaCl's C++ runtime library will interpret. This part will be reused when we drop the SjLj part and create a stable ABI for zero-cost EH. This pass isn't enabled in PNaClABISimplify yet: I'll do that in a separate change. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3696 TEST=*.ll tests (also tested end-to-end: plumbing for this will follow later) Review URL: https://codereview.chromium.org/24777002
2013-09-16Use ARM TTI in "opt" to make up for missing LE32 TTI.Jan Voung
Since we deleted the rewrite of ARM -> LE32 in the bitcode reader, opt is unable to look up a TTI to transform switch(c) { case 1: x = <const1>; break; case 2: x = <const2>; break; ... } into a lookup table to get x from c. This causes a regression in pnacl-llc's size (which has lots of switch statements). Fake the target lookup in opt for now. Eventually we should look into making target info for le32. BUG=https://code.google.com/p/nativeclient/issues/detail?id=2554 TEST= trybot http://chromegw.corp.google.com/i/tryserver.nacl/builders/nacl-toolchain-linux-pnacl-x86_64/builds/887 http://chromegw.corp.google.com/i/tryserver.nacl/builders/nacl-toolchain-mac-pnacl-x86_32/builds/842 R=dschuff@chromium.org Review URL: https://codereview.chromium.org/23551013
2013-09-13Report fatal translator errors to the browserDerek Schuff
Install a fatal error handler for the translator, which stores the error string, signals an error to the RPC thread, and terminates the thread (instead of terminating the whole program). This will cause the error to go to the Javascript console in Chrome BUG= https://code.google.com/p/nativeclient/issues/detail?id=3519 R=jvoung@chromium.org Review URL: https://codereview.chromium.org/23753003
2013-09-13Localize the le32 -> ARM hack to the LTO module for bitcode linking.Jan Voung
Only the bitcode linker via gold / lto module cares about le32 being a target w/ a real backend. LTOModule/LTOCodeGenerator is interested in having a real target to know the name mangling and assembly notation conventions (e.g., what's the prefix for private symbols). This removes the hack from the bitcode reader so that tools like llvm-dis are not affected and nonfinal pexes can still say that they are "le32". This is still not pretty, but it's better than polluting the BitcodeReader, especially if certain tools check what llvm-dis returns, and this doesn't require making a dummy backend just for name mangling and asm conventions. BUG=https://code.google.com/p/nativeclient/issues/detail?id=2554 TEST= trybots http://chromegw.corp.google.com/i/tryserver.nacl/builders/nacl-toolchain-linux-pnacl-x86_32/builds/826 http://chromegw.corp.google.com/i/tryserver.nacl/builders/nacl-toolchain-mac-pnacl-x86_32/builds/830 http://chromegw.corp.google.com/i/tryserver.nacl/builders/nacl-toolchain-linux-pnacl-x86_64/builds/876 R=dschuff@chromium.org Review URL: https://codereview.chromium.org/23619038
2013-08-30PNaCl bitcode: Remove handling of USELIST blocksMark Seaborn
These blocks are never generated by the PNaCl bitcode writer. The code for generating them was removed when BitcodeWriter.cpp was copied to produce NaClBitcodeWriter.cpp in 5712db994c8a4abb8c2512fb2900650f8335af66. The same wasn't done when BitcodeReader.cpp was copied to produce NaClBitcodeReader.cpp, so we do this now. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3590 TEST=PNaCl toolchain trybots Review URL: https://codereview.chromium.org/23598005
2013-08-28Handle pointer conversions for call instructions.Karl Schimpf
This also should complete the changes associated with removing pointer cast instructions from the PNaCl bitcode file. BUG= https://code.google.com/p/nativeclient/issues/detail?id=3544 R=dschuff@chromium.org, jvoung@chromium.org Review URL: https://codereview.chromium.org/23482002
2013-08-26Revert LOCALMODs in gold plugin and libLTO related to bitcode shared objects ↵Derek Schuff
and symbol wrapping This reverts the local modifications to the gold plugin and liblto for bitcode shared objects and for symbol wrapping, neither of which are used or tested anymore. It depends on a corresponding change to the linker plugin API. R=eliben@chromium.org, jvoung@chromium.org BUG= https://code.google.com/p/nativeclient/issues/detail?id=3520 Review URL: https://codereview.chromium.org/22831032
2013-08-14Allow record-level printing by pnacl-bcanalyzer.Karl Schimpf
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3627 R=jvoung@chromium.org Review URL: https://codereview.chromium.org/23060004
2013-08-13Add pnacl-llc CMake dependency on LLVMNaClTransforms.JF Bastien
Some CMake builds fail to build without it. It's probably a race. R=jvoung@chromium.org Review URL: https://codereview.chromium.org/23002005
2013-08-13Add NaClBitReader library dependencies to pnacl-freeze.Karl Schimpf
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3626 R=jvoung@chromium.org Review URL: https://codereview.chromium.org/23072004
2013-08-07Add the new @llvm.nacl.atomic.fence.all intrinsicJF Bastien
This is a follow-up to: https://codereview.chromium.org/22240002/ And requires the Clang changes from: https://codereview.chromium.org/22294002/ This new intrinsic represents ``asm("":::"~{memory}")`` as well as ``__sync_synchronize()``, and in IR it corresponds to a sequentially-consistent fence surrounded by ``call void asm sideeffect "", "~{memory}"()``. R=jvoung@chromium.org TEST= ninja check-all BUG= https://code.google.com/p/nativeclient/issues/detail?id=3475 Review URL: https://codereview.chromium.org/22474008
2013-08-07Revert localmod for bitcode linking speedup (different fix upstream).Jan Voung
Original localmod: https://codereview.chromium.org/10808021/ which fixes some quadratic behavior. Xiaofei Wan fixed the quadratic behavior upstream differently, via a series of commits around: http://llvm.org/viewvc/llvm-project?view=revision&revision=181104 and it is actually faster: ~7 seconds to link pnacl-llc w/ just the upstream fix ~11 seconds to link with localmod (used to be ~120 seconds w/ quadratic behavior) BUG=http://code.google.com/p/nativeclient/issues/detail?id=2883 TEST= trybots: http://chromegw.corp.google.com/i/tryserver.nacl/builders/nacl-toolchain-linux-pnacl-x86_64/builds/784 R=eliben@chromium.org Review URL: https://codereview.chromium.org/22509002
2013-08-01Remove the inttoptr dependency from load instructions.Karl Schimpf
Elides inttoptr casts used (exclusively) in load instructions when PNaClVersion=2. This is an incremental start on removing the inttoptr instruction from the PNaCl wire format (See issue 3544 for more information on the strategy of removing ptrtoint). Also modifies PNaCl bitcode reader/writer to accept PNaClVersion=1 as supported, and PNaClVersion=2 as unsupported but readable (allowing pnacl-freeze and pnacl-thaw to work on such files). Also allows command-line option --pnacl-version for setting PNaClVersion in the PNaCl bitcode writer. Also fixes some problems on PNaCl bitcode headers, using common support to determine when the read/written PNaCl bitcode file is valid. BUG= https://code.google.com/p/nativeclient/issues/detail?id=3544 R=jvoung@chromium.org Review URL: https://codereview.chromium.org/5812155903377408
2013-07-31Copy (strdup) a command-line arg to avoid use-after-free.Jim Stichnoth
There may be a better way to handle this that avoids leaking the command-line arguments. BUG= https://code.google.com/p/nativeclient/issues/detail?id=3605 R=dschuff@chromium.org Review URL: https://codereview.chromium.org/21375003
2013-07-30Rewrite ``asm("":::"memory")`` to ``fence seq_cst``JF Bastien
This is often used as a compiler barrier and should "just work" in user code. BUG= https://code.google.com/p/nativeclient/issues/detail?id=2345 R=eliben@chromium.org TEST= (cd ./pnacl/build/llvm_x86_64 && ninja check-all) Review URL: https://codereview.chromium.org/21178002
2013-07-25More pnacl-llc cleanups.Eli Bendersky
Focus on nacl_file and its interface with pnacl-llc.cpp; nacl_file as a name no longer makes sense, and neither do the comments describing it - so rename it. Also cleanup the interface a bit, and use more LLVM-y stuff instead of new data types. BUG=None R=dschuff@chromium.org, jfb@chromium.org Review URL: https://codereview.chromium.org/20186002
2013-07-23More cleanups of pnacl-llc.Eli Bendersky
Simplifying code, style, removing unnecessary code & includes, etc. BUG=None R=jfb@chromium.org Review URL: https://codereview.chromium.org/19808004
2013-07-19Switch to the upstream way to measure IR parsing time, since we have 3.3 nowEli Bendersky
BUG=https://code.google.com/p/nativeclient/issues/detail?id=3349 R=stichnot@chromium.org Review URL: https://codereview.chromium.org/19500012
2013-07-18Merge remote-tracking branch 'origin/master'Eli Bendersky
2013-07-16Make it compileEli Bendersky
2013-07-15Merge commit '7dfcb84fc16b3bf6b2379713b53090757f0a45f9'Eli Bendersky
Conflicts: docs/LangRef.rst include/llvm/CodeGen/CallingConvLower.h include/llvm/IRReader/IRReader.h include/llvm/Target/TargetMachine.h lib/CodeGen/CallingConvLower.cpp lib/IRReader/IRReader.cpp lib/IRReader/LLVMBuild.txt lib/IRReader/Makefile lib/LLVMBuild.txt lib/Makefile lib/Support/MemoryBuffer.cpp lib/Support/Unix/PathV2.inc lib/Target/ARM/ARMBaseInstrInfo.cpp lib/Target/ARM/ARMISelLowering.cpp lib/Target/ARM/ARMInstrInfo.td lib/Target/ARM/ARMSubtarget.cpp lib/Target/ARM/ARMTargetMachine.cpp lib/Target/Mips/CMakeLists.txt lib/Target/Mips/MipsDelaySlotFiller.cpp lib/Target/Mips/MipsISelLowering.cpp lib/Target/Mips/MipsInstrInfo.td lib/Target/Mips/MipsSubtarget.cpp lib/Target/Mips/MipsSubtarget.h lib/Target/X86/X86FastISel.cpp lib/Target/X86/X86ISelDAGToDAG.cpp lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86InstrControl.td lib/Target/X86/X86InstrFormats.td lib/Transforms/IPO/ExtractGV.cpp lib/Transforms/InstCombine/InstCombineCompares.cpp lib/Transforms/Utils/SimplifyLibCalls.cpp test/CodeGen/X86/fast-isel-divrem.ll test/MC/ARM/data-in-code.ll tools/Makefile tools/llvm-extract/llvm-extract.cpp tools/llvm-link/CMakeLists.txt tools/opt/CMakeLists.txt tools/opt/LLVMBuild.txt tools/opt/Makefile tools/opt/opt.cpp
2013-07-15Clean up some duplicated and/or unused code in pnacl-llc.Eli Bendersky
No functionality change. BUG=None R=jvoung@chromium.org Review URL: https://codereview.chromium.org/19235002
2013-07-15Run the LLVM IR verifier just once in pnacl-llc.Eli Bendersky
By default, using the path inherited from llc, the verifier is run twice. We only need it to run once right after reading the bitcode in and before the ABI verifier runs. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3553 R=jvoung@chromium.org Review URL: https://codereview.chromium.org/18920004
2013-07-13Concurrency support for PNaCl ABIJF Bastien
Add portable support for concurrency in PNaCl's ABI: - Promote volatile to atomic. - Promote all memory ordering to sequential consistency. - Rewrite all atomic operations to frozen NaCl intrinsics for pexe. - Rewrite atomic intrinsics to LLVM instructions for translation. This change also adds documentation to the PNaCl language reference, as well as tests where it makes sense. A future CL could clean up more of our code which mentions atomics, volatiles, memory orderings. Multiple reviewers because this is a big patch: - eliben: LLVM-fu and ResolvePNaClIntrinsics. - dschuff: ABI stability. - mseaborn: ABI stability. - sehr: Tron-duty (fight for the user's programs to work). BUG= https://code.google.com/p/nativeclient/issues/detail?id=3475 R=dschuff@chromium.org, eliben@chromium.org, sehr@google.com TEST= (cd ./pnacl/build/llvm_x86_64; ninja check-all) && ./pnacl/test.sh test-x86-32 && ./pnacl/test.sh test-x86-64 && ./pnacl/test.sh test-arm && ./pnacl/test.sh test-x86-32-sbtc && ./pnacl/test.sh test-x86-64-sbtc && ./pnacl/test.sh test-arm-sbtc Review URL: https://codereview.chromium.org/17777004
2013-07-10Add option to pnacl-abicheck to handle pnacl bitcodeDerek Schuff
This allows running the utility on finalized/frozen pexes. R=kschimpf@google.com BUG=none Review URL: https://codereview.chromium.org/18884003
2013-07-03Cleanup output of pnacl-bcanalyzer.Karl Schimpf
(1) Fix spacing in header of record histogram so that columns line up. (2) Only print 8 operands per line in the dump. Keeps lines from getting too long. BUG=None R=jvoung@chromium.org, mseaborn@chromium.org Review URL: https://codereview.chromium.org/18147006
2013-07-02Simplify globals in PNaCl wire format based on normalized constants.Karl Schimpf
Generates simple global variable records, followed by list of records defining byte initialization and relocations. BUG= https://code.google.com/p/nativeclient/issues/detail?id=3504 R=mseaborn@chromium.org Review URL: https://codereview.chromium.org/18111002
2013-07-01Cleanup of pnacl-llc.Eli Bendersky
Removing some code and comments that aren't needed. BUG=None R=jvoung@chromium.org Review URL: https://codereview.chromium.org/18348005
2013-06-29PNaCl ABI: Remove use of @llvm.memset.p0i8.i64 (64-bit intrinsic variant)Mark Seaborn
Convert calls to this intrinsic to use the 32-bit variant instead. Do the same for the memcpy and memmove intrinsics too. Change the PNaCl ABI verifier to check this argument. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3530 TEST=*.ll tests + PNaCl toolchain trybots Review URL: https://codereview.chromium.org/18226003
2013-06-28Revert the IntrinsicLowering logic that preserves externals for intrinsics.Eli Bendersky
This is no longer required, following our recent PNaCl ABI cleanups. BUG=None R=jvoung@chromium.org Review URL: https://codereview.chromium.org/18031017
2013-06-28Teach llvm-nm to read PNaCl bitcode.Eli Bendersky
BUG=None R=jvoung@chromium.org Review URL: https://codereview.chromium.org/18153009
2013-06-28Change header include for llvm.nacl.target.arch in pnacl-llc.Jan Voung
Have nacl-file include "pnacl.h" from the nacl repo, instead of from the toolchain's standard include locations, so that it can be moved out of the toolchain tarball and not advertise it to normal developers. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3525 R=mseaborn@chromium.org Review URL: https://codereview.chromium.org/18178007
2013-06-25PNaCl ABI: Disallow various operations on the i1 typeMark Seaborn
Disallow i1 on loads/stores and require the conversions to i8 to be explicit. Add a pass, PromoteI1Ops, that adds the conversions. (Load/store on i1 occur in practice in small_tests for some boolean globals.) Disallow i1 for most arithmetic/comparison operations since these aren't very useful and it's a nuisance for a code generator to have to support these. I haven't seen these occur in practice, but PromoteI1Ops nevertheless expands them. We still allow and/or/xor on i1 because these do occur in practice, and they're less of a nuisance to handle because they never overflow: no truncation to 1 bit is required, unlike with adds. Restrict the type of alloca's argument. Clang always uses i32 here. Disallow i1 in switch instructions. Clang doesn't generate i1 switches for booleans. Move CopyLoadOrStoreAttrs() helper into a header to reuse. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3490 TEST=PNaCl toolchain trybots + GCC torture tests + Spec2k Review URL: https://codereview.chromium.org/17356011
2013-06-24Force user to provide -mptriple to pnacl-llc.Eli Bendersky
We already always provide -mptriple to pnacl-llc, and it's nonsensical to run it without it because pexe don't contain a triple. BUG=None R=dschuff@chromium.org Review URL: https://codereview.chromium.org/17617002
2013-06-24Simplify representation of forward value references in bitcode.Karl Schimpf
Simplify instruction records by adding concept of a forward type reference map that maps ValueID's to types. Used to generate forward reference types for instruction arguments that need a type because the forward reference has not yet been generated. BUG= https://code.google.com/p/nativeclient/issues/detail?id=3507 R=jvoung@chromium.org, mseaborn@chromium.org Review URL: https://codereview.chromium.org/16963004
2013-06-20Clean-up pnacl-llc a bit, now that it's truly PNaCl-only.Eli Bendersky
No changes in functionality. Specific cleanups: * Use OwningPtr instead of bare pointer for FDOut * Command-line help should say pnacl-llc instead of a generic llvm message * Remove support for "skip module" feature * Remove some LOCALMOD comments * Add link to issue for TODO about timing IR parsing BUG=None R=jvoung@chromium.org, kschimpf@google.com Review URL: https://codereview.chromium.org/17101032
2013-06-19Rewrite llvm.flt.rounds to "1" for now, and disallow llvm.flt.rounds.Jan Voung
Until there is an intrinsic to *set* the rounding mode, this intrinsic to *get* the rounding mode isn't so useful. Separately we will add a test that for each platform, the initial rounding mode is "1" (round to nearest). That is the case right now for x86, ARM, and MIPS. (see https://codereview.chromium.org/16785003/) BUG=https://code.google.com/p/nativeclient/issues/detail?id=3491 R=mseaborn@chromium.org Review URL: https://codereview.chromium.org/17229007
2013-06-17PNaCl: Turn on ABI verifier by default in sandboxed translatorMark Seaborn
Change pnacl-llc.cpp to enable the verifier. This causes two problems which we fix: * The ABI check for declared-but-not-defined functions fails in streaming mode. Fixing this would involve changing the bitcode reader. For now, disable this check when in streaming mode. Add a flag to PNaClABIVerifyModule. * ARM's GlobalMerge pass modifies functions' global variable references to use ConstantExprs that the ABI checker rejects. Address this by disabling GlobalMerge for now. GlobalMerge does not provide much benefit at the moment anyway, because, with the FlattenGlobals pass applied, GlobalMerge doesn't merge variables with alignment >1. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3465 TEST=PNaCl toolchain trybots Review URL: https://codereview.chromium.org/17190002
2013-06-17When running pnacl-llc sandboxed, force input to always be PNaCl bitcode.Karl Schimpf
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3469 R=jvoung@chromium.org Review URL: https://codereview.chromium.org/17295004
2013-06-12Revert llc to upstreamEli Bendersky
tools/llc is reset to revision 279b9184c2ff4fea93b198a3519b8cb3a1d8d195 from which the last LLVM merge was made. NaCl-specific files are removed. BUG=None R=jvoung@chromium.org Review URL: https://codereview.chromium.org/16510008
2013-06-12Remove a stray usage of NACL_SRPCEli Bendersky
BUG=None R=dschuff@chromium.org Review URL: https://codereview.chromium.org/16663008
2013-06-11Clean-up shared-library related code from pnacl-llc.Eli Bendersky
BUG=None R=dschuff@chromium.org Review URL: https://codereview.chromium.org/16123031
2013-06-10Fix the ninja build by adding naclbitreader to dependencies.Jim Stichnoth
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3485 R=kschimpf@google.com Review URL: https://codereview.chromium.org/16146012
2013-06-10Merge the NACL_SRPC preprocessor flag into __native_client__Eli Bendersky
We always build the sandboxed translator with NACL_SRPC. BUG=None R=jvoung@chromium.org Review URL: https://codereview.chromium.org/16667016
2013-06-07Fix Mispelled local variable in llc.Karl Schimpf
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3479 R=dschuff@chromium.org Review URL: https://codereview.chromium.org/16440008