aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
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-03Cleanup output of pnacl-bcanalyzer.Karl Schimpf
(1) Fix spacing in header of record histogram so that columns line up. (2) Only print 8 operands per line in the dump. Keeps lines from getting too long. BUG=None R=jvoung@chromium.org, mseaborn@chromium.org Review URL: https://codereview.chromium.org/18147006
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-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-07-02Tweak the PNaClLangRef doc with some recent changesEli Bendersky
BUG=None R=mseaborn@chromium.org Review URL: https://codereview.chromium.org/18543004
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-07-01Cleanup of pnacl-llc.Eli Bendersky
Removing some code and comments that aren't needed. BUG=None R=jvoung@chromium.org Review URL: https://codereview.chromium.org/18348005
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-28Teach llvm-nm to read PNaCl bitcode.Eli Bendersky
BUG=None R=jvoung@chromium.org Review URL: https://codereview.chromium.org/18153009
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-28Change header include for llvm.nacl.target.arch in pnacl-llc.Jan Voung
Have nacl-file include "pnacl.h" from the nacl repo, instead of from the toolchain's standard include locations, so that it can be moved out of the toolchain tarball and not advertise it to normal developers. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3525 R=mseaborn@chromium.org Review URL: https://codereview.chromium.org/18178007
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
2013-06-26PNaCl wire format: Use FORWARDTYPEREF consistently for all forward referencesMark Seaborn
Before this change, the writer would only emit FORWARDTYPEREF for some operands, e.g. the first operand of BINOP but not the second, on the grounds that the type of the second operand can be inferred. However, that makes the format complicated. Change the writer so that it always emits FORWARDTYPEREF for a forward ref. This unifies PushValueAndType() and pushValue(). pushValue() gains a call to EmitFnForwardTypeRef() so becomes the same as PushValueAndType(). Change the reader to be stricter, so that it requires a FORWARDTYPEREF to have been emitted in most cases. This is done by ignoring the implied type argument. Tasks still remaining: * Make reader stricter so that multiple FORWARDTYPEREFs are disallowed. * Remove now-unused Type arguments in the reader. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3507 TEST=new llvm-lit test + PNaCl toolchain trybots Review URL: https://codereview.chromium.org/17806003
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-26PNaCl wire format: Remove magic number and hash from encoding of 'switch'Mark Seaborn
The magic number is no longer needed now that the reader for the old switch representation has been removed (in https://codereview.chromium.org/17764003), so we can remove this baggage. Also add a missing record size check to the reader. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3507 TEST=hello_world.pexe includes a switch statement; also PNaCl toolchain trybots Review URL: https://codereview.chromium.org/17777005
2013-06-25PNaCl wire format: Remove code for reading old SwitchInst representationMark Seaborn
The PNaCl pexe writer never writes this old representation. 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/17764003
2013-06-25Support for mem* library functions in stable bitcode via intrinsics.Eli Bendersky
* Don't preserve external linking for mem{cpy,move,cmp} during LTO. * In the RewritePNaClLibraryCalls pass - add rewriting of mem* calls to appropriate intrinsics, similarly to the way it was done for longjmp. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3493 R=mseaborn@chromium.org Review URL: https://codereview.chromium.org/17622003
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: Fix ExpandStructRegs to handle "select" instructionsMark Seaborn
The code is similar to the case for handling phi nodes. It turns out that "select" on struct values can occur in practice with use of C++ method pointers. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3514 TEST=*.ll tests + PNaCl toolchain trybots Review URL: https://codereview.chromium.org/17706002
2013-06-25Revert "Apply upstream r183551, r183601, r183624 and r183794"Jan Voung
Revert this until we fix i1 sext. Currently, it uses LSL and ASR, which are pseudo-instructions and get dropped on the floor when generating .o files. We'll fix that, but for now revert to green the bots. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3501 R=jfb@chromium.org Review URL: https://codereview.chromium.org/17715002
2013-06-25PNaCl: Fix removal of dead function prototypes in ABI simplificationMark Seaborn
The use of StripDeadPrototypes in PNaClABISimplify.cpp wasn't always having an effect: it doesn't work if there are dead constant references remaining to a function declaration. ReplacePtrsWithInts was leaving some of these references behind, so fix it. BUG=none TEST=llvm-lit tests Review URL: https://codereview.chromium.org/17636006
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-24Clarify PNaClLangRef w.r.t. function attributes or varargsEli Bendersky
BUG=https://code.google.com/p/nativeclient/issues/detail?id=3338 BUG=https://code.google.com/p/nativeclient/issues/detail?id=3415 R=mseaborn@chromium.org Review URL: https://codereview.chromium.org/17633003
2013-06-24PNaCl ABI: Strip alignment info from memcpy/memmove/memset intrinsic callsMark Seaborn
Do the same for memcpy/memmove/memset intrinsic calls that we have already done for integer loads and stores: Remove assumptions about pointer alignment by setting the alignment argument to 1. Make the ABI checker require this. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3445 TEST=*.ll tests + PNaCl toolchain trybots Review URL: https://codereview.chromium.org/17563008
2013-06-24PNaCl ABI: Disallow built-in multiplication in "alloca" instructionsMark Seaborn
Simplify the set of "alloca" instructions the ABI verifier allows. Before this change, we used i8 arrays, such as: alloca [8 x i8] After this change, we will just use i8 with an explicit size value, so that becomes: alloca i8, i32 8 Allocation of variable-length arrays will require an explicit multiply instruction. This means that the code generator no longer has to handle an implicit multiplication in "alloca", reducing the burden on fast-and-simple code generators a little. This means the PNaCl ABI doesn't need to specify whether alloca's implicit multiplication checks for overflow. This doesn't affect what the backend generates. See lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp, which handles constant-size AllocaInsts (by filling out StaticAllocaMap) and which is uses for both -O2 (SelectionDAG) and -O0 (FastISel) translation. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3343 TEST=*.ll tests + PNaCl toolchain trybots Review URL: https://codereview.chromium.org/17631004
2013-06-24Move i32/i64 cttz, ctlz, and ctpop to whitelisted intrinsics.Jan Voung
Disallow the other input types. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3378 R=jfb@chromium.org Review URL: https://codereview.chromium.org/17613002
2013-06-24Force user to provide -mptriple to pnacl-llc.Eli Bendersky
We already always provide -mptriple to pnacl-llc, and it's nonsensical to run it without it because pexe don't contain a triple. BUG=None R=dschuff@chromium.org Review URL: https://codereview.chromium.org/17617002
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-24Merge r179774: Allow misaligned stores in x86 fast-isel.Mark Seaborn
This change will fix the regression in -O0 translation time caused by putting "align 1" on integer loads and stores, which was causing FastISel to fall back to SelectionDAG more often. > In X86FastISel::X86SelectStore(), improperly aligned stores are > rejected and handled by the DAG-based ISel. However, > X86FastISel::X86SelectLoad() makes no such requirement. There > doesn't appear to be an x86 architectural correctness issue with > allowing potentially unaligned store instructions. This patch > removes this restriction. > > Patch by Jim Stichnot. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3445 TEST=PNaCl toolchain trybots Review URL: https://codereview.chromium.org/17575003
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-21Update LangRef.rst to the 3.3 version and add PnaclRef.rstEli Bendersky
PnaclRef.rst is an initial reference manual for PNaCl bitcode. It's using the same documentation system to build as the other LLVM .rst docs and has multiple links into relevant sections of LangRef. BUG=None R=jvoung@chromium.org Review URL: https://codereview.chromium.org/17463004
2013-06-21PNaCl wire format: Remove function attributes from pexe reader/writerMark Seaborn
Remove support for reading and writing the PARAMATTR_BLOCK_ID and PARAMATTR_GROUP_BLOCK_ID blocks. These blocks will no longer be written into pexes. While PNaCl doesn't allow function attributes on normal functions, Function::Create() always inserts them back on intrinsics, so previously the PARAMATTR blocks were being written into pexes. Remove paramattr fields from two record types: * MODULE_CODE_FUNCTION records (function declarations). Also remove the fields that follow paramattr, which PNaCl also does not use. * FUNC_CODE_INST_CALL (function calls). BUG=https://code.google.com/p/nativeclient/issues/detail?id=3506 TEST=PNaCl toolchain trybots + GCC torture tests + Spec2k Review URL: https://codereview.chromium.org/17419013
2013-06-21Fix warning messages in bitcode encoding functions.Karl Schimpf
BUG=None R=jvoung@chromium.org Review URL: https://codereview.chromium.org/17519003
2013-06-20Unbreak CMake+Ninja buildEli Bendersky
BUG=None R=jvoung@chromium.org Review URL: https://codereview.chromium.org/17115012
2013-06-20Clean-up pnacl-llc a bit, now that it's truly PNaCl-only.Eli Bendersky
No changes in functionality. Specific cleanups: * Use OwningPtr instead of bare pointer for FDOut * Command-line help should say pnacl-llc instead of a generic llvm message * Remove support for "skip module" feature * Remove some LOCALMOD comments * Add link to issue for TODO about timing IR parsing BUG=None R=jvoung@chromium.org, kschimpf@google.com Review URL: https://codereview.chromium.org/17101032
2013-06-20PNaCl ABI: Reduce the set of allowed "align" attributes on loads/storesMark Seaborn
Change the ABI verifier to require "align 1" on non-atomic integer accesses to prevent non-portable behaviour. Allow larger alignments on floating point accesses as a concession to performance, because ARM might not be able to do unaligned FP loads/stores efficiently. Change StripAttributes to make pexes pass the ABI verifier. Also update comments in StripAttributes to match some recent changes. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3445 TEST=*.ll tests + PNaCl toolchain trybots Review URL: https://codereview.chromium.org/17094009
2013-06-19PNaCl ABI: Disallow the "externally_initialized" attribute of GlobalVariablesMark Seaborn
BUG=https://code.google.com/p/nativeclient/issues/detail?id=3415 TEST=*.ll tests + PNaCl toolchain trybots Review URL: https://codereview.chromium.org/17470005
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