aboutsummaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)Author
2013-07-24Hide the x86-64 sandbox base address.Jim Stichnoth
Prevent sandbox addresses from being written to the stack. This covers the following cases: 1. Function calls manually push a masked return address and jump to the target, rather than using the call instruction. 2. When the function prolog chooses to use a frame pointer (rbp), it saves a masked version of the old rbp. 3. Indirect branches (jumps, calls, and returns) uniformly use r11 to construct the 64-bit target address. 4. Register r11 is marked as reserved (similar to r15) so that the register allocator won't inadvertently spill a code address to the stack. These transformations can be disabled for performance testing with the flag "-sfi-hide-sandbox-base=false". BUG= https://code.google.com/p/nativeclient/issues/detail?id=1235 R=eliben@chromium.org, mseaborn@chromium.org Review URL: https://codereview.chromium.org/19505003
2013-07-24[MIPS] Fix LLVM merge issuesPetar Jovanovic
Several parts of the already in-place code have been omitted in the previous merge. These are: - missing lowering of Intrinsic::nacl_read_tp; - checks for forbidden instructiosn in branch-delay slots; - lowering operation for ISD::NACL_TP_TLS_OFFSET and ISD::NACL_TP_TDB_OFFSET. BUG= https://code.google.com/p/nativeclient/issues/detail?id=2275 TEST= run smoke tests R=eliben@chromium.org Review URL: https://codereview.chromium.org/19614006
2013-07-22Unbreak the Windows/Cygwin toolchain build after the 3.3 merge.Eli Bendersky
Post 3.3-merge there seems to be a problem using mmap on cygwin. In the meantime, as a LOCALMOD, we disable usage of mmap in MemoryBuffer. The effect of this on the Windows/Cygwin toolchain can be a slightly slower developer-side linkage time. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3578 R=dschuff@chromium.org Review URL: https://codereview.chromium.org/19923003
2013-07-22Cherrypick upstream ARM FastISel ext patchesJF Bastien
Specifically: r186489 - Fix ARMFastISel::ARMEmitIntExt shift emission r183794 - ARM FastISel fix sext/zext fold r183601 - Fix unused variable warning from my previous patch r183551 - ARM FastISel integer sext/zext improvements These should fix some failures that I had run into back then, as well as make ARM FastISel faster because it doesn't go to SelectionDAG. BUG= https://code.google.com/p/nativeclient/issues/detail?id=3501 R=jvoung@chromium.org TEST= make check-all Review URL: https://codereview.chromium.org/19992002
2013-07-22Enable ability to have multiple PNaCl wire format versions.Karl Schimpf
Modifies PNaCl bitcode reader/writer to accept PNaClVersion=1 as supported, and all other versions are unsupported and unreadable. The PNaCl bitcode reader/writer will generate appropriate messages (including what version is unsupported if applicable). Also allows command-line option --pnacl-version for setting the 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=None R=jvoung@chromium.org Review URL: https://codereview.chromium.org/19400002
2013-07-22Fix default cases for printing instructions/constants in PNaCl wire format.Karl Schimpf
Fix printing of instructions/constants to explicitly check on cast opcodes and binary operators, so that we don't accidentally allow unknown opcodes. BUG= https://code.google.com/p/nativeclient/issues/detail?id=3570 R=jvoung@chromium.org Review URL: https://codereview.chromium.org/19242003
2013-07-22Remove module info records not allowed by PNaCl from the bitcode.Karl Schimpf
Remove dead code for: (1) Top-level inline assembly. (2) Remove code for named sections. (3) Remove code for GC names. (4) Global variable aliases. BUG= https://code.google.com/p/nativeclient/issues/detail?id=3405 R=jvoung@chromium.org Review URL: https://codereview.chromium.org/18770005
2013-07-22Disallow dev/private intrinsics by default (only llvm.nacl.target.arch remains)Jan Voung
BUG=https://code.google.com/p/nativeclient/issues/detail?id=3525 R=jfb@chromium.org Review URL: https://codereview.chromium.org/19668004
2013-07-20Remove prefetchJF Bastien
Following our discussion in the related bug, prefetch will not be part of our initial stable ABI. BUG= https://code.google.com/p/nativeclient/issues/detail?id=3531 TEST= cd ./pnacl/build/llvm_x86_64; ninja check R=jvoung@chromium.org Review URL: https://codereview.chromium.org/19771015
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-19Clean up a debug printout left in by mistake during the 3.3 mergeEli Bendersky
BUG=None R=dschuff@chromium.org Review URL: https://codereview.chromium.org/19472003
2013-07-18Merge remote-tracking branch 'origin/master'Eli Bendersky
2013-07-18Some more OS-specific calls were added that are not supported in theEli Bendersky
sandboxed build. Condition them properly on __native_client__.
2013-07-18More safeguarding of Attr->getKindAsEnum by checking for isEnumAttributeEli Bendersky
first
2013-07-18Correctly adjust LOCALMOD for x64 frame register computation.Eli Bendersky
2013-07-18Adding checks for isEnumAttribute because getKindAsEnum now assertsEli Bendersky
2013-07-17Fixed constpool pattern matching problem that made the crtbeginS buildEli Bendersky
on ARM fail
2013-07-17Remove unnecessary debug printoutEli Bendersky
2013-07-17Disallow a global address in the x86-64 displacement field.Jim Stichnoth
This applies only to %r15 sandboxed memory references. The problem is that if the index register is negative, the sandboxing operation will cause the index to become a large positive 32-bit value, which combined with the displacement, will overflow and try to reference memory outside the sandbox. This situation may legitimately occur if the compiler happens to construct a (constant) interior pointer to the middle of the global struct/array, and then dereferences it with a variable offset. After this fix, pnacl/scripts/testsuite_known_failures_pnacl.txt can be updated to remove the "aha x86-64" known failure. BUG= https://code.google.com/p/nativeclient/issues/detail?id=3517 R=eliben@chromium.org Review URL: https://codereview.chromium.org/17987002
2013-07-16More tests passEli Bendersky
2013-07-16Fixing make check errors...Eli Bendersky
2013-07-16Remove useless field InstructionList from NaClBitcodeReader.Karl Schimpf
BUG=None R=mseaborn@chromium.org Review URL: https://codereview.chromium.org/19284013
2013-07-16Make it compileEli Bendersky
2013-07-15Trying to get the thing to copmile...Eli 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-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-11Fix ARM paired GPR COPY loweringJF Bastien
ARM paired GPR COPY was being lowered to two MOVr without CC. This patch puts the CC back. I sent this patch upstream (with a test) but haven't received a review yet. This seems like a simple oversight in the code, and is holding my atomics patch so I'd like to get it into our repo. R=dschuff@chromium.org TEST= ./scons run_llvm_bitmanip_intrinsics_test platform=arm BUG= no CC on MOVr Review URL: https://codereview.chromium.org/18047006
2013-07-11Sandbox ARM load/store exclusive dualJF Bastien
PNaCl's LLVM sandboxing wasn't correct for ARM load/store exclusive dual. I encountered this while running our testsuite with my atomic changes: the tests which use volatile 64-bit values started failing validation. R=dschuff@chromium.org BUG= validation failure TEST= ./pnacl/test.sh test-arm Review URL: https://codereview.chromium.org/18978015
2013-07-10Fix ARM LDMIA MI.JF Bastien
The instruction that was generated for paired register stack slot load was wrong. This was fixed by Tim Northover in LLVM 3.3 commit 179977, but his patch does much more and doesn't apply as-is to our tree. I'll therefore punt applying the full patch to when we rebase to 3.3. I encountered the issue while working on atomics (64-bit atomics require paired registers on ARM), and saw the 3.3 fix when I tried upstreaming my fix. BUG= non TEST= ./pnacl/test.sh test-arm R=eliben@chromium.org Review URL: https://codereview.chromium.org/18699004
2013-07-10Reject the llvm.powi intrinsic in the PNaCl ABI verifier.Eli Bendersky
BUG=https://code.google.com/p/nativeclient/issues/detail?id=3524 R=jfb@chromium.org Review URL: https://codereview.chromium.org/18614013
2013-07-09Make GlobalOpt's GV-by-alloca replacement work for PNaCl.Eli Bendersky
GlobalOpt currently assumes only an external "main" is the "real main". This is no longer the case for PNaCl, where we internalize "main". Make the test more strict and PNaCl specific by checking that "main" is just used once - in a call from "_start", but does not have to be external. Note that this also addresses a possible bug in the optimization for C code, since C does not guarantee that main is not recursive. This CL's purpose is to address a SPEC performance regression - 10% in 183.equake. The regression appeared after our ABI change that made 'main' internal, which disabled this particular optimization. The CL addresses this by re-enabling the optimization and also being more C-standard conforming. BUG=None Review URL: https://codereview.chromium.org/18615015
2013-07-09PNaCl: Fix negative relocation addends on x86-32Mark Seaborn
Disable an assertion. This assertion made the behaviour on x86-32 inconsistent with x86-64 and ARM. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3548 TEST=*.ll tests + PNaCl toolchain trybots Review URL: https://codereview.chromium.org/18261008
2013-07-08Fix for a regression caused by the LoopVectorizer whenTom Stellard
vectorizing loops with memory accesses to non-zero address spaces. It simply dropped the AS info. Fixes PR16306. Merged from r184103 Author: Pekka Jaaskelainen <pekka.jaaskelainen@tut.fi> Date: Mon Jun 17 18:49:06 2013 +0000 git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_33@185869 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-08R600: Fix R600ControlFlowFinalizer not considering VTX_READ 128 bit dst regTom Stellard
Patch by: Vincent Lejeune https://bugs.freedesktop.org/show_bug.cgi?id=64877 NOTE: This is a candidate for the 3.3 branch. Merged from r182600 Author: Tom Stellard <thomas.stellard@amd.com> Date: Thu May 23 18:26:42 2013 +0000 git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_33@185868 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-03Do not fail when library functions are declared incorrectly.Eli Bendersky
Instead, defer the undefined behavior to runtime. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3537 R=mseaborn@chromium.org Review URL: https://codereview.chromium.org/18552007
2013-07-03Don't generate Type ID's for global variable fields.Karl Schimpf
Also removed local MaxGlobalType in WriteModuleInfo because it calls VE.getTypeID(GV->getTYpe(), which is no longer defined for globals. Also noted that MaxAlignment in WriteModuleInfo was no longer used and removed it. BUG= https://code.google.com/p/nativeclient/issues/detail?id=3541 R=mseaborn@chromium.org Review URL: https://codereview.chromium.org/18185005
2013-07-02Move LLVM sqrt intrinsic to stable (for float and doubles).Jan Voung
On the hardware that we support, they are implemented by instructions and have consistent behavior for -0.0, values less than -0.0, infinity, and nan. We will need to be careful to guarantee the same behavior for untested hardware. TEST=run_llvm_math_intrinsics_test BUG=http://code.google.com/p/nativeclient/issues/detail?id=3378 R=jfb@chromium.org, mseaborn@chromium.org Review URL: https://codereview.chromium.org/18559005
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-02Enable ABI verification check for whitelisting external symbolsEli Bendersky
BUG=https://code.google.com/p/nativeclient/issues/detail?id=3339 R=mseaborn@chromium.org Review URL: https://codereview.chromium.org/18426002
2013-07-01Internalize all symbols except _start.Eli Bendersky
BUG=https://code.google.com/p/nativeclient/issues/detail?id=3532 R=mseaborn@chromium.org Review URL: https://codereview.chromium.org/18348008
2013-07-01PNaCl ABI checker: Check for exact names and types of whitelisted intrinsicsMark Seaborn
This makes the checker stricter, so that it will reject names such as "@llvm.memcpy.foo". Reuse Intrinsic::getName() and Intrinsic::getType() for checking the exact function name and type that we should expect for whitelisted intrinsics. This is simpler than writing code to check each argument type separately. intrinsics.ll test: Add some tests. Simplify existing tests by replacing multiple CHECK-NOTs with a single "CHECK-NOT: disallowed", which is stricter because it is less specific. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3530 TEST=*.ll tests + PNaCl toolchain trybots Review URL: https://codereview.chromium.org/18302002
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-28Move stacksave/restore to allowed list, pow to disallowed.Jan Voung
The stacksave/restore intrinsics are covered by "run_vla_test", tests in GCC torture testsuite, and basic llvm lit tests (mostly related to debug info...). The pow intrinsic is no longer needed after Eli's change to Clang, and pow is done purely in libm (even with -fno-math-errno). BUG=http://code.google.com/p/nativeclient/issues/detail?id=3378 R=eliben@chromium.org, jfb@chromium.org, mseaborn@chromium.org Review URL: https://codereview.chromium.org/18180002
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-28Do not preserve abort() - it's not needed for ARM and X86.Eli Bendersky
In a subsequent CL I'll clean up the whole IntrinsicLowering logic - probably reverting it to upstream since we no longer really use it. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3526 R=mseaborn@chromium.org Review URL: https://codereview.chromium.org/18053017
2013-06-27Do not preserve "pow" for the sake of re-materializing intrinsics.Eli Bendersky
This is no longer required, since Clang will not generate llvm.pow.* intrinsics. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3513 R=mseaborn@chromium.org Review URL: https://codereview.chromium.org/18162002
2013-06-26PNaCl pexe reader: Remove now-unused Type argument from getValue()/popValue()Mark Seaborn
Before this change, NaClBitcodeReader had some icky use of C++ function overloading and reference types. Whether getValue() modified its Slot argument depended on whether it was passed a Type argument, which wasn't very readable: // Modifies Slot. bool getValue(SmallVector<uint64_t, 64> &Record, unsigned &Slot, unsigned InstNum, Value *&ResVal); // Does not modify Slot. bool getValue(SmallVector<uint64_t, 64> &Record, unsigned Slot, unsigned InstNum, Type *Ty, Value *&ResVal); // Does not modify Slot. Value *getValue(SmallVector<uint64_t, 64> &Record, unsigned Slot, unsigned InstNum, Type *Ty); So, do these cleanups: * Convert non-const reference arguments to pointers. (Also add "const" to the Record argument.) * Remove the unused Type argument from getValue()/popValue(). * Remove the getValue() case that was identical to popValue(). Call popValue() instead. Now popValue() modifies *Slot and getValue() does not. * Remove an unused getValue() case. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3507 TEST=PNaCl toolchain trybots Review URL: https://codereview.chromium.org/17938002
2013-06-26PNaCl wire format: Disallow duplicate FORWARDTYPEREFs for the same value IDMark Seaborn
Change the reader to be stricter so that duplicate FORWARDTYPEREFs are rejected. Also fix typo in error message. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3507 TEST=see "Invalid FORWARDTYPEREF record" if EmitFnForwardTypeRef() is changed to produce unnecessary FORWARDTYPEREFs Review URL: https://codereview.chromium.org/17925002
2013-06-26PNaCl: Remove some LOCALMODs in the upstream bitcode reader/writerMark Seaborn
These were for ELF dynamic linking support, which we are removing. The same LOCALMODs were previously removed from PNaCl's fork of the reader/writer (in https://codereview.chromium.org/17761005/). BUG=https://code.google.com/p/nativeclient/issues/detail?id=3520 TEST=PNaCl toolchain trybots Review URL: https://codereview.chromium.org/17854006
2013-06-26PNaCl wire format: Remove the METADATA_BLOCK block from pexesMark Seaborn
Despite removing metadata at the IR level, the writer was still outputting a METADATA_BLOCK containing built-in strings such as "dbg", "tbaa" and "fpmath". Remove this by removing metadata support from the reader and writer. I've removed most references to "metadata" and "MD". I've also removed DEBUG_LOC handling, since that depends on MDValueList in the reader. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3518 TEST=PNaCl toolchain trybots + check hello_world.final.pexe in bcanalyzer Review URL: https://codereview.chromium.org/17761005