aboutsummaryrefslogtreecommitdiff
path: root/include
AgeCommit message (Collapse)Author
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-18Merge remote-tracking branch 'origin/master'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-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-09Prune some arch-specific MC InstPrinter (.s printing), from sandboxed ↵Jan Voung
translator. Saves about 100KB per arch. As noted in the test, some of the functions like getRegisterName() are not pruned. Common infrastructure code may still be sitting around, only the ${ARCH}InstPrinter::* is touched... but this is just a one-liner. BUG=https://code.google.com/p/nativeclient/issues/detail?id=1222 TEST=https://codereview.chromium.org/18333008/ R=dschuff@chromium.org Review URL: https://codereview.chromium.org/18238011
2013-07-02Remove comma at end of enumerator, to remove warning.Karl Schimpf
BUG=None R=jvoung@chromium.org Review URL: https://codereview.chromium.org/18042006
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-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-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
2013-06-26PNaCl wire format: Clean up representation of "alloca" instructionMark Seaborn
For some reason, the size operand of "alloca" was represented using an absolute value ID + type, unlike other instructions where relative value IDs are used. Change the "alloca" representation to be consistent with other instructions, so that we can use PushValueAndType() in the writer and getValue() in the reader. Also take this opportunity to remove the field for alloca's result type, since it's always i8* in PNaCl. This is part of a cleanup to make forward reference handling stricter: it removes a use of getOrCreateFnValueByID(), which isn't strict (that is, it doesn't reject duplicate FORWARDTYPEREF records). BUG=https://code.google.com/p/nativeclient/issues/detail?id=3507 TEST=PNaCl toolchain trybots Review URL: https://codereview.chromium.org/17757004
2013-06-25PNaCl wire format: Remove the top-level DATALAYOUT recordMark Seaborn
PNaCl only supports a fixed data layout, so treat this as implicit in the pexe file. Add the data layout field back at read time, to prevent accidentally using any architecture-specific backend data layout when translating, and to ensure that any IR passes that use the data layout work correctly. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3505 TEST=*.ll tests + PNaCl toolchain trybots Review URL: https://codereview.chromium.org/17591014
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-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-23PNaCl wire format: Remove the top-level TRIPLE recordMark Seaborn
Currently, the triple that gets put into pexes is "armv7-none-linux-gnueabi". This is a wart that we don't want to keep. We can remove the triple entirely; PNaCl doesn't need it. We don't need to add a triple back at read time: (pnacl-)llc tells the backend explicitly what target to use. I'm leaving MODULE_CODE_TRIPLE defined in the enum for now because pnacl-bcanalyzer still refers to it. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3505 TEST=PNaCl toolchain trybots + GCC torture tests + Spec2k Review URL: https://codereview.chromium.org/17321009
2013-06-21PNaCl wire format: Update comments for function attribute removalMark Seaborn
I missed updating the comments about the bitcode format in NaClLLVMBitCodes.h in my previous change. Note that the comment for FUNC_CODE_INST_CALL was out of date before: it was missing "cc" (calling conventions). BUG=https://code.google.com/p/nativeclient/issues/detail?id=3506 TEST=none Review URL: https://codereview.chromium.org/17516004
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-19Insulate calling conventions in PNaCl bitcode files.Karl Schimpf
Creates a bitcode-local enumeration for calling conventions for the PNaCl bitcode file, so that the bitcode file is better protected from (accidental) changes in LLVM code. Also removes invokes from the bitcode. BUG= https://code.google.com/p/nativeclient/issues/detail?id=3497 R=dschuff@chromium.org, mseaborn@chromium.org Review URL: https://codereview.chromium.org/17118002
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-13Fix PrologEpilogInserter to save and restore all callee saved registersDerek Schuff
if the function calls _builtin_unwind_init() Also fix the list of callee-saved registers returned by X86RegisterInfo::getCalleeSavedRegisters BUG= https://code.google.com/p/nativeclient/issues/detail?id=3486 R=mseaborn@chromium.org Review URL: https://codereview.chromium.org/16987002
2013-06-13PNaCl: Strip more unwanted attributes: "align" on functions and "unnamed_addr"Mark Seaborn
Do this stripping in the StripAttributes pass. Change the pass to be a ModulePass so that it can modify global variables. Change the ABI verifier to check this. Also update a comment about "nuw" and "nsw". BUG=https://code.google.com/p/nativeclient/issues/detail?id=3415 TEST=*.ll tests + PNaCl toolchain trybots Review URL: https://codereview.chromium.org/16991002
2013-06-13Insulate PNaCl bitcode from LLVM encodings of floating point optimization flags.Karl Schimpf
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3405 R=jvoung@chromium.org Review URL: https://codereview.chromium.org/16836017
2013-06-13Fix reading of headers when using a streamable memory object.Karl Schimpf
Fixes bug where we computed the length of fields buffer on the size of a pointer, rather then the actual length of the field. BUG= https://code.google.com/p/nativeclient/issues/detail?id=3485 R=dschuff@chromium.org Review URL: https://codereview.chromium.org/17003002
2013-06-10PNaCl: Extend ExpandStructRegs to handle "insertvalue" instructionsMark Seaborn
Previously, the pass could expand out struct_load+extractvalue combinations (via ReplaceUsesOfStructWithFields()). This change makes the pass more general by converting struct_loads to scalar_load+insertvalue combinations and then by expanding out insertvalue+extractvalue combinations. This means the pass can now handle the insertvalue instructions that are sometimes generated by the SROA pass. (Clang compiles ScummVM's use of C++ method pointers to struct loads+stores which SROA generates insertvalue instructions from.) To make the pass more general, we also extend it to be able to handle phi nodes of struct type. These are split into extractvalue+scalar_phi+insertvalue combinations. However, the pass is not yet fully general, because it doesn't handle: * nested struct types * array types Change ExpandArithWithOverflow to rely on ExpandStructRegs' insertvalue handling rather than the less general ReplaceUsesOfStructWithFields() helper function, which can now be removed. SplitUpStore() no longer needs to handle Constants, because this case is handled by ExpandExtractValue(). BUG=https://code.google.com/p/nativeclient/issues/detail?id=3476 TEST=*.ll tests + PNaCl toolchain trybots Review URL: https://codereview.chromium.org/16448006
2013-06-07Add CL argument -bitcode-format to llvm-dis, llc, and pnacl-llc.Karl Schimpf
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3469 R=jvoung@chromium.org Review URL: https://codereview.chromium.org/16385002
2013-06-06Make PNaCl bitcode files have a different format from LLVM bitcode files.Karl Schimpf
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3405 R=dschuff@chromium.org Review URL: https://codereview.chromium.org/15907008
2013-06-05PNaCl ABI: Strip out attributes on functions and function callsMark Seaborn
Add a pass, StripAttributes, for doing this, and enable it. Add an ABI check to reject these attributes. BUG=https://code.google.com/p/nativeclient/issues/detail?id=2346 BUG=https://code.google.com/p/nativeclient/issues/detail?id=3415 TEST=*.ll tests + PNaCl toolchain trybots Review URL: https://codereview.chromium.org/16325025
2013-05-31Apply LLVM upstream: r182877 - Enable FastISel on ARM for Linux and NaClJF Bastien
This also pulls in a TargetMachine.h change from r176986 and changes NaCl's intrinsics-bitmanip.ll test to account for register spills at O0. FastISel was only enabled for iOS ARM and Thumb2, this patch enables it for ARM (not Thumb2) on Linux and NaCl. Thumb2 support needs a bit more work, mainly around register class restrictions. The patch punts to SelectionDAG when doing TLS relocation on non-Darwin targets. I will fix this and other FastISel-to-SelectionDAG failures in a separate patch. The patch also forces FastISel to retain frame pointers: iOS always keeps them for backtracking (so emitted code won't change because of this), but Linux was getting much worse code that was incorrect when using big frames (such as test-suite's lencod). I'll also fix this in a later patch, it will probably require a peephole so that FastISel doesn't rematerialize frame pointers back-to-back. The test changes are straightforward, similar to: http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20130513/174279.html They also add a vararg test that got dropped in that change. I ran all of test-suite on A15 hardware with --optimize-option=-O0 and all the tests pass. R=dschuff@chromium.org, jvoung@chromium.org BUG= https://code.google.com/p/nativeclient/issues/detail?id=3120 Review URL: https://codereview.chromium.org/15671004
2013-05-31Merging 182989: Fix ScalarEvolution::ComputeExitLimitFromCond for 'or' ↵Andrew Trick
conditions. Fixes PR16130 - clang produces incorrect code with loop/expression at -O2. This is a 2+ year old bug that's now holding up the release. It's a case where we knowingly made aggressive assumptions about undefined behavior. These assumptions are wrong when SCEV is computing a subexpression that does not directly control the branch. With this fix, we avoid making assumptions in those cases but still optimize the common case. SCEV's trip count computation for exits controlled by 'or' expressions is now analagous to the trip count computation for loops with multiple exits. I had already fixed the multiple exit case to be conservative. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182989 91177308-0d34-0410-b5e6-96231b3b80d8 git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_33@183013 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-30PNaCl: Add a pass to expand out Clang's use of registers of struct typeMark Seaborn
Clang's implementation of C++ method pointers generates IR that uses LLVM registers with struct type -- specifically, loads and stores of struct values, and extractvalue instructions. See lib/CodeGen/ItaniumCXXABI.cpp in Clang. Add a pass, ExpandStructRegs, which expands out those uses. Factor out a function from ExpandArithWithOverflow so that the two passes can share some code. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3343 TEST=*.ll tests + trybots + GCC torture tests Review URL: https://codereview.chromium.org/15692014
2013-05-29PNaCl: Add ExpandSmallArguments pass to widen parameters to 32 bitsMark Seaborn
This widens i1, i8 and i16 function arguments and return types. Factor out RecreateFunction() helper function from existing PNaCl passes since this is a reoccurring code fragment. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3342 TEST=*.ll tests + PNaCl toolchain trybots + GCC torture tests + LLVM test suite Review URL: https://codereview.chromium.org/15971007
2013-05-29Merging r182394:Bill Wendling
------------------------------------------------------------------------ r182394 | jholewinski | 2013-05-21 09:51:30 -0700 (Tue, 21 May 2013) | 1 line [NVPTX] Add @llvm.nvvm.sqrt.f() intrinsic ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_33@182829 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-28PNaCl: Extend ExpandMulWithOverflow pass to handle uadd.with.overflow tooMark Seaborn
It turned out that umul.with.overflow wasn't the only *.with.overflow intrinsic usage introduced by Clang. I knew that Clang's CGExprCXX.cpp generates umul.with.overflow for an overflow check for C++'s "new Foo[]". The same code for handling "new Foo[]" also generates uadd.with.overflow in some cases. This happens if class Foo has a destructor or a delete[] operator that takes a size argument. In those cases, the C++ ABI adds a "cookie" to the allocation which contains the array's size. Rename the pass to "ExpandArithWithOverflow" and rename files accordingly. Also enable the pass. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3434 TEST=*.ll tests + trybots + GCC torture tests Review URL: https://codereview.chromium.org/15688011
2013-05-28Add two passes that implement conversions from PNaCl's specific intrinsicsEli Bendersky
to external function calls during the translation stage (llc). One of the passes is a ModulePass that adds the appropriate function declarations to the module. The other is a FunctionPass that performs the actual call replacement. This split exists because of bitcode streaming. Initially the passes handle the llvm.nacl.{set|long}jmp intrinsics. In the future they may handle additional intrinsics that are part of the PNaCl stable bitcode ABI. This CL also removes the previous approach to handling this conversion (in SelectionDAGBuilder.cpp). That ended up not working - more details in issue 3429. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3429 R=mseaborn@chromium.org Review URL: https://codereview.chromium.org/16047002
2013-05-24PNaCl: Add "-pnacl-abi-simplify-{pre,post}opt" meta-passes to "opt"Mark Seaborn
These meta-passes will be used to replace the pass lists that are currently in the pnacl-ld.py driver script in the NaCl repo. I've moved the comments across from pnacl-ld.py and added a couple more comments for ExpandByVal and StripMetadata. Fix the declaration of createResolveAliasesPass(). BUG=https://code.google.com/p/nativeclient/issues/detail?id=3435 TEST=new *.ll tests + tested with change to pnacl-ld.py Review URL: https://codereview.chromium.org/15669002
2013-05-24PNaCl: Add pass to expand out Clang-generated umul.with.overflow callsMark Seaborn
This adds a pass, ExpandMulWithOverflow, to expand out the llvm.umul.with.overflow calls that Clang generates to implement an overflow check for C++'s new[] operator. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3434 TEST=expand-mul-with-overflow.ll Review URL: https://codereview.chromium.org/14649027
2013-05-24Make abbreviations explicit in pnacl-freeze/thaw.Karl Schimpf
[1] Explicitly enumerate all abbreviation values, including the maximum abbreviation for each type of block. [2] Make "enter subblock" calculate number of bits needed by passing in maximum abbreviation (associated with block) rather than requiring the developer to compute this value every time a subblock is entered. *NOTE* This code changes encoding sizes to be based on the maximum allowed value, rather than requiring the developer to calculate out the number of bits needed. This change doesn't make the PNaCL bitcode files incompatable with LLVM bitcode files, since it does not effect the bitcode reader. BUG= https://code.google.com/p/nativeclient/issues/detail?id=3405 R=jvoung@chromium.org Review URL: https://codereview.chromium.org/14813032
2013-05-22PNaCl: Add ReplacePtrsWithInts pass for stripping out pointer typesMark Seaborn
ReplacePtrsWithInts converts IR to a normal form in which functions don't reference any aggregate pointer types and pointer types only appear inside a few instructions. Change BlockAddress::replaceUsesOfWithOnConstant() to handle changing a function's type by replacing a function with a bitcast ConstantExpr of a new function. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3343 TEST=replace-ptrs-with-ints.ll + PNaCl toolchain trybots, torture tests, etc. Review URL: https://codereview.chromium.org/14262011
2013-05-17Merging r181864:Bill Wendling
------------------------------------------------------------------------ r181864 | chapuni | 2013-05-14 19:16:23 -0700 (Tue, 14 May 2013) | 10 lines ELFRelocationEntry::operator<(): Try to stabilize the order. r_offset was insufficient to sort Relocs. It should fix llvm/test/CodeGen/ARM/ehabi-mc-compact-pr*.ll on some hosts. RELOCATION RECORDS FOR [.ARM.exidx]: 0 R_ARM_PREL31 .text 0 R_ARM_NONE __aeabi_unwind_cpp_pr0 FIXME: I am not sure of the directions of extra comparators, in Type and Index. For now, they are different from the direction in r_offset. ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_33@182149 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-14The customary LLVM way of obtaining intrinsics is withEli Bendersky
Intrinsic::getDeclaration and use the definition in include/llvm/Intrinsics.td This also makes the attribute on the intrinsic to be more consistent with the back-end (code-gen), which automatically assumes it's ReadNone (because this is what Intrinsics.td) defines. Using ReadNone rather than ReadOnly may be not strictly correct because the intrinsic depends on the value of the TP. However, this attribute is not really used anywhere in IR optimizations, and in the backend the intrinsic is ReadNone anyhow (the IR setting gets overridden). If we run into any problems with this in the future, we may consider handling the lowering of this intrinsic in TargetLowering::LowerINTRINSIC_W_CHAIN rather than in TargetLowering::LowerINTRINSIC_WO_CHAIN. BUG=None R=mseaborn@chromium.org Review URL: https://codereview.chromium.org/14643019
2013-05-14Adding a pass - RewritePNaClLibraryCalls, that replaces known library calls ↵Eli Bendersky
with stable bitcode intrinsics. Starting with setjmp and longjmp. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3429 R=jvoung@chromium.org, mseaborn@chromium.org Review URL: https://codereview.chromium.org/14617017
2013-05-10PNaCl ABI: Promote illegal integer typesDerek Schuff
This pass (mostly) legalizes integer types by promoting them. It has some limitations (e.g. it can't change function types) but it is more than sufficient for what clang and SROA generate. A more significant limitation of promotion is that packed bitfields of size > 64 bits are still not handled. There are none in our tests (other than callingconv_case_by_case which doesn't require a stable pexe) but we will want to either handle them by correctly expanding them, or find a better way to error out. BUG= https://code.google.com/p/nativeclient/issues/detail?id=3360 R=eliben@chromium.org, jvoung@chromium.org Review URL: https://codereview.chromium.org/14569012
2013-05-10LLVM: Add ELF Note section to NaCl object files identifying them as such to goldDerek Schuff
This is needed to switch the native linker to one based on upstream binutils 2.23 R=mseaborn@chromium.org BUG= https://code.google.com/p/nativeclient/issues/detail?id=2971 also related to bug https://code.google.com/p/nativeclient/issues/detail?id=3424 Review URL: https://codereview.chromium.org/15067009
2013-05-09Support @llvm.nacl.{set|long}jmp intrinsics by translating them to library callsEli Bendersky
This is similar to the way @llvm.{set|long}jmp are handled. The previously defined nacl-specific intrinsics are no longer used and are overridden. For the library call, call setjmp/longjmp without a preceding underscore as these symbols exist in our runtime support code (pnacl/support/setjmp_XXX.S) BUG=https://code.google.com/p/nativeclient/issues/detail?id=3429 R=mseaborn@chromium.org Review URL: https://codereview.chromium.org/14715018
2013-05-08Insert denominator zero checks for NaClDavid Sehr
This IR pass for ARM inserts a comparison and a branch to trap if the denominator of a DIV or REM instruction is zero. This makes ARM fault identically to x86 in this case. BUG= https://code.google.com/p/nativeclient/issues/detail?id=2833 R=eliben@chromium.org Review URL: https://codereview.chromium.org/14607004
2013-05-06Implemented public interface for modifying registered (not positional or ↵Andrew Trick
sink options) command line options at runtime. Patch by Dan Liew! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181254 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-06Support command line option categories.Andrew Trick
Patch by Dan Liew! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181253 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-06Fix build warnings/UB in LTOCodeGenerator.cppDerek Schuff
Change the gatherModuleForLinking interface to return void, and add a default case in setMergedModuleOutputFormat to silence gcc warning. BUG=cleanup R=jvoung@chromium.org, mseaborn@chromium.org Review URL: https://codereview.chromium.org/14582019
2013-05-06Provide InstCombines for the following 3 cases:Jean-Luc Duprat
A * (1 - (uitofp i1 C)) -> select C, 0, A B * (uitofp i1 C) -> select C, B, 0 select C, 0, A + select C, B, 0 -> select C, B, A These come up in code that has been hand-optimized from a select to a linear blend, on platforms where that may have mattered. We want to undo such changes with the following transform: A*(1 - uitofp i1 C) + B*(uitofp i1 C) -> select C, A, B git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181216 91177308-0d34-0410-b5e6-96231b3b80d8