aboutsummaryrefslogtreecommitdiff
path: root/tools
AgeCommit message (Collapse)Author
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-06-05Change CL flag -pnacl-freeze to -bitcode-format={llvm,pnacl}.Karl Schimpf
Also removes flag from llvm-as.cpp and LTOCodeGenerator.cpp since one should call pnacl-finalize to transform pexe's to PNaCl bitcode form. BUG= https://code.google.com/p/nativeclient/issues/detail?id=3469 R=dschuff@chromium.org, jvoung@chromium.org Review URL: https://codereview.chromium.org/16295014
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-28Update llc/pnacl-llc makefiles to link nacltransforms.Eli Bendersky
i686 translator build fails otherwise, not finding the symbols for passes invoked by llc. This breakage was introduced by commit ffc13bcb40d4257202295fc0ffe25b38bdf64263 BUG=https://code.google.com/p/nativeclient/issues/detail?id=3429 R=mseaborn@chromium.org Review URL: https://codereview.chromium.org/15786007
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-24Allow generation of pnacl bitcode files in several llvm commnads.Karl Schimpf
Adds command line option '-pnacl-freeze' to generate a pnacl bit code file instead of an llvm bitcode file. BUG= https://code.google.com/p/nativeclient/issues/detail?id=3405 R=dschuff@chromium.org Review URL: https://codereview.chromium.org/15178005
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-21The RecordMetadataForSrpc function that was removed initialized ↵Eli Bendersky
NaClRecordObjectInformation, and this initialization has to be reinstated. BUG=None R=dschuff@chromium.org Review URL: https://codereview.chromium.org/15451003
2013-05-15Separate the PNaCl llc into a tool named pnacl-llc (how original!)Eli Bendersky
BUG=None R=jvoung@chromium.org Review URL: https://codereview.chromium.org/14604011
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-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-06Copy llvm-bcanalyzer to build pnacl-bcanalyzer.Karl Schimpf
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3405 R=jvoung@chromium.org Review URL: https://codereview.chromium.org/15013003
2013-05-06Split Alignment out of the Section Characteristics.Rafael Espindola
The alignment is just a byte in the middle of Characteristics, not an independent flag. Making it an independent field in the yaml representation makes it more yamlio friendly. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181243 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-06Allow pnacl-freeze/thaw to redirect to stdin/stdout.Karl Schimpf
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3405 R=jvoung@chromium.org Review URL: https://codereview.chromium.org/14642019
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-06Remove some redundant includes in llvm-mc.cpp.Rafael Espindola
Patch by Jun Koi! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181231 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-04Optimize llvm-link too.Rafael Espindola
This takes the linking of almost all modules in a clang build from 6:32 to 0:19. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181105 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-04Last batch of cleanups to Linker.h.Rafael Espindola
Update comments, fix * placement, fix method names that are not used in clang, add a linkInModule that takes a Mode and put it in Linker.cpp. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181099 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-04Don't construct or delete a module on the Linker.Rafael Espindola
The linker is now responsible only for actually linking the modules, it is up to the clients to create and destroy them. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181098 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-04Remove unused members and constructor arguments.Rafael Espindola
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181096 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-04Add missing header.Rafael Espindola
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181095 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-03Revert r181009.Amara Emerson
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181079 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-03Add support for reading ARM ELF build attributes.Amara Emerson
Build attribute sections can now be read if they exist via ELFObjectFile, and the llvm-readobj tool has been extended with an option to dump this information if requested. Regression tests are also included which exercise these features. Also update the docs with a fixed ARM ABI link and a new link to the Addenda which provides the build attributes specification. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181009 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-02Remove redundant flag.Bill Wendling
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180967 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-02We don't want FP elimination when doing an Apple-style build.Bill Wendling
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180949 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-01Copy LLVM bitcode reader to generate a PNaCl wire format reader.Karl Schimpf
Copy classes for LLVM BitcodeReader into a NaCl subdirectory, to create a wire format version. Renames classes/functions to include NaCl prefix, so that they don't conflict with the LLVM Bitcode reader. Also implements pnacl-thaw, showing that we can read the PNaCl wire format files. BUG= https://code.google.com/p/nativeclient/issues/detail?id=3405 R=jvoung@chromium.org Review URL: https://codereview.chromium.org/14314016
2013-04-30Remove unnecessary includes from pnacl-freeze.Karl Schimpf
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3405 Review URL: https://codereview.chromium.org/14322020
2013-04-29Fix CMake build of bitcode wrapper header utility.Derek Schuff
It wasn't even attempting to build before. R=jvoung@chromium.org BUG=cmake/ninja build Review URL: https://codereview.chromium.org/13844019
2013-04-26Check for metadata in PNaCl ABI checker.Jan Voung
Disallow all metadata by default. There is a flag "-allow-debug-metadata", which will be used in pnacl-ld driver, to not change the debugging workflow. That flag will not be present in the pnacl-abicheck driver though. We'll also run -strip-metadata within pnacl-ld, after optimizations are run, so that at least that part is checked inside pnacl-ld. CL for driver changes: https://codereview.chromium.org/14358048/ BUG= http://code.google.com/p/nativeclient/issues/detail?id=3348 R=dschuff@chromium.org Review URL: https://codereview.chromium.org/14329025
2013-04-26Use llvm/Object/MachO.h in macho-dumper. Drop the old macho parser.Rafael Espindola
For Mach-O there were 2 implementations for parsing object files. A standalone llvm/Object/MachOObject.h and llvm/Object/MachO.h which implements the generic interface in llvm/Object/ObjectFile.h. This patch adds the missing features to MachO.h, moves macho-dump to use MachO.h and removes ObjectFile.h. In addition to making sure that check-all is clean, I checked that the new version produces exactly the same output in all Mach-O files in a llvm+clang build directory (including executables and shared libraries). To test the performance, I ran macho-dump over all the files in a llvm+clang build directory again, but this time redirecting the output to /dev/null. Both the old and new versions take about 4.6 seconds (2.5 user) to finish. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180624 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-26Copy Bitwriter to generate PNaClBitwriter.Karl Schimpf
Copy classes for LLVM BitcodeWriter into a PNaCL subdirectory, to create a PNaCL version. Renames classes/methods to include PNaCl prefix so that they don't conflict with the LLVM BitcodeWriter. Also removed experimental support for use-list order preservation. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3405 Review URL: https://codereview.chromium.org/14126011
2013-04-25Clarify getRelocationAddress x getRelocationOffset a bit.Rafael Espindola
getRelocationAddress is for dynamic libraries and executables, getRelocationOffset for relocatable objects. Mark the getRelocationAddress of COFF and MachO as not implemented yet. Add a test of ELF's. llvm-readobj -r now prints the same values as readelf -r. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180259 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-25Don't compute a std::vector<uint8_t> just to write it out a stream.Rafael Espindola
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180247 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-24Use pointers to iterate over symbols.Rafael Espindola
While here, don't report a dummy symbol for relocations that don't have symbols. We used to says such relocations were for the first defined symbol, but now we return end_symbols(). The llvm-readobj output change agrees with otool. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180214 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-24Don't produce an empty llvm.compiler.used in LTO.Rafael Espindola
LTO was always creating an empty llvm.compiler.used. With this patch we now first check if there is anything to be added first. Unfortunately, there is no good way to test libLTO in isolation as it needs gold or ld64, but there are bots doing LTO builds that found this problem. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180202 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-23PNaCl: Add ExpandByVal pass for expanding out by-value struct args and resultsMark Seaborn
This pass expands out the "byval" and "sret" argument attributes. This will affect the calling conventions for PPAPI under PNaCl (for passing PP_Var etc. by value), so the PNaCl PPAPI shims will need to be updated in order to enable this pass by default. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3400 TEST=PNaCl toolchain trybots + GCC torture tests + LLVM test suite + Spec2k Review URL: https://codereview.chromium.org/13973018
2013-04-23PNaCl: Add FlattenGlobals pass for simplifying global variable initializersMark Seaborn
This pass converts initializers for global variables into a flattened normal form which removes nested struct types and simplifies ConstantExprs. In the future, we might change the bitcode format to use the flattened bytes+relocs representation for global initializers. In that case, we will be able to reuse the FlattenedConstant class in the bitcode reader/writer for converting to and from this form. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3113 TEST=test/Transforms/NaCl/flatten-globals.ll Review URL: https://codereview.chromium.org/14017011
2013-04-23Fix typo.Rafael Espindola
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180137 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-23Simplify yaml2obj a bit.Rafael Espindola
The COFFParser now contains only a COFFYAML::Object and the string table (which is recomputed, not serialized). The structs in COFFParser now all begin with a Header field with what is actually on the COFF object. The other fields are things that are semantically part of the struct (relocations in a section for exmaple), but are not actually represented that way in the object file. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180134 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-23Write relocations in yaml2obj.Rafael Espindola
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180115 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-22Fix bot build of translator, renormalize CMakeLists/LLVMBuild.txt/MakefileDerek Schuff
naming to better match upstream R=jvoung@chromium.org BUG=bot LLVM roll Review URL: https://codereview.chromium.org/14315012