aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
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
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-16Work around a gcc 4.6.3 / 4.7 bug.Jim Stichnoth
GCC bug http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58416 causes the bf64-1.c test to fail in the GCC torture test suite. This provides an upstreamable workaround. Inspection of the LLVM code base showed no other instances of the pattern that triggers the gcc bug. This can also be upstreamed as soon as I can get a working x86-32 upstream build working to verify/test against. In the meantime, we can make one pnacl-fyi bot go green again. BUG= https://code.google.com/p/nativeclient/issues/detail?id=3685 R=jfb@chromium.org, jfb@google.com Review URL: https://codereview.chromium.org/23437037
2013-09-16Generate PNaCl bitcode files using version 2.Karl Schimpf
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3590 R=mseaborn@chromium.org Review URL: https://codereview.chromium.org/23974004
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-09-09PNaCl bitcode: Make the reader reject TYPE_CODE_POINTER in the type tableMark Seaborn
Making the reader stricter is something I forgot to do in my earlier change that stops the writer from emitting TYPE_CODE_POINTER. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3671 TEST=test/NaCl/Bitcode/*.ll Review URL: https://codereview.chromium.org/23658027
2013-09-09Allow PNaCl version 2 to be supported and readabile.Karl Schimpf
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3590 R=jvoung@chromium.org Review URL: https://codereview.chromium.org/23924004
2013-09-09PNaCl bitcode: Fix reader to handle pointer type in is.lock.free intrinsicMark Seaborn
BUG=https://code.google.com/p/nativeclient/issues/detail?id=3671 TEST=test/NaCl/Bitcode/*.ll + NaCl's toolchain_tests with bitcode v2 enabled Review URL: https://codereview.chromium.org/23523041
2013-09-09PNaCl bitcode: Remove TYPE_CODE_POINTER entries from type tableMark Seaborn
There are now no uses of pointer type IDs in PNaCl bitcode, so we can stop outputting pointer types into the type table. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3671 TEST=test/NaCl/Bitcode/*.ll Review URL: https://codereview.chromium.org/23600013
2013-09-09PNaCl bitcode: Change FORWARDTYPEREF to never use pointer typesMark Seaborn
Before, FORWARDTYPEREFs used i8* type rather than i32 if they referenced an "alloca" instruction. Clean this up so that FORWARDTYPEREFs use i32 instead in this case. Note that this means that a forward-referenced "alloca" can be used via an ptrtoint+inttoptr, rather than a bitcast, but that's no problem. This is a step towards removing TYPE_CODE_POINTER from the types table, to simplify the PNaCl bitcode format. Rename NormalizeParamType() to NormalizeScalarType() to reflect that it's used in more cases; make it public. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3671 TEST=test/NaCl/Bitcode/*.ll Review URL: https://codereview.chromium.org/23719016
2013-09-06PNaCl bitcode: Fix two compiler warnings about unused variablesMark Seaborn
BUG=none TEST=compile Review URL: https://codereview.chromium.org/23619020
2013-09-06PNaCl bitcode: Use function type not ptr-to-function type to declare functionMark Seaborn
This is a step towards removing TYPE_CODE_POINTER from the types table. This will make the format simpler. It will also make bitcode files a little smaller, because we won't need to use type IDs for referring to pointer types. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3671 TEST=test/NaCl/Bitcode/*.ll Review URL: https://codereview.chromium.org/24049002
2013-09-06PNaCl bitcode: Strip pointer types from intrinsic declarations' parametersMark Seaborn
Change the writer to strip pointer types from intrinsics' argument and return types, replacing them with i32. This simplifies the PNaCl bitcode format so that pointer types don't need to be represented here. Change the reader to restore the pointer types so that the intrinsic declarations pass the LLVM and PNaCl verifiers. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3671 TEST=intrinsic tests in call-elide.ll + intrinsic-pointer-args.ll + run small_tests with bitcode v2 enabled Review URL: https://codereview.chromium.org/23793005
2013-09-06Emit MachineMoves for ARM floating point callee-saved registersDerek Schuff
Currently when a function uses floating-point callee-saved registers, it does not emit unwind info for adjusting the CFA and showing the locations of the saved registers on the stack. This results in the unwinder getting a bad value for the return address when it attempts to unwind past the function's frame, which breaks gdb backtracing and exception handling unwinding. Add to the existing MachineMoves describing the CFA and register locations to handle the float registers BUG= https://code.google.com/p/nativeclient/issues/detail?id=3670 R=jvoung@chromium.org Review URL: https://codereview.chromium.org/23691041
2013-09-06Clean up vestigial code for constants in PNaCl bitcode files.Karl Schimpf
* Removes code that is no longer used because global variables are handled separately. * Removes CST_CODE_NULL. * Adds special abbreviations for constant integer 0, replacing most of what was lost when CST_CODE_NULL is removed. * Adds abbreviation for floating point constants. * Removes CST_CODE_AGGREGATE and CST_CODE_DATA, except for reading old PNaCl version 1 bitcode files. * Removes call to ParseConstants() in ParseModule() since the module block no longer contains a constants block (globals are handled separately). * Removes getConstantFwdRef() method, since it is no longer needed. * Remove ConstantPlaceHolder class, since it is no longer needed. * Remove ResolvedConstants and ResolveConstantForwardRefs() from the bitcode reader, since it is no longer needed. BUG= https://code.google.com/p/nativeclient/issues/detail?id=3668 R=mseaborn@chromium.org Review URL: https://codereview.chromium.org/23522024
2013-09-06PNaCl bitcode: Fix some tests to not use unsupported pointer-typed argsMark Seaborn
Remove an unused "i32* %ptr" argument from a couple of test cases. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3671 TEST=call-elide.ll Review URL: https://codereview.chromium.org/23945004
2013-09-05PNaCl bitcode: Change test to use an intrinsic to make it more realisticMark Seaborn
Pointer-typed arguments are only allowed for intrinsics, so change the test of pointer-args to call an intrinsic. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3671 TEST=call-elide.ll Review URL: https://codereview.chromium.org/23735008
2013-09-05PNaCl bitcode: Indirect calls: Store return type instead of function typeMark Seaborn
For indirect call instructions (INST_CALL_INDIRECT), it's not necessary to store the full function type. The argument types are already known from the arguments in the instruction. We only need to store the return type to be able to reconstruct the full function type. Storing only the return type ID will make the bitcode a little more compact. Return type IDs will be frequently-used scalar types, which can be given smaller type IDs than function types, which are less frequently used. This potentially makes the writer simpler: In principle, the writer no longer needs to make a pass across all functions' bodies to determine which function types are used in order to build the type table. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3544 TEST=*.ll tests Review URL: https://codereview.chromium.org/23521005
2013-09-05PNaCl bitcode: Don't output the LABEL type in the type tableMark Seaborn
The type ID for the "label" type is never referenced. The "label" type was only being added to the type table because EnumerateType() treats BasicBlock and Value operands the same. However, the rest of the reader and writer treat BasicBlock operands specially and not like other Values. Change some tests to use wildcards for some type IDs. This is so that I don't have to update all the type ID numbers now that the generated type tables have changed. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3590 TEST=run small_tests with v2 bitcode format enabled Review URL: https://codereview.chromium.org/23530031
2013-09-04Remove ARRAY/VECTOR types from PNaCl bitcode files.Karl Schimpf
The value selector list for switch statements are represented using ARRAY/VECTOR constants, but this information is not put into the bitcode file. This CL changes the value enumerator to not emit these constants. BUG= https://code.google.com/p/nativeclient/issues/detail?id=3649 R=mseaborn@chromium.org Review URL: https://codereview.chromium.org/23653013
2013-09-04PNaCl bitcode reader: Disallow pointer-typed arguments in indirect callsMark Seaborn
Make the bitcode reader stricter, so that it disallows pointer arguments in indirect function calls, which are disallowed by the PNaCl ABI checker. Pointer arguments in function calls are only allowed in intrinsic calls, and calls to intrinsics must always be direct calls, not indirect calls. This involves removing two tests that specifically test for pointer args. This is in preparation for tweaking how indirect calls are represented, so that they store the call's return type rather than the function type. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3544 TEST=*.ll tests Review URL: https://codereview.chromium.org/23660005
2013-09-03Remove generating STRUCT_ANON records in PNaCl bitcode files.Karl Schimpf
Don't generate types for elided cast instructions, since they are never put into the bitcode file. In addition, do not generate a type id for the types of global variables, because they are never needed. Don't allow STRUCT_ANON in bitcode files PNaClVersion==2. BUG= https://code.google.com/p/nativeclient/issues/detail?id=3648 R=jvoung@chromium.org Review URL: https://codereview.chromium.org/23455023
2013-09-03Remove all remaining pointer casts from PNaCl bitcode files.Karl Schimpf
For PNaClVersion==2, removes remaining pointer casts from bitcode files. This includes: * Return value can be casted to a scalar value. * Intrinsic calls may return an inherent pointer, which may need casting to a scalar value. Also modifies tests bitcast-elide.ll and inttoptr-elide.ll by removing tests that assumed there were remaining pointer bitcasts that do not get removed. BUG= https://code.google.com/p/nativeclient/issues/detail?id=3544 R=jvoung@chromium.org Review URL: https://codereview.chromium.org/23524003
2013-09-03Allow PNaCl bitcode versions to be automatically extendable.Karl Schimpf
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3656 R=mseaborn@chromium.org Review URL: https://codereview.chromium.org/23496022
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-30Revert some ARM byval localmods since byval+varargs are not in stable pexes.Jan Voung
Localmods came from: https://codereview.chromium.org/10825082/, and earlier. (1) The original change was so that byval parameters always go on the stack. That part was added because the original ARM code was buggy, and did not actually make a copy of the value, modifying the caller's struct (ouch!). (2) Then came a localmod to make all arguments following a byval go on the stack and to make the var-args code aware of that. This is so that arguments stay in the correct order for var-args to pick up. For (1) there has been some work upstream to make it work better. In any case, clang with --target=armv7a-...-gnueabi only used byval in some limited cases -- when the size of the struct is > 64 bytes where the backend will know that part of it could be in regs, and the rest can be memcpy'ed to the stack. For le32, clang will still generate byval without satisfying the same ARM condition (only for structs bigger than 64 bytes), so it could be *very bad* if we didn't have the ABI simpification passes rewrite the byval and try to let the ARM backend do things with byval... TEST=the GCC torture tests: va-arg-4.c, and 20030914-2.c and the example in issue 2746 still pass. BUG=none, cleanup R=dschuff@chromium.org Review URL: https://codereview.chromium.org/23691009
2013-08-30Revert "Remove generating STRUCT_ANON records in PNaCl bitcode files."Karl Schimpf
This reverts commit 2302e5d39e2302962d1a0e45d60e00ed47b9b061. BUG= R=eliben@chromium.org Review URL: https://codereview.chromium.org/23827002
2013-08-30Remove generating STRUCT_ANON records in PNaCl bitcode files.Karl Schimpf
Don't generate types for elided cast instructions, since they are never put into the bitcode file. In addition, do not generate a type id for the types of global variables, because they are never needed. Don't allow and STRUCT records in bitcode files when PNaClVersion==2. BUG= https://code.google.com/p/nativeclient/issues/detail?id=3648 R=mseaborn@chromium.org Review URL: https://codereview.chromium.org/23431008
2013-08-29LLVM: Update OWNERS.JF Bastien
R=dschuff@chromium.org Review URL: https://codereview.chromium.org/23480015
2013-08-29PNaCl bitcode: Remove handling of named struct typesMark Seaborn
Named struct types should not appear in LLVM IR that passes the PNaCl ABI verifier. Remove the test struct-types.ll because it no longer passes. Handling of TYPE_CODE_STRUCT_ANON must remain for now until this issue is fixed: https://code.google.com/p/nativeclient/issues/detail?id=3648 BUG=https://code.google.com/p/nativeclient/issues/detail?id=3590 TEST=PNaCl toolchain trybots Review URL: https://codereview.chromium.org/23490018
2013-08-29PNaCl bitcode: Remove handling of TYPE_CODE_OPAQUEMark Seaborn
Opaque struct types should not appear in LLVM IR that passes the PNaCl ABI verifier. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3590 TEST=PNaCl toolchain trybots Review URL: https://codereview.chromium.org/23738002
2013-08-28PNaCl bitcode: Remove handling of unsupported floating point typesMark Seaborn
The only FP types that PNaCl currently supports are float and double. Clean up error reporting: * Convert an assert() to a report_fatal_error(). * Return an error rather than an "undef" value. * Report the type code value when it is unknown. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3590 TEST=PNaCl toolchain trybots Review URL: https://codereview.chromium.org/23191009
2013-08-28PNaCl bitcode: Remove support for >64-bit int constants (CST_CODE_WIDE_INTEGER)Mark Seaborn
The PNaCl ABI verifier does not allow large integer constants. Remove an argument from EmitAPInt() which is now no longer used. Also make error reporting for unknown Constants more verbose. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3590 TEST=PNaCl toolchain trybots Review URL: https://codereview.chromium.org/22903044
2013-08-28Hardcode NaCl in ADT/Triple.h for NaCl only builds (no Darwin/Windows).Jan Voung
Ideally, OS-specific code would be factored out, but there are currently tons of "if (T.isOSBlah())" everywhere. E.g., 57 hits for isTargetDarwin, 36 hits for isOSDarwin, 45 hits for "getOS(", 23 hits for isMacOSX, etc... Hacking Triple.h gets us most of the way there. The X86 code also requires hacking the getEnvironment() to never return the Darwin enum value. We can't just return GNU always, because for ARM we want GNUEABIHF. There is still *some* MachO and COFF code because of code that handles container-specific relocations without checking the OS first. This prunes between 100KB to 200 KB per target (~100KB for ARM, and ~200KB for x86-64). See https://codereview.chromium.org/23540008/ for the test. BUG=https://code.google.com/p/nativeclient/issues/detail?id=1222 BUG=https://code.google.com/p/nativeclient/issues/detail?id=3321 R=dschuff@chromium.org, jfb@chromium.org Review URL: https://codereview.chromium.org/23453014
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-28PNaCl bitcode: Remove definition of unused constant, SWITCH_INST_MAGICMark Seaborn
This is unused since I cleaned up the handling of SwitchInsts for PNaCl. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3590 TEST=PNaCl toolchain trybots Review URL: https://codereview.chromium.org/23104008
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-26Elide pointer to int casts on phi nodes.Karl Schimpf
Handles the eliding of pointer to integer casts operands of the phi node. Also caches unelided casts generated in the reader (removing duplicates within the same block). This reduces the size of thawed pnacl-llc.pexe by about 2%. BUG= https://code.google.com/p/nativeclient/issues/detailid=3544 R=mseaborn@chromium.org Review URL: https://codereview.chromium.org/22909016
2013-08-23PNaCl bitcode: Remove support for TYPE_CODE_FUNCTION_OLDMark Seaborn
PNaCl uses TYPE_CODE_FUNCTION instead, as you'd expect. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3590 TEST=PNaCl toolchain trybots Review URL: https://codereview.chromium.org/22819015
2013-08-23PNaCl bitcode: Remove support for string constant valuesMark Seaborn
These are no longer used since we introduced the GLOBALVAR block for PNaCl, in which global variable initialisers are flattened. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3590 TEST=PNaCl toolchain trybots Review URL: https://codereview.chromium.org/22903045
2013-08-19Remove FlagNaClUseM23ArmAbi since M23 was a long time ago.Jan Voung
It was used to support old r9/TLS model: https://codereview.chromium.org/11345042/ BUG=none (cleanup) R=jfb@chromium.org Review URL: https://codereview.chromium.org/23135011
2013-08-14Remove ptrtoint instructions from the PNaCl bitcode file.Karl Schimpf
Removes ptrtoint instructions when applicable (currently only in stores), and add them back just before their use. Note: This code does not handle ptrtoint casts for calls and phi nodes, binary operators, etc. because handling of casts for these instructions has not been added yet. BUG= https://code.google.com/p/nativeclient/issues/detail?id=3544 R=jvoung@chromium.org Review URL: https://codereview.chromium.org/22633002
2013-08-14Correct DCE comment.JF Bastien
Follow-up to https://codereview.chromium.org/22710004/ R=eliben@chromium.org Review URL: https://codereview.chromium.org/23085007
2013-08-14Updating the developer's guide with additional PNaCl information.Eli Bendersky
I don't think this specific format will be what we eventually "ship" to the NaCl documentation website, but it's useful to have a placeholder to add things to. For example, information like language and library versions supported, preprocessor macros and so on. We will have to document these at some point. Feel free to suggest additional such things that need to be documented (here or in subsequent CLs). BUG=None R=jvoung@chromium.org Review URL: https://codereview.chromium.org/23105006