aboutsummaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)Author
2013-11-22Math.imulAlon Zakai
2013-11-22native phi pushingAlon Zakai
2013-11-22preparation for phi pushingAlon Zakai
2013-11-22update relooper and fix indentation and empty linesAlon Zakai
2013-11-22more mathopsAlon Zakai
2013-11-22fix getOpName - we have no problem with forward refsAlon Zakai
2013-11-22more debug infoAlon Zakai
2013-11-22note each instruction in a debug messageAlon Zakai
2013-11-22fail on invalid getOpName valuesAlon Zakai
2013-11-22improve pre-relooper branch parsingAlon Zakai
2013-11-22remove phi printing code, in preparation for pushing them back into branchesAlon Zakai
2013-11-21fix mathop return typeAlon Zakai
2013-11-21fix sitofp return typeAlon Zakai
2013-11-21fix sitofp castAlon Zakai
2013-11-21merge in CppBackend workAlon Zakai
2013-11-21do not expand tlsAlon Zakai
2013-11-21keep alignment infoAlon Zakai
2013-11-21align varargs stack writes to the proper 4-byte boundariesAlon Zakai
2013-11-21disable pnacl internalization of everything except for _start, as emscripten ↵Alon Zakai
supports arbitrary entry points
2013-11-21Clean up handling of PNaCl bitcode headers.Karl Schimpf
Write out all of PNaCl bitcode headers using a single interface function. BUG= https://code.google.com/p/nativeclient/issues/detail?id=3720 R=jvoung@chromium.org Review URL: https://codereview.chromium.org/61753017
2013-11-21Fixes the modeling of type ids within PNaCl bitcode files.Karl Schimpf
The code previously was very inconsisted in modeling the number of bits needed for type ids within abbreviations. Frequently, the number of bits used was based on the total number of types. This is a bad choice in that this includes all function types, even though most cases do not use these types. This patch makes the selection more consistent. Also removing TYPE_CODE_ARRAY, since it is not allowed. BUG= https://code.google.com/p/nativeclient/issues/detail?id=3720 R=jvoung@chromium.org Review URL: https://codereview.chromium.org/68503018
2013-11-20Remove UseRelativeID branching from NaClBitcodeReader, assume true.Jan Voung
This was kept in upstream LLVM for backwards compatibiilty with version 0 bitcode, but PNaCl only accepts version 1 bitcode, so UseRelativeID is always true. This reduces the number of branches taken while llvm-dis'ing the Ogre SampleBrowser from 2,680,184,988 branches to 2,670,798,955 branches. A 2.5% difference in wall-clock time... BUG=none trybots: http://chromegw.corp.google.com/i/tryserver.nacl/builders/nacl-toolchain-linux-pnacl-x86_32/builds/939 http://chromegw.corp.google.com/i/tryserver.nacl/builders/nacl-toolchain-linux-pnacl-x86_64/builds/991 http://chromegw.corp.google.com/i/tryserver.nacl/builders/nacl-toolchain-mac-pnacl-x86_32/builds/933 R=mseaborn@chromium.org Review URL: https://codereview.chromium.org/77023007
2013-11-15PNaCl: Change exception info format to distinguish catch-all/cleanup clausesMark Seaborn
The initial version of ExceptionInfoWriter.cpp encodes a landingpad's "cleanup" clause the same as "catch i8* null" (a catch-all). But it turns out we do want to distinguish these two: If an uncaught exception occurs, we don't want the runtime to run C++ destructors (cleanups), because this involves unwinding the stack to jump to landingpads, which loses the context of where the uncaught exception was thrown from, which is unhelpful for debugging. (The C++ standard says it's optional whether destructors are run when an uncaught exception occurs.) So, change the encoding as follows: * Use 0 as the ID for "cleanup" clauses. * Add 1 to the IDs of types and "catch" clauses. (Adding 1 to both seems neater than just one of them.) * This means we can use 0 for the terminator of filter lists instead of -1, which seems a little neater. This requires a corresponding change to eh_pnacl.cc in libsupc++. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3696 TEST=NaCl's EH tests with libsupc++ change applied Review URL: https://codereview.chromium.org/69923008
2013-11-15Make integer promotion pass preserve debug infoDerek Schuff
Just copy the debug info from the original instructions to newly-created instructions. R=mseaborn@chromium.org BUG=none Review URL: https://codereview.chromium.org/60353015
2013-11-15Switch PromoteIntegers pass from clearing upper bits after converted operationsDerek Schuff
that may affect them, to clearing before operations that may be affected This is just a cleanup that doesn't have any significant performance or functionality impact, but I thought it might make fixing bug 3714 a bit simpler. R=mseaborn@chromium.org BUG= https://code.google.com/p/nativeclient/issues/detail?id=3714 Review URL: https://codereview.chromium.org/59533011
2013-11-08Add some temporary diagnostics to GetCurrentDirectory to diagnose mac failuresJan Voung
Some users are reporting Mac assertion errors while linking: Assertion failed: (false && "Could not query current working directory."). Add a perror() call to see what errno is when this fails. BUG=none R=dschuff@chromium.org Review URL: https://codereview.chromium.org/66653003
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-30Move global FlagSfi variables to common modulePetar Jovanovic
When built as nexe, llc is configured and built for one arch only. Variables FlagSfiData, FlagSfiLoad, FlagSfiStore, FlagSfiStack, and FlagSfiBranch have to availabe for MIPS as well, so this change moves them from ARM-only code to common code. BUG= building pnacl-llc.nexe for MIPS fails TEST= build sandboxed tools for MIPS R=mseaborn@chromium.org Review URL: https://codereview.chromium.org/46193002
2013-10-29PNaCl: Add option to PNaClABISimplify for enabling the PNaClSjLjEH passMark Seaborn
Making this an 'enable' option (rather than using the pass name, "-pnacl-sjlj-eh") will allow us to reorder the passes within PNaClABISimplify.cpp later without having to change pnacl-ld.py (which lives outside the pnacl-llvm repo). It also means that the option can turn off LowerInvoke, which might reduce the link time a little. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3696 TEST=tested with PNaCl-side plumbing in pnacl-ld.py etc. Review URL: https://codereview.chromium.org/33743010
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-22Make sure flatten globals doesn't insert uses of globals that previously had ↵JF Bastien
no uses. This was the deeper cause of the issues I fixed in https://codereview.chromium.org/33233002/ and is therefore a better fix. (The problem was that StripDeadPrototypes was not stripping a variable that was actually dead because the bitcast constexpr inserted by FlattenGlobals referred to it.) I reverted most of that CL's changes, though not the comment and test cleanup. R=dschuff@chromium.org TEST= pnacl-clang++ pnacl/git/libcxx/test/input.output/iostream.objects/narrow.stream.objects/clog.pass.cpp -stdlib=libc++ Review URL: https://codereview.chromium.org/34843003
2013-10-21Remove unused globals.JF Bastien
libc++'s iostream values are extern, and never actually used in the headers (unlike libstdc++'s) which means that including iostream and doing something like (void)std::clog used to leave a global external ostream object declaration without a definition, which cause PNaCl's module ABI verifier to fail ('has no initializer' and 'is not a valid external symbol'). R=dschuff@chromium.org BUG= http://code.google.com/p/nativeclient/issues/detail?id=3623 TEST= globalcleanup.ll Review URL: https://codereview.chromium.org/33233002
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-10-11Cherry-pick LLVM 187787 to prevent tail calls on x86-32 when not appropriate.Jan Voung
See: http://llvm.org/viewvc/llvm-project?view=revision&revision=187787 The newer version of newlib tickles this x86-32 bug when building the exception handling tests, which don't strip the "tail" attribute. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3702 Waiting on trybots, but it seems to have fixed the minimal reproducer I have: http://chromegw.corp.google.com/i/tryserver.nacl/builders/nacl-toolchain-linux-pnacl-x86_64/builds/922 http://chromegw.corp.google.com/i/tryserver.nacl/builders/nacl-toolchain-linux-pnacl-x86_32/builds/870 http://chromegw.corp.google.com/i/tryserver.nacl/builders/nacl-toolchain-mac-pnacl-x86_32/builds/875 R=jfb@chromium.org Review URL: https://codereview.chromium.org/26538008
2013-10-11Fix bug in rewriting of library calls to intrinsics + new regression test.Eli Bendersky
The pass gets confused in some cases when library functions get passed to other functions as arguments, because use_iterator returns the call instruction. The existing test (rewrite-longjmp-noncall-uses.ll) did not catch this problem because there a bitcast constexpr was applied to the library function pointer, and it came up as the use instead of the containing call. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3706 R=mseaborn@chromium.org Review URL: https://codereview.chromium.org/26952003
2013-10-11Apply upstream: [mips] Disable tail merging when long branch pass is enabled.Petar Jovanovic
Cherry-pick r192124 from upstream. Original commit message: Author: Akira Hatanaka <ahatanaka@mips.com> Date: Mon Oct 7 19:13:53 2013 +0000 [mips] Disable tail merging when long branch pass is enabled. Another bug-fix in LongBranchPass, exposed in llc when it is compiled with LLVM, and visible in NativeClient through llc.nexe. TBR= mseaborn@chromium.org, dschuff@chromium.org BUG= bug in llc.nexe for MIPS Review URL: https://codereview.chromium.org/26963003
2013-10-11Apply upstream: [mips] Define method MipsSubtarget::enableLongBranchPass.Petar Jovanovic
Cherry-pick r192122 from upstream. Original commit message: Author: Akira Hatanaka <ahatanaka@mips.com> Date: Mon Oct 7 19:06:57 2013 +0000 [mips] Define method MipsSubtarget::enableLongBranchPass. This is a helper function/change for a subsequent fix in LongBranchPass, so we need to cherrypick it to be able to pick the next change as is. TBR= mseaborn@chromium.org, dschuff@chromium.org Review URL: https://codereview.chromium.org/26754006
2013-10-11Apply upstream: [mips] Fix a bug in MipsLongBranch::replaceBranchPetar Jovanovic
Cherry-pick r191978 from upstream. Original commit message: Author: Akira Hatanaka <ahatanaka@mips.com> Date: Fri Oct 4 20:51:40 2013 +0000 [mips] Fix a bug in MipsLongBranch::replaceBranch, which was erasing instructions in delay slots along with the original branch instructions This has to be cherrypicked, as it is a bug in backend. It was exposed in a long function inside of llc, which caused llc.nexe to work incorrectly. TBR= mseaborn@chromium.org, dschuff@chromium.org BUG= bug in MIPS backend Review URL: https://codereview.chromium.org/26933005
2013-10-11Apply upstream: [mips] Implement llvm.trap intrinsic.Petar Jovanovic
Cherry-pick r187244 from upstream. Original commit message: Author: Akira Hatanaka <ahatanaka@mips.com> Date: Fri Jul 26 20:58:55 2013 +0000 [mips] Implement llvm.trap intrinsic. Patch by Sasa Stankovic. This has to be cherrypicked, as two tests fail due to missing llvm.trap intrinsic. The tests are: - run_sysbrk_test - run_abi_types_test TBR= mseaborn@chromium.org, dschuff@chromium.org BUG= sysbrk and abi_types tests fail for MIPS Review URL: https://codereview.chromium.org/26953003
2013-10-11Apply upstream: Add missing ATOMIC_CMP_SWAP case.Petar Jovanovic
Cherry-pick r185186 from upstream. Original commit message: Author: Lang Hames <lhames@gmail.com> Date: Fri Jun 28 18:36:42 2013 +0000 Add missing case to switch statement - DAGTypeLegalizer::ExpandIntegerResult should expand ATOMIC_CMP_SWAP nodes the same way that it does for ATOMIC_SWAP. Since ATOMIC_LOADs on some targets (e.g. older ARM variants) get legalized to ATOMIC_CMP_SWAPs, the missing case had been causing i64 atomic loads to crash during isel. This has to be cherry-picked, as we have experienced the same bug described in the original message. Missing case caused MIPS 64 atomics to crash. TBR= mseaborn@chromium.org, dschuff@chromium.org BUG= crash for MIPS atomics Review URL: https://codereview.chromium.org/26958002
2013-10-11Apply upstream: [mips] Trap on integer division by zero.Petar Jovanovic
Cherry-pick r182306 from upstream. Original commit message: Author: Akira Hatanaka <ahatanaka@mips.com> Date: Mon May 20 18:07:43 2013 +0000 [mips] Trap on integer division by zero. By default, a teq instruction is inserted after integer divide. No divide-by-zero checks are performed if option "-mnocheck-zero-division" is used. TBR= mseaborn@chromium.org, dschuff@chromium.org BUG= missing trap for MIPS Review URL: https://codereview.chromium.org/26846007
2013-10-05[MIPS] Define PnaclTargetArchitectureMips_32Petar Jovanovic
LowerNaClTargetArch has to return const PnaclTargetArchitectureMips_32 for MIPS. The constant is later used in ResolvePNaClIntrinsics pass. BUG= https://code.google.com/p/nativeclient/issues/detail?id=3602 R=jfb@chromium.org Review URL: https://codereview.chromium.org/25887007
2013-10-03PNaCl bitcode: Simplify how the writer elides castsMark Seaborn
The PNaCl bitcode writer had some complex logic for deciding when to omit casts in the output. This was left over from when the writer was trying to leave in the casts in some but not all cases (as part of incrementally removing casts). This is no longer needed now that the writer just omits all inttoptrs, all ptrtoints, and all pointer bitcasts. This cleanup also fixes the writer so that it elides an inttoptr of a ptrtoint. This sequence is allowed by the PNaCl ABI verifier, but never occurred in practice because ReplacePtrsWithInts' SimplifyCasts() function converts this sequence to an equivalent bitcast. Before this change, the writer would give this error for an inttoptr-of-ptrtoint: LLVM ERROR: Illegal (PNaCl ABI) pointer cast : %1 = ptrtoint [4 x i8]* @bytes to i32 BUG=https://code.google.com/p/nativeclient/issues/detail?id=3590 TEST=toolchain trybots Review URL: https://codereview.chromium.org/25817002
2013-10-03PNaCl bitcode: Reject CAST_PTRTOINT and CAST_INTTOPTRMark Seaborn
Make the reader and writer stricter so that we can be sure we're not accidentally generating ptrtoint or inttoptr instructions in pexe files. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3590 TEST=toolchain trybots Review URL: https://codereview.chromium.org/25607006
2013-10-03PNaCl bitcode reader: Remove Xcode/ranlib-related hackMark Seaborn
This is a very Mac OS X-specific hack which isn't relevant to PNaCl. PNaCl doesn't use Xcode's ranlib for processing bitcode libraries. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3590 TEST=toolchain trybots Review URL: https://codereview.chromium.org/25635004
2013-10-03PNaCl bitcode: Remove unused function ConvertTypeToScalarType()Mark Seaborn
BUG=https://code.google.com/p/nativeclient/issues/detail?id=3590 TEST=build Review URL: https://codereview.chromium.org/25802002
2013-10-02Fix Ninja build of pnacl-freeze so that tests passMark Seaborn
Declare NaClBitWriter's dependency on NaClBitReader. Without this change, pnacl-freeze fails at run time with: pnacl-freeze: symbol lookup error: .../native_client/pnacl/build/llvm_x86_64_ninja/lib/libLLVMNaClBitWriter.so: undefined symbol: _ZN4llvm17NaClBitcodeHeaderC1Ev BUG=none TEST=llvm-lit tests Review URL: https://codereview.chromium.org/24524003
2013-09-20Support mul binary operator in integer promotion passDerek Schuff
Its handling is the same as add (may overflow, may set upper bits) R=jvoung@chromium.org, mseaborn@chromium.org BUG= https://code.google.com/p/nativeclient/issues/detail?id=3599 Review URL: https://codereview.chromium.org/24244008
2013-09-18Remove code referring to PNaCl version 1, since it is no longer used.Karl Schimpf
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3590 R=mseaborn@chromium.org Review URL: https://codereview.chromium.org/24232002
2013-09-18Only allow PNaCl version 2 bitcode files.Karl Schimpf
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3590 R=jvoung@chromium.org Review URL: https://codereview.chromium.org/23503071