From 9da170402594598fd2d075e45841096d4a10b126 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?T=C3=B6r=C3=B6k=20Edvin?= Date: Mon, 31 Aug 2009 22:38:59 +0300 Subject: [PATCH] Merge LLVM upstream SVN r80601. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This brings in some memory leak fixes for LLVMCOntext. Squashed commit of the following: commit 4cfaf41d499ce05b11ecb62746c3e86b04440f62 Author: Bill Wendling Date: Mon Aug 31 18:26:48 2009 +0000 Output a hex value, because all of the others are hex. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80601 91177308-0d34-0410-b5e6-96231b3b80d8 commit 7829e5a6558bb97589d47d61da3142f7ebbdaeac Author: Dale Johannesen Date: Mon Aug 31 18:05:23 2009 +0000 Fix some misspellings of XTARGET. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80598 91177308-0d34-0410-b5e6-96231b3b80d8 commit 8364630e4cb67b6f64a704960e73ae44ce3f10ed Author: Dale Johannesen Date: Mon Aug 31 17:49:20 2009 +0000 Mark test as passing on all x86, which it should, although I don't think anyone cares about this feature except Darwin. PR 4825. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80596 91177308-0d34-0410-b5e6-96231b3b80d8 commit cf91fb4cb2e15b1fa07dc1282ac59c3659d80015 Author: Chris Lattner Date: Mon Aug 31 17:08:30 2009 +0000 cleanups pointed out by duncan git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80595 91177308-0d34-0410-b5e6-96231b3b80d8 commit 752d366fe7a9d0f68258465ce554cdf40af2918e Author: Duncan Sands Date: Mon Aug 31 16:45:16 2009 +0000 Revert commit 80428. It completely broke exception handling on x86-32 linux. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80592 91177308-0d34-0410-b5e6-96231b3b80d8 commit 3c8dfbb88bb125c2b7d1105645937b14dce9bcd3 Author: Edwin Török Date: Mon Aug 31 16:14:59 2009 +0000 Free the constants that have no uses in ~LLVMContext. This fixes leaks from LLVMContext in multithreaded apps. Since constants are only deleted if they have no uses, it is safe to not delete a Module on shutdown, as many single-threaded tools do. Multithreaded apps should however delete the Module before destroying the Context to ensure that there are no leaks (assuming they use a different context for each thread). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80590 91177308-0d34-0410-b5e6-96231b3b80d8 commit 6d5f43b77a907a2b42ff405ab16e078c6598c70e Author: Edwin Török Date: Mon Aug 31 16:12:29 2009 +0000 Fix ExplicitSymbols leak. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80589 91177308-0d34-0410-b5e6-96231b3b80d8 commit b759ebc5bc48ee93a9f4b031ec6ed3247028d77c Author: Benjamin Kramer Date: Mon Aug 31 13:05:24 2009 +0000 Normalize makefile comments and sort cmake file lists. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80584 91177308-0d34-0410-b5e6-96231b3b80d8 commit d79f43204be2893e74872f1062e2a44f023d39e1 Author: Daniel Dunbar Date: Mon Aug 31 08:09:28 2009 +0000 llvm-mc: Pass values to MCStreamer as MCExprs, not MCValues. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80578 91177308-0d34-0410-b5e6-96231b3b80d8 commit f4c67959b5ea0bbd3a39085c91c2d3162c6fd973 Author: Daniel Dunbar Date: Mon Aug 31 08:09:09 2009 +0000 llvm-mc: Simplify EmitAssignment ('.set' is identical to '='). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80577 91177308-0d34-0410-b5e6-96231b3b80d8 commit b6a03e093598d90c10c8d1cab8425e3d107b12cf Author: Daniel Dunbar Date: Mon Aug 31 08:08:50 2009 +0000 llvm-mc: Remove MCAsmParser::Parse[Paren]RelocatableExpression. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80576 91177308-0d34-0410-b5e6-96231b3b80d8 commit 6e96621a502ddebc12cd4d139756b7a90fd1ca8a Author: Daniel Dunbar Date: Mon Aug 31 08:08:38 2009 +0000 llvm-mc: Switch MCInst to storing an MCExpr* instead of an MCValue. Also, use MCInst::print instead of custom code in MCAsmPrinter. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80575 91177308-0d34-0410-b5e6-96231b3b80d8 commit 667cfd44ac3394697e60f54f72bfd190436c061a Author: Daniel Dunbar Date: Mon Aug 31 08:08:17 2009 +0000 llvm-mc: Add MCAsmParser::Parse[Paren]Expression forms which return an MCExpr. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80574 91177308-0d34-0410-b5e6-96231b3b80d8 commit 22ad5f80f751da3ba986022d09c49fcc4416048a Author: Daniel Dunbar Date: Mon Aug 31 08:08:06 2009 +0000 llvm-mc: Make MCSymbolData symbol member const. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80573 91177308-0d34-0410-b5e6-96231b3b80d8 commit 29efe7e0c9d32aaefa2a2924a8ded5fd4c76ff28 Author: Daniel Dunbar Date: Mon Aug 31 08:07:55 2009 +0000 llvm-mc: Add MCContext to MCAssembler. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80572 91177308-0d34-0410-b5e6-96231b3b80d8 commit 890ebe2d940760796e088902a2613cdf30b16e76 Author: Daniel Dunbar Date: Mon Aug 31 08:07:44 2009 +0000 llvm-mc: Add MCAsmParser::getContext. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80571 91177308-0d34-0410-b5e6-96231b3b80d8 commit 510c1a5512b7de68dc9b272eaba0e5d6c3ddc8b9 Author: Daniel Dunbar Date: Mon Aug 31 08:07:33 2009 +0000 llvm-mc: Add MCExpr::{dump,print}. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80570 91177308-0d34-0410-b5e6-96231b3b80d8 commit bc4d607b1a5fd13c1f19ef812ebb6fe814831d56 Author: Daniel Dunbar Date: Mon Aug 31 08:07:22 2009 +0000 llvm-mc: Switch MCExpr construction to using static member functions, and taking the MCContext (which now owns all MCExprs). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80569 91177308-0d34-0410-b5e6-96231b3b80d8 commit 6e3b031540ae25a464bfa37cdbd19e2cad301ee7 Author: Daniel Dunbar Date: Mon Aug 31 08:07:08 2009 +0000 llvm-mc: Add some doxyment markers. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80568 91177308-0d34-0410-b5e6-96231b3b80d8 commit 3679d2f3156d001053bae8fa5a162852b7700a27 Author: Daniel Dunbar Date: Mon Aug 31 08:06:59 2009 +0000 llvm-mc: Move AsmExpr into MC lib (as MCExpr). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80567 91177308-0d34-0410-b5e6-96231b3b80d8 commit 298ea10f4da28d9be51f8be5af59f88ea86ce7ec Author: Chris Lattner Date: Mon Aug 31 07:23:46 2009 +0000 Step #1 to giving Callgraph some sane invariants. The problems with callgraph stem from the fact that we have two types of passes that need to update it: 1. callgraphscc and module passes that are explicitly aware of it 2. Functionpasses (and loop passes etc) that are interlaced with CGSCC passes by the CGSCC Passmgr. In the case of #1, we can reasonably expect the passes to update the call graph just like any analysis. However, functionpasses are not and generally should not be CG aware. This has caused us no end of problems, so this takes a new approach. Logically, the CGSCC Pass manager can rescan every function after it runs a function pass over it to see if the functionpass made any updates to the IR that affect the callgraph. This allows it to catch new calls introduced by the functionpass. In practice, doing this would be slow. This implementation keeps track of whether or not the current scc is dirtied by a function pass, and, if so, delays updating the callgraph until it is actually needed again. This was we avoid extraneous rescans, but we still have good invariants when the callgraph is needed. Step #2 of the "give Callgraph some sane invariants" is to change CallGraphNode to use a CallBackVH for the callsite entry of the CallGraphNode. This way we can immediately remove entries from the callgraph when a FunctionPass is active instead of having dangling pointers. The current pass tries to tolerate these dangling pointers, but it is just an evil hack. This is related to PR3601/4835/4029. This also reverts r80541, a hack working around the sad lack of invariants. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80566 91177308-0d34-0410-b5e6-96231b3b80d8 commit 21d79e26df48405ff2fdfde682c4fdf6c646ef8a Author: Chris Lattner Date: Mon Aug 31 06:57:37 2009 +0000 fix some cases where instcombine would change hte IR but not return true from runOnFunction git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80562 91177308-0d34-0410-b5e6-96231b3b80d8 commit 223479b6087a6d9a1470c857c459e408ba51df84 Author: Chris Lattner Date: Mon Aug 31 06:01:21 2009 +0000 cleanups, factor some code out to a helper function git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80542 91177308-0d34-0410-b5e6-96231b3b80d8 commit f5313424550268526a14fd910cfb59efb95e0f30 Author: Chris Lattner Date: Mon Aug 31 05:46:59 2009 +0000 fix a crash building SPASS by tolerating a callsite that doesn't exist in the callgraph, see the big comment at the top of the testcase. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80541 91177308-0d34-0410-b5e6-96231b3b80d8 commit 4c76b7e8e15bf7ed6607393535f64a9070b6df8c Author: Chris Lattner Date: Mon Aug 31 05:34:32 2009 +0000 comment and simplify some code. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80540 91177308-0d34-0410-b5e6-96231b3b80d8 commit d441cd63a37ec3589fed1cfba11bbb177dab8fa6 Author: Chris Lattner Date: Mon Aug 31 05:22:48 2009 +0000 add -debug output git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80539 91177308-0d34-0410-b5e6-96231b3b80d8 commit 26b7f945b3a935e44755202ef7be13fdee8c75b5 Author: Chris Lattner Date: Mon Aug 31 05:17:58 2009 +0000 improve -debug output, so that -debug is more likely to print when instcombine is changing stuff. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80538 91177308-0d34-0410-b5e6-96231b3b80d8 commit adba7ea53650f26a6752f606041ac6d741c1fd4f Author: Chris Lattner Date: Mon Aug 31 04:36:22 2009 +0000 fix a bug I introduced with my 'instcombine builder' refactoring changes: SimplifyDemandedBits can't use the builder yet because it has the wrong insertion point. This fixes a crash building MultiSource/Benchmarks/PAQ8p git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80537 91177308-0d34-0410-b5e6-96231b3b80d8 commit b74203603b43d08ddef33e9a4c9c03752d86aee6 Author: Chris Lattner Date: Mon Aug 31 04:09:04 2009 +0000 simplify some code by making the SCCNodes set contain Function*'s instead of CallGraphNode*'s. This also papers over a callgraph problem where a pass (in this case, MemCpyOpt) introduces a new function into the module (llvm.memset.i64) but doesn't add it to the call graph (nor should it, since it is a function pass). While it might be a good idea for MemCpyOpt to not synthesize functions in a runOnFunction(), there is no need for FunctionAttrs to be boneheaded, so fix it there. This fixes an assertion building 176.gcc. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80535 91177308-0d34-0410-b5e6-96231b3b80d8 commit 3e30f91f1c190b8f3ba93de2c8746e0addaf056e Author: Chris Lattner Date: Mon Aug 31 03:22:35 2009 +0000 only print the override triple if it exists! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80534 91177308-0d34-0410-b5e6-96231b3b80d8 commit fd7079292b43ca5eceae2c585fc2899033a448f7 Author: Chris Lattner Date: Mon Aug 31 03:15:49 2009 +0000 Fix PR4834, a tricky case where the inliner would resolve an indirect function pointer, inline it, then go to delete the body. The problem is that the callgraph had other references to the function, though the inliner had no way to know it, so we got a dangling pointer and an invalid iterator out of the deal. The fix to this is pretty simple: stop the inliner from deleting the function by knowing that there are references to it. Do this by making CallGraphNodes contain a refcount. This requires moving deletion of available_externally functions to the module-level cleanup sweep where it belongs. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80533 91177308-0d34-0410-b5e6-96231b3b80d8 commit 7d7776f7adca3f51d05c3bbfbacaf65a5ae5167f Author: Chris Lattner Date: Mon Aug 31 02:24:20 2009 +0000 use an accessor instead of poking internals of a node. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80532 91177308-0d34-0410-b5e6-96231b3b80d8 commit 7032b5cbb5282c844008e780c7bbdddf8f8cf096 Author: Oscar Fuentes Date: Mon Aug 31 01:58:50 2009 +0000 CMake: updated library dependencies. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80531 91177308-0d34-0410-b5e6-96231b3b80d8 commit 54b6adfbb882f2f9b96c241fb87d0128ce840960 Author: Jim Grosbach Date: Mon Aug 31 01:35:03 2009 +0000 PR4747 Shared landing pads run into trouble with SJLJ, as the dispatch table is mapped to call sites, and merging the pads will throw that off. There needs to be a one-to-one mapping of landing pad exception table entries to invoke call points. Detecting the shared pad during lowering of SJLJ info insn't sufficient, as the dispatch function may still need separate destinations to properly handle phi-nodes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80530 91177308-0d34-0410-b5e6-96231b3b80d8 commit 86ab47ae9c388e9e046dedd9d9d554268290e450 Author: Chris Lattner Date: Mon Aug 31 00:28:46 2009 +0000 update unit test for previous change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80528 91177308-0d34-0410-b5e6-96231b3b80d8 commit 3dab7152eedc0d822a9499102303eba526026021 Author: Chris Lattner Date: Mon Aug 31 00:19:58 2009 +0000 Fix some nasty callgraph dangling pointer problems in argpromotion and structretpromote. Basically, when replacing a function, they used the 'changeFunction' api which changes the entry in the function map (and steals/reuses the callgraph node). This has some interesting effects: first, the problem is that it doesn't update the "callee" edges in any callees of the function in the call graph. Second, this covers for a major problem in all the CGSCC pass stuff, which is that it is completely broken when functions are deleted if they *don't* reuse a CGN. (there is a cute little fixme about this though :). This patch changes the protocol that CGSCC passes must obey: now the CGSCC pass manager copies the SCC and preincrements its iterator to avoid passes invalidating it. This allows CGSCC passes to mutate the current SCC. However multiple passes may be run on that SCC, so if passes do this, they are now required to *update* the SCC to be current when they return. Other less interesting parts of this patch are that it makes passes update the CG more directly, eliminates changeFunction, and requires clients of replaceCallSite to specify the new callee CGN if they are changing it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80527 91177308-0d34-0410-b5e6-96231b3b80d8 commit 637d133ffeaa961837ebc87ee6934be5ef401b8f Author: Erick Tryzelaar Date: Sun Aug 30 23:41:20 2009 +0000 Fix header comment for bindings/ocaml/llvm/Makefile. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80526 91177308-0d34-0410-b5e6-96231b3b80d8 commit ad465d7013a6ec529a34605d51377202af71b418 Author: Erick Tryzelaar Date: Sun Aug 30 23:38:06 2009 +0000 Make sure we specify no arguments for context functions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80525 91177308-0d34-0410-b5e6-96231b3b80d8 commit ba263e5f1b2320558e3935bbfbdc10c6d581c19d Author: Chris Lattner Date: Sun Aug 30 22:24:32 2009 +0000 add a dump() method on callgraph. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80524 91177308-0d34-0410-b5e6-96231b3b80d8 commit 72489759fa9fb63fdfa9f2e363222f0c45bf1340 Author: Chris Lattner Date: Sun Aug 30 22:14:17 2009 +0000 rename test git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80523 91177308-0d34-0410-b5e6-96231b3b80d8 commit fae478e46e8ba5192eebbe569a627fdb954e587f Author: Chris Lattner Date: Sun Aug 30 22:13:26 2009 +0000 merge all sinking tests into one and convert them to filecheck. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80522 91177308-0d34-0410-b5e6-96231b3b80d8 commit a94b6974dd77e6457eba731fc6bf760d150f4207 Author: Chris Lattner Date: Sun Aug 30 22:08:19 2009 +0000 convert scalar_promote to filecheck style and merge 2003-12-13-VolatilePromote.ll into it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80521 91177308-0d34-0410-b5e6-96231b3b80d8 commit 9e2f641e11c20fa64e5f605e00168ecc7c0207b6 Author: Chris Lattner Date: Sun Aug 30 21:45:23 2009 +0000 eliminate some uses of prcontext. Any help here would be appreciated :) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80520 91177308-0d34-0410-b5e6-96231b3b80d8 commit b5d911fe3ad0daa3bab9f6ddb24931db969fed00 Author: Chris Lattner Date: Sun Aug 30 21:36:39 2009 +0000 rename test so that name reflects what it is testing for. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80519 91177308-0d34-0410-b5e6-96231b3b80d8 commit 16078ca613ec085b395afbabf5b68b7062e0ac1c Author: Chris Lattner Date: Sun Aug 30 21:36:06 2009 +0000 convert to filecheck format. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80518 91177308-0d34-0410-b5e6-96231b3b80d8 commit 0799dd19d3f0c2f1beb1b17ef7842ae5b61043d2 Author: Chris Lattner Date: Sun Aug 30 21:31:34 2009 +0000 suck a bunch more gep tests into getelementptr.ll and filecheckize them all. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80517 91177308-0d34-0410-b5e6-96231b3b80d8 commit 16d7262e7a2e523c97e2c8bb2b4ab8823cf05772 Author: Daniel Dunbar Date: Sun Aug 30 21:14:05 2009 +0000 Tweak comment. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80516 91177308-0d34-0410-b5e6-96231b3b80d8 commit 6a8458c86c784f7955ab7815b4840fc21f27b2d8 Author: Daniel Dunbar Date: Sun Aug 30 21:13:58 2009 +0000 Fix some possible-use-of-uninitialized warnings. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80515 91177308-0d34-0410-b5e6-96231b3b80d8 commit 909749e25e3d5442e5b407781d2de92871f81a64 Author: Chris Lattner Date: Sun Aug 30 21:02:36 2009 +0000 consolodate various GEP tests into getelementptr.ll using filecheck. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80514 91177308-0d34-0410-b5e6-96231b3b80d8 commit ccf7551a0445599b24a0eae667242e67b5f5d298 Author: Chris Lattner Date: Sun Aug 30 21:02:02 2009 +0000 another huge testcase, this time from 'gs' in llvm-test. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80513 91177308-0d34-0410-b5e6-96231b3b80d8 commit 1fa629a0ffe6aa837bda41389c098e236a5b0f0c Author: Chris Lattner Date: Sun Aug 30 21:01:14 2009 +0000 remove another poorly-reduced testcase which came from ldecod in llvm-test. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80512 91177308-0d34-0410-b5e6-96231b3b80d8 commit 36d9c48134861d576a78c09e001d7773a502ea76 Author: Chris Lattner Date: Sun Aug 30 21:00:11 2009 +0000 this testcase is 500 lines long and is distilled from bzip2, just remove it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80511 91177308-0d34-0410-b5e6-96231b3b80d8 commit 586de4da4bffce2aae9110a60a39a3318014674c Author: Chris Lattner Date: Sun Aug 30 20:48:15 2009 +0000 convert to filecheck git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80510 91177308-0d34-0410-b5e6-96231b3b80d8 commit 83288fa512830d723318bf99060d3ec4fbf53abc Author: Chris Lattner Date: Sun Aug 30 20:38:21 2009 +0000 Fix PR4748: don't fold gep(bitcast(x)) into bitcast(gep) when x is itself a bitcast. Since we have gep(bitcast(bitcast(y))) in this case, just wait for the two bitcasts to get zapped. This prevents instcombine from confusing some aliasing stuff, and allows it to directly eliminate the load in the testcase. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80508 91177308-0d34-0410-b5e6-96231b3b80d8 commit f3a2359906e6939a2552c7c23877592693d757f1 Author: Chris Lattner Date: Sun Aug 30 20:36:46 2009 +0000 misc cleanup git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80507 91177308-0d34-0410-b5e6-96231b3b80d8 commit 6807a24de176e563843a0c5a21c9358b5eeefc2d Author: Chris Lattner Date: Sun Aug 30 20:06:40 2009 +0000 add getPointerAddressSpace() to GEP instruction, use the method in a few scalar xforms to simplify things. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80506 91177308-0d34-0410-b5e6-96231b3b80d8 commit d6164c20cdaaa27a2cc7b340604b4df3f2b97129 Author: Chris Lattner Date: Sun Aug 30 20:01:10 2009 +0000 eliminate InsertCastBefore, use the builder instead. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80505 91177308-0d34-0410-b5e6-96231b3b80d8 commit 78628294ebe9a062fbd7e55edf5240e9b7c53fce Author: Chris Lattner Date: Sun Aug 30 19:47:22 2009 +0000 eliminate InsertBitCastBefore, just use the builder instead. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80504 91177308-0d34-0410-b5e6-96231b3b80d8 commit b77b0464ba62108a07af655f626f5bfe3bd63162 Author: Chris Lattner Date: Sun Aug 30 19:45:21 2009 +0000 add a "getPointerAddressSpace" helper method to LoadInst and StoreInst. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80503 91177308-0d34-0410-b5e6-96231b3b80d8 commit d33527768525e6447c6fdcf521ffb975165dbc7a Author: Anton Korobeynikov Date: Sun Aug 30 19:06:39 2009 +0000 Add missed pattern git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80502 91177308-0d34-0410-b5e6-96231b3b80d8 commit ad7516ac00ede459691feba7f448a4c3654ea6fc Author: Chris Lattner Date: Sun Aug 30 18:50:58 2009 +0000 convert a bunch more calls to InsertNewInstBefore to use the new Instcombine builder. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80501 91177308-0d34-0410-b5e6-96231b3b80d8 commit 36ec3b4e9828905bdc6bf7ef91ac808ab11e7d45 Author: Chris Lattner Date: Sun Aug 30 17:53:59 2009 +0000 fix typo git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80500 91177308-0d34-0410-b5e6-96231b3b80d8 commit 8ba22dd113839d66b3f2912aff6bdd27776b1608 Author: Chris Lattner Date: Sun Aug 30 17:44:10 2009 +0000 hopefully unbreak the build by making this-> explicit for dependent base class lookup. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80499 91177308-0d34-0410-b5e6-96231b3b80d8 commit 243874430bb02c8f76b7603cbc8f31ebf2749785 Author: Anton Korobeynikov Date: Sun Aug 30 17:14:54 2009 +0000 EXTRACT_VECTOR_ELEMENT can have result type different from element type. Remove the assertion and generalize the code for ARM NEON stuff. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80498 91177308-0d34-0410-b5e6-96231b3b80d8 commit 42cee05a28e87ba96760daaf9699f8355ea53f6e Author: Edwin Török Date: Sun Aug 30 08:24:09 2009 +0000 Add regular expression matching support, based on OpenBSD regexec()/regcomp() implementation. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80493 91177308-0d34-0410-b5e6-96231b3b80d8 commit c769485a593b86360597d913c083292279730695 Author: Chris Lattner Date: Sun Aug 30 07:44:24 2009 +0000 give instcombine a custom IRBuilder that adds new instructions to the workslist and is set to insert new instructions before the current one. Convert a bunch of stuff that used to call InsertNewInstBefore over to use it, greatly simplifying code and making it more natural. There is still a lot more to go, but this is a good start. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80492 91177308-0d34-0410-b5e6-96231b3b80d8 commit f0b47f327e20f338c90202ea21001dd9b06f7ef5 Author: Daniel Dunbar Date: Sun Aug 30 07:01:09 2009 +0000 Update test. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80490 91177308-0d34-0410-b5e6-96231b3b80d8 commit c5ad98f04a19b2b7d463713a77634471578d1a64 Author: Chris Lattner Date: Sun Aug 30 06:27:41 2009 +0000 add a new InstCombineWorklist::AddValue method that works even if the operand is not an instruction. Simplify most uses of AddOperandsToWorkList to use AddValue and inline it into the one remaining callsite. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80488 91177308-0d34-0410-b5e6-96231b3b80d8 commit 4796b62fccd6f8c414b5a642ebe0f6dbbabd5b61 Author: Chris Lattner Date: Sun Aug 30 06:22:51 2009 +0000 move AddUsersToWorkList to the worklist processing class, make the argument stronger typed. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80487 91177308-0d34-0410-b5e6-96231b3b80d8 commit 059cfc7570d47711c1b53c909ab0f9c347cb23c3 Author: Chris Lattner Date: Sun Aug 30 06:20:05 2009 +0000 rename AddUsesToWorkList -> AddOperandsToWorkList. The former looks too much like AddUsersToWorkList and keeps confusing me. Remove AddSoonDeadInstToWorklist and change its two callers to do the same thing in a simpler way. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80486 91177308-0d34-0410-b5e6-96231b3b80d8 commit a8d310b5231890e926000c6939540b93fe094b61 Author: Daniel Dunbar Date: Sun Aug 30 06:17:49 2009 +0000 llvm-mc/X86: Encode constant MCValue's correctly. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80485 91177308-0d34-0410-b5e6-96231b3b80d8 commit b03d1179e934cb99e30190835fea1e7f4a59ecad Author: Daniel Dunbar Date: Sun Aug 30 06:17:16 2009 +0000 llvm-mc: MCStreamer cleanups. - Remove EmitLocalSymbol, this is unsupported for now. - Switch Emit{CommonSymbol,Zerofill} to take alignment in bytes (for consistency). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80484 91177308-0d34-0410-b5e6-96231b3b80d8 commit 3183fb6b613c15627c33a8257cbbfe10dbf0bb7f Author: Chris Lattner Date: Sun Aug 30 06:13:40 2009 +0000 inline the trivial AddToWorkList/RemoveFromWorkList methods into their callers. simplify ReplaceInstUsesWith. Make EraseInstFromFunction only add operands to the worklist if there aren't too many of them (this was a scalability win for crazy programs that was only infrequently enforced). Switch more code to using EraseInstFromFunction instead of duplicating it inline. Change some fcmp/icmp optimizations to modify fcmp/icmp in place instead of creating a new one and deleting the old one just to change the predicate. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80483 91177308-0d34-0410-b5e6-96231b3b80d8 commit bf09d6330ea039406e250493d7e45d001f81734d Author: Chris Lattner Date: Sun Aug 30 05:56:44 2009 +0000 fix a bug I introduced in r80478 found by the build bot. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80482 91177308-0d34-0410-b5e6-96231b3b80d8 commit 5119c70d1620b79288c50ca2ad6a3ea4f11a3f35 Author: Chris Lattner Date: Sun Aug 30 05:55:36 2009 +0000 refactor instcombine's worklist processing stuff out to its own class. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80481 91177308-0d34-0410-b5e6-96231b3b80d8 commit 1dde4eb8a0aef903bfd53d8dabfc61a560e1b327 Author: Chris Lattner Date: Sun Aug 30 05:55:04 2009 +0000 make DenseMap::clear() early exit if there is nothing to do. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80480 91177308-0d34-0410-b5e6-96231b3b80d8 commit 69af0ff152a949c41ea8ff4550c74627306262f7 Author: Chris Lattner Date: Sun Aug 30 05:42:59 2009 +0000 some minor cleanups to IRBuilder, factor the insertion hook out of the main IRBuilder class to allow clients to override it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80479 91177308-0d34-0410-b5e6-96231b3b80d8 commit 1c641fc37fc42d878883b0325810a5c8c02a436c Author: Chris Lattner Date: Sun Aug 30 05:30:55 2009 +0000 more cleanups: remove some redundant code, and simplify some other places. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80478 91177308-0d34-0410-b5e6-96231b3b80d8 commit c2c8a0ac3f529c9e536862b213e18f67de05f422 Author: Chris Lattner Date: Sun Aug 30 05:08:50 2009 +0000 eliminate the temporary SrcGEPOperands smallvector. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80477 91177308-0d34-0410-b5e6-96231b3b80d8 commit 95ba1ec4cbb14614f9ac26c9aabe5cac6640c4b0 Author: Chris Lattner Date: Sun Aug 30 05:00:50 2009 +0000 simplify/detangle some control flow. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80476 91177308-0d34-0410-b5e6-96231b3b80d8 commit c0f553e874121b6a0feb35e580040c02da05ac3c Author: Chris Lattner Date: Sun Aug 30 04:49:01 2009 +0000 simplify and cleanup some code, remove some code that just does constant folding of gep's: this is already handled in a more general way. No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80475 91177308-0d34-0410-b5e6-96231b3b80d8 commit 9da50553ef4596ea75c3a5434bf9ad356fb574ee Author: Chris Lattner Date: Sun Aug 30 04:25:40 2009 +0000 default count-aa to -print-all. The whole reason to use count-aa is to see what queries are being made by a transformation, we might as well default to printing them. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80474 91177308-0d34-0410-b5e6-96231b3b80d8 commit 09880947395319ff0df656549ddf0b080b7af385 Author: Bill Wendling Date: Sun Aug 30 00:28:57 2009 +0000 Nuke moribund "std::string" version of EOL(..., Encoding). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80466 91177308-0d34-0410-b5e6-96231b3b80d8 commit cdfb9b17b94bffa0de0e4862d22369fa1dcd9099 Author: Dan Gohman Date: Sat Aug 29 23:54:26 2009 +0000 Add AutoGenerated.inc to svn:ignore. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80455 91177308-0d34-0410-b5e6-96231b3b80d8 commit 5d138f96f048cc7009397708ed10edea7cede5a6 Author: Dan Gohman Date: Sat Aug 29 23:39:38 2009 +0000 Remove an unnecessary Context argument. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80454 91177308-0d34-0410-b5e6-96231b3b80d8 commit f928ad4af07aaac5e7e81757dcd514acbb5cb39c Author: Dan Gohman Date: Sat Aug 29 23:37:49 2009 +0000 Minor logic simplification. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80453 91177308-0d34-0410-b5e6-96231b3b80d8 commit 3d9354c841746f1802babcd465e542d7a7ea2a10 Author: Dan Gohman Date: Sat Aug 29 23:36:57 2009 +0000 Add some comments. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80452 91177308-0d34-0410-b5e6-96231b3b80d8 commit 18e06cf39d0313f80b055eb98dba8d8f42fd08cd Author: Dan Gohman Date: Sat Aug 29 23:35:16 2009 +0000 Cleanup whitespace and indentation. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80451 91177308-0d34-0410-b5e6-96231b3b80d8 commit b006a1010559be4bc9d5e577c50fc750194f34a6 Author: Dan Gohman Date: Sat Aug 29 23:34:14 2009 +0000 Remove some unused fields. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80450 91177308-0d34-0410-b5e6-96231b3b80d8 commit 1596dd23f3e2df5225cdfcea0904a017f96aaa90 Author: Dan Gohman Date: Sat Aug 29 22:19:15 2009 +0000 CMOV_GR8 clobbers EFLAGS when its expansion involves an xor to set a register to 0. This fixes PR4814. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80445 91177308-0d34-0410-b5e6-96231b3b80d8 commit ac09afaf40216429fad53899cce2f9fde8e267d4 Author: Benjamin Kramer Date: Sat Aug 29 13:38:21 2009 +0000 Inline empty destructor. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80431 91177308-0d34-0410-b5e6-96231b3b80d8 commit 3c5374802712a3d28cd13207ed3979a95457075c Author: Bill Wendling Date: Sat Aug 29 12:31:38 2009 +0000 Fix warning about non-virtual destructor. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80429 91177308-0d34-0410-b5e6-96231b3b80d8 commit b4ac493684cdeb2147000a6816a563269fcf3c70 Author: Bill Wendling Date: Sat Aug 29 12:20:54 2009 +0000 - Add target lowering methods to get the preferred format for the FDE and LSDA encodings. - Make some of the values emitted by the FDEs dependent upon the pointer size. This is in line with how GCC does things. And it has the benefit of working for Darwin in 64-bit mode now. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80428 91177308-0d34-0410-b5e6-96231b3b80d8 commit 946b521498866b3d83c4447c9c0ece6095a56874 Author: Bill Wendling Date: Sat Aug 29 12:17:53 2009 +0000 Add a form of EOL which emits the text version of a DWARF format encoding. This doesn't handle all values of the formatting. Those can be added as needed. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80427 91177308-0d34-0410-b5e6-96231b3b80d8 commit 502c35e863882790a94ad432d0a03c4a7e1a0aad Author: Bob Wilson Date: Sat Aug 29 05:53:25 2009 +0000 PR4795: Remove EEVT::isFP, isInt and isVec types used by TableGen's type inferencing. As far as I can tell, these are equivalent to the existing MVT::fAny, iAny and vAny types, and having both of them makes it harder to reason about and modify the type inferencing code. The specific problem in PR4795 occurs when updating a vAny type to be fAny or iAny, or vice versa. Both iAny and fAny include vector types -- they intersect with the set of types represented by vAny. When merging them, choose fAny/iAny to represent the intersection. This is not perfect, since fAny/iAny also include scalar types, but it is good enough for TableGen's type inferencing. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80423 91177308-0d34-0410-b5e6-96231b3b80d8 commit 0ac7faa993d472be4a23e0e58fa6e9372960cfe8 Author: Eric Christopher Date: Sat Aug 29 01:12:46 2009 +0000 Make the augmentation size and next set of bytes agree on size, and make the reference pointer size as it should be. Fixes an abort on a testcase derived from libunwind's personality test in 64-bit. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80414 91177308-0d34-0410-b5e6-96231b3b80d8 commit 83b551c5efdc49183f744103cd8e22a75117d07f Author: Jeffrey Yasskin Date: Sat Aug 29 00:44:16 2009 +0000 Fix OProfile support after r80406 changed the DebugInfo interface from GlobalVariables to MDNodes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80411 91177308-0d34-0410-b5e6-96231b3b80d8 commit e54c004ea5ea6c7e89b1cef9531ce05096122bbf Author: David Goodwin Date: Sat Aug 29 00:11:13 2009 +0000 Another stab at fixing up register kill flags after post-RA scheduling. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80410 91177308-0d34-0410-b5e6-96231b3b80d8 commit cb7c98d9ef32354166106ff8218fb9fcbb8b2d24 Author: Anton Korobeynikov Date: Sat Aug 29 00:08:18 2009 +0000 Do not assert on too wide splats we don't support. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80409 91177308-0d34-0410-b5e6-96231b3b80d8 commit 44e0a6cee931258a05b190f9e6e411a6d276c96a Author: Anton Korobeynikov Date: Fri Aug 28 23:41:26 2009 +0000 Add missed extract_element pattern git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80408 91177308-0d34-0410-b5e6-96231b3b80d8 commit 15e723d2c6021bbeacad9baa9c0d946d4a19867e Author: Devang Patel Date: Fri Aug 28 23:24:31 2009 +0000 Reapply 79977. Use MDNodes to encode debug info in llvm IR. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80406 91177308-0d34-0410-b5e6-96231b3b80d8 commit c299914a58baed2d7cf594494dbba60880d476cd Author: Evan Cheng Date: Fri Aug 28 23:18:09 2009 +0000 Let Darwin linker auto-synthesize stubs and lazy-pointers. This deletes a bunch of nasty code in ARM asm printer. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80404 91177308-0d34-0410-b5e6-96231b3b80d8 commit a14f4474b2d915579e9e9bd8bf4080d7f25e7dcd Author: Eric Christopher Date: Fri Aug 28 22:33:43 2009 +0000 Nuke trailing whitespace. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80401 91177308-0d34-0410-b5e6-96231b3b80d8 commit c6750c9bc8e555f632777eb1c69793b3b0dc40f6 Author: Daniel Dunbar Date: Fri Aug 28 16:14:46 2009 +0000 Fix creation of .bca libraries with EXPORTED_SYMBOLS_LIST, this was putting the llvm-ld shell wrapper script in the archive, not the relinked object! Also, rename the temp file to avoid conflicts. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80373 91177308-0d34-0410-b5e6-96231b3b80d8 commit 72d34e1a91e3f2b58559f92e5c1716ba10586bf1 Author: Andreas Neustifter Date: Fri Aug 28 16:13:45 2009 +0000 Read Makefile.config before using LLVMGCC. See http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20090824/085828.html git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80372 91177308-0d34-0410-b5e6-96231b3b80d8 commit ab4193ba50b6b5fcda5e2230e4705676ec07b463 Author: Edwin Török Date: Fri Aug 28 16:12:48 2009 +0000 install-sh chmods to 0755 by default, and this causes 'git diff' to show that all the Makefiles changed mode. Fix this by tellint install-sh to chmod only to 0644, these are not executable files after all! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80371 91177308-0d34-0410-b5e6-96231b3b80d8 commit b5cc6d8ae5a5813f059b0f03511b29c101c3a8ba Author: Anton Korobeynikov Date: Fri Aug 28 16:06:41 2009 +0000 Short-term workaround for frame-related weirdness on win64. Some other minor win64 fixes as well. Patch by Michael Beck! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80370 91177308-0d34-0410-b5e6-96231b3b80d8 commit 422cc43971693fd61517993472065277cb0cc903 Author: Edwin Török Date: Fri Aug 28 14:05:07 2009 +0000 rm needs -f git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80363 91177308-0d34-0410-b5e6-96231b3b80d8 commit da6633bee39686d02cd348b5c79c9dfc14eea6fd Author: Edwin Török Date: Fri Aug 28 13:35:44 2009 +0000 Remove the llvmprof.out from the test output, otherwise running make check in a non-clean directory causes it to fail (for example when running make check twice), since execution counts will differ. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80362 91177308-0d34-0410-b5e6-96231b3b80d8 commit 3f10e8664f46c60e4153da5da0ce33cd6b0b2ea3 Author: Andreas Neustifter Date: Fri Aug 28 11:28:24 2009 +0000 Preparation for Optimal Edge Profiling: This implements the maximum spanning tree algorithm on CFGs according to weights given by the ProfileEstimator. This is then used to implement Optimal Edge Profiling. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80358 91177308-0d34-0410-b5e6-96231b3b80d8 commit c99a43a3864aee1121af69db21545a3974226d41 Author: Andreas Neustifter Date: Fri Aug 28 10:38:26 2009 +0000 Remove profiling output file because two consecutive runs of make check give error. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80357 91177308-0d34-0410-b5e6-96231b3b80d8 commit 354f75a94252e20f1d61ff7b047f34070dcccfc9 Author: Andreas Neustifter Date: Fri Aug 28 10:07:41 2009 +0000 Removed unnecessary file creation during test. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80356 91177308-0d34-0410-b5e6-96231b3b80d8 commit 975ad9a72fa60d0e8946c9ec584eb5c29d14386e Author: Andreas Neustifter Date: Fri Aug 28 10:00:28 2009 +0000 Pulled all tests into one test. Removed some redundant tests. Rename. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80355 91177308-0d34-0410-b5e6-96231b3b80d8 commit f14af431e0f9724474dfa923ba940ecaf19316c7 Author: Daniel Dunbar Date: Fri Aug 28 08:08:22 2009 +0000 Fix -Asserts warning, round two. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80354 91177308-0d34-0410-b5e6-96231b3b80d8 commit 796a639383578ff065b5c32539c88f9adb5327c2 Author: Daniel Dunbar Date: Fri Aug 28 07:08:47 2009 +0000 llvm-mc: .lsym is more unsupported than unimplemented, pending a use case appearing. Also, all one of the file level flags are implemented. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80352 91177308-0d34-0410-b5e6-96231b3b80d8 commit 8388a8fed449aa79d848dd2e7b0cf8650e063028 Author: Daniel Dunbar Date: Fri Aug 28 07:08:35 2009 +0000 llvm-mc: Support .comm emission. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80351 91177308-0d34-0410-b5e6-96231b3b80d8 commit 3ab6715ba17ac6726bd92a4514c68c5e58c3c884 Author: Evan Cheng Date: Fri Aug 28 06:59:37 2009 +0000 Print a nl before pic labels so they start at a new line. This makes assembly more readable. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80350 91177308-0d34-0410-b5e6-96231b3b80d8 commit fd5e315e8d6dca8cab80789552b6bbfef4d960e0 Author: Andreas Neustifter Date: Fri Aug 28 06:48:25 2009 +0000 Since all std::cout is gone, also remove iostream include. (See http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20090824/085620.html) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80349 91177308-0d34-0410-b5e6-96231b3b80d8 commit a2aca168e5c7bbb35569f6f77a3cd4e8bc17520a Author: Andreas Neustifter Date: Fri Aug 28 06:41:00 2009 +0000 Readded test from r79615, this tests the complete profiling tool chain. Furhter tests can test only parts of this system. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80348 91177308-0d34-0410-b5e6-96231b3b80d8 commit df98a14701fe2de1d0b83205f32edcdfef8ca141 Author: Daniel Dunbar Date: Fri Aug 28 05:49:21 2009 +0000 llvm-mc: Support .zerofill emission. - I'm still trying to figure out the cleanest way to implement this and match the assembler, currently there are some substantial differences. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80347 91177308-0d34-0410-b5e6-96231b3b80d8 commit 1c215be1a50bfd6f0b994d61d0c0548fefa52795 Author: Daniel Dunbar Date: Fri Aug 28 05:49:04 2009 +0000 llvm-mc: Tweak section alignment and size computation to match 'as' closer. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80345 91177308-0d34-0410-b5e6-96231b3b80d8 commit 91e7ee60faaf7867aebddbf4915e1422c6895337 Author: Daniel Dunbar Date: Fri Aug 28 05:48:54 2009 +0000 llvm-mc: Factor getSectionData out of SwitchSection. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80344 91177308-0d34-0410-b5e6-96231b3b80d8 commit 3f952b45c4791659fe6b6addfdc2812f11a21a41 Author: Daniel Dunbar Date: Fri Aug 28 05:48:46 2009 +0000 llvm-mc: Emit .lcomm as .zerofill. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80343 91177308-0d34-0410-b5e6-96231b3b80d8 commit c12c27bdbc93d517025612eab112f28366256839 Author: Daniel Dunbar Date: Fri Aug 28 05:48:29 2009 +0000 llvm-mc: Unique zero fill sections. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80342 91177308-0d34-0410-b5e6-96231b3b80d8 commit 15f1a5cc63c5f08b31c8a67884efd2604067711e Author: Daniel Dunbar Date: Fri Aug 28 05:48:22 2009 +0000 llvm-mc: Add const to EmitZeroFill section argument. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80341 91177308-0d34-0410-b5e6-96231b3b80d8 commit b6eff3bcb6f481500df60e028ceaff6b60336a1d Author: Daniel Dunbar Date: Fri Aug 28 05:48:10 2009 +0000 llvm-mc: Fix thinko in emitting values. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80340 91177308-0d34-0410-b5e6-96231b3b80d8 commit a8425d44b7ffa3397ac7d010598e9caab54e1ed4 Author: Daniel Dunbar Date: Fri Aug 28 05:48:04 2009 +0000 Add MathExtras.h OffsetToAlignment, like RoundUpToAlignment but returns the offset to the next aligned integer. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80339 91177308-0d34-0410-b5e6-96231b3b80d8 commit c24bcdb66bd5b6904147ac443ca44da2660f9223 Author: Daniel Dunbar Date: Fri Aug 28 05:47:56 2009 +0000 Fix -Asserts warning. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80338 91177308-0d34-0410-b5e6-96231b3b80d8 commit d7e5bacf57cba6f139d726a0c63cb195f38cd39d Author: Chris Lattner Date: Fri Aug 28 04:48:54 2009 +0000 finish a half formed thought :) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80334 91177308-0d34-0410-b5e6-96231b3b80d8 commit ac6a9258ed6e7fa1e1e40ef505799ac54e852be4 Author: Daniel Dunbar Date: Fri Aug 28 03:06:28 2009 +0000 Another NO_RUNTIME_LIBRARIES tweak... git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80331 91177308-0d34-0410-b5e6-96231b3b80d8 commit 1497c39481d4d8616d4ba1fb2cde490cfc100baa Author: Daniel Dunbar Date: Fri Aug 28 02:20:39 2009 +0000 Tweak NO_RUNTIME_LIBS. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80330 91177308-0d34-0410-b5e6-96231b3b80d8 commit c4823b9ee92e32a666e03406c46a530fcdbdda1a Author: Chris Lattner Date: Fri Aug 28 00:45:47 2009 +0000 Mark Andersen's as experimental. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80328 91177308-0d34-0410-b5e6-96231b3b80d8 commit a8b647dc112f792cb21b0b675e6d2b300207a4fa Author: Chris Lattner Date: Fri Aug 28 00:43:14 2009 +0000 Fix PR3913, patch by Jakub Staszak! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80327 91177308-0d34-0410-b5e6-96231b3b80d8 commit 5e1d21856de4bf387cccf8365885c45c87642dfb Author: Evan Cheng Date: Fri Aug 28 00:31:43 2009 +0000 v4, v5 does not support sxtb / sxth. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80322 91177308-0d34-0410-b5e6-96231b3b80d8 commit 66f3f9e7356761c91f8063a38b37293ce750c1c2 Author: Bob Wilson Date: Fri Aug 28 00:21:13 2009 +0000 Disable optional bindings for Apple-style builds. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80319 91177308-0d34-0410-b5e6-96231b3b80d8 commit dc8f15c7a771649ab75bdf2dea1b27067ee9f269 Author: Bob Wilson Date: Fri Aug 28 00:10:15 2009 +0000 Revert 76080. This broke some powerpc cross compiles. It also makes the llvmCore build dependent on whatever version of llvm-gcc happens to be installed on the build machine. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80316 91177308-0d34-0410-b5e6-96231b3b80d8 commit 6decb644026d266aaed9bc51e5840529a4af8df0 Author: Daniel Dunbar Date: Thu Aug 27 23:58:10 2009 +0000 Revert r80305, I forgot a dependent change. --- Reverse-merging r80305 into '.': U tools/llvm-mc/AsmParser.cpp git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80309 91177308-0d34-0410-b5e6-96231b3b80d8 commit 20b3210d23b9c5633787e3d8bbd98d7cc0083c32 Author: Devang Patel Date: Thu Aug 27 23:51:51 2009 +0000 Closure is a very generic name. Use AppleBlock instead. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80307 91177308-0d34-0410-b5e6-96231b3b80d8 commit 3edc5f01bcfec50757d8cbdb7cd0fb6abb561d67 Author: Daniel Dunbar Date: Thu Aug 27 23:45:06 2009 +0000 llvm-mc: Unique sections in .zerofill. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80305 91177308-0d34-0410-b5e6-96231b3b80d8 commit ab36e15e689a516f8ff2af4c2c0210a90a423652 Author: Gabor Greif Date: Thu Aug 27 23:44:33 2009 +0000 eliminate all 80-col violations that I have introduced in my recent checkins (and some others more) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80304 91177308-0d34-0410-b5e6-96231b3b80d8 commit 41d850e034d4f33728c8d8d51a3811dbe0fccf8c Author: Daniel Dunbar Date: Thu Aug 27 23:43:28 2009 +0000 Don't build runtime libraries in an Apple style build. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80303 91177308-0d34-0410-b5e6-96231b3b80d8 commit f5b6d86316d71c3eae687ecb56abfdfd12679a54 Author: Bruno Cardoso Lopes Date: Thu Aug 27 19:57:56 2009 +0000 Revert 80278 for now, it caused a lot of MIPS tests to fail git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80280 91177308-0d34-0410-b5e6-96231b3b80d8 commit 862f67b71f0aaeccdd24a0cbd4d99a9a9413c43a Author: Bruno Cardoso Lopes Date: Thu Aug 27 19:40:40 2009 +0000 Revamp our friend Mips :) Add MO flags to simplify the printing of relocations. Remove the support for printing large code model relocs (which aren't supported anyway). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80278 91177308-0d34-0410-b5e6-96231b3b80d8 commit 90adb6c4bd8c285660db59e5ac10fd71fa3c1076 Author: Dan Gohman Date: Thu Aug 27 18:16:24 2009 +0000 Don't mark CMOV_GR8 as two-address, or commutable, since it's a pseudo. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80271 91177308-0d34-0410-b5e6-96231b3b80d8 commit fa4c3253f6dd9f328549aa73e2710981ac3a2881 Author: Dan Gohman Date: Thu Aug 27 18:14:26 2009 +0000 Adjust the MachineBasicBlock verifier rules to be more tolerant of blocks that end with "unreachable". git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80270 91177308-0d34-0410-b5e6-96231b3b80d8 commit 20391ca63ee850ffd6fb86bfd058ff61b698197d Author: Eric Christopher Date: Thu Aug 27 18:08:16 2009 +0000 Add FIXME for when we support more specific XMM registers. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80269 91177308-0d34-0410-b5e6-96231b3b80d8 commit 3d82bbd2ddfb775d59f271cc25cade73551f976c Author: Eric Christopher Date: Thu Aug 27 18:07:15 2009 +0000 Nuke trailing whitespace. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80268 91177308-0d34-0410-b5e6-96231b3b80d8 commit f8b840f45084d2486be3fd074807d9a37564a33d Author: Dan Gohman Date: Thu Aug 27 18:02:03 2009 +0000 Use stripPointerCasts instead of doing the same manually. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80267 91177308-0d34-0410-b5e6-96231b3b80d8 commit a578538e9fde98cb05ce9740d7c63aafbd1c69f4 Author: Dan Gohman Date: Thu Aug 27 17:59:08 2009 +0000 Minor code simplification. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80266 91177308-0d34-0410-b5e6-96231b3b80d8 commit c99596ddbf78116260c177edcfad9261bf186b68 Author: Dan Gohman Date: Thu Aug 27 17:55:13 2009 +0000 Teach getUnderlyingObject and skipPointerCasts about GlobalAliases. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80265 91177308-0d34-0410-b5e6-96231b3b80d8 commit fe1256903404065be182735c1402411c4940e9e5 Author: Dan Gohman Date: Thu Aug 27 17:54:15 2009 +0000 Be somewhat more consistent about const qualifiers. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80264 91177308-0d34-0410-b5e6-96231b3b80d8 commit 3c8455152e3d41b8e5f7b33c3ed99c7a8105f5a8 Author: Dan Gohman Date: Thu Aug 27 17:52:56 2009 +0000 Global Aliases are not identifiable objects. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80263 91177308-0d34-0410-b5e6-96231b3b80d8 commit 54e98d921f7eabfd3baae5399e835ddc39a75e6c Author: Dan Gohman Date: Thu Aug 27 17:51:25 2009 +0000 Handle TargetData with const. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80262 91177308-0d34-0410-b5e6-96231b3b80d8 commit ec966442362eeff9b24c9eee2b11188ab4a5246b Author: Dan Gohman Date: Thu Aug 27 17:29:49 2009 +0000 Strip trailing whitespace from blank lines. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80259 91177308-0d34-0410-b5e6-96231b3b80d8 commit 7bec0f5f90c6d917beb4b1433c847aa132cdfacf Author: Gabor Greif Date: Thu Aug 27 17:07:35 2009 +0000 re-apply r80197, now that iterator.h is not mentioned any more git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80254 91177308-0d34-0410-b5e6-96231b3b80d8 commit aa152ae811d8e0ffd01c7a8b454d595cb1a1a31f Author: Anton Korobeynikov Date: Thu Aug 27 16:25:49 2009 +0000 Hopefully the final missing part :( scalar_to_vector is fully legal now git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80251 91177308-0d34-0410-b5e6-96231b3b80d8 commit 872393c20ee29eaae1746deed115f06192526f64 Author: Anton Korobeynikov Date: Thu Aug 27 16:10:17 2009 +0000 Forgot about actual change :) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80250 91177308-0d34-0410-b5e6-96231b3b80d8 commit 0a21bce095161b98a3671b2aa0e63a020b03e120 Author: Anton Korobeynikov Date: Thu Aug 27 16:04:47 2009 +0000 scalar_to_vector is fully legal now (implemented as subreg accesses) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80249 91177308-0d34-0410-b5e6-96231b3b80d8 commit 2b6e274f8669337cb148c1df4e060a41af14cc1e Author: Devang Patel Date: Thu Aug 27 15:32:38 2009 +0000 Remove an entry from ValueMap before removing elements. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80247 91177308-0d34-0410-b5e6-96231b3b80d8 commit 6e8275030925dbd3beeb873d0bf605f0c0c67f0b Author: Anton Korobeynikov Date: Thu Aug 27 14:51:42 2009 +0000 Ok, sometimes it's profitable to turn scalar_to_vector stuff into subreg access. Add a testcase. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80246 91177308-0d34-0410-b5e6-96231b3b80d8 commit baee7b2a5501a45a59554b5bafd87264a2edc442 Author: Anton Korobeynikov Date: Thu Aug 27 14:38:44 2009 +0000 Transform float scalar_to_vector into subreg accesses. No idea whether this is profitable or not. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80245 91177308-0d34-0410-b5e6-96231b3b80d8 commit 9daa0677ac901b0f54bdba31dc3913b92df58e50 Author: Misha Brukman Date: Thu Aug 27 14:14:21 2009 +0000 STRD and LDRD require ARMv5TE, not just ARMv5T. See http://llvm.org/PR4687 for more info and links. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80244 91177308-0d34-0410-b5e6-96231b3b80d8 commit 4dd75744b70c1a3f686ce5a43952124fb0de7ad9 Author: Benjamin Kramer Date: Thu Aug 27 12:02:34 2009 +0000 Inverse logic to increase portability. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80240 91177308-0d34-0410-b5e6-96231b3b80d8 commit 07f1cdae7f327c15cdfc0d68c8500a275dba72b2 Author: Sanjiv Gupta Date: Thu Aug 27 11:54:38 2009 +0000 To make mcc16 run correctly on mac. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80239 91177308-0d34-0410-b5e6-96231b3b80d8 commit 006e46ee524c49f00fdfa4d0b582c7ecd693c95b Author: Daniel Dunbar Date: Thu Aug 27 08:17:51 2009 +0000 llvm-mc/Mach-O: Add MCCodeEmitter support, for encoding instructions. - No relocations yet, of course. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80235 91177308-0d34-0410-b5e6-96231b3b80d8 commit 2f37963b50b496c99300850683ed41db4f9431b6 Author: Daniel Dunbar Date: Thu Aug 27 08:12:55 2009 +0000 llvm-mc/X86: Implement single instruction encoding interface for MC. - Note, this is a gigantic hack, with the sole purpose of unblocking further work on the assembler (its also possible to test the mathcer more completely now). - Despite being a hack, its actually good enough to work over all of 403.gcc (although some encodings are probably incorrect). This is a testament to the beauty of X86's MachineInstr, no doubt! ;) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80234 91177308-0d34-0410-b5e6-96231b3b80d8 commit 1f32816fdaf9ba3a7e6e5705f94be145fafde497 Author: Daniel Dunbar Date: Thu Aug 27 07:58:57 2009 +0000 llvm-mc: Print encodings after the instruction, and only when we have an asm printer. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80233 91177308-0d34-0410-b5e6-96231b3b80d8 commit 75513bd24edb8ea2142145b448df7a4cdaeaa335 Author: Daniel Dunbar Date: Thu Aug 27 07:58:05 2009 +0000 X86: Mark EH_RETURN as code-gen-only. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80232 91177308-0d34-0410-b5e6-96231b3b80d8 commit 0125384b4a902da228354e5a201cd4cf4f2f1a4a Author: Daniel Dunbar Date: Thu Aug 27 07:57:12 2009 +0000 Add {MCInst,MCOperand}::{print,dump} git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80231 91177308-0d34-0410-b5e6-96231b3b80d8 commit 160f252aa8189beba57b0b025b0206a3910c4ae9 Author: Daniel Dunbar Date: Thu Aug 27 07:56:39 2009 +0000 llvm-mc: Only show instruction encodings with --show-encoding. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80230 91177308-0d34-0410-b5e6-96231b3b80d8 commit f449eb343e70f1e4e8f982939d53c083a1bc5ba3 Author: Gabor Greif Date: Thu Aug 27 06:59:20 2009 +0000 the buildbots revealed one more breakage. fix. (why didn't I see this?) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80227 91177308-0d34-0410-b5e6-96231b3b80d8 commit 765f012f22956a3085e1e84441af9d880bf65f35 Author: Gabor Greif Date: Thu Aug 27 06:41:46 2009 +0000 Clean up the minor mess I caused with removing iterator.h. I shall take care of 80-col violations and the FIXME later. (Thanks goodness that I live in another continent, so the monkeypox did not strike me :-) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80224 91177308-0d34-0410-b5e6-96231b3b80d8 commit bc42440879f2a302f2801e224828cfdccd5a92a7 Author: Chris Lattner Date: Thu Aug 27 06:29:33 2009 +0000 Implement a new optimization in the inliner: if inlining multiple calls into a function and if the calls bring in arrays, try to merge them together to reduce stack size. For example, in the testcase we'd previously end up with 4 allocas, now we end up with 2 allocas. As described in the comments, this is not really the ideal solution to this problem, but it is surprisingly effective. For example, on 176.gcc, we end up eliminating 67 arrays at "gccas" time and another 24 at "llvm-ld" time. One piece of concern that I didn't look into: at -O0 -g with forced inlining this will almost certainly result in worse debug info. I think this is acceptable though given that this is a case of "debugging optimized code", and we don't want debug info to prevent the optimizer from doing things anyway. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80215 91177308-0d34-0410-b5e6-96231b3b80d8 commit 2d1272cbbc0ba9bffbc702e67c59a8d12ec93660 Author: Chris Lattner Date: Thu Aug 27 06:20:45 2009 +0000 the inliner shouldn't crash on this. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80214 91177308-0d34-0410-b5e6-96231b3b80d8 commit ea3bccb555f65187ecbb134d26aab8103ca167b2 Author: Daniel Dunbar Date: Thu Aug 27 06:11:15 2009 +0000 For now, only run MC tests if X86 is configured. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80213 91177308-0d34-0410-b5e6-96231b3b80d8 commit 17d1a4db879f7af0fd20dd78f704ff9f82aabbe1 Author: Bill Wendling Date: Thu Aug 27 05:49:50 2009 +0000 This is passing for PPC on Mac OS X. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80210 91177308-0d34-0410-b5e6-96231b3b80d8 commit cf5d1d8ceb34c56f21bd3f41f5329407e8d090ce Author: Bill Wendling Date: Thu Aug 27 05:35:28 2009 +0000 Revert accidental commit. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80208 91177308-0d34-0410-b5e6-96231b3b80d8 commit f659a56d993743e0d51beb2c94fbe187637e5918 Author: Chris Lattner Date: Thu Aug 27 04:43:05 2009 +0000 unbreak the build, yay for symlinks + makefiles. :( git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80205 91177308-0d34-0410-b5e6-96231b3b80d8 commit d1586b1a1d27d5efeb8e487bbeb7ed255159e53b Author: Chris Lattner Date: Thu Aug 27 04:32:07 2009 +0000 reduce header #include'age git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80204 91177308-0d34-0410-b5e6-96231b3b80d8 commit 1ba292d8cfe7b5bf705c5bb307f63f0c0bbe8979 Author: Chris Lattner Date: Thu Aug 27 04:20:52 2009 +0000 enhance InlineFunction to be able to optionally return a the list of static allocas that it inlined. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80203 91177308-0d34-0410-b5e6-96231b3b80d8 commit eb87590c5346b7c17032242e2232a6c1d217f964 Author: Chris Lattner Date: Thu Aug 27 04:02:30 2009 +0000 smallvectorize the list of returns built by CloneAndPruneFunctionInto. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80202 91177308-0d34-0410-b5e6-96231b3b80d8 commit 612956220f38126feaacceb378cf105043739271 Author: Chris Lattner Date: Thu Aug 27 03:56:43 2009 +0000 remove CloneTrace, which appears to be dead since 2004. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80201 91177308-0d34-0410-b5e6-96231b3b80d8 commit ae56c0de911bf5328ffda48e51ce37bcd7aa0d76 Author: Chris Lattner Date: Thu Aug 27 03:51:50 2009 +0000 reduce inlining factor some stuff out to a static helper function, and other code cleanups. No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80199 91177308-0d34-0410-b5e6-96231b3b80d8 commit 5537c20c55869fac64e4f5738f8eab2080cc79c6 Author: Bill Wendling Date: Thu Aug 27 03:32:50 2009 +0000 Revert accidental commit. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80198 91177308-0d34-0410-b5e6-96231b3b80d8 commit 25cd944a98bcf3b1542c71d2654fe61e28562867 Author: Bill Wendling Date: Thu Aug 27 03:29:26 2009 +0000 --- Reverse-merging r80147 into '.': A include/llvm/ADT/iterator.cmake U autoconf/configure.ac --- Reverse-merging r80161 into '.': U cmake/config-ix.cmake --- Reverse-merging r80171 into '.': U Makefile --- Reverse-merging r80173 into '.': U configure U include/llvm/Config/config.h.in --- Reverse-merging r80180 into '.': A include/llvm/ADT/iterator.h.in Despite common miscomceptions, iterator.h is alive and well. It broke the build bots for several hours. And yet no one bothered to look at them. Gabor and Doug, please review your changes and make sure that they actually build before resubmitting them. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80197 91177308-0d34-0410-b5e6-96231b3b80d8 commit 0d0598f6281c0b1ae107b2fa2fabd69ec21263c4 Author: Dan Gohman Date: Thu Aug 27 02:43:49 2009 +0000 Add some checks for MachineCFG consistency. Use AnalyzeBranch and do extra checking when it succeeds, as those are cases where CodeGen will be doing particularly interesting CFG modifications. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80196 91177308-0d34-0410-b5e6-96231b3b80d8 commit 92e5548870b7945deb93f7956ea816f67d34b73f Author: Daniel Dunbar Date: Thu Aug 27 02:08:37 2009 +0000 Update CMake git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80195 91177308-0d34-0410-b5e6-96231b3b80d8 commit 2f377df6bba8110c3bc0bf5185d33d1f46b54c6b Author: Daniel Dunbar Date: Thu Aug 27 01:34:22 2009 +0000 llvm-mc: Tweak MCCodeEmitter skeleton. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80193 91177308-0d34-0410-b5e6-96231b3b80d8 commit cdde2975f55c43493f3318630985e7a1e8e14384 Author: Dan Gohman Date: Thu Aug 27 01:25:57 2009 +0000 Initialize the PoisonMemory member before initializing members that call methods that read the PoisonMemory member. This fixes potential spurious (though probably otherwise harmless) poising of unused memory, and fixes the associated valgrind error. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80192 91177308-0d34-0410-b5e6-96231b3b80d8 commit 363cd759d4186bdae7b49e89a0d434749d6198aa Author: Evan Cheng Date: Thu Aug 27 01:23:50 2009 +0000 Fix PR4789. Teach eliminateFrameIndex how to handle VLDRQ and VSTRQ which cannot fold any immediate offset. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80191 91177308-0d34-0410-b5e6-96231b3b80d8 commit 511e71114c34c8ddae2b44b996502a5efe1adc3a Author: Daniel Dunbar Date: Thu Aug 27 01:15:54 2009 +0000 Add missing declarations. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80190 91177308-0d34-0410-b5e6-96231b3b80d8 commit 12266adfd9dc571aafb7ec7f8b69d85c7a6e352a Author: Daniel Dunbar Date: Thu Aug 27 00:51:57 2009 +0000 Sketch TargetRegistry support for MCCodeEmitter abstract interface. - Of course, nothing actually can provide this interface yet. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80188 91177308-0d34-0410-b5e6-96231b3b80d8 commit adb77e4c37d183af9a2f29b6df8b0dfee562bbba Author: Daniel Dunbar Date: Thu Aug 27 00:38:04 2009 +0000 Try to make MSVC just a little happier. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80187 91177308-0d34-0410-b5e6-96231b3b80d8 commit b59f15a1d2c40f978d93f43b006546f455a65f04 Author: Dan Gohman Date: Thu Aug 27 00:31:47 2009 +0000 X86FastISel support for loading and storing values of type i1. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80186 91177308-0d34-0410-b5e6-96231b3b80d8 commit 29b998f5248398e6cfe323a5ebd7419bb77975b4 Author: Dan Gohman Date: Thu Aug 27 00:14:12 2009 +0000 Expand i8 selects into control flow instead of 16-bit conditional moves. This avoids the need to promote the operands (or implicitly extend them, a partial register update condition), and can reduce i8 register pressure. This substantially speeds up code such as write_hex in lib/Support/raw_ostream.cpp. subclass-coalesce.ll is too trivial and no longer tests what it was originally intended to test. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80184 91177308-0d34-0410-b5e6-96231b3b80d8 commit a7bddb52ed1bb68e8c654c522b885f941c540d04 Author: Gabor Greif Date: Wed Aug 26 23:35:33 2009 +0000 now that include/llvm/ADT/iterator.h.in is not attempted to be built, its prerequisite can go away too git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80180 91177308-0d34-0410-b5e6-96231b3b80d8 commit b5b99e6fa820047460b362d5d981766ac313b1ce Author: Daniel Dunbar Date: Wed Aug 26 23:12:33 2009 +0000 Simplify. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80176 91177308-0d34-0410-b5e6-96231b3b80d8 commit 2eff5fff4d600df3d29f74dd195bc564a48206b4 Author: Douglas Gregor Date: Wed Aug 26 22:59:05 2009 +0000 Regenerate configure git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80173 91177308-0d34-0410-b5e6-96231b3b80d8 commit 3eace462948ecfec5ee53127c445e4d0d5f1ae89 Author: Gabor Greif Date: Wed Aug 26 22:55:19 2009 +0000 eliminate references to ADT/iterator.h git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80171 91177308-0d34-0410-b5e6-96231b3b80d8 commit d68b1af98ca9bb39ac51d046a37266ceb24e38b5 Author: Owen Anderson Date: Wed Aug 26 22:55:11 2009 +0000 Make this into a static method. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80170 91177308-0d34-0410-b5e6-96231b3b80d8 commit 2f01e9983a054713a49d2ac2124e8ca26d128574 Author: Bob Wilson Date: Wed Aug 26 22:50:39 2009 +0000 Fix bad length argument to substr calls. Apparently I'm the first one to attempt more than 2 constraints on an instruction. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80169 91177308-0d34-0410-b5e6-96231b3b80d8 commit 418706d9a8a304630ddecc3709598d823bee8188 Author: Daniel Dunbar Date: Wed Aug 26 22:49:51 2009 +0000 llvm-mc/Mach-O: Unique sections properly, so we don't get duplicate text sections, etc. - The quick and dirty way, just clone the TargetLoweringObjectFile code. Eventually this should be shared... somehow. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80168 91177308-0d34-0410-b5e6-96231b3b80d8 commit 1ea86df7ddb44659fbf694934abb2177beed8637 Author: Daniel Dunbar Date: Wed Aug 26 22:13:22 2009 +0000 llvm-mc/Mach-O: Don't put assembler temporary labels in the symbol table. - I moved section creation back into AsmParser. I think policy decisions like this should be pushed higher, not lower, when possible (in addition the assembler has flags which change this behavior, for example). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80162 91177308-0d34-0410-b5e6-96231b3b80d8 commit b003759e247f0edb3b691849598ba252f51ae624 Author: Douglas Gregor Date: Wed Aug 26 22:12:02 2009 +0000 De-bork CMake build git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80161 91177308-0d34-0410-b5e6-96231b3b80d8 commit e92cc8d5591cb7ded636c91cc98c741af62ec85f Author: Eric Christopher Date: Wed Aug 26 21:44:57 2009 +0000 Rework getPersonalityIndex slightly - 0 is now a valid and not-NULL personality function. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80153 91177308-0d34-0410-b5e6-96231b3b80d8 commit 2a1099a6809307eee7521b1f725ef89370f7ebd1 Author: Gabor Greif Date: Wed Aug 26 21:36:59 2009 +0000 nobody includes llvm/ADT/iterator.h any more, so get rid of this monstrosity. iterator.h.in is scheduled for deletion in my working copy, but I wait till I see that configure gets regenerated, as it depends on it. I'll commit then. There are still some AC_* tests in the configure.ac dealing with iterators, those can be zapped probably too. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80147 91177308-0d34-0410-b5e6-96231b3b80d8 commit c87d5ae938fe0c3b0afc3aefef1dc6a9873516e4 Author: Eric Christopher Date: Wed Aug 26 21:30:49 2009 +0000 If we're emitting additional CIEs due to personality functions don't emit the default one. Explicitly check for the NULL CIE later. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80146 91177308-0d34-0410-b5e6-96231b3b80d8 commit 84603633a7609ec55de5d8145048efbbf45e5c9c Author: Eric Christopher Date: Wed Aug 26 21:27:09 2009 +0000 Nuke trailing whitespace. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80145 91177308-0d34-0410-b5e6-96231b3b80d8 commit f8c4bb7da634d77a7f2cff601b8d3f53c143e9ad Author: Daniel Dunbar Date: Wed Aug 26 21:22:22 2009 +0000 llvm-mc/Mach-O: Set .subsections_via_symbols flag properly. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80144 91177308-0d34-0410-b5e6-96231b3b80d8 commit 87f46499f001931c031002473a73793772852e51 Author: Bill Wendling Date: Wed Aug 26 21:00:34 2009 +0000 Don't submit test directory. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80139 91177308-0d34-0410-b5e6-96231b3b80d8 commit 441e205eb82a0ebd70b807d8560c5a76188eabc5 Author: Reid Kleckner Date: Wed Aug 26 20:58:25 2009 +0000 Allocate the module provider in the Kaleidoscope code on the heap, not the stack, so that it can be properly deleted. Also update the tutorial with the new code. This fixes PR4762, hopefully better than the last time. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80138 91177308-0d34-0410-b5e6-96231b3b80d8 commit 4952aa5163ff4e87910d461f06316cc793ca95b8 Author: Gabor Greif Date: Wed Aug 26 19:16:32 2009 +0000 Remove all the LLVM_COMPACTIFY_SENTINELS-related macro magic as discussed with Chris on IRC. Anybody wanting to debug sentinel dereferencing problems must revert this patch and perform the indicated modifications. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80128 91177308-0d34-0410-b5e6-96231b3b80d8 commit ffefef35790db7819c72ba7e53c73b8e5931e851 Author: Oscar Fuentes Date: Wed Aug 26 18:37:05 2009 +0000 CMake: Removed outdated TODO. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80124 91177308-0d34-0410-b5e6-96231b3b80d8 commit 66448030685cdc3c9bfd52449e4027258aaba480 Author: Venkatraman Govindaraju Date: Wed Aug 26 18:24:12 2009 +0000 Generate section for bss and enable weak symbols git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80121 91177308-0d34-0410-b5e6-96231b3b80d8 commit 3a392c8714c745ffdc77da0a8589c7b0df03515f Author: Bob Wilson Date: Wed Aug 26 18:11:50 2009 +0000 Convert some more Neon tests to FileCheck. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80120 91177308-0d34-0410-b5e6-96231b3b80d8 commit 5e69950d5391bdf294b415bf39dd44f9f40556a1 Author: Dale Johannesen Date: Wed Aug 26 18:10:32 2009 +0000 Alter 79292 to produce output that actually assembles. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80119 91177308-0d34-0410-b5e6-96231b3b80d8 commit 23f2034aaff80f52b309ee17bfa7a9fc801c9677 Author: Mike Stump Date: Wed Aug 26 18:02:19 2009 +0000 Allow unsigned long long DenseMapInfo. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80118 91177308-0d34-0410-b5e6-96231b3b80d8 commit b1b88455b18224867a8d2fc6c3202b6ce12e0a1c Author: Bob Wilson Date: Wed Aug 26 17:39:53 2009 +0000 Remove unneeded ARM-specific DAG nodes for VLD* and VST* Neon operations. The instructions can be selected directly from the intrinsics. We will need to add some ARM-specific nodes for VLD/VST of 3 and 4 128-bit vectors, but those are not yet implemented. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80117 91177308-0d34-0410-b5e6-96231b3b80d8 commit 0defefd8ce9f13cecba8c988897c3224a25e96f8 Author: Anton Korobeynikov Date: Wed Aug 26 17:39:40 2009 +0000 Add extload expansion for f128 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80116 91177308-0d34-0410-b5e6-96231b3b80d8 commit 3e72169c1b197ef8c5b4c663e2eee4551a3a7178 Author: Anton Korobeynikov Date: Wed Aug 26 17:39:23 2009 +0000 Unbreak FP128 stuff in cbe git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80115 91177308-0d34-0410-b5e6-96231b3b80d8 commit 644cdc3c64cb485c6a21d1bfb126c107e5b40d64 Author: Oscar Fuentes Date: Wed Aug 26 17:05:06 2009 +0000 Ignore -fPIC test on Windows. Suggested by Yonggang Luo. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80111 91177308-0d34-0410-b5e6-96231b3b80d8 commit 8427b6b0529e66663737b39ea51a1fbdbbbbd534 Author: Douglas Gregor Date: Wed Aug 26 16:33:57 2009 +0000 Unbreak CMake build git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80109 91177308-0d34-0410-b5e6-96231b3b80d8 commit 886f20275a78a1b03b83a8145a62f5e4cfbb1c99 Author: Anton Korobeynikov Date: Wed Aug 26 16:26:09 2009 +0000 Expand scalar_to_vector - we don't have any isel logic for it now git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80107 91177308-0d34-0410-b5e6-96231b3b80d8 commit 75c687bcc528eb81dc693d63f7aff9185b29e56f Author: Dan Gohman Date: Wed Aug 26 16:06:11 2009 +0000 Add comments detailing a known bug, so that people writing other backends don't use it as an example. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80105 91177308-0d34-0410-b5e6-96231b3b80d8 commit 32b17ffaa8593d25728c9ebad7e82a45c16f817c Author: Dan Gohman Date: Wed Aug 26 15:57:57 2009 +0000 -fast is now -O0. -fast-isel is no longer experimental. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80104 91177308-0d34-0410-b5e6-96231b3b80d8 commit 4637d177299aed45c6be7ca24e003771f33fd5d6 Author: Dan Gohman Date: Wed Aug 26 15:56:38 2009 +0000 Move ProfileInfo::Edge's operator<< out of line. Among other benefits, this eliminates the ATTRIBUTE_USED, which wasn't being used in a manner acceptable to some GCC versions, according to the buildbots. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80103 91177308-0d34-0410-b5e6-96231b3b80d8 commit a064a395489f954b0eaafb351d15b456699dea8e Author: Andreas Neustifter Date: Wed Aug 26 15:18:38 2009 +0000 Bugfix for r80100, forgot include. Sorry. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80101 91177308-0d34-0410-b5e6-96231b3b80d8 commit 70eeb51888ed9e73d058a3b0c889c295219e2109 Author: Andreas Neustifter Date: Wed Aug 26 15:13:44 2009 +0000 Implemented comments from Daniel Dunbar. (See http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20090817/084958.html) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80100 91177308-0d34-0410-b5e6-96231b3b80d8 commit 9959b052347ceddec3576013485f2564b99b944e Author: Dan Gohman Date: Wed Aug 26 14:59:13 2009 +0000 Don't use INSERT_SUBREG to model anyext operations on x86-64, as it leads to partial-register definitions. To help avoid redundant zero-extensions, also teach the h-register matching patterns that use movzbl to match anyext as well as zext. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80099 91177308-0d34-0410-b5e6-96231b3b80d8 commit 9927f829a68b645ed5813b25e21a881d94fc80d8 Author: Dan Gohman Date: Wed Aug 26 14:53:06 2009 +0000 Create a ScalarEvolution-based AliasAnalysis implementation. This is a simple AliasAnalysis implementation which works by making ScalarEvolution queries. ScalarEvolution has a more complete understanding of arithmetic than BasicAA's collection of ad-hoc checks, so it handles some cases that BasicAA misses, for example p[i] and p[i+1] within the same iteration of a loop. This is currently experimental. It may be that the main use for this pass will be to help find cases where BasicAA can be profitably extended, or to help in the development of the overall AliasAnalysis infrastructure, however it's also possible that it could grow up to become a directly useful pass. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80098 91177308-0d34-0410-b5e6-96231b3b80d8 commit 596114dc06489e5bd79e3e8ffc60d43bbf3668e3 Author: Dan Gohman Date: Wed Aug 26 14:34:12 2009 +0000 Fix a missing newline, now that Value's operator<< doesn't add one of its own. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80096 91177308-0d34-0410-b5e6-96231b3b80d8 commit 84c793aef4170e0d5be4d2c6fcb26a9e56cad21b Author: Dan Gohman Date: Wed Aug 26 14:32:17 2009 +0000 Use SetVector instead of std::set so that alias relations are tested and printed in a deterministic order. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80095 91177308-0d34-0410-b5e6-96231b3b80d8 commit 8fa9da2b34655a15102a0845617a9951ee945ed6 Author: Daniel Dunbar Date: Wed Aug 26 13:58:10 2009 +0000 llvm-mc/Mach-O: Add support for relocations. - I haven't really tried to find the "right" way to store the fixups or apply them, yet. This works, but isn't particularly elegant or fast. - Still no evaluation support, so we don't actually ever not turn a fixup into a relocation entry. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80089 91177308-0d34-0410-b5e6-96231b3b80d8 commit c3c1992d46f418c45a8e0b5fdb3c452c90aa960e Author: Daniel Dunbar Date: Wed Aug 26 13:57:54 2009 +0000 llvm-mc/Mach-O: Move symbol indices into the MCSymbolData structure. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80088 91177308-0d34-0410-b5e6-96231b3b80d8 commit cefbda1f46cc612e074fdcc1d8aab712aba085e7 Author: Daniel Dunbar Date: Wed Aug 26 13:57:44 2009 +0000 llvm-mc/Mach-O: Dump relocations and section data (optionally) in my Mach-O dumper. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80087 91177308-0d34-0410-b5e6-96231b3b80d8 commit 4486ac16542e9dd843778c5f684e1cd9d7bb3945 Author: Daniel Dunbar Date: Wed Aug 26 13:57:37 2009 +0000 llvm-mc: Add symbol entries for undefined symbols used in .fill and .org. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80086 91177308-0d34-0410-b5e6-96231b3b80d8 commit 7c672df8b969b7514438228bed80cfad6e9c473e Author: Anton Korobeynikov Date: Wed Aug 26 13:44:29 2009 +0000 Add dummy inline asm handling for 'r' constraint. This fixes PR4778 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80085 91177308-0d34-0410-b5e6-96231b3b80d8 commit 39fd40ae8671ecff6a1857b5a0156e52284c4e5c Author: Andreas Neustifter Date: Wed Aug 26 13:33:09 2009 +0000 Moved isDeclaration() check further down to allow for function counts for declarations if necessary. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80084 91177308-0d34-0410-b5e6-96231b3b80d8 commit 92183c031a21857a580b38795272ce80863b9ebf Author: Daniel Dunbar Date: Wed Aug 26 09:16:57 2009 +0000 llvm-mc: Change MCContext value table to take const MCSymbol*s. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80079 91177308-0d34-0410-b5e6-96231b3b80d8 commit b9d13ac6e4228451c6fe54566064978597aabc1b Author: Daniel Dunbar Date: Wed Aug 26 09:16:46 2009 +0000 llvm-mc: Make MCValue take const MCSymbol*s. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80078 91177308-0d34-0410-b5e6-96231b3b80d8 commit cb73cfe2496d5e70d8cc4c89e7de29373b348353 Author: Daniel Dunbar Date: Wed Aug 26 09:16:34 2009 +0000 llvm-mc: Make non-sensical max bytes to .align an error. Also, warn about overflow in alignment values. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80077 91177308-0d34-0410-b5e6-96231b3b80d8 commit 3e64a6cc0e75cf654fd23ac9ffa1a9a1d3d911e9 Author: Andreas Neustifter Date: Wed Aug 26 09:05:21 2009 +0000 Changed std::cout to outs(), retaining formating. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80076 91177308-0d34-0410-b5e6-96231b3b80d8 commit 94060421ce73922e71c183fba0fda8bace7d0e2d Author: Devang Patel Date: Wed Aug 26 05:01:18 2009 +0000 Revert 79977. It causes llvm-gcc bootstrap failures on some platforms. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80073 91177308-0d34-0410-b5e6-96231b3b80d8 commit 66d02907de42fa311fb2b512e820277bb1a61e7c Author: Chris Lattner Date: Wed Aug 26 05:00:16 2009 +0000 some mips and some sparc compilers apparently predefine mips and sparc respectively. Just overrule them :) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80072 91177308-0d34-0410-b5e6-96231b3b80d8 commit 202ced1e32f5a88a8c865e62ea10c88a712c3fab Author: Venkatraman Govindaraju Date: Wed Aug 26 04:50:17 2009 +0000 test commit git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80070 91177308-0d34-0410-b5e6-96231b3b80d8 commit 3eb9a3f37ed8ee8e026d2dfebe6bae08df4e615d Author: Daniel Dunbar Date: Wed Aug 26 04:28:45 2009 +0000 llvm-mc: Fix tests for python variations in int printing, sigh. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80069 91177308-0d34-0410-b5e6-96231b3b80d8 commit 53a9082d2e95f33980ef2b7f5104e0cc46d6342d Author: Chris Lattner Date: Wed Aug 26 04:21:30 2009 +0000 fix some funky indentation git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80068 91177308-0d34-0410-b5e6-96231b3b80d8 commit 0f56d41709c27ec2f0637e19881fefd90e31c22b Author: Daniel Dunbar Date: Wed Aug 26 04:13:32 2009 +0000 llvm-mc/Mach-O: Add section padding where needed (to align the next section). Also, simplify some of Mach-O writer code which can now use section addresses. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80067 91177308-0d34-0410-b5e6-96231b3b80d8 commit b3730b1a3de7fe37a660bd30d3d0d55bcea22d1d Author: Daniel Dunbar Date: Wed Aug 26 02:48:04 2009 +0000 llvm-mc/Mach-O: Set addresses for symbols. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80065 91177308-0d34-0410-b5e6-96231b3b80d8 commit 7fd6b0fff74a7c9fbc054b3303fee1a8f22002b2 Author: Dale Johannesen Date: Wed Aug 26 01:08:21 2009 +0000 Add an 'inline hint' attribute to represent source code hints that it would be a good idea to inline a function ("inline" keyword). No functional change yet; FEs do not emit this and inliner does not use it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80063 91177308-0d34-0410-b5e6-96231b3b80d8 commit 2e1a5d0b91503b8d5ada9fe0b19567daca2f1c6f Author: Devang Patel Date: Wed Aug 26 00:39:50 2009 +0000 Add isClosure() predicate. This is used to add DW_AT_APPLE_block attribute. Patch by Caroline Tice. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80061 91177308-0d34-0410-b5e6-96231b3b80d8 commit 6d294da8f845a8d611529759d194315b76b44a6e Author: Daniel Dunbar Date: Wed Aug 26 00:18:21 2009 +0000 llvm-mc: Improve indirect symbol support (add the indirect index table). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80059 91177308-0d34-0410-b5e6-96231b3b80d8 commit 3b126fbc67c6279898f8ca0c31f233a3a56b31d9 Author: Dan Gohman Date: Wed Aug 26 00:13:22 2009 +0000 Remove unused variables. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80058 91177308-0d34-0410-b5e6-96231b3b80d8 commit bdd4dc67fb10d0f304bec21c924263f8444ae7a7 Author: Daniel Dunbar Date: Wed Aug 26 00:10:55 2009 +0000 llvm-mc: Add MCSection::isDefined() git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80057 91177308-0d34-0410-b5e6-96231b3b80d8 commit 917614663633aa0ff1bdf7208862e8b7e25dd911 Author: Dan Gohman Date: Tue Aug 25 23:27:45 2009 +0000 Fix the InsertAtEnd form of ShuffleVectorInst constructor to use the correct type. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80050 91177308-0d34-0410-b5e6-96231b3b80d8 commit e6803b821738076b5b2299c1cd496be0d0042362 Author: Dan Gohman Date: Tue Aug 25 23:17:54 2009 +0000 Eliminate the unused Context argument on one of the ICmpInst and FCmpInst constructors. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80049 91177308-0d34-0410-b5e6-96231b3b80d8 commit 4e46ac9407307942712236f8c91875ef323c182f Author: Gabor Greif Date: Tue Aug 25 23:02:21 2009 +0000 revert r78628 and r78803 as these are not needed any more git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80048 91177308-0d34-0410-b5e6-96231b3b80d8 commit 58d95377713fa32cbf129e19f4005f4863f9cdb3 Author: Scott Michel Date: Tue Aug 25 22:37:34 2009 +0000 Updated i128 sext support for CellSPU backend, contributed by Ken Werner (IBM) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80042 91177308-0d34-0410-b5e6-96231b3b80d8 commit 91bf99a35153b00098633f214207c308c52acdcd Author: Dan Gohman Date: Tue Aug 25 22:29:08 2009 +0000 Use covariant return types for Instruction::clone, and eliminate the forms of ExtractElementInst and InsertElementInst that are equivalent to clone. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80041 91177308-0d34-0410-b5e6-96231b3b80d8 commit 97be9d37d93c38bc82950e0373cd3a8d1d2aa024 Author: Owen Anderson Date: Tue Aug 25 22:27:22 2009 +0000 Get rid of this horrible "benign race" by exploiting ManagedStatic to initialize the array on its first access. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80040 91177308-0d34-0410-b5e6-96231b3b80d8 commit ba4fe8b91352f65caaf2a30f234b5006afd1cf2b Author: Dan Gohman Date: Tue Aug 25 22:24:20 2009 +0000 This should use isIndenticalToWhenDefined. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80039 91177308-0d34-0410-b5e6-96231b3b80d8 commit fc00c4a2407c1b30a19fef9ec0a1ae00f7f7472d Author: Dan Gohman Date: Tue Aug 25 22:11:20 2009 +0000 Rename Instruction::isIdenticalTo to Instruction::isIdenticalToWhenDefined, and introduce a new Instruction::isIdenticalTo which tests for full identity, including the SubclassOptionalData flags. Also, fix the Instruction::clone implementations to preserve the SubclassOptionalData flags. Finally, teach several optimizations how to handle SubclassOptionalData correctly, given these changes. This fixes the counterintuitive behavior of isIdenticalTo not comparing the full value, and clone not returning an identical clone, as well as some subtle bugs that could be caused by these. Thanks to Nick Lewycky for reporting this, and for an initial patch! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80038 91177308-0d34-0410-b5e6-96231b3b80d8 commit e73ff31d813cdc36e334404992c42bfef7842c95 Author: Bill Wendling Date: Tue Aug 25 21:31:39 2009 +0000 Revert last patch. We need to put this into TargetLowering. There will be a lot of EH stuff going into there, so we can wait to add them all then. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80036 91177308-0d34-0410-b5e6-96231b3b80d8 commit 12d46f5ea460e149882e39dc25c649580a161141 Author: Gabor Greif Date: Tue Aug 25 21:25:22 2009 +0000 re-committing yesterday's r79938. This time there is no additional include of llvm/Config/config.h at all. Instead I use a hard-coded preprecessor symbol: LLVM_COMPACTIFY_SENTINELS (should this work on the self-hosting buildbot, then cleanups come next) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80035 91177308-0d34-0410-b5e6-96231b3b80d8 commit b81243240cbfc573324c9760a77e6b1463955bab Author: Daniel Dunbar Date: Tue Aug 25 21:10:45 2009 +0000 llvm-mc: Add statistic for number of fragments emitted by the assembler. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80033 91177308-0d34-0410-b5e6-96231b3b80d8 commit 4f61e5051fa25f4abb928573db6ea52585748b93 Author: Bill Wendling Date: Tue Aug 25 21:09:50 2009 +0000 Add the #include here. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80032 91177308-0d34-0410-b5e6-96231b3b80d8 commit 4b90952a9dd2b26ef6dd359cb8e4f7139e40f864 Author: Chris Lattner Date: Tue Aug 25 21:01:56 2009 +0000 remove some dead lines. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80031 91177308-0d34-0410-b5e6-96231b3b80d8 commit 538dfe54dd1c732208b2dbb00057b0a58cdeb61e Author: Bill Wendling Date: Tue Aug 25 21:01:42 2009 +0000 Comment formatting. Removing of unused #include and type forwarding. OCD is fun! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80030 91177308-0d34-0410-b5e6-96231b3b80d8 commit f2db1075b5a1bf1ea8f2d2c618917651150b8a94 Author: Chris Lattner Date: Tue Aug 25 20:57:38 2009 +0000 convert to filecheck style git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80029 91177308-0d34-0410-b5e6-96231b3b80d8 commit 864504a5810fdfd23e1774de0b935dcdafb91645 Author: Chris Lattner Date: Tue Aug 25 20:49:04 2009 +0000 convert to filecheck git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80025 91177308-0d34-0410-b5e6-96231b3b80d8 commit e371d63e2a817eda5e3563eb574c99fa08df7e6d Author: Bill Wendling Date: Tue Aug 25 20:21:17 2009 +0000 Add a target asm info hook to specify that particular bits of data in the FDE should be forced to 32-bits (.long) even on 64-bit architectures. Darwin wants these bits to be 64-bits (.quad). However, other platforms may disagree. This is just the info right now and is part of a work-in-progress which needs this. We'll add the actual *use* of this soon. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80024 91177308-0d34-0410-b5e6-96231b3b80d8 commit b0b96906a0018edbadd9f4f3b17b48ec3c29838e Author: Daniel Dunbar Date: Tue Aug 25 20:21:09 2009 +0000 EXIT STAGE LEFT: gccas, gccld git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80023 91177308-0d34-0410-b5e6-96231b3b80d8 commit 13808ef92db201ec027004b4fd8eb2db55c5aae4 Author: Sanjiv Gupta Date: Tue Aug 25 19:39:05 2009 +0000 Start refactoring PIC16 TargetObjectFile code. Eventually, all the stuff from PIC16Section will move to MCSectionPIC16. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80021 91177308-0d34-0410-b5e6-96231b3b80d8 commit b1d423e0cccd3f78122a5e8c9e959c8569b23bb0 Author: Daniel Dunbar Date: Tue Aug 25 18:45:03 2009 +0000 Switch abi-isel.ll to FileCheck; it's not much faster, but it now tests a lot more and is much nicer to the OS. - Dan, please check. If there are parts of the test you think I should strip out so it doesn't cause random failures let me know (there are still some PIC label numbers in it, for example). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80019 91177308-0d34-0410-b5e6-96231b3b80d8 commit 1d99646fa9e8847b0ceb086e33a24ed707491684 Author: Dan Gohman Date: Tue Aug 25 17:56:57 2009 +0000 Don't assume that two identical instructions that read from memory will always return the same value. This isn't currently necessary, since this code doesn't currently ever get called under circumstances where it would matter, but it may some day. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80017 91177308-0d34-0410-b5e6-96231b3b80d8 commit 82d30b73d3a37de0ec7960a4e099ef9e255d4f11 Author: Bob Wilson Date: Tue Aug 25 17:52:39 2009 +0000 Remove some unused SDNode definitions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80015 91177308-0d34-0410-b5e6-96231b3b80d8 commit 5bba145cbd5935b442e6a197eda3477f5d1372a5 Author: Dan Gohman Date: Tue Aug 25 17:49:57 2009 +0000 Teach ScalarEvolution about GlobalAliases. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80014 91177308-0d34-0410-b5e6-96231b3b80d8 commit 1c17fd9fbdcfebe29c7ea59c2c7675e420aa49f5 Author: Dan Gohman Date: Tue Aug 25 17:48:17 2009 +0000 Delete some unnecessary flushes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80013 91177308-0d34-0410-b5e6-96231b3b80d8 commit 814c2eaa0121afd0661d8a2b5f715fcb1174f0b5 Author: Dan Gohman Date: Tue Aug 25 17:47:44 2009 +0000 Use X86II::MO_NO_FLAG. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80012 91177308-0d34-0410-b5e6-96231b3b80d8 commit 316062a4d193609d98e80e64389fc2094ad8c515 Author: Bob Wilson Date: Tue Aug 25 17:46:06 2009 +0000 Expose the instruction contraint string as an argument to the NLdSt class. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80011 91177308-0d34-0410-b5e6-96231b3b80d8 commit 208278cfa708aa6e5fcca6d1b92ee780beb72a8c Author: Dan Gohman Date: Tue Aug 25 17:42:10 2009 +0000 Special-case static allocas in IndVarSimplify's loop invariant sinking code, since they are special. If the loop preheader happens to be the entry block of a function, don't sink static allocas out of it. This fixes PR4775. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80010 91177308-0d34-0410-b5e6-96231b3b80d8 commit 36ed6c0368d77188063d1594e54c52df1438ae87 Author: Owen Anderson Date: Tue Aug 25 17:42:07 2009 +0000 Comment-ify. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80009 91177308-0d34-0410-b5e6-96231b3b80d8 commit 845a722eb435c2a9c0528b13a472e595340b6dd8 Author: Owen Anderson Date: Tue Aug 25 17:35:37 2009 +0000 Switch to SmallVector. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80007 91177308-0d34-0410-b5e6-96231b3b80d8 commit 2845c6f885c8c7615610ab8494f7535a8f67334c Author: Owen Anderson Date: Tue Aug 25 17:26:32 2009 +0000 Pull out this predicate loop into a helper function. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80006 91177308-0d34-0410-b5e6-96231b3b80d8 commit a9c16fe7d4d2b61191b362a5d073bdc95c123c0f Author: David Goodwin Date: Tue Aug 25 17:03:05 2009 +0000 Fixup register kills after scheduling. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80002 91177308-0d34-0410-b5e6-96231b3b80d8 commit 9518d88d270c05fb576604fc813405de177e2e34 Author: Anton Korobeynikov Date: Tue Aug 25 17:00:23 2009 +0000 Provide dynamic_stackalloc lowering for MSP430. This fixes PR4769 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80001 91177308-0d34-0410-b5e6-96231b3b80d8 commit b802d676875f2df286887be83419649770dd8580 Author: Edwin Török Date: Tue Aug 25 16:53:15 2009 +0000 Remove target triple from this test, it fails on x86-64 with --enable-targets=host-only otherwise. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80000 91177308-0d34-0410-b5e6-96231b3b80d8 commit e577ff861e934b98cb950a0b0d32d0a9a1dce8b1 Author: Dan Gohman Date: Tue Aug 25 16:00:35 2009 +0000 Allocate the basic types inside the LLVMContextImpl instance, rather than separately with new. Move the members above the TypeMap members to avoid destruction order issues. This fixes a leak of these objects, and eliminates an extra level of indirection in Type::getInt32Ty and friends. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79997 91177308-0d34-0410-b5e6-96231b3b80d8 commit 87489cff37dde33a9dbb37fbfbad46ce2f70c8af Author: Dan Gohman Date: Tue Aug 25 15:54:01 2009 +0000 Update documentation for the -f change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79996 91177308-0d34-0410-b5e6-96231b3b80d8 commit a0e89b2e414df522132636eb256ecbcc2d01a4e8 Author: Dan Gohman Date: Tue Aug 25 15:45:44 2009 +0000 Fix a few typos from the removal of -f. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79994 91177308-0d34-0410-b5e6-96231b3b80d8 commit 2d65d35d9233277aee7c8a6d3643740e3ed29f0b Author: Dan Gohman Date: Tue Aug 25 15:38:29 2009 +0000 Remove obsolete -f flags. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79992 91177308-0d34-0410-b5e6-96231b3b80d8 commit 176426d2102142aaa0bf19aca55f528ceb873329 Author: Dan Gohman Date: Tue Aug 25 15:34:52 2009 +0000 Make LLVM command-line tools overwrite their output files without -f. This is conventional command-line tool behavior. -f now just means "enable binary output on terminals". Add a -f option to llvm-extract and llvm-link, for consistency. Remove F_Force from raw_fd_ostream and enable overwriting and truncating by default. Introduce an F_Excl flag to permit users to enable a failure when the file already exists. This flag is currently unused. Update Makefiles and documentation accordingly. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79990 91177308-0d34-0410-b5e6-96231b3b80d8 commit 8c949d7c548ed4ec883a2c8bd922607be2563f5a Author: Andreas Neustifter Date: Tue Aug 25 12:53:27 2009 +0000 Read profile files as binary as proposed in http://lists.cs.uiuc.edu/pipermail/llvmdev/2009-August/025020.html. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79983 91177308-0d34-0410-b5e6-96231b3b80d8 commit 9112f5f6755a85f10036ff20741fc264622dc14a Author: Xerxes Ranby Date: Tue Aug 25 10:12:55 2009 +0000 Fix PR4772 ARM JIT.GlobalInFuction unittest by explicitly initialize MMI to 0 during JITEmitter constructor. Modified: lib/ExecutionEngine/JIT/JITEmitter.cpp git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79982 91177308-0d34-0410-b5e6-96231b3b80d8 commit a75796301ee17e60daea754e30a035a53891650d Author: Bill Wendling Date: Tue Aug 25 08:08:33 2009 +0000 - Rename EmitCommonInformationEntry to EmitCIE. - Rename EmitFunctionDescriptionEntry to EmitFDE. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79981 91177308-0d34-0410-b5e6-96231b3b80d8 commit 57b83c78f56324e3a8ff636b311235f6f2350b4e Author: Devang Patel Date: Tue Aug 25 05:24:07 2009 +0000 Update DebugInfo interface to use metadata, instead of special named llvm.dbg.... global variables, to encode debugging information in llvm IR. This is mostly a mechanical change that tests metadata support very well. This change speeds up llvm-gcc by more then 6% at "-O0 -g" (measured by compiling InstructionCombining.cpp!) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79977 91177308-0d34-0410-b5e6-96231b3b80d8 commit bcc93309ca3632b3cd2b45f265a534256be7589a Author: Bill Wendling Date: Tue Aug 25 02:32:05 2009 +0000 - Emit new line after each FDE. - Fix comment. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79971 91177308-0d34-0410-b5e6-96231b3b80d8 commit 4767b24840250630c47fee8be2a6aef07f19d30a Author: Bill Wendling Date: Tue Aug 25 02:27:42 2009 +0000 Rename functions to something more descriptive. At the very least mention the CIE and FDE in their names. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79969 91177308-0d34-0410-b5e6-96231b3b80d8 commit 30d4d765dfc6d01bc4c1d6934582050106bcceba Author: Dale Johannesen Date: Tue Aug 25 01:13:58 2009 +0000 Allow multiple occurrences of -inline-threshold on the command line. This gives llvm-gcc developers a way to control inlining (documented as "not intended for end users"). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79966 91177308-0d34-0410-b5e6-96231b3b80d8 commit 06b990c5b3f32505188e52be1b70b38290f81b83 Author: Owen Anderson Date: Tue Aug 25 00:54:39 2009 +0000 Handle a corner case when extracing code regions where one of the immediate successor of an extracted block contains a PHI using a value defined in the extracted region. With this patch, the partial inliner now passes MultiSource/Applications. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79963 91177308-0d34-0410-b5e6-96231b3b80d8 commit f1f04ecf6e5af3aa7c4c59077486c9cb29df20ea Author: Dale Johannesen Date: Tue Aug 25 00:16:14 2009 +0000 Fix PR 4751, another difficulty with %a modifier on x86. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79961 91177308-0d34-0410-b5e6-96231b3b80d8 commit 09220a24f7845a078fb41c61ee909eed6c94a255 Author: Bill Wendling Date: Tue Aug 25 00:05:04 2009 +0000 --- Reverse-merging r79938 into '.': U include/llvm/BasicBlock.h U include/llvm/ADT/ilist_node.h U include/llvm/ADT/ilist.h U include/llvm/CodeGen/SelectionDAG.h U include/llvm/CodeGen/MachineFunction.h U include/llvm/CodeGen/MachineBasicBlock.h U include/llvm/Function.h Revert r79938. It was causing self-hosting build failures. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79960 91177308-0d34-0410-b5e6-96231b3b80d8 commit f2942e63abf0b485e88c21a9fc96bfb13754ed41 Author: Oscar Fuentes Date: Tue Aug 25 00:02:29 2009 +0000 CMake: updated list of source files. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79959 91177308-0d34-0410-b5e6-96231b3b80d8 commit 399ece6621d316d7378e5fc13bd030e5572f03ce Author: Scott Michel Date: Mon Aug 24 23:57:35 2009 +0000 - Remove SelectSEXTi128 from SPUISelDAGToDAG.cpp, evidently, this is redundant code, according to Anton (I'm not totally convinced, but we can always resurrect patches if we need to do so.) - Start moving CellSPU's tests to prefer FileCheck. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79958 91177308-0d34-0410-b5e6-96231b3b80d8 commit 27dad5a41e0b0fa8fd5cba2e6f5dd70b82689e76 Author: Owen Anderson Date: Mon Aug 24 23:32:14 2009 +0000 When extracting SEME regions of code, the extractor needs to update the dominator tree for split return blocks. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79957 91177308-0d34-0410-b5e6-96231b3b80d8 commit 316e6fb92b997dfa4db655a371d5699cbcac0473 Author: Scott Michel Date: Mon Aug 24 22:49:22 2009 +0000 Prefer 'FileCheck' over 'grep'. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79953 91177308-0d34-0410-b5e6-96231b3b80d8 commit 36173e27ebfe4da907c17f2b507a9df3415a3aad Author: Scott Michel Date: Mon Aug 24 22:28:53 2009 +0000 128-bit sign extension and vector shift cleanups, contributed by Ken Werner (IBM). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79949 91177308-0d34-0410-b5e6-96231b3b80d8 commit 73ab81726b384015ac9bfe7f734fc13b93297c4c Author: Scott Michel Date: Mon Aug 24 21:53:27 2009 +0000 Initialize ShufBytes, as gcc 4.4 can't detect that the entire array is initialized and a warning about a potentially unintialized variable is generated. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79946 91177308-0d34-0410-b5e6-96231b3b80d8 commit af26e32df3f129ac906a45c4527b5ee3641cb22d Author: Andreas Neustifter Date: Mon Aug 24 21:41:37 2009 +0000 Add llvm_start_edge_profiling to exported symbols for libprofile_rt. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79944 91177308-0d34-0410-b5e6-96231b3b80d8 commit 92b39ace140de279245e80d0465528933787c7e4 Author: Andreas Neustifter Date: Mon Aug 24 21:37:48 2009 +0000 This patch cleans up the ProfileInfo by *) introducing new data type and export function of edge info for whole function (preparation for next patch). *) renaming variables to make clear distinction between data and containers that contain this data. *) updated comments and whitespaces. *) made ProfileInfo::MissingValue a double (as it should be...). (Discussed at http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20090817/084955.html.) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79940 91177308-0d34-0410-b5e6-96231b3b80d8 commit c19dfb9d25347b815512bba5eb64052708e4c183 Author: Gabor Greif Date: Mon Aug 24 21:34:17 2009 +0000 Resubmit an earlier patch of mine: reduce the size of relevant "ghostly" sentinels by a pointer. This attempt now makes the compactification dependent on the configure variable LLVM_COMPACT_SENTINELS and should not cause any bootstrap failures for llvm-gcc any more. Please note that this is not yet the final version, and (as settled with Chris) I shall take out the autofoo/cmake portions in the next days. This will also lose the assertability on sentinel dereferencing and operator++, but that seems an acceptable price to pay for the simplified build logic. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79938 91177308-0d34-0410-b5e6-96231b3b80d8 commit b2f99910fba8818270e41e75f4b127d82a2082a6 Author: Bob Wilson Date: Mon Aug 24 21:17:17 2009 +0000 Fix a typo. Somehow I thought this had passed before, but I guess not. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79937 91177308-0d34-0410-b5e6-96231b3b80d8 commit f5c686b114bf6ac6b3137f96bc59ffb2e8e20de6 Author: Gabor Greif Date: Mon Aug 24 21:00:10 2009 +0000 prune ignores: AutoGenerated.inc is no more git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79936 91177308-0d34-0410-b5e6-96231b3b80d8 commit cacea03dbaca34b44783243898ef2274bd71e72e Author: Bob Wilson Date: Mon Aug 24 20:33:47 2009 +0000 Convert slow test to use FileCheck. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79935 91177308-0d34-0410-b5e6-96231b3b80d8 commit 8551a303173101cf595dc35200eea7da37e769d4 Author: Daniel Dunbar Date: Mon Aug 24 20:08:27 2009 +0000 Convert two gratuitous abuses of poor helpless CPU cycles to FileCheck. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79933 91177308-0d34-0410-b5e6-96231b3b80d8 commit b9640223f05f0257603a0138c1ea8cb59c7f5acc Author: Dale Johannesen Date: Mon Aug 24 17:51:19 2009 +0000 Split test into 3. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79926 91177308-0d34-0410-b5e6-96231b3b80d8 commit a0151d0e9f948b39e55944b5cad64fb33732af25 Author: Daniel Dunbar Date: Mon Aug 24 11:56:58 2009 +0000 llvm-mc/Mach-O: Preliminary support for indirect symbols. - The indirect table itself isn't being filled in yet. - This isn't factored properly and is rather FIXMEd, but at the moment I'm more focused on figuring out what it needs to do. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79910 91177308-0d34-0410-b5e6-96231b3b80d8 commit b69f053e0d5af3463d1bbf2101e5c1431cca6fee Author: Duncan Sands Date: Mon Aug 24 10:59:01 2009 +0000 Fix the build when using gcc-4.4 on linux. Header needed for stderr and fprintf. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79909 91177308-0d34-0410-b5e6-96231b3b80d8 --- libclamav/c++/llvm/CMakeLists.txt | 6 - libclamav/c++/llvm/LICENSE.TXT | 1 + libclamav/c++/llvm/Makefile | 4 +- libclamav/c++/llvm/Makefile.rules | 4 +- libclamav/c++/llvm/autoconf/configure.ac | 12 - .../c++/llvm/autoconf/m4/config_makefile.m4 | 2 +- .../c++/llvm/bindings/ocaml/llvm/Makefile | 2 +- libclamav/c++/llvm/cmake/config-ix.cmake | 11 +- .../c++/llvm/cmake/modules/LLVMLibDeps.cmake | 2 +- libclamav/c++/llvm/configure | 98 +- libclamav/c++/llvm/docs/CodeGenerator.html | 6 +- libclamav/c++/llvm/docs/CommandGuide/llc.pod | 5 +- .../c++/llvm/docs/CommandGuide/llvm-as.pod | 6 +- .../c++/llvm/docs/CommandGuide/llvm-dis.pod | 6 +- .../llvm/docs/CommandGuide/llvm-extract.pod | 6 +- .../c++/llvm/docs/CommandGuide/llvm-link.pod | 5 +- libclamav/c++/llvm/docs/CommandGuide/opt.pod | 6 +- libclamav/c++/llvm/docs/CommandLine.html | 18 +- libclamav/c++/llvm/docs/HowToSubmitABug.html | 14 +- libclamav/c++/llvm/docs/LangRef.html | 5 + libclamav/c++/llvm/docs/Passes.html | 6 + .../c++/llvm/docs/SourceLevelDebugging.html | 975 +- libclamav/c++/llvm/docs/re_format.7 | 756 ++ .../c++/llvm/docs/tutorial/LangImpl4.html | 100 +- .../c++/llvm/docs/tutorial/LangImpl5.html | 57 +- .../c++/llvm/docs/tutorial/LangImpl6.html | 59 +- .../c++/llvm/docs/tutorial/LangImpl7.html | 61 +- .../c++/llvm/examples/BrainF/BrainFDriver.cpp | 1 - .../c++/llvm/examples/Kaleidoscope/toy.cpp | 62 +- libclamav/c++/llvm/include/llvm-c/Core.h | 7 +- .../c++/llvm/include/llvm/ADT/DenseMap.h | 2 + .../c++/llvm/include/llvm/ADT/DenseMapInfo.h | 14 + .../include/llvm/ADT/DepthFirstIterator.h | 7 +- .../include/llvm/ADT/EquivalenceClasses.h | 8 +- .../llvm/include/llvm/ADT/PostOrderIterator.h | 7 +- .../c++/llvm/include/llvm/ADT/SCCIterator.h | 7 +- .../c++/llvm/include/llvm/ADT/STLExtras.h | 2 +- .../c++/llvm/include/llvm/ADT/SmallVector.h | 1 - libclamav/c++/llvm/include/llvm/ADT/Triple.h | 5 + libclamav/c++/llvm/include/llvm/ADT/ilist.h | 10 +- .../c++/llvm/include/llvm/ADT/ilist_node.h | 27 +- .../c++/llvm/include/llvm/ADT/iterator.cmake | 79 - .../c++/llvm/include/llvm/ADT/iterator.h.in | 76 - .../include/llvm/Analysis/AliasAnalysis.h | 2 +- .../include/llvm/Analysis/AliasSetTracker.h | 4 +- .../llvm/include/llvm/Analysis/CallGraph.h | 64 +- .../include/llvm/Analysis/ConstantsScanner.h | 4 +- .../llvm/include/llvm/Analysis/DebugInfo.h | 132 +- .../llvm/include/llvm/Analysis/Dominators.h | 119 +- .../include/llvm/Analysis/IntervalIterator.h | 3 +- .../c++/llvm/include/llvm/Analysis/LoopInfo.h | 8 +- .../c++/llvm/include/llvm/Analysis/Passes.h | 7 + .../llvm/include/llvm/Analysis/ProfileInfo.h | 33 +- .../include/llvm/Analysis/ValueTracking.h | 6 +- libclamav/c++/llvm/include/llvm/Attributes.h | 5 +- libclamav/c++/llvm/include/llvm/AutoUpgrade.h | 4 + libclamav/c++/llvm/include/llvm/BasicBlock.h | 2 +- .../include/llvm/Bitcode/BitstreamReader.h | 1 + .../c++/llvm/include/llvm/CallGraphSCCPass.h | 5 +- .../llvm/include/llvm/CodeGen/AsmPrinter.h | 3 +- .../llvm/include/llvm/CodeGen/DwarfWriter.h | 8 +- .../include/llvm/CodeGen/MachineBasicBlock.h | 2 +- .../include/llvm/CodeGen/MachineFunction.h | 4 +- .../llvm/CodeGen/MachineRegisterInfo.h | 9 +- .../llvm/include/llvm/CodeGen/ScheduleDAG.h | 13 +- .../llvm/include/llvm/CodeGen/SelectionDAG.h | 4 +- .../include/llvm/CodeGen/SelectionDAGNodes.h | 20 +- .../llvm/CompilerDriver/CompilationGraph.h | 4 +- .../llvm/include/llvm/Config/config.h.cmake | 3 - .../c++/llvm/include/llvm/Config/config.h.in | 18 +- libclamav/c++/llvm/include/llvm/Function.h | 4 +- libclamav/c++/llvm/include/llvm/InstrTypes.h | 11 +- libclamav/c++/llvm/include/llvm/Instruction.h | 5 + .../c++/llvm/include/llvm/Instructions.h | 125 +- .../c++/llvm/include/llvm/IntrinsicInst.h | 13 +- libclamav/c++/llvm/include/llvm/Intrinsics.td | 11 +- .../c++/llvm/include/llvm/LinkAllPasses.h | 1 + .../c++/llvm/include/llvm/MC/MCAsmInfo.h | 134 +- .../c++/llvm/include/llvm/MC/MCAsmParser.h | 37 +- .../c++/llvm/include/llvm/MC/MCAssembler.h | 248 +- .../c++/llvm/include/llvm/MC/MCCodeEmitter.h | 34 + .../c++/llvm/include/llvm/MC/MCContext.h | 29 +- libclamav/c++/llvm/include/llvm/MC/MCExpr.h | 323 + libclamav/c++/llvm/include/llvm/MC/MCInst.h | 37 +- .../c++/llvm/include/llvm/MC/MCStreamer.h | 73 +- libclamav/c++/llvm/include/llvm/MC/MCSymbol.h | 14 +- libclamav/c++/llvm/include/llvm/MC/MCValue.h | 9 +- libclamav/c++/llvm/include/llvm/Metadata.h | 1 - libclamav/c++/llvm/include/llvm/PassSupport.h | 11 +- libclamav/c++/llvm/include/llvm/Support/CFG.h | 19 +- .../c++/llvm/include/llvm/Support/DebugLoc.h | 12 +- .../llvm/Support/GetElementPtrTypeIterator.h | 5 +- .../llvm/include/llvm/Support/GraphWriter.h | 2 +- .../c++/llvm/include/llvm/Support/IRBuilder.h | 60 +- .../llvm/include/llvm/Support/MathExtras.h | 7 + .../c++/llvm/include/llvm/Support/Regex.h | 64 + .../llvm/include/llvm/Support/raw_ostream.h | 11 +- .../llvm/include/llvm/Target/TargetRegistry.h | 65 + .../include/llvm/Transforms/IPO/InlinerPass.h | 16 +- .../include/llvm/Transforms/Utils/Cloning.h | 39 +- .../llvm/Transforms/Utils/InlineCost.h | 3 +- libclamav/c++/llvm/include/llvm/Type.h | 1 - libclamav/c++/llvm/include/llvm/Use.h | 7 +- libclamav/c++/llvm/include/llvm/Value.h | 12 + .../c++/llvm/lib/Analysis/AliasAnalysis.cpp | 6 +- .../lib/Analysis/AliasAnalysisCounter.cpp | 2 +- .../lib/Analysis/AliasAnalysisEvaluator.cpp | 17 +- .../llvm/lib/Analysis/BasicAliasAnalysis.cpp | 17 +- .../c++/llvm/lib/Analysis/CFGPrinter.cpp | 4 +- .../c++/llvm/lib/Analysis/CMakeLists.txt | 1 + .../c++/llvm/lib/Analysis/DbgInfoPrinter.cpp | 2 +- libclamav/c++/llvm/lib/Analysis/DebugInfo.cpp | 507 +- .../c++/llvm/lib/Analysis/IPA/Andersens.cpp | 3 +- .../c++/llvm/lib/Analysis/IPA/CallGraph.cpp | 82 +- .../lib/Analysis/IPA/CallGraphSCCPass.cpp | 207 +- .../lib/Analysis/ProfileEstimatorPass.cpp | 82 +- .../c++/llvm/lib/Analysis/ProfileInfo.cpp | 19 +- .../llvm/lib/Analysis/ProfileInfoLoader.cpp | 2 +- .../c++/llvm/lib/Analysis/ScalarEvolution.cpp | 5 +- .../Analysis/ScalarEvolutionAliasAnalysis.cpp | 133 + .../c++/llvm/lib/Analysis/ValueTracking.cpp | 7 +- libclamav/c++/llvm/lib/AsmParser/LLLexer.cpp | 1 + libclamav/c++/llvm/lib/AsmParser/LLParser.cpp | 9 +- libclamav/c++/llvm/lib/AsmParser/LLToken.h | 1 + .../llvm/lib/Bitcode/Reader/BitcodeReader.cpp | 11 +- .../c++/llvm/lib/Bitcode/Writer/BitWriter.cpp | 2 +- .../lib/CodeGen/AsmPrinter/AsmPrinter.cpp | 60 +- .../lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 179 +- .../llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h | 24 +- .../lib/CodeGen/AsmPrinter/DwarfException.cpp | 60 +- .../lib/CodeGen/AsmPrinter/DwarfException.h | 12 +- .../lib/CodeGen/AsmPrinter/DwarfWriter.cpp | 15 +- .../llvm/lib/CodeGen/LLVMTargetMachine.cpp | 4 +- .../c++/llvm/lib/CodeGen/MachineFunction.cpp | 2 +- .../llvm/lib/CodeGen/MachineModuleInfo.cpp | 42 +- .../c++/llvm/lib/CodeGen/MachineVerifier.cpp | 136 + .../llvm/lib/CodeGen/PostRASchedulerList.cpp | 156 +- .../lib/CodeGen/SelectionDAG/FastISel.cpp | 15 +- .../lib/CodeGen/SelectionDAG/LegalizeDAG.cpp | 17 +- .../lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 23 +- .../SelectionDAG/SelectionDAGBuild.cpp | 12 +- .../c++/llvm/lib/CodeGen/SjLjEHPrepare.cpp | 54 +- .../lib/ExecutionEngine/JIT/JITEmitter.cpp | 2 +- .../ExecutionEngine/JIT/JITMemoryManager.cpp | 14 +- .../JIT/OProfileJITEventListener.cpp | 6 +- libclamav/c++/llvm/lib/MC/CMakeLists.txt | 3 + libclamav/c++/llvm/lib/MC/MCAsmInfo.cpp | 1 + libclamav/c++/llvm/lib/MC/MCAsmStreamer.cpp | 132 +- libclamav/c++/llvm/lib/MC/MCAssembler.cpp | 641 +- libclamav/c++/llvm/lib/MC/MCCodeEmitter.cpp | 18 + libclamav/c++/llvm/lib/MC/MCContext.cpp | 9 +- libclamav/c++/llvm/lib/MC/MCExpr.cpp | 249 + libclamav/c++/llvm/lib/MC/MCInst.cpp | 53 + libclamav/c++/llvm/lib/MC/MCMachOStreamer.cpp | 180 +- libclamav/c++/llvm/lib/MC/MCNullStreamer.cpp | 16 +- libclamav/c++/llvm/lib/Support/CMakeLists.txt | 7 + .../c++/llvm/lib/Support/COPYRIGHT.regex | 54 + libclamav/c++/llvm/lib/Support/Regex.cpp | 97 + .../c++/llvm/lib/Support/raw_ostream.cpp | 12 +- libclamav/c++/llvm/lib/Support/regcclass.h | 70 + libclamav/c++/llvm/lib/Support/regcname.h | 139 + libclamav/c++/llvm/lib/Support/regcomp.c | 1524 +++ libclamav/c++/llvm/lib/Support/regengine.inc | 1021 +++ libclamav/c++/llvm/lib/Support/regerror.c | 131 + libclamav/c++/llvm/lib/Support/regex2.h | 157 + libclamav/c++/llvm/lib/Support/regex_impl.h | 108 + libclamav/c++/llvm/lib/Support/regexec.c | 161 + libclamav/c++/llvm/lib/Support/regfree.c | 72 + libclamav/c++/llvm/lib/Support/regstrlcpy.c | 52 + libclamav/c++/llvm/lib/Support/regutils.h | 55 + .../c++/llvm/lib/System/DynamicLibrary.cpp | 7 + .../llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp | 21 +- .../llvm/lib/Target/ARM/ARMBaseInstrInfo.h | 17 +- .../lib/Target/ARM/ARMBaseRegisterInfo.cpp | 30 +- .../llvm/lib/Target/ARM/ARMCodeEmitter.cpp | 11 +- .../lib/Target/ARM/ARMConstantPoolValue.cpp | 16 +- .../lib/Target/ARM/ARMConstantPoolValue.h | 16 +- .../llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp | 226 +- .../llvm/lib/Target/ARM/ARMISelLowering.cpp | 124 +- .../c++/llvm/lib/Target/ARM/ARMISelLowering.h | 8 - .../llvm/lib/Target/ARM/ARMInstrFormats.td | 4 +- .../c++/llvm/lib/Target/ARM/ARMInstrInfo.td | 22 +- .../c++/llvm/lib/Target/ARM/ARMInstrNEON.td | 100 +- .../c++/llvm/lib/Target/ARM/ARMInstrThumb.td | 14 +- .../c++/llvm/lib/Target/ARM/ARMInstrThumb2.td | 4 +- .../c++/llvm/lib/Target/ARM/ARMSubtarget.cpp | 11 + .../c++/llvm/lib/Target/ARM/ARMSubtarget.h | 5 + .../Target/ARM/AsmPrinter/ARMAsmPrinter.cpp | 147 +- .../llvm/lib/Target/ARM/AsmPrinter/Makefile | 2 +- .../c++/llvm/lib/Target/ARM/CMakeLists.txt | 2 +- .../llvm/lib/Target/ARM/Thumb2InstrInfo.cpp | 36 +- .../llvm/lib/Target/Alpha/AsmPrinter/Makefile | 2 +- .../c++/llvm/lib/Target/Alpha/CMakeLists.txt | 2 +- .../llvm/lib/Target/Alpha/TargetInfo/Makefile | 2 +- .../lib/Target/Blackfin/AsmPrinter/Makefile | 2 +- .../llvm/lib/Target/Blackfin/CMakeLists.txt | 2 +- .../c++/llvm/lib/Target/CBackend/CBackend.cpp | 3 +- libclamav/c++/llvm/lib/Target/CMakeLists.txt | 2 - .../lib/Target/CellSPU/AsmPrinter/Makefile | 2 +- .../llvm/lib/Target/CellSPU/CMakeLists.txt | 2 +- .../lib/Target/CellSPU/SPUISelLowering.cpp | 74 +- .../llvm/lib/Target/CellSPU/SPUISelLowering.h | 3 - .../c++/llvm/lib/Target/CellSPU/SPUNodes.td | 6 +- .../llvm/lib/Target/CppBackend/CPPBackend.cpp | 1 + .../MSP430/AsmPrinter/MSP430AsmPrinter.cpp | 16 + .../lib/Target/MSP430/AsmPrinter/Makefile | 2 +- .../c++/llvm/lib/Target/MSP430/CMakeLists.txt | 6 +- .../lib/Target/MSP430/MSP430ISelLowering.cpp | 40 + .../lib/Target/MSP430/MSP430ISelLowering.h | 5 + .../lib/Target/MSP430/MSP430RegisterInfo.cpp | 11 +- .../c++/llvm/lib/Target/Mips/CMakeLists.txt | 2 +- .../llvm/lib/Target/PIC16/AsmPrinter/Makefile | 2 +- .../c++/llvm/lib/Target/PIC16/CMakeLists.txt | 2 +- .../llvm/lib/Target/PIC16/MCSectionPIC16.h | 57 +- .../llvm/lib/Target/PIC16/PIC16DebugInfo.cpp | 25 +- .../llvm/lib/Target/PIC16/PIC16DebugInfo.h | 2 +- .../lib/Target/PIC16/PIC16ISelLowering.cpp | 8 + .../Target/PIC16/PIC16TargetObjectFile.cpp | 10 +- .../lib/Target/PIC16/PIC16TargetObjectFile.h | 3 +- .../PowerPC/AsmPrinter/PPCAsmPrinter.cpp | 2 + .../llvm/lib/Target/PowerPC/CMakeLists.txt | 2 +- .../lib/Target/PowerPC/TargetInfo/Makefile | 2 +- .../llvm/lib/Target/Sparc/AsmPrinter/Makefile | 2 +- .../c++/llvm/lib/Target/Sparc/CMakeLists.txt | 2 +- .../llvm/lib/Target/Sparc/SparcInstrInfo.td | 2 +- .../llvm/lib/Target/Sparc/SparcMCAsmInfo.cpp | 6 + .../lib/Target/SystemZ/AsmPrinter/Makefile | 2 +- .../llvm/lib/Target/SystemZ/CMakeLists.txt | 2 +- .../lib/Target/TargetLoweringObjectFile.cpp | 6 +- .../lib/Target/X86/AsmParser/X86AsmParser.cpp | 42 +- .../X86/AsmPrinter/X86ATTAsmPrinter.cpp | 31 +- .../X86/AsmPrinter/X86ATTInstPrinter.cpp | 13 +- .../c++/llvm/lib/Target/X86/CMakeLists.txt | 2 +- libclamav/c++/llvm/lib/Target/X86/X86.h | 4 + .../llvm/lib/Target/X86/X86CodeEmitter.cpp | 256 + .../c++/llvm/lib/Target/X86/X86FastISel.cpp | 18 +- .../llvm/lib/Target/X86/X86ISelDAGToDAG.cpp | 5 +- .../llvm/lib/Target/X86/X86ISelLowering.cpp | 307 +- .../c++/llvm/lib/Target/X86/X86Instr64bit.td | 41 +- .../c++/llvm/lib/Target/X86/X86InstrInfo.cpp | 6 +- .../c++/llvm/lib/Target/X86/X86InstrInfo.td | 38 +- .../c++/llvm/lib/Target/X86/X86JITInfo.cpp | 2 +- .../c++/llvm/lib/Target/X86/X86Subtarget.cpp | 2 +- .../llvm/lib/Target/X86/X86TargetMachine.cpp | 4 + .../c++/llvm/lib/Target/XCore/CMakeLists.txt | 2 +- .../lib/Transforms/IPO/ArgumentPromotion.cpp | 56 +- .../llvm/lib/Transforms/IPO/FunctionAttrs.cpp | 25 +- .../c++/llvm/lib/Transforms/IPO/Inliner.cpp | 339 +- .../lib/Transforms/IPO/MergeFunctions.cpp | 3 +- .../c++/llvm/lib/Transforms/IPO/PruneEH.cpp | 6 +- .../llvm/lib/Transforms/IPO/StripSymbols.cpp | 125 +- .../lib/Transforms/IPO/StructRetPromotion.cpp | 65 +- .../Instrumentation/MaximumSpanningTree.cpp | 121 + .../Instrumentation/MaximumSpanningTree.h | 51 + .../lib/Transforms/Scalar/CodeGenPrepare.cpp | 2 +- .../c++/llvm/lib/Transforms/Scalar/GVN.cpp | 28 +- .../c++/llvm/lib/Transforms/Scalar/GVNPRE.cpp | 7 +- .../lib/Transforms/Scalar/IndVarSimplify.cpp | 5 + .../Scalar/InstructionCombining.cpp | 1754 ++-- .../lib/Transforms/Scalar/LoopIndexSplit.cpp | 2 +- .../c++/llvm/lib/Transforms/Scalar/SCCP.cpp | 3 +- .../lib/Transforms/Scalar/SimplifyCFGPass.cpp | 2 +- .../lib/Transforms/Utils/BasicBlockUtils.cpp | 8 +- .../llvm/lib/Transforms/Utils/CMakeLists.txt | 1 - .../lib/Transforms/Utils/CloneFunction.cpp | 14 +- .../llvm/lib/Transforms/Utils/CloneModule.cpp | 2 +- .../llvm/lib/Transforms/Utils/CloneTrace.cpp | 119 - .../lib/Transforms/Utils/CodeExtractor.cpp | 49 +- .../llvm/lib/Transforms/Utils/InlineCost.cpp | 2 +- .../lib/Transforms/Utils/InlineFunction.cpp | 302 +- .../llvm/lib/Transforms/Utils/LowerSwitch.cpp | 2 +- .../llvm/lib/Transforms/Utils/SimplifyCFG.cpp | 6 +- libclamav/c++/llvm/lib/VMCore/Attributes.cpp | 2 + libclamav/c++/llvm/lib/VMCore/AutoUpgrade.cpp | 74 +- .../c++/llvm/lib/VMCore/ConstantFold.cpp | 57 +- .../c++/llvm/lib/VMCore/ConstantsContext.h | 8 + libclamav/c++/llvm/lib/VMCore/Instruction.cpp | 8 + .../c++/llvm/lib/VMCore/Instructions.cpp | 237 +- .../c++/llvm/lib/VMCore/LLVMContextImpl.h | 102 +- libclamav/c++/llvm/lib/VMCore/Metadata.cpp | 2 +- libclamav/c++/llvm/lib/VMCore/Pass.cpp | 13 +- libclamav/c++/llvm/lib/VMCore/Type.cpp | 28 +- libclamav/c++/llvm/lib/VMCore/TypesContext.h | 2 - libclamav/c++/llvm/lib/VMCore/Value.cpp | 8 + libclamav/c++/llvm/lib/VMCore/ValueTypes.cpp | 1 + libclamav/c++/llvm/projects/sample/configure | 10 +- libclamav/c++/llvm/runtime/Makefile | 5 +- .../c++/llvm/runtime/libprofile/Makefile | 2 + .../runtime/libprofile/exported_symbols.lst | 1 + .../BasicAA/{licmtest.ll => store-promote.ll} | 16 +- .../c++/llvm/test/Analysis/Profiling/dg.exp | 4 + .../Profiling/profiling-tool-chain.ll | 182 + .../test/Analysis/ScalarEvolution/scev-aa.ll | 194 + .../2002-01-24-BadSymbolTableAssert.ll | 2 +- .../2002-01-24-ValueRefineAbsType.ll | 2 +- .../test/Assembler/2002-02-19-TypeParsing.ll | 2 +- .../Assembler/2002-03-08-NameCollision.ll | 2 +- .../Assembler/2002-03-08-NameCollision2.ll | 2 +- .../Assembler/2002-04-04-PureVirtMethCall.ll | 2 +- .../Assembler/2002-04-04-PureVirtMethCall2.ll | 2 +- .../test/Assembler/2002-04-05-TypeParsing.ll | 2 +- .../Assembler/2002-05-02-InvalidForwardRef.ll | 2 +- .../test/Assembler/2002-05-02-ParseError.ll | 2 +- .../2002-07-08-HugePerformanceProblem.ll | 2 +- .../2002-07-25-ParserAssertionFailure.ll | 2 +- .../Assembler/2002-08-15-CastAmbiguity.ll | 2 +- .../2002-08-15-ConstantExprProblem.ll | 2 +- .../2002-08-15-UnresolvedGlobalReference.ll | 2 +- .../Assembler/2002-08-22-DominanceProblem.ll | 2 +- .../2002-10-08-LargeArrayPerformance.ll | 2 +- .../test/Assembler/2002-10-15-NameClash.ll | 2 +- .../Assembler/2002-12-15-GlobalResolve.ll | 2 +- .../Assembler/2003-01-30-UnsignedString.ll | 2 +- .../2003-04-25-UnresolvedGlobalReference.ll | 2 +- .../Assembler/2003-05-15-AssemblerProblem.ll | 2 +- .../test/Assembler/2003-05-15-SwitchBug.ll | 2 +- .../Assembler/2003-05-21-ConstantShiftExpr.ll | 2 +- .../Assembler/2003-05-21-EmptyStructTest.ll | 2 +- .../2003-06-30-RecursiveTypeProblem.ll | 2 +- .../2003-10-04-NotMergingGlobalConstants.ll | 2 +- .../2003-12-30-TypeMapInvalidMemory.ll | 2 +- .../2004-02-27-SelfUseAssertError.ll | 2 +- .../2004-04-04-GetElementPtrIndexTypes.ll | 2 +- .../Assembler/2004-10-22-BCWriterUndefBug.ll | 2 +- .../Assembler/2004-11-28-InvalidTypeCrash.ll | 2 +- .../2005-01-31-CallingAggregateFunction.ll | 2 +- .../2007-01-02-Undefined-Arg-Type.ll | 2 +- .../Assembler/2007-01-05-Cmp-ConstExpr.ll | 2 +- .../Assembler/2007-01-16-CrashOnBadCast.ll | 2 +- .../Assembler/2007-01-16-CrashOnBadCast2.ll | 2 +- .../2007-03-18-InvalidNumberedVar.ll | 2 +- .../Assembler/2008-09-02-FunctionNotes2.ll | 2 +- .../test/Assembler/2009-07-24-ZeroArgGEP.ll | 2 +- libclamav/c++/llvm/test/Assembler/select.ll | 2 +- libclamav/c++/llvm/test/Bitcode/memcpy.ll | 2 +- libclamav/c++/llvm/test/Bitcode/metadata-2.ll | 2 +- libclamav/c++/llvm/test/Bitcode/metadata.ll | 2 +- .../test/CodeGen/ARM/2009-08-21-PostRAKill.ll | 40 + .../CodeGen/ARM/2009-08-21-PostRAKill2.ll | 38 + .../CodeGen/ARM/2009-08-21-PostRAKill3.ll | 31 + .../CodeGen/ARM/2009-08-23-linkerprivate.ll | 8 + .../CodeGen/ARM/2009-08-26-ScalarToVector.ll | 27 + .../CodeGen/ARM/2009-08-27-ScalarToVector.ll | 35 + .../CodeGen/ARM/2009-08-29-ExtractEltf32.ll | 25 + .../CodeGen/ARM/2009-08-29-TooLongSplat.ll | 23 + .../c++/llvm/test/CodeGen/ARM/aliases.ll | 2 +- .../c++/llvm/test/CodeGen/ARM/ldr_ext.ll | 31 +- .../c++/llvm/test/CodeGen/ARM/spill-q.ll | 57 + libclamav/c++/llvm/test/CodeGen/ARM/stubs.ll | 67 - libclamav/c++/llvm/test/CodeGen/ARM/vcls.ll | 17 +- libclamav/c++/llvm/test/CodeGen/ARM/vclz.ll | 17 +- libclamav/c++/llvm/test/CodeGen/ARM/vcnt.ll | 7 +- libclamav/c++/llvm/test/CodeGen/ARM/vcvt.ll | 22 +- .../c++/llvm/test/CodeGen/ARM/vget_lane2.ll | 63 + .../c++/llvm/test/CodeGen/ARM/vset_lane.ll | 7 + libclamav/c++/llvm/test/CodeGen/Alpha/add.ll | 2 +- .../CodeGen/CPP/2009-05-01-Long-Double.ll | 2 +- .../test/CodeGen/CPP/2009-05-04-CondBr.ll | 2 +- .../c++/llvm/test/CodeGen/CellSPU/loads.ll | 10 +- .../llvm/test/CodeGen/CellSPU/rotate_ops.ll | 2 +- .../c++/llvm/test/CodeGen/CellSPU/sext128.ll | 47 + .../c++/llvm/test/CodeGen/Generic/Makefile | 4 +- .../test/CodeGen/Generic/nested-select.ll | 2 +- .../CodeGen/Generic/switch-lower-feature-2.ll | 2 +- .../MSP430/2009-08-25-DynamicStackAlloc.ll | 30 + .../llvm/test/CodeGen/MSP430/inline-asm.ll | 16 + .../test/CodeGen/Mips/2008-06-05-Carry.ll | 2 +- .../Mips/2008-07-07-IntDoubleConvertions.ll | 2 +- .../Mips/2008-07-15-InternalConstant.ll | 2 +- .../CodeGen/Mips/2008-07-15-SmallSection.ll | 4 +- .../CodeGen/Mips/2008-07-16-SignExtInReg.ll | 2 +- .../test/CodeGen/Mips/2008-07-22-Cstpool.ll | 2 +- .../test/CodeGen/Mips/2008-07-23-fpcmp.ll | 2 +- .../test/CodeGen/Mips/2008-07-31-fcopysign.ll | 2 +- .../test/CodeGen/Mips/2008-08-01-AsmInline.ll | 2 +- .../test/CodeGen/Mips/2008-08-03-fabs64.ll | 2 +- .../CodeGen/Mips/2008-08-04-Bitconvert.ll | 2 +- .../llvm/test/CodeGen/Mips/2008-08-07-CC.ll | 2 +- ...009-08-17-inline-asm-addr-mode-breakage.ll | 5 +- .../2009-08-23-linkerprivate.ll | 2 - .../test/CodeGen/PowerPC/Frames-alloca.ll | 57 +- .../llvm/test/CodeGen/PowerPC/Frames-large.ll | 119 +- .../llvm/test/CodeGen/PowerPC/Frames-small.ll | 8 +- .../c++/llvm/test/CodeGen/PowerPC/addc.ll | 2 +- .../c++/llvm/test/CodeGen/PowerPC/and_add.ll | 2 +- .../c++/llvm/test/CodeGen/PowerPC/mulhs.ll | 2 +- .../c++/llvm/test/CodeGen/PowerPC/rlwimi2.ll | 2 +- .../c++/llvm/test/CodeGen/PowerPC/rlwinm.ll | 2 +- .../c++/llvm/test/CodeGen/PowerPC/rlwinm2.ll | 2 +- .../c++/llvm/test/CodeGen/PowerPC/stfiwx.ll | 4 +- .../c++/llvm/test/CodeGen/PowerPC/subc.ll | 2 +- .../llvm/test/CodeGen/PowerPC/vec_br_cmp.ll | 2 +- .../llvm/test/CodeGen/PowerPC/vec_splat.ll | 2 +- .../llvm/test/CodeGen/PowerPC/vec_vrsave.ll | 2 +- .../c++/llvm/test/CodeGen/Thumb/ldr_ext.ll | 58 +- .../llvm/test/CodeGen/Thumb2/thumb2-call.ll | 2 +- .../llvm/test/CodeGen/Thumb2/thumb2-mov.ll | 62 +- .../test/CodeGen/Thumb2/thumb2-spill-q.ll | 57 + .../2006-10-19-SwitchUnnecessaryBranching.ll | 9 +- .../test/CodeGen/X86/2007-01-08-InstrSched.ll | 11 +- .../test/CodeGen/X86/2008-07-11-SpillerBug.ll | 8 +- .../CodeGen/X86/2008-12-19-EarlyClobberBug.ll | 7 +- .../test/CodeGen/X86/2009-03-25-TestBug.ll | 2 +- .../CodeGen/X86/2009-06-03-Win64SpillXMM.ll | 2 +- .../CodeGen/X86/2009-08-23-linkerprivate.ll | 8 + .../c++/llvm/test/CodeGen/X86/abi-isel.ll | 8133 ++++++++++++++++- .../c++/llvm/test/CodeGen/X86/aliases.ll | 2 +- libclamav/c++/llvm/test/CodeGen/X86/anyext.ll | 18 + .../c++/llvm/test/CodeGen/X86/asm-modifier.ll | 20 + .../c++/llvm/test/CodeGen/X86/atomic_op.ll | 2 +- .../llvm/test/CodeGen/X86/cmov-i8-eflags.ll | 55 + .../c++/llvm/test/CodeGen/X86/commute-cmov.ll | 25 +- .../X86/convert-2-addr-3-addr-inc64.ll | 2 +- .../CodeGen/X86/dagcombine-buildvector.ll | 2 +- .../llvm/test/CodeGen/X86/extract-combine.ll | 2 +- .../c++/llvm/test/CodeGen/X86/fast-isel.ll | 9 + .../test/CodeGen/X86/ins_subreg_coalesce-1.ll | 2 +- .../CodeGen/X86/iv-users-in-other-loops.ll | 2 +- .../llvm/test/CodeGen/X86/legalizedag_vec.ll | 2 +- .../c++/llvm/test/CodeGen/X86/mingw-alloca.ll | 2 +- libclamav/c++/llvm/test/CodeGen/X86/neg_fp.ll | 4 +- libclamav/c++/llvm/test/CodeGen/X86/pic-1.ll | 2 +- libclamav/c++/llvm/test/CodeGen/X86/pic-2.ll | 2 +- libclamav/c++/llvm/test/CodeGen/X86/pic-4.ll | 2 +- libclamav/c++/llvm/test/CodeGen/X86/pic-5.ll | 2 +- libclamav/c++/llvm/test/CodeGen/X86/pic-6.ll | 2 +- .../c++/llvm/test/CodeGen/X86/pic-cpool.ll | 2 +- .../c++/llvm/test/CodeGen/X86/pic-jtbl.ll | 2 +- .../llvm/test/CodeGen/X86/scalar-extract.ll | 2 +- .../c++/llvm/test/CodeGen/X86/select-i8.ll | 12 + .../test/CodeGen/X86/subclass-coalesce.ll | 17 - .../c++/llvm/test/CodeGen/X86/vec_clear.ll | 2 +- .../llvm/test/CodeGen/X86/vec_extract-sse4.ll | 2 +- .../c++/llvm/test/CodeGen/X86/vec_extract.ll | 2 +- .../c++/llvm/test/CodeGen/X86/vec_i64.ll | 2 +- .../c++/llvm/test/CodeGen/X86/vec_insert-8.ll | 2 +- .../c++/llvm/test/CodeGen/X86/vec_set-3.ll | 2 +- .../c++/llvm/test/CodeGen/X86/vec_set-5.ll | 2 +- .../c++/llvm/test/CodeGen/X86/vec_set-6.ll | 2 +- .../llvm/test/CodeGen/X86/vec_shuffle-10.ll | 2 +- .../llvm/test/CodeGen/X86/vec_shuffle-16.ll | 4 +- .../llvm/test/CodeGen/X86/vec_shuffle-22.ll | 4 +- .../llvm/test/CodeGen/X86/vec_shuffle-25.ll | 2 +- .../llvm/test/CodeGen/X86/vec_shuffle-26.ll | 2 +- .../llvm/test/CodeGen/X86/vec_shuffle-27.ll | 2 +- .../llvm/test/CodeGen/X86/vec_shuffle-28.ll | 2 +- .../llvm/test/CodeGen/X86/vec_shuffle-3.ll | 2 +- .../llvm/test/CodeGen/X86/vec_shuffle-30.ll | 2 +- .../llvm/test/CodeGen/X86/vec_shuffle-31.ll | 2 +- .../llvm/test/CodeGen/X86/vec_shuffle-35.ll | 4 +- .../llvm/test/CodeGen/X86/vec_shuffle-36.ll | 2 +- .../llvm/test/CodeGen/X86/vec_shuffle-5.ll | 2 +- .../llvm/test/CodeGen/X86/vec_shuffle-6.ll | 2 +- .../llvm/test/CodeGen/X86/vec_shuffle-7.ll | 2 +- .../llvm/test/CodeGen/X86/vec_shuffle-9.ll | 2 +- .../c++/llvm/test/CodeGen/X86/vec_shuffle.ll | 2 +- .../c++/llvm/test/CodeGen/X86/vec_splat-3.ll | 2 +- .../c++/llvm/test/CodeGen/X86/vec_splat-4.ll | 2 +- .../llvm/test/CodeGen/X86/vec_ss_load_fold.ll | 2 +- .../c++/llvm/test/CodeGen/X86/vshift-1.ll | 2 +- .../c++/llvm/test/CodeGen/X86/vshift-2.ll | 4 +- .../c++/llvm/test/CodeGen/X86/vshift-3.ll | 4 +- .../c++/llvm/test/CodeGen/X86/vshift-4.ll | 2 +- .../llvm/test/CodeGen/X86/widen_arith-1.ll | 2 +- .../llvm/test/CodeGen/X86/widen_arith-2.ll | 2 +- .../llvm/test/CodeGen/X86/widen_arith-3.ll | 2 +- .../llvm/test/CodeGen/X86/widen_arith-4.ll | 2 +- .../llvm/test/CodeGen/X86/widen_arith-5.ll | 2 +- .../llvm/test/CodeGen/X86/widen_arith-6.ll | 2 +- .../c++/llvm/test/CodeGen/X86/widen_cast-1.ll | 2 +- .../c++/llvm/test/CodeGen/X86/widen_cast-2.ll | 2 +- .../c++/llvm/test/CodeGen/X86/widen_cast-3.ll | 2 +- .../c++/llvm/test/CodeGen/X86/widen_cast-4.ll | 2 +- .../c++/llvm/test/CodeGen/X86/widen_cast-5.ll | 2 +- .../c++/llvm/test/CodeGen/X86/widen_cast-6.ll | 2 +- .../c++/llvm/test/CodeGen/X86/widen_conv-1.ll | 2 +- .../c++/llvm/test/CodeGen/X86/widen_conv-2.ll | 2 +- .../c++/llvm/test/CodeGen/X86/widen_conv-3.ll | 2 +- .../c++/llvm/test/CodeGen/X86/widen_conv-4.ll | 2 +- .../llvm/test/CodeGen/X86/widen_select-1.ll | 2 +- .../llvm/test/CodeGen/X86/widen_shuffle-1.ll | 2 +- .../llvm/test/CodeGen/X86/widen_shuffle-2.ll | 2 +- .../c++/llvm/test/CodeGen/X86/x86-64-mem.ll | 4 +- .../c++/llvm/test/CodeGen/X86/x86-64-pic-1.ll | 2 +- .../llvm/test/CodeGen/X86/x86-64-pic-10.ll | 2 +- .../llvm/test/CodeGen/X86/x86-64-pic-11.ll | 2 +- .../c++/llvm/test/CodeGen/X86/x86-64-pic-2.ll | 2 +- .../c++/llvm/test/CodeGen/X86/x86-64-pic-3.ll | 2 +- .../c++/llvm/test/CodeGen/X86/x86-64-pic-4.ll | 2 +- .../c++/llvm/test/CodeGen/X86/x86-64-pic-5.ll | 2 +- .../c++/llvm/test/CodeGen/X86/x86-64-pic-6.ll | 2 +- .../c++/llvm/test/CodeGen/X86/x86-64-pic-7.ll | 2 +- .../c++/llvm/test/CodeGen/X86/x86-64-pic-8.ll | 2 +- .../c++/llvm/test/CodeGen/X86/x86-64-pic-9.ll | 2 +- .../llvm/test/DebugInfo/2008-11-06-Mem2Reg.ll | 56 - .../test/DebugInfo/2008-11-19-InstCombine.ll | 44 - .../2009-01-15-RecordVariableCrash.ll | 2 +- .../test/DebugInfo/2009-01-15-dbg_declare.ll | 5 +- .../llvm/test/DebugInfo/2009-01-15-member.ll | 4 +- .../test/DebugInfo/2009-01-28-ArrayType.ll | 23 - .../DebugInfo/2009-01-29-HeaderLocation.ll | 46 - .../DebugInfo/2009-01-29-MethodDeclaration.ll | 32 - .../llvm/test/DebugInfo/2009-01-30-Method.ll | 103 - .../2009-02-18-DefaultScope-Crash.ll | 2 +- .../test/DebugInfo/2009-02-23-InstCombine.ll | 41 - .../llvm/test/DebugInfo/2009-03-02-sink.ll | 57 - .../llvm/test/DebugInfo/2009-06-12-Inline.ll | 2 +- libclamav/c++/llvm/test/DebugInfo/dataOnly.ll | 47 - .../c++/llvm/test/DebugInfo/forwardDecl.ll | 49 - .../c++/llvm/test/DebugInfo/printdbginfo.ll | 136 - .../c++/llvm/test/DebugInfo/printdbginfo2.ll | 74 - .../ExecutionEngine/2002-12-16-ArgTest.ll | 2 +- .../ExecutionEngine/2003-01-04-ArgumentBug.ll | 2 +- .../ExecutionEngine/2003-01-04-LoopTest.ll | 2 +- .../ExecutionEngine/2003-01-04-PhiTest.ll | 2 +- .../ExecutionEngine/2003-01-09-SARTest.ll | 2 +- .../test/ExecutionEngine/2003-01-10-FUCOM.ll | 2 +- .../2003-01-15-AlignmentTest.ll | 2 +- .../2003-05-11-PHIRegAllocBug.ll | 2 +- .../ExecutionEngine/2003-06-04-bzip2-bug.ll | 2 +- .../test/ExecutionEngine/2003-06-05-PHIBug.ll | 2 +- .../2003-08-15-AllocaAssertion.ll | 2 +- .../2003-08-21-EnvironmentTest.ll | 2 +- .../2003-08-23-RegisterAllocatePhysReg.ll | 2 +- ...8-PHINode-ConstantExpr-CondCode-Failure.ll | 2 +- .../2008-06-05-APInt-OverAShr.ll | 2 +- .../c++/llvm/test/ExecutionEngine/hello.ll | 2 +- .../c++/llvm/test/ExecutionEngine/hello2.ll | 2 +- .../llvm/test/ExecutionEngine/simplesttest.ll | 2 +- .../llvm/test/ExecutionEngine/simpletest.ll | 2 +- .../llvm/test/ExecutionEngine/test-arith.ll | 2 +- .../llvm/test/ExecutionEngine/test-branch.ll | 2 +- .../llvm/test/ExecutionEngine/test-call.ll | 2 +- .../llvm/test/ExecutionEngine/test-cast.ll | 2 +- .../test/ExecutionEngine/test-constantexpr.ll | 2 +- .../c++/llvm/test/ExecutionEngine/test-fp.ll | 2 +- .../test/ExecutionEngine/test-loadstore.ll | 2 +- .../llvm/test/ExecutionEngine/test-logical.ll | 2 +- .../llvm/test/ExecutionEngine/test-loop.ll | 2 +- .../llvm/test/ExecutionEngine/test-malloc.ll | 2 +- .../c++/llvm/test/ExecutionEngine/test-phi.ll | 2 +- .../c++/llvm/test/ExecutionEngine/test-ret.ll | 2 +- .../test/ExecutionEngine/test-setcond-fp.ll | 2 +- .../test/ExecutionEngine/test-setcond-int.ll | 2 +- .../llvm/test/ExecutionEngine/test-shift.ll | 2 +- .../c++/llvm/test/Feature/NamedMDNode2.ll | 2 +- .../llvm/test/Feature/globalredefinition3.ll | 2 +- .../FrontendC++/2003-08-20-ExceptionFail.cpp | 2 +- .../FrontendC++/2003-08-21-EmptyClass.cpp | 2 +- .../FrontendC++/2003-08-27-TypeNamespaces.cpp | 2 +- .../FrontendC++/2003-08-28-ForwardType.cpp | 2 +- .../FrontendC++/2003-08-28-SaveExprBug.cpp | 2 +- .../FrontendC++/2003-08-31-StructLayout.cpp | 2 +- .../2003-09-22-CompositeExprValue.cpp | 2 +- .../2003-09-29-ArgumentNumberMismatch.cpp | 2 +- .../FrontendC++/2003-09-30-CommaExprBug.cpp | 2 +- .../2003-09-30-ForIncrementExprBug.cpp | 2 +- .../2003-09-30-ForIncrementExprBug2.cpp | 2 +- .../2003-09-30-NestedFunctionDecl.cpp | 2 +- .../FrontendC++/2003-10-17-BoolBitfields.cpp | 2 +- .../2003-10-27-VirtualBaseClassCrash.cpp | 2 +- .../2003-11-04-ArrayConstructors.cpp | 2 +- .../FrontendC++/2003-11-04-CatchLabelName.cpp | 2 +- .../test/FrontendC++/2003-11-18-EnumArray.cpp | 2 +- .../2003-11-18-PtrMemConstantInitializer.cpp | 2 +- .../2003-11-25-ReturningOpaqueByValue.cpp | 2 +- .../2003-11-27-MultipleInheritanceThunk.cpp | 2 +- .../2003-11-29-DuplicatedCleanupTest.cpp | 2 +- .../2003-12-08-ArrayOfPtrToMemberFunc.cpp | 2 +- .../2004-03-08-ReinterpretCastCopy.cpp | 2 +- .../2004-03-15-CleanupsAndGotos.cpp | 2 +- .../2004-06-08-LateTemplateInstantiation.cpp | 2 +- .../FrontendC++/2004-09-27-CompilerCrash.cpp | 2 +- .../FrontendC++/2006-11-06-StackTrace.cpp | 2 +- .../FrontendC++/2006-11-30-NoCompileUnit.cpp | 2 +- .../test/FrontendC++/2006-11-30-Pubnames.cpp | 2 +- .../2007-04-05-PackedBitFields-1.cpp | 2 +- .../2007-04-05-PackedBitFieldsOverlap-2.cpp | 2 +- .../2007-04-05-PackedBitFieldsOverlap.cpp | 2 +- .../2007-04-05-PackedBitFieldsSmall.cpp | 2 +- .../2007-04-05-StructPackedFieldUnpacked.cpp | 2 +- .../2009-02-16-AnonTypedef-Dbg.cpp | 5 - .../FrontendC++/2009-04-21-DtorNames-dbg.cpp | 2 +- .../FrontendC++/2009-07-15-LineNumbers.cpp | 2 +- .../2002-01-23-LoadQISIReloadFailure.c | 2 +- .../FrontendC/2002-01-24-ComplexSpaceInType.c | 2 +- .../FrontendC/2002-01-24-HandleCallInsnSEGV.c | 2 +- .../FrontendC/2002-02-13-ConditionalInCall.c | 2 +- .../test/FrontendC/2002-02-13-ReloadProblem.c | 2 +- .../2002-02-13-TypeVarNameCollision.c | 2 +- .../test/FrontendC/2002-02-13-UnnamedLocal.c | 2 +- .../FrontendC/2002-02-14-EntryNodePreds.c | 2 +- .../test/FrontendC/2002-02-16-RenamingTest.c | 2 +- .../FrontendC/2002-02-17-ArgumentAddress.c | 2 +- .../test/FrontendC/2002-02-18-64bitConstant.c | 2 +- .../test/FrontendC/2002-02-18-StaticData.c | 2 +- .../FrontendC/2002-03-11-LargeCharInString.c | 2 +- .../2002-03-12-ArrayInitialization.c | 2 +- .../FrontendC/2002-03-12-StructInitialize.c | 2 +- .../FrontendC/2002-03-12-StructInitializer.c | 2 +- .../test/FrontendC/2002-03-14-BrokenPHINode.c | 2 +- .../test/FrontendC/2002-03-14-BrokenSSA.c | 2 +- .../FrontendC/2002-03-14-QuotesInStrConst.c | 2 +- .../test/FrontendC/2002-04-07-SwitchStmt.c | 2 +- .../test/FrontendC/2002-04-08-LocalArray.c | 2 +- .../test/FrontendC/2002-04-09-StructRetVal.c | 2 +- .../FrontendC/2002-04-10-StructParameters.c | 2 +- .../test/FrontendC/2002-05-23-StaticValues.c | 2 +- .../FrontendC/2002-05-23-TypeNameCollision.c | 2 +- .../llvm/test/FrontendC/2002-05-24-Alloca.c | 2 +- .../2002-06-25-FWriteInterfaceFailure.c | 2 +- .../test/FrontendC/2002-07-14-MiscListTests.c | 2 +- .../test/FrontendC/2002-07-14-MiscTests.c | 2 +- .../test/FrontendC/2002-07-14-MiscTests2.c | 2 +- .../test/FrontendC/2002-07-14-MiscTests3.c | 2 +- .../FrontendC/2002-07-16-HardStringInit.c | 2 +- .../FrontendC/2002-07-17-StringConstant.c | 2 +- .../llvm/test/FrontendC/2002-07-29-Casts.c | 2 +- .../FrontendC/2002-07-30-SubregSetAssertion.c | 2 +- .../test/FrontendC/2002-07-30-UnionTest.c | 2 +- .../FrontendC/2002-07-30-VarArgsCallFailure.c | 2 +- .../test/FrontendC/2002-07-31-BadAssert.c | 2 +- .../test/FrontendC/2002-07-31-SubregFailure.c | 2 +- .../test/FrontendC/2002-08-02-UnionTest.c | 2 +- .../FrontendC/2002-08-19-RecursiveLocals.c | 2 +- .../test/FrontendC/2002-09-08-PointerShifts.c | 2 +- .../test/FrontendC/2002-09-18-UnionProblem.c | 2 +- .../test/FrontendC/2002-09-19-StarInLabel.c | 2 +- .../FrontendC/2002-10-12-TooManyArguments.c | 2 +- .../FrontendC/2002-12-15-GlobalBoolTest.c | 2 +- .../FrontendC/2002-12-15-GlobalConstantTest.c | 2 +- .../FrontendC/2002-12-15-GlobalRedefinition.c | 2 +- .../FrontendC/2002-12-15-StructParameters.c | 2 +- .../test/FrontendC/2003-03-03-DeferredType.c | 2 +- .../test/FrontendC/2003-06-22-UnionCrash.c | 2 +- .../2003-06-23-GCC-fold-infinite-recursion.c | 2 +- .../llvm/test/FrontendC/2003-06-26-CFECrash.c | 2 +- .../2003-06-29-MultipleFunctionDefinition.c | 2 +- .../test/FrontendC/2003-08-18-SigSetJmp.c | 2 +- .../test/FrontendC/2003-08-18-StructAsValue.c | 2 +- .../FrontendC/2003-08-20-BadBitfieldRef.c | 2 +- .../FrontendC/2003-08-20-PrototypeMismatch.c | 2 +- .../test/FrontendC/2003-08-20-vfork-bug.c | 2 +- .../2003-08-21-BinOp-Type-Mismatch.c | 2 +- .../llvm/test/FrontendC/2003-08-21-StmtExpr.c | 2 +- .../test/FrontendC/2003-08-21-WideString.c | 2 +- .../FrontendC/2003-08-23-LocalUnionTest.c | 2 +- .../FrontendC/2003-08-29-BitFieldStruct.c | 2 +- .../test/FrontendC/2003-08-29-HugeCharConst.c | 2 +- .../FrontendC/2003-08-29-StructLayoutBug.c | 2 +- .../2003-08-30-LargeIntegerBitfieldMember.c | 2 +- .../test/FrontendC/2003-09-18-BitfieldTests.c | 2 +- .../test/FrontendC/2003-09-30-StructLayout.c | 2 +- .../FrontendC/2003-10-02-UnionLValueError.c | 2 +- .../FrontendC/2003-10-06-NegateExprType.c | 2 +- .../2003-10-09-UnionInitializerBug.c | 2 +- .../llvm/test/FrontendC/2003-10-28-ident.c | 2 +- .../test/FrontendC/2003-10-29-AsmRename.c | 2 +- .../2003-11-01-C99-CompoundLiteral.c | 2 +- .../FrontendC/2003-11-01-EmptyStructCrash.c | 2 +- .../FrontendC/2003-11-01-GlobalUnionInit.c | 2 +- .../test/FrontendC/2003-11-04-EmptyStruct.c | 2 +- .../test/FrontendC/2003-11-04-OutOfMemory.c | 2 +- .../test/FrontendC/2003-11-12-VoidString.c | 2 +- .../FrontendC/2003-11-16-StaticArrayInit.c | 2 +- .../FrontendC/2003-11-18-CondExprLValue.c | 2 +- .../test/FrontendC/2003-11-19-BitFieldArray.c | 2 +- .../test/FrontendC/2003-11-20-Bitfields.c | 2 +- .../FrontendC/2003-11-20-ComplexDivision.c | 2 +- .../test/FrontendC/2003-11-20-UnionBitfield.c | 2 +- .../test/FrontendC/2003-11-26-PointerShift.c | 2 +- .../FrontendC/2003-11-27-ConstructorCast.c | 2 +- .../2003-11-27-UnionCtorInitialization.c | 2 +- .../2004-01-08-ExternInlineRedefine.c | 2 +- .../FrontendC/2004-03-07-ComplexDivEquals.c | 2 +- .../2004-03-09-LargeArrayInitializers.c | 2 +- .../FrontendC/2004-03-15-SimpleIndirectGoto.c | 2 +- .../FrontendC/2004-03-16-AsmRegisterCrash.c | 2 +- .../test/FrontendC/2004-05-07-VarArrays.c | 2 +- .../FrontendC/2004-05-21-IncompleteEnum.c | 2 +- .../FrontendC/2004-06-08-OpaqueStructArg.c | 2 +- .../FrontendC/2004-06-17-UnorderedBuiltins.c | 2 +- ...04-06-18-VariableLengthArrayOfStructures.c | 2 +- .../test/FrontendC/2004-07-06-FunctionCast.c | 2 +- .../FrontendC/2004-08-06-LargeStructTest.c | 2 +- .../FrontendC/2005-09-20-ComplexConstants.c | 2 +- .../test/FrontendC/2009-02-17-BitField-dbg.c | 2 +- .../FrontendC/2009-07-15-pad-wchar_t-array.c | 2 +- .../2009-08-11-AsmBlocksComplexJumpTarget.c | 2 +- .../FrontendObjC/2009-02-17-RunTimeVer-dbg.m | 13 - .../test/FrontendObjC/2009-04-14-AsmSection.m | 2 +- .../2009-04-27-bitfield-vs-ivar.m | 2 +- .../test/FrontendObjC/2009-08-17-DebugInfo.m | 4 +- .../test/Linker/2003-01-30-LinkerRename.ll | 2 +- .../llvm/test/Linker/2003-04-21-Linkage.ll | 2 +- .../test/Linker/2003-04-23-LinkOnceLost.ll | 4 +- .../Linker/2003-04-26-NullPtrLinkProblem.ll | 2 +- .../Linker/2004-02-17-WeakStrongLinkage.ll | 2 +- .../test/Linker/2004-05-07-TypeResolution1.ll | 6 +- .../test/Linker/2006-01-19-ConstantPacked.ll | 4 +- .../test/Linker/2008-03-05-AliasReference.ll | 6 +- .../Linker/2008-06-13-LinkOnceRedefinition.ll | 6 +- .../test/Linker/2008-06-26-AddressSpace.ll | 4 +- .../test/Linker/2008-07-06-AliasFnDecl.ll | 6 +- .../test/Linker/2008-07-06-AliasWeakDest.ll | 8 +- libclamav/c++/llvm/test/Linker/basiclink.ll | 8 +- .../c++/llvm/test/Linker/link-archive.ll | 4 +- .../llvm/test/Linker/link-global-to-func.ll | 4 +- .../c++/llvm/test/Linker/link-messages.ll | 4 +- .../c++/llvm/test/Linker/redefinition.ll | 6 +- libclamav/c++/llvm/test/Linker/weakextern.ll | 2 +- .../llvm/test/MC/AsmParser/conditional_asm.s | 2 +- libclamav/c++/llvm/test/MC/AsmParser/dg.exp | 5 +- .../test/MC/AsmParser/directive_include.s | 2 +- .../llvm/test/MC/AsmParser/directive_lcomm.s | 6 +- .../llvm/test/MC/AsmParser/directive_lsym.s | 5 + .../llvm/test/MC/AsmParser/directive_set.s | 2 +- .../llvm/test/MC/AsmParser/exprs-invalid.s | 5 + libclamav/c++/llvm/test/MC/AsmParser/labels.s | 18 +- .../c++/llvm/test/MC/AsmParser/x86_operands.s | 10 +- libclamav/c++/llvm/test/MC/MachO/comm-1.s | 114 + libclamav/c++/llvm/test/MC/MachO/dg.exp | 5 +- .../c++/llvm/test/MC/MachO/lcomm-attributes.s | 136 + libclamav/c++/llvm/test/MC/MachO/reloc.s | 227 + .../c++/llvm/test/MC/MachO/section-align-1.s | 87 + .../c++/llvm/test/MC/MachO/section-align-2.s | 137 + libclamav/c++/llvm/test/MC/MachO/sections.s | 8 +- .../c++/llvm/test/MC/MachO/symbol-indirect.s | 268 + libclamav/c++/llvm/test/MC/MachO/symbols-1.s | 3 +- libclamav/c++/llvm/test/MC/MachO/values.s | 135 + libclamav/c++/llvm/test/MC/MachO/zerofill-1.s | 121 + libclamav/c++/llvm/test/MC/MachO/zerofill-2.s | 103 + libclamav/c++/llvm/test/MC/MachO/zerofill-3.s | 141 + libclamav/c++/llvm/test/Makefile.tests | 2 +- libclamav/c++/llvm/test/Scripts/macho-dump | 36 +- .../Transforms/IndVarSimplify/sink-alloca.ll | 31 + .../Transforms/Inline/2007-06-06-NoInline.ll | 2 +- .../test/Transforms/Inline/alloca-in-scc.ll | 31 + .../test/Transforms/Inline/array_merge.ll | 26 + .../c++/llvm/test/Transforms/Inline/crash.ll | 57 + .../Transforms/Inline/indirect_resolve.ll | 16 + .../2002-05-14-TouchDeletedInst.ll | 508 - .../2002-09-17-GetElementPtrCrash.ll | 12 - .../2003-06-22-ConstantExprCrash.ll | 13 - .../2003-10-23-InstcombineNullFail.ll | 12 - .../2004-12-08-InstCombineCrash.ll | 14 - .../InstCombine/2006-02-07-SextZextCrash.ll | 21 - .../InstCombine/2006-04-01-InfLoop.ll | 444 - .../InstCombine/2006-05-06-Infloop.ll | 519 -- .../InstCombine/2006-06-28-infloop.ll | 20 - .../2006-09-11-EmptyStructCrash.ll | 46 - .../InstCombine/2006-12-10-ICmp-GEP-GEP.ll | 162 - .../InstCombine/2007-03-31-InfiniteLoop.ll | 302 - .../InstCombine/2007-09-05-EqualGEP.ll | 10 - .../InstCombine/2007-10-28-EmptyField.ll | 24 - .../InstCombine/2008-02-04-GEPIdxBug.ll | 33 - .../2009-03-02-VarLengthArrayGEP.ll | 14 - .../InstCombine/2009-04-06-GEP-Index-Crash.ll | 24 - .../Transforms/InstCombine/GEPIdxCanon.ll | 10 - .../Transforms/InstCombine/bitcast-gep.ll | 30 - .../Transforms/InstCombine/cast-store-gep.ll | 17 - .../constant-fold-gep-overindex.ll | 33 - .../llvm/test/Transforms/InstCombine/crash.ll | 14 + .../InstCombine/getelementptr-setcc.ll | 31 - .../InstCombine/getelementptr-seteq.ll | 13 - .../Transforms/InstCombine/getelementptr.ll | 450 +- .../InstCombine/getelementptr_cast.ll | 11 - .../InstCombine/getelementptr_const.ll | 15 - .../InstCombine/getelementptr_index.ll | 9 - .../InstCombine/getelementptr_promote.ll | 58 - .../udiv_select_to_select_shift.ll | 2 +- .../LICM/2003-08-04-TrappingInstOkHoist.ll | 21 - .../LICM/2003-12-13-VolatilePromote.ll | 16 - .../LICM/call_sink_const_function.ll | 17 - .../LICM/call_sink_pure_function.ll | 16 - ...08-04-TrappingInstHoist.ll => hoisting.ll} | 34 +- .../test/Transforms/LICM/scalar_promote.ll | 52 +- .../Transforms/LICM/sink_critical_edge.ll | 16 - .../llvm/test/Transforms/LICM/sink_inst.ll | 20 - .../llvm/test/Transforms/LICM/sink_load.ll | 21 - .../test/Transforms/LICM/sink_multiple.ll | 21 - .../Transforms/LICM/sink_multiple_exits.ll | 24 - .../Transforms/LICM/sink_only_some_exits.ll | 23 - .../test/Transforms/LICM/sink_phi_node_use.ll | 21 - .../Transforms/LICM/sink_trapping_inst.ll | 18 - .../c++/llvm/test/Transforms/LICM/sinking.ll | 235 + .../test/Transforms/LoopIndexSplit/PR3913.ll | 24 + .../test/Transforms/SimplifyCFG/dbginfo.ll | 2 - .../test/Transforms/TailDup/if-tail-dup.ll | 2 +- .../test/Verifier/2008-03-01-AllocaSized.ll | 2 +- .../Verifier/2008-08-22-MemCpyAlignment.ll | 2 +- .../c++/llvm/test/Verifier/SelfReferential.ll | 2 +- .../c++/llvm/test/Verifier/aliasing-chain.ll | 2 +- libclamav/c++/llvm/test/Verifier/byval-4.ll | 2 +- libclamav/c++/llvm/test/Verifier/invoke-2.ll | 2 +- libclamav/c++/llvm/test/lib/llvm2cpp.exp | 4 +- libclamav/c++/llvm/tools/CMakeLists.txt | 3 - libclamav/c++/llvm/tools/Makefile | 2 +- .../llvm/tools/bugpoint/ExtractFunction.cpp | 3 +- .../llvm/tools/bugpoint/OptimizerDriver.cpp | 6 +- .../c++/llvm/tools/bugpoint/ToolRunner.cpp | 1 - .../c++/llvm/tools/bugpoint/bugpoint.cpp | 5 +- libclamav/c++/llvm/tools/gccas/Makefile | 28 - libclamav/c++/llvm/tools/gccas/gccas.sh | 64 - libclamav/c++/llvm/tools/gccld/Makefile | 29 - libclamav/c++/llvm/tools/gccld/gccld.sh | 23 - libclamav/c++/llvm/tools/gold/gold-plugin.cpp | 2 +- libclamav/c++/llvm/tools/llc/llc.cpp | 11 +- libclamav/c++/llvm/tools/llvm-as/llvm-as.cpp | 5 +- .../tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp | 1 + .../c++/llvm/tools/llvm-dis/llvm-dis.cpp | 5 +- .../llvm/tools/llvm-extract/llvm-extract.cpp | 12 +- libclamav/c++/llvm/tools/llvm-ld/llvm-ld.cpp | 7 +- .../c++/llvm/tools/llvm-link/llvm-link.cpp | 12 +- libclamav/c++/llvm/tools/llvm-mc/AsmExpr.cpp | 162 - libclamav/c++/llvm/tools/llvm-mc/AsmExpr.h | 179 - .../c++/llvm/tools/llvm-mc/AsmParser.cpp | 302 +- libclamav/c++/llvm/tools/llvm-mc/AsmParser.h | 47 +- .../c++/llvm/tools/llvm-mc/CMakeLists.txt | 1 - libclamav/c++/llvm/tools/llvm-mc/llvm-mc.cpp | 25 +- .../c++/llvm/tools/llvm-prof/llvm-prof.cpp | 55 +- .../mcc16/plugins/PIC16Base/PluginMain.cpp | 8 +- .../c++/llvm/tools/lto/LTOCodeGenerator.cpp | 7 +- .../c++/llvm/tools/opt/GraphPrinters.cpp | 2 +- libclamav/c++/llvm/tools/opt/opt.cpp | 9 +- .../c++/llvm/unittests/Support/RegexTest.cpp | 64 + .../llvm/unittests/VMCore/PassManagerTest.cpp | 2 +- .../c++/llvm/utils/FileUpdate/FileUpdate.cpp | 2 +- .../utils/TableGen/CodeGenDAGPatterns.cpp | 67 +- .../llvm/utils/TableGen/CodeGenDAGPatterns.h | 14 +- .../utils/TableGen/CodeGenInstruction.cpp | 4 +- .../c++/llvm/utils/TableGen/TableGen.cpp | 3 +- libclamav/c++/llvm/utils/buildit/GNUmakefile | 1 + libclamav/c++/llvm/utils/buildit/build_llvm | 10 +- libclamav/c++/llvm/utils/llvm.grm | 1 + libclamav/c++/llvm/utils/vim/llvm.vim | 2 +- 836 files changed, 24353 insertions(+), 10249 deletions(-) create mode 100644 libclamav/c++/llvm/docs/re_format.7 delete mode 100644 libclamav/c++/llvm/include/llvm/ADT/iterator.cmake delete mode 100644 libclamav/c++/llvm/include/llvm/ADT/iterator.h.in create mode 100644 libclamav/c++/llvm/include/llvm/MC/MCCodeEmitter.h create mode 100644 libclamav/c++/llvm/include/llvm/MC/MCExpr.h create mode 100644 libclamav/c++/llvm/include/llvm/Support/Regex.h create mode 100644 libclamav/c++/llvm/lib/Analysis/ScalarEvolutionAliasAnalysis.cpp create mode 100644 libclamav/c++/llvm/lib/MC/MCCodeEmitter.cpp create mode 100644 libclamav/c++/llvm/lib/MC/MCExpr.cpp create mode 100644 libclamav/c++/llvm/lib/MC/MCInst.cpp create mode 100644 libclamav/c++/llvm/lib/Support/COPYRIGHT.regex create mode 100644 libclamav/c++/llvm/lib/Support/Regex.cpp create mode 100644 libclamav/c++/llvm/lib/Support/regcclass.h create mode 100644 libclamav/c++/llvm/lib/Support/regcname.h create mode 100644 libclamav/c++/llvm/lib/Support/regcomp.c create mode 100644 libclamav/c++/llvm/lib/Support/regengine.inc create mode 100644 libclamav/c++/llvm/lib/Support/regerror.c create mode 100644 libclamav/c++/llvm/lib/Support/regex2.h create mode 100644 libclamav/c++/llvm/lib/Support/regex_impl.h create mode 100644 libclamav/c++/llvm/lib/Support/regexec.c create mode 100644 libclamav/c++/llvm/lib/Support/regfree.c create mode 100644 libclamav/c++/llvm/lib/Support/regstrlcpy.c create mode 100644 libclamav/c++/llvm/lib/Support/regutils.h create mode 100644 libclamav/c++/llvm/lib/Transforms/Instrumentation/MaximumSpanningTree.cpp create mode 100644 libclamav/c++/llvm/lib/Transforms/Instrumentation/MaximumSpanningTree.h delete mode 100644 libclamav/c++/llvm/lib/Transforms/Utils/CloneTrace.cpp rename libclamav/c++/llvm/test/Analysis/BasicAA/{licmtest.ll => store-promote.ll} (73%) create mode 100644 libclamav/c++/llvm/test/Analysis/Profiling/dg.exp create mode 100644 libclamav/c++/llvm/test/Analysis/Profiling/profiling-tool-chain.ll create mode 100644 libclamav/c++/llvm/test/Analysis/ScalarEvolution/scev-aa.ll create mode 100644 libclamav/c++/llvm/test/CodeGen/ARM/2009-08-21-PostRAKill.ll create mode 100644 libclamav/c++/llvm/test/CodeGen/ARM/2009-08-21-PostRAKill2.ll create mode 100644 libclamav/c++/llvm/test/CodeGen/ARM/2009-08-21-PostRAKill3.ll create mode 100644 libclamav/c++/llvm/test/CodeGen/ARM/2009-08-23-linkerprivate.ll create mode 100644 libclamav/c++/llvm/test/CodeGen/ARM/2009-08-26-ScalarToVector.ll create mode 100644 libclamav/c++/llvm/test/CodeGen/ARM/2009-08-27-ScalarToVector.ll create mode 100644 libclamav/c++/llvm/test/CodeGen/ARM/2009-08-29-ExtractEltf32.ll create mode 100644 libclamav/c++/llvm/test/CodeGen/ARM/2009-08-29-TooLongSplat.ll create mode 100644 libclamav/c++/llvm/test/CodeGen/ARM/spill-q.ll delete mode 100644 libclamav/c++/llvm/test/CodeGen/ARM/stubs.ll create mode 100644 libclamav/c++/llvm/test/CodeGen/ARM/vget_lane2.ll create mode 100644 libclamav/c++/llvm/test/CodeGen/CellSPU/sext128.ll create mode 100644 libclamav/c++/llvm/test/CodeGen/MSP430/2009-08-25-DynamicStackAlloc.ll create mode 100644 libclamav/c++/llvm/test/CodeGen/MSP430/inline-asm.ll rename libclamav/c++/llvm/test/CodeGen/{Generic => PowerPC}/2009-08-23-linkerprivate.ll (72%) create mode 100644 libclamav/c++/llvm/test/CodeGen/Thumb2/thumb2-spill-q.ll create mode 100644 libclamav/c++/llvm/test/CodeGen/X86/2009-08-23-linkerprivate.ll create mode 100644 libclamav/c++/llvm/test/CodeGen/X86/anyext.ll create mode 100644 libclamav/c++/llvm/test/CodeGen/X86/cmov-i8-eflags.ll create mode 100644 libclamav/c++/llvm/test/CodeGen/X86/select-i8.ll delete mode 100644 libclamav/c++/llvm/test/CodeGen/X86/subclass-coalesce.ll delete mode 100644 libclamav/c++/llvm/test/DebugInfo/2008-11-06-Mem2Reg.ll delete mode 100644 libclamav/c++/llvm/test/DebugInfo/2008-11-19-InstCombine.ll delete mode 100644 libclamav/c++/llvm/test/DebugInfo/2009-01-28-ArrayType.ll delete mode 100644 libclamav/c++/llvm/test/DebugInfo/2009-01-29-HeaderLocation.ll delete mode 100644 libclamav/c++/llvm/test/DebugInfo/2009-01-29-MethodDeclaration.ll delete mode 100644 libclamav/c++/llvm/test/DebugInfo/2009-01-30-Method.ll delete mode 100644 libclamav/c++/llvm/test/DebugInfo/2009-02-23-InstCombine.ll delete mode 100644 libclamav/c++/llvm/test/DebugInfo/2009-03-02-sink.ll delete mode 100644 libclamav/c++/llvm/test/DebugInfo/dataOnly.ll delete mode 100644 libclamav/c++/llvm/test/DebugInfo/forwardDecl.ll delete mode 100644 libclamav/c++/llvm/test/DebugInfo/printdbginfo.ll delete mode 100644 libclamav/c++/llvm/test/DebugInfo/printdbginfo2.ll delete mode 100644 libclamav/c++/llvm/test/FrontendC++/2009-02-16-AnonTypedef-Dbg.cpp delete mode 100644 libclamav/c++/llvm/test/FrontendObjC/2009-02-17-RunTimeVer-dbg.m create mode 100644 libclamav/c++/llvm/test/MC/MachO/comm-1.s create mode 100644 libclamav/c++/llvm/test/MC/MachO/lcomm-attributes.s create mode 100644 libclamav/c++/llvm/test/MC/MachO/reloc.s create mode 100644 libclamav/c++/llvm/test/MC/MachO/section-align-1.s create mode 100644 libclamav/c++/llvm/test/MC/MachO/section-align-2.s create mode 100644 libclamav/c++/llvm/test/MC/MachO/symbol-indirect.s create mode 100644 libclamav/c++/llvm/test/MC/MachO/values.s create mode 100644 libclamav/c++/llvm/test/MC/MachO/zerofill-1.s create mode 100644 libclamav/c++/llvm/test/MC/MachO/zerofill-2.s create mode 100644 libclamav/c++/llvm/test/MC/MachO/zerofill-3.s create mode 100644 libclamav/c++/llvm/test/Transforms/IndVarSimplify/sink-alloca.ll create mode 100644 libclamav/c++/llvm/test/Transforms/Inline/alloca-in-scc.ll create mode 100644 libclamav/c++/llvm/test/Transforms/Inline/array_merge.ll create mode 100644 libclamav/c++/llvm/test/Transforms/Inline/crash.ll create mode 100644 libclamav/c++/llvm/test/Transforms/Inline/indirect_resolve.ll delete mode 100644 libclamav/c++/llvm/test/Transforms/InstCombine/2002-05-14-TouchDeletedInst.ll delete mode 100644 libclamav/c++/llvm/test/Transforms/InstCombine/2002-09-17-GetElementPtrCrash.ll delete mode 100644 libclamav/c++/llvm/test/Transforms/InstCombine/2003-06-22-ConstantExprCrash.ll delete mode 100644 libclamav/c++/llvm/test/Transforms/InstCombine/2003-10-23-InstcombineNullFail.ll delete mode 100644 libclamav/c++/llvm/test/Transforms/InstCombine/2004-12-08-InstCombineCrash.ll delete mode 100644 libclamav/c++/llvm/test/Transforms/InstCombine/2006-02-07-SextZextCrash.ll delete mode 100644 libclamav/c++/llvm/test/Transforms/InstCombine/2006-04-01-InfLoop.ll delete mode 100644 libclamav/c++/llvm/test/Transforms/InstCombine/2006-05-06-Infloop.ll delete mode 100644 libclamav/c++/llvm/test/Transforms/InstCombine/2006-06-28-infloop.ll delete mode 100644 libclamav/c++/llvm/test/Transforms/InstCombine/2006-09-11-EmptyStructCrash.ll delete mode 100644 libclamav/c++/llvm/test/Transforms/InstCombine/2006-12-10-ICmp-GEP-GEP.ll delete mode 100644 libclamav/c++/llvm/test/Transforms/InstCombine/2007-03-31-InfiniteLoop.ll delete mode 100644 libclamav/c++/llvm/test/Transforms/InstCombine/2007-09-05-EqualGEP.ll delete mode 100644 libclamav/c++/llvm/test/Transforms/InstCombine/2007-10-28-EmptyField.ll delete mode 100644 libclamav/c++/llvm/test/Transforms/InstCombine/2008-02-04-GEPIdxBug.ll delete mode 100644 libclamav/c++/llvm/test/Transforms/InstCombine/2009-03-02-VarLengthArrayGEP.ll delete mode 100644 libclamav/c++/llvm/test/Transforms/InstCombine/2009-04-06-GEP-Index-Crash.ll delete mode 100644 libclamav/c++/llvm/test/Transforms/InstCombine/GEPIdxCanon.ll delete mode 100644 libclamav/c++/llvm/test/Transforms/InstCombine/bitcast-gep.ll delete mode 100644 libclamav/c++/llvm/test/Transforms/InstCombine/cast-store-gep.ll delete mode 100644 libclamav/c++/llvm/test/Transforms/InstCombine/constant-fold-gep-overindex.ll create mode 100644 libclamav/c++/llvm/test/Transforms/InstCombine/crash.ll delete mode 100644 libclamav/c++/llvm/test/Transforms/InstCombine/getelementptr-setcc.ll delete mode 100644 libclamav/c++/llvm/test/Transforms/InstCombine/getelementptr-seteq.ll delete mode 100644 libclamav/c++/llvm/test/Transforms/InstCombine/getelementptr_cast.ll delete mode 100644 libclamav/c++/llvm/test/Transforms/InstCombine/getelementptr_const.ll delete mode 100644 libclamav/c++/llvm/test/Transforms/InstCombine/getelementptr_index.ll delete mode 100644 libclamav/c++/llvm/test/Transforms/InstCombine/getelementptr_promote.ll delete mode 100644 libclamav/c++/llvm/test/Transforms/LICM/2003-08-04-TrappingInstOkHoist.ll delete mode 100644 libclamav/c++/llvm/test/Transforms/LICM/2003-12-13-VolatilePromote.ll delete mode 100644 libclamav/c++/llvm/test/Transforms/LICM/call_sink_const_function.ll delete mode 100644 libclamav/c++/llvm/test/Transforms/LICM/call_sink_pure_function.ll rename libclamav/c++/llvm/test/Transforms/LICM/{2003-08-04-TrappingInstHoist.ll => hoisting.ll} (50%) delete mode 100644 libclamav/c++/llvm/test/Transforms/LICM/sink_critical_edge.ll delete mode 100644 libclamav/c++/llvm/test/Transforms/LICM/sink_inst.ll delete mode 100644 libclamav/c++/llvm/test/Transforms/LICM/sink_load.ll delete mode 100644 libclamav/c++/llvm/test/Transforms/LICM/sink_multiple.ll delete mode 100644 libclamav/c++/llvm/test/Transforms/LICM/sink_multiple_exits.ll delete mode 100644 libclamav/c++/llvm/test/Transforms/LICM/sink_only_some_exits.ll delete mode 100644 libclamav/c++/llvm/test/Transforms/LICM/sink_phi_node_use.ll delete mode 100644 libclamav/c++/llvm/test/Transforms/LICM/sink_trapping_inst.ll create mode 100644 libclamav/c++/llvm/test/Transforms/LICM/sinking.ll create mode 100644 libclamav/c++/llvm/test/Transforms/LoopIndexSplit/PR3913.ll delete mode 100644 libclamav/c++/llvm/tools/gccas/Makefile delete mode 100644 libclamav/c++/llvm/tools/gccas/gccas.sh delete mode 100644 libclamav/c++/llvm/tools/gccld/Makefile delete mode 100644 libclamav/c++/llvm/tools/gccld/gccld.sh delete mode 100644 libclamav/c++/llvm/tools/llvm-mc/AsmExpr.cpp delete mode 100644 libclamav/c++/llvm/tools/llvm-mc/AsmExpr.h create mode 100644 libclamav/c++/llvm/unittests/Support/RegexTest.cpp diff --git a/libclamav/c++/llvm/CMakeLists.txt b/libclamav/c++/llvm/CMakeLists.txt index 1c1e6fcee..c6036f02b 100644 --- a/libclamav/c++/llvm/CMakeLists.txt +++ b/libclamav/c++/llvm/CMakeLists.txt @@ -94,12 +94,6 @@ else() endif() endif() -if( uppercase_CMAKE_BUILD_TYPE STREQUAL "RELEASE" AND NOT LLVM_ENABLE_ASSERTIONS ) - set( LLVM_COMPACT_SENTINELS 1 ) -else( uppercase_CMAKE_BUILD_TYPE STREQUAL "RELEASE" AND NOT LLVM_ENABLE_ASSERTIONS ) - set( LLVM_COMPACT_SENTINELS 0 ) -endif( uppercase_CMAKE_BUILD_TYPE STREQUAL "RELEASE" AND NOT LLVM_ENABLE_ASSERTIONS ) - if( LLVM_TARGETS_TO_BUILD STREQUAL "all" ) set( LLVM_TARGETS_TO_BUILD ${LLVM_ALL_TARGETS} ) endif() diff --git a/libclamav/c++/llvm/LICENSE.TXT b/libclamav/c++/llvm/LICENSE.TXT index 060cb4ffd..fd4917266 100644 --- a/libclamav/c++/llvm/LICENSE.TXT +++ b/libclamav/c++/llvm/LICENSE.TXT @@ -66,3 +66,4 @@ Autoconf llvm/autoconf llvm/projects/sample/autoconf CellSPU backend llvm/lib/Target/CellSPU/README.txt Google Test llvm/utils/unittest/googletest +OpenBSD regex llvm/lib/Support/{reg*, COPYRIGHT.regex} diff --git a/libclamav/c++/llvm/Makefile b/libclamav/c++/llvm/Makefile index 700b02d02..5d10f8e23 100644 --- a/libclamav/c++/llvm/Makefile +++ b/libclamav/c++/llvm/Makefile @@ -117,7 +117,6 @@ debug-opt-prof: dist-hook:: $(Echo) Eliminating files constructed by configure $(Verb) $(RM) -f \ - $(TopDistDir)/include/llvm/ADT/iterator.h \ $(TopDistDir)/include/llvm/Config/config.h \ $(TopDistDir)/include/llvm/Support/DataTypes.h \ $(TopDistDir)/include/llvm/Support/ThreadSupport.h @@ -136,8 +135,7 @@ FilesToConfig := \ include/llvm/Config/config.h \ include/llvm/Config/Targets.def \ include/llvm/Config/AsmPrinters.def \ - include/llvm/Support/DataTypes.h \ - include/llvm/ADT/iterator.h + include/llvm/Support/DataTypes.h FilesToConfigPATH := $(addprefix $(LLVM_OBJ_ROOT)/,$(FilesToConfig)) all-local:: $(FilesToConfigPATH) diff --git a/libclamav/c++/llvm/Makefile.rules b/libclamav/c++/llvm/Makefile.rules index 5556684d5..23e554d73 100644 --- a/libclamav/c++/llvm/Makefile.rules +++ b/libclamav/c++/llvm/Makefile.rules @@ -1058,9 +1058,9 @@ $(LibName.BCA): $(ObjectsBC) $(LibDir)/.dir $(LLVMLD) \ $(LLVMToolDir)/llvm-ar $(Echo) Building $(BuildMode) Bytecode Archive $(notdir $@) \ "(internalize)" - $(Verb) $(BCLinkLib) -o $(ObjDir)/$(LIBRARYNAME).o $(ObjectsBC) + $(Verb) $(BCLinkLib) -o $(ObjDir)/$(LIBRARYNAME).internalize $(ObjectsBC) $(Verb) $(RM) -f $@ - $(Verb) $(LArchive) $@ $(ObjDir)/$(LIBRARYNAME).o + $(Verb) $(LArchive) $@ $(ObjDir)/$(LIBRARYNAME).internalize.bc else $(LibName.BCA): $(ObjectsBC) $(LibDir)/.dir \ $(LLVMToolDir)/llvm-ar diff --git a/libclamav/c++/llvm/autoconf/configure.ac b/libclamav/c++/llvm/autoconf/configure.ac index 22e4076a0..49ab0376e 100644 --- a/libclamav/c++/llvm/autoconf/configure.ac +++ b/libclamav/c++/llvm/autoconf/configure.ac @@ -361,17 +361,6 @@ else AC_SUBST(DISABLE_ASSERTIONS,[[DISABLE_ASSERTIONS=1]]) fi -dnl LLVM_COMPACT_SENTINELS : can be used to shrink ilist's end iterators and disable certain checks on them: -if test ${ENABLE_OPTIMIZED},${DISABLE_ASSERTIONS} = "ENABLE_OPTIMIZED=1,DISABLE_ASSERTIONS=1" ; then - AC_SUBST(LLVM_COMPACT_SENTINELS,[1]) -else - AC_SUBST(LLVM_COMPACT_SENTINELS,[0]) -fi - -AC_DEFINE_UNQUOTED([LLVM_COMPACT_SENTINELS],$LLVM_COMPACT_SENTINELS, - [Define to 1 for ilist sentinel compaction]) - - dnl --enable-expensive-checks : check whether they want to turn on expensive debug checks: AC_ARG_ENABLE(expensive-checks,AS_HELP_STRING( --enable-expensive-checks,[Compile with expensive debug checks enabled (default is NO)]),, enableval="no") @@ -1325,7 +1314,6 @@ AC_CONFIG_FILES([include/llvm/Config/Targets.def]) AC_CONFIG_FILES([include/llvm/Config/AsmPrinters.def]) AC_CONFIG_FILES([include/llvm/Config/AsmParsers.def]) AC_CONFIG_HEADERS([include/llvm/Support/DataTypes.h]) -AC_CONFIG_HEADERS([include/llvm/ADT/iterator.h]) dnl Configure the makefile's configuration data AC_CONFIG_FILES([Makefile.config]) diff --git a/libclamav/c++/llvm/autoconf/m4/config_makefile.m4 b/libclamav/c++/llvm/autoconf/m4/config_makefile.m4 index f21a25631..b1eaffdcd 100644 --- a/libclamav/c++/llvm/autoconf/m4/config_makefile.m4 +++ b/libclamav/c++/llvm/autoconf/m4/config_makefile.m4 @@ -5,5 +5,5 @@ AC_DEFUN([AC_CONFIG_MAKEFILE], [AC_CONFIG_COMMANDS($1, [${llvm_src}/autoconf/mkinstalldirs `dirname $1` - ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/$1 $1]) + ${SHELL} ${llvm_src}/autoconf/install-sh -m 0644 -c ${srcdir}/$1 $1]) ]) diff --git a/libclamav/c++/llvm/bindings/ocaml/llvm/Makefile b/libclamav/c++/llvm/bindings/ocaml/llvm/Makefile index cd974d482..99e347bc1 100644 --- a/libclamav/c++/llvm/bindings/ocaml/llvm/Makefile +++ b/libclamav/c++/llvm/bindings/ocaml/llvm/Makefile @@ -1,4 +1,4 @@ -##===- bindings/ocaml/bitwriter/Makefile -------------------*- Makefile -*-===## +##===- bindings/ocaml/llvm/Makefile ------------------------*- Makefile -*-===## # # The LLVM Compiler Infrastructure # diff --git a/libclamav/c++/llvm/cmake/config-ix.cmake b/libclamav/c++/llvm/cmake/config-ix.cmake index abb4afc74..85f947087 100755 --- a/libclamav/c++/llvm/cmake/config-ix.cmake +++ b/libclamav/c++/llvm/cmake/config-ix.cmake @@ -81,7 +81,11 @@ endif() include(CheckAtomic) include(CheckCXXCompilerFlag) -check_cxx_compiler_flag("-fPIC" SUPPORTS_FPIC_FLAG) +# On windows all code is position-independent and mingw warns if -fPIC +# is in the command-line. +if( NOT WIN32 ) + check_cxx_compiler_flag("-fPIC" SUPPORTS_FPIC_FLAG) +endif() include(GetTargetTriple) get_target_triple(LLVM_HOSTTRIPLE) @@ -176,11 +180,6 @@ configure_file( ${LLVM_BINARY_DIR}/include/llvm/Config/config.h ) -configure_file( - ${LLVM_MAIN_INCLUDE_DIR}/llvm/ADT/iterator.cmake - ${LLVM_BINARY_DIR}/include/llvm/ADT/iterator.h - ) - configure_file( ${LLVM_MAIN_INCLUDE_DIR}/llvm/Support/DataTypes.h.cmake ${LLVM_BINARY_DIR}/include/llvm/Support/DataTypes.h diff --git a/libclamav/c++/llvm/cmake/modules/LLVMLibDeps.cmake b/libclamav/c++/llvm/cmake/modules/LLVMLibDeps.cmake index 019a50119..ba353fd19 100644 --- a/libclamav/c++/llvm/cmake/modules/LLVMLibDeps.cmake +++ b/libclamav/c++/llvm/cmake/modules/LLVMLibDeps.cmake @@ -29,7 +29,7 @@ set(MSVC_LIB_DEPS_LLVMInstrumentation LLVMCore LLVMScalarOpts LLVMSupport LLVMSy set(MSVC_LIB_DEPS_LLVMInterpreter LLVMCodeGen LLVMCore LLVMExecutionEngine LLVMSupport LLVMSystem LLVMTarget) set(MSVC_LIB_DEPS_LLVMJIT LLVMCodeGen LLVMCore LLVMExecutionEngine LLVMMC LLVMSupport LLVMSystem LLVMTarget) set(MSVC_LIB_DEPS_LLVMLinker LLVMArchive LLVMBitReader LLVMCore LLVMSupport LLVMSystem) -set(MSVC_LIB_DEPS_LLVMMC LLVMSupport) +set(MSVC_LIB_DEPS_LLVMMC LLVMSupport LLVMSystem) set(MSVC_LIB_DEPS_LLVMMSIL LLVMAnalysis LLVMCodeGen LLVMCore LLVMMSILInfo LLVMScalarOpts LLVMSupport LLVMSystem LLVMTarget LLVMTransformUtils LLVMipa) set(MSVC_LIB_DEPS_LLVMMSILInfo LLVMSupport) set(MSVC_LIB_DEPS_LLVMMSP430AsmPrinter LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMSP430Info LLVMSupport LLVMSystem LLVMTarget) diff --git a/libclamav/c++/llvm/configure b/libclamav/c++/llvm/configure index 64566fbb1..2c15d16b3 100755 --- a/libclamav/c++/llvm/configure +++ b/libclamav/c++/llvm/configure @@ -834,7 +834,6 @@ CVSBUILD ENABLE_OPTIMIZED ENABLE_PROFILING DISABLE_ASSERTIONS -LLVM_COMPACT_SENTINELS ENABLE_EXPENSIVE_CHECKS EXPENSIVE_CHECKS DEBUG_RUNTIME @@ -4846,21 +4845,6 @@ else fi -if test ${ENABLE_OPTIMIZED},${DISABLE_ASSERTIONS} = "ENABLE_OPTIMIZED=1,DISABLE_ASSERTIONS=1" ; then - LLVM_COMPACT_SENTINELS=1 - -else - LLVM_COMPACT_SENTINELS=0 - -fi - - -cat >>confdefs.h <<_ACEOF -#define LLVM_COMPACT_SENTINELS $LLVM_COMPACT_SENTINELS -_ACEOF - - - # Check whether --enable-expensive-checks was given. if test "${enable_expensive_checks+set}" = set; then enableval=$enable_expensive_checks; @@ -10988,7 +10972,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext + echo '#line 13119 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -14850,11 +14834,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14853: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14837: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:14857: \$? = $ac_status" >&5 + echo "$as_me:14841: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -15118,11 +15102,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15121: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15105: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:15125: \$? = $ac_status" >&5 + echo "$as_me:15109: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -15222,11 +15206,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15225: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15209: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:15229: \$? = $ac_status" >&5 + echo "$as_me:15213: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -17674,7 +17658,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:20129: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:20149: \$? = $ac_status" >&5 + echo "$as_me:20133: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -20246,11 +20230,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:20249: $lt_compile\"" >&5) + (eval echo "\"\$as_me:20233: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:20253: \$? = $ac_status" >&5 + echo "$as_me:20237: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -21816,11 +21800,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:21819: $lt_compile\"" >&5) + (eval echo "\"\$as_me:21803: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:21823: \$? = $ac_status" >&5 + echo "$as_me:21807: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -21920,11 +21904,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:21923: $lt_compile\"" >&5) + (eval echo "\"\$as_me:21907: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:21927: \$? = $ac_status" >&5 + echo "$as_me:21911: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -24155,11 +24139,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:24158: $lt_compile\"" >&5) + (eval echo "\"\$as_me:24142: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:24162: \$? = $ac_status" >&5 + echo "$as_me:24146: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -24423,11 +24407,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:24426: $lt_compile\"" >&5) + (eval echo "\"\$as_me:24410: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:24430: \$? = $ac_status" >&5 + echo "$as_me:24414: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -24527,11 +24511,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:24530: $lt_compile\"" >&5) + (eval echo "\"\$as_me:24514: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:24534: \$? = $ac_status" >&5 + echo "$as_me:24518: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -35316,8 +35300,6 @@ ac_config_files="$ac_config_files include/llvm/Config/AsmParsers.def" ac_config_headers="$ac_config_headers include/llvm/Support/DataTypes.h" -ac_config_headers="$ac_config_headers include/llvm/ADT/iterator.h" - ac_config_files="$ac_config_files Makefile.config" @@ -35944,7 +35926,6 @@ do "include/llvm/Config/AsmPrinters.def") CONFIG_FILES="$CONFIG_FILES include/llvm/Config/AsmPrinters.def" ;; "include/llvm/Config/AsmParsers.def") CONFIG_FILES="$CONFIG_FILES include/llvm/Config/AsmParsers.def" ;; "include/llvm/Support/DataTypes.h") CONFIG_HEADERS="$CONFIG_HEADERS include/llvm/Support/DataTypes.h" ;; - "include/llvm/ADT/iterator.h") CONFIG_HEADERS="$CONFIG_HEADERS include/llvm/ADT/iterator.h" ;; "Makefile.config") CONFIG_FILES="$CONFIG_FILES Makefile.config" ;; "llvm.spec") CONFIG_FILES="$CONFIG_FILES llvm.spec" ;; "docs/doxygen.cfg") CONFIG_FILES="$CONFIG_FILES docs/doxygen.cfg" ;; @@ -36104,7 +36085,6 @@ CVSBUILD!$CVSBUILD$ac_delim ENABLE_OPTIMIZED!$ENABLE_OPTIMIZED$ac_delim ENABLE_PROFILING!$ENABLE_PROFILING$ac_delim DISABLE_ASSERTIONS!$DISABLE_ASSERTIONS$ac_delim -LLVM_COMPACT_SENTINELS!$LLVM_COMPACT_SENTINELS$ac_delim ENABLE_EXPENSIVE_CHECKS!$ENABLE_EXPENSIVE_CHECKS$ac_delim EXPENSIVE_CHECKS!$EXPENSIVE_CHECKS$ac_delim DEBUG_RUNTIME!$DEBUG_RUNTIME$ac_delim @@ -36123,6 +36103,7 @@ BINUTILS_INCDIR!$BINUTILS_INCDIR$ac_delim ENABLE_LLVMC_DYNAMIC!$ENABLE_LLVMC_DYNAMIC$ac_delim ENABLE_LLVMC_DYNAMIC_PLUGINS!$ENABLE_LLVMC_DYNAMIC_PLUGINS$ac_delim CXX!$CXX$ac_delim +CXXFLAGS!$CXXFLAGS$ac_delim _ACEOF if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then @@ -36164,7 +36145,6 @@ _ACEOF ac_delim='%!_!# ' for ac_last_try in false false false false false :; do cat >conf$$subs.sed <<_ACEOF -CXXFLAGS!$CXXFLAGS$ac_delim ac_ct_CXX!$ac_ct_CXX$ac_delim NM!$NM$ac_delim ifGNUmake!$ifGNUmake$ac_delim @@ -36258,7 +36238,7 @@ LIBOBJS!$LIBOBJS$ac_delim LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 92; then + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 91; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 @@ -36662,31 +36642,31 @@ echo "$as_me: executing $ac_file commands" >&6;} case $ac_file$ac_mode in "Makefile":C) ${llvm_src}/autoconf/mkinstalldirs `dirname Makefile` - ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/Makefile Makefile ;; + ${SHELL} ${llvm_src}/autoconf/install-sh -m 0644 -c ${srcdir}/Makefile Makefile ;; "Makefile.common":C) ${llvm_src}/autoconf/mkinstalldirs `dirname Makefile.common` - ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/Makefile.common Makefile.common ;; + ${SHELL} ${llvm_src}/autoconf/install-sh -m 0644 -c ${srcdir}/Makefile.common Makefile.common ;; "examples/Makefile":C) ${llvm_src}/autoconf/mkinstalldirs `dirname examples/Makefile` - ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/examples/Makefile examples/Makefile ;; + ${SHELL} ${llvm_src}/autoconf/install-sh -m 0644 -c ${srcdir}/examples/Makefile examples/Makefile ;; "lib/Makefile":C) ${llvm_src}/autoconf/mkinstalldirs `dirname lib/Makefile` - ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/lib/Makefile lib/Makefile ;; + ${SHELL} ${llvm_src}/autoconf/install-sh -m 0644 -c ${srcdir}/lib/Makefile lib/Makefile ;; "runtime/Makefile":C) ${llvm_src}/autoconf/mkinstalldirs `dirname runtime/Makefile` - ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/runtime/Makefile runtime/Makefile ;; + ${SHELL} ${llvm_src}/autoconf/install-sh -m 0644 -c ${srcdir}/runtime/Makefile runtime/Makefile ;; "test/Makefile":C) ${llvm_src}/autoconf/mkinstalldirs `dirname test/Makefile` - ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/test/Makefile test/Makefile ;; + ${SHELL} ${llvm_src}/autoconf/install-sh -m 0644 -c ${srcdir}/test/Makefile test/Makefile ;; "test/Makefile.tests":C) ${llvm_src}/autoconf/mkinstalldirs `dirname test/Makefile.tests` - ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/test/Makefile.tests test/Makefile.tests ;; + ${SHELL} ${llvm_src}/autoconf/install-sh -m 0644 -c ${srcdir}/test/Makefile.tests test/Makefile.tests ;; "unittests/Makefile":C) ${llvm_src}/autoconf/mkinstalldirs `dirname unittests/Makefile` - ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/unittests/Makefile unittests/Makefile ;; + ${SHELL} ${llvm_src}/autoconf/install-sh -m 0644 -c ${srcdir}/unittests/Makefile unittests/Makefile ;; "tools/Makefile":C) ${llvm_src}/autoconf/mkinstalldirs `dirname tools/Makefile` - ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/tools/Makefile tools/Makefile ;; + ${SHELL} ${llvm_src}/autoconf/install-sh -m 0644 -c ${srcdir}/tools/Makefile tools/Makefile ;; "utils/Makefile":C) ${llvm_src}/autoconf/mkinstalldirs `dirname utils/Makefile` - ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/utils/Makefile utils/Makefile ;; + ${SHELL} ${llvm_src}/autoconf/install-sh -m 0644 -c ${srcdir}/utils/Makefile utils/Makefile ;; "projects/Makefile":C) ${llvm_src}/autoconf/mkinstalldirs `dirname projects/Makefile` - ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/projects/Makefile projects/Makefile ;; + ${SHELL} ${llvm_src}/autoconf/install-sh -m 0644 -c ${srcdir}/projects/Makefile projects/Makefile ;; "bindings/Makefile":C) ${llvm_src}/autoconf/mkinstalldirs `dirname bindings/Makefile` - ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/bindings/Makefile bindings/Makefile ;; + ${SHELL} ${llvm_src}/autoconf/install-sh -m 0644 -c ${srcdir}/bindings/Makefile bindings/Makefile ;; "bindings/ocaml/Makefile.ocaml":C) ${llvm_src}/autoconf/mkinstalldirs `dirname bindings/ocaml/Makefile.ocaml` - ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/bindings/ocaml/Makefile.ocaml bindings/ocaml/Makefile.ocaml ;; + ${SHELL} ${llvm_src}/autoconf/install-sh -m 0644 -c ${srcdir}/bindings/ocaml/Makefile.ocaml bindings/ocaml/Makefile.ocaml ;; esac done # for ac_tag diff --git a/libclamav/c++/llvm/docs/CodeGenerator.html b/libclamav/c++/llvm/docs/CodeGenerator.html index 2f716a216..4f8472c07 100644 --- a/libclamav/c++/llvm/docs/CodeGenerator.html +++ b/libclamav/c++/llvm/docs/CodeGenerator.html @@ -1616,9 +1616,9 @@ bool RegMapping_Fer::compatible_class(MachineFunction &mf,
-$ llc -f -regalloc=simple file.bc -o sp.s;
-$ llc -f -regalloc=local file.bc -o lc.s;
-$ llc -f -regalloc=linearscan file.bc -o ln.s;
+$ llc -regalloc=simple file.bc -o sp.s;
+$ llc -regalloc=local file.bc -o lc.s;
+$ llc -regalloc=linearscan file.bc -o ln.s;
 
diff --git a/libclamav/c++/llvm/docs/CommandGuide/llc.pod b/libclamav/c++/llvm/docs/CommandGuide/llc.pod index eba7859e2..7a7bbcac9 100644 --- a/libclamav/c++/llvm/docs/CommandGuide/llc.pod +++ b/libclamav/c++/llvm/docs/CommandGuide/llc.pod @@ -49,8 +49,9 @@ B. =item B<-f> -Overwrite output files. By default, B will refuse to overwrite -an output file which already exists. +Enable binary output on terminals. Normally, B will refuse to +write raw bitcode output if the output stream is a terminal. With this option, +B will write raw bitcode regardless of the output device. =item B<-mtriple>=I diff --git a/libclamav/c++/llvm/docs/CommandGuide/llvm-as.pod b/libclamav/c++/llvm/docs/CommandGuide/llvm-as.pod index 2befed13a..045a9245b 100644 --- a/libclamav/c++/llvm/docs/CommandGuide/llvm-as.pod +++ b/libclamav/c++/llvm/docs/CommandGuide/llvm-as.pod @@ -46,9 +46,9 @@ suffix is appended. =item B<-f> -Force overwrite. Normally, B will refuse to overwrite an -output file that already exists. With this option, B -will overwrite the output file and replace it with new bitcode. +Enable binary output on terminals. Normally, B will refuse to +write raw bitcode output if the output stream is a terminal. With this option, +B will write raw bitcode regardless of the output device. =item B<--help> diff --git a/libclamav/c++/llvm/docs/CommandGuide/llvm-dis.pod b/libclamav/c++/llvm/docs/CommandGuide/llvm-dis.pod index 8df382d2e..2b83290c9 100644 --- a/libclamav/c++/llvm/docs/CommandGuide/llvm-dis.pod +++ b/libclamav/c++/llvm/docs/CommandGuide/llvm-dis.pod @@ -29,9 +29,9 @@ B<-o> option. =item B<-f> -Force overwrite. Normally, B will refuse to overwrite -an output file that already exists. With this option, B -will overwrite the output file. +Enable binary output on terminals. Normally, B will refuse to +write raw bitcode output if the output stream is a terminal. With this option, +B will write raw bitcode regardless of the output device. =item B<--help> diff --git a/libclamav/c++/llvm/docs/CommandGuide/llvm-extract.pod b/libclamav/c++/llvm/docs/CommandGuide/llvm-extract.pod index d916612ec..c3bc019c6 100644 --- a/libclamav/c++/llvm/docs/CommandGuide/llvm-extract.pod +++ b/libclamav/c++/llvm/docs/CommandGuide/llvm-extract.pod @@ -28,9 +28,9 @@ unless the B<-o> option is specified (see below). =item B<-f> -Force overwrite. Normally, B will refuse to overwrite an -output file that already exists. With this option, B -will overwrite the output file and replace it with new bitcode. +Enable binary output on terminals. Normally, B will refuse to +write raw bitcode output if the output stream is a terminal. With this option, +B will write raw bitcode regardless of the output device. =item B<--func> I diff --git a/libclamav/c++/llvm/docs/CommandGuide/llvm-link.pod b/libclamav/c++/llvm/docs/CommandGuide/llvm-link.pod index 5f4dcb6e3..8a2a8c5d7 100644 --- a/libclamav/c++/llvm/docs/CommandGuide/llvm-link.pod +++ b/libclamav/c++/llvm/docs/CommandGuide/llvm-link.pod @@ -33,8 +33,9 @@ the order in which they were specified on the command line. =item B<-f> -Overwrite output files. By default, B will not overwrite an output -file if it already exists. +Enable binary output on terminals. Normally, B will refuse to +write raw bitcode output if the output stream is a terminal. With this option, +B will write raw bitcode regardless of the output device. =item B<-o> F diff --git a/libclamav/c++/llvm/docs/CommandGuide/opt.pod b/libclamav/c++/llvm/docs/CommandGuide/opt.pod index 75b7eddd4..3e23cd1ae 100644 --- a/libclamav/c++/llvm/docs/CommandGuide/opt.pod +++ b/libclamav/c++/llvm/docs/CommandGuide/opt.pod @@ -39,9 +39,9 @@ writes its output to the standard output. =item B<-f> -Force overwrite. Normally, B will refuse to overwrite an -output file that already exists. With this option, B will -overwrite the output file and replace it with new bitcode. +Enable binary output on terminals. Normally, B will refuse to +write raw bitcode output if the output stream is a terminal. With this option, +B will write raw bitcode regardless of the output device. =item B<-help> diff --git a/libclamav/c++/llvm/docs/CommandLine.html b/libclamav/c++/llvm/docs/CommandLine.html index 09ed2b8c0..f14defc31 100644 --- a/libclamav/c++/llvm/docs/CommandLine.html +++ b/libclamav/c++/llvm/docs/CommandLine.html @@ -331,13 +331,13 @@ OPTIONS:

In addition to input and output filenames, we would like the compiler example -to support three boolean flags: "-f" to force overwriting of the output -file, "--quiet" to enable quiet mode, and "-q" for backwards -compatibility with some of our users. We can support these by declaring options -of boolean type like this:

+to support three boolean flags: "-f" to force writing binary output to +a terminal, "--quiet" to enable quiet mode, and "-q" for +backwards compatibility with some of our users. We can support these by +declaring options of boolean type like this:

-cl::opt<bool> Force ("f", cl::desc("Overwrite output files"));
+cl::opt<bool> Force ("f", cl::desc("Enable binary output on terminals"));
 cl::opt<bool> Quiet ("quiet", cl::desc("Don't print informational messages"));
 cl::opt<bool> Quiet2("q", cl::desc("Don't print informational messages"), cl::Hidden);
 
@@ -378,7 +378,7 @@ library calls to parse the string value into the specified data type.

USAGE: compiler [options] <input file> OPTIONS: - -f - Overwrite output files + -f - Enable binary output on terminals -o - Override output filename -quiet - Don't print informational messages -help - display available options (--help-hidden for more) @@ -390,7 +390,7 @@ OPTIONS: USAGE: compiler [options] <input file> OPTIONS: - -f - Overwrite output files + -f - Enable binary output on terminals -o - Override output filename -q - Don't print informational messages -quiet - Don't print informational messages @@ -530,7 +530,7 @@ OPTIONS: -O1 - Enable trivial optimizations -O2 - Enable default optimizations -O3 - Enable expensive optimizations - -f - Overwrite output files + -f - Enable binary output on terminals -help - display available options (--help-hidden for more) -o <filename> - Specify output filename -quiet - Don't print informational messages @@ -614,7 +614,7 @@ OPTIONS: =none - disable debug information =quick - enable quick debug information =detailed - enable detailed debug information - -f - Overwrite output files + -f - Enable binary output on terminals -help - display available options (--help-hidden for more) -o <filename> - Specify output filename -quiet - Don't print informational messages diff --git a/libclamav/c++/llvm/docs/HowToSubmitABug.html b/libclamav/c++/llvm/docs/HowToSubmitABug.html index bdec1c091..91d4e2bfe 100644 --- a/libclamav/c++/llvm/docs/HowToSubmitABug.html +++ b/libclamav/c++/llvm/docs/HowToSubmitABug.html @@ -183,12 +183,12 @@ to llvm-gcc (in addition to the options you already pass). Once your have foo.bc, one of the following commands should fail:

    -
  1. llc foo.bc -f
  2. -
  3. llc foo.bc -f -relocation-model=pic
  4. -
  5. llc foo.bc -f -relocation-model=static
  6. -
  7. llc foo.bc -f -enable-eh
  8. -
  9. llc foo.bc -f -relocation-model=pic -enable-eh
  10. -
  11. llc foo.bc -f -relocation-model=static -enable-eh
  12. +
  13. llc foo.bc
  14. +
  15. llc foo.bc -relocation-model=pic
  16. +
  17. llc foo.bc -relocation-model=static
  18. +
  19. llc foo.bc -enable-eh
  20. +
  21. llc foo.bc -relocation-model=pic -enable-eh
  22. +
  23. llc foo.bc -relocation-model=static -enable-eh

If none of these crash, please follow the instructions for a @@ -320,7 +320,7 @@ the following:

-llc test.bc -o test.s -f
+llc test.bc -o test.s
gcc test.s safe.so -o test.llc
./test.llc [program options]

diff --git a/libclamav/c++/llvm/docs/LangRef.html b/libclamav/c++/llvm/docs/LangRef.html index ab86271f3..44ef03b4e 100644 --- a/libclamav/c++/llvm/docs/LangRef.html +++ b/libclamav/c++/llvm/docs/LangRef.html @@ -1042,6 +1042,11 @@ define void @f() optsize function into callers whenever possible, ignoring any active inlining size threshold for this caller. +
inlinehint
+
This attribute indicates that the source code contained a hint that inlining + this function is desirable (such as the "inline" keyword in C/C++). It + is just a hint; it imposes no requirements on the inliner.
+
noinline
This attribute indicates that the inliner should never inline this function in any situation. This attribute may not be used together with diff --git a/libclamav/c++/llvm/docs/Passes.html b/libclamav/c++/llvm/docs/Passes.html index 8c086720a..362be32d7 100644 --- a/libclamav/c++/llvm/docs/Passes.html +++ b/libclamav/c++/llvm/docs/Passes.html @@ -274,6 +274,12 @@ perl -e '$/ = undef; for (split(/\n/, <>)) { s:^ *///? ?::; print "

\n" if ! located at getNode(F) + CallReturnPos. The arguments start at getNode(F) + CallArgPos.

+ +

+ Please keep in mind that the current andersen's pass has many known + problems and bugs. It should be considered "research quality". +

+
diff --git a/libclamav/c++/llvm/docs/SourceLevelDebugging.html b/libclamav/c++/llvm/docs/SourceLevelDebugging.html index fab63046a..49ce27852 100644 --- a/libclamav/c++/llvm/docs/SourceLevelDebugging.html +++ b/libclamav/c++/llvm/docs/SourceLevelDebugging.html @@ -122,8 +122,8 @@ height="369">

The approach used by the LLVM implementation is to use a small set of intrinsic functions to define a mapping between LLVM program objects and the source-level objects. The - description of the source-level program is maintained in LLVM global - variables in an implementation-defined format + description of the source-level program is maintained in LLVM metadata + in an implementation-defined format (the C/C++ front-end currently uses working draft 7 of the DWARF 3 standard).

@@ -240,31 +240,21 @@ height="369">

LLVM debugging information has been carefully designed to make it possible for the optimizer to optimize the program and debugging information without necessarily having to know anything about debugging information. In - particular, the global constant merging pass automatically eliminates - duplicated debugging information (often caused by header files), the global - dead code elimination pass automatically deletes debugging information for a - function if it decides to delete the function, and the linker eliminates - debug information when it merges linkonce functions.

+ particular, te use of metadadta avoids duplicated dubgging information from + the beginning, and the global dead code elimination pass automatically + deletes debugging information for a function if it decides to delete the + function.

To do this, most of the debugging information (descriptors for types, variables, functions, source files, etc) is inserted by the language - front-end in the form of LLVM global variables. These LLVM global variables - are no different from any other global variables, except that they have a web - of LLVM intrinsic functions that point to them. If the last references to a - particular piece of debugging information are deleted (for example, by the - -globaldce pass), the extraneous debug information will - automatically become dead and be removed by the optimizer.

+ front-end in the form of LLVM metadata.

Debug information is designed to be agnostic about the target debugger and debugging information representation (e.g. DWARF/Stabs/etc). It uses a - generic machine debug information pass to decode the information that - represents variables, types, functions, namespaces, etc: this allows for - arbitrary source-language semantics and type-systems to be used, as long as - there is a module written for the target debugger to interpret the - information. In addition, debug global variables are declared in - the "llvm.metadata" section. All values declared in this section - are stripped away after target debug information is constructed and before - the program object is emitted.

+ generic pass to decode the information that represents variables, types, + functions, namespaces, etc: this allows for arbitrary source-language + semantics and type-systems to be used, as long as there is a module + written for the target debugger to interpret the information.

To provide basic functionality, the LLVM debugger does have to make some assumptions about the source-level language being debugged, though it keeps @@ -288,9 +278,7 @@ height="369">

In consideration of the complexity and volume of debug information, LLVM - provides a specification for well formed debug global variables. The - constant value of each of these globals is one of a limited set of - structures, known as debug descriptors.

+ provides a specification for well formed debug descriptors.

Consumers of LLVM debug information expect the descriptors for program objects to start in a canonical format, but the descriptors can include @@ -303,17 +291,14 @@ height="369"> the range 0x1000 thru 0x2000 (there is a defined enum DW_TAG_user_base = 0x1000.)

-

The fields of debug descriptors used internally by LLVM (MachineModuleInfo) +

The fields of debug descriptors used internally by LLVM are restricted to only the simple data types int, uint, - bool, float, double, i8* and - { }*. References to arbitrary values are handled using a - { }* and a cast to { }* expression; typically - references to other field descriptors, arrays of descriptors or global - variables.

+ bool, float, double, mdstring and + mdnode.

-%llvm.dbg.object.type = type {
+!1 = metadata !{
   uint,   ;; A tag
   ...
 }
@@ -326,8 +311,8 @@ height="369">
    of tags are loosely bound to the tag values of DWARF information entries.
    However, that does not restrict the use of the information supplied to DWARF
    targets.  To facilitate versioning of debug information, the tag is augmented
-   with the current debug version (LLVMDebugVersion = 4 << 16 or 0x40000 or
-   262144.)

+ with the current debug version (LLVMDebugVersion = 7 << 16 or 0x70000 or + 458752.)

The details of the various descriptors follow.

@@ -342,17 +327,18 @@ height="369">
-%llvm.dbg.compile_unit.type = type {
-  i32,    ;; Tag = 17 + LLVMDebugVersion (DW_TAG_compile_unit)
-  {  }*,  ;; Compile unit anchor = cast = (%llvm.dbg.anchor.type* %llvm.dbg.compile_units to {  }*)
-  i32,    ;; DWARF language identifier (ex. DW_LANG_C89) 
-  i8*,    ;; Source file name
-  i8*,    ;; Source file directory (includes trailing slash)
-  i8*     ;; Producer (ex. "4.0.1 LLVM (LLVM research group)")
-  i1,     ;; True if this is a main compile unit. 
-  i1,     ;; True if this is optimized.
-  i8*,    ;; Flags
-  i32     ;; Runtime version
+!0 = metadata !{
+  i32,       ;; Tag = 17 + LLVMDebugVersion 
+             ;; (DW_TAG_compile_unit)
+  i32,       ;; Unused field. 
+  i32,       ;; DWARF language identifier (ex. DW_LANG_C89) 
+  metadata,  ;; Source file name
+  metadata,  ;; Source file directory (includes trailing slash)
+  metadata   ;; Producer (ex. "4.0.1 LLVM (LLVM research group)")
+  i1,        ;; True if this is a main compile unit. 
+  i1,        ;; True if this is optimized.
+  metadata,  ;; Flags
+  i32        ;; Runtime version
 }
 
@@ -388,19 +374,20 @@ height="369">
-%llvm.dbg.global_variable.type = type {
-  i32,    ;; Tag = 52 + LLVMDebugVersion (DW_TAG_variable)
-  {  }*,  ;; Global variable anchor = cast (%llvm.dbg.anchor.type* %llvm.dbg.global_variables to {  }*),  
-  {  }*,  ;; Reference to context descriptor
-  i8*,    ;; Name
-  i8*,    ;; Display name (fully qualified C++ name)
-  i8*,    ;; MIPS linkage name (for C++)
-  {  }*,  ;; Reference to compile unit where defined
-  i32,    ;; Line number where defined
-  {  }*,  ;; Reference to type descriptor
-  i1,     ;; True if the global is local to compile unit (static)
-  i1,     ;; True if the global is defined in the compile unit (not extern)
-  {  }*   ;; Reference to the global variable
+!1 = metadata !{
+  i32,      ;; Tag = 52 + LLVMDebugVersion 
+            ;; (DW_TAG_variable)
+  i32,      ;; Unused field.
+  metadata, ;; Reference to context descriptor
+  metadata, ;; Name
+  metadata, ;; Display name (fully qualified C++ name)
+  metadata, ;; MIPS linkage name (for C++)
+  metadata, ;; Reference to compile unit where defined
+  i32,      ;; Line number where defined
+  metadata, ;; Reference to type descriptor
+  i1,       ;; True if the global is local to compile unit (static)
+  i1,       ;; True if the global is defined in the compile unit (not extern)
+  {  }*     ;; Reference to the global variable
 }
 
@@ -419,18 +406,19 @@ provide details such as name, type and where the variable is defined.

-%llvm.dbg.subprogram.type = type {
-  i32,    ;; Tag = 46 + LLVMDebugVersion (DW_TAG_subprogram)
-  {  }*,  ;; Subprogram anchor = cast (%llvm.dbg.anchor.type* %llvm.dbg.subprograms to {  }*),  
-  {  }*,  ;; Reference to context descriptor
-  i8*,    ;; Name
-  i8*,    ;; Display name (fully qualified C++ name)
-  i8*,    ;; MIPS linkage name (for C++)
-  {  }*,  ;; Reference to compile unit where defined
-  i32,    ;; Line number where defined
-  {  }*,  ;; Reference to type descriptor
-  i1,     ;; True if the global is local to compile unit (static)
-  i1      ;; True if the global is defined in the compile unit (not extern)
+!2 = metadata !{
+  i32,      ;; Tag = 46 + LLVMDebugVersion
+            ;; (DW_TAG_subprogram)
+  i32,      ;; Unused field.
+  metadata, ;; Reference to context descriptor
+  metadata, ;; Name
+  metadata, ;; Display name (fully qualified C++ name)
+  metadata, ;; MIPS linkage name (for C++)
+  metadata, ;; Reference to compile unit where defined
+  i32,      ;; Line number where defined
+  metadata, ;; Reference to type descriptor
+  i1,       ;; True if the global is local to compile unit (static)
+  i1        ;; True if the global is defined in the compile unit (not extern)
 }
 
@@ -450,9 +438,9 @@ provide details such as name, type and where the variable is defined.

-%llvm.dbg.block = type {
-  i32,    ;; Tag = 13 + LLVMDebugVersion (DW_TAG_lexical_block)
-  {  }*   ;; Reference to context descriptor
+!3 = metadata !{
+  i32,     ;; Tag = 13 + LLVMDebugVersion (DW_TAG_lexical_block)
+  metadata ;; Reference to context descriptor
 }
 
@@ -472,17 +460,18 @@ provide details such as name, type and where the variable is defined.

-%llvm.dbg.basictype.type = type {
-  i32,    ;; Tag = 36 + LLVMDebugVersion (DW_TAG_base_type)
-  {  }*,  ;; Reference to context (typically a compile unit)
-  i8*,    ;; Name (may be "" for anonymous types)
-  {  }*,  ;; Reference to compile unit where defined (may be NULL)
-  i32,    ;; Line number where defined (may be 0)
-  i64,    ;; Size in bits
-  i64,    ;; Alignment in bits
-  i64,    ;; Offset in bits
-  i32,    ;; Flags
-  i32     ;; DWARF type encoding
+!4 = metadata !{
+  i32,      ;; Tag = 36 + LLVMDebugVersion 
+            ;; (DW_TAG_base_type)
+  metadata, ;; Reference to context (typically a compile unit)
+  metadata, ;; Name (may be "" for anonymous types)
+  metadata, ;; Reference to compile unit where defined (may be NULL)
+  i32,      ;; Line number where defined (may be 0)
+  i64,      ;; Size in bits
+  i64,      ;; Alignment in bits
+  i64,      ;; Offset in bits
+  i32,      ;; Flags
+  i32       ;; DWARF type encoding
 }
 
@@ -523,16 +512,16 @@ DW_ATE_unsigned_char = 8
-%llvm.dbg.derivedtype.type = type {
-  i32,    ;; Tag (see below)
-  {  }*,  ;; Reference to context
-  i8*,    ;; Name (may be "" for anonymous types)
-  {  }*,  ;; Reference to compile unit where defined (may be NULL)
-  i32,    ;; Line number where defined (may be 0)
-  i32,    ;; Size in bits
-  i32,    ;; Alignment in bits
-  i32,    ;; Offset in bits
-  {  }*   ;; Reference to type derived from
+!5 = metadata !{
+  i32,      ;; Tag (see below)
+  metadata, ;; Reference to context
+  metadata, ;; Name (may be "" for anonymous types)
+  metadata, ;; Reference to compile unit where defined (may be NULL)
+  i32,      ;; Line number where defined (may be 0)
+  i32,      ;; Size in bits
+  i32,      ;; Alignment in bits
+  i32,      ;; Offset in bits
+  metadata  ;; Reference to type derived from
 }
 
@@ -591,19 +580,19 @@ DW_TAG_restrict_type = 55
-%llvm.dbg.compositetype.type = type {
-  i32,    ;; Tag (see below)
-  {  }*,  ;; Reference to context
-  i8*,    ;; Name (may be "" for anonymous types)
-  {  }*,  ;; Reference to compile unit where defined (may be NULL)
-  i32,    ;; Line number where defined (may be 0)
-  i64,    ;; Size in bits
-  i64,    ;; Alignment in bits
-  i64,    ;; Offset in bits
-  i32,    ;; Flags
-  {  }*,  ;; Reference to type derived from
-  {  }*,  ;; Reference to array of member descriptors
-  i32     ;; Runtime languages
+!6 = metadata !{
+  i32,      ;; Tag (see below)
+  metadata, ;; Reference to context
+  metadata, ;; Name (may be "" for anonymous types)
+  metadata, ;; Reference to compile unit where defined (may be NULL)
+  i32,      ;; Line number where defined (may be 0)
+  i64,      ;; Size in bits
+  i64,      ;; Alignment in bits
+  i64,      ;; Offset in bits
+  i32,      ;; Flags
+  metadata, ;; Reference to type derived from
+  metadata, ;; Reference to array of member descriptors
+  i32       ;; Runtime languages
 }
 
@@ -702,10 +691,11 @@ DW_TAG_inheritance = 28
-%llvm.dbg.enumerator.type = type {
-  i32,    ;; Tag = 40 + LLVMDebugVersion (DW_TAG_enumerator)
-  i8*,    ;; Name
-  i64     ;; Value
+!6 = metadata !{
+  i32,      ;; Tag = 40 + LLVMDebugVersion 
+            ;; (DW_TAG_enumerator)
+  metadata, ;; Name
+  i64       ;; Value
 }
 
@@ -725,13 +715,13 @@ DW_TAG_inheritance = 28
-%llvm.dbg.variable.type = type {
-  i32,     ;; Tag (see below)
-  {  }*,   ;; Context
-  i8*,     ;; Name
-  {  }*,   ;; Reference to compile unit where defined
-  i32,     ;; Line number where defined
-  {  }*    ;; Type descriptor
+!7 = metadata !{
+  i32,      ;; Tag (see below)
+  metadata, ;; Context
+  metadata, ;; Name
+  metadata, ;; Reference to compile unit where defined
+  i32,      ;; Line number where defined
+  metadata  ;; Type descriptor
 }
 
@@ -778,14 +768,14 @@ DW_TAG_return_variable = 258
-  void %llvm.dbg.stoppoint( uint, uint, { }* )
+  void %llvm.dbg.stoppoint( uint, uint, metadata)
 

This intrinsic is used to provide correspondence between the source file and the generated code. The first argument is the line number (base 1), second argument is the column number (0 if unknown) and the third argument the - source %llvm.dbg.compile_unit* - cast to a { }*. Code following a call to this intrinsic will + source %llvm.dbg.compile_unit. + Code following a call to this intrinsic will have been defined in close proximity of the line, column and file. This information holds until the next call to %lvm.dbg.stoppoint.

@@ -799,7 +789,7 @@ DW_TAG_return_variable = 258
-  void %llvm.dbg.func.start( { }* )
+  void %llvm.dbg.func.start( metadata )
 

This intrinsic is used to link the debug information @@ -823,7 +813,7 @@ DW_TAG_return_variable = 258

-  void %llvm.dbg.region.start( { }* )
+  void %llvm.dbg.region.start( metadata )
 

This intrinsic is used to define the beginning of a declarative scope (ex. @@ -843,7 +833,7 @@ DW_TAG_return_variable = 258

-  void %llvm.dbg.region.end( { }* )
+  void %llvm.dbg.region.end( metadata )
 

This intrinsic is used to define the end of a declarative scope (ex. block) @@ -864,14 +854,14 @@ DW_TAG_return_variable = 258

-  void %llvm.dbg.declare( { } *, { }* )
+  void %llvm.dbg.declare( { } *, metadata )
 

This intrinsic provides information about a local element (ex. variable.) The first argument is the alloca for the variable, cast to a { }*. The second argument is the %llvm.dbg.variable containing - the description of the variable, also cast to a { }*.

+ the description of the variable.

@@ -955,29 +945,29 @@ entry: ... - call void @llvm.dbg.func.start( %llvm.dbg.subprogram.type* @llvm.dbg.subprogram ) + call void @llvm.dbg.func.start( metadata !0) - call void @llvm.dbg.stoppoint( uint 2, uint 2, %llvm.dbg.compile_unit* @llvm.dbg.compile_unit ) + call void @llvm.dbg.stoppoint( uint 2, uint 2, metadata !1) call void @llvm.dbg.declare({}* %X, ...) call void @llvm.dbg.declare({}* %Y, ...) ;; Evaluate expression on line 2, assigning to X. - call void @llvm.dbg.stoppoint( uint 3, uint 2, %llvm.dbg.compile_unit* @llvm.dbg.compile_unit ) + call void @llvm.dbg.stoppoint( uint 3, uint 2, metadata !1) ;; Evaluate expression on line 3, assigning to Y. call void @llvm.region.start() - call void @llvm.dbg.stoppoint( uint 5, uint 4, %llvm.dbg.compile_unit* @llvm.dbg.compile_unit ) + call void @llvm.dbg.stoppoint( uint 5, uint 4, metadata !1) call void @llvm.dbg.declare({}* %X, ...) ;; Evaluate expression on line 5, assigning to Z. - call void @llvm.dbg.stoppoint( uint 7, uint 2, %llvm.dbg.compile_unit* @llvm.dbg.compile_unit ) + call void @llvm.dbg.stoppoint( uint 7, uint 2, metadata !1) call void @llvm.region.end() - call void @llvm.dbg.stoppoint( uint 9, uint 2, %llvm.dbg.compile_unit* @llvm.dbg.compile_unit ) + call void @llvm.dbg.stoppoint( uint 9, uint 2, metadata !1) call void @llvm.region.end() @@ -1096,51 +1086,36 @@ int main(int argc, char *argv[]) {
 ...
-;;
-;; Define types used.  In this case we need one for compile unit anchors and one
-;; for compile units.
-;;
-%llvm.dbg.anchor.type = type { uint, uint }
-%llvm.dbg.compile_unit.type = type { uint, {  }*, uint, uint, i8*, i8*, i8* }
-...
-;;
-;; Define the anchor for compile units.  Note that the second field of the
-;; anchor is 17, which is the same as the tag for compile units
-;; (17 = DW_TAG_compile_unit.)
-;;
-%llvm.dbg.compile_units = linkonce constant %llvm.dbg.anchor.type { uint 0, uint 17 }, section "llvm.metadata"
-
 ;;
 ;; Define the compile unit for the source file "/Users/mine/sources/MySource.cpp".
 ;;
-%llvm.dbg.compile_unit1 = internal constant %llvm.dbg.compile_unit.type {
-    uint add(uint 17, uint 262144), 
-    {  }* cast (%llvm.dbg.anchor.type* %llvm.dbg.compile_units to {  }*), 
-    uint 1, 
-    uint 1, 
-    i8* getelementptr ([13 x i8]* %str1, i32 0, i32 0), 
-    i8* getelementptr ([21 x i8]* %str2, i32 0, i32 0), 
-    i8* getelementptr ([33 x i8]* %str3, i32 0, i32 0) }, section "llvm.metadata"
-    
+!3 = metadata !{
+  i32 458769,    ;; Tag
+  i32 0,         ;; Unused
+  i32 4,         ;; Language Id
+  metadata !"MySource.cpp", 
+  metadata !"/Users/mine/sources", 
+  metadata !"4.2.1 (Based on Apple Inc. build 5649) (LLVM build 00)", 
+  i1 true,       ;; Main Compile Unit
+  i1 false,      ;; Optimized compile unit
+  metadata !"",  ;; Compiler flags
+  i32 0}         ;; Runtime version
+
 ;;
 ;; Define the compile unit for the header file "/Users/mine/sources/MyHeader.h".
 ;;
-%llvm.dbg.compile_unit2 = internal constant %llvm.dbg.compile_unit.type {
-    uint add(uint 17, uint 262144), 
-    {  }* cast (%llvm.dbg.anchor.type* %llvm.dbg.compile_units to {  }*), 
-    uint 1, 
-    uint 1, 
-    i8* getelementptr ([11 x i8]* %str4, int 0, int 0), 
-    i8* getelementptr ([21 x i8]* %str2, int 0, int 0), 
-    i8* getelementptr ([33 x i8]* %str3, int 0, int 0) }, section "llvm.metadata"
+!1 = metadata !{
+  i32 458769,    ;; Tag
+  i32 0,         ;; Unused
+  i32 4,         ;; Language Id
+  metadata !"MyHeader.h", 
+  metadata !"/Users/mine/sources", 
+  metadata !"4.2.1 (Based on Apple Inc. build 5649) (LLVM build 00)", 
+  i1 false,      ;; Main Compile Unit
+  i1 false,      ;; Optimized compile unit
+  metadata !"",  ;; Compiler flags
+  i32 0}         ;; Runtime version
 
-;;
-;; Define each of the strings used in the compile units.
-;;
-%str1 = internal constant [13 x i8] c"MySource.cpp\00", section "llvm.metadata";
-%str2 = internal constant [21 x i8] c"/Users/mine/sources/\00", section "llvm.metadata";
-%str3 = internal constant [33 x i8] c"4.0.1 LLVM (LLVM research group)\00", section "llvm.metadata";
-%str4 = internal constant [11 x i8] c"MyHeader.h\00", section "llvm.metadata";
 ...
 
@@ -1167,65 +1142,51 @@ int MyGlobal = 100;
 ;;
-;; Define types used. One for global variable anchors, one for the global
-;; variable descriptor, one for the global's basic type and one for the global's
-;; compile unit.
-;;
-%llvm.dbg.anchor.type = type { uint, uint }
-%llvm.dbg.global_variable.type = type { uint, {  }*, {  }*, i8*, {  }*, uint, {  }*, bool, bool, {  }*, uint }
-%llvm.dbg.basictype.type = type { uint, {  }*, i8*, {  }*, int, uint, uint, uint, uint }
-%llvm.dbg.compile_unit.type = ...
-...
-;;
 ;; Define the global itself.
 ;;
 %MyGlobal = global int 100
 ...
 ;;
-;; Define the anchor for global variables.  Note that the second field of the
-;; anchor is 52, which is the same as the tag for global variables
-;; (52 = DW_TAG_variable.)
+;; List of debug info of globals
 ;;
-%llvm.dbg.global_variables = linkonce constant %llvm.dbg.anchor.type { uint 0, uint 52 }, section "llvm.metadata"
+!llvm.dbg.gv = !{!0}
 
 ;;
 ;; Define the global variable descriptor.  Note the reference to the global
 ;; variable anchor and the global variable itself.
 ;;
-%llvm.dbg.global_variable = internal constant %llvm.dbg.global_variable.type {
-    uint add(uint 52, uint 262144), 
-    {  }* cast (%llvm.dbg.anchor.type* %llvm.dbg.global_variables to {  }*), 
-    {  }* cast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to {  }*), 
-    i8* getelementptr ([9 x i8]* %str1, int 0, int 0), 
-    i8* getelementptr ([1 x i8]* %str2, int 0, int 0), 
-    {  }* cast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to {  }*), 
-    uint 1,
-    {  }* cast (%llvm.dbg.basictype.type* %llvm.dbg.basictype to {  }*), 
-    bool false, 
-    bool true, 
-    {  }* cast (int* %MyGlobal to {  }*) }, section "llvm.metadata"
-    
+!0 = metadata !{
+  i32 458804,              ;; Tag
+  i32 0,                   ;; Unused
+  metadata !1,             ;; Context
+  metadata !"MyGlobal",    ;; Name
+  metadata !"MyGlobal",    ;; Display Name
+  metadata !"MyGlobal",    ;; Linkage Name
+  metadata !1,             ;; Compile Unit
+  i32 1,                   ;; Line Number
+  metadata !2,             ;; Type
+  i1 false,                ;; Is a local variable
+  i1 true,                 ;; Is this a definition
+  i32* @MyGlobal           ;; The global variable
+}
+
 ;;
 ;; Define the basic type of 32 bit signed integer.  Note that since int is an
 ;; intrinsic type the source file is NULL and line 0.
 ;;    
-%llvm.dbg.basictype = internal constant %llvm.dbg.basictype.type {
-    uint add(uint 36, uint 262144), 
-    {  }* cast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to {  }*), 
-    i8* getelementptr ([4 x i8]* %str3, int 0, int 0), 
-    {  }* null, 
-    int 0, 
-    uint 32, 
-    uint 32, 
-    uint 0, 
-    uint 5 }, section "llvm.metadata"
+!2 = metadata !{
+  i32 458788,              ;; Tag
+  metadata !1,             ;; Context
+  metadata !"int",         ;; Name
+  metadata !1,             ;; Compile Unit
+  i32 0,                   ;; Line number
+  i64 32,                  ;; Size in Bits
+  i64 32,                  ;; Align in Bits
+  i64 0,                   ;; Offset in Bits
+  i32 0,                   ;; Flags
+  i32 5                    ;; Encoding
+}
 
-;;
-;; Define the names of the global variable and basic type.
-;;
-%str1 = internal constant [9 x i8] c"MyGlobal\00", section "llvm.metadata"
-%str2 = internal constant [1 x i8] c"\00", section "llvm.metadata"
-%str3 = internal constant [4 x i8] c"int\00", section "llvm.metadata"
 
@@ -1252,47 +1213,28 @@ int main(int argc, char *argv[]) {
-;;
-;; Define types used. One for subprogram anchors, one for the subprogram
-;; descriptor, one for the global's basic type and one for the subprogram's
-;; compile unit.
-;;
-%llvm.dbg.subprogram.type = type { uint, {  }*, {  }*, i8*, {  }*, bool, bool }
-%llvm.dbg.anchor.type = type { uint, uint }
-%llvm.dbg.compile_unit.type = ...
-	
 ;;
 ;; Define the anchor for subprograms.  Note that the second field of the
 ;; anchor is 46, which is the same as the tag for subprograms
 ;; (46 = DW_TAG_subprogram.)
 ;;
-%llvm.dbg.subprograms = linkonce constant %llvm.dbg.anchor.type { uint 0, uint 46 }, section "llvm.metadata"
-
-;;
-;; Define the descriptor for the subprogram.  TODO - more details.
-;;
-%llvm.dbg.subprogram = internal constant %llvm.dbg.subprogram.type {
-    uint add(uint 46, uint 262144), 
-    {  }* cast (%llvm.dbg.anchor.type* %llvm.dbg.subprograms to {  }*), 
-    {  }* cast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to {  }*), 
-    i8* getelementptr ([5 x i8]* %str1, int 0, int 0), 
-    i8* getelementptr ([1 x i8]* %str2, int 0, int 0), 
-    {  }* cast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to {  }*),
-    uint 1,
-    {  }* null, 
-    bool false, 
-    bool true }, section "llvm.metadata"
-
-;;
-;; Define the name of the subprogram.
-;;
-%str1 = internal constant [5 x i8] c"main\00", section "llvm.metadata"
-%str2 = internal constant [1 x i8] c"\00", section "llvm.metadata"
-
+!0 = metadata !{
+  i32 458798,        ;; Tag
+  i32 0,             ;; Unused
+  metadata !1,       ;; Context
+  metadata !"main",  ;; Name
+  metadata !"main",  ;; Display name
+  metadata !"main",  ;; Linkage name
+  metadata !1,       ;; Compile unit
+  i32 1,             ;; Line number
+  metadata !2,       ;; Type
+  i1 false,          ;; Is local 
+  i1 true            ;; Is definition
+}
 ;;
 ;; Define the subprogram itself.
 ;;
-int %main(int %argc, i8** %argv) {
+define i32 @main(i32 %argc, i8** %argv) {
 ...
 }
 
@@ -1320,17 +1262,18 @@ int %main(int %argc, i8** %argv) {
-%llvm.dbg.basictype = internal constant %llvm.dbg.basictype.type {
-    uint add(uint 36, uint 262144), 
-    {  }* cast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to {  }*), 
-    i8* getelementptr ([5 x i8]* %str1, int 0, int 0), 
-    {  }* null, 
-    int 0, 
-    uint 32, 
-    uint 32, 
-    uint 0, 
-    uint 2 }, section "llvm.metadata"
-%str1 = internal constant [5 x i8] c"bool\00", section "llvm.metadata"
+!2 = metadata !{
+  i32 458788,        ;; Tag
+  metadata !1,       ;; Context
+  metadata !"bool",  ;; Name
+  metadata !1,       ;; Compile Unit
+  i32 0,             ;; Line number
+  i64 8,             ;; Size in Bits
+  i64 8,             ;; Align in Bits
+  i64 0,             ;; Offset in Bits
+  i32 0,             ;; Flags
+  i32 2              ;; Encoding
+}
 
@@ -1345,17 +1288,18 @@ int %main(int %argc, i8** %argv) {
-%llvm.dbg.basictype = internal constant %llvm.dbg.basictype.type {
-    uint add(uint 36, uint 262144), 
-    {  }* cast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to {  }*), 
-    i8* getelementptr ([5 x i8]* %str1, int 0, int 0), 
-    {  }* null, 
-    int 0, 
-    uint 8, 
-    uint 8, 
-    uint 0, 
-    uint 6 }, section "llvm.metadata"
-%str1 = internal constant [5 x i8] c"char\00", section "llvm.metadata"
+!2 = metadata !{
+  i32 458788,        ;; Tag
+  metadata !1,       ;; Context
+  metadata !"char",  ;; Name
+  metadata !1,       ;; Compile Unit
+  i32 0,             ;; Line number
+  i64 8,             ;; Size in Bits
+  i64 8,             ;; Align in Bits
+  i64 0,             ;; Offset in Bits
+  i32 0,             ;; Flags
+  i32 6              ;; Encoding
+}
 
@@ -1370,17 +1314,18 @@ int %main(int %argc, i8** %argv) {
-%llvm.dbg.basictype = internal constant %llvm.dbg.basictype.type {
-    uint add(uint 36, uint 262144), 
-    {  }* cast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to {  }*), 
-    i8* getelementptr ([14 x i8]* %str1, int 0, int 0), 
-    {  }* null, 
-    int 0, 
-    uint 8, 
-    uint 8, 
-    uint 0, 
-    uint 8 }, section "llvm.metadata"
-%str1 = internal constant [14 x i8] c"unsigned char\00", section "llvm.metadata"
+!2 = metadata !{
+  i32 458788,        ;; Tag
+  metadata !1,       ;; Context
+  metadata !"unsigned char", 
+  metadata !1,       ;; Compile Unit
+  i32 0,             ;; Line number
+  i64 8,             ;; Size in Bits
+  i64 8,             ;; Align in Bits
+  i64 0,             ;; Offset in Bits
+  i32 0,             ;; Flags
+  i32 8              ;; Encoding
+}
 
@@ -1395,17 +1340,18 @@ int %main(int %argc, i8** %argv) {
-%llvm.dbg.basictype = internal constant %llvm.dbg.basictype.type {
-    uint add(uint 36, uint 262144), 
-    {  }* cast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to {  }*), 
-    i8* getelementptr ([10 x i8]* %str1, int 0, int 0), 
-    {  }* null, 
-    int 0, 
-    uint 16, 
-    uint 16, 
-    uint 0, 
-    uint 5 }, section "llvm.metadata"
-%str1 = internal constant [10 x i8] c"short int\00", section "llvm.metadata"
+!2 = metadata !{
+  i32 458788,        ;; Tag
+  metadata !1,       ;; Context
+  metadata !"short int",
+  metadata !1,       ;; Compile Unit
+  i32 0,             ;; Line number
+  i64 16,            ;; Size in Bits
+  i64 16,            ;; Align in Bits
+  i64 0,             ;; Offset in Bits
+  i32 0,             ;; Flags
+  i32 5              ;; Encoding
+}
 
@@ -1420,17 +1366,18 @@ int %main(int %argc, i8** %argv) {
-%llvm.dbg.basictype = internal constant %llvm.dbg.basictype.type {
-    uint add(uint 36, uint 262144), 
-    {  }* cast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to {  }*), 
-    i8* getelementptr ([19 x i8]* %str1, int 0, int 0), 
-    {  }* null, 
-    int 0, 
-    uint 16, 
-    uint 16, 
-    uint 0, 
-    uint 7 }, section "llvm.metadata"
-%str1 = internal constant [19 x i8] c"short unsigned int\00", section "llvm.metadata"
+!2 = metadata !{
+  i32 458788,        ;; Tag
+  metadata !1,       ;; Context
+  metadata !"short unsigned int",
+  metadata !1,       ;; Compile Unit
+  i32 0,             ;; Line number
+  i64 16,            ;; Size in Bits
+  i64 16,            ;; Align in Bits
+  i64 0,             ;; Offset in Bits
+  i32 0,             ;; Flags
+  i32 7              ;; Encoding
+}
 
@@ -1445,17 +1392,18 @@ int %main(int %argc, i8** %argv) {
-%llvm.dbg.basictype = internal constant %llvm.dbg.basictype.type {
-    uint add(uint 36, uint 262144), 
-    {  }* cast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to {  }*), 
-    i8* getelementptr ([4 x i8]* %str1, int 0, int 0), 
-    {  }* null, 
-    int 0, 
-    uint 32, 
-    uint 32, 
-    uint 0, 
-    uint 5 }, section "llvm.metadata"
-%str1 = internal constant [4 x i8] c"int\00", section "llvm.metadata"
+!2 = metadata !{
+  i32 458788,        ;; Tag
+  metadata !1,       ;; Context
+  metadata !"int",   ;; Name
+  metadata !1,       ;; Compile Unit
+  i32 0,             ;; Line number
+  i64 32,            ;; Size in Bits
+  i64 32,            ;; Align in Bits
+  i64 0,             ;; Offset in Bits
+  i32 0,             ;; Flags
+  i32 5              ;; Encoding
+}
 
@@ -1469,17 +1417,18 @@ int %main(int %argc, i8** %argv) {
-%llvm.dbg.basictype = internal constant %llvm.dbg.basictype.type {
-    uint add(uint 36, uint 262144), 
-    {  }* cast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to {  }*), 
-    i8* getelementptr ([13 x i8]* %str1, int 0, int 0), 
-    {  }* null, 
-    int 0, 
-    uint 32, 
-    uint 32, 
-    uint 0, 
-    uint 7 }, section "llvm.metadata"
-%str1 = internal constant [13 x i8] c"unsigned int\00", section "llvm.metadata"
+!2 = metadata !{
+  i32 458788,        ;; Tag
+  metadata !1,       ;; Context
+  metadata !"unsigned int",
+  metadata !1,       ;; Compile Unit
+  i32 0,             ;; Line number
+  i64 32,            ;; Size in Bits
+  i64 32,            ;; Align in Bits
+  i64 0,             ;; Offset in Bits
+  i32 0,             ;; Flags
+  i32 7              ;; Encoding
+}
 
@@ -1494,17 +1443,18 @@ int %main(int %argc, i8** %argv) {
-%llvm.dbg.basictype = internal constant %llvm.dbg.basictype.type {
-    uint add(uint 36, uint 262144), 
-    {  }* cast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to {  }*), 
-    i8* getelementptr ([14 x i8]* %str1, int 0, int 0), 
-    {  }* null, 
-    int 0, 
-    uint 64, 
-    uint 64, 
-    uint 0, 
-    uint 5 }, section "llvm.metadata"
-%str1 = internal constant [14 x i8] c"long long int\00", section "llvm.metadata"
+!2 = metadata !{
+  i32 458788,        ;; Tag
+  metadata !1,       ;; Context
+  metadata !"long long int",
+  metadata !1,       ;; Compile Unit
+  i32 0,             ;; Line number
+  i64 64,            ;; Size in Bits
+  i64 64,            ;; Align in Bits
+  i64 0,             ;; Offset in Bits
+  i32 0,             ;; Flags
+  i32 5              ;; Encoding
+}
 
@@ -1519,17 +1469,18 @@ int %main(int %argc, i8** %argv) {
-%llvm.dbg.basictype = internal constant %llvm.dbg.basictype.type {
-    uint add(uint 36, uint 262144), 
-    {  }* cast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to {  }*), 
-    i8* getelementptr ([23 x i8]* %str1, int 0, int 0), 
-    {  }* null, 
-    int 0, 
-    uint 64, 
-    uint 64, 
-    uint 0, 
-    uint 7 }, section "llvm.metadata"
-%str1 = internal constant [23 x 8] c"long long unsigned int\00", section "llvm.metadata"
+!2 = metadata !{
+  i32 458788,        ;; Tag
+  metadata !1,       ;; Context
+  metadata !"long long unsigned int",
+  metadata !1,       ;; Compile Unit
+  i32 0,             ;; Line number
+  i64 64,            ;; Size in Bits
+  i64 64,            ;; Align in Bits
+  i64 0,             ;; Offset in Bits
+  i32 0,             ;; Flags
+  i32 7              ;; Encoding
+}
 
@@ -1544,17 +1495,18 @@ int %main(int %argc, i8** %argv) {
-%llvm.dbg.basictype = internal constant %llvm.dbg.basictype.type {
-    uint add(uint 36, uint 262144), 
-    {  }* cast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to {  }*), 
-    i8* getelementptr ([6 x i8]* %str1, int 0, int 0), 
-    {  }* null, 
-    int 0, 
-    uint 32, 
-    uint 32, 
-    uint 0, 
-    uint 4 }, section "llvm.metadata"
-%str1 = internal constant [6 x i8] c"float\00", section "llvm.metadata"
+!2 = metadata !{
+  i32 458788,        ;; Tag
+  metadata !1,       ;; Context
+  metadata !"float",
+  metadata !1,       ;; Compile Unit
+  i32 0,             ;; Line number
+  i64 32,            ;; Size in Bits
+  i64 32,            ;; Align in Bits
+  i64 0,             ;; Offset in Bits
+  i32 0,             ;; Flags
+  i32 4              ;; Encoding
+}
 
@@ -1569,17 +1521,18 @@ int %main(int %argc, i8** %argv) {
-%llvm.dbg.basictype = internal constant %llvm.dbg.basictype.type {
-    uint add(uint 36, uint 262144), 
-    {  }* cast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to {  }*), 
-    8* getelementptr ([7 x 8]* %str1, int 0, int 0), 
-    {  }* null, 
-    int 0, 
-    uint 64, 
-    uint 64, 
-    uint 0, 
-    uint 4 }, section "llvm.metadata"
-%str1 = internal constant [7 x 8] c"double\00", section "llvm.metadata"
+!2 = metadata !{
+  i32 458788,        ;; Tag
+  metadata !1,       ;; Context
+  metadata !"double",;; Name
+  metadata !1,       ;; Compile Unit
+  i32 0,             ;; Line number
+  i64 64,            ;; Size in Bits
+  i64 64,            ;; Align in Bits
+  i64 0,             ;; Offset in Bits
+  i32 0,             ;; Flags
+  i32 4              ;; Encoding
+}
 
@@ -1607,60 +1560,64 @@ typedef const int *IntPtr; ;; ;; Define the typedef "IntPtr". ;; -%llvm.dbg.derivedtype1 = internal constant %llvm.dbg.derivedtype.type { - uint add(uint 22, uint 262144), - { }* cast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to { }*), - i8* getelementptr ([7 x 8]* %str1, int 0, int 0), - { }* cast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to { }*), - int 1, - uint 0, - uint 0, - uint 0, - { }* cast (%llvm.dbg.derivedtype.type* %llvm.dbg.derivedtype2 to { }*) }, section "llvm.metadata" -%str1 = internal constant [7 x 8] c"IntPtr\00", section "llvm.metadata" +!2 = metadata !{ + i32 458774, ;; Tag + metadata !1, ;; Context + metadata !"IntPtr", ;; Name + metadata !3, ;; Compile unit + i32 0, ;; Line number + i64 0, ;; Size in bits + i64 0, ;; Align in bits + i64 0, ;; Offset in bits + i32 0, ;; Flags + metadata !4 ;; Derived From type +} ;; ;; Define the pointer type. ;; -%llvm.dbg.derivedtype2 = internal constant %llvm.dbg.derivedtype.type { - uint add(uint 15, uint 262144), - { }* cast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to { }*), - i8* null, - { }* null, - int 0, - uint 32, - uint 32, - uint 0, - { }* cast (%llvm.dbg.derivedtype.type* %llvm.dbg.derivedtype3 to { }*) }, section "llvm.metadata" - +!4 = metadata !{ + i32 458767, ;; Tag + metadata !1, ;; Context + metadata !"", ;; Name + metadata !1, ;; Compile unit + i32 0, ;; Line number + i64 64, ;; Size in bits + i64 64, ;; Align in bits + i64 0, ;; Offset in bits + i32 0, ;; Flags + metadata !5 ;; Derived From type +} ;; ;; Define the const type. ;; -%llvm.dbg.derivedtype3 = internal constant %llvm.dbg.derivedtype.type { - uint add(uint 38, uint 262144), - { }* cast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to { }*), - i8* null, - { }* null, - int 0, - uint 0, - uint 0, - uint 0, - { }* cast (%llvm.dbg.basictype.type* %llvm.dbg.basictype1 to { }*) }, section "llvm.metadata" - +!5 = metadata !{ + i32 458790, ;; Tag + metadata !1, ;; Context + metadata !"", ;; Name + metadata !1, ;; Compile unit + i32 0, ;; Line number + i64 32, ;; Size in bits + i64 32, ;; Align in bits + i64 0, ;; Offset in bits + i32 0, ;; Flags + metadata !6 ;; Derived From type +} ;; ;; Define the int type. ;; -%llvm.dbg.basictype1 = internal constant %llvm.dbg.basictype.type { - uint add(uint 36, uint 262144), - { }* cast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to { }*), - 8* getelementptr ([4 x 8]* %str2, int 0, int 0), - { }* null, - int 0, - uint 32, - uint 32, - uint 0, - uint 5 }, section "llvm.metadata" -%str2 = internal constant [4 x 8] c"int\00", section "llvm.metadata" +!6 = metadata !{ + i32 458788, ;; Tag + metadata !1, ;; Context + metadata !"int", ;; Name + metadata !1, ;; Compile unit + i32 0, ;; Line number + i64 32, ;; Size in bits + i64 32, ;; Align in bits + i64 0, ;; Offset in bits + i32 0, ;; Flags + 5 ;; Encoding +}
@@ -1692,86 +1649,88 @@ struct Color { ;; ;; Define basic type for unsigned int. ;; -%llvm.dbg.basictype = internal constant %llvm.dbg.basictype.type { - uint add(uint 36, uint 262144), - { }* cast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to { }*), - i8* getelementptr ([13 x i8]* %str1, int 0, int 0), - { }* null, - int 0, - uint 32, - uint 32, - uint 0, - uint 7 }, section "llvm.metadata" -%str1 = internal constant [13 x i8] c"unsigned int\00", section "llvm.metadata" - +!5 = metadata !{ + i32 458788, ;; Tag + metadata !1, ;; Context + metadata !"unsigned int", + metadata !1, ;; Compile Unit + i32 0, ;; Line number + i64 32, ;; Size in Bits + i64 32, ;; Align in Bits + i64 0, ;; Offset in Bits + i32 0, ;; Flags + i32 7 ;; Encoding +} ;; ;; Define composite type for struct Color. ;; -%llvm.dbg.compositetype = internal constant %llvm.dbg.compositetype.type { - uint add(uint 19, uint 262144), - { }* cast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to { }*), - i8* getelementptr ([6 x i8]* %str2, int 0, int 0), - { }* cast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to { }*), - int 1, - uint 96, - uint 32, - uint 0, - { }* null, - { }* cast ([3 x { }*]* %llvm.dbg.array to { }*) }, section "llvm.metadata" -%str2 = internal constant [6 x i8] c"Color\00", section "llvm.metadata" +!2 = metadata !{ + i32 458771, ;; Tag + metadata !1, ;; Context + metadata !"Color", ;; Name + metadata !1, ;; Compile unit + i32 1, ;; Line number + i64 96, ;; Size in bits + i64 32, ;; Align in bits + i64 0, ;; Offset in bits + i32 0, ;; Flags + null, ;; Derived From + metadata !3, ;; Elements + i32 0 ;; Runtime Language +} ;; ;; Define the Red field. ;; -%llvm.dbg.derivedtype1 = internal constant %llvm.dbg.derivedtype.type { - uint add(uint 13, uint 262144), - { }* null, - i8* getelementptr ([4 x i8]* %str3, int 0, int 0), - { }* cast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to { }*), - int 2, - uint 32, - uint 32, - uint 0, - { }* cast (%llvm.dbg.basictype.type* %llvm.dbg.basictype to { }*) }, section "llvm.metadata" -%str3 = internal constant [4 x i8] c"Red\00", section "llvm.metadata" +!4 = metadata !{ + i32 458765, ;; Tag + metadata !1, ;; Context + metadata !"Red", ;; Name + metadata !1, ;; Compile Unit + i32 2, ;; Line number + i64 32, ;; Size in bits + i64 32, ;; Align in bits + i64 0, ;; Offset in bits + i32 0, ;; Flags + metadata !5 ;; Derived From type +} ;; ;; Define the Green field. ;; -%llvm.dbg.derivedtype2 = internal constant %llvm.dbg.derivedtype.type { - uint add(uint 13, uint 262144), - { }* null, - i8* getelementptr ([6 x i8]* %str4, int 0, int 0), - { }* cast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to { }*), - int 3, - uint 32, - uint 32, - uint 32, - { }* cast (%llvm.dbg.basictype.type* %llvm.dbg.basictype to { }*) }, section "llvm.metadata" -%str4 = internal constant [6 x i8] c"Green\00", section "llvm.metadata" +!6 = metadata !{ + i32 458765, ;; Tag + metadata !1, ;; Context + metadata !"Green", ;; Name + metadata !1, ;; Compile Unit + i32 3, ;; Line number + i64 32, ;; Size in bits + i64 32, ;; Align in bits + i64 32, ;; Offset in bits + i32 0, ;; Flags + metadata !5 ;; Derived From type +} ;; ;; Define the Blue field. ;; -%llvm.dbg.derivedtype3 = internal constant %llvm.dbg.derivedtype.type { - uint add(uint 13, uint 262144), - { }* null, - i8* getelementptr ([5 x i8]* %str5, int 0, int 0), - { }* cast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to { }*), - int 4, - uint 32, - uint 32, - uint 64, - { }* cast (%llvm.dbg.basictype.type* %llvm.dbg.basictype to { }*) }, section "llvm.metadata" -%str5 = internal constant [5 x 8] c"Blue\00", section "llvm.metadata" +!7 = metadata !{ + i32 458765, ;; Tag + metadata !1, ;; Context + metadata !"Blue", ;; Name + metadata !1, ;; Compile Unit + i32 4, ;; Line number + i64 32, ;; Size in bits + i64 32, ;; Align in bits + i64 64, ;; Offset in bits + i32 0, ;; Flags + metadata !5 ;; Derived From type +} ;; ;; Define the array of fields used by the composite type Color. ;; -%llvm.dbg.array = internal constant [3 x { }*] [ - { }* cast (%llvm.dbg.derivedtype.type* %llvm.dbg.derivedtype1 to { }*), - { }* cast (%llvm.dbg.derivedtype.type* %llvm.dbg.derivedtype2 to { }*), - { }* cast (%llvm.dbg.derivedtype.type* %llvm.dbg.derivedtype3 to { }*) ], section "llvm.metadata" +!3 = metadata !{metadata !4, metadata !6, metadata !7}
@@ -1803,53 +1762,41 @@ enum Trees { ;; ;; Define composite type for enum Trees ;; -%llvm.dbg.compositetype = internal constant %llvm.dbg.compositetype.type { - uint add(uint 4, uint 262144), - { }* cast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to { }*), - i8* getelementptr ([6 x i8]* %str1, int 0, int 0), - { }* cast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to { }*), - int 1, - uint 32, - uint 32, - uint 0, - { }* null, - { }* cast ([3 x { }*]* %llvm.dbg.array to { }*) }, section "llvm.metadata" -%str1 = internal constant [6 x i8] c"Trees\00", section "llvm.metadata" - -;; -;; Define Spruce enumerator. -;; -%llvm.dbg.enumerator1 = internal constant %llvm.dbg.enumerator.type { - uint add(uint 40, uint 262144), - i8* getelementptr ([7 x i8]* %str2, int 0, int 0), - int 100 }, section "llvm.metadata" -%str2 = internal constant [7 x i8] c"Spruce\00", section "llvm.metadata" - -;; -;; Define Oak enumerator. -;; -%llvm.dbg.enumerator2 = internal constant %llvm.dbg.enumerator.type { - uint add(uint 40, uint 262144), - i8* getelementptr ([4 x i8]* %str3, int 0, int 0), - int 200 }, section "llvm.metadata" -%str3 = internal constant [4 x i8] c"Oak\00", section "llvm.metadata" - -;; -;; Define Maple enumerator. -;; -%llvm.dbg.enumerator3 = internal constant %llvm.dbg.enumerator.type { - uint add(uint 40, uint 262144), - i8* getelementptr ([6 x i8]* %str4, int 0, int 0), - int 300 }, section "llvm.metadata" -%str4 = internal constant [6 x i8] c"Maple\00", section "llvm.metadata" +!2 = metadata !{ + i32 458756, ;; Tag + metadata !1, ;; Context + metadata !"Trees", ;; Name + metadata !1, ;; Compile unit + i32 1, ;; Line number + i64 32, ;; Size in bits + i64 32, ;; Align in bits + i64 0, ;; Offset in bits + i32 0, ;; Flags + null, ;; Derived From type + metadata !3, ;; Elements + i32 0 ;; Runtime language +} ;; ;; Define the array of enumerators used by composite type Trees. ;; -%llvm.dbg.array = internal constant [3 x { }*] [ - { }* cast (%llvm.dbg.enumerator.type* %llvm.dbg.enumerator1 to { }*), - { }* cast (%llvm.dbg.enumerator.type* %llvm.dbg.enumerator2 to { }*), - { }* cast (%llvm.dbg.enumerator.type* %llvm.dbg.enumerator3 to { }*) ], section "llvm.metadata" +!3 = metadata !{metadata !4, metadata !5, metadata !6} + +;; +;; Define Spruce enumerator. +;; +!4 = metadata !{i32 458792, metadata !"Spruce", i64 100} + +;; +;; Define Oak enumerator. +;; +!5 = metadata !{i32 458792, metadata !"Oak", i64 200} + +;; +;; Define Maple enumerator. +;; +!6 = metadata !{i32 458792, metadata !"Maple", i64 300} +
diff --git a/libclamav/c++/llvm/docs/re_format.7 b/libclamav/c++/llvm/docs/re_format.7 new file mode 100644 index 000000000..0c0928716 --- /dev/null +++ b/libclamav/c++/llvm/docs/re_format.7 @@ -0,0 +1,756 @@ +.\" $OpenBSD: re_format.7,v 1.14 2007/05/31 19:19:30 jmc Exp $ +.\" +.\" Copyright (c) 1997, Phillip F Knaack. All rights reserved. +.\" +.\" Copyright (c) 1992, 1993, 1994 Henry Spencer. +.\" Copyright (c) 1992, 1993, 1994 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" This code is derived from software contributed to Berkeley by +.\" Henry Spencer. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" @(#)re_format.7 8.3 (Berkeley) 3/20/94 +.\" +.Dd $Mdocdate: May 31 2007 $ +.Dt RE_FORMAT 7 +.Os +.Sh NAME +.Nm re_format +.Nd POSIX regular expressions +.Sh DESCRIPTION +Regular expressions (REs), +as defined in +.St -p1003.1-2004 , +come in two forms: +basic regular expressions +(BREs) +and extended regular expressions +(EREs). +Both forms of regular expressions are supported +by the interfaces described in +.Xr regex 3 . +Applications dealing with regular expressions +may use one or the other form +(or indeed both). +For example, +.Xr ed 1 +uses BREs, +whilst +.Xr egrep 1 +talks EREs. +Consult the manual page for the specific application to find out which +it uses. +.Pp +POSIX leaves some aspects of RE syntax and semantics open; +.Sq ** +marks decisions on these aspects that +may not be fully portable to other POSIX implementations. +.Pp +This manual page first describes regular expressions in general, +specifically extended regular expressions, +and then discusses differences between them and basic regular expressions. +.Sh EXTENDED REGULAR EXPRESSIONS +An ERE is one** or more non-empty** +.Em branches , +separated by +.Sq \*(Ba . +It matches anything that matches one of the branches. +.Pp +A branch is one** or more +.Em pieces , +concatenated. +It matches a match for the first, followed by a match for the second, etc. +.Pp +A piece is an +.Em atom +possibly followed by a single** +.Sq * , +.Sq + , +.Sq ?\& , +or +.Em bound . +An atom followed by +.Sq * +matches a sequence of 0 or more matches of the atom. +An atom followed by +.Sq + +matches a sequence of 1 or more matches of the atom. +An atom followed by +.Sq ?\& +matches a sequence of 0 or 1 matches of the atom. +.Pp +A bound is +.Sq { +followed by an unsigned decimal integer, +possibly followed by +.Sq ,\& +possibly followed by another unsigned decimal integer, +always followed by +.Sq } . +The integers must lie between 0 and +.Dv RE_DUP_MAX +(255**) inclusive, +and if there are two of them, the first may not exceed the second. +An atom followed by a bound containing one integer +.Ar i +and no comma matches +a sequence of exactly +.Ar i +matches of the atom. +An atom followed by a bound +containing one integer +.Ar i +and a comma matches +a sequence of +.Ar i +or more matches of the atom. +An atom followed by a bound +containing two integers +.Ar i +and +.Ar j +matches a sequence of +.Ar i +through +.Ar j +(inclusive) matches of the atom. +.Pp +An atom is a regular expression enclosed in +.Sq () +(matching a part of the regular expression), +an empty set of +.Sq () +(matching the null string)**, +a +.Em bracket expression +(see below), +.Sq .\& +(matching any single character), +.Sq ^ +(matching the null string at the beginning of a line), +.Sq $ +(matching the null string at the end of a line), +a +.Sq \e +followed by one of the characters +.Sq ^.[$()|*+?{\e +(matching that character taken as an ordinary character), +a +.Sq \e +followed by any other character** +(matching that character taken as an ordinary character, +as if the +.Sq \e +had not been present**), +or a single character with no other significance (matching that character). +A +.Sq { +followed by a character other than a digit is an ordinary character, +not the beginning of a bound**. +It is illegal to end an RE with +.Sq \e . +.Pp +A bracket expression is a list of characters enclosed in +.Sq [] . +It normally matches any single character from the list (but see below). +If the list begins with +.Sq ^ , +it matches any single character +.Em not +from the rest of the list +(but see below). +If two characters in the list are separated by +.Sq - , +this is shorthand for the full +.Em range +of characters between those two (inclusive) in the +collating sequence, e.g.\& +.Sq [0-9] +in ASCII matches any decimal digit. +It is illegal** for two ranges to share an endpoint, e.g.\& +.Sq a-c-e . +Ranges are very collating-sequence-dependent, +and portable programs should avoid relying on them. +.Pp +To include a literal +.Sq ]\& +in the list, make it the first character +(following a possible +.Sq ^ ) . +To include a literal +.Sq - , +make it the first or last character, +or the second endpoint of a range. +To use a literal +.Sq - +as the first endpoint of a range, +enclose it in +.Sq [. +and +.Sq .] +to make it a collating element (see below). +With the exception of these and some combinations using +.Sq [ +(see next paragraphs), +all other special characters, including +.Sq \e , +lose their special significance within a bracket expression. +.Pp +Within a bracket expression, a collating element +(a character, +a multi-character sequence that collates as if it were a single character, +or a collating-sequence name for either) +enclosed in +.Sq [. +and +.Sq .] +stands for the sequence of characters of that collating element. +The sequence is a single element of the bracket expression's list. +A bracket expression containing a multi-character collating element +can thus match more than one character, +e.g. if the collating sequence includes a +.Sq ch +collating element, +then the RE +.Sq [[.ch.]]*c +matches the first five characters of +.Sq chchcc . +.Pp +Within a bracket expression, a collating element enclosed in +.Sq [= +and +.Sq =] +is an equivalence class, standing for the sequences of characters +of all collating elements equivalent to that one, including itself. +(If there are no other equivalent collating elements, +the treatment is as if the enclosing delimiters were +.Sq [. +and +.Sq .] . ) +For example, if +.Sq x +and +.Sq y +are the members of an equivalence class, +then +.Sq [[=x=]] , +.Sq [[=y=]] , +and +.Sq [xy] +are all synonymous. +An equivalence class may not** be an endpoint of a range. +.Pp +Within a bracket expression, the name of a +.Em character class +enclosed +in +.Sq [: +and +.Sq :] +stands for the list of all characters belonging to that class. +Standard character class names are: +.Bd -literal -offset indent +alnum digit punct +alpha graph space +blank lower upper +cntrl print xdigit +.Ed +.Pp +These stand for the character classes defined in +.Xr ctype 3 . +A locale may provide others. +A character class may not be used as an endpoint of a range. +.Pp +There are two special cases** of bracket expressions: +the bracket expressions +.Sq [[:<:]] +and +.Sq [[:>:]] +match the null string at the beginning and end of a word, respectively. +A word is defined as a sequence of +characters starting and ending with a word character +which is neither preceded nor followed by +word characters. +A word character is an +.Em alnum +character (as defined by +.Xr ctype 3 ) +or an underscore. +This is an extension, +compatible with but not specified by POSIX, +and should be used with +caution in software intended to be portable to other systems. +.Pp +In the event that an RE could match more than one substring of a given +string, +the RE matches the one starting earliest in the string. +If the RE could match more than one substring starting at that point, +it matches the longest. +Subexpressions also match the longest possible substrings, subject to +the constraint that the whole match be as long as possible, +with subexpressions starting earlier in the RE taking priority over +ones starting later. +Note that higher-level subexpressions thus take priority over +their lower-level component subexpressions. +.Pp +Match lengths are measured in characters, not collating elements. +A null string is considered longer than no match at all. +For example, +.Sq bb* +matches the three middle characters of +.Sq abbbc ; +.Sq (wee|week)(knights|nights) +matches all ten characters of +.Sq weeknights ; +when +.Sq (.*).* +is matched against +.Sq abc , +the parenthesized subexpression matches all three characters; +and when +.Sq (a*)* +is matched against +.Sq bc , +both the whole RE and the parenthesized subexpression match the null string. +.Pp +If case-independent matching is specified, +the effect is much as if all case distinctions had vanished from the +alphabet. +When an alphabetic that exists in multiple cases appears as an +ordinary character outside a bracket expression, it is effectively +transformed into a bracket expression containing both cases, +e.g.\& +.Sq x +becomes +.Sq [xX] . +When it appears inside a bracket expression, +all case counterparts of it are added to the bracket expression, +so that, for example, +.Sq [x] +becomes +.Sq [xX] +and +.Sq [^x] +becomes +.Sq [^xX] . +.Pp +No particular limit is imposed on the length of REs**. +Programs intended to be portable should not employ REs longer +than 256 bytes, +as an implementation can refuse to accept such REs and remain +POSIX-compliant. +.Pp +The following is a list of extended regular expressions: +.Bl -tag -width Ds +.It Ar c +Any character +.Ar c +not listed below matches itself. +.It \e Ns Ar c +Any backslash-escaped character +.Ar c +matches itself. +.It \&. +Matches any single character that is not a newline +.Pq Sq \en . +.It Bq Ar char-class +Matches any single character in +.Ar char-class . +To include a +.Ql \&] +in +.Ar char-class , +it must be the first character. +A range of characters may be specified by separating the end characters +of the range with a +.Ql - ; +e.g.\& +.Ar a-z +specifies the lower case characters. +The following literal expressions can also be used in +.Ar char-class +to specify sets of characters: +.Bd -unfilled -offset indent +[:alnum:] [:cntrl:] [:lower:] [:space:] +[:alpha:] [:digit:] [:print:] [:upper:] +[:blank:] [:graph:] [:punct:] [:xdigit:] +.Ed +.Pp +If +.Ql - +appears as the first or last character of +.Ar char-class , +then it matches itself. +All other characters in +.Ar char-class +match themselves. +.Pp +Patterns in +.Ar char-class +of the form +.Eo [. +.Ar col-elm +.Ec .]\& +or +.Eo [= +.Ar col-elm +.Ec =]\& , +where +.Ar col-elm +is a collating element, are interpreted according to +.Xr setlocale 3 +.Pq not currently supported . +.It Bq ^ Ns Ar char-class +Matches any single character, other than newline, not in +.Ar char-class . +.Ar char-class +is defined as above. +.It ^ +If +.Sq ^ +is the first character of a regular expression, then it +anchors the regular expression to the beginning of a line. +Otherwise, it matches itself. +.It $ +If +.Sq $ +is the last character of a regular expression, +it anchors the regular expression to the end of a line. +Otherwise, it matches itself. +.It [[:<:]] +Anchors the single character regular expression or subexpression +immediately following it to the beginning of a word. +.It [[:>:]] +Anchors the single character regular expression or subexpression +immediately following it to the end of a word. +.It Pq Ar re +Defines a subexpression +.Ar re . +Any set of characters enclosed in parentheses +matches whatever the set of characters without parentheses matches +(that is a long-winded way of saying the constructs +.Sq (re) +and +.Sq re +match identically). +.It * +Matches the single character regular expression or subexpression +immediately preceding it zero or more times. +If +.Sq * +is the first character of a regular expression or subexpression, +then it matches itself. +The +.Sq * +operator sometimes yields unexpected results. +For example, the regular expression +.Ar b* +matches the beginning of the string +.Qq abbb +(as opposed to the substring +.Qq bbb ) , +since a null match is the only leftmost match. +.It + +Matches the singular character regular expression +or subexpression immediately preceding it +one or more times. +.It ? +Matches the singular character regular expression +or subexpression immediately preceding it +0 or 1 times. +.Sm off +.It Xo +.Pf { Ar n , m No }\ \& +.Pf { Ar n , No }\ \& +.Pf { Ar n No } +.Xc +.Sm on +Matches the single character regular expression or subexpression +immediately preceding it at least +.Ar n +and at most +.Ar m +times. +If +.Ar m +is omitted, then it matches at least +.Ar n +times. +If the comma is also omitted, then it matches exactly +.Ar n +times. +.It \*(Ba +Used to separate patterns. +For example, +the pattern +.Sq cat\*(Badog +matches either +.Sq cat +or +.Sq dog . +.El +.Sh BASIC REGULAR EXPRESSIONS +Basic regular expressions differ in several respects: +.Bl -bullet -offset 3n +.It +.Sq \*(Ba , +.Sq + , +and +.Sq ?\& +are ordinary characters and there is no equivalent +for their functionality. +.It +The delimiters for bounds are +.Sq \e{ +and +.Sq \e} , +with +.Sq { +and +.Sq } +by themselves ordinary characters. +.It +The parentheses for nested subexpressions are +.Sq \e( +and +.Sq \e) , +with +.Sq ( +and +.Sq )\& +by themselves ordinary characters. +.It +.Sq ^ +is an ordinary character except at the beginning of the +RE or** the beginning of a parenthesized subexpression. +.It +.Sq $ +is an ordinary character except at the end of the +RE or** the end of a parenthesized subexpression. +.It +.Sq * +is an ordinary character if it appears at the beginning of the +RE or the beginning of a parenthesized subexpression +(after a possible leading +.Sq ^ ) . +.It +Finally, there is one new type of atom, a +.Em back-reference : +.Sq \e +followed by a non-zero decimal digit +.Ar d +matches the same sequence of characters matched by the +.Ar d Ns th +parenthesized subexpression +(numbering subexpressions by the positions of their opening parentheses, +left to right), +so that, for example, +.Sq \e([bc]\e)\e1 +matches +.Sq bb\& +or +.Sq cc +but not +.Sq bc . +.El +.Pp +The following is a list of basic regular expressions: +.Bl -tag -width Ds +.It Ar c +Any character +.Ar c +not listed below matches itself. +.It \e Ns Ar c +Any backslash-escaped character +.Ar c , +except for +.Sq { , +.Sq } , +.Sq \&( , +and +.Sq \&) , +matches itself. +.It \&. +Matches any single character that is not a newline +.Pq Sq \en . +.It Bq Ar char-class +Matches any single character in +.Ar char-class . +To include a +.Ql \&] +in +.Ar char-class , +it must be the first character. +A range of characters may be specified by separating the end characters +of the range with a +.Ql - ; +e.g.\& +.Ar a-z +specifies the lower case characters. +The following literal expressions can also be used in +.Ar char-class +to specify sets of characters: +.Bd -unfilled -offset indent +[:alnum:] [:cntrl:] [:lower:] [:space:] +[:alpha:] [:digit:] [:print:] [:upper:] +[:blank:] [:graph:] [:punct:] [:xdigit:] +.Ed +.Pp +If +.Ql - +appears as the first or last character of +.Ar char-class , +then it matches itself. +All other characters in +.Ar char-class +match themselves. +.Pp +Patterns in +.Ar char-class +of the form +.Eo [. +.Ar col-elm +.Ec .]\& +or +.Eo [= +.Ar col-elm +.Ec =]\& , +where +.Ar col-elm +is a collating element, are interpreted according to +.Xr setlocale 3 +.Pq not currently supported . +.It Bq ^ Ns Ar char-class +Matches any single character, other than newline, not in +.Ar char-class . +.Ar char-class +is defined as above. +.It ^ +If +.Sq ^ +is the first character of a regular expression, then it +anchors the regular expression to the beginning of a line. +Otherwise, it matches itself. +.It $ +If +.Sq $ +is the last character of a regular expression, +it anchors the regular expression to the end of a line. +Otherwise, it matches itself. +.It [[:<:]] +Anchors the single character regular expression or subexpression +immediately following it to the beginning of a word. +.It [[:>:]] +Anchors the single character regular expression or subexpression +immediately following it to the end of a word. +.It \e( Ns Ar re Ns \e) +Defines a subexpression +.Ar re . +Subexpressions may be nested. +A subsequent backreference of the form +.Pf \e Ns Ar n , +where +.Ar n +is a number in the range [1,9], expands to the text matched by the +.Ar n Ns th +subexpression. +For example, the regular expression +.Ar \e(.*\e)\e1 +matches any string consisting of identical adjacent substrings. +Subexpressions are ordered relative to their left delimiter. +.It * +Matches the single character regular expression or subexpression +immediately preceding it zero or more times. +If +.Sq * +is the first character of a regular expression or subexpression, +then it matches itself. +The +.Sq * +operator sometimes yields unexpected results. +For example, the regular expression +.Ar b* +matches the beginning of the string +.Qq abbb +(as opposed to the substring +.Qq bbb ) , +since a null match is the only leftmost match. +.Sm off +.It Xo +.Pf \e{ Ar n , m No \e}\ \& +.Pf \e{ Ar n , No \e}\ \& +.Pf \e{ Ar n No \e} +.Xc +.Sm on +Matches the single character regular expression or subexpression +immediately preceding it at least +.Ar n +and at most +.Ar m +times. +If +.Ar m +is omitted, then it matches at least +.Ar n +times. +If the comma is also omitted, then it matches exactly +.Ar n +times. +.El +.Sh SEE ALSO +.Xr ctype 3 , +.Xr regex 3 +.Sh STANDARDS +.St -p1003.1-2004 : +Base Definitions, Chapter 9 (Regular Expressions). +.Sh BUGS +Having two kinds of REs is a botch. +.Pp +The current POSIX spec says that +.Sq )\& +is an ordinary character in the absence of an unmatched +.Sq ( ; +this was an unintentional result of a wording error, +and change is likely. +Avoid relying on it. +.Pp +Back-references are a dreadful botch, +posing major problems for efficient implementations. +They are also somewhat vaguely defined +(does +.Sq a\e(\e(b\e)*\e2\e)*d +match +.Sq abbbd ? ) . +Avoid using them. +.Pp +POSIX's specification of case-independent matching is vague. +The +.Dq one case implies all cases +definition given above +is the current consensus among implementors as to the right interpretation. +.Pp +The syntax for word boundaries is incredibly ugly. diff --git a/libclamav/c++/llvm/docs/tutorial/LangImpl4.html b/libclamav/c++/llvm/docs/tutorial/LangImpl4.html index 2f1dd4af1..0163b25a2 100644 --- a/libclamav/c++/llvm/docs/tutorial/LangImpl4.html +++ b/libclamav/c++/llvm/docs/tutorial/LangImpl4.html @@ -171,26 +171,28 @@ add a set of optimizations to run. The code looks like this:

-    ExistingModuleProvider OurModuleProvider(TheModule);
-    FunctionPassManager OurFPM(&OurModuleProvider);
-      
-    // Set up the optimizer pipeline.  Start with registering info about how the
-    // target lays out data structures.
-    OurFPM.add(new TargetData(*TheExecutionEngine->getTargetData()));
-    // Do simple "peephole" optimizations and bit-twiddling optzns.
-    OurFPM.add(createInstructionCombiningPass());
-    // Reassociate expressions.
-    OurFPM.add(createReassociatePass());
-    // Eliminate Common SubExpressions.
-    OurFPM.add(createGVNPass());
-    // Simplify the control flow graph (deleting unreachable blocks, etc).
-    OurFPM.add(createCFGSimplificationPass());
+  ExistingModuleProvider *OurModuleProvider =
+      new ExistingModuleProvider(TheModule);
 
-    // Set the global so the code gen can use this.
-    TheFPM = &OurFPM;
+  FunctionPassManager OurFPM(OurModuleProvider);
 
-    // Run the main "interpreter loop" now.
-    MainLoop();
+  // Set up the optimizer pipeline.  Start with registering info about how the
+  // target lays out data structures.
+  OurFPM.add(new TargetData(*TheExecutionEngine->getTargetData()));
+  // Do simple "peephole" optimizations and bit-twiddling optzns.
+  OurFPM.add(createInstructionCombiningPass());
+  // Reassociate expressions.
+  OurFPM.add(createReassociatePass());
+  // Eliminate Common SubExpressions.
+  OurFPM.add(createGVNPass());
+  // Simplify the control flow graph (deleting unreachable blocks, etc).
+  OurFPM.add(createCFGSimplificationPass());
+
+  // Set the global so the code gen can use this.
+  TheFPM = &OurFPM;
+
+  // Run the main "interpreter loop" now.
+  MainLoop();
 
@@ -298,8 +300,8 @@ by adding a global variable and a call in main:

... int main() { .. - // Create the JIT. - TheExecutionEngine = EngineBuilder(TheModule).create(); + // Create the JIT. This takes ownership of the module and module provider. + TheExecutionEngine = EngineBuilder(OurModuleProvider).create(); .. } @@ -1076,38 +1078,38 @@ int main() { // Make the module, which holds all the code. TheModule = new Module("my cool jit", getGlobalContext()); - - // Create the JIT. - TheExecutionEngine = EngineBuilder(TheModule).create(); - { - ExistingModuleProvider OurModuleProvider(TheModule); - FunctionPassManager OurFPM(&OurModuleProvider); - - // Set up the optimizer pipeline. Start with registering info about how the - // target lays out data structures. - OurFPM.add(new TargetData(*TheExecutionEngine->getTargetData())); - // Do simple "peephole" optimizations and bit-twiddling optzns. - OurFPM.add(createInstructionCombiningPass()); - // Reassociate expressions. - OurFPM.add(createReassociatePass()); - // Eliminate Common SubExpressions. - OurFPM.add(createGVNPass()); - // Simplify the control flow graph (deleting unreachable blocks, etc). - OurFPM.add(createCFGSimplificationPass()); + ExistingModuleProvider *OurModuleProvider = + new ExistingModuleProvider(TheModule); - // Set the global so the code gen can use this. - TheFPM = &OurFPM; + // Create the JIT. This takes ownership of the module and module provider. + TheExecutionEngine = EngineBuilder(OurModuleProvider).create(); + + FunctionPassManager OurFPM(OurModuleProvider); + + // Set up the optimizer pipeline. Start with registering info about how the + // target lays out data structures. + OurFPM.add(new TargetData(*TheExecutionEngine->getTargetData())); + // Do simple "peephole" optimizations and bit-twiddling optzns. + OurFPM.add(createInstructionCombiningPass()); + // Reassociate expressions. + OurFPM.add(createReassociatePass()); + // Eliminate Common SubExpressions. + OurFPM.add(createGVNPass()); + // Simplify the control flow graph (deleting unreachable blocks, etc). + OurFPM.add(createCFGSimplificationPass()); + + // Set the global so the code gen can use this. + TheFPM = &OurFPM; + + // Run the main "interpreter loop" now. + MainLoop(); + + TheFPM = 0; + + // Print out all of the generated code. + TheModule->dump(); - // Run the main "interpreter loop" now. - MainLoop(); - - TheFPM = 0; - - // Print out all of the generated code. - TheModule->dump(); - } // Free module provider (and thus the module) and pass manager. - return 0; } diff --git a/libclamav/c++/llvm/docs/tutorial/LangImpl5.html b/libclamav/c++/llvm/docs/tutorial/LangImpl5.html index acfee7b9b..3ded1392a 100644 --- a/libclamav/c++/llvm/docs/tutorial/LangImpl5.html +++ b/libclamav/c++/llvm/docs/tutorial/LangImpl5.html @@ -1710,37 +1710,38 @@ int main() { // Make the module, which holds all the code. TheModule = new Module("my cool jit", getGlobalContext()); - - // Create the JIT. - TheExecutionEngine = EngineBuilder(TheModule).create(); - { - ExistingModuleProvider OurModuleProvider(TheModule); - FunctionPassManager OurFPM(&OurModuleProvider); - - // Set up the optimizer pipeline. Start with registering info about how the - // target lays out data structures. - OurFPM.add(new TargetData(*TheExecutionEngine->getTargetData())); - // Do simple "peephole" optimizations and bit-twiddling optzns. - OurFPM.add(createInstructionCombiningPass()); - // Reassociate expressions. - OurFPM.add(createReassociatePass()); - // Eliminate Common SubExpressions. - OurFPM.add(createGVNPass()); - // Simplify the control flow graph (deleting unreachable blocks, etc). - OurFPM.add(createCFGSimplificationPass()); - // Set the global so the code gen can use this. - TheFPM = &OurFPM; + ExistingModuleProvider *OurModuleProvider = + new ExistingModuleProvider(TheModule); - // Run the main "interpreter loop" now. - MainLoop(); - - TheFPM = 0; + // Create the JIT. This takes ownership of the module and module provider. + TheExecutionEngine = EngineBuilder(OurModuleProvider).create(); + + FunctionPassManager OurFPM(OurModuleProvider); + + // Set up the optimizer pipeline. Start with registering info about how the + // target lays out data structures. + OurFPM.add(new TargetData(*TheExecutionEngine->getTargetData())); + // Do simple "peephole" optimizations and bit-twiddling optzns. + OurFPM.add(createInstructionCombiningPass()); + // Reassociate expressions. + OurFPM.add(createReassociatePass()); + // Eliminate Common SubExpressions. + OurFPM.add(createGVNPass()); + // Simplify the control flow graph (deleting unreachable blocks, etc). + OurFPM.add(createCFGSimplificationPass()); + + // Set the global so the code gen can use this. + TheFPM = &OurFPM; + + // Run the main "interpreter loop" now. + MainLoop(); + + TheFPM = 0; + + // Print out all of the generated code. + TheModule->dump(); - // Print out all of the generated code. - TheModule->dump(); - } // Free module provider (and thus the module) and pass manager. - return 0; } diff --git a/libclamav/c++/llvm/docs/tutorial/LangImpl6.html b/libclamav/c++/llvm/docs/tutorial/LangImpl6.html index 33df2452b..a61c82cd4 100644 --- a/libclamav/c++/llvm/docs/tutorial/LangImpl6.html +++ b/libclamav/c++/llvm/docs/tutorial/LangImpl6.html @@ -1749,37 +1749,38 @@ int main() { // Make the module, which holds all the code. TheModule = new Module("my cool jit", getGlobalContext()); - - // Create the JIT. - TheExecutionEngine = EngineBuilder(TheModule).create(); - { - ExistingModuleProvider OurModuleProvider(TheModule); - FunctionPassManager OurFPM(&OurModuleProvider); - - // Set up the optimizer pipeline. Start with registering info about how the - // target lays out data structures. - OurFPM.add(new TargetData(*TheExecutionEngine->getTargetData())); - // Do simple "peephole" optimizations and bit-twiddling optzns. - OurFPM.add(createInstructionCombiningPass()); - // Reassociate expressions. - OurFPM.add(createReassociatePass()); - // Eliminate Common SubExpressions. - OurFPM.add(createGVNPass()); - // Simplify the control flow graph (deleting unreachable blocks, etc). - OurFPM.add(createCFGSimplificationPass()); - // Set the global so the code gen can use this. - TheFPM = &OurFPM; + ExistingModuleProvider *OurModuleProvider = + new ExistingModuleProvider(TheModule); + + // Create the JIT. This takes ownership of the module and module provider. + TheExecutionEngine = EngineBuilder(OurModuleProvider).create(); + + FunctionPassManager OurFPM(OurModuleProvider); + + // Set up the optimizer pipeline. Start with registering info about how the + // target lays out data structures. + OurFPM.add(new TargetData(*TheExecutionEngine->getTargetData())); + // Do simple "peephole" optimizations and bit-twiddling optzns. + OurFPM.add(createInstructionCombiningPass()); + // Reassociate expressions. + OurFPM.add(createReassociatePass()); + // Eliminate Common SubExpressions. + OurFPM.add(createGVNPass()); + // Simplify the control flow graph (deleting unreachable blocks, etc). + OurFPM.add(createCFGSimplificationPass()); + + // Set the global so the code gen can use this. + TheFPM = &OurFPM; + + // Run the main "interpreter loop" now. + MainLoop(); + + TheFPM = 0; + + // Print out all of the generated code. + TheModule->dump(); - // Run the main "interpreter loop" now. - MainLoop(); - - TheFPM = 0; - - // Print out all of the generated code. - TheModule->dump(); - } // Free module provider (and thus the module) and pass manager. - return 0; } diff --git a/libclamav/c++/llvm/docs/tutorial/LangImpl7.html b/libclamav/c++/llvm/docs/tutorial/LangImpl7.html index 81386bc1a..90925a904 100644 --- a/libclamav/c++/llvm/docs/tutorial/LangImpl7.html +++ b/libclamav/c++/llvm/docs/tutorial/LangImpl7.html @@ -2101,41 +2101,38 @@ int main() { // Make the module, which holds all the code. TheModule = new Module("my cool jit", getGlobalContext()); - - // Create the JIT. - TheExecutionEngine = EngineBuilder(TheModule).create(); - { - ExistingModuleProvider OurModuleProvider(TheModule); - FunctionPassManager OurFPM(&OurModuleProvider); - - // Set up the optimizer pipeline. Start with registering info about how the - // target lays out data structures. - OurFPM.add(new TargetData(*TheExecutionEngine->getTargetData())); - // Promote allocas to registers. - OurFPM.add(createPromoteMemoryToRegisterPass()); - // Do simple "peephole" optimizations and bit-twiddling optzns. - OurFPM.add(createInstructionCombiningPass()); - // Reassociate expressions. - OurFPM.add(createReassociatePass()); - // Eliminate Common SubExpressions. - OurFPM.add(createGVNPass()); - // Simplify the control flow graph (deleting unreachable blocks, etc). - OurFPM.add(createCFGSimplificationPass()); + ExistingModuleProvider *OurModuleProvider = + new ExistingModuleProvider(TheModule); - // Set the global so the code gen can use this. - TheFPM = &OurFPM; + // Create the JIT. This takes ownership of the module and module provider. + TheExecutionEngine = EngineBuilder(OurModuleProvider).create(); + + FunctionPassManager OurFPM(OurModuleProvider); + + // Set up the optimizer pipeline. Start with registering info about how the + // target lays out data structures. + OurFPM.add(new TargetData(*TheExecutionEngine->getTargetData())); + // Do simple "peephole" optimizations and bit-twiddling optzns. + OurFPM.add(createInstructionCombiningPass()); + // Reassociate expressions. + OurFPM.add(createReassociatePass()); + // Eliminate Common SubExpressions. + OurFPM.add(createGVNPass()); + // Simplify the control flow graph (deleting unreachable blocks, etc). + OurFPM.add(createCFGSimplificationPass()); + + // Set the global so the code gen can use this. + TheFPM = &OurFPM; + + // Run the main "interpreter loop" now. + MainLoop(); + + TheFPM = 0; + + // Print out all of the generated code. + TheModule->dump(); - // Run the main "interpreter loop" now. - MainLoop(); - - TheFPM = 0; - - // Print out all of the generated code. - TheModule->dump(); - - } // Free module provider (and thus the module) and pass manager. - return 0; } diff --git a/libclamav/c++/llvm/examples/BrainF/BrainFDriver.cpp b/libclamav/c++/llvm/examples/BrainF/BrainFDriver.cpp index ad8a922b5..6f4ba6992 100644 --- a/libclamav/c++/llvm/examples/BrainF/BrainFDriver.cpp +++ b/libclamav/c++/llvm/examples/BrainF/BrainFDriver.cpp @@ -110,7 +110,6 @@ int main(int argc, char **argv) { if (OutputFilename != "-") { std::string ErrInfo; out = new raw_fd_ostream(OutputFilename.c_str(), ErrInfo, - raw_fd_ostream::F_Force| raw_fd_ostream::F_Binary); } } diff --git a/libclamav/c++/llvm/examples/Kaleidoscope/toy.cpp b/libclamav/c++/llvm/examples/Kaleidoscope/toy.cpp index 6b0560a14..8e02e9ab6 100644 --- a/libclamav/c++/llvm/examples/Kaleidoscope/toy.cpp +++ b/libclamav/c++/llvm/examples/Kaleidoscope/toy.cpp @@ -1108,42 +1108,40 @@ int main() { // Make the module, which holds all the code. TheModule = new Module("my cool jit", Context); - { - ExistingModuleProvider OurModuleProvider(TheModule); + ExistingModuleProvider *OurModuleProvider = + new ExistingModuleProvider(TheModule); - // Create the JIT. - TheExecutionEngine = EngineBuilder(&OurModuleProvider).create(); + // Create the JIT. This takes ownership of the module and module provider. + TheExecutionEngine = EngineBuilder(OurModuleProvider).create(); - FunctionPassManager OurFPM(&OurModuleProvider); - - // Set up the optimizer pipeline. Start with registering info about how the - // target lays out data structures. - OurFPM.add(new TargetData(*TheExecutionEngine->getTargetData())); - // Promote allocas to registers. - OurFPM.add(createPromoteMemoryToRegisterPass()); - // Do simple "peephole" optimizations and bit-twiddling optzns. - OurFPM.add(createInstructionCombiningPass()); - // Reassociate expressions. - OurFPM.add(createReassociatePass()); - // Eliminate Common SubExpressions. - OurFPM.add(createGVNPass()); - // Simplify the control flow graph (deleting unreachable blocks, etc). - OurFPM.add(createCFGSimplificationPass()); + FunctionPassManager OurFPM(OurModuleProvider); - OurFPM.doInitialization(); + // Set up the optimizer pipeline. Start with registering info about how the + // target lays out data structures. + OurFPM.add(new TargetData(*TheExecutionEngine->getTargetData())); + // Promote allocas to registers. + OurFPM.add(createPromoteMemoryToRegisterPass()); + // Do simple "peephole" optimizations and bit-twiddling optzns. + OurFPM.add(createInstructionCombiningPass()); + // Reassociate expressions. + OurFPM.add(createReassociatePass()); + // Eliminate Common SubExpressions. + OurFPM.add(createGVNPass()); + // Simplify the control flow graph (deleting unreachable blocks, etc). + OurFPM.add(createCFGSimplificationPass()); - // Set the global so the code gen can use this. - TheFPM = &OurFPM; + OurFPM.doInitialization(); + + // Set the global so the code gen can use this. + TheFPM = &OurFPM; + + // Run the main "interpreter loop" now. + MainLoop(); + + TheFPM = 0; + + // Print out all of the generated code. + TheModule->dump(); - // Run the main "interpreter loop" now. - MainLoop(); - - TheFPM = 0; - - // Print out all of the generated code. - TheModule->dump(); - - } // Free module provider (and thus the module) and pass manager. - return 0; } diff --git a/libclamav/c++/llvm/include/llvm-c/Core.h b/libclamav/c++/llvm/include/llvm-c/Core.h index b0a9800ce..40696e0ac 100644 --- a/libclamav/c++/llvm/include/llvm-c/Core.h +++ b/libclamav/c++/llvm/include/llvm-c/Core.h @@ -109,7 +109,8 @@ typedef enum { LLVMNoCaptureAttribute = 1<<21, LLVMNoRedZoneAttribute = 1<<22, LLVMNoImplicitFloatAttribute = 1<<23, - LLVMNakedAttribute = 1<<24 + LLVMNakedAttribute = 1<<24, + LLVMInlineHintAttribute = 1<<25 } LLVMAttribute; typedef enum { @@ -207,8 +208,8 @@ void LLVMDisposeMessage(char *Message); /*===-- Modules -----------------------------------------------------------===*/ /* Create and destroy contexts. */ -LLVMContextRef LLVMContextCreate(); -LLVMContextRef LLVMGetGlobalContext(); +LLVMContextRef LLVMContextCreate(void); +LLVMContextRef LLVMGetGlobalContext(void); void LLVMContextDispose(LLVMContextRef C); /* Create and destroy modules. */ diff --git a/libclamav/c++/llvm/include/llvm/ADT/DenseMap.h b/libclamav/c++/llvm/include/llvm/ADT/DenseMap.h index b5862a9f0..b220714b3 100644 --- a/libclamav/c++/llvm/include/llvm/ADT/DenseMap.h +++ b/libclamav/c++/llvm/include/llvm/ADT/DenseMap.h @@ -93,6 +93,8 @@ public: void resize(size_t Size) { grow(Size); } void clear() { + if (NumEntries == 0 && NumTombstones == 0) return; + // If the capacity of the array is huge, and the # elements used is small, // shrink the array. if (NumEntries * 4 < NumBuckets && NumBuckets > 64) { diff --git a/libclamav/c++/llvm/include/llvm/ADT/DenseMapInfo.h b/libclamav/c++/llvm/include/llvm/ADT/DenseMapInfo.h index a89507422..d76ebde7f 100644 --- a/libclamav/c++/llvm/include/llvm/ADT/DenseMapInfo.h +++ b/libclamav/c++/llvm/include/llvm/ADT/DenseMapInfo.h @@ -84,6 +84,20 @@ template<> struct DenseMapInfo { } }; +// Provide DenseMapInfo for unsigned long longs. +template<> struct DenseMapInfo { + static inline unsigned long long getEmptyKey() { return ~0LL; } + static inline unsigned long long getTombstoneKey() { return ~0LL - 1LL; } + static unsigned getHashValue(const unsigned long long& Val) { + return (unsigned)(Val * 37LL); + } + static bool isPod() { return true; } + static bool isEqual(const unsigned long long& LHS, + const unsigned long long& RHS) { + return LHS == RHS; + } +}; + // Provide DenseMapInfo for all pairs whose members have info. template struct DenseMapInfo > { diff --git a/libclamav/c++/llvm/include/llvm/ADT/DepthFirstIterator.h b/libclamav/c++/llvm/include/llvm/ADT/DepthFirstIterator.h index c5f246c33..5f2df2a17 100644 --- a/libclamav/c++/llvm/include/llvm/ADT/DepthFirstIterator.h +++ b/libclamav/c++/llvm/include/llvm/ADT/DepthFirstIterator.h @@ -34,7 +34,6 @@ #define LLVM_ADT_DEPTHFIRSTITERATOR_H #include "llvm/ADT/GraphTraits.h" -#include "llvm/ADT/iterator.h" #include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/PointerIntPair.h" #include @@ -63,9 +62,11 @@ public: template::NodeType*, 8>, bool ExtStorage = false, class GT = GraphTraits > -class df_iterator : public forward_iterator, +class df_iterator : public std::iterator, public df_iterator_storage { - typedef forward_iterator super; + typedef std::iterator super; typedef typename GT::NodeType NodeType; typedef typename GT::ChildIteratorType ChildItTy; diff --git a/libclamav/c++/llvm/include/llvm/ADT/EquivalenceClasses.h b/libclamav/c++/llvm/include/llvm/ADT/EquivalenceClasses.h index 6e00a217b..bed99d3d2 100644 --- a/libclamav/c++/llvm/include/llvm/ADT/EquivalenceClasses.h +++ b/libclamav/c++/llvm/include/llvm/ADT/EquivalenceClasses.h @@ -15,7 +15,6 @@ #ifndef LLVM_ADT_EQUIVALENCECLASSES_H #define LLVM_ADT_EQUIVALENCECLASSES_H -#include "llvm/ADT/iterator.h" #include "llvm/Support/DataTypes.h" #include @@ -234,8 +233,9 @@ public: return L1; } - class member_iterator : public forward_iterator { - typedef forward_iterator super; + class member_iterator : public std::iterator { + typedef std::iterator super; const ECValue *Node; friend class EquivalenceClasses; public: @@ -249,7 +249,7 @@ public: reference operator*() const { assert(Node != 0 && "Dereferencing end()!"); - return Node->getData(); + return const_cast(Node->getData()); // FIXME } reference operator->() const { return operator*(); } diff --git a/libclamav/c++/llvm/include/llvm/ADT/PostOrderIterator.h b/libclamav/c++/llvm/include/llvm/ADT/PostOrderIterator.h index 227472b2d..8315bc9f9 100644 --- a/libclamav/c++/llvm/include/llvm/ADT/PostOrderIterator.h +++ b/libclamav/c++/llvm/include/llvm/ADT/PostOrderIterator.h @@ -17,7 +17,6 @@ #define LLVM_ADT_POSTORDERITERATOR_H #include "llvm/ADT/GraphTraits.h" -#include "llvm/ADT/iterator.h" #include "llvm/ADT/SmallPtrSet.h" #include #include @@ -43,9 +42,11 @@ template::NodeType*, 8>, bool ExtStorage = false, class GT = GraphTraits > -class po_iterator : public forward_iterator, +class po_iterator : public std::iterator, public po_iterator_storage { - typedef forward_iterator super; + typedef std::iterator super; typedef typename GT::NodeType NodeType; typedef typename GT::ChildIteratorType ChildItTy; diff --git a/libclamav/c++/llvm/include/llvm/ADT/SCCIterator.h b/libclamav/c++/llvm/include/llvm/ADT/SCCIterator.h index fde735d10..c0c6ba2a6 100644 --- a/libclamav/c++/llvm/include/llvm/ADT/SCCIterator.h +++ b/libclamav/c++/llvm/include/llvm/ADT/SCCIterator.h @@ -22,7 +22,6 @@ #define LLVM_ADT_SCCITERATOR_H #include "llvm/ADT/GraphTraits.h" -#include "llvm/ADT/iterator.h" #include #include @@ -35,11 +34,13 @@ namespace llvm { /// template > class scc_iterator - : public forward_iterator, ptrdiff_t> { + : public std::iterator, ptrdiff_t> { typedef typename GT::NodeType NodeType; typedef typename GT::ChildIteratorType ChildItTy; typedef std::vector SccTy; - typedef forward_iterator super; + typedef std::iterator, ptrdiff_t> super; typedef typename super::reference reference; typedef typename super::pointer pointer; diff --git a/libclamav/c++/llvm/include/llvm/ADT/STLExtras.h b/libclamav/c++/llvm/include/llvm/ADT/STLExtras.h index 9ac73c0c9..6f4769260 100644 --- a/libclamav/c++/llvm/include/llvm/ADT/STLExtras.h +++ b/libclamav/c++/llvm/include/llvm/ADT/STLExtras.h @@ -19,8 +19,8 @@ #include // for std::size_t #include +#include #include // for std::pair -#include "llvm/ADT/iterator.h" namespace llvm { diff --git a/libclamav/c++/llvm/include/llvm/ADT/SmallVector.h b/libclamav/c++/llvm/include/llvm/ADT/SmallVector.h index dd3a6d006..f3b4533b9 100644 --- a/libclamav/c++/llvm/include/llvm/ADT/SmallVector.h +++ b/libclamav/c++/llvm/include/llvm/ADT/SmallVector.h @@ -14,7 +14,6 @@ #ifndef LLVM_ADT_SMALLVECTOR_H #define LLVM_ADT_SMALLVECTOR_H -#include "llvm/ADT/iterator.h" #include "llvm/Support/type_traits.h" #include #include diff --git a/libclamav/c++/llvm/include/llvm/ADT/Triple.h b/libclamav/c++/llvm/include/llvm/ADT/Triple.h index 46bf90082..03ecd708f 100644 --- a/libclamav/c++/llvm/include/llvm/ADT/Triple.h +++ b/libclamav/c++/llvm/include/llvm/ADT/Triple.h @@ -13,6 +13,11 @@ #include "llvm/ADT/StringRef.h" #include +// Some system headers or GCC predefined macros conflict with identifiers in +// this file. Undefine them here. +#undef mips +#undef sparc + namespace llvm { class StringRef; class Twine; diff --git a/libclamav/c++/llvm/include/llvm/ADT/ilist.h b/libclamav/c++/llvm/include/llvm/ADT/ilist.h index 1db648b0f..6e6f5d69b 100644 --- a/libclamav/c++/llvm/include/llvm/ADT/ilist.h +++ b/libclamav/c++/llvm/include/llvm/ADT/ilist.h @@ -38,8 +38,8 @@ #ifndef LLVM_ADT_ILIST_H #define LLVM_ADT_ILIST_H -#include "llvm/ADT/iterator.h" #include +#include namespace llvm { @@ -140,11 +140,12 @@ struct ilist_traits : public ilist_traits {}; // template class ilist_iterator - : public bidirectional_iterator { + : public std::iterator { public: typedef ilist_traits Traits; - typedef bidirectional_iterator super; + typedef std::iterator super; typedef typename super::value_type value_type; typedef typename super::difference_type difference_type; @@ -189,12 +190,10 @@ public: // Accessors... operator pointer() const { - assert(Traits::getNext(NodePtr) != 0 && "Dereferencing end()!"); return NodePtr; } reference operator*() const { - assert(Traits::getNext(NodePtr) != 0 && "Dereferencing end()!"); return *NodePtr; } pointer operator->() const { return &operator*(); } @@ -215,7 +214,6 @@ public: } ilist_iterator &operator++() { // preincrement - Advance NodePtr = Traits::getNext(NodePtr); - assert(NodePtr && "++'d off the end of an ilist!"); return *this; } ilist_iterator operator--(int) { // postdecrement operators... diff --git a/libclamav/c++/llvm/include/llvm/ADT/ilist_node.h b/libclamav/c++/llvm/include/llvm/ADT/ilist_node.h index dae7475ff..c28169fde 100644 --- a/libclamav/c++/llvm/include/llvm/ADT/ilist_node.h +++ b/libclamav/c++/llvm/include/llvm/ADT/ilist_node.h @@ -18,28 +18,37 @@ namespace llvm { template -struct ilist_nextprev_traits; +struct ilist_traits; + +/// ilist_half_node - Base class that provides prev services for sentinels. +/// +template +class ilist_half_node { + friend struct ilist_traits; + NodeTy *Prev; +protected: + NodeTy *getPrev() { return Prev; } + const NodeTy *getPrev() const { return Prev; } + void setPrev(NodeTy *P) { Prev = P; } + ilist_half_node() : Prev(0) {} +}; template -struct ilist_traits; +struct ilist_nextprev_traits; /// ilist_node - Base class that provides next/prev services for nodes /// that use ilist_nextprev_traits or ilist_default_traits. /// template -class ilist_node { -private: +class ilist_node : ilist_half_node { friend struct ilist_nextprev_traits; friend struct ilist_traits; - NodeTy *Prev, *Next; - NodeTy *getPrev() { return Prev; } + NodeTy *Next; NodeTy *getNext() { return Next; } - const NodeTy *getPrev() const { return Prev; } const NodeTy *getNext() const { return Next; } - void setPrev(NodeTy *N) { Prev = N; } void setNext(NodeTy *N) { Next = N; } protected: - ilist_node() : Prev(0), Next(0) {} + ilist_node() : Next(0) {} }; } // End llvm namespace diff --git a/libclamav/c++/llvm/include/llvm/ADT/iterator.cmake b/libclamav/c++/llvm/include/llvm/ADT/iterator.cmake deleted file mode 100644 index 55df8ce26..000000000 --- a/libclamav/c++/llvm/include/llvm/ADT/iterator.cmake +++ /dev/null @@ -1,79 +0,0 @@ -//===-- llvm/ADT/iterator - Portable wrapper around --*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file provides a wrapper around the mysterious header file. -// In GCC 2.95.3, the file defines a bidirectional_iterator class (and other -// friends), instead of the standard iterator class. In GCC 3.1, the -// bidirectional_iterator class got moved out and the new, standards compliant, -// iterator<> class was added. Because there is nothing that we can do to get -// correct behavior on both compilers, we have this header with #ifdef's. Gross -// huh? -// -// By #includ'ing this file, you get the contents of plus the -// following classes in the global namespace: -// -// 1. bidirectional_iterator -// 2. forward_iterator -// -// The #if directives' expressions are filled in by Autoconf. -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_ADT_ITERATOR -#define LLVM_ADT_ITERATOR - -#include - -#undef HAVE_BI_ITERATOR -#undef HAVE_STD_ITERATOR -#undef HAVE_FWD_ITERATOR - -// defined by Kevin -#define HAVE_STD_ITERATOR 1 - -#ifdef _MSC_VER -# define HAVE_BI_ITERATOR 0 -# define HAVE_STD_ITERATOR 1 -# define HAVE_FWD_ITERATOR 0 -#endif - -#if !HAVE_BI_ITERATOR -# if HAVE_STD_ITERATOR -/// If the bidirectional iterator is not defined, we attempt to define it in -/// terms of the C++ standard iterator. Otherwise, we import it with a "using" -/// statement. -/// -template -struct bidirectional_iterator - : public std::iterator { -}; -# else -# error "Need to have standard iterator to define bidirectional iterator!" -# endif -#else -using std::bidirectional_iterator; -#endif - -#if !HAVE_FWD_ITERATOR -# if HAVE_STD_ITERATOR -/// If the forward iterator is not defined, attempt to define it in terms of -/// the C++ standard iterator. Otherwise, we import it with a "using" statement. -/// -template -struct forward_iterator - : public std::iterator { -}; -# else -# error "Need to have standard iterator to define forward iterator!" -# endif -#else -using std::forward_iterator; -#endif - -#endif diff --git a/libclamav/c++/llvm/include/llvm/ADT/iterator.h.in b/libclamav/c++/llvm/include/llvm/ADT/iterator.h.in deleted file mode 100644 index dce746251..000000000 --- a/libclamav/c++/llvm/include/llvm/ADT/iterator.h.in +++ /dev/null @@ -1,76 +0,0 @@ -//==-- llvm/ADT/iterator.h - Portable wrapper around --*- C++ -*-==// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file provides a wrapper around the mysterious header file. -// In GCC 2.95.3, the file defines a bidirectional_iterator class (and other -// friends), instead of the standard iterator class. In GCC 3.1, the -// bidirectional_iterator class got moved out and the new, standards compliant, -// iterator<> class was added. Because there is nothing that we can do to get -// correct behavior on both compilers, we have this header with #ifdef's. Gross -// huh? -// -// By #includ'ing this file, you get the contents of plus the -// following classes in the global namespace: -// -// 1. bidirectional_iterator -// 2. forward_iterator -// -// The #if directives' expressions are filled in by Autoconf. -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_ADT_ITERATOR_H -#define LLVM_ADT_ITERATOR_H - -#include - -#undef HAVE_BI_ITERATOR -#undef HAVE_STD_ITERATOR -#undef HAVE_FWD_ITERATOR - -#ifdef _MSC_VER -# define HAVE_BI_ITERATOR 0 -# define HAVE_STD_ITERATOR 1 -# define HAVE_FWD_ITERATOR 0 -#endif - -#if !HAVE_BI_ITERATOR -# if HAVE_STD_ITERATOR -/// If the bidirectional iterator is not defined, we attempt to define it in -/// terms of the C++ standard iterator. Otherwise, we import it with a "using" -/// statement. -/// -template -struct bidirectional_iterator - : public std::iterator { -}; -# else -# error "Need to have standard iterator to define bidirectional iterator!" -# endif -#else -using std::bidirectional_iterator; -#endif - -#if !HAVE_FWD_ITERATOR -# if HAVE_STD_ITERATOR -/// If the forward iterator is not defined, attempt to define it in terms of -/// the C++ standard iterator. Otherwise, we import it with a "using" statement. -/// -template -struct forward_iterator - : public std::iterator { -}; -# else -# error "Need to have standard iterator to define forward iterator!" -# endif -#else -using std::forward_iterator; -#endif - -#endif // LLVM_ADT_ITERATOR_H diff --git a/libclamav/c++/llvm/include/llvm/Analysis/AliasAnalysis.h b/libclamav/c++/llvm/include/llvm/Analysis/AliasAnalysis.h index 54006aea0..be7d5ee37 100644 --- a/libclamav/c++/llvm/include/llvm/Analysis/AliasAnalysis.h +++ b/libclamav/c++/llvm/include/llvm/Analysis/AliasAnalysis.h @@ -347,7 +347,7 @@ bool isNoAliasCall(const Value *V); /// isIdentifiedObject - Return true if this pointer refers to a distinct and /// identifiable object. This returns true for: -/// Global Variables and Functions +/// Global Variables and Functions (but not Global Aliases) /// Allocas and Mallocs /// ByVal and NoAlias Arguments /// NoAlias returns diff --git a/libclamav/c++/llvm/include/llvm/Analysis/AliasSetTracker.h b/libclamav/c++/llvm/include/llvm/Analysis/AliasSetTracker.h index 82c6f392d..239f30f93 100644 --- a/libclamav/c++/llvm/include/llvm/Analysis/AliasSetTracker.h +++ b/libclamav/c++/llvm/include/llvm/Analysis/AliasSetTracker.h @@ -20,7 +20,6 @@ #include "llvm/Support/CallSite.h" #include "llvm/Support/ValueHandle.h" #include "llvm/ADT/DenseMap.h" -#include "llvm/ADT/iterator.h" #include "llvm/ADT/ilist.h" #include "llvm/ADT/ilist_node.h" #include @@ -159,7 +158,8 @@ public: void dump() const; /// Define an iterator for alias sets... this is just a forward iterator. - class iterator : public forward_iterator { + class iterator : public std::iterator { PointerRec *CurNode; public: explicit iterator(PointerRec *CN = 0) : CurNode(CN) {} diff --git a/libclamav/c++/llvm/include/llvm/Analysis/CallGraph.h b/libclamav/c++/llvm/include/llvm/Analysis/CallGraph.h index c36cb2278..0e997cab7 100644 --- a/libclamav/c++/llvm/include/llvm/Analysis/CallGraph.h +++ b/libclamav/c++/llvm/include/llvm/Analysis/CallGraph.h @@ -77,7 +77,7 @@ protected: public: static char ID; // Class identification, replacement for typeinfo //===--------------------------------------------------------------------- - // Accessors... + // Accessors. // typedef FunctionMapTy::iterator iterator; typedef FunctionMapTy::const_iterator const_iterator; @@ -107,6 +107,7 @@ public: /// Returns the CallGraphNode which is used to represent undetermined calls /// into the callgraph. Override this if you want behavioral inheritance. virtual CallGraphNode* getExternalCallingNode() const { return 0; } + virtual CallGraphNode* getCallsExternalNode() const { return 0; } /// Return the root/main method in the module, or some other root node, such /// as the externalcallingnode. Overload these if you behavioral @@ -130,19 +131,13 @@ public: return removeFunctionFromModule((*this)[F]); } - /// changeFunction - This method changes the function associated with this - /// CallGraphNode, for use by transformations that need to change the - /// prototype of a Function (thus they must create a new Function and move the - /// old code over). - void changeFunction(Function *OldF, Function *NewF); - /// getOrInsertFunction - This method is identical to calling operator[], but /// it will insert a new CallGraphNode for the specified function if one does /// not already exist. CallGraphNode *getOrInsertFunction(const Function *F); //===--------------------------------------------------------------------- - // Pass infrastructure interface glue code... + // Pass infrastructure interface glue code. // protected: CallGraph() {} @@ -156,7 +151,7 @@ public: void initialize(Module &M); void print(raw_ostream &o, Module *) const; - + void dump() const; protected: // destroy - Release memory for the call graph virtual void destroy(); @@ -169,19 +164,31 @@ class CallGraphNode { Function *F; typedef std::pair CallRecord; std::vector CalledFunctions; + + /// NumReferences - This is the number of times that this CallGraphNode occurs + /// in the CalledFunctions array of this or other CallGraphNodes. + unsigned NumReferences; - CallGraphNode(const CallGraphNode &); // Do not implement + CallGraphNode(const CallGraphNode &); // DO NOT IMPLEMENT + void operator=(const CallGraphNode &); // DO NOT IMPLEMENT + + void DropRef() { --NumReferences; } + void AddRef() { ++NumReferences; } public: typedef std::vector CalledFunctionsVector; + + // CallGraphNode ctor - Create a node for the specified function. + inline CallGraphNode(Function *f) : F(f), NumReferences(0) {} + //===--------------------------------------------------------------------- - // Accessor methods... + // Accessor methods. // typedef std::vector::iterator iterator; typedef std::vector::const_iterator const_iterator; - // getFunction - Return the function that this call graph node represents... + // getFunction - Return the function that this call graph node represents. Function *getFunction() const { return F; } inline iterator begin() { return CalledFunctions.begin(); } @@ -191,9 +198,14 @@ public: inline bool empty() const { return CalledFunctions.empty(); } inline unsigned size() const { return (unsigned)CalledFunctions.size(); } - // Subscripting operator - Return the i'th called function... + /// getNumReferences - Return the number of other CallGraphNodes in this + /// CallGraph that reference this node in their callee list. + unsigned getNumReferences() const { return NumReferences; } + + // Subscripting operator - Return the i'th called function. // CallGraphNode *operator[](unsigned i) const { + assert(i < CalledFunctions.size() && "Invalid index"); return CalledFunctions[i].second; } @@ -210,13 +222,26 @@ public: /// removeAllCalledFunctions - As the name implies, this removes all edges /// from this CallGraphNode to any functions it calls. void removeAllCalledFunctions() { - CalledFunctions.clear(); + while (!CalledFunctions.empty()) { + CalledFunctions.back().second->DropRef(); + CalledFunctions.pop_back(); + } } + + /// stealCalledFunctionsFrom - Move all the callee information from N to this + /// node. + void stealCalledFunctionsFrom(CallGraphNode *N) { + assert(CalledFunctions.empty() && + "Cannot steal callsite information if I already have some"); + std::swap(CalledFunctions, N->CalledFunctions); + } + /// addCalledFunction - Add a function to the list of functions called by this /// one. void addCalledFunction(CallSite CS, CallGraphNode *M) { CalledFunctions.push_back(std::make_pair(CS, M)); + M->AddRef(); } /// removeCallEdgeFor - This method removes the edge in the node for the @@ -224,6 +249,10 @@ public: /// should be used sparingly. void removeCallEdgeFor(CallSite CS); + // FIXME: REMOVE THIS WHEN HACK IS REMOVED FROM CGSCCPASSMGR. + void removeCallEdgeFor(Instruction *CS); + + /// removeAnyCallEdgeTo - This method removes all call edges from this node /// to the specified callee function. This takes more time to execute than /// removeCallEdgeTo, so it should not be used unless necessary. @@ -236,12 +265,7 @@ public: /// replaceCallSite - Make the edge in the node for Old CallSite be for /// New CallSite instead. Note that this method takes linear time, so it /// should be used sparingly. - void replaceCallSite(CallSite Old, CallSite New); - - friend class CallGraph; - - // CallGraphNode ctor - Create a node for the specified function. - inline CallGraphNode(Function *f) : F(f) {} + void replaceCallSite(CallSite Old, CallSite New, CallGraphNode *NewCallee); }; //===----------------------------------------------------------------------===// diff --git a/libclamav/c++/llvm/include/llvm/Analysis/ConstantsScanner.h b/libclamav/c++/llvm/include/llvm/Analysis/ConstantsScanner.h index bac551f04..cdaf68d75 100644 --- a/libclamav/c++/llvm/include/llvm/Analysis/ConstantsScanner.h +++ b/libclamav/c++/llvm/include/llvm/Analysis/ConstantsScanner.h @@ -17,13 +17,13 @@ #define LLVM_ANALYSIS_CONSTANTSSCANNER_H #include "llvm/Support/InstIterator.h" -#include "llvm/ADT/iterator.h" namespace llvm { class Constant; -class constant_iterator : public forward_iterator { +class constant_iterator : public std::iterator { const_inst_iterator InstI; // Method instruction iterator unsigned OpIdx; // Operand index diff --git a/libclamav/c++/llvm/include/llvm/Analysis/DebugInfo.h b/libclamav/c++/llvm/include/llvm/Analysis/DebugInfo.h index 79f4a58e4..489c273ed 100644 --- a/libclamav/c++/llvm/include/llvm/Analysis/DebugInfo.h +++ b/libclamav/c++/llvm/include/llvm/Analysis/DebugInfo.h @@ -17,6 +17,7 @@ #ifndef LLVM_ANALYSIS_DEBUGINFO_H #define LLVM_ANALYSIS_DEBUGINFO_H +#include "llvm/Metadata.h" #include "llvm/Target/TargetMachine.h" #include "llvm/ADT/StringMap.h" #include "llvm/ADT/DenseMap.h" @@ -44,12 +45,12 @@ namespace llvm { class DIDescriptor { protected: - GlobalVariable *DbgGV; + MDNode *DbgNode; - /// DIDescriptor constructor. If the specified GV is non-null, this checks + /// DIDescriptor constructor. If the specified node is non-null, check /// to make sure that the tag in the descriptor matches 'RequiredTag'. If /// not, the debug info is corrupt and we ignore it. - DIDescriptor(GlobalVariable *GV, unsigned RequiredTag); + DIDescriptor(MDNode *N, unsigned RequiredTag); const std::string &getStringField(unsigned Elt, std::string &Result) const; unsigned getUnsignedField(unsigned Elt) const { @@ -60,18 +61,18 @@ namespace llvm { template DescTy getFieldAs(unsigned Elt) const { - return DescTy(getDescriptorField(Elt).getGV()); + return DescTy(getDescriptorField(Elt).getNode()); } GlobalVariable *getGlobalVariableField(unsigned Elt) const; public: - explicit DIDescriptor() : DbgGV(0) {} - explicit DIDescriptor(GlobalVariable *GV) : DbgGV(GV) {} + explicit DIDescriptor() : DbgNode(0) {} + explicit DIDescriptor(MDNode *N) : DbgNode(N) {} - bool isNull() const { return DbgGV == 0; } + bool isNull() const { return DbgNode == 0; } - GlobalVariable *getGV() const { return DbgGV; } + MDNode *getNode() const { return DbgNode; } unsigned getVersion() const { return getUnsignedField(0) & LLVMDebugVersionMask; @@ -81,8 +82,8 @@ namespace llvm { return getUnsignedField(0) & ~LLVMDebugVersionMask; } - /// ValidDebugInfo - Return true if V represents valid debug info value. - static bool ValidDebugInfo(Value *V, CodeGenOpt::Level OptLevel); + /// ValidDebugInfo - Return true if N represents valid debug info value. + static bool ValidDebugInfo(MDNode *N, CodeGenOpt::Level OptLevel); /// dump - print descriptor. void dump() const; @@ -91,8 +92,8 @@ namespace llvm { /// DISubrange - This is used to represent ranges, for array bounds. class DISubrange : public DIDescriptor { public: - explicit DISubrange(GlobalVariable *GV = 0) - : DIDescriptor(GV, dwarf::DW_TAG_subrange_type) {} + explicit DISubrange(MDNode *N = 0) + : DIDescriptor(N, dwarf::DW_TAG_subrange_type) {} int64_t getLo() const { return (int64_t)getUInt64Field(1); } int64_t getHi() const { return (int64_t)getUInt64Field(2); } @@ -101,7 +102,8 @@ namespace llvm { /// DIArray - This descriptor holds an array of descriptors. class DIArray : public DIDescriptor { public: - explicit DIArray(GlobalVariable *GV = 0) : DIDescriptor(GV) {} + explicit DIArray(MDNode *N = 0) + : DIDescriptor(N) {} unsigned getNumElements() const; DIDescriptor getElement(unsigned Idx) const { @@ -112,8 +114,8 @@ namespace llvm { /// DICompileUnit - A wrapper for a compile unit. class DICompileUnit : public DIDescriptor { public: - explicit DICompileUnit(GlobalVariable *GV = 0) - : DIDescriptor(GV, dwarf::DW_TAG_compile_unit) {} + explicit DICompileUnit(MDNode *N = 0) + : DIDescriptor(N, dwarf::DW_TAG_compile_unit) {} unsigned getLanguage() const { return getUnsignedField(2); } const std::string &getFilename(std::string &F) const { @@ -154,8 +156,8 @@ namespace llvm { /// type/precision or a file/line pair for location info. class DIEnumerator : public DIDescriptor { public: - explicit DIEnumerator(GlobalVariable *GV = 0) - : DIDescriptor(GV, dwarf::DW_TAG_enumerator) {} + explicit DIEnumerator(MDNode *N = 0) + : DIDescriptor(N, dwarf::DW_TAG_enumerator) {} const std::string &getName(std::string &F) const { return getStringField(1, F); @@ -169,16 +171,18 @@ namespace llvm { class DIType : public DIDescriptor { public: enum { - FlagPrivate = 1 << 0, - FlagProtected = 1 << 1, - FlagFwdDecl = 1 << 2 + FlagPrivate = 1 << 0, + FlagProtected = 1 << 1, + FlagFwdDecl = 1 << 2, + FlagAppleBlock = 1 << 3 }; protected: - DIType(GlobalVariable *GV, unsigned Tag) : DIDescriptor(GV, Tag) {} + DIType(MDNode *N, unsigned Tag) + : DIDescriptor(N, Tag) {} // This ctor is used when the Tag has already been validated by a derived // ctor. - DIType(GlobalVariable *GV, bool, bool) : DIDescriptor(GV) {} + DIType(MDNode *N, bool, bool) : DIDescriptor(N) {} public: /// isDerivedType - Return true if the specified tag is legal for @@ -198,7 +202,7 @@ namespace llvm { /// Verify - Verify that a type descriptor is well formed. bool Verify() const; public: - explicit DIType(GlobalVariable *GV); + explicit DIType(MDNode *N); explicit DIType() {} virtual ~DIType() {} @@ -214,14 +218,18 @@ namespace llvm { // carry this is just plain insane. uint64_t getOffsetInBits() const { return getUInt64Field(7); } unsigned getFlags() const { return getUnsignedField(8); } - bool isPrivate() const { return - (getFlags() & FlagPrivate) != 0; + bool isPrivate() const { + return (getFlags() & FlagPrivate) != 0; } - bool isProtected() const { + bool isProtected() const { return (getFlags() & FlagProtected) != 0; } - bool isForwardDecl() const { - return (getFlags() & FlagFwdDecl) != 0; + bool isForwardDecl() const { + return (getFlags() & FlagFwdDecl) != 0; + } + // isAppleBlock - Return true if this is the Apple Blocks extension. + bool isAppleBlockExtension() const { + return (getFlags() & FlagAppleBlock) != 0; } /// dump - print type. @@ -231,8 +239,8 @@ namespace llvm { /// DIBasicType - A basic type, like 'int' or 'float'. class DIBasicType : public DIType { public: - explicit DIBasicType(GlobalVariable *GV) - : DIType(GV, dwarf::DW_TAG_base_type) {} + explicit DIBasicType(MDNode *N = 0) + : DIType(N, dwarf::DW_TAG_base_type) {} unsigned getEncoding() const { return getUnsignedField(9); } @@ -244,13 +252,13 @@ namespace llvm { /// a typedef, a pointer or reference, etc. class DIDerivedType : public DIType { protected: - explicit DIDerivedType(GlobalVariable *GV, bool, bool) - : DIType(GV, true, true) {} + explicit DIDerivedType(MDNode *N, bool, bool) + : DIType(N, true, true) {} public: - explicit DIDerivedType(GlobalVariable *GV) - : DIType(GV, true, true) { - if (GV && !isDerivedType(getTag())) - DbgGV = 0; + explicit DIDerivedType(MDNode *N = 0) + : DIType(N, true, true) { + if (DbgNode && !isDerivedType(getTag())) + DbgNode = 0; } DIType getTypeDerivedFrom() const { return getFieldAs(9); } @@ -272,10 +280,10 @@ namespace llvm { /// FIXME: Why is this a DIDerivedType?? class DICompositeType : public DIDerivedType { public: - explicit DICompositeType(GlobalVariable *GV) - : DIDerivedType(GV, true, true) { - if (GV && !isCompositeType(getTag())) - DbgGV = 0; + explicit DICompositeType(MDNode *N = 0) + : DIDerivedType(N, true, true) { + if (N && !isCompositeType(getTag())) + DbgNode = 0; } DIArray getTypeArray() const { return getFieldAs(10); } @@ -291,8 +299,8 @@ namespace llvm { /// DIGlobal - This is a common class for global variables and subprograms. class DIGlobal : public DIDescriptor { protected: - explicit DIGlobal(GlobalVariable *GV, unsigned RequiredTag) - : DIDescriptor(GV, RequiredTag) {} + explicit DIGlobal(MDNode *N, unsigned RequiredTag) + : DIDescriptor(N, RequiredTag) {} /// isSubprogram - Return true if the specified tag is legal for /// DISubprogram. @@ -335,8 +343,8 @@ namespace llvm { /// DISubprogram - This is a wrapper for a subprogram (e.g. a function). class DISubprogram : public DIGlobal { public: - explicit DISubprogram(GlobalVariable *GV = 0) - : DIGlobal(GV, dwarf::DW_TAG_subprogram) {} + explicit DISubprogram(MDNode *N = 0) + : DIGlobal(N, dwarf::DW_TAG_subprogram) {} DICompositeType getType() const { return getFieldAs(8); } @@ -346,7 +354,7 @@ namespace llvm { DICompositeType DCT(getFieldAs(8)); if (!DCT.isNull()) { DIArray A = DCT.getTypeArray(); - DIType T(A.getElement(0).getGV()); + DIType T(A.getElement(0).getNode()); return T.getName(F); } DIType T(getFieldAs(8)); @@ -367,8 +375,8 @@ namespace llvm { /// DIGlobalVariable - This is a wrapper for a global variable. class DIGlobalVariable : public DIGlobal { public: - explicit DIGlobalVariable(GlobalVariable *GV = 0) - : DIGlobal(GV, dwarf::DW_TAG_variable) {} + explicit DIGlobalVariable(MDNode *N = 0) + : DIGlobal(N, dwarf::DW_TAG_variable) {} GlobalVariable *getGlobal() const { return getGlobalVariableField(11); } @@ -383,10 +391,10 @@ namespace llvm { /// global etc). class DIVariable : public DIDescriptor { public: - explicit DIVariable(GlobalVariable *GV = 0) - : DIDescriptor(GV) { - if (GV && !isVariable(getTag())) - DbgGV = 0; + explicit DIVariable(MDNode *N = 0) + : DIDescriptor(N) { + if (DbgNode && !isVariable(getTag())) + DbgNode = 0; } DIDescriptor getContext() const { return getDescriptorField(1); } @@ -410,8 +418,8 @@ namespace llvm { /// DIBlock - This is a wrapper for a block (e.g. a function, scope, etc). class DIBlock : public DIDescriptor { public: - explicit DIBlock(GlobalVariable *GV = 0) - : DIDescriptor(GV, dwarf::DW_TAG_lexical_block) {} + explicit DIBlock(MDNode *N = 0) + : DIDescriptor(N, dwarf::DW_TAG_lexical_block) {} DIDescriptor getContext() const { return getDescriptorField(1); } }; @@ -538,10 +546,6 @@ namespace llvm { private: Constant *GetTagConstant(unsigned TAG); - Constant *GetStringConstant(const std::string &String); - - /// getCastToEmpty - Return the descriptor as a Constant* with type '{}*'. - Constant *getCastToEmpty(DIDescriptor D); }; /// Finds the stoppoint coressponding to this instruction, that is the @@ -603,7 +607,6 @@ namespace llvm { /// isInlinedFnEnd - Return true if REI is ending an inlined function. bool isInlinedFnEnd(DbgRegionEndInst &REI, const Function *CurrentFn); - /// DebugInfoFinder - This object collects DebugInfo from a module. class DebugInfoFinder { @@ -647,7 +650,7 @@ namespace llvm { bool addType(DIType DT); public: - typedef SmallVector::iterator iterator; + typedef SmallVector::iterator iterator; iterator compile_unit_begin() { return CUs.begin(); } iterator compile_unit_end() { return CUs.end(); } iterator subprogram_begin() { return SPs.begin(); } @@ -663,12 +666,11 @@ namespace llvm { unsigned type_count() { return TYs.size(); } private: - SmallVector CUs; // Compile Units - SmallVector SPs; // Subprograms - SmallVector GVs; // Global Variables - SmallVector TYs; // Types - SmallPtrSet NodesSeen; - + SmallVector CUs; // Compile Units + SmallVector SPs; // Subprograms + SmallVector GVs; // Global Variables; + SmallVector TYs; // Types + SmallPtrSet NodesSeen; }; } // end namespace llvm diff --git a/libclamav/c++/llvm/include/llvm/Analysis/Dominators.h b/libclamav/c++/llvm/include/llvm/Analysis/Dominators.h index 412f8ccf6..7622326ce 100644 --- a/libclamav/c++/llvm/include/llvm/Analysis/Dominators.h +++ b/libclamav/c++/llvm/include/llvm/Analysis/Dominators.h @@ -82,12 +82,12 @@ public: typedef typename std::vector *>::iterator iterator; typedef typename std::vector *>::const_iterator const_iterator; - + iterator begin() { return Children.begin(); } iterator end() { return Children.end(); } const_iterator begin() const { return Children.begin(); } const_iterator end() const { return Children.end(); } - + NodeT *getBlock() const { return TheBB; } DomTreeNodeBase *getIDom() const { return IDom; } const std::vector*> &getChildren() const { @@ -96,7 +96,7 @@ public: DomTreeNodeBase(NodeT *BB, DomTreeNodeBase *iDom) : TheBB(BB), IDom(iDom), DFSNumIn(-1), DFSNumOut(-1) { } - + DomTreeNodeBase *addChild(DomTreeNodeBase *C) { Children.push_back(C); return C; @@ -109,7 +109,7 @@ public: void clearAllChildren() { Children.clear(); } - + bool compare(DomTreeNodeBase *Other) { if (getNumChildren() != Other->getNumChildren()) return true; @@ -143,7 +143,7 @@ public: IDom->Children.push_back(this); } } - + /// getDFSNumIn/getDFSNumOut - These are an internal implementation detail, do /// not call them. unsigned getDFSNumIn() const { return DFSNumIn; } @@ -167,9 +167,9 @@ static raw_ostream &operator<<(raw_ostream &o, WriteAsOperand(o, Node->getBlock(), false); else o << " <>"; - + o << " {" << Node->getDFSNumIn() << "," << Node->getDFSNumOut() << "}"; - + return o << "\n"; } @@ -233,7 +233,7 @@ protected: Vertex.clear(); RootNode = 0; } - + // NewBB is split and now it has one successor. Update dominator tree to // reflect this change. template @@ -320,7 +320,7 @@ public: DomTreeNodeBase* MyNd = I->second; DomTreeNodeBase* OtherNd = OI->second; - + if (MyNd->compare(OtherNd)) return true; } @@ -352,7 +352,7 @@ public: /// Note that this is not a constant time operation! /// bool properlyDominates(const DomTreeNodeBase *A, - DomTreeNodeBase *B) const { + const DomTreeNodeBase *B) const { if (A == 0 || B == 0) return false; return dominatedBySlowTreeWalk(A, B); } @@ -378,12 +378,12 @@ public: && "This is not implemented for post dominators"); return dominates(&A->getParent()->front(), A); } - + /// dominates - Returns true iff A dominates B. Note that this is not a /// constant time operation! /// inline bool dominates(const DomTreeNodeBase *A, - DomTreeNodeBase *B) { + const DomTreeNodeBase *B) { if (B == A) return true; // A node trivially dominates itself. @@ -407,10 +407,10 @@ public: inline bool dominates(NodeT *A, NodeT *B) { if (A == B) return true; - + return dominates(getNode(A), getNode(B)); } - + NodeT *getRoot() const { assert(this->Roots.size() == 1 && "Should always have entry node!"); return this->Roots[0]; @@ -522,7 +522,7 @@ public: assert(getNode(BB) && "Removing node that isn't in dominator tree."); DomTreeNodes.erase(BB); } - + /// splitBlock - BB is split and now it has one successor. Update dominator /// tree to reflect this change. void splitBlock(NodeT* NewBB) { @@ -546,7 +546,7 @@ public: PrintDomTree(getRootNode(), o, 1); } - + protected: template friend void Compress(DominatorTreeBase& DT, @@ -561,16 +561,16 @@ protected: friend void Link(DominatorTreeBase& DT, unsigned DFSNumV, typename GraphT::NodeType* W, typename DominatorTreeBase::InfoRec &WInfo); - + template friend unsigned DFSPass(DominatorTreeBase& DT, typename GraphT::NodeType* V, unsigned N); - + template friend void Calculate(DominatorTreeBase::NodeType>& DT, FuncT& F); - + /// updateDFSNumbers - Assign In and Out numbers to the nodes while walking /// dominator tree in dfs order. void updateDFSNumbers() { @@ -598,17 +598,17 @@ protected: // Otherwise, recursively visit this child. DomTreeNodeBase *Child = *ChildIt; ++WorkStack.back().second; - + WorkStack.push_back(std::make_pair(Child, Child->begin())); Child->DFSNumIn = DFSNum++; } } } - + SlowQueries = 0; DFSInfoValid = true; } - + DomTreeNodeBase *getNodeForBlock(NodeT *BB) { typename DomTreeNodeMapType::iterator I = this->DomTreeNodes.find(BB); if (I != this->DomTreeNodes.end() && I->second) @@ -626,31 +626,31 @@ protected: DomTreeNodeBase *C = new DomTreeNodeBase(BB, IDomNode); return this->DomTreeNodes[BB] = IDomNode->addChild(C); } - + inline NodeT *getIDom(NodeT *BB) const { typename DenseMap::const_iterator I = IDoms.find(BB); return I != IDoms.end() ? I->second : 0; } - + inline void addRoot(NodeT* BB) { this->Roots.push_back(BB); } - + public: /// recalculate - compute a dominator tree for the given function template void recalculate(FT& F) { if (!this->IsPostDominators) { reset(); - + // Initialize roots this->Roots.push_back(&F.front()); this->IDoms[&F.front()] = 0; this->DomTreeNodes[&F.front()] = 0; this->Vertex.push_back(0); - + Calculate(*this, F); - + updateDFSNumbers(); } else { reset(); // Reset from the last time we were run... @@ -667,7 +667,7 @@ public: } this->Vertex.push_back(0); - + Calculate >(*this, F); } } @@ -683,18 +683,18 @@ class DominatorTree : public FunctionPass { public: static char ID; // Pass ID, replacement for typeid DominatorTreeBase* DT; - + DominatorTree() : FunctionPass(&ID) { DT = new DominatorTreeBase(false); } - + ~DominatorTree() { DT->releaseMemory(); delete DT; } - + DominatorTreeBase& getBase() { return *DT; } - + /// getRoots - Return the root blocks of the current CFG. This may include /// multiple blocks if we are computing post dominators. For forward /// dominators, this will always be a single block (the entry node). @@ -702,11 +702,11 @@ public: inline const std::vector &getRoots() const { return DT->getRoots(); } - + inline BasicBlock *getRoot() const { return DT->getRoot(); } - + inline DomTreeNode *getRootNode() const { return DT->getRootNode(); } @@ -716,10 +716,10 @@ public: inline bool compare(DominatorTree &Other) const { DomTreeNode *R = getRootNode(); DomTreeNode *OtherR = Other.getRootNode(); - + if (!R || !OtherR || R->getBlock() != OtherR->getBlock()) return true; - + if (DT->compare(Other.getBase())) return true; @@ -727,19 +727,19 @@ public: } virtual bool runOnFunction(Function &F); - + virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.setPreservesAll(); } - + inline bool dominates(DomTreeNode* A, DomTreeNode* B) const { return DT->dominates(A, B); } - + inline bool dominates(BasicBlock* A, BasicBlock* B) const { return DT->dominates(A, B); } - + // dominates - Return true if A dominates B. This performs the // special checks necessary if A and B are in the same basic block. bool dominates(Instruction *A, Instruction *B) const { @@ -763,72 +763,73 @@ public: // return &*I == B; //} } - - inline bool properlyDominates(const DomTreeNode* A, DomTreeNode* B) const { + + inline bool properlyDominates(const DomTreeNode* A, + const DomTreeNode* B) const { return DT->properlyDominates(A, B); } - + inline bool properlyDominates(BasicBlock* A, BasicBlock* B) const { return DT->properlyDominates(A, B); } - + /// findNearestCommonDominator - Find nearest common dominator basic block /// for basic block A and B. If there is no such block then return NULL. inline BasicBlock *findNearestCommonDominator(BasicBlock *A, BasicBlock *B) { return DT->findNearestCommonDominator(A, B); } - + inline DomTreeNode *operator[](BasicBlock *BB) const { return DT->getNode(BB); } - + /// getNode - return the (Post)DominatorTree node for the specified basic /// block. This is the same as using operator[] on this class. /// inline DomTreeNode *getNode(BasicBlock *BB) const { return DT->getNode(BB); } - + /// addNewBlock - Add a new node to the dominator tree information. This /// creates a new node as a child of DomBB dominator node,linking it into /// the children list of the immediate dominator. inline DomTreeNode *addNewBlock(BasicBlock *BB, BasicBlock *DomBB) { return DT->addNewBlock(BB, DomBB); } - + /// changeImmediateDominator - This method is used to update the dominator /// tree information when a node's immediate dominator changes. /// inline void changeImmediateDominator(BasicBlock *N, BasicBlock* NewIDom) { DT->changeImmediateDominator(N, NewIDom); } - + inline void changeImmediateDominator(DomTreeNode *N, DomTreeNode* NewIDom) { DT->changeImmediateDominator(N, NewIDom); } - + /// eraseNode - Removes a node from the dominator tree. Block must not /// domiante any other blocks. Removes node from its immediate dominator's /// children list. Deletes dominator node associated with basic block BB. inline void eraseNode(BasicBlock *BB) { DT->eraseNode(BB); } - + /// splitBlock - BB is split and now it has one successor. Update dominator /// tree to reflect this change. inline void splitBlock(BasicBlock* NewBB) { DT->splitBlock(NewBB); } - + bool isReachableFromEntry(BasicBlock* A) { return DT->isReachableFromEntry(A); } - - + + virtual void releaseMemory() { DT->releaseMemory(); } - + virtual void print(raw_ostream &OS, const Module* M= 0) const; }; @@ -839,7 +840,7 @@ public: template <> struct GraphTraits { typedef DomTreeNode NodeType; typedef NodeType::iterator ChildIteratorType; - + static NodeType *getEntryNode(NodeType *N) { return N; } @@ -871,7 +872,7 @@ protected: DomSetMapType Frontiers; std::vector Roots; const bool IsPostDominators; - + public: DominanceFrontierBase(void *ID, bool isPostDom) : FunctionPass(ID), IsPostDominators(isPostDom) {} @@ -881,7 +882,7 @@ public: /// dominators, this will always be a single block (the entry node). /// inline const std::vector &getRoots() const { return Roots; } - + /// isPostDominator - Returns true if analysis based of postdoms /// bool isPostDominator() const { return IsPostDominators; } diff --git a/libclamav/c++/llvm/include/llvm/Analysis/IntervalIterator.h b/libclamav/c++/llvm/include/llvm/Analysis/IntervalIterator.h index 551bb7243..d842840b6 100644 --- a/libclamav/c++/llvm/include/llvm/Analysis/IntervalIterator.h +++ b/libclamav/c++/llvm/include/llvm/Analysis/IntervalIterator.h @@ -233,7 +233,8 @@ private: }; typedef IntervalIterator function_interval_iterator; -typedef IntervalIterator interval_part_interval_iterator; +typedef IntervalIterator + interval_part_interval_iterator; inline function_interval_iterator intervals_begin(Function *F, diff --git a/libclamav/c++/llvm/include/llvm/Analysis/LoopInfo.h b/libclamav/c++/llvm/include/llvm/Analysis/LoopInfo.h index a31ace76e..b8617c134 100644 --- a/libclamav/c++/llvm/include/llvm/Analysis/LoopInfo.h +++ b/libclamav/c++/llvm/include/llvm/Analysis/LoopInfo.h @@ -213,7 +213,6 @@ public: } /// getExitEdges - Return all pairs of (_inside_block_,_outside_block_). - /// (Modelled after getExitingBlocks().) typedef std::pair Edge; void getExitEdges(SmallVectorImpl &ExitEdges) const { // Sort the blocks vector so that we can use binary search to do quick @@ -782,11 +781,8 @@ public: // loop can be found for them. // for (typename std::vector::iterator I = L->Blocks.begin(), - E = L->Blocks.end(); I != E; ++I) { - typename std::map::iterator BBMI = BBMap.find(*I); - if (BBMI == BBMap.end()) // Not in map yet... - BBMap.insert(BBMI, std::make_pair(*I, L)); // Must be at this level - } + E = L->Blocks.end(); I != E; ++I) + BBMap.insert(std::make_pair(*I, L)); // Now that we have a list of all of the child loops of this loop, check to // see if any of them should actually be nested inside of each other. We diff --git a/libclamav/c++/llvm/include/llvm/Analysis/Passes.h b/libclamav/c++/llvm/include/llvm/Analysis/Passes.h index e5b86e867..e68765310 100644 --- a/libclamav/c++/llvm/include/llvm/Analysis/Passes.h +++ b/libclamav/c++/llvm/include/llvm/Analysis/Passes.h @@ -72,6 +72,13 @@ namespace llvm { /// FunctionPass *createLibCallAliasAnalysisPass(LibCallInfo *LCI); + //===--------------------------------------------------------------------===// + // + // createScalarEvolutionAliasAnalysisPass - This pass implements a simple + // alias analysis using ScalarEvolution queries. + // + FunctionPass *createScalarEvolutionAliasAnalysisPass(); + //===--------------------------------------------------------------------===// // // createAndersensPass - This pass implements Andersen's interprocedural alias diff --git a/libclamav/c++/llvm/include/llvm/Analysis/ProfileInfo.h b/libclamav/c++/llvm/include/llvm/Analysis/ProfileInfo.h index 9b692515f..16bfc1351 100644 --- a/libclamav/c++/llvm/include/llvm/Analysis/ProfileInfo.h +++ b/libclamav/c++/llvm/include/llvm/Analysis/ProfileInfo.h @@ -29,6 +29,7 @@ namespace llvm { class Function; class Pass; + class raw_ostream; /// ProfileInfo Class - This class holds and maintains profiling /// information for some unit of code. @@ -36,20 +37,21 @@ namespace llvm { public: // Types for handling profiling information. typedef std::pair Edge; - typedef std::map EdgeCounts; + typedef std::pair EdgeWeight; + typedef std::map EdgeWeights; typedef std::map BlockCounts; protected: - // EdgeCounts - Count the number of times a transition between two blocks is - // executed. As a special case, we also hold an edge from the null - // BasicBlock to the entry block to indicate how many times the function was - // entered. - std::map EdgeInformation; + // EdgeInformation - Count the number of times a transition between two + // blocks is executed. As a special case, we also hold an edge from the + // null BasicBlock to the entry block to indicate how many times the + // function was entered. + std::map EdgeInformation; - // BlockCounts - Count the number of times a block is executed. + // BlockInformation - Count the number of times a block is executed. std::map BlockInformation; - // FunctionCounts - Count the number of times a function is executed. + // FunctionInformation - Count the number of times a function is executed. std::map FunctionInformation; public: static char ID; // Class identification, replacement for typeinfo @@ -57,7 +59,7 @@ namespace llvm { // MissingValue - The value that is returned for execution counts in case // no value is available. - static const int MissingValue = -1; + static const double MissingValue; // getFunction() - Returns the Function for an Edge, checking for validity. static const Function* getFunction(Edge e) { @@ -66,7 +68,7 @@ namespace llvm { } // getEdge() - Creates an Edge from two BasicBlocks. - static Edge getEdge(const BasicBlock* Src, const BasicBlock* Dest) { + static Edge getEdge(const BasicBlock *Src, const BasicBlock *Dest) { return std::make_pair(Src, Dest); } @@ -78,16 +80,20 @@ namespace llvm { double getExecutionCount(const BasicBlock *BB); double getEdgeWeight(Edge e) const { - std::map::const_iterator J = + std::map::const_iterator J = EdgeInformation.find(getFunction(e)); if (J == EdgeInformation.end()) return MissingValue; - EdgeCounts::const_iterator I = J->second.find(e); + EdgeWeights::const_iterator I = J->second.find(e); if (I == J->second.end()) return MissingValue; return I->second; } + EdgeWeights &getEdgeWeights (const Function *F) { + return EdgeInformation[F]; + } + //===------------------------------------------------------------------===// /// Analysis Update Methods /// @@ -98,6 +104,9 @@ namespace llvm { /// profiling information for the module from the specified filename, making /// it available to the optimizers. Pass *createProfileLoaderPass(const std::string &Filename); + + raw_ostream& operator<<(raw_ostream &O, ProfileInfo::Edge E); + } // End llvm namespace #endif diff --git a/libclamav/c++/llvm/include/llvm/Analysis/ValueTracking.h b/libclamav/c++/llvm/include/llvm/Analysis/ValueTracking.h index 1ebd9c26c..6bb3b3c98 100644 --- a/libclamav/c++/llvm/include/llvm/Analysis/ValueTracking.h +++ b/libclamav/c++/llvm/include/llvm/Analysis/ValueTracking.h @@ -30,14 +30,14 @@ namespace llvm { /// bit sets. This code only analyzes bits in Mask, in order to short-circuit /// processing. void ComputeMaskedBits(Value *V, const APInt &Mask, APInt &KnownZero, - APInt &KnownOne, TargetData *TD = 0, + APInt &KnownOne, const TargetData *TD = 0, unsigned Depth = 0); /// MaskedValueIsZero - Return true if 'V & Mask' is known to be zero. We use /// this predicate to simplify operations downstream. Mask is known to be /// zero for bits that V cannot have. bool MaskedValueIsZero(Value *V, const APInt &Mask, - TargetData *TD = 0, unsigned Depth = 0); + const TargetData *TD = 0, unsigned Depth = 0); /// ComputeNumSignBits - Return the number of times the sign bit of the @@ -48,7 +48,7 @@ namespace llvm { /// /// 'Op' must have a scalar integer type. /// - unsigned ComputeNumSignBits(Value *Op, TargetData *TD = 0, + unsigned ComputeNumSignBits(Value *Op, const TargetData *TD = 0, unsigned Depth = 0); /// CannotBeNegativeZero - Return true if we can prove that the specified FP diff --git a/libclamav/c++/llvm/include/llvm/Attributes.h b/libclamav/c++/llvm/include/llvm/Attributes.h index 49f6057f3..0bbdc349b 100644 --- a/libclamav/c++/llvm/include/llvm/Attributes.h +++ b/libclamav/c++/llvm/include/llvm/Attributes.h @@ -57,7 +57,8 @@ const Attributes NoCapture = 1<<21; ///< Function creates no aliases of pointer const Attributes NoRedZone = 1<<22; /// disable redzone const Attributes NoImplicitFloat = 1<<23; /// disable implicit floating point /// instructions. -const Attributes Naked = 1<<24; ///< Naked function +const Attributes Naked = 1<<24; ///< Naked function +const Attributes InlineHint = 1<<25; ///< source said inlining was desirable /// @brief Attributes that only apply to function parameters. const Attributes ParameterOnly = ByVal | Nest | StructRet | NoCapture; @@ -66,7 +67,7 @@ const Attributes ParameterOnly = ByVal | Nest | StructRet | NoCapture; /// be used on return values or function parameters. const Attributes FunctionOnly = NoReturn | NoUnwind | ReadNone | ReadOnly | NoInline | AlwaysInline | OptimizeForSize | StackProtect | StackProtectReq | - NoRedZone | NoImplicitFloat | Naked; + NoRedZone | NoImplicitFloat | Naked | InlineHint; /// @brief Parameter attributes that do not apply to vararg call arguments. const Attributes VarArgsIncompatible = StructRet; diff --git a/libclamav/c++/llvm/include/llvm/AutoUpgrade.h b/libclamav/c++/llvm/include/llvm/AutoUpgrade.h index f61bd1a08..0a81c8079 100644 --- a/libclamav/c++/llvm/include/llvm/AutoUpgrade.h +++ b/libclamav/c++/llvm/include/llvm/AutoUpgrade.h @@ -15,6 +15,7 @@ #define LLVM_AUTOUPGRADE_H namespace llvm { + class Module; class Function; class CallInst; @@ -34,6 +35,9 @@ namespace llvm { /// so that it can update all calls to the old function. void UpgradeCallsToIntrinsic(Function* F); + /// This function checks debug info intrinsics. If an intrinsic is invalid + /// then this function simply removes the intrinsic. + void CheckDebugInfoIntrinsics(Module *M); } // End llvm namespace #endif diff --git a/libclamav/c++/llvm/include/llvm/BasicBlock.h b/libclamav/c++/llvm/include/llvm/BasicBlock.h index 3ba4e360f..3f535076e 100644 --- a/libclamav/c++/llvm/include/llvm/BasicBlock.h +++ b/libclamav/c++/llvm/include/llvm/BasicBlock.h @@ -47,7 +47,7 @@ template<> struct ilist_traits Instruction *ensureHead(Instruction*) const { return createSentinel(); } static void noteHead(Instruction*, Instruction*) {} private: - mutable ilist_node Sentinel; + mutable ilist_half_node Sentinel; }; /// This represents a single basic block in LLVM. A basic block is simply a diff --git a/libclamav/c++/llvm/include/llvm/Bitcode/BitstreamReader.h b/libclamav/c++/llvm/include/llvm/Bitcode/BitstreamReader.h index 83d2350fe..779ef5fa2 100644 --- a/libclamav/c++/llvm/include/llvm/Bitcode/BitstreamReader.h +++ b/libclamav/c++/llvm/include/llvm/Bitcode/BitstreamReader.h @@ -17,6 +17,7 @@ #include "llvm/Bitcode/BitCodes.h" #include +#include #include namespace llvm { diff --git a/libclamav/c++/llvm/include/llvm/CallGraphSCCPass.h b/libclamav/c++/llvm/include/llvm/CallGraphSCCPass.h index 85e83e50f..fc9feda5b 100644 --- a/libclamav/c++/llvm/include/llvm/CallGraphSCCPass.h +++ b/libclamav/c++/llvm/include/llvm/CallGraphSCCPass.h @@ -46,7 +46,10 @@ struct CallGraphSCCPass : public Pass { /// non-recursive (or only self-recursive) functions will have an SCC size of /// 1, where recursive portions of the call graph will have SCC size > 1. /// - virtual bool runOnSCC(const std::vector &SCC) = 0; + /// SCC passes that add or delete functions to the SCC are required to update + /// the SCC list, otherwise stale pointers may be dereferenced. + /// + virtual bool runOnSCC(std::vector &SCC) = 0; /// doFinalization - This method is called after the SCC's of the program has /// been processed, allowing the pass to do final cleanup as necessary. diff --git a/libclamav/c++/llvm/include/llvm/CodeGen/AsmPrinter.h b/libclamav/c++/llvm/include/llvm/CodeGen/AsmPrinter.h index 55fc3b0da..621b47d21 100644 --- a/libclamav/c++/llvm/include/llvm/CodeGen/AsmPrinter.h +++ b/libclamav/c++/llvm/include/llvm/CodeGen/AsmPrinter.h @@ -268,7 +268,8 @@ namespace llvm { void EOL() const; void EOL(const std::string &Comment) const; void EOL(const char* Comment) const; - + void EOL(const char *Comment, unsigned Encoding) const; + /// EmitULEB128Bytes - Emit an assembler byte data directive to compose an /// unsigned leb128 value. void EmitULEB128Bytes(unsigned Value) const; diff --git a/libclamav/c++/llvm/include/llvm/CodeGen/DwarfWriter.h b/libclamav/c++/llvm/include/llvm/CodeGen/DwarfWriter.h index 9ae76686d..3635c4d8e 100644 --- a/libclamav/c++/llvm/include/llvm/CodeGen/DwarfWriter.h +++ b/libclamav/c++/llvm/include/llvm/CodeGen/DwarfWriter.h @@ -33,7 +33,7 @@ class MachineFunction; class MachineInstr; class Value; class Module; -class GlobalVariable; +class MDNode; class MCAsmInfo; class raw_ostream; class Instruction; @@ -88,17 +88,17 @@ public: unsigned RecordSourceLine(unsigned Line, unsigned Col, DICompileUnit CU); /// RecordRegionStart - Indicate the start of a region. - unsigned RecordRegionStart(GlobalVariable *V); + unsigned RecordRegionStart(MDNode *N); /// RecordRegionEnd - Indicate the end of a region. - unsigned RecordRegionEnd(GlobalVariable *V); + unsigned RecordRegionEnd(MDNode *N); /// getRecordSourceLineCount - Count source lines. unsigned getRecordSourceLineCount(); /// RecordVariable - Indicate the declaration of a local variable. /// - void RecordVariable(GlobalVariable *GV, unsigned FrameIndex); + void RecordVariable(MDNode *N, unsigned FrameIndex); /// ShouldEmitDwarfDebug - Returns true if Dwarf debugging declarations should /// be emitted. diff --git a/libclamav/c++/llvm/include/llvm/CodeGen/MachineBasicBlock.h b/libclamav/c++/llvm/include/llvm/CodeGen/MachineBasicBlock.h index 9b989b230..2a9e86a04 100644 --- a/libclamav/c++/llvm/include/llvm/CodeGen/MachineBasicBlock.h +++ b/libclamav/c++/llvm/include/llvm/CodeGen/MachineBasicBlock.h @@ -26,7 +26,7 @@ class raw_ostream; template <> struct ilist_traits : public ilist_default_traits { private: - mutable ilist_node Sentinel; + mutable ilist_half_node Sentinel; // this is only set by the MachineBasicBlock owning the LiveList friend class MachineBasicBlock; diff --git a/libclamav/c++/llvm/include/llvm/CodeGen/MachineFunction.h b/libclamav/c++/llvm/include/llvm/CodeGen/MachineFunction.h index 51200cb2b..ce0a208c7 100644 --- a/libclamav/c++/llvm/include/llvm/CodeGen/MachineFunction.h +++ b/libclamav/c++/llvm/include/llvm/CodeGen/MachineFunction.h @@ -38,7 +38,7 @@ class TargetRegisterClass; template <> struct ilist_traits : public ilist_default_traits { - mutable ilist_node Sentinel; + mutable ilist_half_node Sentinel; public: MachineBasicBlock *createSentinel() const { return static_cast(&Sentinel); @@ -327,7 +327,7 @@ public: /// getOrCreateDebugLocID - Look up the DebugLocTuple index with the given /// source file, line, and column. If none currently exists, create a new /// DebugLocTuple, and insert it into the DebugIdMap. - unsigned getOrCreateDebugLocID(GlobalVariable *CompileUnit, + unsigned getOrCreateDebugLocID(MDNode *CompileUnit, unsigned Line, unsigned Col); /// getDebugLocTuple - Get the DebugLocTuple for a given DebugLoc object. diff --git a/libclamav/c++/llvm/include/llvm/CodeGen/MachineRegisterInfo.h b/libclamav/c++/llvm/include/llvm/CodeGen/MachineRegisterInfo.h index 80c37b39c..18e60200b 100644 --- a/libclamav/c++/llvm/include/llvm/CodeGen/MachineRegisterInfo.h +++ b/libclamav/c++/llvm/include/llvm/CodeGen/MachineRegisterInfo.h @@ -16,7 +16,6 @@ #include "llvm/Target/TargetRegisterInfo.h" #include "llvm/ADT/BitVector.h" -#include "llvm/ADT/iterator.h" #include namespace llvm { @@ -256,7 +255,7 @@ public: /// returns end(). template class defusechain_iterator - : public forward_iterator { + : public std::iterator { MachineOperand *Op; explicit defusechain_iterator(MachineOperand *op) : Op(op) { // If the first node isn't one we're interested in, advance to one that @@ -269,8 +268,10 @@ public: } friend class MachineRegisterInfo; public: - typedef forward_iterator::reference reference; - typedef forward_iterator::pointer pointer; + typedef std::iterator::reference reference; + typedef std::iterator::pointer pointer; defusechain_iterator(const defusechain_iterator &I) : Op(I.Op) {} defusechain_iterator() : Op(0) {} diff --git a/libclamav/c++/llvm/include/llvm/CodeGen/ScheduleDAG.h b/libclamav/c++/llvm/include/llvm/CodeGen/ScheduleDAG.h index f820200f9..af309486a 100644 --- a/libclamav/c++/llvm/include/llvm/CodeGen/ScheduleDAG.h +++ b/libclamav/c++/llvm/include/llvm/CodeGen/ScheduleDAG.h @@ -434,8 +434,8 @@ namespace llvm { class ScheduleDAG { public: - MachineBasicBlock *BB; // The block in which to insert instructions. - MachineBasicBlock::iterator InsertPos;// The position to insert instructions. + MachineBasicBlock *BB; // The block in which to insert instructions + MachineBasicBlock::iterator InsertPos;// The position to insert instructions const TargetMachine &TM; // Target processor const TargetInstrInfo *TII; // Target instruction information const TargetRegisterInfo *TRI; // Target processor register info @@ -506,8 +506,8 @@ namespace llvm { /// virtual void Schedule() = 0; - /// ForceUnitLatencies - Return true if all scheduling edges should be given a - /// latency value of one. The default is to return false; schedulers may + /// ForceUnitLatencies - Return true if all scheduling edges should be given + /// a latency value of one. The default is to return false; schedulers may /// override this as needed. virtual bool ForceUnitLatencies() const { return false; } @@ -535,7 +535,8 @@ namespace llvm { void EmitLiveInCopies(MachineBasicBlock *MBB); }; - class SUnitIterator : public forward_iterator { + class SUnitIterator : public std::iterator { SUnit *Node; unsigned Operand; @@ -547,7 +548,7 @@ namespace llvm { bool operator!=(const SUnitIterator& x) const { return !operator==(x); } const SUnitIterator &operator=(const SUnitIterator &I) { - assert(I.Node == Node && "Cannot assign iterators to two different nodes!"); + assert(I.Node==Node && "Cannot assign iterators to two different nodes!"); Operand = I.Operand; return *this; } diff --git a/libclamav/c++/llvm/include/llvm/CodeGen/SelectionDAG.h b/libclamav/c++/llvm/include/llvm/CodeGen/SelectionDAG.h index 5f5498158..7ce869050 100644 --- a/libclamav/c++/llvm/include/llvm/CodeGen/SelectionDAG.h +++ b/libclamav/c++/llvm/include/llvm/CodeGen/SelectionDAG.h @@ -37,7 +37,7 @@ class FunctionLoweringInfo; template<> struct ilist_traits : public ilist_default_traits { private: - mutable ilist_node Sentinel; + mutable ilist_half_node Sentinel; public: SDNode *createSentinel() const { return static_cast(&Sentinel); @@ -322,7 +322,7 @@ public: SDValue getValueType(EVT); SDValue getRegister(unsigned Reg, EVT VT); SDValue getDbgStopPoint(DebugLoc DL, SDValue Root, - unsigned Line, unsigned Col, Value *CU); + unsigned Line, unsigned Col, MDNode *CU); SDValue getLabel(unsigned Opcode, DebugLoc dl, SDValue Root, unsigned LabelID); diff --git a/libclamav/c++/llvm/include/llvm/CodeGen/SelectionDAGNodes.h b/libclamav/c++/llvm/include/llvm/CodeGen/SelectionDAGNodes.h index a5fb08f32..c42ff3850 100644 --- a/libclamav/c++/llvm/include/llvm/CodeGen/SelectionDAGNodes.h +++ b/libclamav/c++/llvm/include/llvm/CodeGen/SelectionDAGNodes.h @@ -22,7 +22,6 @@ #include "llvm/Constants.h" #include "llvm/ADT/FoldingSet.h" #include "llvm/ADT/GraphTraits.h" -#include "llvm/ADT/iterator.h" #include "llvm/ADT/ilist_node.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/STLExtras.h" @@ -292,7 +291,7 @@ namespace ISD { EXTRACT_SUBVECTOR, /// VECTOR_SHUFFLE(VEC1, VEC2) - Returns a vector, of the same type as - /// VEC1/VEC2. A VECTOR_SHUFFLE node also contains an array of constant int + /// VEC1/VEC2. A VECTOR_SHUFFLE node also contains an array of constant int /// values that indicate which value (or undef) each result element will /// get. These constant ints are accessible through the /// ShuffleVectorSDNode class. This is quite similar to the Altivec @@ -1129,14 +1128,16 @@ public: /// use_iterator - This class provides iterator support for SDUse /// operands that use a specific SDNode. class use_iterator - : public forward_iterator { + : public std::iterator { SDUse *Op; explicit use_iterator(SDUse *op) : Op(op) { } friend class SDNode; public: - typedef forward_iterator::reference reference; - typedef forward_iterator::pointer pointer; + typedef std::iterator::reference reference; + typedef std::iterator::pointer pointer; use_iterator(const use_iterator &I) : Op(I.Op) {} use_iterator() : Op(0) {} @@ -2015,10 +2016,10 @@ class DbgStopPointSDNode : public SDNode { SDUse Chain; unsigned Line; unsigned Column; - Value *CU; + MDNode *CU; friend class SelectionDAG; DbgStopPointSDNode(SDValue ch, unsigned l, unsigned c, - Value *cu) + MDNode *cu) : SDNode(ISD::DBG_STOPPOINT, DebugLoc::getUnknownLoc(), getSDVTList(MVT::Other)), Line(l), Column(c), CU(cu) { InitOperands(&Chain, ch); @@ -2026,7 +2027,7 @@ class DbgStopPointSDNode : public SDNode { public: unsigned getLine() const { return Line; } unsigned getColumn() const { return Column; } - Value *getCompileUnit() const { return CU; } + MDNode *getCompileUnit() const { return CU; } static bool classof(const DbgStopPointSDNode *) { return true; } static bool classof(const SDNode *N) { @@ -2354,7 +2355,8 @@ public: }; -class SDNodeIterator : public forward_iterator { +class SDNodeIterator : public std::iterator { SDNode *Node; unsigned Operand; diff --git a/libclamav/c++/llvm/include/llvm/CompilerDriver/CompilationGraph.h b/libclamav/c++/llvm/include/llvm/CompilerDriver/CompilationGraph.h index 825d4c40f..3daafd58a 100644 --- a/libclamav/c++/llvm/include/llvm/CompilerDriver/CompilationGraph.h +++ b/libclamav/c++/llvm/include/llvm/CompilerDriver/CompilationGraph.h @@ -18,7 +18,6 @@ #include "llvm/ADT/GraphTraits.h" #include "llvm/ADT/IntrusiveRefCntPtr.h" -#include "llvm/ADT/iterator.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringMap.h" #include "llvm/ADT/StringSet.h" @@ -242,7 +241,8 @@ namespace llvmc { /// NodeChildIterator - Another auxiliary class needed by GraphTraits. - class NodeChildIterator : public bidirectional_iterator { + class NodeChildIterator : public + std::iterator { typedef NodeChildIterator ThisType; typedef Node::container_type::iterator iterator; diff --git a/libclamav/c++/llvm/include/llvm/Config/config.h.cmake b/libclamav/c++/llvm/include/llvm/Config/config.h.cmake index 626da4d91..360ca5d9c 100644 --- a/libclamav/c++/llvm/include/llvm/Config/config.h.cmake +++ b/libclamav/c++/llvm/include/llvm/Config/config.h.cmake @@ -425,9 +425,6 @@ /* Define to 1 if you have the header file. */ #cmakedefine HAVE_WINDOWS_H ${HAVE_WINDOWS_H} -/* Define to 1 for ilist sentinel compaction */ -#cmakedefine LLVM_COMPACT_SENTINELS ${LLVM_COMPACT_SENTINELS} - /* Installation directory for binary executables */ #undef LLVM_BINDIR diff --git a/libclamav/c++/llvm/include/llvm/Config/config.h.in b/libclamav/c++/llvm/include/llvm/Config/config.h.in index 6a28326cd..f32f4038f 100644 --- a/libclamav/c++/llvm/include/llvm/Config/config.h.in +++ b/libclamav/c++/llvm/include/llvm/Config/config.h.in @@ -3,6 +3,14 @@ /* Define if dlopen(0) will open the symbols of the program */ #undef CAN_DLOPEN_SELF +/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP + systems. This function is required for `alloca.c' support on those systems. + */ +#undef CRAY_STACKSEG_END + +/* Define to 1 if using `alloca.c'. */ +#undef C_ALLOCA + /* Define if CBE is enabled for printf %a output */ #undef ENABLE_CBE_PRINTF_A @@ -12,6 +20,13 @@ /* Define if threads enabled */ #undef ENABLE_THREADS +/* Define to 1 if you have `alloca', as a function or macro. */ +#undef HAVE_ALLOCA + +/* Define to 1 if you have and it should be used (not on Ultrix). + */ +#undef HAVE_ALLOCA_H + /* Define to 1 if you have the `argz_append' function. */ #undef HAVE_ARGZ_APPEND @@ -446,9 +461,6 @@ /* Installation directory for binary executables */ #undef LLVM_BINDIR -/* Define to 1 for ilist sentinel compaction */ -#undef LLVM_COMPACT_SENTINELS - /* Time at which LLVM was configured */ #undef LLVM_CONFIGTIME diff --git a/libclamav/c++/llvm/include/llvm/Function.h b/libclamav/c++/llvm/include/llvm/Function.h index 90d9b0ee4..7ff18b376 100644 --- a/libclamav/c++/llvm/include/llvm/Function.h +++ b/libclamav/c++/llvm/include/llvm/Function.h @@ -45,7 +45,7 @@ template<> struct ilist_traits static ValueSymbolTable *getSymTab(Function *ItemParent); private: - mutable ilist_node Sentinel; + mutable ilist_half_node Sentinel; }; template<> struct ilist_traits @@ -62,7 +62,7 @@ template<> struct ilist_traits static ValueSymbolTable *getSymTab(Function *ItemParent); private: - mutable ilist_node Sentinel; + mutable ilist_half_node Sentinel; }; class Function : public GlobalValue, diff --git a/libclamav/c++/llvm/include/llvm/InstrTypes.h b/libclamav/c++/llvm/include/llvm/InstrTypes.h index 35fec63dd..35d7534e5 100644 --- a/libclamav/c++/llvm/include/llvm/InstrTypes.h +++ b/libclamav/c++/llvm/include/llvm/InstrTypes.h @@ -53,7 +53,7 @@ protected: virtual void setSuccessorV(unsigned idx, BasicBlock *B) = 0; public: - virtual Instruction *clone(LLVMContext &Context) const = 0; + virtual TerminatorInst *clone(LLVMContext &Context) const = 0; /// getNumSuccessors - Return the number of successors that this terminator /// has. @@ -90,7 +90,6 @@ public: class UnaryInstruction : public Instruction { void *operator new(size_t, unsigned); // Do not implement - UnaryInstruction(const UnaryInstruction&); // Do not implement protected: UnaryInstruction(const Type *Ty, unsigned iType, Value *V, @@ -315,12 +314,6 @@ DEFINE_TRANSPARENT_OPERAND_ACCESSORS(BinaryOperator, Value) /// if (isa(Instr)) { ... } /// @brief Base class of casting instructions. class CastInst : public UnaryInstruction { - /// @brief Copy constructor - CastInst(const CastInst &CI) - : UnaryInstruction(CI.getType(), CI.getOpcode(), CI.getOperand(0)) { - } - /// @brief Do not allow default construction - CastInst(); protected: /// @brief Constructor with insert-before-instruction semantics for subclasses CastInst(const Type *Ty, unsigned iType, Value *S, @@ -613,7 +606,7 @@ public: /// instruction into a BasicBlock right before the specified instruction. /// The specified Instruction is allowed to be a dereferenced end iterator. /// @brief Create a CmpInst - static CmpInst *Create(LLVMContext &Context, OtherOps Op, + static CmpInst *Create(OtherOps Op, unsigned short predicate, Value *S1, Value *S2, const Twine &Name = "", Instruction *InsertBefore = 0); diff --git a/libclamav/c++/llvm/include/llvm/Instruction.h b/libclamav/c++/llvm/include/llvm/Instruction.h index 924b19554..189c34a50 100644 --- a/libclamav/c++/llvm/include/llvm/Instruction.h +++ b/libclamav/c++/llvm/include/llvm/Instruction.h @@ -54,6 +54,11 @@ public: /// extra information (e.g. load is volatile) agree. bool isIdenticalTo(const Instruction *I) const; + /// isIdenticalToWhenDefined - This is like isIdenticalTo, except that it + /// ignores the SubclassOptionalData flags, which specify conditions + /// under which the instruction's result is undefined. + bool isIdenticalToWhenDefined(const Instruction *I) const; + /// This function determines if the specified instruction executes the same /// operation as the current one. This means that the opcodes, type, operand /// types and any other factors affecting the operation must be the same. This diff --git a/libclamav/c++/llvm/include/llvm/Instructions.h b/libclamav/c++/llvm/include/llvm/Instructions.h index 33af5bcd7..4460f8890 100644 --- a/libclamav/c++/llvm/include/llvm/Instructions.h +++ b/libclamav/c++/llvm/include/llvm/Instructions.h @@ -78,7 +78,7 @@ public: unsigned getAlignment() const { return (1u << SubclassData) >> 1; } void setAlignment(unsigned Align); - virtual Instruction *clone(LLVMContext &Context) const = 0; + virtual AllocationInst *clone(LLVMContext &Context) const = 0; // Methods for support type inquiry through isa, cast, and dyn_cast: static inline bool classof(const AllocationInst *) { return true; } @@ -99,7 +99,6 @@ public: /// MallocInst - an instruction to allocated memory on the heap /// class MallocInst : public AllocationInst { - MallocInst(const MallocInst &MI); public: explicit MallocInst(const Type *Ty, Value *ArraySize = 0, const Twine &NameStr = "", @@ -148,7 +147,6 @@ public: /// AllocaInst - an instruction to allocate memory on the stack /// class AllocaInst : public AllocationInst { - AllocaInst(const AllocaInst &); public: explicit AllocaInst(const Type *Ty, Value *ArraySize = 0, @@ -234,16 +232,6 @@ public: /// SubclassData field in Value to store whether or not the load is volatile. /// class LoadInst : public UnaryInstruction { - - LoadInst(const LoadInst &LI) - : UnaryInstruction(LI.getType(), Load, LI.getOperand(0)) { - setVolatile(LI.isVolatile()); - setAlignment(LI.getAlignment()); - -#ifndef NDEBUG - AssertOK(); -#endif - } void AssertOK(); public: LoadInst(Value *Ptr, const Twine &NameStr, Instruction *InsertBefore); @@ -289,6 +277,11 @@ public: const Value *getPointerOperand() const { return getOperand(0); } static unsigned getPointerOperandIndex() { return 0U; } + unsigned getPointerAddressSpace() const { + return cast(getPointerOperand()->getType())->getAddressSpace(); + } + + // Methods for support type inquiry through isa, cast, and dyn_cast: static inline bool classof(const LoadInst *) { return true; } static inline bool classof(const Instruction *I) { @@ -308,18 +301,6 @@ public: /// class StoreInst : public Instruction { void *operator new(size_t, unsigned); // DO NOT IMPLEMENT - - StoreInst(const StoreInst &SI) : Instruction(SI.getType(), Store, - &Op<0>(), 2) { - Op<0>() = SI.Op<0>(); - Op<1>() = SI.Op<1>(); - setVolatile(SI.isVolatile()); - setAlignment(SI.getAlignment()); - -#ifndef NDEBUG - AssertOK(); -#endif - } void AssertOK(); public: // allocate space for exactly two operands @@ -365,6 +346,10 @@ public: const Value *getPointerOperand() const { return getOperand(1); } static unsigned getPointerOperandIndex() { return 1U; } + unsigned getPointerAddressSpace() const { + return cast(getPointerOperand()->getType())->getAddressSpace(); + } + // Methods for support type inquiry through isa, cast, and dyn_cast: static inline bool classof(const StoreInst *) { return true; } static inline bool classof(const Instruction *I) { @@ -585,6 +570,10 @@ public: static unsigned getPointerOperandIndex() { return 0U; // get index for modifying correct operand } + + unsigned getPointerAddressSpace() const { + return cast(getType())->getAddressSpace(); + } /// getPointerOperandType - Method to return the pointer operand as a /// PointerType. @@ -720,7 +709,6 @@ public: /// @brief Constructor with no-insertion semantics ICmpInst( - LLVMContext &Context, ///< Context to construct within Predicate pred, ///< The predicate to use for the comparison Value *LHS, ///< The left-hand-side of the expression Value *RHS, ///< The right-hand-side of the expression @@ -891,7 +879,6 @@ public: /// @brief Constructor with no-insertion semantics FCmpInst( - LLVMContext &Context, ///< Context to build in Predicate pred, ///< The predicate to use for the comparison Value *LHS, ///< The left-hand-side of the expression Value *RHS, ///< The right-hand-side of the expression @@ -1196,10 +1183,6 @@ class SelectInst : public Instruction { Op<2>() = S2; } - SelectInst(const SelectInst &SI) - : Instruction(SI.getType(), SI.getOpcode(), &Op<0>(), 3) { - init(SI.Op<0>(), SI.Op<1>(), SI.Op<2>()); - } SelectInst(Value *C, Value *S1, Value *S2, const Twine &NameStr, Instruction *InsertBefore) : Instruction(S1->getType(), Instruction::Select, @@ -1267,8 +1250,6 @@ DEFINE_TRANSPARENT_OPERAND_ACCESSORS(SelectInst, Value) /// an argument of the specified type given a va_list and increments that list /// class VAArgInst : public UnaryInstruction { - VAArgInst(const VAArgInst &VAA) - : UnaryInstruction(VAA.getType(), VAArg, VAA.getOperand(0)) {} public: VAArgInst(Value *List, const Type *Ty, const Twine &NameStr = "", Instruction *InsertBefore = 0) @@ -1301,21 +1282,11 @@ public: /// element from a VectorType value /// class ExtractElementInst : public Instruction { - ExtractElementInst(const ExtractElementInst &EE) : - Instruction(EE.getType(), ExtractElement, &Op<0>(), 2) { - Op<0>() = EE.Op<0>(); - Op<1>() = EE.Op<1>(); - } - ExtractElementInst(Value *Vec, Value *Idx, const Twine &NameStr = "", Instruction *InsertBefore = 0); ExtractElementInst(Value *Vec, Value *Idx, const Twine &NameStr, BasicBlock *InsertAtEnd); public: - static ExtractElementInst *Create(const ExtractElementInst &EE) { - return new(EE.getNumOperands()) ExtractElementInst(EE); - } - static ExtractElementInst *Create(Value *Vec, Value *Idx, const Twine &NameStr = "", Instruction *InsertBefore = 0) { @@ -1360,16 +1331,12 @@ DEFINE_TRANSPARENT_OPERAND_ACCESSORS(ExtractElementInst, Value) /// element into a VectorType value /// class InsertElementInst : public Instruction { - InsertElementInst(const InsertElementInst &IE); InsertElementInst(Value *Vec, Value *NewElt, Value *Idx, const Twine &NameStr = "", Instruction *InsertBefore = 0); InsertElementInst(Value *Vec, Value *NewElt, Value *Idx, const Twine &NameStr, BasicBlock *InsertAtEnd); public: - static InsertElementInst *Create(const InsertElementInst &IE) { - return new(IE.getNumOperands()) InsertElementInst(IE); - } static InsertElementInst *Create(Value *Vec, Value *NewElt, Value *Idx, const Twine &NameStr = "", Instruction *InsertBefore = 0) { @@ -1421,7 +1388,6 @@ DEFINE_TRANSPARENT_OPERAND_ACCESSORS(InsertElementInst, Value) /// input vectors. /// class ShuffleVectorInst : public Instruction { - ShuffleVectorInst(const ShuffleVectorInst &IE); public: // allocate space for exactly three operands void *operator new(size_t s) { @@ -2658,10 +2624,6 @@ private: /// @brief This class represents a truncation of integer types. class TruncInst : public CastInst { - /// Private copy constructor - TruncInst(const TruncInst &CI) - : CastInst(CI.getType(), Trunc, CI.getOperand(0)) { - } public: /// @brief Constructor with insert-before-instruction semantics TruncInst( @@ -2680,7 +2642,7 @@ public: ); /// @brief Clone an identical TruncInst - virtual CastInst *clone(LLVMContext &Context) const; + virtual TruncInst *clone(LLVMContext &Context) const; /// @brief Methods for support type inquiry through isa, cast, and dyn_cast: static inline bool classof(const TruncInst *) { return true; } @@ -2698,10 +2660,6 @@ public: /// @brief This class represents zero extension of integer types. class ZExtInst : public CastInst { - /// @brief Private copy constructor - ZExtInst(const ZExtInst &CI) - : CastInst(CI.getType(), ZExt, CI.getOperand(0)) { - } public: /// @brief Constructor with insert-before-instruction semantics ZExtInst( @@ -2720,7 +2678,7 @@ public: ); /// @brief Clone an identical ZExtInst - virtual CastInst *clone(LLVMContext &Context) const; + virtual ZExtInst *clone(LLVMContext &Context) const; /// @brief Methods for support type inquiry through isa, cast, and dyn_cast: static inline bool classof(const ZExtInst *) { return true; } @@ -2738,10 +2696,6 @@ public: /// @brief This class represents a sign extension of integer types. class SExtInst : public CastInst { - /// @brief Private copy constructor - SExtInst(const SExtInst &CI) - : CastInst(CI.getType(), SExt, CI.getOperand(0)) { - } public: /// @brief Constructor with insert-before-instruction semantics SExtInst( @@ -2760,7 +2714,7 @@ public: ); /// @brief Clone an identical SExtInst - virtual CastInst *clone(LLVMContext &Context) const; + virtual SExtInst *clone(LLVMContext &Context) const; /// @brief Methods for support type inquiry through isa, cast, and dyn_cast: static inline bool classof(const SExtInst *) { return true; } @@ -2778,9 +2732,6 @@ public: /// @brief This class represents a truncation of floating point types. class FPTruncInst : public CastInst { - FPTruncInst(const FPTruncInst &CI) - : CastInst(CI.getType(), FPTrunc, CI.getOperand(0)) { - } public: /// @brief Constructor with insert-before-instruction semantics FPTruncInst( @@ -2799,7 +2750,7 @@ public: ); /// @brief Clone an identical FPTruncInst - virtual CastInst *clone(LLVMContext &Context) const; + virtual FPTruncInst *clone(LLVMContext &Context) const; /// @brief Methods for support type inquiry through isa, cast, and dyn_cast: static inline bool classof(const FPTruncInst *) { return true; } @@ -2817,9 +2768,6 @@ public: /// @brief This class represents an extension of floating point types. class FPExtInst : public CastInst { - FPExtInst(const FPExtInst &CI) - : CastInst(CI.getType(), FPExt, CI.getOperand(0)) { - } public: /// @brief Constructor with insert-before-instruction semantics FPExtInst( @@ -2838,7 +2786,7 @@ public: ); /// @brief Clone an identical FPExtInst - virtual CastInst *clone(LLVMContext &Context) const; + virtual FPExtInst *clone(LLVMContext &Context) const; /// @brief Methods for support type inquiry through isa, cast, and dyn_cast: static inline bool classof(const FPExtInst *) { return true; } @@ -2856,9 +2804,6 @@ public: /// @brief This class represents a cast unsigned integer to floating point. class UIToFPInst : public CastInst { - UIToFPInst(const UIToFPInst &CI) - : CastInst(CI.getType(), UIToFP, CI.getOperand(0)) { - } public: /// @brief Constructor with insert-before-instruction semantics UIToFPInst( @@ -2877,7 +2822,7 @@ public: ); /// @brief Clone an identical UIToFPInst - virtual CastInst *clone(LLVMContext &Context) const; + virtual UIToFPInst *clone(LLVMContext &Context) const; /// @brief Methods for support type inquiry through isa, cast, and dyn_cast: static inline bool classof(const UIToFPInst *) { return true; } @@ -2895,9 +2840,6 @@ public: /// @brief This class represents a cast from signed integer to floating point. class SIToFPInst : public CastInst { - SIToFPInst(const SIToFPInst &CI) - : CastInst(CI.getType(), SIToFP, CI.getOperand(0)) { - } public: /// @brief Constructor with insert-before-instruction semantics SIToFPInst( @@ -2916,7 +2858,7 @@ public: ); /// @brief Clone an identical SIToFPInst - virtual CastInst *clone(LLVMContext &Context) const; + virtual SIToFPInst *clone(LLVMContext &Context) const; /// @brief Methods for support type inquiry through isa, cast, and dyn_cast: static inline bool classof(const SIToFPInst *) { return true; } @@ -2934,9 +2876,6 @@ public: /// @brief This class represents a cast from floating point to unsigned integer class FPToUIInst : public CastInst { - FPToUIInst(const FPToUIInst &CI) - : CastInst(CI.getType(), FPToUI, CI.getOperand(0)) { - } public: /// @brief Constructor with insert-before-instruction semantics FPToUIInst( @@ -2955,7 +2894,7 @@ public: ); /// @brief Clone an identical FPToUIInst - virtual CastInst *clone(LLVMContext &Context) const; + virtual FPToUIInst *clone(LLVMContext &Context) const; /// @brief Methods for support type inquiry through isa, cast, and dyn_cast: static inline bool classof(const FPToUIInst *) { return true; } @@ -2973,9 +2912,6 @@ public: /// @brief This class represents a cast from floating point to signed integer. class FPToSIInst : public CastInst { - FPToSIInst(const FPToSIInst &CI) - : CastInst(CI.getType(), FPToSI, CI.getOperand(0)) { - } public: /// @brief Constructor with insert-before-instruction semantics FPToSIInst( @@ -2994,7 +2930,7 @@ public: ); /// @brief Clone an identical FPToSIInst - virtual CastInst *clone(LLVMContext &Context) const; + virtual FPToSIInst *clone(LLVMContext &Context) const; /// @brief Methods for support type inquiry through isa, cast, and dyn_cast: static inline bool classof(const FPToSIInst *) { return true; } @@ -3012,9 +2948,6 @@ public: /// @brief This class represents a cast from an integer to a pointer. class IntToPtrInst : public CastInst { - IntToPtrInst(const IntToPtrInst &CI) - : CastInst(CI.getType(), IntToPtr, CI.getOperand(0)) { - } public: /// @brief Constructor with insert-before-instruction semantics IntToPtrInst( @@ -3033,7 +2966,7 @@ public: ); /// @brief Clone an identical IntToPtrInst - virtual CastInst *clone(LLVMContext &Context) const; + virtual IntToPtrInst *clone(LLVMContext &Context) const; // Methods for support type inquiry through isa, cast, and dyn_cast: static inline bool classof(const IntToPtrInst *) { return true; } @@ -3051,9 +2984,6 @@ public: /// @brief This class represents a cast from a pointer to an integer class PtrToIntInst : public CastInst { - PtrToIntInst(const PtrToIntInst &CI) - : CastInst(CI.getType(), PtrToInt, CI.getOperand(0)) { - } public: /// @brief Constructor with insert-before-instruction semantics PtrToIntInst( @@ -3072,7 +3002,7 @@ public: ); /// @brief Clone an identical PtrToIntInst - virtual CastInst *clone(LLVMContext &Context) const; + virtual PtrToIntInst *clone(LLVMContext &Context) const; // Methods for support type inquiry through isa, cast, and dyn_cast: static inline bool classof(const PtrToIntInst *) { return true; } @@ -3090,9 +3020,6 @@ public: /// @brief This class represents a no-op cast from one type to another. class BitCastInst : public CastInst { - BitCastInst(const BitCastInst &CI) - : CastInst(CI.getType(), BitCast, CI.getOperand(0)) { - } public: /// @brief Constructor with insert-before-instruction semantics BitCastInst( @@ -3111,7 +3038,7 @@ public: ); /// @brief Clone an identical BitCastInst - virtual CastInst *clone(LLVMContext &Context) const; + virtual BitCastInst *clone(LLVMContext &Context) const; // Methods for support type inquiry through isa, cast, and dyn_cast: static inline bool classof(const BitCastInst *) { return true; } diff --git a/libclamav/c++/llvm/include/llvm/IntrinsicInst.h b/libclamav/c++/llvm/include/llvm/IntrinsicInst.h index b8480551b..a502cc27b 100644 --- a/libclamav/c++/llvm/include/llvm/IntrinsicInst.h +++ b/libclamav/c++/llvm/include/llvm/IntrinsicInst.h @@ -25,6 +25,7 @@ #define LLVM_INTRINSICINST_H #include "llvm/Constants.h" +#include "llvm/Metadata.h" #include "llvm/Function.h" #include "llvm/Instructions.h" #include "llvm/Intrinsics.h" @@ -85,8 +86,8 @@ namespace llvm { struct DbgStopPointInst : public DbgInfoIntrinsic { Value *getLineValue() const { return const_cast(getOperand(1)); } Value *getColumnValue() const { return const_cast(getOperand(2)); } - Value *getContext() const { - return StripCast(getOperand(3)); + MDNode *getContext() const { + return cast(getOperand(3)); } unsigned getLine() const { @@ -112,7 +113,7 @@ namespace llvm { /// DbgFuncStartInst - This represents the llvm.dbg.func.start instruction. /// struct DbgFuncStartInst : public DbgInfoIntrinsic { - Value *getSubprogram() const { return StripCast(getOperand(1)); } + MDNode *getSubprogram() const { return cast(getOperand(1)); } // Methods for support type inquiry through isa, cast, and dyn_cast: static inline bool classof(const DbgFuncStartInst *) { return true; } @@ -127,7 +128,7 @@ namespace llvm { /// DbgRegionStartInst - This represents the llvm.dbg.region.start /// instruction. struct DbgRegionStartInst : public DbgInfoIntrinsic { - Value *getContext() const { return StripCast(getOperand(1)); } + MDNode *getContext() const { return cast(getOperand(1)); } // Methods for support type inquiry through isa, cast, and dyn_cast: static inline bool classof(const DbgRegionStartInst *) { return true; } @@ -142,7 +143,7 @@ namespace llvm { /// DbgRegionEndInst - This represents the llvm.dbg.region.end instruction. /// struct DbgRegionEndInst : public DbgInfoIntrinsic { - Value *getContext() const { return StripCast(getOperand(1)); } + MDNode *getContext() const { return cast(getOperand(1)); } // Methods for support type inquiry through isa, cast, and dyn_cast: static inline bool classof(const DbgRegionEndInst *) { return true; } @@ -158,7 +159,7 @@ namespace llvm { /// struct DbgDeclareInst : public DbgInfoIntrinsic { Value *getAddress() const { return getOperand(1); } - Value *getVariable() const { return StripCast(getOperand(2)); } + MDNode *getVariable() const { return cast(getOperand(2)); } // Methods for support type inquiry through isa, cast, and dyn_cast: static inline bool classof(const DbgDeclareInst *) { return true; } diff --git a/libclamav/c++/llvm/include/llvm/Intrinsics.td b/libclamav/c++/llvm/include/llvm/Intrinsics.td index 552254f7b..9b0c876d7 100644 --- a/libclamav/c++/llvm/include/llvm/Intrinsics.td +++ b/libclamav/c++/llvm/include/llvm/Intrinsics.td @@ -110,6 +110,7 @@ def llvm_ptrptr_ty : LLVMPointerType; // i8** def llvm_anyptr_ty : LLVMAnyPointerType; // (space)i8* def llvm_empty_ty : LLVMType; // { } def llvm_descriptor_ty : LLVMPointerType; // { }* +def llvm_metadata_ty : LLVMType; // !{...} def llvm_v2i8_ty : LLVMType; // 2 x i8 def llvm_v4i8_ty : LLVMType; // 4 x i8 @@ -278,12 +279,12 @@ let Properties = [IntrNoMem] in { let Properties = [IntrNoMem] in { def int_dbg_stoppoint : Intrinsic<[llvm_void_ty], [llvm_i32_ty, llvm_i32_ty, - llvm_descriptor_ty]>; - def int_dbg_region_start : Intrinsic<[llvm_void_ty], [llvm_descriptor_ty]>; - def int_dbg_region_end : Intrinsic<[llvm_void_ty], [llvm_descriptor_ty]>; - def int_dbg_func_start : Intrinsic<[llvm_void_ty], [llvm_descriptor_ty]>; + llvm_metadata_ty]>; + def int_dbg_region_start : Intrinsic<[llvm_void_ty], [llvm_metadata_ty]>; + def int_dbg_region_end : Intrinsic<[llvm_void_ty], [llvm_metadata_ty]>; + def int_dbg_func_start : Intrinsic<[llvm_void_ty], [llvm_metadata_ty]>; def int_dbg_declare : Intrinsic<[llvm_void_ty], - [llvm_descriptor_ty, llvm_descriptor_ty]>; + [llvm_descriptor_ty, llvm_metadata_ty]>; } //===------------------ Exception Handling Intrinsics----------------------===// diff --git a/libclamav/c++/llvm/include/llvm/LinkAllPasses.h b/libclamav/c++/llvm/include/llvm/LinkAllPasses.h index 52bca9db6..347dba444 100644 --- a/libclamav/c++/llvm/include/llvm/LinkAllPasses.h +++ b/libclamav/c++/llvm/include/llvm/LinkAllPasses.h @@ -51,6 +51,7 @@ namespace { (void) llvm::createStructRetPromotionPass(); (void) llvm::createBasicAliasAnalysisPass(); (void) llvm::createLibCallAliasAnalysisPass(0); + (void) llvm::createScalarEvolutionAliasAnalysisPass(); (void) llvm::createBlockPlacementPass(); (void) llvm::createBlockProfilerPass(); (void) llvm::createBreakCriticalEdgesPass(); diff --git a/libclamav/c++/llvm/include/llvm/MC/MCAsmInfo.h b/libclamav/c++/llvm/include/llvm/MC/MCAsmInfo.h index f788c368a..a3959e504 100644 --- a/libclamav/c++/llvm/include/llvm/MC/MCAsmInfo.h +++ b/libclamav/c++/llvm/include/llvm/MC/MCAsmInfo.h @@ -16,12 +16,9 @@ #ifndef LLVM_TARGET_ASM_INFO_H #define LLVM_TARGET_ASM_INFO_H -#include "llvm/Support/DataTypes.h" #include namespace llvm { - template class SmallVectorImpl; - /// MCAsmInfo - This class is intended to be used as a base class for asm /// properties and features specific to the target. namespace ExceptionHandling { enum ExceptionsType { None, Dwarf, SjLj }; } @@ -34,7 +31,7 @@ namespace llvm { /// ZeroFillDirective - Directive for emitting a global to the ZeroFill /// section on this target. Null if this target doesn't support zerofill. - const char *ZeroFillDirective; // Default is null. + const char *ZeroFillDirective; // Default is null. /// NonexecutableStackDirective - Directive for declaring to the /// linker and beyond that the emitted code does not require stack @@ -50,77 +47,77 @@ namespace llvm { /// .long x-y /// is relocated if the relative locations of x and y change at linktime. /// We want both these things in different places. - bool NeedsSet; // Defaults to false. + bool NeedsSet; // Defaults to false. /// MaxInstLength - This is the maximum possible length of an instruction, /// which is needed to compute the size of an inline asm. - unsigned MaxInstLength; // Defaults to 4. + unsigned MaxInstLength; // Defaults to 4. /// PCSymbol - The symbol used to represent the current PC. Used in PC /// relative expressions. - const char *PCSymbol; // Defaults to "$". + const char *PCSymbol; // Defaults to "$". /// SeparatorChar - This character, if specified, is used to separate /// instructions from each other when on the same line. This is used to /// measure inline asm instructions. - char SeparatorChar; // Defaults to ';' + char SeparatorChar; // Defaults to ';' /// CommentColumn - This indicates the comment num (zero-based) at /// which asm comments should be printed. - unsigned CommentColumn; // Defaults to 60 + unsigned CommentColumn; // Defaults to 60 /// CommentString - This indicates the comment character used by the /// assembler. - const char *CommentString; // Defaults to "#" + const char *CommentString; // Defaults to "#" /// GlobalPrefix - If this is set to a non-empty string, it is prepended /// onto all global symbols. This is often used for "_" or ".". - const char *GlobalPrefix; // Defaults to "" + const char *GlobalPrefix; // Defaults to "" /// PrivateGlobalPrefix - This prefix is used for globals like constant /// pool entries that are completely private to the .s file and should not /// have names in the .o file. This is often "." or "L". - const char *PrivateGlobalPrefix; // Defaults to "." + const char *PrivateGlobalPrefix; // Defaults to "." /// LinkerPrivateGlobalPrefix - This prefix is used for symbols that should /// be passed through the assembler but be removed by the linker. This /// is "l" on Darwin, currently used for some ObjC metadata. - const char *LinkerPrivateGlobalPrefix; // Defaults to "" + const char *LinkerPrivateGlobalPrefix; // Defaults to "" /// JumpTableSpecialLabelPrefix - If not null, a extra (dead) label is /// emitted before jump tables with the specified prefix. - const char *JumpTableSpecialLabelPrefix; // Default to null. + const char *JumpTableSpecialLabelPrefix; // Default to null. /// GlobalVarAddrPrefix/Suffix - If these are nonempty, these strings /// will enclose any GlobalVariable (that isn't a function) /// - const char *GlobalVarAddrPrefix; // Defaults to "" - const char *GlobalVarAddrSuffix; // Defaults to "" + const char *GlobalVarAddrPrefix; // Defaults to "" + const char *GlobalVarAddrSuffix; // Defaults to "" /// FunctionAddrPrefix/Suffix - If these are nonempty, these strings /// will enclose any GlobalVariable that points to a function. /// - const char *FunctionAddrPrefix; // Defaults to "" - const char *FunctionAddrSuffix; // Defaults to "" + const char *FunctionAddrPrefix; // Defaults to "" + const char *FunctionAddrSuffix; // Defaults to "" /// PersonalityPrefix/Suffix - If these are nonempty, these strings will /// enclose any personality function in the common frame section. /// - const char *PersonalityPrefix; // Defaults to "" - const char *PersonalitySuffix; // Defaults to "" + const char *PersonalityPrefix; // Defaults to "" + const char *PersonalitySuffix; // Defaults to "" /// NeedsIndirectEncoding - If set, we need to set the indirect encoding bit /// for EH in Dwarf. /// - bool NeedsIndirectEncoding; // Defaults to false + bool NeedsIndirectEncoding; // Defaults to false /// InlineAsmStart/End - If these are nonempty, they contain a directive to /// emit before and after an inline assembly statement. - const char *InlineAsmStart; // Defaults to "#APP\n" - const char *InlineAsmEnd; // Defaults to "#NO_APP\n" + const char *InlineAsmStart; // Defaults to "#APP\n" + const char *InlineAsmEnd; // Defaults to "#NO_APP\n" /// AssemblerDialect - Which dialect of an assembler variant to use. - unsigned AssemblerDialect; // Defaults to 0 + unsigned AssemblerDialect; // Defaults to 0 /// AllowQuotesInName - This is true if the assembler allows for complex /// symbol names to be surrounded in quotes. This defaults to false. @@ -132,25 +129,25 @@ namespace llvm { /// number of zero bytes emitted to the current section. Common cases are /// "\t.zero\t" and "\t.space\t". If this is set to null, the /// Data*bitsDirective's will be used to emit zero bytes. - const char *ZeroDirective; // Defaults to "\t.zero\t" - const char *ZeroDirectiveSuffix; // Defaults to "" + const char *ZeroDirective; // Defaults to "\t.zero\t" + const char *ZeroDirectiveSuffix; // Defaults to "" /// AsciiDirective - This directive allows emission of an ascii string with /// the standard C escape characters embedded into it. - const char *AsciiDirective; // Defaults to "\t.ascii\t" + const char *AsciiDirective; // Defaults to "\t.ascii\t" /// AscizDirective - If not null, this allows for special handling of /// zero terminated strings on this target. This is commonly supported as /// ".asciz". If a target doesn't support this, it can be set to null. - const char *AscizDirective; // Defaults to "\t.asciz\t" + const char *AscizDirective; // Defaults to "\t.asciz\t" /// DataDirectives - These directives are used to output some unit of /// integer data to the current section. If a data directive is set to /// null, smaller data directives will be used to emit the large sizes. - const char *Data8bitsDirective; // Defaults to "\t.byte\t" - const char *Data16bitsDirective; // Defaults to "\t.short\t" - const char *Data32bitsDirective; // Defaults to "\t.long\t" - const char *Data64bitsDirective; // Defaults to "\t.quad\t" + const char *Data8bitsDirective; // Defaults to "\t.byte\t" + const char *Data16bitsDirective; // Defaults to "\t.short\t" + const char *Data32bitsDirective; // Defaults to "\t.long\t" + const char *Data64bitsDirective; // Defaults to "\t.quad\t" /// getDataASDirective - Return the directive that should be used to emit /// data of the specified size to the specified numeric address space. @@ -162,151 +159,144 @@ namespace llvm { /// SunStyleELFSectionSwitchSyntax - This is true if this target uses "Sun /// Style" syntax for section switching ("#alloc,#write" etc) instead of the /// normal ELF syntax (,"a,w") in .section directives. - bool SunStyleELFSectionSwitchSyntax; // Defaults to false. + bool SunStyleELFSectionSwitchSyntax; // Defaults to false. /// UsesELFSectionDirectiveForBSS - This is true if this target uses ELF /// '.section' directive before the '.bss' one. It's used for PPC/Linux /// which doesn't support the '.bss' directive only. - bool UsesELFSectionDirectiveForBSS; // Defaults to false. + bool UsesELFSectionDirectiveForBSS; // Defaults to false. //===--- Alignment Information ----------------------------------------===// /// AlignDirective - The directive used to emit round up to an alignment /// boundary. /// - const char *AlignDirective; // Defaults to "\t.align\t" + const char *AlignDirective; // Defaults to "\t.align\t" /// AlignmentIsInBytes - If this is true (the default) then the asmprinter /// emits ".align N" directives, where N is the number of bytes to align to. /// Otherwise, it emits ".align log2(N)", e.g. 3 to align to an 8 byte /// boundary. - bool AlignmentIsInBytes; // Defaults to true + bool AlignmentIsInBytes; // Defaults to true /// TextAlignFillValue - If non-zero, this is used to fill the executable /// space created as the result of a alignment directive. - unsigned TextAlignFillValue; + unsigned TextAlignFillValue; // Defaults to 0 //===--- Section Switching Directives ---------------------------------===// /// JumpTableDirective - if non-null, the directive to emit before jump /// table entries. FIXME: REMOVE THIS. - const char *JumpTableDirective; - const char *PICJumpTableDirective; + const char *JumpTableDirective; // Defaults to NULL. + const char *PICJumpTableDirective; // Defaults to NULL. //===--- Global Variable Emission Directives --------------------------===// /// GlobalDirective - This is the directive used to declare a global entity. /// - const char *GlobalDirective; // Defaults to NULL. + const char *GlobalDirective; // Defaults to NULL. /// ExternDirective - This is the directive used to declare external /// globals. /// - const char *ExternDirective; // Defaults to NULL. + const char *ExternDirective; // Defaults to NULL. /// SetDirective - This is the name of a directive that can be used to tell /// the assembler to set the value of a variable to some expression. - const char *SetDirective; // Defaults to null. + const char *SetDirective; // Defaults to null. /// LCOMMDirective - This is the name of a directive (if supported) that can /// be used to efficiently declare a local (internal) block of zero /// initialized data in the .bss/.data section. The syntax expected is: /// @verbatim SYMBOLNAME LENGTHINBYTES, ALIGNMENT /// @endverbatim - const char *LCOMMDirective; // Defaults to null. + const char *LCOMMDirective; // Defaults to null. - const char *COMMDirective; // Defaults to "\t.comm\t". + const char *COMMDirective; // Defaults to "\t.comm\t". /// COMMDirectiveTakesAlignment - True if COMMDirective take a third /// argument that specifies the alignment of the declaration. - bool COMMDirectiveTakesAlignment; // Defaults to true. + bool COMMDirectiveTakesAlignment; // Defaults to true. /// HasDotTypeDotSizeDirective - True if the target has .type and .size /// directives, this is true for most ELF targets. - bool HasDotTypeDotSizeDirective; // Defaults to true. + bool HasDotTypeDotSizeDirective; // Defaults to true. /// HasSingleParameterDotFile - True if the target has a single parameter /// .file directive, this is true for ELF targets. - bool HasSingleParameterDotFile; // Defaults to true. + bool HasSingleParameterDotFile; // Defaults to true. /// UsedDirective - This directive, if non-null, is used to declare a global /// as being used somehow that the assembler can't see. This prevents dead /// code elimination on some targets. - const char *UsedDirective; // Defaults to null. + const char *UsedDirective; // Defaults to NULL. /// WeakRefDirective - This directive, if non-null, is used to declare a /// global as being a weak undefined symbol. - const char *WeakRefDirective; // Defaults to null. + const char *WeakRefDirective; // Defaults to NULL. /// WeakDefDirective - This directive, if non-null, is used to declare a /// global as being a weak defined symbol. - const char *WeakDefDirective; // Defaults to null. + const char *WeakDefDirective; // Defaults to NULL. /// HiddenDirective - This directive, if non-null, is used to declare a /// global or function as having hidden visibility. - const char *HiddenDirective; // Defaults to "\t.hidden\t". + const char *HiddenDirective; // Defaults to "\t.hidden\t". /// ProtectedDirective - This directive, if non-null, is used to declare a /// global or function as having protected visibility. - const char *ProtectedDirective; // Defaults to "\t.protected\t". + const char *ProtectedDirective; // Defaults to "\t.protected\t". //===--- Dwarf Emission Directives -----------------------------------===// /// AbsoluteDebugSectionOffsets - True if we should emit abolute section - /// offsets for debug information. Defaults to false. - bool AbsoluteDebugSectionOffsets; + /// offsets for debug information. + bool AbsoluteDebugSectionOffsets; // Defaults to false. /// AbsoluteEHSectionOffsets - True if we should emit abolute section /// offsets for EH information. Defaults to false. bool AbsoluteEHSectionOffsets; /// HasLEB128 - True if target asm supports leb128 directives. - /// - bool HasLEB128; // Defaults to false. + bool HasLEB128; // Defaults to false. /// hasDotLocAndDotFile - True if target asm supports .loc and .file /// directives for emitting debugging information. - /// - bool HasDotLocAndDotFile; // Defaults to false. + bool HasDotLocAndDotFile; // Defaults to false. /// SupportsDebugInformation - True if target supports emission of debugging /// information. - bool SupportsDebugInformation; + bool SupportsDebugInformation; // Defaults to false. - /// SupportsExceptionHandling - True if target supports - /// exception handling. - /// - // Defaults to None - ExceptionHandling::ExceptionsType ExceptionsType; + /// SupportsExceptionHandling - True if target supports exception handling. + ExceptionHandling::ExceptionsType ExceptionsType; // Defaults to None /// RequiresFrameSection - true if the Dwarf2 output needs a frame section - /// - bool DwarfRequiresFrameSection; // Defaults to true. + bool DwarfRequiresFrameSection; // Defaults to true. /// DwarfUsesInlineInfoSection - True if DwarfDebugInlineSection is used to /// encode inline subroutine information. - bool DwarfUsesInlineInfoSection; // Defaults to false. + bool DwarfUsesInlineInfoSection; // Defaults to false. /// Is_EHSymbolPrivate - If set, the "_foo.eh" is made private so that it /// doesn't show up in the symbol table of the object file. - bool Is_EHSymbolPrivate; // Defaults to true. + bool Is_EHSymbolPrivate; // Defaults to true. /// GlobalEHDirective - This is the directive used to make exception frame /// tables globally visible. - /// - const char *GlobalEHDirective; // Defaults to NULL. + const char *GlobalEHDirective; // Defaults to NULL. /// SupportsWeakEmptyEHFrame - True if target assembler and linker will /// handle a weak_definition of constant 0 for an omitted EH frame. - bool SupportsWeakOmittedEHFrame; // Defaults to true. + bool SupportsWeakOmittedEHFrame; // Defaults to true. /// DwarfSectionOffsetDirective - Special section offset directive. const char* DwarfSectionOffsetDirective; // Defaults to NULL //===--- CBE Asm Translation Table -----------------------------------===// - const char *const *AsmTransCBE; // Defaults to empty + const char *const *AsmTransCBE; // Defaults to empty public: explicit MCAsmInfo(); diff --git a/libclamav/c++/llvm/include/llvm/MC/MCAsmParser.h b/libclamav/c++/llvm/include/llvm/MC/MCAsmParser.h index a6acf4e94..8c1b7b886 100644 --- a/libclamav/c++/llvm/include/llvm/MC/MCAsmParser.h +++ b/libclamav/c++/llvm/include/llvm/MC/MCAsmParser.h @@ -14,6 +14,8 @@ namespace llvm { class MCAsmLexer; +class MCContext; +class MCExpr; class MCValue; class SMLoc; class Twine; @@ -31,6 +33,8 @@ public: virtual MCAsmLexer &getLexer() = 0; + virtual MCContext &getContext() = 0; + /// Warning - Emit a warning at the location \arg L, with the message \arg /// Msg. virtual void Warning(SMLoc L, const Twine &Msg) = 0; @@ -42,6 +46,21 @@ public: /// clients. virtual bool Error(SMLoc L, const Twine &Msg) = 0; + /// ParseExpression - Parse an arbitrary expression. + /// + /// @param Res - The value of the expression. The result is undefined + /// on error. + /// @result - False on success. + virtual bool ParseExpression(const MCExpr *&Res) = 0; + + /// ParseParenExpression - Parse an arbitrary expression, assuming that an + /// initial '(' has already been consumed. + /// + /// @param Res - The value of the expression. The result is undefined + /// on error. + /// @result - False on success. + virtual bool ParseParenExpression(const MCExpr *&Res) = 0; + /// ParseAbsoluteExpression - Parse an expression which must evaluate to an /// absolute value. /// @@ -49,24 +68,6 @@ public: /// on error. /// @result - False on success. virtual bool ParseAbsoluteExpression(int64_t &Res) = 0; - - /// ParseRelocatableExpression - Parse an expression which must be - /// relocatable. - /// - /// @param Res - The relocatable expression value. The result is undefined on - /// error. - /// @result - False on success. - virtual bool ParseRelocatableExpression(MCValue &Res) = 0; - - /// ParseParenRelocatableExpression - Parse an expression which must be - /// relocatable, assuming that an initial '(' has already been consumed. - /// - /// @param Res - The relocatable expression value. The result is undefined on - /// error. - /// @result - False on success. - /// - /// @see ParseRelocatableExpression, ParseParenExpr. - virtual bool ParseParenRelocatableExpression(MCValue &Res) = 0; }; } // End llvm namespace diff --git a/libclamav/c++/llvm/include/llvm/MC/MCAssembler.h b/libclamav/c++/llvm/include/llvm/MC/MCAssembler.h index aae5f08ca..44fc2e16d 100644 --- a/libclamav/c++/llvm/include/llvm/MC/MCAssembler.h +++ b/libclamav/c++/llvm/include/llvm/MC/MCAssembler.h @@ -16,10 +16,12 @@ #include "llvm/MC/MCValue.h" #include "llvm/Support/Casting.h" #include "llvm/Support/DataTypes.h" +#include // FIXME: Shouldn't be needed. namespace llvm { class raw_ostream; class MCAssembler; +class MCContext; class MCSection; class MCSectionData; @@ -32,12 +34,16 @@ public: FT_Data, FT_Align, FT_Fill, - FT_Org + FT_Org, + FT_ZeroFill }; private: FragmentType Kind; + /// Parent - The data for the section this fragment is in. + MCSectionData *Parent; + /// @name Assembler Backend Data /// @{ // @@ -53,7 +59,7 @@ private: /// @} protected: - MCFragment(FragmentType _Kind, MCSectionData *SD = 0); + MCFragment(FragmentType _Kind, MCSectionData *_Parent = 0); public: // Only for sentinel. @@ -62,6 +68,9 @@ public: FragmentType getKind() const { return Kind; } + MCSectionData *getParent() const { return Parent; } + void setParent(MCSectionData *Value) { Parent = Value; } + // FIXME: This should be abstract, fix sentinel. virtual uint64_t getMaxFileSize() const { assert(0 && "Invalid getMaxFileSize call!"); @@ -73,7 +82,9 @@ public: // // FIXME: This could all be kept private to the assembler implementation. - unsigned getFileSize() const { + uint64_t getAddress() const; + + uint64_t getFileSize() const { assert(FileSize != ~UINT64_C(0) && "File size not set!"); return FileSize; } @@ -209,6 +220,7 @@ public: MCOrgFragment(MCValue _Offset, int8_t _Value, MCSectionData *SD = 0) : MCFragment(FT_Org, SD), Offset(_Offset), Value(_Value) {} + /// @name Accessors /// @{ @@ -229,6 +241,40 @@ public: static bool classof(const MCOrgFragment *) { return true; } }; +/// MCZeroFillFragment - Represent data which has a fixed size and alignment, +/// but requires no physical space in the object file. +class MCZeroFillFragment : public MCFragment { + /// Size - The size of this fragment. + uint64_t Size; + + /// Alignment - The alignment for this fragment. + unsigned Alignment; + +public: + MCZeroFillFragment(uint64_t _Size, unsigned _Alignment, MCSectionData *SD = 0) + : MCFragment(FT_ZeroFill, SD), + Size(_Size), Alignment(_Alignment) {} + + /// @name Accessors + /// @{ + + uint64_t getMaxFileSize() const { + // FIXME: This also doesn't make much sense, this method is misnamed. + return ~UINT64_C(0); + } + + uint64_t getSize() const { return Size; } + + unsigned getAlignment() const { return Alignment; } + + /// @} + + static bool classof(const MCFragment *F) { + return F->getKind() == MCFragment::FT_ZeroFill; + } + static bool classof(const MCZeroFillFragment *) { return true; } +}; + // FIXME: Should this be a separate class, or just merged into MCSection? Since // we anticipate the fast path being through an MCAssembler, the only reason to // keep it out is for API abstraction. @@ -237,14 +283,48 @@ class MCSectionData : public ilist_node { void operator=(const MCSectionData&); // DO NOT IMPLEMENT public: + /// Fixup - Represent a fixed size region of bytes inside some fragment which + /// needs to be rewritten. This region will either be rewritten by the + /// assembler or cause a relocation entry to be generated. + struct Fixup { + /// Fragment - The fragment containing the fixup. + MCFragment *Fragment; + + /// Offset - The offset inside the fragment which needs to be rewritten. + uint64_t Offset; + + /// Value - The expression to eventually write into the fragment. + // + // FIXME: We could probably get away with requiring the client to pass in an + // owned reference whose lifetime extends past that of the fixup. + MCValue Value; + + /// Size - The fixup size. + unsigned Size; + + /// FixedValue - The value to replace the fix up by. + // + // FIXME: This should not be here. + uint64_t FixedValue; + + public: + Fixup(MCFragment &_Fragment, uint64_t _Offset, const MCValue &_Value, + unsigned _Size) + : Fragment(&_Fragment), Offset(_Offset), Value(_Value), Size(_Size), + FixedValue(0) {} + }; + typedef iplist FragmentListType; typedef FragmentListType::const_iterator const_iterator; typedef FragmentListType::iterator iterator; + typedef std::vector::const_iterator const_fixup_iterator; + typedef std::vector::iterator fixup_iterator; + private: iplist Fragments; - const MCSection &Section; + const MCSection *Section; /// Alignment - The maximum alignment seen in this section. unsigned Alignment; @@ -254,10 +334,23 @@ private: // // FIXME: This could all be kept private to the assembler implementation. + /// Address - The computed address of this section. This is ~0 until + /// initialized. + uint64_t Address; + + /// Size - The content size of this section. This is ~0 until initialized. + uint64_t Size; + /// FileSize - The size of this section in the object file. This is ~0 until /// initialized. uint64_t FileSize; + /// LastFixupLookup - Cache for the last looked up fixup. + mutable unsigned LastFixupLookup; + + /// Fixups - The list of fixups in this section. + std::vector Fixups; + /// @} public: @@ -265,12 +358,12 @@ public: MCSectionData(); MCSectionData(const MCSection &Section, MCAssembler *A = 0); - const MCSection &getSection() const { return Section; } + const MCSection &getSection() const { return *Section; } unsigned getAlignment() const { return Alignment; } void setAlignment(unsigned Value) { Alignment = Value; } - /// @name Section List Access + /// @name Fragment Access /// @{ const FragmentListType &getFragmentList() const { return Fragments; } @@ -286,17 +379,57 @@ public: bool empty() const { return Fragments.empty(); } + /// @} + /// @name Fixup Access + /// @{ + + std::vector &getFixups() { + return Fixups; + } + + fixup_iterator fixup_begin() { + return Fixups.begin(); + } + + fixup_iterator fixup_end() { + return Fixups.end(); + } + + size_t fixup_size() const { return Fixups.size(); } + /// @} /// @name Assembler Backend Support /// @{ // // FIXME: This could all be kept private to the assembler implementation. - unsigned getFileSize() const { + /// LookupFixup - Look up the fixup for the given \arg Fragment and \arg + /// Offset. + /// + /// If multiple fixups exist for the same fragment and offset it is undefined + /// which one is returned. + // + // FIXME: This isn't horribly slow in practice, but there are much nicer + // solutions to applying the fixups. + const Fixup *LookupFixup(const MCFragment *Fragment, uint64_t Offset) const; + + uint64_t getAddress() const { + assert(Address != ~UINT64_C(0) && "Address not set!"); + return Address; + } + void setAddress(uint64_t Value) { Address = Value; } + + uint64_t getSize() const { + assert(Size != ~UINT64_C(0) && "File size not set!"); + return Size; + } + void setSize(uint64_t Value) { Size = Value; } + + uint64_t getFileSize() const { assert(FileSize != ~UINT64_C(0) && "File size not set!"); return FileSize; } - void setFileSize(uint64_t Value) { FileSize = Value; } + void setFileSize(uint64_t Value) { FileSize = Value; } /// @} }; @@ -304,7 +437,7 @@ public: // FIXME: Same concerns as with SectionData. class MCSymbolData : public ilist_node { public: - MCSymbol &Symbol; + const MCSymbol &Symbol; /// Fragment - The fragment this symbol's value is relative to, if any. MCFragment *Fragment; @@ -320,20 +453,34 @@ public: /// IsPrivateExtern - True if this symbol is private extern. unsigned IsPrivateExtern : 1; + /// CommonSize - The size of the symbol, if it is 'common', or 0. + // + // FIXME: Pack this in with other fields? We could put it in offset, since a + // common symbol can never get a definition. + uint64_t CommonSize; + + /// CommonAlign - The alignment of the symbol, if it is 'common'. + // + // FIXME: Pack this in with other fields? + unsigned CommonAlign; + /// Flags - The Flags field is used by object file implementations to store /// additional per symbol information which is not easily classified. uint32_t Flags; + /// Index - Index field, for use by the object file implementation. + uint64_t Index; + public: // Only for use as sentinel. MCSymbolData(); - MCSymbolData(MCSymbol &_Symbol, MCFragment *_Fragment, uint64_t _Offset, + MCSymbolData(const MCSymbol &_Symbol, MCFragment *_Fragment, uint64_t _Offset, MCAssembler *A = 0); /// @name Accessors /// @{ - MCSymbol &getSymbol() const { return Symbol; } + const MCSymbol &getSymbol() const { return Symbol; } MCFragment *getFragment() const { return Fragment; } void setFragment(MCFragment *Value) { Fragment = Value; } @@ -350,16 +497,52 @@ public: bool isPrivateExtern() const { return IsPrivateExtern; } void setPrivateExtern(bool Value) { IsPrivateExtern = Value; } - + + /// isCommon - Is this a 'common' symbol. + bool isCommon() const { return CommonSize != 0; } + + /// setCommon - Mark this symbol as being 'common'. + /// + /// \param Size - The size of the symbol. + /// \param Align - The alignment of the symbol. + void setCommon(uint64_t Size, unsigned Align) { + CommonSize = Size; + CommonAlign = Align; + } + + /// getCommonSize - Return the size of a 'common' symbol. + uint64_t getCommonSize() const { + assert(isCommon() && "Not a 'common' symbol!"); + return CommonSize; + } + + /// getCommonAlignment - Return the alignment of a 'common' symbol. + unsigned getCommonAlignment() const { + assert(isCommon() && "Not a 'common' symbol!"); + return CommonAlign; + } + /// getFlags - Get the (implementation defined) symbol flags. uint32_t getFlags() const { return Flags; } /// setFlags - Set the (implementation defined) symbol flags. void setFlags(uint32_t Value) { Flags = Value; } + /// getIndex - Get the (implementation defined) index. + uint64_t getIndex() const { return Index; } + + /// setIndex - Set the (implementation defined) index. + void setIndex(uint64_t Value) { Index = Value; } + /// @} }; +// FIXME: This really doesn't belong here. See comments below. +struct IndirectSymbolData { + MCSymbol *Symbol; + MCSectionData *SectionData; +}; + class MCAssembler { public: typedef iplist SectionDataListType; @@ -371,16 +554,24 @@ public: typedef SymbolDataListType::const_iterator const_symbol_iterator; typedef SymbolDataListType::iterator symbol_iterator; + typedef std::vector::iterator indirect_symbol_iterator; + private: MCAssembler(const MCAssembler&); // DO NOT IMPLEMENT void operator=(const MCAssembler&); // DO NOT IMPLEMENT + MCContext &Context; + raw_ostream &OS; iplist Sections; iplist Symbols; + std::vector IndirectSymbols; + + unsigned SubsectionsViaSymbols : 1; + private: /// LayoutSection - Assign offsets and sizes to the fragments in the section /// \arg SD, and update the section size. The section file offset should @@ -396,12 +587,22 @@ public: // concrete and require clients to pass in a target like object. The other // option is to make this abstract, and have targets provide concrete // implementations as we do with AsmParser. - MCAssembler(raw_ostream &OS); + MCAssembler(MCContext &_Context, raw_ostream &OS); ~MCAssembler(); + MCContext &getContext() const { return Context; } + /// Finish - Do final processing and write the object to the output stream. void Finish(); + // FIXME: This does not belong here. + bool getSubsectionsViaSymbols() const { + return SubsectionsViaSymbols; + } + void setSubsectionsViaSymbols(bool Value) { + SubsectionsViaSymbols = Value; + } + /// @name Section List Access /// @{ @@ -431,6 +632,27 @@ public: size_t symbol_size() const { return Symbols.size(); } + /// @} + /// @name Indirect Symbol List Access + /// @{ + + // FIXME: This is a total hack, this should not be here. Once things are + // factored so that the streamer has direct access to the .o writer, it can + // disappear. + std::vector &getIndirectSymbols() { + return IndirectSymbols; + } + + indirect_symbol_iterator indirect_symbol_begin() { + return IndirectSymbols.begin(); + } + + indirect_symbol_iterator indirect_symbol_end() { + return IndirectSymbols.end(); + } + + size_t indirect_symbol_size() const { return IndirectSymbols.size(); } + /// @} }; diff --git a/libclamav/c++/llvm/include/llvm/MC/MCCodeEmitter.h b/libclamav/c++/llvm/include/llvm/MC/MCCodeEmitter.h new file mode 100644 index 000000000..ad42dc2e5 --- /dev/null +++ b/libclamav/c++/llvm/include/llvm/MC/MCCodeEmitter.h @@ -0,0 +1,34 @@ +//===-- llvm/MC/MCCodeEmitter.h - Instruction Encoding ----------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_MC_MCCODEEMITTER_H +#define LLVM_MC_MCCODEEMITTER_H + +namespace llvm { +class MCInst; +class raw_ostream; + +/// MCCodeEmitter - Generic instruction encoding interface. +class MCCodeEmitter { + MCCodeEmitter(const MCCodeEmitter &); // DO NOT IMPLEMENT + void operator=(const MCCodeEmitter &); // DO NOT IMPLEMENT +protected: // Can only create subclasses. + MCCodeEmitter(); + +public: + virtual ~MCCodeEmitter(); + + /// EncodeInstruction - Encode the given \arg Inst to bytes on the output + /// stream \arg OS. + virtual void EncodeInstruction(const MCInst &Inst, raw_ostream &OS) const = 0; +}; + +} // End llvm namespace + +#endif diff --git a/libclamav/c++/llvm/include/llvm/MC/MCContext.h b/libclamav/c++/llvm/include/llvm/MC/MCContext.h index 082b515a2..955aa8b08 100644 --- a/libclamav/c++/llvm/include/llvm/MC/MCContext.h +++ b/libclamav/c++/llvm/include/llvm/MC/MCContext.h @@ -36,7 +36,7 @@ namespace llvm { /// SymbolValues - Bindings of symbols to values. // // FIXME: Is there a good reason to not just put this in the MCSymbol? - DenseMap SymbolValues; + DenseMap SymbolValues; /// Allocator - Allocator object used for creating machine code objects. /// @@ -46,7 +46,10 @@ namespace llvm { public: MCContext(); ~MCContext(); - + + /// @name Symbol Managment + /// @{ + /// CreateSymbol - Create a new symbol with the specified @param Name. /// /// @param Name - The symbol name, which must be unique across all symbols. @@ -57,6 +60,8 @@ namespace llvm { /// reference and return it. /// /// @param Name - The symbol name, which must be unique across all symbols. + /// @param IsTemporary - Whether this symbol is an assembler temporary, + /// which should not survive into the symbol table for the translation unit. MCSymbol *GetOrCreateSymbol(const StringRef &Name); /// CreateTemporarySymbol - Create a new temporary symbol with the specified @@ -70,17 +75,21 @@ namespace llvm { /// LookupSymbol - Get the symbol for @param Name, or null. MCSymbol *LookupSymbol(const StringRef &Name) const; - /// ClearSymbolValue - Erase a value binding for @param Symbol, if one - /// exists. - void ClearSymbolValue(MCSymbol *Symbol); + /// @} + /// @name Symbol Value Table + /// @{ - /// SetSymbolValue - Set the value binding for @param Symbol to @param - /// Value. - void SetSymbolValue(MCSymbol *Symbol, const MCValue &Value); + /// ClearSymbolValue - Erase a value binding for @arg Symbol, if one exists. + void ClearSymbolValue(const MCSymbol *Symbol); - /// GetSymbolValue - Return the current value for @param Symbol, or null if + /// SetSymbolValue - Set the value binding for @arg Symbol to @arg Value. + void SetSymbolValue(const MCSymbol *Symbol, const MCValue &Value); + + /// GetSymbolValue - Return the current value for @arg Symbol, or null if /// none exists. - const MCValue *GetSymbolValue(MCSymbol *Symbol) const; + const MCValue *GetSymbolValue(const MCSymbol *Symbol) const; + + /// @} void *Allocate(unsigned Size, unsigned Align = 8) { return Allocator.Allocate(Size, Align); diff --git a/libclamav/c++/llvm/include/llvm/MC/MCExpr.h b/libclamav/c++/llvm/include/llvm/MC/MCExpr.h new file mode 100644 index 000000000..9f9f2670f --- /dev/null +++ b/libclamav/c++/llvm/include/llvm/MC/MCExpr.h @@ -0,0 +1,323 @@ +//===- MCExpr.h - Assembly Level Expressions --------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_MC_MCEXPR_H +#define LLVM_MC_MCEXPR_H + +#include "llvm/Support/Casting.h" +#include "llvm/Support/DataTypes.h" + +namespace llvm { +class MCContext; +class MCSymbol; +class MCValue; +class raw_ostream; + +/// MCExpr - Base class for the full range of assembler expressions which are +/// needed for parsing. +class MCExpr { +public: + enum ExprKind { + Binary, ///< Binary expressions. + Constant, ///< Constant expressions. + SymbolRef, ///< References to labels and assigned expressions. + Unary ///< Unary expressions. + }; + +private: + ExprKind Kind; + + MCExpr(const MCExpr&); // DO NOT IMPLEMENT + void operator=(const MCExpr&); // DO NOT IMPLEMENT + +protected: + MCExpr(ExprKind _Kind) : Kind(_Kind) {} + +public: + /// @name Accessors + /// @{ + + ExprKind getKind() const { return Kind; } + + /// @} + /// @name Utility Methods + /// @{ + + void print(raw_ostream &OS) const; + void dump() const; + + /// @} + /// @name Expression Evaluation + /// @{ + + /// EvaluateAsAbsolute - Try to evaluate the expression to an absolute value. + /// + /// @param Res - The absolute value, if evaluation succeeds. + /// @result - True on success. + bool EvaluateAsAbsolute(MCContext &Ctx, int64_t &Res) const; + + /// EvaluateAsRelocatable - Try to evaluate the expression to a relocatable + /// value, i.e. an expression of the fixed form (a - b + constant). + /// + /// @param Res - The relocatable value, if evaluation succeeds. + /// @result - True on success. + bool EvaluateAsRelocatable(MCContext &Ctx, MCValue &Res) const; + + /// @} + + static bool classof(const MCExpr *) { return true; } +}; + +//// MCConstantExpr - Represent a constant integer expression. +class MCConstantExpr : public MCExpr { + int64_t Value; + + MCConstantExpr(int64_t _Value) + : MCExpr(MCExpr::Constant), Value(_Value) {} + +public: + /// @name Construction + /// @{ + + static const MCConstantExpr *Create(int64_t Value, MCContext &Ctx); + + /// @} + /// @name Accessors + /// @{ + + int64_t getValue() const { return Value; } + + /// @} + + static bool classof(const MCExpr *E) { + return E->getKind() == MCExpr::Constant; + } + static bool classof(const MCConstantExpr *) { return true; } +}; + +/// MCSymbolRefExpr - Represent a reference to a symbol from inside an +/// expression. +/// +/// A symbol reference in an expression may be a use of a label, a use of an +/// assembler variable (defined constant), or constitute an implicit definition +/// of the symbol as external. +class MCSymbolRefExpr : public MCExpr { + const MCSymbol *Symbol; + + MCSymbolRefExpr(const MCSymbol *_Symbol) + : MCExpr(MCExpr::SymbolRef), Symbol(_Symbol) {} + +public: + /// @name Construction + /// @{ + + static const MCSymbolRefExpr *Create(const MCSymbol *Symbol, MCContext &Ctx); + + /// @} + /// @name Accessors + /// @{ + + const MCSymbol &getSymbol() const { return *Symbol; } + + /// @} + + static bool classof(const MCExpr *E) { + return E->getKind() == MCExpr::SymbolRef; + } + static bool classof(const MCSymbolRefExpr *) { return true; } +}; + +/// MCUnaryExpr - Unary assembler expressions. +class MCUnaryExpr : public MCExpr { +public: + enum Opcode { + LNot, ///< Logical negation. + Minus, ///< Unary minus. + Not, ///< Bitwise negation. + Plus ///< Unary plus. + }; + +private: + Opcode Op; + const MCExpr *Expr; + + MCUnaryExpr(Opcode _Op, const MCExpr *_Expr) + : MCExpr(MCExpr::Unary), Op(_Op), Expr(_Expr) {} + +public: + /// @name Construction + /// @{ + + static const MCUnaryExpr *Create(Opcode Op, const MCExpr *Expr, + MCContext &Ctx); + static const MCUnaryExpr *CreateLNot(const MCExpr *Expr, MCContext &Ctx) { + return Create(LNot, Expr, Ctx); + } + static const MCUnaryExpr *CreateMinus(const MCExpr *Expr, MCContext &Ctx) { + return Create(Minus, Expr, Ctx); + } + static const MCUnaryExpr *CreateNot(const MCExpr *Expr, MCContext &Ctx) { + return Create(Not, Expr, Ctx); + } + static const MCUnaryExpr *CreatePlus(const MCExpr *Expr, MCContext &Ctx) { + return Create(Plus, Expr, Ctx); + } + + /// @} + /// @name Accessors + /// @{ + + /// getOpcode - Get the kind of this unary expression. + Opcode getOpcode() const { return Op; } + + /// getSubExpr - Get the child of this unary expression. + const MCExpr *getSubExpr() const { return Expr; } + + /// @} + + static bool classof(const MCExpr *E) { + return E->getKind() == MCExpr::Unary; + } + static bool classof(const MCUnaryExpr *) { return true; } +}; + +/// MCBinaryExpr - Binary assembler expressions. +class MCBinaryExpr : public MCExpr { +public: + enum Opcode { + Add, ///< Addition. + And, ///< Bitwise and. + Div, ///< Division. + EQ, ///< Equality comparison. + GT, ///< Greater than comparison. + GTE, ///< Greater than or equal comparison. + LAnd, ///< Logical and. + LOr, ///< Logical or. + LT, ///< Less than comparison. + LTE, ///< Less than or equal comparison. + Mod, ///< Modulus. + Mul, ///< Multiplication. + NE, ///< Inequality comparison. + Or, ///< Bitwise or. + Shl, ///< Bitwise shift left. + Shr, ///< Bitwise shift right. + Sub, ///< Subtraction. + Xor ///< Bitwise exclusive or. + }; + +private: + Opcode Op; + const MCExpr *LHS, *RHS; + + MCBinaryExpr(Opcode _Op, const MCExpr *_LHS, const MCExpr *_RHS) + : MCExpr(MCExpr::Binary), Op(_Op), LHS(_LHS), RHS(_RHS) {} + +public: + /// @name Construction + /// @{ + + static const MCBinaryExpr *Create(Opcode Op, const MCExpr *LHS, + const MCExpr *RHS, MCContext &Ctx); + static const MCBinaryExpr *CreateAdd(const MCExpr *LHS, const MCExpr *RHS, + MCContext &Ctx) { + return Create(Add, LHS, RHS, Ctx); + } + static const MCBinaryExpr *CreateAnd(const MCExpr *LHS, const MCExpr *RHS, + MCContext &Ctx) { + return Create(And, LHS, RHS, Ctx); + } + static const MCBinaryExpr *CreateDiv(const MCExpr *LHS, const MCExpr *RHS, + MCContext &Ctx) { + return Create(Div, LHS, RHS, Ctx); + } + static const MCBinaryExpr *CreateEQ(const MCExpr *LHS, const MCExpr *RHS, + MCContext &Ctx) { + return Create(EQ, LHS, RHS, Ctx); + } + static const MCBinaryExpr *CreateGT(const MCExpr *LHS, const MCExpr *RHS, + MCContext &Ctx) { + return Create(GT, LHS, RHS, Ctx); + } + static const MCBinaryExpr *CreateGTE(const MCExpr *LHS, const MCExpr *RHS, + MCContext &Ctx) { + return Create(GTE, LHS, RHS, Ctx); + } + static const MCBinaryExpr *CreateLAnd(const MCExpr *LHS, const MCExpr *RHS, + MCContext &Ctx) { + return Create(LAnd, LHS, RHS, Ctx); + } + static const MCBinaryExpr *CreateLOr(const MCExpr *LHS, const MCExpr *RHS, + MCContext &Ctx) { + return Create(LOr, LHS, RHS, Ctx); + } + static const MCBinaryExpr *CreateLT(const MCExpr *LHS, const MCExpr *RHS, + MCContext &Ctx) { + return Create(LT, LHS, RHS, Ctx); + } + static const MCBinaryExpr *CreateLTE(const MCExpr *LHS, const MCExpr *RHS, + MCContext &Ctx) { + return Create(LTE, LHS, RHS, Ctx); + } + static const MCBinaryExpr *CreateMod(const MCExpr *LHS, const MCExpr *RHS, + MCContext &Ctx) { + return Create(Mod, LHS, RHS, Ctx); + } + static const MCBinaryExpr *CreateMul(const MCExpr *LHS, const MCExpr *RHS, + MCContext &Ctx) { + return Create(Mul, LHS, RHS, Ctx); + } + static const MCBinaryExpr *CreateNE(const MCExpr *LHS, const MCExpr *RHS, + MCContext &Ctx) { + return Create(NE, LHS, RHS, Ctx); + } + static const MCBinaryExpr *CreateOr(const MCExpr *LHS, const MCExpr *RHS, + MCContext &Ctx) { + return Create(Or, LHS, RHS, Ctx); + } + static const MCBinaryExpr *CreateShl(const MCExpr *LHS, const MCExpr *RHS, + MCContext &Ctx) { + return Create(Shl, LHS, RHS, Ctx); + } + static const MCBinaryExpr *CreateShr(const MCExpr *LHS, const MCExpr *RHS, + MCContext &Ctx) { + return Create(Shr, LHS, RHS, Ctx); + } + static const MCBinaryExpr *CreateSub(const MCExpr *LHS, const MCExpr *RHS, + MCContext &Ctx) { + return Create(Sub, LHS, RHS, Ctx); + } + static const MCBinaryExpr *CreateXor(const MCExpr *LHS, const MCExpr *RHS, + MCContext &Ctx) { + return Create(Xor, LHS, RHS, Ctx); + } + + /// @} + /// @name Accessors + /// @{ + + /// getOpcode - Get the kind of this binary expression. + Opcode getOpcode() const { return Op; } + + /// getLHS - Get the left-hand side expression of the binary operator. + const MCExpr *getLHS() const { return LHS; } + + /// getRHS - Get the right-hand side expression of the binary operator. + const MCExpr *getRHS() const { return RHS; } + + /// @} + + static bool classof(const MCExpr *E) { + return E->getKind() == MCExpr::Binary; + } + static bool classof(const MCBinaryExpr *) { return true; } +}; + +} // end namespace llvm + +#endif diff --git a/libclamav/c++/llvm/include/llvm/MC/MCInst.h b/libclamav/c++/llvm/include/llvm/MC/MCInst.h index 36011b9b6..7c1cb136d 100644 --- a/libclamav/c++/llvm/include/llvm/MC/MCInst.h +++ b/libclamav/c++/llvm/include/llvm/MC/MCInst.h @@ -16,12 +16,13 @@ #ifndef LLVM_MC_MCINST_H #define LLVM_MC_MCINST_H -#include "llvm/MC/MCValue.h" #include "llvm/ADT/SmallVector.h" #include "llvm/Support/DataTypes.h" #include "llvm/Support/DebugLoc.h" namespace llvm { +class raw_ostream; +class MCExpr; /// MCOperand - Instances of this class represent operands of the MCInst class. /// This is a simple discriminated union. @@ -31,14 +32,14 @@ class MCOperand { kRegister, ///< Register operand. kImmediate, ///< Immediate operand. kMBBLabel, ///< Basic block label. - kMCValue ///< Relocatable immediate operand. + kExpr ///< Relocatable immediate operand. }; unsigned char Kind; union { unsigned RegVal; int64_t ImmVal; - MCValue MCValueVal; + const MCExpr *ExprVal; struct { unsigned FunctionNo; unsigned BlockNo; @@ -53,7 +54,7 @@ public: bool isReg() const { return Kind == kRegister; } bool isImm() const { return Kind == kImmediate; } bool isMBBLabel() const { return Kind == kMBBLabel; } - bool isMCValue() const { return Kind == kMCValue; } + bool isExpr() const { return Kind == kExpr; } /// getReg - Returns the register number. unsigned getReg() const { @@ -77,21 +78,21 @@ public: } unsigned getMBBLabelFunction() const { - assert(isMBBLabel() && "Wrong accessor"); + assert(isMBBLabel() && "This is not a machine basic block"); return MBBLabel.FunctionNo; } unsigned getMBBLabelBlock() const { - assert(isMBBLabel() && "Wrong accessor"); + assert(isMBBLabel() && "This is not a machine basic block"); return MBBLabel.BlockNo; } - const MCValue &getMCValue() const { - assert(isMCValue() && "This is not an MCValue"); - return MCValueVal; + const MCExpr *getExpr() const { + assert(isExpr() && "This is not an expression"); + return ExprVal; } - void setMCValue(const MCValue &Val) { - assert(isMCValue() && "This is not an MCValue"); - MCValueVal = Val; + void setExpr(const MCExpr *Val) { + assert(isExpr() && "This is not an expression"); + ExprVal = Val; } static MCOperand CreateReg(unsigned Reg) { @@ -113,12 +114,15 @@ public: Op.MBBLabel.BlockNo = MBB; return Op; } - static MCOperand CreateMCValue(const MCValue &Val) { + static MCOperand CreateExpr(const MCExpr *Val) { MCOperand Op; - Op.Kind = kMCValue; - Op.MCValueVal = Val; + Op.Kind = kExpr; + Op.ExprVal = Val; return Op; } + + void print(raw_ostream &OS) const; + void dump() const; }; @@ -142,6 +146,9 @@ public: void addOperand(const MCOperand &Op) { Operands.push_back(Op); } + + void print(raw_ostream &OS) const; + void dump() const; }; diff --git a/libclamav/c++/llvm/include/llvm/MC/MCStreamer.h b/libclamav/c++/llvm/include/llvm/MC/MCStreamer.h index e7741042e..224fbf4ff 100644 --- a/libclamav/c++/llvm/include/llvm/MC/MCStreamer.h +++ b/libclamav/c++/llvm/include/llvm/MC/MCStreamer.h @@ -18,19 +18,20 @@ namespace llvm { class AsmPrinter; + class MCAsmInfo; + class MCCodeEmitter; class MCContext; - class MCValue; + class MCExpr; class MCInst; class MCSection; class MCSymbol; class StringRef; class raw_ostream; - class MCAsmInfo; /// MCStreamer - Streaming machine code generation interface. This interface /// is intended to provide a programatic interface that is very similar to the /// level that an assembler .s file provides. It has callbacks to emit bytes, - /// "emit directives", etc. The implementation of this interface retains + /// handle directives, etc. The implementation of this interface retains /// state to know what the current section is etc. /// /// There are multiple implementations of this interface: one for writing out @@ -72,6 +73,7 @@ namespace llvm { /// CurSection - This is the current section code is being emitted to, it is /// kept up to date by SwitchSection. const MCSection *CurSection; + public: virtual ~MCStreamer(); @@ -79,17 +81,16 @@ namespace llvm { /// @name Symbol & Section Management /// @{ + + /// getCurrentSection - Return the current seciton that the streamer is + /// emitting code to. + const MCSection *getCurrentSection() const { return CurSection; } /// SwitchSection - Set the current section where code is being emitted to /// @param Section. This is required to update CurSection. /// /// This corresponds to assembler directives like .section, .text, etc. virtual void SwitchSection(const MCSection *Section) = 0; - - - /// getCurrentSection - Return the current seciton that the streamer is - /// emitting code to. - const MCSection *getCurrentSection() const { return CurSection; } /// EmitLabel - Emit a label for @param Symbol into the current section. /// @@ -99,9 +100,6 @@ namespace llvm { /// @param Symbol - The symbol to emit. A given symbol should only be /// emitted as a label once, and symbols emitted as a label should never be /// used in an assignment. - // - // FIXME: What to do about the current section? Should we get rid of the - // symbol section in the constructor and initialize it here? virtual void EmitLabel(MCSymbol *Symbol) = 0; /// EmitAssemblerFlag - Note in the output the specified @param Flag @@ -118,18 +116,9 @@ namespace llvm { /// /// @param Symbol - The symbol being assigned to. /// @param Value - The value for the symbol. - /// @param MakeAbsolute - If true, then the symbol should be given the - /// absolute value of @param Value, even if @param Value would be - /// relocatable expression. This corresponds to the ".set" directive. - virtual void EmitAssignment(MCSymbol *Symbol, const MCValue &Value, - bool MakeAbsolute = false) = 0; + virtual void EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) = 0; /// EmitSymbolAttribute - Add the given @param Attribute to @param Symbol. - // - // FIXME: This doesn't make much sense, could we just have attributes be on - // the symbol and make the printer smart enough to add the right symbols? - // This should work as long as the order of attributes in the file doesn't - // matter. virtual void EmitSymbolAttribute(MCSymbol *Symbol, SymbolAttr Attribute) = 0; @@ -139,38 +128,30 @@ namespace llvm { /// @param DescValue - The value to set into the n_desc field. virtual void EmitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) = 0; - /// EmitLocalSymbol - Emit a local symbol of @param Value to @param Symbol. - /// - /// @param Symbol - The local symbol being created. - /// @param Value - The value for the symbol. - virtual void EmitLocalSymbol(MCSymbol *Symbol, const MCValue &Value) = 0; - - /// EmitCommonSymbol - Emit a common or local common symbol of @param Size - /// with the @param Pow2Alignment if non-zero. + /// EmitCommonSymbol - Emit a common or local common symbol. /// /// @param Symbol - The common symbol to emit. /// @param Size - The size of the common symbol. - /// @param Pow2Alignment - The alignment of the common symbol if non-zero. - /// @param IsLocal - If true, then the symbol is to be a local common + /// @param ByteAlignment - The alignment of the symbol if + /// non-zero. This must be a power of 2 on some targets. virtual void EmitCommonSymbol(MCSymbol *Symbol, unsigned Size, - unsigned Pow2Alignment, bool IsLocal) = 0; + unsigned ByteAlignment) = 0; - /// EmitZerofill - Emit a the zerofill section and possiblity a symbol, if - /// @param Symbol is non-NULL, for @param Size and with the @param - /// Pow2Alignment if non-zero. + /// EmitZerofill - Emit a the zerofill section and an option symbol. /// /// @param Section - The zerofill section to create and or to put the symbol /// @param Symbol - The zerofill symbol to emit, if non-NULL. /// @param Size - The size of the zerofill symbol. - /// @param Pow2Alignment - The alignment of the zerofill symbol if non-zero. - virtual void EmitZerofill(MCSection *Section, MCSymbol *Symbol = 0, - unsigned Size = 0,unsigned Pow2Alignment = 0) = 0; + /// @param ByteAlignment - The alignment of the zerofill symbol if + /// non-zero. This must be a power of 2 on some targets. + virtual void EmitZerofill(const MCSection *Section, MCSymbol *Symbol = 0, + unsigned Size = 0,unsigned ByteAlignment = 0) = 0; /// @} /// @name Generating Data /// @{ - /// EmitBytes - Emit the bytes in @param Data into the output. + /// EmitBytes - Emit the bytes in \arg Data into the output. /// /// This is used to implement assembler directives such as .byte, .ascii, /// etc. @@ -185,7 +166,7 @@ namespace llvm { /// @param Value - The value to emit. /// @param Size - The size of the integer (in bytes) to emit. This must /// match a native machine width. - virtual void EmitValue(const MCValue &Value, unsigned Size) = 0; + virtual void EmitValue(const MCExpr *Value, unsigned Size) = 0; /// EmitValueToAlignment - Emit some number of copies of @param Value until /// the byte alignment @param ByteAlignment is reached. @@ -213,12 +194,10 @@ namespace llvm { /// /// This is used to implement assembler directives such as .org. /// - /// @param Offset - The offset to reach.This may be an expression, but the + /// @param Offset - The offset to reach. This may be an expression, but the /// expression must be associated with the current section. /// @param Value - The value to use when filling bytes. - // - // FIXME: How are we going to signal failures out of this? - virtual void EmitValueToOffset(const MCValue &Offset, + virtual void EmitValueToOffset(const MCExpr *Offset, unsigned char Value = 0) = 0; /// @} @@ -241,7 +220,8 @@ namespace llvm { /// /// \arg AP - If given, an AsmPrinter to use for printing instructions. MCStreamer *createAsmStreamer(MCContext &Ctx, raw_ostream &OS, - const MCAsmInfo &MAI, AsmPrinter *AP = 0); + const MCAsmInfo &MAI, AsmPrinter *AP = 0, + MCCodeEmitter *CE = 0); // FIXME: These two may end up getting rolled into a single // createObjectStreamer interface, which implements the assembler backend, and @@ -249,7 +229,8 @@ namespace llvm { /// createMachOStream - Create a machine code streamer which will generative /// Mach-O format object files. - MCStreamer *createMachOStreamer(MCContext &Ctx, raw_ostream &OS); + MCStreamer *createMachOStreamer(MCContext &Ctx, raw_ostream &OS, + MCCodeEmitter *CE = 0); /// createELFStreamer - Create a machine code streamer which will generative /// ELF format object files. diff --git a/libclamav/c++/llvm/include/llvm/MC/MCSymbol.h b/libclamav/c++/llvm/include/llvm/MC/MCSymbol.h index 122e897a9..631fa12f3 100644 --- a/libclamav/c++/llvm/include/llvm/MC/MCSymbol.h +++ b/libclamav/c++/llvm/include/llvm/MC/MCSymbol.h @@ -63,9 +63,21 @@ namespace llvm { /// @name Symbol Type /// @{ + /// isTemporary - Check if this is an assembler temporary symbol. + bool isTemporary() const { + return IsTemporary; + } + + /// isDefined - Check if this symbol is defined (i.e., it has an address). + /// + /// Defined symbols are either absolute or in some section. + bool isDefined() const { + return Section != 0; + } + /// isUndefined - Check if this symbol undefined (i.e., implicitly defined). bool isUndefined() const { - return Section == 0; + return !isDefined(); } /// isAbsolute - Check if this this is an absolute symbol. diff --git a/libclamav/c++/llvm/include/llvm/MC/MCValue.h b/libclamav/c++/llvm/include/llvm/MC/MCValue.h index af56eedec..9d71209f8 100644 --- a/libclamav/c++/llvm/include/llvm/MC/MCValue.h +++ b/libclamav/c++/llvm/include/llvm/MC/MCValue.h @@ -33,13 +33,13 @@ class raw_ostream; /// Note that this class must remain a simple POD value class, because we need /// it to live in unions etc. class MCValue { - MCSymbol *SymA, *SymB; + const MCSymbol *SymA, *SymB; int64_t Cst; public: int64_t getConstant() const { return Cst; } - MCSymbol *getSymA() const { return SymA; } - MCSymbol *getSymB() const { return SymB; } + const MCSymbol *getSymA() const { return SymA; } + const MCSymbol *getSymB() const { return SymB; } /// isAbsolute - Is this an absolute (as opposed to relocatable) value. bool isAbsolute() const { return !SymA && !SymB; } @@ -60,7 +60,8 @@ public: /// dump - Print the value to stderr. void dump() const; - static MCValue get(MCSymbol *SymA, MCSymbol *SymB = 0, int64_t Val = 0) { + static MCValue get(const MCSymbol *SymA, const MCSymbol *SymB = 0, + int64_t Val = 0) { MCValue R; assert((!SymB || SymA) && "Invalid relocatable MCValue!"); R.Cst = Val; diff --git a/libclamav/c++/llvm/include/llvm/Metadata.h b/libclamav/c++/llvm/include/llvm/Metadata.h index f36de687d..b38336b98 100644 --- a/libclamav/c++/llvm/include/llvm/Metadata.h +++ b/libclamav/c++/llvm/include/llvm/Metadata.h @@ -110,7 +110,6 @@ class MDNode : public MetadataBase { unsigned getNumOperands() { return User::getNumOperands(); } SmallVector Node; - friend struct ConstantCreator >; protected: explicit MDNode(LLVMContext &C, Value*const* Vals, unsigned NumVals); diff --git a/libclamav/c++/llvm/include/llvm/PassSupport.h b/libclamav/c++/llvm/include/llvm/PassSupport.h index fe3ca5206..b5e581a6f 100644 --- a/libclamav/c++/llvm/include/llvm/PassSupport.h +++ b/libclamav/c++/llvm/include/llvm/PassSupport.h @@ -190,14 +190,11 @@ struct RegisterPass : public PassInfo { /// a nice name with the interface. /// class RegisterAGBase : public PassInfo { - PassInfo *InterfaceInfo; - const PassInfo *ImplementationInfo; - bool isDefaultImplementation; protected: - explicit RegisterAGBase(const char *Name, - intptr_t InterfaceID, - intptr_t PassID = 0, - bool isDefault = false); + RegisterAGBase(const char *Name, + intptr_t InterfaceID, + intptr_t PassID = 0, + bool isDefault = false); }; template diff --git a/libclamav/c++/llvm/include/llvm/Support/CFG.h b/libclamav/c++/llvm/include/llvm/Support/CFG.h index b0b857bf0..3a20696f0 100644 --- a/libclamav/c++/llvm/include/llvm/Support/CFG.h +++ b/libclamav/c++/llvm/include/llvm/Support/CFG.h @@ -18,17 +18,17 @@ #include "llvm/ADT/GraphTraits.h" #include "llvm/Function.h" #include "llvm/InstrTypes.h" -#include "llvm/ADT/iterator.h" namespace llvm { -//===--------------------------------------------------------------------===// +//===----------------------------------------------------------------------===// // BasicBlock pred_iterator definition -//===--------------------------------------------------------------------===// +//===----------------------------------------------------------------------===// template // Predecessor Iterator -class PredIterator : public forward_iterator<_Ptr, ptrdiff_t> { - typedef forward_iterator<_Ptr, ptrdiff_t> super; +class PredIterator : public std::iterator { + typedef std::iterator super; _USE_iterator It; public: typedef PredIterator<_Ptr,_USE_iterator> _Self; @@ -80,15 +80,16 @@ inline pred_const_iterator pred_end(const BasicBlock *BB) { -//===--------------------------------------------------------------------===// +//===----------------------------------------------------------------------===// // BasicBlock succ_iterator definition -//===--------------------------------------------------------------------===// +//===----------------------------------------------------------------------===// template // Successor Iterator -class SuccIterator : public bidirectional_iterator { +class SuccIterator : public std::iterator { const Term_ Term; unsigned idx; - typedef bidirectional_iterator super; + typedef std::iterator super; public: typedef SuccIterator _Self; typedef typename super::pointer pointer; diff --git a/libclamav/c++/llvm/include/llvm/Support/DebugLoc.h b/libclamav/c++/llvm/include/llvm/Support/DebugLoc.h index 8ef7e4afc..0bfad7cc0 100644 --- a/libclamav/c++/llvm/include/llvm/Support/DebugLoc.h +++ b/libclamav/c++/llvm/include/llvm/Support/DebugLoc.h @@ -19,19 +19,19 @@ #include namespace llvm { - class GlobalVariable; + class MDNode; /// DebugLocTuple - Debug location tuple of filename id, line and column. /// struct DebugLocTuple { - GlobalVariable *CompileUnit; + MDNode *CompileUnit; unsigned Line, Col; DebugLocTuple() : CompileUnit(0), Line(~0U), Col(~0U) {}; - DebugLocTuple(GlobalVariable *v, unsigned l, unsigned c) - : CompileUnit(v), Line(l), Col(c) {}; + DebugLocTuple(MDNode *n, unsigned l, unsigned c) + : CompileUnit(n), Line(l), Col(c) {}; bool operator==(const DebugLocTuple &DLT) const { return CompileUnit == DLT.CompileUnit && @@ -69,10 +69,10 @@ namespace llvm { return DebugLocTuple(0, ~0U, ~0U); } static inline DebugLocTuple getTombstoneKey() { - return DebugLocTuple((GlobalVariable*)~1U, ~1U, ~1U); + return DebugLocTuple((MDNode*)~1U, ~1U, ~1U); } static unsigned getHashValue(const DebugLocTuple &Val) { - return DenseMapInfo::getHashValue(Val.CompileUnit) ^ + return DenseMapInfo::getHashValue(Val.CompileUnit) ^ DenseMapInfo::getHashValue(Val.Line) ^ DenseMapInfo::getHashValue(Val.Col); } diff --git a/libclamav/c++/llvm/include/llvm/Support/GetElementPtrTypeIterator.h b/libclamav/c++/llvm/include/llvm/Support/GetElementPtrTypeIterator.h index e1cda75c5..f5915c992 100644 --- a/libclamav/c++/llvm/include/llvm/Support/GetElementPtrTypeIterator.h +++ b/libclamav/c++/llvm/include/llvm/Support/GetElementPtrTypeIterator.h @@ -21,8 +21,9 @@ namespace llvm { template class generic_gep_type_iterator - : public forward_iterator { - typedef forward_iterator super; + : public std::iterator { + typedef std::iterator super; ItTy OpIt; const Type *CurTy; diff --git a/libclamav/c++/llvm/include/llvm/Support/GraphWriter.h b/libclamav/c++/llvm/include/llvm/Support/GraphWriter.h index b88dd3f9a..d5f2e741d 100644 --- a/libclamav/c++/llvm/include/llvm/Support/GraphWriter.h +++ b/libclamav/c++/llvm/include/llvm/Support/GraphWriter.h @@ -274,7 +274,7 @@ sys::Path WriteGraph(const GraphType &G, const std::string &Name, errs() << "Writing '" << Filename.str() << "'... "; std::string ErrorInfo; - raw_fd_ostream O(Filename.c_str(), ErrorInfo, raw_fd_ostream::F_Force); + raw_fd_ostream O(Filename.c_str(), ErrorInfo); if (ErrorInfo.empty()) { WriteGraph(O, G, ShortNames, Name, Title); diff --git a/libclamav/c++/llvm/include/llvm/Support/IRBuilder.h b/libclamav/c++/llvm/include/llvm/Support/IRBuilder.h index ca65aa17b..4080f9020 100644 --- a/libclamav/c++/llvm/include/llvm/Support/IRBuilder.h +++ b/libclamav/c++/llvm/include/llvm/Support/IRBuilder.h @@ -26,34 +26,53 @@ namespace llvm { +/// IRBuilderDefaultInserter - This provides the default implementation of the +/// IRBuilder 'InsertHelper' method that is called whenever an instruction is +/// created by IRBuilder and needs to be inserted. By default, this inserts the +/// instruction at the insertion point. +template +class IRBuilderDefaultInserter { +protected: + void InsertHelper(Instruction *I, const Twine &Name, + BasicBlock *BB, BasicBlock::iterator InsertPt) const { + if (BB) BB->getInstList().insert(InsertPt, I); + if (preserveNames) + I->setName(Name); + } +}; + + /// IRBuilder - This provides a uniform API for creating instructions and /// inserting them into a basic block: either at the end of a BasicBlock, or /// at a specific iterator location in a block. /// /// Note that the builder does not expose the full generality of LLVM -/// instructions. For example, it cannot be used to create instructions with -/// arbitrary names (specifically, names with nul characters in them) - It only -/// supports nul-terminated C strings. For fully generic names, use -/// I->setName(). For access to extra instruction properties, use the mutators +/// instructions. For access to extra instruction properties, use the mutators /// (e.g. setVolatile) on the instructions after they have been created. /// The first template argument handles whether or not to preserve names in the /// final instruction output. This defaults to on. The second template argument /// specifies a class to use for creating constants. This defaults to creating -/// minimally folded constants. -template class IRBuilder{ +/// minimally folded constants. The fourth template argument allows clients to +/// specify custom insertion hooks that are called on every newly created +/// insertion. +template > +class IRBuilder : public Inserter { BasicBlock *BB; BasicBlock::iterator InsertPt; LLVMContext &Context; T Folder; public: - IRBuilder(LLVMContext &C, const T& F) : - Context(C), Folder(F) { ClearInsertionPoint(); } + IRBuilder(LLVMContext &C, const T &F, const Inserter &I = Inserter()) + : Inserter(I), Context(C), Folder(F) { + ClearInsertionPoint(); + } explicit IRBuilder(LLVMContext &C) : Context(C), Folder(C) { ClearInsertionPoint(); } - explicit IRBuilder(BasicBlock *TheBB, const T& F) + explicit IRBuilder(BasicBlock *TheBB, const T &F) : Context(TheBB->getContext()), Folder(F) { SetInsertPoint(TheBB); } @@ -74,7 +93,7 @@ public: } /// getFolder - Get the constant folder being used. - const T& getFolder() { return Folder; } + const T &getFolder() { return Folder; } /// isNamePreserving - Return true if this builder is configured to actually /// add the requested names to IR created through it. @@ -111,19 +130,10 @@ public: /// Insert - Insert and return the specified instruction. template InstTy *Insert(InstTy *I, const Twine &Name = "") const { - InsertHelper(I, Name); + this->InsertHelper(I, Name, BB, InsertPt); return I; } - /// InsertHelper - Insert the specified instruction at the specified insertion - /// point. This is split out of Insert so that it isn't duplicated for every - /// template instantiation. - void InsertHelper(Instruction *I, const Twine &Name) const { - if (BB) BB->getInstList().insert(InsertPt, I); - if (preserveNames) - I->setName(Name); - } - //===--------------------------------------------------------------------===// // Type creation methods //===--------------------------------------------------------------------===// @@ -406,8 +416,7 @@ public: LoadInst *CreateLoad(Value *Ptr, const Twine &Name = "") { return Insert(new LoadInst(Ptr), Name); } - LoadInst *CreateLoad(Value *Ptr, bool isVolatile, - const Twine &Name = "") { + LoadInst *CreateLoad(Value *Ptr, bool isVolatile, const Twine &Name = "") { return Insert(new LoadInst(Ptr, 0, isVolatile), Name); } StoreInst *CreateStore(Value *Val, Value *Ptr, bool isVolatile = false) { @@ -744,14 +753,14 @@ public: if (Constant *LC = dyn_cast(LHS)) if (Constant *RC = dyn_cast(RHS)) return Folder.CreateICmp(P, LC, RC); - return Insert(new ICmpInst(Context, P, LHS, RHS), Name); + return Insert(new ICmpInst(P, LHS, RHS), Name); } Value *CreateFCmp(CmpInst::Predicate P, Value *LHS, Value *RHS, const Twine &Name = "") { if (Constant *LC = dyn_cast(LHS)) if (Constant *RC = dyn_cast(RHS)) return Folder.CreateFCmp(P, LC, RC); - return Insert(new FCmpInst(Context, P, LHS, RHS), Name); + return Insert(new FCmpInst(P, LHS, RHS), Name); } //===--------------------------------------------------------------------===// @@ -861,8 +870,7 @@ public: const Twine &Name = "") { if (Constant *AggC = dyn_cast(Agg)) if (Constant *ValC = dyn_cast(Val)) - return Folder.CreateInsertValue(AggC, ValC, - IdxBegin, IdxEnd - IdxBegin); + return Folder.CreateInsertValue(AggC, ValC, IdxBegin, IdxEnd-IdxBegin); return Insert(InsertValueInst::Create(Agg, Val, IdxBegin, IdxEnd), Name); } diff --git a/libclamav/c++/llvm/include/llvm/Support/MathExtras.h b/libclamav/c++/llvm/include/llvm/Support/MathExtras.h index 7ba5d8661..6fa618eb1 100644 --- a/libclamav/c++/llvm/include/llvm/Support/MathExtras.h +++ b/libclamav/c++/llvm/include/llvm/Support/MathExtras.h @@ -435,6 +435,13 @@ inline uint64_t RoundUpToAlignment(uint64_t Value, uint64_t Align) { return ((Value + Align - 1) / Align) * Align; } +/// OffsetToAlignment - Return the offset to the next integer (mod 2**64) that +/// is greater than or equal to \arg Value and is a multiple of \arg +/// Align. Align must be non-zero. +inline uint64_t OffsetToAlignment(uint64_t Value, uint64_t Align) { + return RoundUpToAlignment(Value, Align) - Value; +} + /// abs64 - absolute value of a 64-bit int. Not all environments support /// "abs" on whatever their name for the 64-bit int type is. The absolute /// value of the largest negative number is undefined, as with "abs". diff --git a/libclamav/c++/llvm/include/llvm/Support/Regex.h b/libclamav/c++/llvm/include/llvm/Support/Regex.h new file mode 100644 index 000000000..31fd3ccef --- /dev/null +++ b/libclamav/c++/llvm/include/llvm/Support/Regex.h @@ -0,0 +1,64 @@ +//===-- Regex.h - Regular Expression matcher implementation -*- C++ -*-----===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file implements a POSIX regular expression matcher. +// +//===----------------------------------------------------------------------===// + +#include "llvm/ADT/SmallVector.h" +#include "llvm/ADT/StringRef.h" + +struct llvm_regex; +namespace llvm { + class Regex { + public: + enum { + /// Compile with support for subgroup matches, this is just to make + /// constructs like Regex("...", 0) more readable as Regex("...", Sub). + Sub=0, + /// Compile for matching that ignores upper/lower case distinctions. + IgnoreCase=1, + /// Compile for matching that need only report success or failure, + /// not what was matched. + NoSub=2, + /// Compile for newline-sensitive matching. With this flag '[^' bracket + /// expressions and '.' never match newline. A ^ anchor matches the + /// null string after any newline in the string in addition to its normal + /// function, and the $ anchor matches the null string before any + /// newline in the string in addition to its normal function. + Newline=4 + }; + + /// Compiles the given POSIX Extended Regular Expression \arg Regex. + /// This implementation supports regexes and matching strings with embedded + /// NUL characters. + Regex(const StringRef &Regex, unsigned Flags=NoSub); + ~Regex(); + + /// isValid - returns the error encountered during regex compilation, or + /// matching, if any. + bool isValid(std::string &Error); + + /// matches - Match the regex against a given \arg String. + /// + /// \param Matches - If given, on a succesful match this will be filled in + /// with references to the matched group expressions (inside \arg String), + /// the first group is always the entire pattern. + /// By default the regex is compiled with NoSub, which disables support for + /// Matches. + /// For this feature to be enabled you must construct the regex using + /// Regex("...", Regex::Sub) constructor. + + bool match(const StringRef &String, SmallVectorImpl *Matches=0); + private: + struct llvm_regex *preg; + int error; + bool sub; + }; +} diff --git a/libclamav/c++/llvm/include/llvm/Support/raw_ostream.h b/libclamav/c++/llvm/include/llvm/Support/raw_ostream.h index 58253dd73..a01d4cdb0 100644 --- a/libclamav/c++/llvm/include/llvm/Support/raw_ostream.h +++ b/libclamav/c++/llvm/include/llvm/Support/raw_ostream.h @@ -328,18 +328,17 @@ class raw_fd_ostream : public raw_ostream { public: enum { - /// F_Force - When opening a file, this flag makes raw_fd_ostream overwrite - /// a file if it already exists instead of emitting an error. This may not - /// be specified with F_Append. - F_Force = 1, + /// F_Excl - When opening a file, this flag makes raw_fd_ostream + /// report an error if the file already exists. + F_Excl = 1, /// F_Append - When opening a file, if it already exists append to the /// existing file instead of returning an error. This may not be specified - /// with F_Force. + /// with F_Excl. F_Append = 2, /// F_Binary - The file should be opened in binary mode on platforms that - /// support this distinction. + /// make this distinction. F_Binary = 4 }; diff --git a/libclamav/c++/llvm/include/llvm/Target/TargetRegistry.h b/libclamav/c++/llvm/include/llvm/Target/TargetRegistry.h index 6772d061e..5c89fa597 100644 --- a/libclamav/c++/llvm/include/llvm/Target/TargetRegistry.h +++ b/libclamav/c++/llvm/include/llvm/Target/TargetRegistry.h @@ -26,6 +26,7 @@ namespace llvm { class AsmPrinter; class MCAsmParser; + class MCCodeEmitter; class Module; class MCAsmInfo; class TargetAsmParser; @@ -57,6 +58,9 @@ namespace llvm { bool VerboseAsm); typedef TargetAsmParser *(*AsmParserCtorTy)(const Target &T, MCAsmParser &P); + typedef MCCodeEmitter *(*CodeEmitterCtorTy)(const Target &T, + TargetMachine &TM); + private: /// Next - The next registered target in the linked list, maintained by the /// TargetRegistry. @@ -89,7 +93,14 @@ namespace llvm { /// if registered. AsmParserCtorTy AsmParserCtorFn; + /// CodeEmitterCtorFn - Construction function for this target's CodeEmitter, + /// if registered. + CodeEmitterCtorTy CodeEmitterCtorFn; + public: + /// @name Target Information + /// @{ + // getNext - Return the next registered target. const Target *getNext() const { return Next; } @@ -99,6 +110,11 @@ namespace llvm { /// getShortDescription - Get a short description of the target. const char *getShortDescription() const { return ShortDesc; } + /// @} + /// @name Feature Predicates + /// @{ + + /// hasJIT - Check if this targets supports the just-in-time compilation. bool hasJIT() const { return HasJIT; } /// hasTargetMachine - Check if this target supports code generation. @@ -110,6 +126,12 @@ namespace llvm { /// hasAsmParser - Check if this target supports .s parsing. bool hasAsmParser() const { return AsmParserCtorFn != 0; } + /// hasCodeEmitter - Check if this target supports instruction encoding. + bool hasCodeEmitter() const { return CodeEmitterCtorFn != 0; } + + /// @} + /// @name Feature Constructors + /// @{ /// createAsmInfo - Create a MCAsmInfo implementation for the specified /// target triple. @@ -155,6 +177,15 @@ namespace llvm { return 0; return AsmParserCtorFn(*this, Parser); } + + /// createCodeEmitter - Create a target specific code emitter. + MCCodeEmitter *createCodeEmitter(TargetMachine &TM) const { + if (!CodeEmitterCtorFn) + return 0; + return CodeEmitterCtorFn(*this, TM); + } + + /// @} }; /// TargetRegistry - Generic interface to target specific features. @@ -303,6 +334,20 @@ namespace llvm { T.AsmParserCtorFn = Fn; } + /// RegisterCodeEmitter - Register a MCCodeEmitter implementation for the + /// given target. + /// + /// Clients are responsible for ensuring that registration doesn't occur + /// while another thread is attempting to access the registry. Typically + /// this is done by initializing all targets at program startup. + /// + /// @param T - The target being registered. + /// @param Fn - A function to construct an AsmPrinter for the target. + static void RegisterCodeEmitter(Target &T, Target::CodeEmitterCtorTy Fn) { + if (!T.CodeEmitterCtorFn) + T.CodeEmitterCtorFn = Fn; + } + /// @} }; @@ -431,6 +476,26 @@ namespace llvm { } }; + /// RegisterCodeEmitter - Helper template for registering a target specific + /// machine code emitter, for use in the target initialization + /// function. Usage: + /// + /// extern "C" void LLVMInitializeFooCodeEmitter() { + /// extern Target TheFooTarget; + /// RegisterCodeEmitter X(TheFooTarget); + /// } + template + struct RegisterCodeEmitter { + RegisterCodeEmitter(Target &T) { + TargetRegistry::RegisterCodeEmitter(T, &Allocator); + } + + private: + static MCCodeEmitter *Allocator(const Target &T, TargetMachine &TM) { + return new CodeEmitterImpl(T, TM); + } + }; + } #endif diff --git a/libclamav/c++/llvm/include/llvm/Transforms/IPO/InlinerPass.h b/libclamav/c++/llvm/include/llvm/Transforms/IPO/InlinerPass.h index e8a869466..5d00f4215 100644 --- a/libclamav/c++/llvm/include/llvm/Transforms/IPO/InlinerPass.h +++ b/libclamav/c++/llvm/include/llvm/Transforms/IPO/InlinerPass.h @@ -14,16 +14,17 @@ // //===----------------------------------------------------------------------===// -#ifndef INLINER_H -#define INLINER_H +#ifndef LLVM_TRANSFORMS_IPO_INLINERPASS_H +#define LLVM_TRANSFORMS_IPO_INLINERPASS_H #include "llvm/CallGraphSCCPass.h" -#include "llvm/Transforms/Utils/InlineCost.h" - namespace llvm { class CallSite; class TargetData; + class InlineCost; + template + class SmallPtrSet; /// Inliner - This class contains all of the helper code which is used to /// perform the inlining operations that do not depend on the policy. @@ -39,17 +40,12 @@ struct Inliner : public CallGraphSCCPass { // Main run interface method, this implements the interface required by the // Pass class. - virtual bool runOnSCC(const std::vector &SCC); + virtual bool runOnSCC(std::vector &SCC); // doFinalization - Remove now-dead linkonce functions at the end of // processing to avoid breaking the SCC traversal. virtual bool doFinalization(CallGraph &CG); - // InlineCallIfPossible - bool InlineCallIfPossible(CallSite CS, CallGraph &CG, - const SmallPtrSet &SCCFunctions, - const TargetData *TD); - /// This method returns the value specified by the -inline-threshold value, /// specified on the command line. This is typically not directly needed. /// diff --git a/libclamav/c++/llvm/include/llvm/Transforms/Utils/Cloning.h b/libclamav/c++/llvm/include/llvm/Transforms/Utils/Cloning.h index 66cac9fea..5b15b5b87 100644 --- a/libclamav/c++/llvm/include/llvm/Transforms/Utils/Cloning.h +++ b/libclamav/c++/llvm/include/llvm/Transforms/Utils/Cloning.h @@ -18,7 +18,6 @@ #ifndef LLVM_TRANSFORMS_UTILS_CLONING_H #define LLVM_TRANSFORMS_UTILS_CLONING_H -#include #include "llvm/ADT/DenseMap.h" namespace llvm { @@ -39,6 +38,8 @@ class TargetData; class Loop; class LoopInfo; class LLVMContext; +class AllocaInst; +template class SmallVectorImpl; /// CloneModule - Return an exact copy of the specified module /// @@ -104,9 +105,9 @@ BasicBlock *CloneBasicBlock(const BasicBlock *BB, ClonedCodeInfo *CodeInfo = 0); -/// CloneLoop - Clone Loop. Clone dominator info for loop insiders. Populate ValueMap -/// using old blocks to new blocks mapping. -Loop *CloneLoop(Loop *L, LPPassManager *LPM, LoopInfo *LI, +/// CloneLoop - Clone Loop. Clone dominator info for loop insiders. Populate +/// ValueMap using old blocks to new blocks mapping. +Loop *CloneLoop(Loop *L, LPPassManager *LPM, LoopInfo *LI, DenseMap &ValueMap, Pass *P); /// CloneFunction - Return a copy of the specified function, but without @@ -137,7 +138,7 @@ inline Function *CloneFunction(const Function *F, ClonedCodeInfo *CodeInfo = 0){ /// void CloneFunctionInto(Function *NewFunc, const Function *OldFunc, DenseMap &ValueMap, - std::vector &Returns, + SmallVectorImpl &Returns, const char *NameSuffix = "", ClonedCodeInfo *CodeInfo = 0); @@ -150,25 +151,11 @@ void CloneFunctionInto(Function *NewFunc, const Function *OldFunc, /// used for things like CloneFunction or CloneModule. void CloneAndPruneFunctionInto(Function *NewFunc, const Function *OldFunc, DenseMap &ValueMap, - std::vector &Returns, + SmallVectorImpl &Returns, const char *NameSuffix = "", ClonedCodeInfo *CodeInfo = 0, const TargetData *TD = 0); - -/// CloneTraceInto - Clone T into NewFunc. Original<->clone mapping is -/// saved in ValueMap. -/// -void CloneTraceInto(Function *NewFunc, Trace &T, - DenseMap &ValueMap, - const char *NameSuffix); - -/// CloneTrace - Returns a copy of the specified trace. -/// It takes a vector of basic blocks clones the basic blocks, removes internal -/// phi nodes, adds it to the same function as the original (although there is -/// no jump to it) and returns the new vector of basic blocks. -std::vector CloneTrace(const std::vector &origTrace); - /// InlineFunction - This function inlines the called function into the basic /// block of the caller. This returns false if it is not possible to inline /// this call. The program is still in a well defined state if this occurs @@ -182,9 +169,15 @@ std::vector CloneTrace(const std::vector &origTrace); /// If a non-null callgraph pointer is provided, these functions update the /// CallGraph to represent the program after inlining. /// -bool InlineFunction(CallInst *C, CallGraph *CG = 0, const TargetData *TD = 0); -bool InlineFunction(InvokeInst *II, CallGraph *CG = 0, const TargetData *TD =0); -bool InlineFunction(CallSite CS, CallGraph *CG = 0, const TargetData *TD = 0); +/// If StaticAllocas is non-null, InlineFunction populates it with all of the +/// static allocas that it inlines into the caller. +/// +bool InlineFunction(CallInst *C, CallGraph *CG = 0, const TargetData *TD = 0, + SmallVectorImpl *StaticAllocas = 0); +bool InlineFunction(InvokeInst *II, CallGraph *CG = 0, const TargetData *TD = 0, + SmallVectorImpl *StaticAllocas = 0); +bool InlineFunction(CallSite CS, CallGraph *CG = 0, const TargetData *TD = 0, + SmallVectorImpl *StaticAllocas = 0); } // End llvm namespace diff --git a/libclamav/c++/llvm/include/llvm/Transforms/Utils/InlineCost.h b/libclamav/c++/llvm/include/llvm/Transforms/Utils/InlineCost.h index f275b7608..2d0c39722 100644 --- a/libclamav/c++/llvm/include/llvm/Transforms/Utils/InlineCost.h +++ b/libclamav/c++/llvm/include/llvm/Transforms/Utils/InlineCost.h @@ -14,7 +14,6 @@ #ifndef LLVM_TRANSFORMS_UTILS_INLINECOST_H #define LLVM_TRANSFORMS_UTILS_INLINECOST_H -#include "llvm/ADT/SmallPtrSet.h" #include #include #include @@ -25,6 +24,8 @@ namespace llvm { class Value; class Function; class CallSite; + template + class SmallPtrSet; /// InlineCost - Represent the cost of inlining a function. This /// supports special values for functions which should "always" or diff --git a/libclamav/c++/llvm/include/llvm/Type.h b/libclamav/c++/llvm/include/llvm/Type.h index 94ebf1e52..9c2fae0df 100644 --- a/libclamav/c++/llvm/include/llvm/Type.h +++ b/libclamav/c++/llvm/include/llvm/Type.h @@ -17,7 +17,6 @@ #include "llvm/Support/DataTypes.h" #include "llvm/System/Atomic.h" #include "llvm/ADT/GraphTraits.h" -#include "llvm/ADT/iterator.h" #include #include diff --git a/libclamav/c++/llvm/include/llvm/Use.h b/libclamav/c++/llvm/include/llvm/Use.h index 489dbc50a..970f69b9d 100644 --- a/libclamav/c++/llvm/include/llvm/Use.h +++ b/libclamav/c++/llvm/include/llvm/Use.h @@ -26,8 +26,8 @@ #define LLVM_USE_H #include "llvm/Support/Casting.h" -#include "llvm/ADT/iterator.h" #include "llvm/ADT/PointerIntPair.h" +#include namespace llvm { @@ -158,8 +158,9 @@ template<> struct simplify_type { template // UserTy == 'User' or 'const User' -class value_use_iterator : public forward_iterator { - typedef forward_iterator super; +class value_use_iterator : public std::iterator { + typedef std::iterator super; typedef value_use_iterator _Self; Use *U; diff --git a/libclamav/c++/llvm/include/llvm/Value.h b/libclamav/c++/llvm/include/llvm/Value.h index 47933f019..fdc3aeb95 100644 --- a/libclamav/c++/llvm/include/llvm/Value.h +++ b/libclamav/c++/llvm/include/llvm/Value.h @@ -240,6 +240,18 @@ public: return SubclassID; } + /// hasSameSubclassOptionalData - Test whether the optional flags contained + /// in this value are equal to the optional flags in the given value. + bool hasSameSubclassOptionalData(const Value *V) const { + return SubclassOptionalData == V->SubclassOptionalData; + } + + /// intersectOptionalDataWith - Clear any optional flags in this value + /// that are not also set in the given value. + void intersectOptionalDataWith(const Value *V) { + SubclassOptionalData &= V->SubclassOptionalData; + } + // Methods for support type inquiry through isa, cast, and dyn_cast: static inline bool classof(const Value *) { return true; // Values are always values. diff --git a/libclamav/c++/llvm/lib/Analysis/AliasAnalysis.cpp b/libclamav/c++/llvm/lib/Analysis/AliasAnalysis.cpp index 1d2efc1ed..c456990d8 100644 --- a/libclamav/c++/llvm/lib/Analysis/AliasAnalysis.cpp +++ b/libclamav/c++/llvm/lib/Analysis/AliasAnalysis.cpp @@ -233,13 +233,15 @@ bool llvm::isNoAliasCall(const Value *V) { /// isIdentifiedObject - Return true if this pointer refers to a distinct and /// identifiable object. This returns true for: -/// Global Variables and Functions +/// Global Variables and Functions (but not Global Aliases) /// Allocas and Mallocs /// ByVal and NoAlias Arguments /// NoAlias returns /// bool llvm::isIdentifiedObject(const Value *V) { - if (isa(V) || isa(V) || isNoAliasCall(V)) + if (isa(V) || isNoAliasCall(V)) + return true; + if (isa(V) && !isa(V)) return true; if (const Argument *A = dyn_cast(V)) return A->hasNoAliasAttr() || A->hasByValAttr(); diff --git a/libclamav/c++/llvm/lib/Analysis/AliasAnalysisCounter.cpp b/libclamav/c++/llvm/lib/Analysis/AliasAnalysisCounter.cpp index 73956a15a..06827ae45 100644 --- a/libclamav/c++/llvm/lib/Analysis/AliasAnalysisCounter.cpp +++ b/libclamav/c++/llvm/lib/Analysis/AliasAnalysisCounter.cpp @@ -23,7 +23,7 @@ using namespace llvm; static cl::opt -PrintAll("count-aa-print-all-queries", cl::ReallyHidden); +PrintAll("count-aa-print-all-queries", cl::ReallyHidden, cl::init(true)); static cl::opt PrintAllFailures("count-aa-print-all-failed-queries", cl::ReallyHidden); diff --git a/libclamav/c++/llvm/lib/Analysis/AliasAnalysisEvaluator.cpp b/libclamav/c++/llvm/lib/Analysis/AliasAnalysisEvaluator.cpp index 5194e494e..bb95c01e2 100644 --- a/libclamav/c++/llvm/lib/Analysis/AliasAnalysisEvaluator.cpp +++ b/libclamav/c++/llvm/lib/Analysis/AliasAnalysisEvaluator.cpp @@ -30,8 +30,7 @@ #include "llvm/Support/CommandLine.h" #include "llvm/Support/Compiler.h" #include "llvm/Support/raw_ostream.h" -#include -#include +#include "llvm/ADT/SetVector.h" using namespace llvm; static cl::opt PrintAll("print-all-alias-modref-info", cl::ReallyHidden); @@ -105,15 +104,15 @@ PrintModRefResults(const char *Msg, bool P, Instruction *I, Value *Ptr, if (P) { errs() << " " << Msg << ": Ptr: "; WriteAsOperand(errs(), Ptr, true, M); - errs() << "\t<->" << *I; + errs() << "\t<->" << *I << '\n'; } } bool AAEval::runOnFunction(Function &F) { AliasAnalysis &AA = getAnalysis(); - std::set Pointers; - std::set CallSites; + SetVector Pointers; + SetVector CallSites; for (Function::arg_iterator I = F.arg_begin(), E = F.arg_end(); I != E; ++I) if (isa(I->getType())) // Add all pointer arguments @@ -141,13 +140,13 @@ bool AAEval::runOnFunction(Function &F) { << " pointers, " << CallSites.size() << " call sites\n"; // iterate over the worklist, and run the full (n^2)/2 disambiguations - for (std::set::iterator I1 = Pointers.begin(), E = Pointers.end(); + for (SetVector::iterator I1 = Pointers.begin(), E = Pointers.end(); I1 != E; ++I1) { unsigned I1Size = ~0u; const Type *I1ElTy = cast((*I1)->getType())->getElementType(); if (I1ElTy->isSized()) I1Size = AA.getTypeStoreSize(I1ElTy); - for (std::set::iterator I2 = Pointers.begin(); I2 != I1; ++I2) { + for (SetVector::iterator I2 = Pointers.begin(); I2 != I1; ++I2) { unsigned I2Size = ~0u; const Type *I2ElTy =cast((*I2)->getType())->getElementType(); if (I2ElTy->isSized()) I2Size = AA.getTypeStoreSize(I2ElTy); @@ -169,11 +168,11 @@ bool AAEval::runOnFunction(Function &F) { } // Mod/ref alias analysis: compare all pairs of calls and values - for (std::set::iterator C = CallSites.begin(), + for (SetVector::iterator C = CallSites.begin(), Ce = CallSites.end(); C != Ce; ++C) { Instruction *I = C->getInstruction(); - for (std::set::iterator V = Pointers.begin(), Ve = Pointers.end(); + for (SetVector::iterator V = Pointers.begin(), Ve = Pointers.end(); V != Ve; ++V) { unsigned Size = ~0u; const Type *ElTy = cast((*V)->getType())->getElementType(); diff --git a/libclamav/c++/llvm/lib/Analysis/BasicAliasAnalysis.cpp b/libclamav/c++/llvm/lib/Analysis/BasicAliasAnalysis.cpp index 286f12a1b..9e9d0f10d 100644 --- a/libclamav/c++/llvm/lib/Analysis/BasicAliasAnalysis.cpp +++ b/libclamav/c++/llvm/lib/Analysis/BasicAliasAnalysis.cpp @@ -308,13 +308,9 @@ BasicAliasAnalysis::getModRefInfo(CallSite CS1, CallSite CS2) { AliasAnalysis::AliasResult BasicAliasAnalysis::alias(const Value *V1, unsigned V1Size, const Value *V2, unsigned V2Size) { - // Strip off any constant expression casts if they exist - if (const ConstantExpr *CE = dyn_cast(V1)) - if (CE->isCast() && isa(CE->getOperand(0)->getType())) - V1 = CE->getOperand(0); - if (const ConstantExpr *CE = dyn_cast(V2)) - if (CE->isCast() && isa(CE->getOperand(0)->getType())) - V2 = CE->getOperand(0); + // Strip off any casts if they exist. + V1 = V1->stripPointerCasts(); + V2 = V2->stripPointerCasts(); // Are we checking for alias of the same value? if (V1 == V2) return MustAlias; @@ -322,13 +318,6 @@ BasicAliasAnalysis::alias(const Value *V1, unsigned V1Size, if (!isa(V1->getType()) || !isa(V2->getType())) return NoAlias; // Scalars cannot alias each other - // Strip off cast instructions. Since V1 and V2 are pointers, they must be - // pointer<->pointer bitcasts. - if (const BitCastInst *I = dyn_cast(V1)) - return alias(I->getOperand(0), V1Size, V2, V2Size); - if (const BitCastInst *I = dyn_cast(V2)) - return alias(V1, V1Size, I->getOperand(0), V2Size); - // Figure out what objects these things are pointing to if we can. const Value *O1 = V1->getUnderlyingObject(); const Value *O2 = V2->getUnderlyingObject(); diff --git a/libclamav/c++/llvm/lib/Analysis/CFGPrinter.cpp b/libclamav/c++/llvm/lib/Analysis/CFGPrinter.cpp index 4ac6b8d8e..03cfb9d51 100644 --- a/libclamav/c++/llvm/lib/Analysis/CFGPrinter.cpp +++ b/libclamav/c++/llvm/lib/Analysis/CFGPrinter.cpp @@ -138,7 +138,7 @@ namespace { errs() << "Writing '" << Filename << "'..."; std::string ErrorInfo; - raw_fd_ostream File(Filename.c_str(), ErrorInfo, raw_fd_ostream::F_Force); + raw_fd_ostream File(Filename.c_str(), ErrorInfo); if (ErrorInfo.empty()) WriteGraph(File, (const Function*)&F); @@ -170,7 +170,7 @@ namespace { errs() << "Writing '" << Filename << "'..."; std::string ErrorInfo; - raw_fd_ostream File(Filename.c_str(), ErrorInfo, raw_fd_ostream::F_Force); + raw_fd_ostream File(Filename.c_str(), ErrorInfo); if (ErrorInfo.empty()) WriteGraph(File, (const Function*)&F, true); diff --git a/libclamav/c++/llvm/lib/Analysis/CMakeLists.txt b/libclamav/c++/llvm/lib/Analysis/CMakeLists.txt index 8adfe49e6..612063240 100644 --- a/libclamav/c++/llvm/lib/Analysis/CMakeLists.txt +++ b/libclamav/c++/llvm/lib/Analysis/CMakeLists.txt @@ -30,6 +30,7 @@ add_llvm_library(LLVMAnalysis ProfileInfoLoader.cpp ProfileInfoLoaderPass.cpp ScalarEvolution.cpp + ScalarEvolutionAliasAnalysis.cpp ScalarEvolutionExpander.cpp SparsePropagation.cpp Trace.cpp diff --git a/libclamav/c++/llvm/lib/Analysis/DbgInfoPrinter.cpp b/libclamav/c++/llvm/lib/Analysis/DbgInfoPrinter.cpp index 913490d60..8063476bb 100644 --- a/libclamav/c++/llvm/lib/Analysis/DbgInfoPrinter.cpp +++ b/libclamav/c++/llvm/lib/Analysis/DbgInfoPrinter.cpp @@ -90,7 +90,7 @@ void PrintDbgInfo::printStopPoint(const DbgStopPointInst *DSI) { } void PrintDbgInfo::printFuncStart(const DbgFuncStartInst *FS) { - DISubprogram Subprogram(cast(FS->getSubprogram())); + DISubprogram Subprogram(FS->getSubprogram()); std::string Res1, Res2; Out << "; fully qualified function name: " << Subprogram.getDisplayName(Res1) << " return type: " << Subprogram.getReturnTypeName(Res2) diff --git a/libclamav/c++/llvm/lib/Analysis/DebugInfo.cpp b/libclamav/c++/llvm/lib/Analysis/DebugInfo.cpp index b7c73f876..0d4b213e8 100644 --- a/libclamav/c++/llvm/lib/Analysis/DebugInfo.cpp +++ b/libclamav/c++/llvm/lib/Analysis/DebugInfo.cpp @@ -21,6 +21,7 @@ #include "llvm/LLVMContext.h" #include "llvm/Module.h" #include "llvm/Analysis/ValueTracking.h" +#include "llvm/ADT/SmallPtrSet.h" #include "llvm/Support/Dwarf.h" #include "llvm/Support/DebugLoc.h" #include "llvm/Support/raw_ostream.h" @@ -32,18 +33,12 @@ using namespace llvm::dwarf; //===----------------------------------------------------------------------===// /// ValidDebugInfo - Return true if V represents valid debug info value. -bool DIDescriptor::ValidDebugInfo(Value *V, CodeGenOpt::Level OptLevel) { - if (!V) +/// FIXME : Add DIDescriptor.isValid() +bool DIDescriptor::ValidDebugInfo(MDNode *N, CodeGenOpt::Level OptLevel) { + if (!N) return false; - GlobalVariable *GV = dyn_cast(V->stripPointerCasts()); - if (!GV) - return false; - - if (!GV->hasInternalLinkage () && !GV->hasLinkOnceLinkage()) - return false; - - DIDescriptor DI(GV); + DIDescriptor DI(N); // Check current version. Allow Version6 for now. unsigned Version = DI.getVersion(); @@ -53,13 +48,13 @@ bool DIDescriptor::ValidDebugInfo(Value *V, CodeGenOpt::Level OptLevel) { unsigned Tag = DI.getTag(); switch (Tag) { case DW_TAG_variable: - assert(DIVariable(GV).Verify() && "Invalid DebugInfo value"); + assert(DIVariable(N).Verify() && "Invalid DebugInfo value"); break; case DW_TAG_compile_unit: - assert(DICompileUnit(GV).Verify() && "Invalid DebugInfo value"); + assert(DICompileUnit(N).Verify() && "Invalid DebugInfo value"); break; case DW_TAG_subprogram: - assert(DISubprogram(GV).Verify() && "Invalid DebugInfo value"); + assert(DISubprogram(N).Verify() && "Invalid DebugInfo value"); break; case DW_TAG_lexical_block: // FIXME: This interfers with the quality of generated code during @@ -74,67 +69,58 @@ bool DIDescriptor::ValidDebugInfo(Value *V, CodeGenOpt::Level OptLevel) { return true; } -DIDescriptor::DIDescriptor(GlobalVariable *GV, unsigned RequiredTag) { - DbgGV = GV; +DIDescriptor::DIDescriptor(MDNode *N, unsigned RequiredTag) { + DbgNode = N; // If this is non-null, check to see if the Tag matches. If not, set to null. - if (GV && getTag() != RequiredTag) - DbgGV = 0; + if (N && getTag() != RequiredTag) { + DbgNode = 0; + } } const std::string & DIDescriptor::getStringField(unsigned Elt, std::string &Result) const { - if (DbgGV == 0) { - Result.clear(); + Result.clear(); + if (DbgNode == 0) return Result; - } - - Constant *C = DbgGV->getInitializer(); - if (C == 0 || Elt >= C->getNumOperands()) { - Result.clear(); - return Result; - } - - // Fills in the string if it succeeds - if (!GetConstantStringInfo(C->getOperand(Elt), Result)) - Result.clear(); + if (Elt < DbgNode->getNumElements()) + if (MDString *MDS = dyn_cast_or_null(DbgNode->getElement(Elt))) { + Result.assign(MDS->begin(), MDS->begin() + MDS->length()); + return Result; + } + return Result; } uint64_t DIDescriptor::getUInt64Field(unsigned Elt) const { - if (DbgGV == 0) return 0; - if (!DbgGV->hasInitializer()) return 0; - - Constant *C = DbgGV->getInitializer(); - if (C == 0 || Elt >= C->getNumOperands()) + if (DbgNode == 0) return 0; - if (ConstantInt *CI = dyn_cast(C->getOperand(Elt))) - return CI->getZExtValue(); + if (Elt < DbgNode->getNumElements()) + if (ConstantInt *CI = dyn_cast(DbgNode->getElement(Elt))) + return CI->getZExtValue(); + return 0; } DIDescriptor DIDescriptor::getDescriptorField(unsigned Elt) const { - if (DbgGV == 0) return DIDescriptor(); - - Constant *C = DbgGV->getInitializer(); - if (C == 0 || Elt >= C->getNumOperands()) + if (DbgNode == 0) return DIDescriptor(); - C = C->getOperand(Elt); - return DIDescriptor(dyn_cast(C->stripPointerCasts())); + if (Elt < DbgNode->getNumElements() && DbgNode->getElement(Elt)) + return DIDescriptor(dyn_cast(DbgNode->getElement(Elt))); + + return DIDescriptor(); } GlobalVariable *DIDescriptor::getGlobalVariableField(unsigned Elt) const { - if (DbgGV == 0) return 0; - - Constant *C = DbgGV->getInitializer(); - if (C == 0 || Elt >= C->getNumOperands()) + if (DbgNode == 0) return 0; - C = C->getOperand(Elt); - return dyn_cast(C->stripPointerCasts()); + if (Elt < DbgNode->getNumElements()) + return dyn_cast(DbgNode->getElement(Elt)); + return 0; } //===----------------------------------------------------------------------===// @@ -142,12 +128,13 @@ GlobalVariable *DIDescriptor::getGlobalVariableField(unsigned Elt) const { //===----------------------------------------------------------------------===// // Needed by DIVariable::getType(). -DIType::DIType(GlobalVariable *GV) : DIDescriptor(GV) { - if (!GV) return; +DIType::DIType(MDNode *N) : DIDescriptor(N) { + if (!N) return; unsigned tag = getTag(); if (tag != dwarf::DW_TAG_base_type && !DIDerivedType::isDerivedType(tag) && - !DICompositeType::isCompositeType(tag)) - DbgGV = 0; + !DICompositeType::isCompositeType(tag)) { + DbgNode = 0; + } } /// isDerivedType - Return true if the specified tag is legal for @@ -164,9 +151,8 @@ bool DIType::isDerivedType(unsigned Tag) { case dwarf::DW_TAG_inheritance: return true; default: - // FIXME: Even though it doesn't make sense, CompositeTypes are current - // modelled as DerivedTypes, this should return true for them as well. - return false; + // CompositeTypes are currently modelled as DerivedTypes. + return isCompositeType(Tag); } } @@ -200,10 +186,8 @@ bool DIVariable::isVariable(unsigned Tag) { } unsigned DIArray::getNumElements() const { - assert (DbgGV && "Invalid DIArray"); - Constant *C = DbgGV->getInitializer(); - assert (C && "Invalid DIArray initializer"); - return C->getNumOperands(); + assert (DbgNode && "Invalid DIArray"); + return DbgNode->getNumElements(); } /// replaceAllUsesWith - Replace all uses of debug info referenced by @@ -214,8 +198,8 @@ void DIDerivedType::replaceAllUsesWith(DIDescriptor &D) { return; assert (!D.isNull() && "Can not replace with null"); - getGV()->replaceAllUsesWith(D.getGV()); - getGV()->eraseFromParent(); + DbgNode->replaceAllUsesWith(D.getNode()); + delete DbgNode; } /// Verify - Verify that a compile unit is well formed. @@ -341,8 +325,8 @@ bool DISubprogram::describes(const Function *F) { /// dump - Print descriptor. void DIDescriptor::dump() const { - errs() << "[" << dwarf::TagString(getTag()) << "] [GV:"; - errs().write_hex((intptr_t)DbgGV) << ']'; + errs() << "[" << dwarf::TagString(getTag()) << "] "; + errs().write_hex((intptr_t)DbgNode) << ']'; } /// dump - Print compile unit. @@ -383,11 +367,11 @@ void DIType::dump() const { errs() << " [fwd] "; if (isBasicType(Tag)) - DIBasicType(DbgGV).dump(); + DIBasicType(DbgNode).dump(); else if (isDerivedType(Tag)) - DIDerivedType(DbgGV).dump(); + DIDerivedType(DbgNode).dump(); else if (isCompositeType(Tag)) - DICompositeType(DbgGV).dump(); + DICompositeType(DbgNode).dump(); else { errs() << "Invalid DIType\n"; return; @@ -434,7 +418,7 @@ void DIGlobal::dump() const { errs() << " [def] "; if (isGlobalVariable(Tag)) - DIGlobalVariable(DbgGV).dump(); + DIGlobalVariable(DbgNode).dump(); errs() << "\n"; } @@ -474,43 +458,12 @@ DIFactory::DIFactory(Module &m) EmptyStructPtr = PointerType::getUnqual(StructType::get(VMContext)); } -/// getCastToEmpty - Return this descriptor as a Constant* with type '{}*'. -/// This is only valid when the descriptor is non-null. -Constant *DIFactory::getCastToEmpty(DIDescriptor D) { - if (D.isNull()) return llvm::Constant::getNullValue(EmptyStructPtr); - return ConstantExpr::getBitCast(D.getGV(), EmptyStructPtr); -} - Constant *DIFactory::GetTagConstant(unsigned TAG) { assert((TAG & LLVMDebugVersionMask) == 0 && "Tag too large for debug encoding!"); return ConstantInt::get(Type::getInt32Ty(VMContext), TAG | LLVMDebugVersion); } -Constant *DIFactory::GetStringConstant(const std::string &String) { - // Check string cache for previous edition. - Constant *&Slot = StringCache[String]; - - // Return Constant if previously defined. - if (Slot) return Slot; - - const PointerType *DestTy = PointerType::getUnqual(Type::getInt8Ty(VMContext)); - - // If empty string then use a i8* null instead. - if (String.empty()) - return Slot = ConstantPointerNull::get(DestTy); - - // Construct string as an llvm constant. - Constant *ConstStr = ConstantArray::get(VMContext, String); - - // Otherwise create and return a new string global. - GlobalVariable *StrGV = new GlobalVariable(M, ConstStr->getType(), true, - GlobalVariable::InternalLinkage, - ConstStr, ".str"); - StrGV->setSection("llvm.metadata"); - return Slot = ConstantExpr::getBitCast(StrGV, DestTy); -} - //===----------------------------------------------------------------------===// // DIFactory: Primary Constructors //===----------------------------------------------------------------------===// @@ -518,50 +471,27 @@ Constant *DIFactory::GetStringConstant(const std::string &String) { /// GetOrCreateArray - Create an descriptor for an array of descriptors. /// This implicitly uniques the arrays created. DIArray DIFactory::GetOrCreateArray(DIDescriptor *Tys, unsigned NumTys) { - SmallVector Elts; + SmallVector Elts; - for (unsigned i = 0; i != NumTys; ++i) - Elts.push_back(getCastToEmpty(Tys[i])); - - Constant *Init = ConstantArray::get(ArrayType::get(EmptyStructPtr, - Elts.size()), - Elts.data(), Elts.size()); - // If we already have this array, just return the uniqued version. - DIDescriptor &Entry = SimpleConstantCache[Init]; - if (!Entry.isNull()) return DIArray(Entry.getGV()); + if (NumTys == 0) + Elts.push_back(llvm::Constant::getNullValue(Type::getInt32Ty(VMContext))); + else + for (unsigned i = 0; i != NumTys; ++i) + Elts.push_back(Tys[i].getNode()); - GlobalVariable *GV = new GlobalVariable(M, Init->getType(), true, - GlobalValue::InternalLinkage, - Init, "llvm.dbg.array"); - GV->setSection("llvm.metadata"); - Entry = DIDescriptor(GV); - return DIArray(GV); + return DIArray(MDNode::get(VMContext,Elts.data(), Elts.size())); } /// GetOrCreateSubrange - Create a descriptor for a value range. This /// implicitly uniques the values returned. DISubrange DIFactory::GetOrCreateSubrange(int64_t Lo, int64_t Hi) { - Constant *Elts[] = { + Value *Elts[] = { GetTagConstant(dwarf::DW_TAG_subrange_type), ConstantInt::get(Type::getInt64Ty(VMContext), Lo), ConstantInt::get(Type::getInt64Ty(VMContext), Hi) }; - Constant *Init = ConstantStruct::get(VMContext, Elts, - sizeof(Elts)/sizeof(Elts[0])); - - // If we already have this range, just return the uniqued version. - DIDescriptor &Entry = SimpleConstantCache[Init]; - if (!Entry.isNull()) return DISubrange(Entry.getGV()); - - M.addTypeName("llvm.dbg.subrange.type", Init->getType()); - - GlobalVariable *GV = new GlobalVariable(M, Init->getType(), true, - GlobalValue::InternalLinkage, - Init, "llvm.dbg.subrange"); - GV->setSection("llvm.metadata"); - Entry = DIDescriptor(GV); - return DISubrange(GV); + return DISubrange(MDNode::get(VMContext, &Elts[0], 3)); } @@ -576,47 +506,30 @@ DICompileUnit DIFactory::CreateCompileUnit(unsigned LangID, bool isOptimized, const char *Flags, unsigned RunTimeVer) { - Constant *Elts[] = { + Value *Elts[] = { GetTagConstant(dwarf::DW_TAG_compile_unit), - llvm::Constant::getNullValue(EmptyStructPtr), + llvm::Constant::getNullValue(Type::getInt32Ty(VMContext)), ConstantInt::get(Type::getInt32Ty(VMContext), LangID), - GetStringConstant(Filename), - GetStringConstant(Directory), - GetStringConstant(Producer), + MDString::get(VMContext, Filename), + MDString::get(VMContext, Directory), + MDString::get(VMContext, Producer), ConstantInt::get(Type::getInt1Ty(VMContext), isMain), ConstantInt::get(Type::getInt1Ty(VMContext), isOptimized), - GetStringConstant(Flags), + MDString::get(VMContext, Flags), ConstantInt::get(Type::getInt32Ty(VMContext), RunTimeVer) }; - - Constant *Init = ConstantStruct::get(VMContext, Elts, - sizeof(Elts)/sizeof(Elts[0])); - - M.addTypeName("llvm.dbg.compile_unit.type", Init->getType()); - GlobalVariable *GV = new GlobalVariable(M, Init->getType(), true, - GlobalValue::InternalLinkage, - Init, "llvm.dbg.compile_unit"); - GV->setSection("llvm.metadata"); - return DICompileUnit(GV); + + return DICompileUnit(MDNode::get(VMContext, &Elts[0], 10)); } /// CreateEnumerator - Create a single enumerator value. DIEnumerator DIFactory::CreateEnumerator(const std::string &Name, uint64_t Val){ - Constant *Elts[] = { + Value *Elts[] = { GetTagConstant(dwarf::DW_TAG_enumerator), - GetStringConstant(Name), + MDString::get(VMContext, Name), ConstantInt::get(Type::getInt64Ty(VMContext), Val) }; - - Constant *Init = ConstantStruct::get(VMContext, Elts, - sizeof(Elts)/sizeof(Elts[0])); - - M.addTypeName("llvm.dbg.enumerator.type", Init->getType()); - GlobalVariable *GV = new GlobalVariable(M, Init->getType(), true, - GlobalValue::InternalLinkage, - Init, "llvm.dbg.enumerator"); - GV->setSection("llvm.metadata"); - return DIEnumerator(GV); + return DIEnumerator(MDNode::get(VMContext, &Elts[0], 3)); } @@ -629,11 +542,11 @@ DIBasicType DIFactory::CreateBasicType(DIDescriptor Context, uint64_t AlignInBits, uint64_t OffsetInBits, unsigned Flags, unsigned Encoding) { - Constant *Elts[] = { + Value *Elts[] = { GetTagConstant(dwarf::DW_TAG_base_type), - getCastToEmpty(Context), - GetStringConstant(Name), - getCastToEmpty(CompileUnit), + Context.getNode(), + MDString::get(VMContext, Name), + CompileUnit.getNode(), ConstantInt::get(Type::getInt32Ty(VMContext), LineNumber), ConstantInt::get(Type::getInt64Ty(VMContext), SizeInBits), ConstantInt::get(Type::getInt64Ty(VMContext), AlignInBits), @@ -641,16 +554,7 @@ DIBasicType DIFactory::CreateBasicType(DIDescriptor Context, ConstantInt::get(Type::getInt32Ty(VMContext), Flags), ConstantInt::get(Type::getInt32Ty(VMContext), Encoding) }; - - Constant *Init = ConstantStruct::get(VMContext, Elts, - sizeof(Elts)/sizeof(Elts[0])); - - M.addTypeName("llvm.dbg.basictype.type", Init->getType()); - GlobalVariable *GV = new GlobalVariable(M, Init->getType(), true, - GlobalValue::InternalLinkage, - Init, "llvm.dbg.basictype"); - GV->setSection("llvm.metadata"); - return DIBasicType(GV); + return DIBasicType(MDNode::get(VMContext, &Elts[0], 10)); } /// CreateDerivedType - Create a derived type like const qualified type, @@ -665,28 +569,19 @@ DIDerivedType DIFactory::CreateDerivedType(unsigned Tag, uint64_t OffsetInBits, unsigned Flags, DIType DerivedFrom) { - Constant *Elts[] = { + Value *Elts[] = { GetTagConstant(Tag), - getCastToEmpty(Context), - GetStringConstant(Name), - getCastToEmpty(CompileUnit), + Context.getNode(), + MDString::get(VMContext, Name), + CompileUnit.getNode(), ConstantInt::get(Type::getInt32Ty(VMContext), LineNumber), ConstantInt::get(Type::getInt64Ty(VMContext), SizeInBits), ConstantInt::get(Type::getInt64Ty(VMContext), AlignInBits), ConstantInt::get(Type::getInt64Ty(VMContext), OffsetInBits), ConstantInt::get(Type::getInt32Ty(VMContext), Flags), - getCastToEmpty(DerivedFrom) + DerivedFrom.getNode(), }; - - Constant *Init = ConstantStruct::get(VMContext, Elts, - sizeof(Elts)/sizeof(Elts[0])); - - M.addTypeName("llvm.dbg.derivedtype.type", Init->getType()); - GlobalVariable *GV = new GlobalVariable(M, Init->getType(), true, - GlobalValue::InternalLinkage, - Init, "llvm.dbg.derivedtype"); - GV->setSection("llvm.metadata"); - return DIDerivedType(GV); + return DIDerivedType(MDNode::get(VMContext, &Elts[0], 10)); } /// CreateCompositeType - Create a composite type like array, struct, etc. @@ -703,30 +598,21 @@ DICompositeType DIFactory::CreateCompositeType(unsigned Tag, DIArray Elements, unsigned RuntimeLang) { - Constant *Elts[] = { + Value *Elts[] = { GetTagConstant(Tag), - getCastToEmpty(Context), - GetStringConstant(Name), - getCastToEmpty(CompileUnit), + Context.getNode(), + MDString::get(VMContext, Name), + CompileUnit.getNode(), ConstantInt::get(Type::getInt32Ty(VMContext), LineNumber), ConstantInt::get(Type::getInt64Ty(VMContext), SizeInBits), ConstantInt::get(Type::getInt64Ty(VMContext), AlignInBits), ConstantInt::get(Type::getInt64Ty(VMContext), OffsetInBits), ConstantInt::get(Type::getInt32Ty(VMContext), Flags), - getCastToEmpty(DerivedFrom), - getCastToEmpty(Elements), + DerivedFrom.getNode(), + Elements.getNode(), ConstantInt::get(Type::getInt32Ty(VMContext), RuntimeLang) }; - - Constant *Init = ConstantStruct::get(VMContext, Elts, - sizeof(Elts)/sizeof(Elts[0])); - - M.addTypeName("llvm.dbg.composite.type", Init->getType()); - GlobalVariable *GV = new GlobalVariable(M, Init->getType(), true, - GlobalValue::InternalLinkage, - Init, "llvm.dbg.composite"); - GV->setSection("llvm.metadata"); - return DICompositeType(GV); + return DICompositeType(MDNode::get(VMContext, &Elts[0], 12)); } @@ -742,29 +628,20 @@ DISubprogram DIFactory::CreateSubprogram(DIDescriptor Context, bool isLocalToUnit, bool isDefinition) { - Constant *Elts[] = { + Value *Elts[] = { GetTagConstant(dwarf::DW_TAG_subprogram), - llvm::Constant::getNullValue(EmptyStructPtr), - getCastToEmpty(Context), - GetStringConstant(Name), - GetStringConstant(DisplayName), - GetStringConstant(LinkageName), - getCastToEmpty(CompileUnit), + llvm::Constant::getNullValue(Type::getInt32Ty(VMContext)), + Context.getNode(), + MDString::get(VMContext, Name), + MDString::get(VMContext, DisplayName), + MDString::get(VMContext, LinkageName), + CompileUnit.getNode(), ConstantInt::get(Type::getInt32Ty(VMContext), LineNo), - getCastToEmpty(Type), + Type.getNode(), ConstantInt::get(Type::getInt1Ty(VMContext), isLocalToUnit), ConstantInt::get(Type::getInt1Ty(VMContext), isDefinition) }; - - Constant *Init = ConstantStruct::get(VMContext, Elts, - sizeof(Elts)/sizeof(Elts[0])); - - M.addTypeName("llvm.dbg.subprogram.type", Init->getType()); - GlobalVariable *GV = new GlobalVariable(M, Init->getType(), true, - GlobalValue::InternalLinkage, - Init, "llvm.dbg.subprogram"); - GV->setSection("llvm.metadata"); - return DISubprogram(GV); + return DISubprogram(MDNode::get(VMContext, &Elts[0], 11)); } /// CreateGlobalVariable - Create a new descriptor for the specified global. @@ -775,30 +652,29 @@ DIFactory::CreateGlobalVariable(DIDescriptor Context, const std::string &Name, DICompileUnit CompileUnit, unsigned LineNo, DIType Type,bool isLocalToUnit, bool isDefinition, llvm::GlobalVariable *Val) { - Constant *Elts[] = { + Value *Elts[] = { GetTagConstant(dwarf::DW_TAG_variable), - llvm::Constant::getNullValue(EmptyStructPtr), - getCastToEmpty(Context), - GetStringConstant(Name), - GetStringConstant(DisplayName), - GetStringConstant(LinkageName), - getCastToEmpty(CompileUnit), + llvm::Constant::getNullValue(Type::getInt32Ty(VMContext)), + Context.getNode(), + MDString::get(VMContext, Name), + MDString::get(VMContext, DisplayName), + MDString::get(VMContext, LinkageName), + CompileUnit.getNode(), ConstantInt::get(Type::getInt32Ty(VMContext), LineNo), - getCastToEmpty(Type), + Type.getNode(), ConstantInt::get(Type::getInt1Ty(VMContext), isLocalToUnit), ConstantInt::get(Type::getInt1Ty(VMContext), isDefinition), - ConstantExpr::getBitCast(Val, EmptyStructPtr) + Val }; - - Constant *Init = ConstantStruct::get(VMContext, Elts, - sizeof(Elts)/sizeof(Elts[0])); - - M.addTypeName("llvm.dbg.global_variable.type", Init->getType()); - GlobalVariable *GV = new GlobalVariable(M, Init->getType(), true, - GlobalValue::LinkOnceAnyLinkage, - Init, "llvm.dbg.global_variable"); - GV->setSection("llvm.metadata"); - return DIGlobalVariable(GV); + + Value *const *Vs = &Elts[0]; + MDNode *Node = MDNode::get(VMContext,Vs, 12); + + // Create a named metadata so that we do not lose this mdnode. + NamedMDNode *NMD = M.getOrInsertNamedMetadata("llvm.dbg.gv"); + NMD->addElement(Node); + + return DIGlobalVariable(Node); } @@ -807,44 +683,26 @@ DIVariable DIFactory::CreateVariable(unsigned Tag, DIDescriptor Context, const std::string &Name, DICompileUnit CompileUnit, unsigned LineNo, DIType Type) { - Constant *Elts[] = { + Value *Elts[] = { GetTagConstant(Tag), - getCastToEmpty(Context), - GetStringConstant(Name), - getCastToEmpty(CompileUnit), + Context.getNode(), + MDString::get(VMContext, Name), + CompileUnit.getNode(), ConstantInt::get(Type::getInt32Ty(VMContext), LineNo), - getCastToEmpty(Type) + Type.getNode(), }; - - Constant *Init = ConstantStruct::get(VMContext, Elts, - sizeof(Elts)/sizeof(Elts[0])); - - M.addTypeName("llvm.dbg.variable.type", Init->getType()); - GlobalVariable *GV = new GlobalVariable(M, Init->getType(), true, - GlobalValue::InternalLinkage, - Init, "llvm.dbg.variable"); - GV->setSection("llvm.metadata"); - return DIVariable(GV); + return DIVariable(MDNode::get(VMContext, &Elts[0], 6)); } /// CreateBlock - This creates a descriptor for a lexical block with the /// specified parent VMContext. DIBlock DIFactory::CreateBlock(DIDescriptor Context) { - Constant *Elts[] = { + Value *Elts[] = { GetTagConstant(dwarf::DW_TAG_lexical_block), - getCastToEmpty(Context) + Context.getNode() }; - - Constant *Init = ConstantStruct::get(VMContext, Elts, - sizeof(Elts)/sizeof(Elts[0])); - - M.addTypeName("llvm.dbg.block.type", Init->getType()); - GlobalVariable *GV = new GlobalVariable(M, Init->getType(), true, - GlobalValue::InternalLinkage, - Init, "llvm.dbg.block"); - GV->setSection("llvm.metadata"); - return DIBlock(GV); + return DIBlock(MDNode::get(VMContext, &Elts[0], 2)); } @@ -866,7 +724,7 @@ void DIFactory::InsertStopPoint(DICompileUnit CU, unsigned LineNo, Value *Args[] = { ConstantInt::get(llvm::Type::getInt32Ty(VMContext), LineNo), ConstantInt::get(llvm::Type::getInt32Ty(VMContext), ColNo), - getCastToEmpty(CU) + CU.getNode() }; CallInst::Create(StopPointFn, Args, Args+3, "", BB); } @@ -879,7 +737,7 @@ void DIFactory::InsertSubprogramStart(DISubprogram SP, BasicBlock *BB) { FuncStartFn = Intrinsic::getDeclaration(&M, Intrinsic::dbg_func_start); // Call llvm.dbg.func.start which also implicitly sets a stoppoint. - CallInst::Create(FuncStartFn, getCastToEmpty(SP), "", BB); + CallInst::Create(FuncStartFn, SP.getNode(), "", BB); } /// InsertRegionStart - Insert a new llvm.dbg.region.start intrinsic call to @@ -890,7 +748,7 @@ void DIFactory::InsertRegionStart(DIDescriptor D, BasicBlock *BB) { RegionStartFn = Intrinsic::getDeclaration(&M, Intrinsic::dbg_region_start); // Call llvm.dbg.func.start. - CallInst::Create(RegionStartFn, getCastToEmpty(D), "", BB); + CallInst::Create(RegionStartFn, D.getNode(), "", BB); } /// InsertRegionEnd - Insert a new llvm.dbg.region.end intrinsic call to @@ -901,7 +759,7 @@ void DIFactory::InsertRegionEnd(DIDescriptor D, BasicBlock *BB) { RegionEndFn = Intrinsic::getDeclaration(&M, Intrinsic::dbg_region_end); // Call llvm.dbg.region.end. - CallInst::Create(RegionEndFn, getCastToEmpty(D), "", BB); + CallInst::Create(RegionEndFn, D.getNode(), "", BB); } /// InsertDeclare - Insert a new llvm.dbg.declare intrinsic call. @@ -912,17 +770,19 @@ void DIFactory::InsertDeclare(Value *Storage, DIVariable D, BasicBlock *BB) { if (!DeclareFn) DeclareFn = Intrinsic::getDeclaration(&M, Intrinsic::dbg_declare); - Value *Args[] = { Storage, getCastToEmpty(D) }; + Value *Args[] = { Storage, D.getNode() }; CallInst::Create(DeclareFn, Args, Args+2, "", BB); } + //===----------------------------------------------------------------------===// // DebugInfoFinder implementations. //===----------------------------------------------------------------------===// /// processModule - Process entire module and collect debug info. void DebugInfoFinder::processModule(Module &M) { - + + for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) for (Function::iterator FI = (*I).begin(), FE = (*I).end(); FI != FE; ++FI) for (BasicBlock::iterator BI = (*FI).begin(), BE = (*FI).end(); BI != BE; @@ -938,15 +798,13 @@ void DebugInfoFinder::processModule(Module &M) { else if (DbgDeclareInst *DDI = dyn_cast(BI)) processDeclare(DDI); } - - for (Module::global_iterator GVI = M.global_begin(), GVE = M.global_end(); - GVI != GVE; ++GVI) { - GlobalVariable *GV = GVI; - if (!GV->hasName() || !GV->isConstant() - || strncmp(GV->getName().data(), "llvm.dbg.global_variable", 24) - || !GV->hasInitializer()) - continue; - DIGlobalVariable DIG(GV); + + NamedMDNode *NMD = M.getNamedMetadata("llvm.dbg.gv"); + if (!NMD) + return; + + for (unsigned i = 0, e = NMD->getNumElements(); i != e; ++i) { + DIGlobalVariable DIG(cast(NMD->getElement(i))); if (addGlobalVariable(DIG)) { addCompileUnit(DIG.getCompileUnit()); processType(DIG.getType()); @@ -961,20 +819,20 @@ void DebugInfoFinder::processType(DIType DT) { addCompileUnit(DT.getCompileUnit()); if (DT.isCompositeType(DT.getTag())) { - DICompositeType DCT(DT.getGV()); + DICompositeType DCT(DT.getNode()); processType(DCT.getTypeDerivedFrom()); DIArray DA = DCT.getTypeArray(); if (!DA.isNull()) for (unsigned i = 0, e = DA.getNumElements(); i != e; ++i) { DIDescriptor D = DA.getElement(i); - DIType TypeE = DIType(D.getGV()); + DIType TypeE = DIType(D.getNode()); if (!TypeE.isNull()) processType(TypeE); else - processSubprogram(DISubprogram(D.getGV())); + processSubprogram(DISubprogram(D.getNode())); } } else if (DT.isDerivedType(DT.getTag())) { - DIDerivedType DDT(DT.getGV()); + DIDerivedType DDT(DT.getNode()); if (!DDT.isNull()) processType(DDT.getTypeDerivedFrom()); } @@ -992,35 +850,35 @@ void DebugInfoFinder::processSubprogram(DISubprogram SP) { /// processStopPoint - Process DbgStopPointInst. void DebugInfoFinder::processStopPoint(DbgStopPointInst *SPI) { - GlobalVariable *Context = dyn_cast(SPI->getContext()); + MDNode *Context = dyn_cast(SPI->getContext()); addCompileUnit(DICompileUnit(Context)); } /// processFuncStart - Process DbgFuncStartInst. void DebugInfoFinder::processFuncStart(DbgFuncStartInst *FSI) { - GlobalVariable *SP = dyn_cast(FSI->getSubprogram()); + MDNode *SP = dyn_cast(FSI->getSubprogram()); processSubprogram(DISubprogram(SP)); } /// processRegionStart - Process DbgRegionStart. void DebugInfoFinder::processRegionStart(DbgRegionStartInst *DRS) { - GlobalVariable *SP = dyn_cast(DRS->getContext()); + MDNode *SP = dyn_cast(DRS->getContext()); processSubprogram(DISubprogram(SP)); } /// processRegionEnd - Process DbgRegionEnd. void DebugInfoFinder::processRegionEnd(DbgRegionEndInst *DRE) { - GlobalVariable *SP = dyn_cast(DRE->getContext()); + MDNode *SP = dyn_cast(DRE->getContext()); processSubprogram(DISubprogram(SP)); } /// processDeclare - Process DbgDeclareInst. void DebugInfoFinder::processDeclare(DbgDeclareInst *DDI) { - DIVariable DV(cast(DDI->getVariable())); + DIVariable DV(cast(DDI->getVariable())); if (DV.isNull()) return; - if (!NodesSeen.insert(DV.getGV())) + if (!NodesSeen.insert(DV.getNode())) return; addCompileUnit(DV.getCompileUnit()); @@ -1032,10 +890,10 @@ bool DebugInfoFinder::addType(DIType DT) { if (DT.isNull()) return false; - if (!NodesSeen.insert(DT.getGV())) + if (!NodesSeen.insert(DT.getNode())) return false; - TYs.push_back(DT.getGV()); + TYs.push_back(DT.getNode()); return true; } @@ -1044,10 +902,10 @@ bool DebugInfoFinder::addCompileUnit(DICompileUnit CU) { if (CU.isNull()) return false; - if (!NodesSeen.insert(CU.getGV())) + if (!NodesSeen.insert(CU.getNode())) return false; - CUs.push_back(CU.getGV()); + CUs.push_back(CU.getNode()); return true; } @@ -1056,10 +914,10 @@ bool DebugInfoFinder::addGlobalVariable(DIGlobalVariable DIG) { if (DIG.isNull()) return false; - if (!NodesSeen.insert(DIG.getGV())) + if (!NodesSeen.insert(DIG.getNode())) return false; - GVs.push_back(DIG.getGV()); + GVs.push_back(DIG.getNode()); return true; } @@ -1068,10 +926,10 @@ bool DebugInfoFinder::addSubprogram(DISubprogram SP) { if (SP.isNull()) return false; - if (!NodesSeen.insert(SP.getGV())) + if (!NodesSeen.insert(SP.getNode())) return false; - SPs.push_back(SP.getGV()); + SPs.push_back(SP.getNode()); return true; } @@ -1124,31 +982,17 @@ namespace llvm { Value *findDbgGlobalDeclare(GlobalVariable *V) { const Module *M = V->getParent(); + NamedMDNode *NMD = M->getNamedMetadata("llvm.dbg.gv"); + if (!NMD) + return 0; - const Type *Ty = M->getTypeByName("llvm.dbg.global_variable.type"); - if (!Ty) return 0; - - Ty = PointerType::get(Ty, 0); - - Value *Val = V->stripPointerCasts(); - for (Value::use_iterator I = Val->use_begin(), E = Val->use_end(); - I != E; ++I) { - if (ConstantExpr *CE = dyn_cast(I)) { - if (CE->getOpcode() == Instruction::BitCast) { - Value *VV = CE; - - while (VV->hasOneUse()) - VV = *VV->use_begin(); - - if (VV->getType() == Ty) - return VV; - } - } + for (unsigned i = 0, e = NMD->getNumElements(); i != e; ++i) { + DIGlobalVariable DIG(cast_or_null(NMD->getElement(i))); + if (DIG.isNull()) + continue; + if (DIG.getGlobal() == V) + return DIG.getNode(); } - - if (Val->getType() == Ty) - return Val; - return 0; } @@ -1185,7 +1029,7 @@ namespace llvm { if (GlobalVariable *GV = dyn_cast(const_cast(V))) { Value *DIGV = findDbgGlobalDeclare(GV); if (!DIGV) return false; - DIGlobalVariable Var(cast(DIGV)); + DIGlobalVariable Var(cast(DIGV)); Var.getDisplayName(DisplayName); LineNo = Var.getLineNumber(); @@ -1194,7 +1038,7 @@ namespace llvm { } else { const DbgDeclareInst *DDI = findDbgDeclare(V); if (!DDI) return false; - DIVariable Var(cast(DDI->getVariable())); + DIVariable Var(cast(DDI->getVariable())); Var.getName(DisplayName); LineNo = Var.getLineNumber(); @@ -1252,7 +1096,7 @@ namespace llvm { Value *Context = SPI.getContext(); // If this location is already tracked then use it. - DebugLocTuple Tuple(cast(Context), SPI.getLine(), + DebugLocTuple Tuple(cast(Context), SPI.getLine(), SPI.getColumn()); DenseMap::iterator II = DebugLocInfo.DebugIdMap.find(Tuple); @@ -1274,12 +1118,12 @@ namespace llvm { DebugLoc DL; Value *SP = FSI.getSubprogram(); - DISubprogram Subprogram(cast(SP)); + DISubprogram Subprogram(cast(SP)); unsigned Line = Subprogram.getLineNumber(); DICompileUnit CU(Subprogram.getCompileUnit()); // If this location is already tracked then use it. - DebugLocTuple Tuple(CU.getGV(), Line, /* Column */ 0); + DebugLocTuple Tuple(CU.getNode(), Line, /* Column */ 0); DenseMap::iterator II = DebugLocInfo.DebugIdMap.find(Tuple); if (II != DebugLocInfo.DebugIdMap.end()) @@ -1295,7 +1139,7 @@ namespace llvm { /// isInlinedFnStart - Return true if FSI is starting an inlined function. bool isInlinedFnStart(DbgFuncStartInst &FSI, const Function *CurrentFn) { - DISubprogram Subprogram(cast(FSI.getSubprogram())); + DISubprogram Subprogram(cast(FSI.getSubprogram())); if (Subprogram.describes(CurrentFn)) return false; @@ -1304,11 +1148,10 @@ namespace llvm { /// isInlinedFnEnd - Return true if REI is ending an inlined function. bool isInlinedFnEnd(DbgRegionEndInst &REI, const Function *CurrentFn) { - DISubprogram Subprogram(cast(REI.getContext())); + DISubprogram Subprogram(cast(REI.getContext())); if (Subprogram.isNull() || Subprogram.describes(CurrentFn)) return false; return true; } - } diff --git a/libclamav/c++/llvm/lib/Analysis/IPA/Andersens.cpp b/libclamav/c++/llvm/lib/Analysis/IPA/Andersens.cpp index 01566a065..9de1fcc5c 100644 --- a/libclamav/c++/llvm/lib/Analysis/IPA/Andersens.cpp +++ b/libclamav/c++/llvm/lib/Analysis/IPA/Andersens.cpp @@ -617,7 +617,8 @@ namespace { char Andersens::ID = 0; static RegisterPass -X("anders-aa", "Andersen's Interprocedural Alias Analysis", false, true); +X("anders-aa", "Andersen's Interprocedural Alias Analysis (experimental)", + false, true); static RegisterAnalysisGroup Y(X); // Initialize Timestamp Counter (static). diff --git a/libclamav/c++/llvm/lib/Analysis/IPA/CallGraph.cpp b/libclamav/c++/llvm/lib/Analysis/IPA/CallGraph.cpp index f03e4b2ba..5757bfd89 100644 --- a/libclamav/c++/llvm/lib/Analysis/IPA/CallGraph.cpp +++ b/libclamav/c++/llvm/lib/Analysis/IPA/CallGraph.cpp @@ -53,7 +53,7 @@ public: CallsExternalNode = new CallGraphNode(0); Root = 0; - // Add every function to the call graph... + // Add every function to the call graph. for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) addToCallGraph(I); @@ -169,18 +169,21 @@ void CallGraph::initialize(Module &M) { } void CallGraph::destroy() { - if (!FunctionMap.empty()) { - for (FunctionMapTy::iterator I = FunctionMap.begin(), E = FunctionMap.end(); - I != E; ++I) - delete I->second; - FunctionMap.clear(); - } + if (FunctionMap.empty()) return; + + for (FunctionMapTy::iterator I = FunctionMap.begin(), E = FunctionMap.end(); + I != E; ++I) + delete I->second; + FunctionMap.clear(); } void CallGraph::print(raw_ostream &OS, Module*) const { for (CallGraph::const_iterator I = begin(), E = end(); I != E; ++I) I->second->print(OS); } +void CallGraph::dump() const { + print(errs(), 0); +} //===----------------------------------------------------------------------===// // Implementations of public modification methods @@ -193,7 +196,7 @@ void CallGraph::print(raw_ostream &OS, Module*) const { // is to dropAllReferences before calling this. // Function *CallGraph::removeFunctionFromModule(CallGraphNode *CGN) { - assert(CGN->CalledFunctions.empty() && "Cannot remove function from call " + assert(CGN->empty() && "Cannot remove function from call " "graph if it references other functions!"); Function *F = CGN->getFunction(); // Get the function for the call graph node delete CGN; // Delete the call graph node for this func @@ -203,20 +206,6 @@ Function *CallGraph::removeFunctionFromModule(CallGraphNode *CGN) { return F; } -// changeFunction - This method changes the function associated with this -// CallGraphNode, for use by transformations that need to change the prototype -// of a Function (thus they must create a new Function and move the old code -// over). -void CallGraph::changeFunction(Function *OldF, Function *NewF) { - iterator I = FunctionMap.find(OldF); - CallGraphNode *&New = FunctionMap[NewF]; - assert(I != FunctionMap.end() && I->second && !New && - "OldF didn't exist in CG or NewF already does!"); - New = I->second; - New->F = NewF; - FunctionMap.erase(I); -} - // getOrInsertFunction - This method is identical to calling operator[], but // it will insert a new CallGraphNode for the specified function if one does // not already exist. @@ -230,9 +219,11 @@ CallGraphNode *CallGraph::getOrInsertFunction(const Function *F) { void CallGraphNode::print(raw_ostream &OS) const { if (Function *F = getFunction()) - OS << "Call graph node for function: '" << F->getName() <<"'\n"; + OS << "Call graph node for function: '" << F->getName() << "'"; else - OS << "Call graph node <>:\n"; + OS << "Call graph node <>"; + + OS << "<<0x" << this << ">> #uses=" << getNumReferences() << '\n'; for (const_iterator I = begin(), E = end(); I != E; ++I) if (Function *FI = I->second->getFunction()) @@ -251,12 +242,29 @@ void CallGraphNode::removeCallEdgeFor(CallSite CS) { for (CalledFunctionsVector::iterator I = CalledFunctions.begin(); ; ++I) { assert(I != CalledFunctions.end() && "Cannot find callsite to remove!"); if (I->first == CS) { - CalledFunctions.erase(I); + I->second->DropRef(); + *I = CalledFunctions.back(); + CalledFunctions.pop_back(); return; } } } +// FIXME: REMOVE THIS WHEN HACK IS REMOVED FROM CGSCCPASSMGR. +void CallGraphNode::removeCallEdgeFor(Instruction *CS) { + for (CalledFunctionsVector::iterator I = CalledFunctions.begin(); ; ++I) { + assert(I != CalledFunctions.end() && "Cannot find callsite to remove!"); + if (I->first.getInstruction() == CS) { + I->second->DropRef(); + *I = CalledFunctions.back(); + CalledFunctions.pop_back(); + return; + } + } + +} + + // removeAnyCallEdgeTo - This method removes any call edges from this node to // the specified callee function. This takes more time to execute than @@ -264,6 +272,7 @@ void CallGraphNode::removeCallEdgeFor(CallSite CS) { void CallGraphNode::removeAnyCallEdgeTo(CallGraphNode *Callee) { for (unsigned i = 0, e = CalledFunctions.size(); i != e; ++i) if (CalledFunctions[i].second == Callee) { + Callee->DropRef(); CalledFunctions[i] = CalledFunctions.back(); CalledFunctions.pop_back(); --i; --e; @@ -276,8 +285,10 @@ void CallGraphNode::removeOneAbstractEdgeTo(CallGraphNode *Callee) { for (CalledFunctionsVector::iterator I = CalledFunctions.begin(); ; ++I) { assert(I != CalledFunctions.end() && "Cannot find callee to remove!"); CallRecord &CR = *I; - if (CR.second == Callee && !CR.first.getInstruction()) { - CalledFunctions.erase(I); + if (CR.second == Callee && CR.first.getInstruction() == 0) { + Callee->DropRef(); + *I = CalledFunctions.back(); + CalledFunctions.pop_back(); return; } } @@ -286,13 +297,22 @@ void CallGraphNode::removeOneAbstractEdgeTo(CallGraphNode *Callee) { /// replaceCallSite - Make the edge in the node for Old CallSite be for /// New CallSite instead. Note that this method takes linear time, so it /// should be used sparingly. -void CallGraphNode::replaceCallSite(CallSite Old, CallSite New) { +void CallGraphNode::replaceCallSite(CallSite Old, CallSite New, + CallGraphNode *NewCallee) { for (CalledFunctionsVector::iterator I = CalledFunctions.begin(); ; ++I) { assert(I != CalledFunctions.end() && "Cannot find callsite to replace!"); - if (I->first == Old) { - I->first = New; - return; + if (I->first != Old) continue; + + I->first = New; + + // If the callee is changing, not just the callsite, then update it as + // well. + if (NewCallee) { + I->second->DropRef(); + I->second = NewCallee; + I->second->AddRef(); } + return; } } diff --git a/libclamav/c++/llvm/lib/Analysis/IPA/CallGraphSCCPass.cpp b/libclamav/c++/llvm/lib/Analysis/IPA/CallGraphSCCPass.cpp index 00eddc4de..2d5600d6e 100644 --- a/libclamav/c++/llvm/lib/Analysis/IPA/CallGraphSCCPass.cpp +++ b/libclamav/c++/llvm/lib/Analysis/IPA/CallGraphSCCPass.cpp @@ -15,11 +15,13 @@ // //===----------------------------------------------------------------------===// +#define DEBUG_TYPE "cgscc-passmgr" #include "llvm/CallGraphSCCPass.h" #include "llvm/Analysis/CallGraph.h" #include "llvm/ADT/SCCIterator.h" #include "llvm/PassManagers.h" #include "llvm/Function.h" +#include "llvm/Support/Debug.h" #include "llvm/Support/raw_ostream.h" using namespace llvm; @@ -31,7 +33,6 @@ using namespace llvm; namespace { class CGPassManager : public ModulePass, public PMDataManager { - public: static char ID; explicit CGPassManager(int Depth) @@ -73,48 +74,195 @@ public: virtual PassManagerType getPassManagerType() const { return PMT_CallGraphPassManager; } + +private: + bool RunPassOnSCC(Pass *P, std::vector &CurSCC, + CallGraph &CG, bool &CallGraphUpToDate); + void RefreshCallGraph(std::vector &CurSCC, CallGraph &CG); }; -} +} // end anonymous namespace. char CGPassManager::ID = 0; + +bool CGPassManager::RunPassOnSCC(Pass *P, std::vector &CurSCC, + CallGraph &CG, bool &CallGraphUpToDate) { + bool Changed = false; + if (CallGraphSCCPass *CGSP = dynamic_cast(P)) { + if (!CallGraphUpToDate) { + RefreshCallGraph(CurSCC, CG); + CallGraphUpToDate = true; + } + + StartPassTimer(P); + Changed = CGSP->runOnSCC(CurSCC); + StopPassTimer(P); + return Changed; + } + + StartPassTimer(P); + FPPassManager *FPP = dynamic_cast(P); + assert(FPP && "Invalid CGPassManager member"); + + // Run pass P on all functions in the current SCC. + for (unsigned i = 0, e = CurSCC.size(); i != e; ++i) { + if (Function *F = CurSCC[i]->getFunction()) { + dumpPassInfo(P, EXECUTION_MSG, ON_FUNCTION_MSG, F->getName()); + Changed |= FPP->runOnFunction(*F); + } + } + StopPassTimer(P); + + // The function pass(es) modified the IR, they may have clobbered the + // callgraph. + if (Changed && CallGraphUpToDate) { + DEBUG(errs() << "CGSCCPASSMGR: Pass Dirtied SCC: " + << P->getPassName() << '\n'); + CallGraphUpToDate = false; + } + return Changed; +} + +void CGPassManager::RefreshCallGraph(std::vector &CurSCC, + CallGraph &CG) { + DenseMap CallSites; + + DEBUG(errs() << "CGSCCPASSMGR: Refreshing SCC with " << CurSCC.size() + << " nodes:\n"; + for (unsigned i = 0, e = CurSCC.size(); i != e; ++i) + CurSCC[i]->dump(); + ); + + bool MadeChange = false; + + // Scan all functions in the SCC. + for (unsigned sccidx = 0, e = CurSCC.size(); sccidx != e; ++sccidx) { + CallGraphNode *CGN = CurSCC[sccidx]; + Function *F = CGN->getFunction(); + if (F == 0 || F->isDeclaration()) continue; + + // Walk the function body looking for call sites. Sync up the call sites in + // CGN with those actually in the function. + + // Get the set of call sites currently in the function. + for (CallGraphNode::iterator I = CGN->begin(), E = CGN->end(); I != E; ++I){ + assert(I->first.getInstruction() && + "Call site record in function should not be abstract"); + assert(!CallSites.count(I->first.getInstruction()) && + "Call site occurs in node multiple times"); + CallSites.insert(std::make_pair(I->first.getInstruction(), + I->second)); + } + + // Loop over all of the instructions in the function, getting the callsites. + for (Function::iterator BB = F->begin(), E = F->end(); BB != E; ++BB) + for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ++I) { + CallSite CS = CallSite::get(I); + if (!CS.getInstruction()) continue; + + // If this call site already existed in the callgraph, just verify it + // matches up to expectations and remove it from CallSites. + DenseMap::iterator ExistingIt = + CallSites.find(CS.getInstruction()); + if (ExistingIt != CallSites.end()) { + CallGraphNode *ExistingNode = ExistingIt->second; + + // Remove from CallSites since we have now seen it. + CallSites.erase(ExistingIt); + + // Verify that the callee is right. + if (ExistingNode->getFunction() == CS.getCalledFunction()) + continue; + + // If not, we either went from a direct call to indirect, indirect to + // direct, or direct to different direct. + CallGraphNode *CalleeNode; + if (Function *Callee = CS.getCalledFunction()) + CalleeNode = CG.getOrInsertFunction(Callee); + else + CalleeNode = CG.getCallsExternalNode(); + + CGN->replaceCallSite(CS, CS, CalleeNode); + MadeChange = true; + continue; + } + + // If the call site didn't exist in the CGN yet, add it. We assume that + // newly introduced call sites won't be indirect. This could be fixed + // in the future. + CallGraphNode *CalleeNode; + if (Function *Callee = CS.getCalledFunction()) + CalleeNode = CG.getOrInsertFunction(Callee); + else + CalleeNode = CG.getCallsExternalNode(); + + CGN->addCalledFunction(CS, CalleeNode); + MadeChange = true; + } + + // After scanning this function, if we still have entries in callsites, then + // they are dangling pointers. Crap. Well, until we change CallGraph to + // use CallbackVH, we'll just zap them here. When we have that, this should + // turn into an assertion. + if (CallSites.empty()) continue; + + for (DenseMap::iterator I = CallSites.begin(), + E = CallSites.end(); I != E; ++I) + // FIXME: I had to add a special horrible form of removeCallEdgeFor to + // support this. Remove the Instruction* version of it when we can. + CGN->removeCallEdgeFor(I->first); + MadeChange = true; + CallSites.clear(); + } + + DEBUG(if (MadeChange) { + errs() << "CGSCCPASSMGR: Refreshed SCC is now:\n"; + for (unsigned i = 0, e = CurSCC.size(); i != e; ++i) + CurSCC[i]->dump(); + } else { + errs() << "CGSCCPASSMGR: SCC Refresh didn't change call graph.\n"; + } + ); +} + /// run - Execute all of the passes scheduled for execution. Keep track of /// whether any of the passes modifies the module, and if so, return true. bool CGPassManager::runOnModule(Module &M) { CallGraph &CG = getAnalysis(); bool Changed = doInitialization(CG); - // Walk SCC - for (scc_iterator I = scc_begin(&CG), E = scc_end(&CG); - I != E; ++I) { - - // Run all passes on current SCC - for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) { - Pass *P = getContainedPass(Index); + std::vector CurSCC; + + // Walk the callgraph in bottom-up SCC order. + for (scc_iterator CGI = scc_begin(&CG), E = scc_end(&CG); + CGI != E;) { + // Copy the current SCC and increment past it so that the pass can hack + // on the SCC if it wants to without invalidating our iterator. + CurSCC = *CGI; + ++CGI; + + + // CallGraphUpToDate - Keep track of whether the callgraph is known to be + // up-to-date or not. The CGSSC pass manager runs two types of passes: + // CallGraphSCC Passes and other random function passes. Because other + // random function passes are not CallGraph aware, they may clobber the + // call graph by introducing new calls or deleting other ones. This flag + // is set to false when we run a function pass so that we know to clean up + // the callgraph when we need to run a CGSCCPass again. + bool CallGraphUpToDate = true; + + // Run all passes on current SCC. + for (unsigned PassNo = 0, e = getNumContainedPasses(); + PassNo != e; ++PassNo) { + Pass *P = getContainedPass(PassNo); dumpPassInfo(P, EXECUTION_MSG, ON_CG_MSG, ""); dumpRequiredSet(P); initializeAnalysisImpl(P); - StartPassTimer(P); - if (CallGraphSCCPass *CGSP = dynamic_cast(P)) - Changed |= CGSP->runOnSCC(*I); // TODO : What if CG is changed ? - else { - FPPassManager *FPP = dynamic_cast(P); - assert (FPP && "Invalid CGPassManager member"); - - // Run pass P on all functions current SCC - std::vector &SCC = *I; - for (unsigned i = 0, e = SCC.size(); i != e; ++i) { - Function *F = SCC[i]->getFunction(); - if (F) { - dumpPassInfo(P, EXECUTION_MSG, ON_FUNCTION_MSG, F->getName()); - Changed |= FPP->runOnFunction(*F); - } - } - } - StopPassTimer(P); + // Actually run this pass on the current SCC. + Changed |= RunPassOnSCC(P, CurSCC, CG, CallGraphUpToDate); if (Changed) dumpPassInfo(P, MODIFICATION_MSG, ON_CG_MSG, ""); @@ -125,6 +273,11 @@ bool CGPassManager::runOnModule(Module &M) { recordAvailableAnalysis(P); removeDeadPasses(P, "", ON_CG_MSG); } + + // If the callgraph was left out of date (because the last pass run was a + // functionpass), refresh it before we move on to the next SCC. + if (!CallGraphUpToDate) + RefreshCallGraph(CurSCC, CG); } Changed |= doFinalization(CG); return Changed; diff --git a/libclamav/c++/llvm/lib/Analysis/ProfileEstimatorPass.cpp b/libclamav/c++/llvm/lib/Analysis/ProfileEstimatorPass.cpp index 0efb5ac07..8f5313fda 100644 --- a/libclamav/c++/llvm/lib/Analysis/ProfileEstimatorPass.cpp +++ b/libclamav/c++/llvm/lib/Analysis/ProfileEstimatorPass.cpp @@ -19,10 +19,11 @@ #include "llvm/Support/CommandLine.h" #include "llvm/Support/Debug.h" #include "llvm/Support/raw_ostream.h" +#include "llvm/Support/Format.h" using namespace llvm; static cl::opt -ProfileInfoExecCount( +LoopWeight( "profile-estimator-loop-weight", cl::init(10), cl::value_desc("loop-weight"), cl::desc("Number of loop executions used for profile-estimator") @@ -39,7 +40,7 @@ namespace { static char ID; // Class identification, replacement for typeinfo explicit ProfileEstimatorPass(const double execcount = 0) : FunctionPass(&ID), ExecCount(execcount) { - if (execcount == 0) ExecCount = ProfileInfoExecCount; + if (execcount == 0) ExecCount = LoopWeight; } virtual void getAnalysisUsage(AnalysisUsage &AU) const { @@ -55,6 +56,8 @@ namespace { virtual bool runOnFunction(Function &F); virtual void recurseBasicBlock(BasicBlock *BB); + + void inline printEdgeWeight(Edge); }; } // End of anonymous namespace @@ -71,8 +74,8 @@ namespace llvm { return new ProfileEstimatorPass(); } - // createProfileEstimatorPass - This function returns a Pass that estimates - // profiling information using the given loop execution count. + /// createProfileEstimatorPass - This function returns a Pass that estimates + /// profiling information using the given loop execution count. Pass *createProfileEstimatorPass(const unsigned execcount) { return new ProfileEstimatorPass(execcount); } @@ -83,25 +86,25 @@ static double ignoreMissing(double w) { return w; } -#define EDGE_ERROR(V1,V2) \ +static void inline printEdgeError(BasicBlock *V1, BasicBlock *V2) { DEBUG(errs() << "-- Edge (" <<(V1)->getName() << "," << (V2)->getName() \ - << ") is not calculated, returning\n") + << ") is not calculated, returning\n"); +} -#define EDGE_WEIGHT(E) \ - DEBUG(errs() << "-- Weight of Edge (" \ - << ((E).first ? (E).first->getNameStr() : "0") \ - << "," << (E).second->getName() << "):" \ - << getEdgeWeight(E) << "\n") +void inline ProfileEstimatorPass::printEdgeWeight(Edge E) { + DEBUG(errs() << "-- Weight of Edge " << E << ":" + << format("%g", getEdgeWeight(E)) << "\n"); +} // recurseBasicBlock() - This calculates the ProfileInfo estimation for a // single block and then recurses into the successors. void ProfileEstimatorPass::recurseBasicBlock(BasicBlock *BB) { - // break recursion if already visited + // Break the recursion if this BasicBlock was already visited. if (BBisVisited.find(BB) != BBisVisited.end()) return; - // check if uncalculated incoming edges are calculated already, if BB is - // header allow backedges + // Check if incoming edges are calculated already, if BB is header allow + // backedges that are uncalculated for now. bool BBisHeader = LI->isLoopHeader(BB); Loop* BBLoop = LI->getLoopFor(BB); @@ -114,11 +117,11 @@ void ProfileEstimatorPass::recurseBasicBlock(BasicBlock *BB) { BBWeight += ignoreMissing(getEdgeWeight(edge)); } if (BBisHeader && BBLoop == LI->getLoopFor(*bbi)) { - EDGE_ERROR(*bbi,BB); + printEdgeError(*bbi,BB); continue; } if (BBisVisited.find(*bbi) == BBisVisited.end()) { - EDGE_ERROR(*bbi,BB); + printEdgeError(*bbi,BB); return; } } @@ -126,20 +129,20 @@ void ProfileEstimatorPass::recurseBasicBlock(BasicBlock *BB) { BBWeight = getExecutionCount(BB); } - // fetch all necessary information for current block + // Fetch all necessary information for current block. SmallVector ExitEdges; SmallVector Edges; if (BBLoop) { BBLoop->getExitEdges(ExitEdges); } - // if block is an loop header, first subtract all weigths from edges that + // If block is an loop header, first subtract all weights from edges that // exit this loop, then distribute remaining weight on to the edges exiting - // this loop. finally the weight of the block is increased, to simulate - // several executions of this loop + // this loop. Finally the weight of the block is increased, to simulate + // several executions of this loop. if (BBisHeader) { double incoming = BBWeight; - // subtract the flow leaving the loop + // Subtract the flow leaving the loop. for (SmallVector::iterator ei = ExitEdges.begin(), ee = ExitEdges.end(); ei != ee; ++ei) { double w = getEdgeWeight(*ei); @@ -149,20 +152,23 @@ void ProfileEstimatorPass::recurseBasicBlock(BasicBlock *BB) { incoming -= w; } } - // distribute remaining weight onto the exit edges + // Distribute remaining weight onto the exit edges. for (SmallVector::iterator ei = Edges.begin(), ee = Edges.end(); ei != ee; ++ei) { EdgeInformation[BB->getParent()][*ei] += incoming/Edges.size(); - EDGE_WEIGHT(*ei); + printEdgeWeight(*ei); } - // increase flow into the loop + // Increase flow into the loop. BBWeight *= (ExecCount+1); } - // remove from current flow of block all the successor edges that already - // have some flow on them + // Remove from current flow of block all the successor edges that already + // have some flow on them. Edges.clear(); std::set ProcessedSuccs; + + // Otherwise consider weight of outgoing edges and store them for + // distribution of remaining weight. for ( succ_iterator bbi = succ_begin(BB), bbe = succ_end(BB); bbi != bbe; ++bbi ) { if (ProcessedSuccs.insert(*bbi).second) { @@ -176,14 +182,14 @@ void ProfileEstimatorPass::recurseBasicBlock(BasicBlock *BB) { } } - // distribute remaining flow onto the outgoing edges + // Distribute remaining flow onto the outgoing edges. for (SmallVector::iterator ei = Edges.begin(), ee = Edges.end(); ei != ee; ++ei) { EdgeInformation[BB->getParent()][*ei] += BBWeight/Edges.size(); - EDGE_WEIGHT(*ei); + printEdgeWeight(*ei); } - // mark as visited and recurse into subnodes + // Mark this Block visited and recurse into successors. BBisVisited.insert(BB); for ( succ_iterator bbi = succ_begin(BB), bbe = succ_end(BB); bbi != bbe; @@ -201,19 +207,19 @@ bool ProfileEstimatorPass::runOnFunction(Function &F) { EdgeInformation[&F].clear(); BBisVisited.clear(); - DEBUG(errs() << "Working on function " << F.getName() << "\n"); + DEBUG(errs() << "Working on function " << F.getNameStr() << "\n"); - // since the entry block is the first one and has no predecessors, the edge - // (0,entry) is inserted with the starting weight of 1 + // Since the entry block is the first one and has no predecessors, the edge + // (0,entry) is inserted with the starting weight of 1. BasicBlock *entry = &F.getEntryBlock(); BlockInformation[&F][entry] = 1; Edge edge = getEdge(0,entry); - EdgeInformation[&F][edge] = 1; EDGE_WEIGHT(edge); + EdgeInformation[&F][edge] = 1; printEdgeWeight(edge); recurseBasicBlock(entry); - // in case something went wrong, clear all results, not profiling info - // available + // In case something went wrong, clear all results, not profiling info is + // available. if (BBisVisited.size() != F.size()) { DEBUG(errs() << "-- could not estimate profile, using default profile\n"); FunctionInformation.erase(&F); @@ -222,12 +228,14 @@ bool ProfileEstimatorPass::runOnFunction(Function &F) { for (pred_iterator bbi = pred_begin(BB), bbe = pred_end(BB); bbi != bbe; ++bbi) { Edge e = getEdge(*bbi,BB); - EdgeInformation[&F][e] = 1; EDGE_WEIGHT(edge); + EdgeInformation[&F][e] = 1; + printEdgeWeight(e); } for (succ_iterator bbi = succ_begin(BB), bbe = succ_end(BB); bbi != bbe; ++bbi) { Edge e = getEdge(BB,*bbi); - EdgeInformation[&F][e] = 1; EDGE_WEIGHT(edge); + EdgeInformation[&F][e] = 1; + printEdgeWeight(e); } } } diff --git a/libclamav/c++/llvm/lib/Analysis/ProfileInfo.cpp b/libclamav/c++/llvm/lib/Analysis/ProfileInfo.cpp index 98ea25199..55c5cab75 100644 --- a/libclamav/c++/llvm/lib/Analysis/ProfileInfo.cpp +++ b/libclamav/c++/llvm/lib/Analysis/ProfileInfo.cpp @@ -17,6 +17,7 @@ #include "llvm/Pass.h" #include "llvm/Support/CFG.h" #include "llvm/Support/Compiler.h" +#include "llvm/Support/raw_ostream.h" #include using namespace llvm; @@ -26,6 +27,8 @@ char ProfileInfo::ID = 0; ProfileInfo::~ProfileInfo() {} +const double ProfileInfo::MissingValue = -1; + double ProfileInfo::getExecutionCount(const BasicBlock *BB) { std::map::iterator J = BlockInformation.find(BB->getParent()); @@ -60,22 +63,32 @@ double ProfileInfo::getExecutionCount(const BasicBlock *BB) { Count += w; } - BlockInformation[BB->getParent()][BB] = Count; + if (Count != MissingValue) BlockInformation[BB->getParent()][BB] = Count; return Count; } double ProfileInfo::getExecutionCount(const Function *F) { - if (F->isDeclaration()) return MissingValue; std::map::iterator J = FunctionInformation.find(F); if (J != FunctionInformation.end()) return J->second; + // isDeclaration() is checked here and not at start of function to allow + // functions without a body still to have a execution count. + if (F->isDeclaration()) return MissingValue; + double Count = getExecutionCount(&F->getEntryBlock()); - FunctionInformation[F] = Count; + if (Count != MissingValue) FunctionInformation[F] = Count; return Count; } +raw_ostream& llvm::operator<<(raw_ostream &O, ProfileInfo::Edge E) { + O << "("; + O << (E.first ? E.first->getNameStr() : "0"); + O << ","; + O << (E.second ? E.second->getNameStr() : "0"); + return O << ")"; +} //===----------------------------------------------------------------------===// // NoProfile ProfileInfo implementation diff --git a/libclamav/c++/llvm/lib/Analysis/ProfileInfoLoader.cpp b/libclamav/c++/llvm/lib/Analysis/ProfileInfoLoader.cpp index eddbef388..f0641cf2d 100644 --- a/libclamav/c++/llvm/lib/Analysis/ProfileInfoLoader.cpp +++ b/libclamav/c++/llvm/lib/Analysis/ProfileInfoLoader.cpp @@ -76,7 +76,7 @@ ProfileInfoLoader::ProfileInfoLoader(const char *ToolName, Module &TheModule) : Filename(Filename), M(TheModule), Warned(false) { - FILE *F = fopen(Filename.c_str(), "r"); + FILE *F = fopen(Filename.c_str(), "rb"); if (F == 0) { errs() << ToolName << ": Error opening '" << Filename << "': "; perror(0); diff --git a/libclamav/c++/llvm/lib/Analysis/ScalarEvolution.cpp b/libclamav/c++/llvm/lib/Analysis/ScalarEvolution.cpp index ca2cdca67..d639aee70 100644 --- a/libclamav/c++/llvm/lib/Analysis/ScalarEvolution.cpp +++ b/libclamav/c++/llvm/lib/Analysis/ScalarEvolution.cpp @@ -63,6 +63,7 @@ #include "llvm/Constants.h" #include "llvm/DerivedTypes.h" #include "llvm/GlobalVariable.h" +#include "llvm/GlobalAlias.h" #include "llvm/Instructions.h" #include "llvm/LLVMContext.h" #include "llvm/Operator.h" @@ -2906,6 +2907,8 @@ const SCEV *ScalarEvolution::createSCEV(Value *V) { return getIntegerSCEV(0, V->getType()); else if (isa(V)) return getIntegerSCEV(0, V->getType()); + else if (GlobalAlias *GA = dyn_cast(V)) + return GA->mayBeOverridden() ? getUnknown(V) : getSCEV(GA->getAliasee()); else return getUnknown(V); @@ -4346,7 +4349,7 @@ static bool HasSameValue(const SCEV *A, const SCEV *B) { if (const SCEVUnknown *BU = dyn_cast(B)) if (const Instruction *AI = dyn_cast(AU->getValue())) if (const Instruction *BI = dyn_cast(BU->getValue())) - if (AI->isIdenticalTo(BI)) + if (AI->isIdenticalTo(BI) && !AI->mayReadFromMemory()) return true; // Otherwise assume they may have a different value. diff --git a/libclamav/c++/llvm/lib/Analysis/ScalarEvolutionAliasAnalysis.cpp b/libclamav/c++/llvm/lib/Analysis/ScalarEvolutionAliasAnalysis.cpp new file mode 100644 index 000000000..cc79e6c3b --- /dev/null +++ b/libclamav/c++/llvm/lib/Analysis/ScalarEvolutionAliasAnalysis.cpp @@ -0,0 +1,133 @@ +//===- ScalarEvolutionAliasAnalysis.cpp - SCEV-based Alias Analysis -------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file defines the ScalarEvolutionAliasAnalysis pass, which implements a +// simple alias analysis implemented in terms of ScalarEvolution queries. +// +// ScalarEvolution has a more complete understanding of pointer arithmetic +// than BasicAliasAnalysis' collection of ad-hoc analyses. +// +//===----------------------------------------------------------------------===// + +#include "llvm/Analysis/AliasAnalysis.h" +#include "llvm/Analysis/ScalarEvolutionExpressions.h" +#include "llvm/Analysis/Passes.h" +#include "llvm/Pass.h" +#include "llvm/Support/Compiler.h" +using namespace llvm; + +namespace { + /// ScalarEvolutionAliasAnalysis - This is a simple alias analysis + /// implementation that uses ScalarEvolution to answer queries. + class VISIBILITY_HIDDEN ScalarEvolutionAliasAnalysis : public FunctionPass, + public AliasAnalysis { + ScalarEvolution *SE; + + public: + static char ID; // Class identification, replacement for typeinfo + ScalarEvolutionAliasAnalysis() : FunctionPass(&ID), SE(0) {} + + private: + virtual void getAnalysisUsage(AnalysisUsage &AU) const; + virtual bool runOnFunction(Function &F); + virtual AliasResult alias(const Value *V1, unsigned V1Size, + const Value *V2, unsigned V2Size); + + Value *GetUnderlyingIdentifiedObject(const SCEV *S); + }; +} // End of anonymous namespace + +// Register this pass... +char ScalarEvolutionAliasAnalysis::ID = 0; +static RegisterPass +X("scev-aa", "ScalarEvolution-based Alias Analysis", false, true); + +// Declare that we implement the AliasAnalysis interface +static RegisterAnalysisGroup Y(X); + +FunctionPass *llvm::createScalarEvolutionAliasAnalysisPass() { + return new ScalarEvolutionAliasAnalysis(); +} + +void +ScalarEvolutionAliasAnalysis::getAnalysisUsage(AnalysisUsage &AU) const { + AU.addRequiredTransitive(); + AU.setPreservesAll(); + AliasAnalysis::getAnalysisUsage(AU); +} + +bool +ScalarEvolutionAliasAnalysis::runOnFunction(Function &F) { + InitializeAliasAnalysis(this); + SE = &getAnalysis(); + return false; +} + +/// GetUnderlyingIdentifiedObject - Given an expression, try to find an +/// "identified object" (see AliasAnalysis::isIdentifiedObject) base +/// value. Return null is none was found. +Value * +ScalarEvolutionAliasAnalysis::GetUnderlyingIdentifiedObject(const SCEV *S) { + if (const SCEVAddRecExpr *AR = dyn_cast(S)) { + // In an addrec, assume that the base will be in the start, rather + // than the step. + return GetUnderlyingIdentifiedObject(AR->getStart()); + } else if (const SCEVAddExpr *A = dyn_cast(S)) { + // If there's a pointer operand, it'll be sorted at the end of the list. + const SCEV *Last = A->getOperand(A->getNumOperands()-1); + if (isa(Last->getType())) + return GetUnderlyingIdentifiedObject(Last); + } else if (const SCEVUnknown *U = dyn_cast(S)) { + // Determine if we've found an Identified object. + Value *V = U->getValue(); + if (isIdentifiedObject(V)) + return V; + } + // No Identified object found. + return 0; +} + +AliasAnalysis::AliasResult +ScalarEvolutionAliasAnalysis::alias(const Value *A, unsigned ASize, + const Value *B, unsigned BSize) { + // This is ScalarEvolutionAliasAnalysis. Get the SCEVs! + const SCEV *AS = SE->getSCEV(const_cast(A)); + const SCEV *BS = SE->getSCEV(const_cast(B)); + + // If they evaluate to the same expression, it's a MustAlias. + if (AS == BS) return MustAlias; + + // If something is known about the difference between the two addresses, + // see if it's enough to prove a NoAlias. + if (SE->getEffectiveSCEVType(AS->getType()) == + SE->getEffectiveSCEVType(BS->getType())) { + unsigned BitWidth = SE->getTypeSizeInBits(AS->getType()); + APInt AI(BitWidth, ASize); + const SCEV *BA = SE->getMinusSCEV(BS, AS); + if (AI.ule(SE->getUnsignedRange(BA).getUnsignedMin())) { + APInt BI(BitWidth, BSize); + const SCEV *AB = SE->getMinusSCEV(AS, BS); + if (BI.ule(SE->getUnsignedRange(AB).getUnsignedMin())) + return NoAlias; + } + } + + // If ScalarEvolution can find an underlying object, form a new query. + // The correctness of this depends on ScalarEvolution not recognizing + // inttoptr and ptrtoint operators. + Value *AO = GetUnderlyingIdentifiedObject(AS); + Value *BO = GetUnderlyingIdentifiedObject(BS); + if ((AO && AO != A) || (BO && BO != B)) + if (alias(AO ? AO : A, AO ? ~0u : ASize, + BO ? BO : B, BO ? ~0u : BSize) == NoAlias) + return NoAlias; + + // Forward the query to the next analysis. + return AliasAnalysis::alias(A, ASize, B, BSize); +} diff --git a/libclamav/c++/llvm/lib/Analysis/ValueTracking.cpp b/libclamav/c++/llvm/lib/Analysis/ValueTracking.cpp index 2042d2e0a..cb2d624a9 100644 --- a/libclamav/c++/llvm/lib/Analysis/ValueTracking.cpp +++ b/libclamav/c++/llvm/lib/Analysis/ValueTracking.cpp @@ -37,7 +37,7 @@ using namespace llvm; /// this won't lose us code quality. void llvm::ComputeMaskedBits(Value *V, const APInt &Mask, APInt &KnownZero, APInt &KnownOne, - TargetData *TD, unsigned Depth) { + const TargetData *TD, unsigned Depth) { const unsigned MaxDepth = 6; assert(V && "No Value?"); assert(Depth <= MaxDepth && "Limit Search Depth"); @@ -609,7 +609,7 @@ void llvm::ComputeMaskedBits(Value *V, const APInt &Mask, /// this predicate to simplify operations downstream. Mask is known to be zero /// for bits that V cannot have. bool llvm::MaskedValueIsZero(Value *V, const APInt &Mask, - TargetData *TD, unsigned Depth) { + const TargetData *TD, unsigned Depth) { APInt KnownZero(Mask.getBitWidth(), 0), KnownOne(Mask.getBitWidth(), 0); ComputeMaskedBits(V, Mask, KnownZero, KnownOne, TD, Depth); assert((KnownZero & KnownOne) == 0 && "Bits known to be one AND zero?"); @@ -626,7 +626,8 @@ bool llvm::MaskedValueIsZero(Value *V, const APInt &Mask, /// /// 'Op' must have a scalar integer type. /// -unsigned llvm::ComputeNumSignBits(Value *V, TargetData *TD, unsigned Depth) { +unsigned llvm::ComputeNumSignBits(Value *V, const TargetData *TD, + unsigned Depth) { assert((TD || V->getType()->isIntOrIntVector()) && "ComputeNumSignBits requires a TargetData object to operate " "on non-integer values!"); diff --git a/libclamav/c++/llvm/lib/AsmParser/LLLexer.cpp b/libclamav/c++/llvm/lib/AsmParser/LLLexer.cpp index 8d6b5dbb1..23d7f19bb 100644 --- a/libclamav/c++/llvm/lib/AsmParser/LLLexer.cpp +++ b/libclamav/c++/llvm/lib/AsmParser/LLLexer.cpp @@ -556,6 +556,7 @@ lltok::Kind LLLexer::LexIdentifier() { KEYWORD(readnone); KEYWORD(readonly); + KEYWORD(inlinehint); KEYWORD(noinline); KEYWORD(alwaysinline); KEYWORD(optsize); diff --git a/libclamav/c++/llvm/lib/AsmParser/LLParser.cpp b/libclamav/c++/llvm/lib/AsmParser/LLParser.cpp index 0b3533596..4f7a440c0 100644 --- a/libclamav/c++/llvm/lib/AsmParser/LLParser.cpp +++ b/libclamav/c++/llvm/lib/AsmParser/LLParser.cpp @@ -98,6 +98,8 @@ bool LLParser::ValidateEndOfModule() { for (Module::iterator FI = M->begin(), FE = M->end(); FI != FE; ) UpgradeCallsToIntrinsic(FI++); // must be post-increment, as we remove + // Check debug info intrinsics. + CheckDebugInfoIntrinsics(M); return false; } @@ -905,6 +907,7 @@ bool LLParser::ParseOptionalAttrs(unsigned &Attrs, unsigned AttrKind) { case lltok::kw_noinline: Attrs |= Attribute::NoInline; break; case lltok::kw_readnone: Attrs |= Attribute::ReadNone; break; case lltok::kw_readonly: Attrs |= Attribute::ReadOnly; break; + case lltok::kw_inlinehint: Attrs |= Attribute::InlineHint; break; case lltok::kw_alwaysinline: Attrs |= Attribute::AlwaysInline; break; case lltok::kw_optsize: Attrs |= Attribute::OptimizeForSize; break; case lltok::kw_ssp: Attrs |= Attribute::StackProtect; break; @@ -2498,7 +2501,7 @@ bool LLParser::ParseFunctionHeader(Function *&Fn, bool isDefine) { } } - } else if (FunctionName.empty()) { + } else { // If this is a definition of a forward referenced function, make sure the // types agree. std::map >::iterator I @@ -3087,13 +3090,13 @@ bool LLParser::ParseCompare(Instruction *&Inst, PerFunctionState &PFS, if (Opc == Instruction::FCmp) { if (!LHS->getType()->isFPOrFPVector()) return Error(Loc, "fcmp requires floating point operands"); - Inst = new FCmpInst(Context, CmpInst::Predicate(Pred), LHS, RHS); + Inst = new FCmpInst(CmpInst::Predicate(Pred), LHS, RHS); } else { assert(Opc == Instruction::ICmp && "Unknown opcode for CmpInst!"); if (!LHS->getType()->isIntOrIntVector() && !isa(LHS->getType())) return Error(Loc, "icmp requires integer operands"); - Inst = new ICmpInst(Context, CmpInst::Predicate(Pred), LHS, RHS); + Inst = new ICmpInst(CmpInst::Predicate(Pred), LHS, RHS); } return false; } diff --git a/libclamav/c++/llvm/lib/AsmParser/LLToken.h b/libclamav/c++/llvm/lib/AsmParser/LLToken.h index a49d05442..b053cca18 100644 --- a/libclamav/c++/llvm/lib/AsmParser/LLToken.h +++ b/libclamav/c++/llvm/lib/AsmParser/LLToken.h @@ -82,6 +82,7 @@ namespace lltok { kw_readnone, kw_readonly, + kw_inlinehint, kw_noinline, kw_alwaysinline, kw_optsize, diff --git a/libclamav/c++/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/libclamav/c++/llvm/lib/Bitcode/Reader/BitcodeReader.cpp index df171c55e..f9cfe9162 100644 --- a/libclamav/c++/llvm/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/libclamav/c++/llvm/lib/Bitcode/Reader/BitcodeReader.cpp @@ -16,7 +16,7 @@ #include "llvm/Constants.h" #include "llvm/DerivedTypes.h" #include "llvm/InlineAsm.h" -#include "llvm/Instructions.h" +#include "llvm/IntrinsicInst.h" #include "llvm/LLVMContext.h" #include "llvm/Metadata.h" #include "llvm/Module.h" @@ -1781,9 +1781,9 @@ bool BitcodeReader::ParseFunctionBody(Function *F) { return Error("Invalid CMP record"); if (LHS->getType()->isFPOrFPVector()) - I = new FCmpInst(Context, (FCmpInst::Predicate)Record[OpNum], LHS, RHS); + I = new FCmpInst((FCmpInst::Predicate)Record[OpNum], LHS, RHS); else - I = new ICmpInst(Context, (ICmpInst::Predicate)Record[OpNum], LHS, RHS); + I = new ICmpInst((ICmpInst::Predicate)Record[OpNum], LHS, RHS); break; } @@ -2192,7 +2192,10 @@ Module *BitcodeReader::materializeModule(std::string *ErrInfo) { } } std::vector >().swap(UpgradedIntrinsics); - + + // Check debug info intrinsics. + CheckDebugInfoIntrinsics(TheModule); + return TheModule; } diff --git a/libclamav/c++/llvm/lib/Bitcode/Writer/BitWriter.cpp b/libclamav/c++/llvm/lib/Bitcode/Writer/BitWriter.cpp index 32a740569..7ed651b77 100644 --- a/libclamav/c++/llvm/lib/Bitcode/Writer/BitWriter.cpp +++ b/libclamav/c++/llvm/lib/Bitcode/Writer/BitWriter.cpp @@ -18,7 +18,7 @@ using namespace llvm; int LLVMWriteBitcodeToFile(LLVMModuleRef M, const char *Path) { std::string ErrorInfo; raw_fd_ostream OS(Path, ErrorInfo, - raw_fd_ostream::F_Force|raw_fd_ostream::F_Binary); + raw_fd_ostream::F_Binary); if (!ErrorInfo.empty()) return -1; diff --git a/libclamav/c++/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/libclamav/c++/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index c8099c8b1..a92d923a7 100644 --- a/libclamav/c++/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/libclamav/c++/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -604,6 +604,48 @@ void AsmPrinter::EOL(const char* Comment) const { O << '\n'; } +static const char *DecodeDWARFEncoding(unsigned Encoding) { + switch (Encoding) { + case dwarf::DW_EH_PE_absptr: + return "absptr"; + case dwarf::DW_EH_PE_omit: + return "omit"; + case dwarf::DW_EH_PE_pcrel: + return "pcrel"; + case dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_udata4: + return "pcrel udata4"; + case dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4: + return "pcrel sdata4"; + case dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_udata8: + return "pcrel udata8"; + case dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata8: + return "pcrel sdata8"; + case dwarf::DW_EH_PE_indirect | dwarf::DW_EH_PE_pcrel |dwarf::DW_EH_PE_udata4: + return "indirect pcrel udata4"; + case dwarf::DW_EH_PE_indirect | dwarf::DW_EH_PE_pcrel |dwarf::DW_EH_PE_sdata4: + return "indirect pcrel sdata4"; + case dwarf::DW_EH_PE_indirect | dwarf::DW_EH_PE_pcrel |dwarf::DW_EH_PE_udata8: + return "indirect pcrel udata8"; + case dwarf::DW_EH_PE_indirect | dwarf::DW_EH_PE_pcrel |dwarf::DW_EH_PE_sdata8: + return "indirect pcrel sdata8"; + } + + return 0; +} + +void AsmPrinter::EOL(const char *Comment, unsigned Encoding) const { + if (VerboseAsm && *Comment) { + O.PadToColumn(MAI->getCommentColumn()); + O << MAI->getCommentString() + << ' ' + << Comment; + + if (const char *EncStr = DecodeDWARFEncoding(Encoding)) + O << " (" << EncStr << ')'; + } + O << '\n'; +} + /// EmitULEB128Bytes - Emit an assembler byte data directive to compose an /// unsigned leb128 value. void AsmPrinter::EmitULEB128Bytes(unsigned Value) const { @@ -1739,11 +1781,10 @@ void AsmPrinter::EmitComments(const MachineInstr &MI) const { // Print source line info. O.PadToColumn(MAI->getCommentColumn()); O << MAI->getCommentString() << " SrcLine "; - if (DLT.CompileUnit->hasInitializer()) { - Constant *Name = DLT.CompileUnit->getInitializer(); - if (ConstantArray *NameString = dyn_cast(Name)) - if (NameString->isString()) - O << NameString->getAsString() << " "; + if (DLT.CompileUnit) { + std::string Str; + DICompileUnit CU(DLT.CompileUnit); + O << CU.getFilename(Str) << " "; } O << DLT.Line; if (DLT.Col != 0) @@ -1761,11 +1802,10 @@ void AsmPrinter::EmitComments(const MCInst &MI) const { // Print source line info O.PadToColumn(MAI->getCommentColumn()); O << MAI->getCommentString() << " SrcLine "; - if (DLT.CompileUnit->hasInitializer()) { - Constant *Name = DLT.CompileUnit->getInitializer(); - if (ConstantArray *NameString = dyn_cast(Name)) - if (NameString->isString()) - O << NameString->getAsString() << " "; + if (DLT.CompileUnit) { + std::string Str; + DICompileUnit CU(DLT.CompileUnit); + O << CU.getFilename(Str) << " "; } O << DLT.Line; if (DLT.Col != 0) diff --git a/libclamav/c++/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/libclamav/c++/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index fbb522df1..efa7577c6 100644 --- a/libclamav/c++/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/libclamav/c++/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -10,7 +10,7 @@ // This file contains support for writing dwarf debug info into asm files. // //===----------------------------------------------------------------------===// - +#define DEBUG_TYPE "dwarfdebug" #include "DwarfDebug.h" #include "llvm/Module.h" #include "llvm/CodeGen/MachineFunction.h" @@ -24,6 +24,7 @@ #include "llvm/Target/TargetRegisterInfo.h" #include "llvm/ADT/StringExtras.h" #include "llvm/Support/Timer.h" +#include "llvm/Support/Debug.h" #include "llvm/System/Path.h" using namespace llvm; @@ -56,11 +57,13 @@ class VISIBILITY_HIDDEN CompileUnit { /// GVToDieMap - Tracks the mapping of unit level debug informaton /// variables to debug information entries. - std::map GVToDieMap; + /// FIXME : Rename GVToDieMap -> NodeToDieMap + std::map GVToDieMap; /// GVToDIEEntryMap - Tracks the mapping of unit level debug informaton /// descriptors to debug information entries using a DIEEntry proxy. - std::map GVToDIEEntryMap; + /// FIXME : Rename + std::map GVToDIEEntryMap; /// Globals - A map of globally visible named entities for this unit. /// @@ -89,12 +92,12 @@ public: /// getDieMapSlotFor - Returns the debug information entry map slot for the /// specified debug variable. - DIE *&getDieMapSlotFor(GlobalVariable *GV) { return GVToDieMap[GV]; } + DIE *&getDieMapSlotFor(MDNode *N) { return GVToDieMap[N]; } /// getDIEEntrySlotFor - Returns the debug information entry proxy slot for /// the specified debug variable. - DIEEntry *&getDIEEntrySlotFor(GlobalVariable *GV) { - return GVToDIEEntryMap[GV]; + DIEEntry *&getDIEEntrySlotFor(MDNode *N) { + return GVToDIEEntryMap[N]; } /// AddDie - Adds or interns the DIE to the compile unit. @@ -239,7 +242,7 @@ DwarfDebug::~DwarfDebug() { for (unsigned j = 0, M = Values.size(); j < M; ++j) delete Values[j]; - for (DenseMap::iterator + for (DenseMap::iterator I = AbstractInstanceRootMap.begin(), E = AbstractInstanceRootMap.end(); I != E;++I) delete I->second; @@ -531,7 +534,7 @@ void DwarfDebug::AddType(CompileUnit *DW_Unit, DIE *Entity, DIType Ty) { return; // Check for pre-existence. - DIEEntry *&Slot = DW_Unit->getDIEEntrySlotFor(Ty.getGV()); + DIEEntry *&Slot = DW_Unit->getDIEEntrySlotFor(Ty.getNode()); // If it exists then use the existing value. if (Slot) { @@ -545,19 +548,20 @@ void DwarfDebug::AddType(CompileUnit *DW_Unit, DIE *Entity, DIType Ty) { // Construct type. DIE Buffer(dwarf::DW_TAG_base_type); if (Ty.isBasicType(Ty.getTag())) - ConstructTypeDIE(DW_Unit, Buffer, DIBasicType(Ty.getGV())); - else if (Ty.isDerivedType(Ty.getTag())) - ConstructTypeDIE(DW_Unit, Buffer, DIDerivedType(Ty.getGV())); + ConstructTypeDIE(DW_Unit, Buffer, DIBasicType(Ty.getNode())); + else if (Ty.isCompositeType(Ty.getTag())) + ConstructTypeDIE(DW_Unit, Buffer, DICompositeType(Ty.getNode())); else { - assert(Ty.isCompositeType(Ty.getTag()) && "Unknown kind of DIType"); - ConstructTypeDIE(DW_Unit, Buffer, DICompositeType(Ty.getGV())); + assert(Ty.isDerivedType(Ty.getTag()) && "Unknown kind of DIType"); + ConstructTypeDIE(DW_Unit, Buffer, DIDerivedType(Ty.getNode())); + } // Add debug information entry to entity and appropriate context. DIE *Die = NULL; DIDescriptor Context = Ty.getContext(); if (!Context.isNull()) - Die = DW_Unit->getDieMapSlotFor(Context.getGV()); + Die = DW_Unit->getDieMapSlotFor(Context.getNode()); if (Die) { DIE *Child = new DIE(Buffer); @@ -642,7 +646,7 @@ void DwarfDebug::ConstructTypeDIE(CompileUnit *DW_Unit, DIE &Buffer, // Add enumerators to enumeration type. for (unsigned i = 0, N = Elements.getNumElements(); i < N; ++i) { DIE *ElemDie = NULL; - DIEnumerator Enum(Elements.getElement(i).getGV()); + DIEnumerator Enum(Elements.getElement(i).getNode()); ElemDie = ConstructEnumTypeDIE(DW_Unit, &Enum); Buffer.AddChild(ElemDie); } @@ -652,7 +656,7 @@ void DwarfDebug::ConstructTypeDIE(CompileUnit *DW_Unit, DIE &Buffer, // Add return type. DIArray Elements = CTy.getTypeArray(); DIDescriptor RTy = Elements.getElement(0); - AddType(DW_Unit, &Buffer, DIType(RTy.getGV())); + AddType(DW_Unit, &Buffer, DIType(RTy.getNode())); // Add prototype flag. AddUInt(&Buffer, dwarf::DW_AT_prototyped, dwarf::DW_FORM_flag, 1); @@ -661,7 +665,7 @@ void DwarfDebug::ConstructTypeDIE(CompileUnit *DW_Unit, DIE &Buffer, for (unsigned i = 1, N = Elements.getNumElements(); i < N; ++i) { DIE *Arg = new DIE(dwarf::DW_TAG_formal_parameter); DIDescriptor Ty = Elements.getElement(i); - AddType(DW_Unit, Arg, DIType(Ty.getGV())); + AddType(DW_Unit, Arg, DIType(Ty.getNode())); Buffer.AddChild(Arg); } } @@ -679,20 +683,19 @@ void DwarfDebug::ConstructTypeDIE(CompileUnit *DW_Unit, DIE &Buffer, // Add elements to structure type. for (unsigned i = 0, N = Elements.getNumElements(); i < N; ++i) { DIDescriptor Element = Elements.getElement(i); + if (Element.isNull()) + continue; DIE *ElemDie = NULL; if (Element.getTag() == dwarf::DW_TAG_subprogram) ElemDie = CreateSubprogramDIE(DW_Unit, - DISubprogram(Element.getGV())); + DISubprogram(Element.getNode())); else ElemDie = CreateMemberDIE(DW_Unit, - DIDerivedType(Element.getGV())); + DIDerivedType(Element.getNode())); Buffer.AddChild(ElemDie); } - // FIXME: We'd like an API to register additional attributes for the - // frontend to use while synthesizing, and then we'd use that api in clang - // instead of this. - if (Name == "__block_literal_generic") + if (CTy.isAppleBlockExtension()) AddUInt(&Buffer, dwarf::DW_AT_APPLE_block, dwarf::DW_FORM_flag, 1); unsigned RLang = CTy.getRunTimeLang(); @@ -765,7 +768,7 @@ void DwarfDebug::ConstructArrayTypeDIE(CompileUnit *DW_Unit, DIE &Buffer, for (unsigned i = 0, N = Elements.getNumElements(); i < N; ++i) { DIDescriptor Element = Elements.getElement(i); if (Element.getTag() == dwarf::DW_TAG_subrange_type) - ConstructSubrangeDIE(Buffer, DISubrange(Element.getGV()), IndexTy); + ConstructSubrangeDIE(Buffer, DISubrange(Element.getNode()), IndexTy); } } @@ -892,7 +895,7 @@ DIE *DwarfDebug::CreateSubprogramDIE(CompileUnit *DW_Unit, if (Args.isNull() || SPTag != dwarf::DW_TAG_subroutine_type) AddType(DW_Unit, SPDie, SPTy); else - AddType(DW_Unit, SPDie, DIType(Args.getElement(0).getGV())); + AddType(DW_Unit, SPDie, DIType(Args.getElement(0).getNode())); } if (!SP.isDefinition()) { @@ -903,7 +906,7 @@ DIE *DwarfDebug::CreateSubprogramDIE(CompileUnit *DW_Unit, if (SPTag == dwarf::DW_TAG_subroutine_type) for (unsigned i = 1, N = Args.getNumElements(); i < N; ++i) { DIE *Arg = new DIE(dwarf::DW_TAG_formal_parameter); - AddType(DW_Unit, Arg, DIType(Args.getElement(i).getGV())); + AddType(DW_Unit, Arg, DIType(Args.getElement(i).getNode())); AddUInt(Arg, dwarf::DW_AT_artificial, dwarf::DW_FORM_flag, 1); // ?? SPDie->AddChild(Arg); } @@ -913,7 +916,7 @@ DIE *DwarfDebug::CreateSubprogramDIE(CompileUnit *DW_Unit, AddUInt(SPDie, dwarf::DW_AT_external, dwarf::DW_FORM_flag, 1); // DW_TAG_inlined_subroutine may refer to this DIE. - DIE *&Slot = DW_Unit->getDieMapSlotFor(SP.getGV()); + DIE *&Slot = DW_Unit->getDieMapSlotFor(SP.getNode()); Slot = SPDie; return SPDie; } @@ -922,7 +925,7 @@ DIE *DwarfDebug::CreateSubprogramDIE(CompileUnit *DW_Unit, /// CompileUnit &DwarfDebug::FindCompileUnit(DICompileUnit Unit) const { DenseMap::const_iterator I = - CompileUnitMap.find(Unit.getGV()); + CompileUnitMap.find(Unit.getNode()); assert(I != CompileUnitMap.end() && "Missing compile unit."); return *I->second; } @@ -975,26 +978,26 @@ DIE *DwarfDebug::CreateDbgScopeVariable(DbgVariable *DV, CompileUnit *Unit) { /// getOrCreateScope - Returns the scope associated with the given descriptor. /// -DbgScope *DwarfDebug::getOrCreateScope(GlobalVariable *V) { - DbgScope *&Slot = DbgScopeMap[V]; +DbgScope *DwarfDebug::getOrCreateScope(MDNode *N) { + DbgScope *&Slot = DbgScopeMap[N]; if (Slot) return Slot; DbgScope *Parent = NULL; - DIBlock Block(V); + DIBlock Block(N); // Don't create a new scope if we already created one for an inlined function. - DenseMap::iterator - II = AbstractInstanceRootMap.find(V); + DenseMap::iterator + II = AbstractInstanceRootMap.find(N); if (II != AbstractInstanceRootMap.end()) return LexicalScopeStack.back(); if (!Block.isNull()) { DIDescriptor ParentDesc = Block.getContext(); Parent = - ParentDesc.isNull() ? NULL : getOrCreateScope(ParentDesc.getGV()); + ParentDesc.isNull() ? NULL : getOrCreateScope(ParentDesc.getNode()); } - Slot = new DbgScope(Parent, DIDescriptor(V)); + Slot = new DbgScope(Parent, DIDescriptor(N)); if (Parent) Parent->AddScope(Slot); @@ -1103,10 +1106,10 @@ void DwarfDebug::ConstructFunctionDbgScope(DbgScope *RootScope, return; // Get the subprogram debug information entry. - DISubprogram SPD(Desc.getGV()); + DISubprogram SPD(Desc.getNode()); // Get the subprogram die. - DIE *SPDie = ModuleCU->getDieMapSlotFor(SPD.getGV()); + DIE *SPDie = ModuleCU->getDieMapSlotFor(SPD.getNode()); assert(SPDie && "Missing subprogram descriptor"); if (!AbstractScope) { @@ -1179,8 +1182,8 @@ unsigned DwarfDebug::GetOrCreateSourceID(const std::string &DirName, return SrcId; } -void DwarfDebug::ConstructCompileUnit(GlobalVariable *GV) { - DICompileUnit DIUnit(GV); +void DwarfDebug::ConstructCompileUnit(MDNode *N) { + DICompileUnit DIUnit(N); std::string Dir, FN, Prod; unsigned ID = GetOrCreateSourceID(DIUnit.getDirectory(Dir), DIUnit.getFilename(FN)); @@ -1217,15 +1220,15 @@ void DwarfDebug::ConstructCompileUnit(GlobalVariable *GV) { ModuleCU = Unit; } - CompileUnitMap[DIUnit.getGV()] = Unit; + CompileUnitMap[DIUnit.getNode()] = Unit; CompileUnits.push_back(Unit); } -void DwarfDebug::ConstructGlobalVariableDIE(GlobalVariable *GV) { - DIGlobalVariable DI_GV(GV); +void DwarfDebug::ConstructGlobalVariableDIE(MDNode *N) { + DIGlobalVariable DI_GV(N); // Check for pre-existence. - DIE *&Slot = ModuleCU->getDieMapSlotFor(DI_GV.getGV()); + DIE *&Slot = ModuleCU->getDieMapSlotFor(DI_GV.getNode()); if (Slot) return; @@ -1251,11 +1254,11 @@ void DwarfDebug::ConstructGlobalVariableDIE(GlobalVariable *GV) { return; } -void DwarfDebug::ConstructSubprogram(GlobalVariable *GV) { - DISubprogram SP(GV); +void DwarfDebug::ConstructSubprogram(MDNode *N) { + DISubprogram SP(N); // Check for pre-existence. - DIE *&Slot = ModuleCU->getDieMapSlotFor(GV); + DIE *&Slot = ModuleCU->getDieMapSlotFor(N); if (Slot) return; @@ -1538,6 +1541,9 @@ unsigned DwarfDebug::RecordSourceLine(Value *V, unsigned Line, unsigned Col) { /// correspondence to the source line list. unsigned DwarfDebug::RecordSourceLine(unsigned Line, unsigned Col, DICompileUnit CU) { + if (!MMI) + return 0; + if (TimePassesIsEnabled) DebugTimer->startTimer(); @@ -1572,11 +1578,11 @@ unsigned DwarfDebug::getOrCreateSourceID(const std::string &DirName, } /// RecordRegionStart - Indicate the start of a region. -unsigned DwarfDebug::RecordRegionStart(GlobalVariable *V) { +unsigned DwarfDebug::RecordRegionStart(MDNode *N) { if (TimePassesIsEnabled) DebugTimer->startTimer(); - DbgScope *Scope = getOrCreateScope(V); + DbgScope *Scope = getOrCreateScope(N); unsigned ID = MMI->NextLabelID(); if (!Scope->getStartLabelID()) Scope->setStartLabelID(ID); LexicalScopeStack.push_back(Scope); @@ -1588,11 +1594,11 @@ unsigned DwarfDebug::RecordRegionStart(GlobalVariable *V) { } /// RecordRegionEnd - Indicate the end of a region. -unsigned DwarfDebug::RecordRegionEnd(GlobalVariable *V) { +unsigned DwarfDebug::RecordRegionEnd(MDNode *N) { if (TimePassesIsEnabled) DebugTimer->startTimer(); - DbgScope *Scope = getOrCreateScope(V); + DbgScope *Scope = getOrCreateScope(N); unsigned ID = MMI->NextLabelID(); Scope->setEndLabelID(ID); // FIXME : region.end() may not be in the last basic block. @@ -1609,41 +1615,36 @@ unsigned DwarfDebug::RecordRegionEnd(GlobalVariable *V) { } /// RecordVariable - Indicate the declaration of a local variable. -void DwarfDebug::RecordVariable(GlobalVariable *GV, unsigned FrameIndex) { +void DwarfDebug::RecordVariable(MDNode *N, unsigned FrameIndex) { if (TimePassesIsEnabled) DebugTimer->startTimer(); - DIDescriptor Desc(GV); + DIDescriptor Desc(N); DbgScope *Scope = NULL; bool InlinedFnVar = false; - if (Desc.getTag() == dwarf::DW_TAG_variable) { - // GV is a global variable. - DIGlobalVariable DG(GV); - Scope = getOrCreateScope(DG.getContext().getGV()); - } else { + if (Desc.getTag() == dwarf::DW_TAG_variable) + Scope = getOrCreateScope(DIGlobalVariable(N).getContext().getNode()); + else { bool InlinedVar = false; - DIVariable DV(GV); - GlobalVariable *V = DV.getContext().getGV(); - DISubprogram SP(V); + MDNode *Context = DIVariable(N).getContext().getNode(); + DISubprogram SP(Context); if (!SP.isNull()) { // SP is inserted into DbgAbstractScopeMap when inlined function // start was recorded by RecordInlineFnStart. - DenseMap::iterator - I = DbgAbstractScopeMap.find(SP.getGV()); + DenseMap::iterator + I = DbgAbstractScopeMap.find(SP.getNode()); if (I != DbgAbstractScopeMap.end()) { InlinedVar = true; Scope = I->second; } } - if (!InlinedVar) { - // GV is a local variable. - Scope = getOrCreateScope(V); - } + if (!InlinedVar) + Scope = getOrCreateScope(Context); } assert(Scope && "Unable to find the variable's scope"); - DbgVariable *DV = new DbgVariable(DIVariable(GV), FrameIndex, InlinedFnVar); + DbgVariable *DV = new DbgVariable(DIVariable(N), FrameIndex, InlinedFnVar); Scope->AddVariable(DV); if (TimePassesIsEnabled) @@ -1661,17 +1662,17 @@ unsigned DwarfDebug::RecordInlinedFnStart(DISubprogram &SP, DICompileUnit CU, if (TimePassesIsEnabled) DebugTimer->startTimer(); - GlobalVariable *GV = SP.getGV(); - DenseMap::iterator - II = AbstractInstanceRootMap.find(GV); + MDNode *Node = SP.getNode(); + DenseMap::iterator + II = AbstractInstanceRootMap.find(Node); if (II == AbstractInstanceRootMap.end()) { // Create an abstract instance entry for this inlined function if it doesn't // already exist. - DbgScope *Scope = new DbgScope(NULL, DIDescriptor(GV)); + DbgScope *Scope = new DbgScope(NULL, DIDescriptor(Node)); // Get the compile unit context. - DIE *SPDie = ModuleCU->getDieMapSlotFor(GV); + DIE *SPDie = ModuleCU->getDieMapSlotFor(Node); if (!SPDie) SPDie = CreateSubprogramDIE(ModuleCU, SP, false, true); @@ -1683,18 +1684,18 @@ unsigned DwarfDebug::RecordInlinedFnStart(DISubprogram &SP, DICompileUnit CU, AddUInt(SPDie, dwarf::DW_AT_inline, 0, dwarf::DW_INL_declared_not_inlined); // Keep track of the abstract scope for this function. - DbgAbstractScopeMap[GV] = Scope; + DbgAbstractScopeMap[Node] = Scope; - AbstractInstanceRootMap[GV] = Scope; + AbstractInstanceRootMap[Node] = Scope; AbstractInstanceRootList.push_back(Scope); } // Create a concrete inlined instance for this inlined function. - DbgConcreteScope *ConcreteScope = new DbgConcreteScope(DIDescriptor(GV)); + DbgConcreteScope *ConcreteScope = new DbgConcreteScope(DIDescriptor(Node)); DIE *ScopeDie = new DIE(dwarf::DW_TAG_inlined_subroutine); ScopeDie->setAbstractCompileUnit(ModuleCU); - DIE *Origin = ModuleCU->getDieMapSlotFor(GV); + DIE *Origin = ModuleCU->getDieMapSlotFor(Node); AddDIEEntry(ScopeDie, dwarf::DW_AT_abstract_origin, dwarf::DW_FORM_ref4, Origin); AddUInt(ScopeDie, dwarf::DW_AT_call_file, 0, ModuleCU->getID()); @@ -1708,20 +1709,20 @@ unsigned DwarfDebug::RecordInlinedFnStart(DISubprogram &SP, DICompileUnit CU, LexicalScopeStack.back()->AddConcreteInst(ConcreteScope); // Keep track of the concrete scope that's inlined into this function. - DenseMap >::iterator - SI = DbgConcreteScopeMap.find(GV); + DenseMap >::iterator + SI = DbgConcreteScopeMap.find(Node); if (SI == DbgConcreteScopeMap.end()) - DbgConcreteScopeMap[GV].push_back(ConcreteScope); + DbgConcreteScopeMap[Node].push_back(ConcreteScope); else SI->second.push_back(ConcreteScope); // Track the start label for this inlined function. - DenseMap >::iterator - I = InlineInfo.find(GV); + DenseMap >::iterator + I = InlineInfo.find(Node); if (I == InlineInfo.end()) - InlineInfo[GV].push_back(LabelID); + InlineInfo[Node].push_back(LabelID); else I->second.push_back(LabelID); @@ -1739,9 +1740,9 @@ unsigned DwarfDebug::RecordInlinedFnEnd(DISubprogram &SP) { if (TimePassesIsEnabled) DebugTimer->startTimer(); - GlobalVariable *GV = SP.getGV(); - DenseMap >::iterator - I = DbgConcreteScopeMap.find(GV); + MDNode *Node = SP.getNode(); + DenseMap >::iterator + I = DbgConcreteScopeMap.find(Node); if (I == DbgConcreteScopeMap.end()) { // FIXME: Can this situation actually happen? And if so, should it? @@ -2446,11 +2447,11 @@ void DwarfDebug::EmitDebugInlineInfo() { Asm->EmitInt16(dwarf::DWARF_VERSION); Asm->EOL("Dwarf Version"); Asm->EmitInt8(TD->getPointerSize()); Asm->EOL("Address Size (in bytes)"); - for (DenseMap >::iterator + for (DenseMap >::iterator I = InlineInfo.begin(), E = InlineInfo.end(); I != E; ++I) { - GlobalVariable *GV = I->first; + MDNode *Node = I->first; SmallVector &Labels = I->second; - DISubprogram SP(GV); + DISubprogram SP(Node); std::string Name; std::string LName; @@ -2476,7 +2477,7 @@ void DwarfDebug::EmitDebugInlineInfo() { for (SmallVector::iterator LI = Labels.begin(), LE = Labels.end(); LI != LE; ++LI) { - DIE *SP = ModuleCU->getDieMapSlotFor(GV); + DIE *SP = ModuleCU->getDieMapSlotFor(Node); Asm->EmitInt32(SP->getOffset()); Asm->EOL("DIE offset"); if (TD->getPointerSize() == sizeof(int32_t)) diff --git a/libclamav/c++/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h b/libclamav/c++/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h index bd7cdf70b..917d6efef 100644 --- a/libclamav/c++/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h +++ b/libclamav/c++/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h @@ -139,25 +139,25 @@ class VISIBILITY_HIDDEN DwarfDebug : public Dwarf { DbgScope *FunctionDbgScope; /// DbgScopeMap - Tracks the scopes in the current function. - DenseMap DbgScopeMap; + DenseMap DbgScopeMap; /// DbgAbstractScopeMap - Tracks abstract instance scopes in the current /// function. - DenseMap DbgAbstractScopeMap; + DenseMap DbgAbstractScopeMap; /// DbgConcreteScopeMap - Tracks concrete instance scopes in the current /// function. - DenseMap > DbgConcreteScopeMap; /// InlineInfo - Keep track of inlined functions and their location. This /// information is used to populate debug_inlined section. - DenseMap > InlineInfo; + DenseMap > InlineInfo; /// AbstractInstanceRootMap - Map of abstract instance roots of inlined /// functions. These are subroutine entries that contain a DW_AT_inline /// attribute. - DenseMap AbstractInstanceRootMap; + DenseMap AbstractInstanceRootMap; /// AbstractInstanceRootList - List of abstract instance roots of inlined /// functions. These are subroutine entries that contain a DW_AT_inline @@ -335,7 +335,7 @@ class VISIBILITY_HIDDEN DwarfDebug : public Dwarf { /// getOrCreateScope - Returns the scope associated with the given descriptor. /// - DbgScope *getOrCreateScope(GlobalVariable *V); + DbgScope *getOrCreateScope(MDNode *N); /// ConstructDbgScope - Construct the components of a scope. /// @@ -448,11 +448,11 @@ class VISIBILITY_HIDDEN DwarfDebug : public Dwarf { unsigned GetOrCreateSourceID(const std::string &DirName, const std::string &FileName); - void ConstructCompileUnit(GlobalVariable *GV); + void ConstructCompileUnit(MDNode *N); - void ConstructGlobalVariableDIE(GlobalVariable *GV); + void ConstructGlobalVariableDIE(MDNode *N); - void ConstructSubprogram(GlobalVariable *GV); + void ConstructSubprogram(MDNode *N); public: //===--------------------------------------------------------------------===// @@ -506,13 +506,13 @@ public: const std::string &FileName); /// RecordRegionStart - Indicate the start of a region. - unsigned RecordRegionStart(GlobalVariable *V); + unsigned RecordRegionStart(MDNode *N); /// RecordRegionEnd - Indicate the end of a region. - unsigned RecordRegionEnd(GlobalVariable *V); + unsigned RecordRegionEnd(MDNode *N); /// RecordVariable - Indicate the declaration of a local variable. - void RecordVariable(GlobalVariable *GV, unsigned FrameIndex); + void RecordVariable(MDNode *N, unsigned FrameIndex); //// RecordInlinedFnStart - Indicate the start of inlined subroutine. unsigned RecordInlinedFnStart(DISubprogram &SP, DICompileUnit CU, diff --git a/libclamav/c++/llvm/lib/CodeGen/AsmPrinter/DwarfException.cpp b/libclamav/c++/llvm/lib/CodeGen/AsmPrinter/DwarfException.cpp index c44e7b620..f6feccdac 100644 --- a/libclamav/c++/llvm/lib/CodeGen/AsmPrinter/DwarfException.cpp +++ b/libclamav/c++/llvm/lib/CodeGen/AsmPrinter/DwarfException.cpp @@ -40,7 +40,7 @@ DwarfException::DwarfException(raw_ostream &OS, AsmPrinter *A, : Dwarf(OS, A, T, "eh"), shouldEmitTable(false), shouldEmitMoves(false), shouldEmitTableModule(false), shouldEmitMovesModule(false), ExceptionTimer(0) { - if (TimePassesIsEnabled) + if (TimePassesIsEnabled) ExceptionTimer = new Timer("Dwarf Exception Writer", getDwarfTimerGroup()); } @@ -49,8 +49,10 @@ DwarfException::~DwarfException() { delete ExceptionTimer; } -void DwarfException::EmitCommonEHFrame(const Function *Personality, - unsigned Index) { +/// EmitCIE - Emit a Common Information Entry (CIE). This holds information that +/// is shared among many Frame Description Entries. There is at least one CIE +/// in every non-empty .debug_frame section. +void DwarfException::EmitCIE(const Function *Personality, unsigned Index) { // Size and sign of stack growth. int stackGrowth = Asm->TM.getFrameInfo()->getStackGrowthDirection() == @@ -94,7 +96,7 @@ void DwarfException::EmitCommonEHFrame(const Function *Personality, Asm->EmitInt8(RI->getDwarfRegNum(RI->getRARegister(), true)); Asm->EOL("CIE Return Address Column"); - // If there is a personality, we need to indicate the functions location. + // If there is a personality, we need to indicate the function's location. if (Personality) { Asm->EmitULEB128Bytes(7); Asm->EOL("Augmentation Size"); @@ -144,16 +146,15 @@ void DwarfException::EmitCommonEHFrame(const Function *Personality, Asm->EOL(); } -/// EmitEHFrame - Emit function exception frame information. -/// -void DwarfException::EmitEHFrame(const FunctionEHFrameInfo &EHFrameInfo) { - assert(!EHFrameInfo.function->hasAvailableExternallyLinkage() && +/// EmitFDE - Emit the Frame Description Entry (FDE) for the function. +void DwarfException::EmitFDE(const FunctionEHFrameInfo &EHFrameInfo) { + assert(!EHFrameInfo.function->hasAvailableExternallyLinkage() && "Should not emit 'available externally' functions at all"); const Function *TheFunc = EHFrameInfo.function; - + Asm->OutStreamer.SwitchSection(Asm->getObjFileLowering().getEHFrameSection()); - + // Externally visible entry into the functions eh frame info. If the // corresponding function is static, this should not be externally visible. if (!TheFunc->hasLocalLinkage()) @@ -202,14 +203,20 @@ void DwarfException::EmitEHFrame(const FunctionEHFrameInfo &EHFrameInfo) { // If there is a personality and landing pads then point to the language // specific data area in the exception table. - if (EHFrameInfo.PersonalityIndex) { - Asm->EmitULEB128Bytes(4); + if (MMI->getPersonalities()[0] != NULL) { + bool is4Byte = TD->getPointerSize() == sizeof(int32_t); + + Asm->EmitULEB128Bytes(is4Byte ? 4 : 8); Asm->EOL("Augmentation size"); if (EHFrameInfo.hasLandingPads) - EmitReference("exception", EHFrameInfo.Number, true, true); - else - Asm->EmitInt32((int)0); + EmitReference("exception", EHFrameInfo.Number, true, false); + else { + if (is4Byte) + Asm->EmitInt32((int)0); + else + Asm->EmitInt64((int)0); + } Asm->EOL("Language Specific Data Area"); } else { Asm->EmitULEB128Bytes(0); @@ -217,7 +224,7 @@ void DwarfException::EmitEHFrame(const FunctionEHFrameInfo &EHFrameInfo) { } // Indicate locations of function specific callee saved registers in frame. - EmitFrameMoves("eh_func_begin", EHFrameInfo.Number, EHFrameInfo.Moves, + EmitFrameMoves("eh_func_begin", EHFrameInfo.Number, EHFrameInfo.Moves, true); // On Darwin the linker honors the alignment of eh_frame, which means it @@ -236,6 +243,8 @@ void DwarfException::EmitEHFrame(const FunctionEHFrameInfo &EHFrameInfo) { if (const char *UsedDirective = MAI->getUsedDirective()) O << UsedDirective << EHFrameInfo.FnName << "\n\n"; } + + Asm->EOL(); } /// SharedTypeIds - How many leading type ids two landing pads have in common. @@ -448,8 +457,9 @@ ComputeCallSiteTable(SmallVectorImpl &CallSites, FirstActions[P.PadIndex] }; - // Try to merge with the previous call-site. - if (PreviousIsInvoke) { + // Try to merge with the previous call-site. SJLJ doesn't do this + if (PreviousIsInvoke && + MAI->getExceptionHandlingType() == ExceptionHandling::Dwarf) { CallSiteEntry &Prev = CallSites.back(); if (Site.PadLabel == Prev.PadLabel && Site.Action == Prev.Action) { // Extend the range of the previous entry. @@ -483,7 +493,7 @@ ComputeCallSiteTable(SmallVectorImpl &CallSites, /// The general organization of the table is complex, but the basic concepts are /// easy. First there is a header which describes the location and organization /// of the three components that follow. -/// +/// /// 1. The landing pad site information describes the range of code covered by /// the try. In our case it's an accumulation of the ranges covered by the /// invokes in the try. There is also a reference to the landing pad that @@ -791,7 +801,7 @@ void DwarfException::EmitExceptionTable() { // associated switch value. // // Action Record Fields: - // + // // * Filter Value // Positive value, starting at 1. Index in the types table of the // __typeinfo for the catch-clause type. 1 is the first word preceding @@ -816,7 +826,7 @@ void DwarfException::EmitExceptionTable() { std::string GLN; O << Asm->getGlobalLinkName(GV, GLN); } else { - O << "0"; + O << "0x0"; } Asm->EOL("TypeInfo"); @@ -844,11 +854,11 @@ void DwarfException::EndModule() { if (shouldEmitMovesModule || shouldEmitTableModule) { const std::vector Personalities = MMI->getPersonalities(); for (unsigned i = 0; i < Personalities.size(); ++i) - EmitCommonEHFrame(Personalities[i], i); + EmitCIE(Personalities[i], i); for (std::vector::iterator I = EHFrames.begin(), E = EHFrames.end(); I != E; ++I) - EmitEHFrame(*I); + EmitFDE(*I); } if (TimePassesIsEnabled) @@ -891,7 +901,7 @@ void DwarfException::BeginFunction(MachineFunction *MF) { /// EndFunction - Gather and emit post-function exception information. /// void DwarfException::EndFunction() { - if (TimePassesIsEnabled) + if (TimePassesIsEnabled) ExceptionTimer->startTimer(); if (shouldEmitMoves || shouldEmitTable) { @@ -909,6 +919,6 @@ void DwarfException::EndFunction() { MF->getFunction())); } - if (TimePassesIsEnabled) + if (TimePassesIsEnabled) ExceptionTimer->stopTimer(); } diff --git a/libclamav/c++/llvm/lib/CodeGen/AsmPrinter/DwarfException.h b/libclamav/c++/llvm/lib/CodeGen/AsmPrinter/DwarfException.h index 5f4fda750..b1820b727 100644 --- a/libclamav/c++/llvm/lib/CodeGen/AsmPrinter/DwarfException.h +++ b/libclamav/c++/llvm/lib/CodeGen/AsmPrinter/DwarfException.h @@ -70,13 +70,13 @@ class VISIBILITY_HIDDEN DwarfException : public Dwarf { /// ExceptionTimer - Timer for the Dwarf exception writer. Timer *ExceptionTimer; - /// EmitCommonEHFrame - Emit the common eh unwind frame. - /// - void EmitCommonEHFrame(const Function *Personality, unsigned Index); + /// EmitCIE - Emit a Common Information Entry (CIE). This holds information + /// that is shared among many Frame Description Entries. There is at least + /// one CIE in every non-empty .debug_frame section. + void EmitCIE(const Function *Personality, unsigned Index); - /// EmitEHFrame - Emit function exception frame information. - /// - void EmitEHFrame(const FunctionEHFrameInfo &EHFrameInfo); + /// EmitFDE - Emit the Frame Description Entry (FDE) for the function. + void EmitFDE(const FunctionEHFrameInfo &EHFrameInfo); /// EmitExceptionTable - Emit landing pads and actions. /// diff --git a/libclamav/c++/llvm/lib/CodeGen/AsmPrinter/DwarfWriter.cpp b/libclamav/c++/llvm/lib/CodeGen/AsmPrinter/DwarfWriter.cpp index 440b91c89..aafac71b2 100644 --- a/libclamav/c++/llvm/lib/CodeGen/AsmPrinter/DwarfWriter.cpp +++ b/libclamav/c++/llvm/lib/CodeGen/AsmPrinter/DwarfWriter.cpp @@ -80,13 +80,13 @@ unsigned DwarfWriter::RecordSourceLine(unsigned Line, unsigned Col, } /// RecordRegionStart - Indicate the start of a region. -unsigned DwarfWriter::RecordRegionStart(GlobalVariable *V) { - return DD->RecordRegionStart(V); +unsigned DwarfWriter::RecordRegionStart(MDNode *N) { + return DD->RecordRegionStart(N); } /// RecordRegionEnd - Indicate the end of a region. -unsigned DwarfWriter::RecordRegionEnd(GlobalVariable *V) { - return DD->RecordRegionEnd(V); +unsigned DwarfWriter::RecordRegionEnd(MDNode *N) { + return DD->RecordRegionEnd(N); } /// getRecordSourceLineCount - Count source lines. @@ -96,8 +96,8 @@ unsigned DwarfWriter::getRecordSourceLineCount() { /// RecordVariable - Indicate the declaration of a local variable. /// -void DwarfWriter::RecordVariable(GlobalVariable *GV, unsigned FrameIndex) { - DD->RecordVariable(GV, FrameIndex); +void DwarfWriter::RecordVariable(MDNode *N, unsigned FrameIndex) { + DD->RecordVariable(N, FrameIndex); } /// ShouldEmitDwarfDebug - Returns true if Dwarf debugging declarations should @@ -106,8 +106,7 @@ bool DwarfWriter::ShouldEmitDwarfDebug() const { return DD && DD->ShouldEmitDwarfDebug(); } -//// RecordInlinedFnStart - Global variable GV is inlined at the location marked -//// by LabelID label. +//// RecordInlinedFnStart unsigned DwarfWriter::RecordInlinedFnStart(DISubprogram SP, DICompileUnit CU, unsigned Line, unsigned Col) { return DD->RecordInlinedFnStart(SP, CU, Line, Col); diff --git a/libclamav/c++/llvm/lib/CodeGen/LLVMTargetMachine.cpp b/libclamav/c++/llvm/lib/CodeGen/LLVMTargetMachine.cpp index 01cf3af50..5b6cfdc98 100644 --- a/libclamav/c++/llvm/lib/CodeGen/LLVMTargetMachine.cpp +++ b/libclamav/c++/llvm/lib/CodeGen/LLVMTargetMachine.cpp @@ -51,10 +51,10 @@ DisablePostRAScheduler("disable-post-RA-scheduler", // Enable or disable FastISel. Both options are needed, because // FastISel is enabled by default with -fast, and we wish to be -// able to enable or disable fast-isel independently from -fast. +// able to enable or disable fast-isel independently from -O0. static cl::opt EnableFastISelOption("fast-isel", cl::Hidden, - cl::desc("Enable the experimental \"fast\" instruction selector")); + cl::desc("Enable the \"fast\" instruction selector")); LLVMTargetMachine::LLVMTargetMachine(const Target &T, diff --git a/libclamav/c++/llvm/lib/CodeGen/MachineFunction.cpp b/libclamav/c++/llvm/lib/CodeGen/MachineFunction.cpp index 25dfa6e1b..14ba36011 100644 --- a/libclamav/c++/llvm/lib/CodeGen/MachineFunction.cpp +++ b/libclamav/c++/llvm/lib/CodeGen/MachineFunction.cpp @@ -333,7 +333,7 @@ unsigned MachineFunction::addLiveIn(unsigned PReg, /// getOrCreateDebugLocID - Look up the DebugLocTuple index with the given /// source file, line, and column. If none currently exists, create a new /// DebugLocTuple, and insert it into the DebugIdMap. -unsigned MachineFunction::getOrCreateDebugLocID(GlobalVariable *CompileUnit, +unsigned MachineFunction::getOrCreateDebugLocID(MDNode *CompileUnit, unsigned Line, unsigned Col) { DebugLocTuple Tuple(CompileUnit, Line, Col); DenseMap::iterator II diff --git a/libclamav/c++/llvm/lib/CodeGen/MachineModuleInfo.cpp b/libclamav/c++/llvm/lib/CodeGen/MachineModuleInfo.cpp index 08b126a13..a673d177f 100644 --- a/libclamav/c++/llvm/lib/CodeGen/MachineModuleInfo.cpp +++ b/libclamav/c++/llvm/lib/CodeGen/MachineModuleInfo.cpp @@ -33,7 +33,7 @@ X("machinemoduleinfo", "Module Information"); char MachineModuleInfo::ID = 0; //===----------------------------------------------------------------------===// - + MachineModuleInfo::MachineModuleInfo() : ImmutablePass(&ID) , LabelIDList() @@ -44,7 +44,7 @@ MachineModuleInfo::MachineModuleInfo() , CallsUnwindInit(0) , DbgInfoAvailable(false) { - // Always emit "no personality" info + // Always emit some info, by default "no personality" info. Personalities.push_back(NULL); } MachineModuleInfo::~MachineModuleInfo() { @@ -74,7 +74,7 @@ void MachineModuleInfo::BeginFunction(MachineFunction *MF) { void MachineModuleInfo::EndFunction() { // Clean up frame info. FrameMoves.clear(); - + // Clean up exception info. LandingPads.clear(); TypeInfos.clear(); @@ -114,7 +114,7 @@ LandingPadInfo &MachineModuleInfo::getOrCreateLandingPadInfo if (LP.LandingPadBlock == LandingPad) return LP; } - + LandingPads.push_back(LandingPadInfo(LandingPad)); return LandingPads[N]; } @@ -133,7 +133,7 @@ void MachineModuleInfo::addInvoke(MachineBasicBlock *LandingPad, unsigned MachineModuleInfo::addLandingPad(MachineBasicBlock *LandingPad) { unsigned LandingPadLabel = NextLabelID(); LandingPadInfo &LP = getOrCreateLandingPadInfo(LandingPad); - LP.LandingPadLabel = LandingPadLabel; + LP.LandingPadLabel = LandingPadLabel; return LandingPadLabel; } @@ -147,8 +147,13 @@ void MachineModuleInfo::addPersonality(MachineBasicBlock *LandingPad, for (unsigned i = 0; i < Personalities.size(); ++i) if (Personalities[i] == Personality) return; - - Personalities.push_back(Personality); + + // If this is the first personality we're adding go + // ahead and add it at the beginning. + if (Personalities[0] == NULL) + Personalities[0] = Personality; + else + Personalities.push_back(Personality); } /// addCatchTypeInfo - Provide the catch typeinfo for a landing pad. @@ -223,7 +228,7 @@ void MachineModuleInfo::TidyLandingPads() { } } -/// getTypeIDFor - Return the type id for the specified typeinfo. This is +/// getTypeIDFor - Return the type id for the specified typeinfo. This is /// function wide. unsigned MachineModuleInfo::getTypeIDFor(GlobalVariable *TI) { for (unsigned i = 0, N = TypeInfos.size(); i != N; ++i) @@ -272,24 +277,24 @@ Function *MachineModuleInfo::getPersonality() const { } /// getPersonalityIndex - Return unique index for current personality -/// function. NULL personality function should always get zero index. +/// function. NULL/first personality function should always get zero index. unsigned MachineModuleInfo::getPersonalityIndex() const { const Function* Personality = NULL; - + // Scan landing pads. If there is at least one non-NULL personality - use it. for (unsigned i = 0; i != LandingPads.size(); ++i) if (LandingPads[i].Personality) { Personality = LandingPads[i].Personality; break; } - + for (unsigned i = 0; i < Personalities.size(); ++i) { if (Personalities[i] == Personality) return i; } - // This should never happen - llvm_unreachable("Personality function should be set!"); + // This will happen if the current personality function is + // in the zero index. return 0; } @@ -321,12 +326,12 @@ bool DebugLabelFolder::runOnMachineFunction(MachineFunction &MF) { // Get machine module info. MachineModuleInfo *MMI = getAnalysisIfAvailable(); if (!MMI) return false; - + // Track if change is made. bool MadeChange = false; // No prior label to begin. unsigned PriorLabel = 0; - + // Iterate through basic blocks. for (MachineFunction::iterator BB = MF.begin(), E = MF.end(); BB != E; ++BB) { @@ -336,7 +341,7 @@ bool DebugLabelFolder::runOnMachineFunction(MachineFunction &MF) { if (I->isDebugLabel() && !MMI->isDbgLabelUsed(I->getOperand(0).getImm())){ // The label ID # is always operand #0, an immediate. unsigned NextLabel = I->getOperand(0).getImm(); - + // If there was an immediate prior label. if (PriorLabel) { // Remap the current label to prior label. @@ -354,15 +359,14 @@ bool DebugLabelFolder::runOnMachineFunction(MachineFunction &MF) { // No consecutive labels. PriorLabel = 0; } - + ++I; } } - + return MadeChange; } FunctionPass *createDebugLabelFoldingPass() { return new DebugLabelFolder(); } } - diff --git a/libclamav/c++/llvm/lib/CodeGen/MachineVerifier.cpp b/libclamav/c++/llvm/lib/CodeGen/MachineVerifier.cpp index 1d7000c7d..f43a37034 100644 --- a/libclamav/c++/llvm/lib/CodeGen/MachineVerifier.cpp +++ b/libclamav/c++/llvm/lib/CodeGen/MachineVerifier.cpp @@ -300,6 +300,142 @@ MachineVerifier::visitMachineFunctionBefore() void MachineVerifier::visitMachineBasicBlockBefore(const MachineBasicBlock *MBB) { + const TargetInstrInfo *TII = MF->getTarget().getInstrInfo(); + + // Start with minimal CFG sanity checks. + MachineFunction::const_iterator MBBI = MBB; + ++MBBI; + if (MBBI != MF->end()) { + // Block is not last in function. + if (!MBB->isSuccessor(MBBI)) { + // Block does not fall through. + if (MBB->empty()) { + report("MBB doesn't fall through but is empty!", MBB); + } + } + if (TII->BlockHasNoFallThrough(*MBB)) { + if (MBB->empty()) { + report("TargetInstrInfo says the block has no fall through, but the " + "block is empty!", MBB); + } else if (!MBB->back().getDesc().isBarrier()) { + report("TargetInstrInfo says the block has no fall through, but the " + "block does not end in a barrier!", MBB); + } + } + } else { + // Block is last in function. + if (MBB->empty()) { + report("MBB is last in function but is empty!", MBB); + } + } + + // Call AnalyzeBranch. If it succeeds, there several more conditions to check. + MachineBasicBlock *TBB = 0, *FBB = 0; + SmallVector Cond; + if (!TII->AnalyzeBranch(*const_cast(MBB), + TBB, FBB, Cond)) { + // Ok, AnalyzeBranch thinks it knows what's going on with this block. Let's + // check whether its answers match up with reality. + if (!TBB && !FBB) { + // Block falls through to its successor. + MachineFunction::const_iterator MBBI = MBB; + ++MBBI; + if (MBBI == MF->end()) { + // It's possible that the block legitimately ends with a noreturn + // call or an unreachable, in which case it won't actually fall + // out the bottom of the function. + } else if (MBB->succ_empty()) { + // It's possible that the block legitimately ends with a noreturn + // call or an unreachable, in which case it won't actuall fall + // out of the block. + } else if (MBB->succ_size() != 1) { + report("MBB exits via unconditional fall-through but doesn't have " + "exactly one CFG successor!", MBB); + } else if (MBB->succ_begin()[0] != MBBI) { + report("MBB exits via unconditional fall-through but its successor " + "differs from its CFG successor!", MBB); + } + if (!MBB->empty() && MBB->back().getDesc().isBarrier()) { + report("MBB exits via unconditional fall-through but ends with a " + "barrier instruction!", MBB); + } + if (!Cond.empty()) { + report("MBB exits via unconditional fall-through but has a condition!", + MBB); + } + } else if (TBB && !FBB && Cond.empty()) { + // Block unconditionally branches somewhere. + if (MBB->succ_size() != 1) { + report("MBB exits via unconditional branch but doesn't have " + "exactly one CFG successor!", MBB); + } else if (MBB->succ_begin()[0] != TBB) { + report("MBB exits via unconditional branch but the CFG " + "successor doesn't match the actual successor!", MBB); + } + if (MBB->empty()) { + report("MBB exits via unconditional branch but doesn't contain " + "any instructions!", MBB); + } else if (!MBB->back().getDesc().isBarrier()) { + report("MBB exits via unconditional branch but doesn't end with a " + "barrier instruction!", MBB); + } else if (!MBB->back().getDesc().isTerminator()) { + report("MBB exits via unconditional branch but the branch isn't a " + "terminator instruction!", MBB); + } + } else if (TBB && !FBB && !Cond.empty()) { + // Block conditionally branches somewhere, otherwise falls through. + MachineFunction::const_iterator MBBI = MBB; + ++MBBI; + if (MBBI == MF->end()) { + report("MBB conditionally falls through out of function!", MBB); + } if (MBB->succ_size() != 2) { + report("MBB exits via conditional branch/fall-through but doesn't have " + "exactly two CFG successors!", MBB); + } else if ((MBB->succ_begin()[0] == TBB && MBB->succ_end()[1] == MBBI) || + (MBB->succ_begin()[1] == TBB && MBB->succ_end()[0] == MBBI)) { + report("MBB exits via conditional branch/fall-through but the CFG " + "successors don't match the actual successors!", MBB); + } + if (MBB->empty()) { + report("MBB exits via conditional branch/fall-through but doesn't " + "contain any instructions!", MBB); + } else if (MBB->back().getDesc().isBarrier()) { + report("MBB exits via conditional branch/fall-through but ends with a " + "barrier instruction!", MBB); + } else if (!MBB->back().getDesc().isTerminator()) { + report("MBB exits via conditional branch/fall-through but the branch " + "isn't a terminator instruction!", MBB); + } + } else if (TBB && FBB) { + // Block conditionally branches somewhere, otherwise branches + // somewhere else. + if (MBB->succ_size() != 2) { + report("MBB exits via conditional branch/branch but doesn't have " + "exactly two CFG successors!", MBB); + } else if ((MBB->succ_begin()[0] == TBB && MBB->succ_end()[1] == FBB) || + (MBB->succ_begin()[1] == TBB && MBB->succ_end()[0] == FBB)) { + report("MBB exits via conditional branch/branch but the CFG " + "successors don't match the actual successors!", MBB); + } + if (MBB->empty()) { + report("MBB exits via conditional branch/branch but doesn't " + "contain any instructions!", MBB); + } else if (!MBB->back().getDesc().isBarrier()) { + report("MBB exits via conditional branch/branch but doesn't end with a " + "barrier instruction!", MBB); + } else if (!MBB->back().getDesc().isTerminator()) { + report("MBB exits via conditional branch/branch but the branch " + "isn't a terminator instruction!", MBB); + } + if (Cond.empty()) { + report("MBB exits via conditinal branch/branch but there's no " + "condition!", MBB); + } + } else { + report("AnalyzeBranch returned invalid data!", MBB); + } + } + regsLive.clear(); for (MachineBasicBlock::const_livein_iterator I = MBB->livein_begin(), E = MBB->livein_end(); I != E; ++I) { diff --git a/libclamav/c++/llvm/lib/CodeGen/PostRASchedulerList.cpp b/libclamav/c++/llvm/lib/CodeGen/PostRASchedulerList.cpp index 5042415c2..4b4c0768a 100644 --- a/libclamav/c++/llvm/lib/CodeGen/PostRASchedulerList.cpp +++ b/libclamav/c++/llvm/lib/CodeGen/PostRASchedulerList.cpp @@ -40,6 +40,7 @@ #include "llvm/Support/raw_ostream.h" #include "llvm/ADT/Statistic.h" #include +#include using namespace llvm; STATISTIC(NumNoops, "Number of noops inserted"); @@ -140,6 +141,11 @@ namespace { /// Schedule - Schedule the instruction range using list scheduling. /// void Schedule(); + + /// FixupKills - Fix register kill flags that have been made + /// invalid due to scheduling + /// + void FixupKills(MachineBasicBlock *MBB); /// Observe - Update liveness information to account for the current /// instruction, which will not be scheduled. @@ -150,6 +156,11 @@ namespace { /// void FinishBlock(); + /// GenerateLivenessForKills - If true then generate Def/Kill + /// information for use in updating register kill. If false then + /// generate Def/Kill information for anti-dependence breaking. + bool GenerateLivenessForKills; + private: void PrescanInstruction(MachineInstr *MI); void ScanInstruction(MachineInstr *MI, unsigned Count); @@ -202,6 +213,7 @@ bool PostRAScheduler::runOnMachineFunction(MachineFunction &Fn) { for (MachineFunction::iterator MBB = Fn.begin(), MBBe = Fn.end(); MBB != MBBe; ++MBB) { // Initialize register live-range state for scheduling in this block. + Scheduler.GenerateLivenessForKills = false; Scheduler.StartBlock(MBB); // Schedule each sequence of instructions not interrupted by a label @@ -228,6 +240,12 @@ bool PostRAScheduler::runOnMachineFunction(MachineFunction &Fn) { // Clean up register live-range state. Scheduler.FinishBlock(); + + // Initialize register live-range state again and update register kills + Scheduler.GenerateLivenessForKills = true; + Scheduler.StartBlock(MBB); + Scheduler.FixupKills(MBB); + Scheduler.FinishBlock(); } return true; @@ -287,26 +305,28 @@ void SchedulePostRATDList::StartBlock(MachineBasicBlock *BB) { } } - // Consider callee-saved registers as live-out, since we're running after - // prologue/epilogue insertion so there's no way to add additional - // saved registers. - // - // TODO: If the callee saves and restores these, then we can potentially - // use them between the save and the restore. To do that, we could scan - // the exit blocks to see which of these registers are defined. - // Alternatively, callee-saved registers that aren't saved and restored - // could be marked live-in in every block. - for (const unsigned *I = TRI->getCalleeSavedRegs(); *I; ++I) { - unsigned Reg = *I; - Classes[Reg] = reinterpret_cast(-1); - KillIndices[Reg] = BB->size(); - DefIndices[Reg] = ~0u; - // Repeat, for all aliases. - for (const unsigned *Alias = TRI->getAliasSet(Reg); *Alias; ++Alias) { - unsigned AliasReg = *Alias; - Classes[AliasReg] = reinterpret_cast(-1); - KillIndices[AliasReg] = BB->size(); - DefIndices[AliasReg] = ~0u; + if (!GenerateLivenessForKills) { + // Consider callee-saved registers as live-out, since we're running after + // prologue/epilogue insertion so there's no way to add additional + // saved registers. + // + // TODO: If the callee saves and restores these, then we can potentially + // use them between the save and the restore. To do that, we could scan + // the exit blocks to see which of these registers are defined. + // Alternatively, callee-saved registers that aren't saved and restored + // could be marked live-in in every block. + for (const unsigned *I = TRI->getCalleeSavedRegs(); *I; ++I) { + unsigned Reg = *I; + Classes[Reg] = reinterpret_cast(-1); + KillIndices[Reg] = BB->size(); + DefIndices[Reg] = ~0u; + // Repeat, for all aliases. + for (const unsigned *Alias = TRI->getAliasSet(Reg); *Alias; ++Alias) { + unsigned AliasReg = *Alias; + Classes[AliasReg] = reinterpret_cast(-1); + KillIndices[AliasReg] = BB->size(); + DefIndices[AliasReg] = ~0u; + } } } } @@ -753,6 +773,102 @@ bool SchedulePostRATDList::BreakAntiDependencies() { return Changed; } +/// FixupKills - Fix the register kill flags, they may have been made +/// incorrect by instruction reordering. +/// +void SchedulePostRATDList::FixupKills(MachineBasicBlock *MBB) { + DEBUG(errs() << "Fixup kills for BB ID#" << MBB->getNumber() << '\n'); + + std::set killedRegs; + BitVector ReservedRegs = TRI->getReservedRegs(MF); + + // Examine block from end to start... + unsigned Count = MBB->size(); + for (MachineBasicBlock::iterator I = MBB->end(), E = MBB->begin(); + I != E; --Count) { + MachineInstr *MI = --I; + + DEBUG(MI->dump()); + // Update liveness. Registers that are defed but not used in this + // instruction are now dead. Mark register and all subregs as they + // are completely defined. + for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { + MachineOperand &MO = MI->getOperand(i); + if (!MO.isReg()) continue; + unsigned Reg = MO.getReg(); + if (Reg == 0) continue; + if (!MO.isDef()) continue; + // Ignore two-addr defs. + if (MI->isRegTiedToUseOperand(i)) continue; + + DEBUG(errs() << "*** Handling Defs " << TM.getRegisterInfo()->get(Reg).Name << '\n'); + + KillIndices[Reg] = ~0u; + + // Repeat for all subregs. + for (const unsigned *Subreg = TRI->getSubRegisters(Reg); + *Subreg; ++Subreg) { + KillIndices[*Subreg] = ~0u; + } + } + + // Examine all used registers and set kill flag. When a register + // is used multiple times we only set the kill flag on the first + // use. + killedRegs.clear(); + for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { + MachineOperand &MO = MI->getOperand(i); + if (!MO.isReg() || !MO.isUse()) continue; + unsigned Reg = MO.getReg(); + if ((Reg == 0) || ReservedRegs.test(Reg)) continue; + + DEBUG(errs() << "*** Handling Uses " << TM.getRegisterInfo()->get(Reg).Name << '\n'); + + bool kill = false; + if (killedRegs.find(Reg) == killedRegs.end()) { + kill = true; + // A register is not killed if any subregs are live... + for (const unsigned *Subreg = TRI->getSubRegisters(Reg); + *Subreg; ++Subreg) { + if (KillIndices[*Subreg] != ~0u) { + kill = false; + break; + } + } + + // If subreg is not live, then register is killed if it became + // live in this instruction + if (kill) + kill = (KillIndices[Reg] == ~0u); + } + + if (MO.isKill() != kill) { + MO.setIsKill(kill); + DEBUG(errs() << "Fixed " << MO << " in "); + DEBUG(MI->dump()); + } + + killedRegs.insert(Reg); + } + + // Mark any used register and subregs as now live... + for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { + MachineOperand &MO = MI->getOperand(i); + if (!MO.isReg() || !MO.isUse()) continue; + unsigned Reg = MO.getReg(); + if ((Reg == 0) || ReservedRegs.test(Reg)) continue; + + DEBUG(errs() << "Killing " << TM.getRegisterInfo()->get(Reg).Name << '\n'); + KillIndices[Reg] = Count; + + for (const unsigned *Subreg = TRI->getSubRegisters(Reg); + *Subreg; ++Subreg) { + KillIndices[*Subreg] = Count; + } + } + } +} + //===----------------------------------------------------------------------===// // Top-Down Scheduling //===----------------------------------------------------------------------===// diff --git a/libclamav/c++/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp b/libclamav/c++/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp index 4c60b29e9..5b4c79a9f 100644 --- a/libclamav/c++/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp +++ b/libclamav/c++/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp @@ -335,7 +335,7 @@ bool FastISel::SelectCall(User *I) { if (isValidDebugInfoIntrinsic(*RSI, CodeGenOpt::None) && DW && DW->ShouldEmitDwarfDebug()) { unsigned ID = - DW->RecordRegionStart(cast(RSI->getContext())); + DW->RecordRegionStart(RSI->getContext()); const TargetInstrDesc &II = TII.get(TargetInstrInfo::DBG_LABEL); BuildMI(MBB, DL, II).addImm(ID); } @@ -346,7 +346,7 @@ bool FastISel::SelectCall(User *I) { if (isValidDebugInfoIntrinsic(*REI, CodeGenOpt::None) && DW && DW->ShouldEmitDwarfDebug()) { unsigned ID = 0; - DISubprogram Subprogram(cast(REI->getContext())); + DISubprogram Subprogram(REI->getContext()); if (isInlinedFnEnd(*REI, MF.getFunction())) { // This is end of an inlined function. const TargetInstrDesc &II = TII.get(TargetInstrInfo::DBG_LABEL); @@ -359,7 +359,7 @@ bool FastISel::SelectCall(User *I) { BuildMI(MBB, DL, II).addImm(ID); } else { const TargetInstrDesc &II = TII.get(TargetInstrInfo::DBG_LABEL); - ID = DW->RecordRegionEnd(cast(REI->getContext())); + ID = DW->RecordRegionEnd(REI->getContext()); BuildMI(MBB, DL, II).addImm(ID); } } @@ -384,7 +384,7 @@ bool FastISel::SelectCall(User *I) { setCurDebugLoc(ExtractDebugLocation(*FSI, MF.getDebugLocInfo())); DebugLocTuple PrevLocTpl = MF.getDebugLocTuple(PrevLoc); - DISubprogram SP(cast(FSI->getSubprogram())); + DISubprogram SP(FSI->getSubprogram()); unsigned LabelID = DW->RecordInlinedFnStart(SP, DICompileUnit(PrevLocTpl.CompileUnit), PrevLocTpl.Line, @@ -398,7 +398,7 @@ bool FastISel::SelectCall(User *I) { MF.setDefaultDebugLoc(ExtractDebugLocation(*FSI, MF.getDebugLocInfo())); // llvm.dbg.func_start also defines beginning of function scope. - DW->RecordRegionStart(cast(FSI->getSubprogram())); + DW->RecordRegionStart(FSI->getSubprogram()); return true; } case Intrinsic::dbg_declare: { @@ -419,10 +419,7 @@ bool FastISel::SelectCall(User *I) { if (SI == StaticAllocaMap.end()) break; // VLAs. int FI = SI->second; - // Determine the debug globalvariable. - GlobalValue *GV = cast(Variable); - - DW->RecordVariable(cast(GV), FI); + DW->RecordVariable(cast(Variable), FI); return true; } case Intrinsic::eh_exception: { diff --git a/libclamav/c++/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/libclamav/c++/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp index 10f7b3206..4ed83db26 100644 --- a/libclamav/c++/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp +++ b/libclamav/c++/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp @@ -1279,10 +1279,13 @@ SDValue SelectionDAGLegalize::LegalizeOp(SDValue Op) { break; case TargetLowering::Expand: // f64 = EXTLOAD f32 should expand to LOAD, FP_EXTEND - if (SrcVT == MVT::f32 && Node->getValueType(0) == MVT::f64) { + // f128 = EXTLOAD {f32,f64} too + if ((SrcVT == MVT::f32 && (Node->getValueType(0) == MVT::f64 || + Node->getValueType(0) == MVT::f128)) || + (SrcVT == MVT::f64 && Node->getValueType(0) == MVT::f128)) { SDValue Load = DAG.getLoad(SrcVT, dl, Tmp1, Tmp2, LD->getSrcValue(), - LD->getSrcValueOffset(), - LD->isVolatile(), LD->getAlignment()); + LD->getSrcValueOffset(), + LD->isVolatile(), LD->getAlignment()); Result = DAG.getNode(ISD::FP_EXTEND, dl, Node->getValueType(0), Load); Tmp1 = LegalizeOp(Result); // Relegalize new nodes. @@ -1593,9 +1596,9 @@ SDValue SelectionDAGLegalize::ExpandDBG_STOPPOINT(SDNode* Node) { bool useLABEL = TLI.isOperationLegalOrCustom(ISD::DBG_LABEL, MVT::Other); const DbgStopPointSDNode *DSP = cast(Node); - GlobalVariable *CU_GV = cast(DSP->getCompileUnit()); - if (DW && (useDEBUG_LOC || useLABEL) && !CU_GV->isDeclaration()) { - DICompileUnit CU(cast(DSP->getCompileUnit())); + MDNode *CU_Node = DSP->getCompileUnit(); + if (DW && (useDEBUG_LOC || useLABEL)) { + DICompileUnit CU(CU_Node); unsigned Line = DSP->getLine(); unsigned Col = DSP->getColumn(); @@ -1607,7 +1610,7 @@ SDValue SelectionDAGLegalize::ExpandDBG_STOPPOINT(SDNode* Node) { return DAG.getNode(ISD::DEBUG_LOC, dl, MVT::Other, Node->getOperand(0), DAG.getConstant(Line, MVT::i32), DAG.getConstant(Col, MVT::i32), - DAG.getSrcValue(CU.getGV())); + DAG.getSrcValue(CU.getNode())); } else { unsigned ID = DW->RecordSourceLine(Line, Col, CU); return DAG.getLabel(ISD::DBG_LABEL, dl, Node->getOperand(0), ID); diff --git a/libclamav/c++/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/libclamav/c++/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index ded913ba6..11f12c947 100644 --- a/libclamav/c++/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/libclamav/c++/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -1286,7 +1286,7 @@ SDValue SelectionDAG::getRegister(unsigned RegNo, EVT VT) { SDValue SelectionDAG::getDbgStopPoint(DebugLoc DL, SDValue Root, unsigned Line, unsigned Col, - Value *CU) { + MDNode *CU) { SDNode *N = NodeAllocator.Allocate(); new (N) DbgStopPointSDNode(Root, Line, Col, CU); N->setDebugLoc(DL); @@ -5014,8 +5014,20 @@ void SDNode::Profile(FoldingSetNodeID &ID) const { AddNodeIDNode(ID, this); } +namespace { + struct EVTArray { + std::vector VTs; + + EVTArray() { + VTs.reserve(MVT::LAST_VALUETYPE); + for (unsigned i = 0; i < MVT::LAST_VALUETYPE; ++i) + VTs.push_back(MVT((MVT::SimpleValueType)i)); + } + }; +} + static ManagedStatic > EVTs; -static EVT VTs[MVT::LAST_VALUETYPE]; +static ManagedStatic SimpleVTArray; static ManagedStatic > VTMutex; /// getValueTypeList - Return a pointer to the specified value type. @@ -5025,12 +5037,7 @@ const EVT *SDNode::getValueTypeList(EVT VT) { sys::SmartScopedLock Lock(*VTMutex); return &(*EVTs->insert(VT).first); } else { - // All writes to this location will have the same value, so it's ok - // to race on it. We only need to ensure that at least one write has - // succeeded before we return the pointer into the array. - VTs[VT.getSimpleVT().SimpleTy] = VT; - sys::MemoryFence(); - return VTs + VT.getSimpleVT().SimpleTy; + return &SimpleVTArray->VTs[VT.getSimpleVT().SimpleTy]; } } diff --git a/libclamav/c++/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp b/libclamav/c++/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp index a4cd009bd..0a161d0dc 100644 --- a/libclamav/c++/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp +++ b/libclamav/c++/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp @@ -3876,7 +3876,7 @@ SelectionDAGLowering::visitIntrinsicCall(CallInst &I, unsigned Intrinsic) { if (isValidDebugInfoIntrinsic(RSI, OptLevel) && DW && DW->ShouldEmitDwarfDebug()) { unsigned LabelID = - DW->RecordRegionStart(cast(RSI.getContext())); + DW->RecordRegionStart(RSI.getContext()); DAG.setRoot(DAG.getLabel(ISD::DBG_LABEL, getCurDebugLoc(), getRoot(), LabelID)); } @@ -3891,7 +3891,7 @@ SelectionDAGLowering::visitIntrinsicCall(CallInst &I, unsigned Intrinsic) { return 0; MachineFunction &MF = DAG.getMachineFunction(); - DISubprogram Subprogram(cast(REI.getContext())); + DISubprogram Subprogram(REI.getContext()); if (isInlinedFnEnd(REI, MF.getFunction())) { // This is end of inlined function. Debugging information for inlined @@ -3910,7 +3910,7 @@ SelectionDAGLowering::visitIntrinsicCall(CallInst &I, unsigned Intrinsic) { } unsigned LabelID = - DW->RecordRegionEnd(cast(REI.getContext())); + DW->RecordRegionEnd(REI.getContext()); DAG.setRoot(DAG.getLabel(ISD::DBG_LABEL, getCurDebugLoc(), getRoot(), LabelID)); return 0; @@ -3942,7 +3942,7 @@ SelectionDAGLowering::visitIntrinsicCall(CallInst &I, unsigned Intrinsic) { if (!DW || !DW->ShouldEmitDwarfDebug()) return 0; DebugLocTuple PrevLocTpl = MF.getDebugLocTuple(PrevLoc); - DISubprogram SP(cast(FSI.getSubprogram())); + DISubprogram SP(FSI.getSubprogram()); DICompileUnit CU(PrevLocTpl.CompileUnit); unsigned LabelID = DW->RecordInlinedFnStart(SP, CU, PrevLocTpl.Line, @@ -3958,7 +3958,7 @@ SelectionDAGLowering::visitIntrinsicCall(CallInst &I, unsigned Intrinsic) { if (!DW || !DW->ShouldEmitDwarfDebug()) return 0; // llvm.dbg.func_start also defines beginning of function scope. - DW->RecordRegionStart(cast(FSI.getSubprogram())); + DW->RecordRegionStart(FSI.getSubprogram()); return 0; } case Intrinsic::dbg_declare: { @@ -3981,7 +3981,7 @@ SelectionDAGLowering::visitIntrinsicCall(CallInst &I, unsigned Intrinsic) { if (!AI) return 0; int FI = FuncInfo.StaticAllocaMap[AI]; - DW->RecordVariable(cast(Variable), FI); + DW->RecordVariable(cast(Variable), FI); return 0; } case Intrinsic::eh_exception: { diff --git a/libclamav/c++/llvm/lib/CodeGen/SjLjEHPrepare.cpp b/libclamav/c++/llvm/lib/CodeGen/SjLjEHPrepare.cpp index 61f13abcd..38996ff6c 100644 --- a/libclamav/c++/llvm/lib/CodeGen/SjLjEHPrepare.cpp +++ b/libclamav/c++/llvm/lib/CodeGen/SjLjEHPrepare.cpp @@ -24,7 +24,6 @@ #include "llvm/CodeGen/Passes.h" #include "llvm/Transforms/Utils/BasicBlockUtils.h" #include "llvm/Transforms/Utils/Local.h" -#include "llvm/ADT/DenseMap.h" #include "llvm/ADT/Statistic.h" #include "llvm/ADT/SmallVector.h" #include "llvm/Support/CommandLine.h" @@ -70,7 +69,8 @@ namespace { private: void markInvokeCallSite(InvokeInst *II, unsigned InvokeNo, - Value *CallSite); + Value *CallSite, + SwitchInst *CatchSwitch); void splitLiveRangesLiveAcrossInvokes(SmallVector &Invokes); bool insertSjLjEHSupport(Function &F); }; @@ -126,9 +126,14 @@ bool SjLjEHPass::doInitialization(Module &M) { /// markInvokeCallSite - Insert code to mark the call_site for this invoke void SjLjEHPass::markInvokeCallSite(InvokeInst *II, unsigned InvokeNo, - Value *CallSite) { + Value *CallSite, + SwitchInst *CatchSwitch) { ConstantInt *CallSiteNoC= ConstantInt::get(Type::getInt32Ty(II->getContext()), InvokeNo); + // The runtime comes back to the dispatcher with the call_site - 1 in + // the context. Odd, but there it is. + ConstantInt *SwitchValC = ConstantInt::get(Type::getInt32Ty(II->getContext()), + InvokeNo - 1); // If the unwind edge has phi nodes, split the edge. if (isa(II->getUnwindDest()->begin())) { @@ -145,6 +150,8 @@ void SjLjEHPass::markInvokeCallSite(InvokeInst *II, unsigned InvokeNo, // location afterward. new StoreInst(CallSiteNoC, CallSite, true, II); // volatile + // Add a switch case to our unwind block. + CatchSwitch->addCase(SwitchValC, II->getUnwindDest()); // We still want this to look like an invoke so we emit the LSDA properly // FIXME: ??? Or will this cause strangeness with mis-matched IDs like // when it was in the front end? @@ -311,6 +318,13 @@ bool SjLjEHPass::insertSjLjEHSupport(Function &F) { if (!Invokes.empty()) { // We have invokes, so we need to add register/unregister calls to get // this function onto the global unwind stack. + // + // First thing we need to do is scan the whole function for values that are + // live across unwind edges. Each value that is live across an unwind edge + // we spill into a stack location, guaranteeing that there is nothing live + // across the unwind edge. This process also splits all critical edges + // coming out of invoke's. + splitLiveRangesLiveAcrossInvokes(Invokes); BasicBlock *EntryBB = F.begin(); // Create an alloca for the incoming jump buffer ptr and the new jump buffer @@ -462,32 +476,11 @@ bool SjLjEHPass::insertSjLjEHSupport(Function &F) { ContBlock->getTerminator()); Register->setDoesNotThrow(); - // At this point, we are all set up. Update the invoke instructions + // At this point, we are all set up, update the invoke instructions // to mark their call_site values, and fill in the dispatch switch // accordingly. - DenseMap PadSites; - unsigned NextCallSiteValue = 1; - for (SmallVector::iterator I = Invokes.begin(), - E = Invokes.end(); I < E; ++I) { - unsigned CallSiteValue; - BasicBlock *LandingPad = (*I)->getSuccessor(1); - // landing pads can be shared. If we see a landing pad again, we - // want to make sure to use the same call site index so the dispatch - // will go to the right place. - CallSiteValue = PadSites[LandingPad]; - if (!CallSiteValue) { - CallSiteValue = NextCallSiteValue++; - PadSites[LandingPad] = CallSiteValue; - // Add a switch case to our unwind block. The runtime comes back - // to the dispatcher with the call_site - 1 in the context. Odd, - // but there it is. - ConstantInt *SwitchValC = - ConstantInt::get(Type::getInt32Ty((*I)->getContext()), - CallSiteValue - 1); - DispatchSwitch->addCase(SwitchValC, (*I)->getUnwindDest()); - } - markInvokeCallSite(*I, CallSiteValue, CallSite); - } + for (unsigned i = 0, e = Invokes.size(); i != e; ++i) + markInvokeCallSite(Invokes[i], i+1, CallSite, DispatchSwitch); // The front end has likely added calls to _Unwind_Resume. We need // to find those calls and mark the call_site as -1 immediately prior. @@ -515,13 +508,6 @@ bool SjLjEHPass::insertSjLjEHSupport(Function &F) { Unwinds[i]->eraseFromParent(); } - // Scan the whole function for values that are live across unwind edges. - // Each value that is live across an unwind edge we spill into a stack - // location, guaranteeing that there is nothing live across the unwind - // edge. This process also splits all critical edges coming out of - // invoke's. - splitLiveRangesLiveAcrossInvokes(Invokes); - // Finally, for any returns from this function, if this function contains an // invoke, add a call to unregister the function context. for (unsigned i = 0, e = Returns.size(); i != e; ++i) diff --git a/libclamav/c++/llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp b/libclamav/c++/llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp index 5ed614548..e1799600e 100644 --- a/libclamav/c++/llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp +++ b/libclamav/c++/llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp @@ -505,7 +505,7 @@ namespace { public: JITEmitter(JIT &jit, JITMemoryManager *JMM) - : SizeEstimate(0), Resolver(jit), CurFn(0) { + : SizeEstimate(0), Resolver(jit), MMI(0), CurFn(0) { MemMgr = JMM ? JMM : JITMemoryManager::CreateDefaultMemManager(); if (jit.getJITInfo().needsGOT()) { MemMgr->AllocateGOT(); diff --git a/libclamav/c++/llvm/lib/ExecutionEngine/JIT/JITMemoryManager.cpp b/libclamav/c++/llvm/lib/ExecutionEngine/JIT/JITMemoryManager.cpp index e750768d2..474843f06 100644 --- a/libclamav/c++/llvm/lib/ExecutionEngine/JIT/JITMemoryManager.cpp +++ b/libclamav/c++/llvm/lib/ExecutionEngine/JIT/JITMemoryManager.cpp @@ -556,17 +556,17 @@ void JITSlabAllocator::Deallocate(MemSlab *Slab) { } DefaultJITMemoryManager::DefaultJITMemoryManager() - : LastSlab(0, 0), + : +#ifdef NDEBUG + PoisonMemory(false), +#else + PoisonMemory(true), +#endif + LastSlab(0, 0), BumpSlabAllocator(*this), StubAllocator(DefaultSlabSize, DefaultSizeThreshold, BumpSlabAllocator), DataAllocator(DefaultSlabSize, DefaultSizeThreshold, BumpSlabAllocator) { -#ifdef NDEBUG - PoisonMemory = false; -#else - PoisonMemory = true; -#endif - // Allocate space for code. sys::MemoryBlock MemBlock = allocateNewSlab(DefaultCodeSlabSize); CodeSlabs.push_back(MemBlock); diff --git a/libclamav/c++/llvm/lib/ExecutionEngine/JIT/OProfileJITEventListener.cpp b/libclamav/c++/llvm/lib/ExecutionEngine/JIT/OProfileJITEventListener.cpp index beea80c88..740dcfc62 100644 --- a/libclamav/c++/llvm/lib/ExecutionEngine/JIT/OProfileJITEventListener.cpp +++ b/libclamav/c++/llvm/lib/ExecutionEngine/JIT/OProfileJITEventListener.cpp @@ -71,12 +71,12 @@ OProfileJITEventListener::~OProfileJITEventListener() { class FilenameCache { // Holds the filename of each CompileUnit, so that we can pass the // pointer into oprofile. These char*s are freed in the destructor. - DenseMap Filenames; + DenseMap Filenames; // Used as the scratch space in DICompileUnit::getFilename(). std::string TempFilename; public: - const char* getFilename(GlobalVariable *CompileUnit) { + const char* getFilename(MDNode *CompileUnit) { char *&Filename = Filenames[CompileUnit]; if (Filename == NULL) { DICompileUnit CU(CompileUnit); @@ -85,7 +85,7 @@ class FilenameCache { return Filename; } ~FilenameCache() { - for (DenseMap::iterator + for (DenseMap::iterator I = Filenames.begin(), E = Filenames.end(); I != E;++I) { free(I->second); } diff --git a/libclamav/c++/llvm/lib/MC/CMakeLists.txt b/libclamav/c++/llvm/lib/MC/CMakeLists.txt index 8075392c3..4fc999379 100644 --- a/libclamav/c++/llvm/lib/MC/CMakeLists.txt +++ b/libclamav/c++/llvm/lib/MC/CMakeLists.txt @@ -6,7 +6,10 @@ add_llvm_library(LLVMMC MCAsmParser.cpp MCAsmStreamer.cpp MCAssembler.cpp + MCCodeEmitter.cpp MCContext.cpp + MCExpr.cpp + MCInst.cpp MCMachOStreamer.cpp MCNullStreamer.cpp MCSection.cpp diff --git a/libclamav/c++/llvm/lib/MC/MCAsmInfo.cpp b/libclamav/c++/llvm/lib/MC/MCAsmInfo.cpp index 0653b19a5..65625608f 100644 --- a/libclamav/c++/llvm/lib/MC/MCAsmInfo.cpp +++ b/libclamav/c++/llvm/lib/MC/MCAsmInfo.cpp @@ -13,6 +13,7 @@ //===----------------------------------------------------------------------===// #include "llvm/MC/MCAsmInfo.h" +#include "llvm/Support/DataTypes.h" #include #include using namespace llvm; diff --git a/libclamav/c++/llvm/lib/MC/MCAsmStreamer.cpp b/libclamav/c++/llvm/lib/MC/MCAsmStreamer.cpp index 76d6ee687..d97602830 100644 --- a/libclamav/c++/llvm/lib/MC/MCAsmStreamer.cpp +++ b/libclamav/c++/llvm/lib/MC/MCAsmStreamer.cpp @@ -8,15 +8,18 @@ //===----------------------------------------------------------------------===// #include "llvm/MC/MCStreamer.h" +#include "llvm/ADT/SmallString.h" #include "llvm/CodeGen/AsmPrinter.h" +#include "llvm/MC/MCAsmInfo.h" +#include "llvm/MC/MCCodeEmitter.h" #include "llvm/MC/MCContext.h" +#include "llvm/MC/MCExpr.h" #include "llvm/MC/MCInst.h" #include "llvm/MC/MCSectionMachO.h" #include "llvm/MC/MCSymbol.h" -#include "llvm/MC/MCValue.h" -#include "llvm/MC/MCAsmInfo.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/MathExtras.h" +#include "llvm/Support/Format.h" #include "llvm/Support/raw_ostream.h" using namespace llvm; @@ -26,10 +29,12 @@ class MCAsmStreamer : public MCStreamer { raw_ostream &OS; const MCAsmInfo &MAI; AsmPrinter *Printer; + MCCodeEmitter *Emitter; public: MCAsmStreamer(MCContext &Context, raw_ostream &_OS, const MCAsmInfo &tai, - AsmPrinter *_AsmPrinter) - : MCStreamer(Context), OS(_OS), MAI(tai), Printer(_AsmPrinter) {} + AsmPrinter *_Printer, MCCodeEmitter *_Emitter) + : MCStreamer(Context), OS(_OS), MAI(tai), Printer(_Printer), + Emitter(_Emitter) {} ~MCAsmStreamer() {} /// @name MCStreamer Interface @@ -41,30 +46,27 @@ public: virtual void EmitAssemblerFlag(AssemblerFlag Flag); - virtual void EmitAssignment(MCSymbol *Symbol, const MCValue &Value, - bool MakeAbsolute = false); + virtual void EmitAssignment(MCSymbol *Symbol, const MCExpr *Value); virtual void EmitSymbolAttribute(MCSymbol *Symbol, SymbolAttr Attribute); virtual void EmitSymbolDesc(MCSymbol *Symbol, unsigned DescValue); - virtual void EmitLocalSymbol(MCSymbol *Symbol, const MCValue &Value); - virtual void EmitCommonSymbol(MCSymbol *Symbol, unsigned Size, - unsigned Pow2Alignment, bool IsLocal); + unsigned ByteAlignment); - virtual void EmitZerofill(MCSection *Section, MCSymbol *Symbol = NULL, - unsigned Size = 0, unsigned Pow2Alignment = 0); + virtual void EmitZerofill(const MCSection *Section, MCSymbol *Symbol = 0, + unsigned Size = 0, unsigned ByteAlignment = 0); virtual void EmitBytes(const StringRef &Data); - virtual void EmitValue(const MCValue &Value, unsigned Size); + virtual void EmitValue(const MCExpr *Value, unsigned Size); virtual void EmitValueToAlignment(unsigned ByteAlignment, int64_t Value = 0, unsigned ValueSize = 1, unsigned MaxBytesToEmit = 0); - virtual void EmitValueToOffset(const MCValue &Offset, + virtual void EmitValueToOffset(const MCExpr *Offset, unsigned char Value = 0); virtual void EmitInstruction(const MCInst &Inst); @@ -83,7 +85,7 @@ static inline raw_ostream &operator<<(raw_ostream &os, const MCSymbol *S) { } /// Allow printing values directly to a raw_ostream. -static inline raw_ostream &operator<<(raw_ostream &os, const MCValue &Value) { +static inline raw_ostream &operator<<(raw_ostream &os, const MCExpr &Value) { Value.print(os); return os; } @@ -93,9 +95,10 @@ static inline int64_t truncateToSize(int64_t Value, unsigned Bytes) { return Value & ((uint64_t) (int64_t) -1 >> (64 - Bytes * 8)); } -static inline MCValue truncateToSize(const MCValue &Value, unsigned Bytes) { - return MCValue::get(Value.getSymA(), Value.getSymB(), - truncateToSize(Value.getConstant(), Bytes)); +static inline const MCExpr *truncateToSize(const MCExpr *Value, + unsigned Bytes) { + // FIXME: Do we really need this routine? + return Value; } void MCAsmStreamer::SwitchSection(const MCSection *Section) { @@ -122,26 +125,12 @@ void MCAsmStreamer::EmitAssemblerFlag(AssemblerFlag Flag) { OS << '\n'; } -void MCAsmStreamer::EmitAssignment(MCSymbol *Symbol, const MCValue &Value, - bool MakeAbsolute) { +void MCAsmStreamer::EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) { // Only absolute symbols can be redefined. assert((Symbol->isUndefined() || Symbol->isAbsolute()) && "Cannot define a symbol twice!"); - if (MakeAbsolute) { - OS << ".set " << Symbol << ", " << Value << '\n'; - - // HACK: If the value isn't already absolute, set the symbol value to - // itself, we want to use the .set absolute value, not the actual - // expression. - if (!Value.isAbsolute()) - getContext().SetSymbolValue(Symbol, MCValue::get(Symbol)); - else - getContext().SetSymbolValue(Symbol, Value); - } else { - OS << Symbol << " = " << Value << '\n'; - getContext().SetSymbolValue(Symbol, Value); - } + OS << Symbol << " = " << *Value << '\n'; } void MCAsmStreamer::EmitSymbolAttribute(MCSymbol *Symbol, @@ -168,24 +157,17 @@ void MCAsmStreamer::EmitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) { OS << ".desc" << ' ' << Symbol << ',' << DescValue << '\n'; } -void MCAsmStreamer::EmitLocalSymbol(MCSymbol *Symbol, const MCValue &Value) { - OS << ".lsym" << ' ' << Symbol << ',' << Value << '\n'; -} - void MCAsmStreamer::EmitCommonSymbol(MCSymbol *Symbol, unsigned Size, - unsigned Pow2Alignment, bool IsLocal) { - if (IsLocal) - OS << ".lcomm"; - else - OS << ".comm"; + unsigned ByteAlignment) { + OS << ".comm"; OS << ' ' << Symbol << ',' << Size; - if (Pow2Alignment != 0) - OS << ',' << Pow2Alignment; + if (ByteAlignment != 0) + OS << ',' << Log2_32(ByteAlignment); OS << '\n'; } -void MCAsmStreamer::EmitZerofill(MCSection *Section, MCSymbol *Symbol, - unsigned Size, unsigned Pow2Alignment) { +void MCAsmStreamer::EmitZerofill(const MCSection *Section, MCSymbol *Symbol, + unsigned Size, unsigned ByteAlignment) { // Note: a .zerofill directive does not switch sections. OS << ".zerofill "; @@ -195,8 +177,8 @@ void MCAsmStreamer::EmitZerofill(MCSection *Section, MCSymbol *Symbol, if (Symbol != NULL) { OS << ',' << Symbol << ',' << Size; - if (Pow2Alignment != 0) - OS << ',' << Pow2Alignment; + if (ByteAlignment != 0) + OS << ',' << Log2_32(ByteAlignment); } OS << '\n'; } @@ -207,7 +189,7 @@ void MCAsmStreamer::EmitBytes(const StringRef &Data) { OS << ".byte " << (unsigned) (unsigned char) Data[i] << '\n'; } -void MCAsmStreamer::EmitValue(const MCValue &Value, unsigned Size) { +void MCAsmStreamer::EmitValue(const MCExpr *Value, unsigned Size) { assert(CurSection && "Cannot emit contents before setting section!"); // Need target hooks to know how to print this. switch (Size) { @@ -219,7 +201,7 @@ void MCAsmStreamer::EmitValue(const MCValue &Value, unsigned Size) { case 8: OS << ".quad"; break; } - OS << ' ' << truncateToSize(Value, Size) << '\n'; + OS << ' ' << *truncateToSize(Value, Size) << '\n'; } void MCAsmStreamer::EmitValueToAlignment(unsigned ByteAlignment, int64_t Value, @@ -269,22 +251,10 @@ void MCAsmStreamer::EmitValueToAlignment(unsigned ByteAlignment, int64_t Value, OS << '\n'; } -void MCAsmStreamer::EmitValueToOffset(const MCValue &Offset, +void MCAsmStreamer::EmitValueToOffset(const MCExpr *Offset, unsigned char Value) { // FIXME: Verify that Offset is associated with the current section. - OS << ".org " << Offset << ", " << (unsigned) Value << '\n'; -} - -static raw_ostream &operator<<(raw_ostream &OS, const MCOperand &Op) { - if (Op.isReg()) - return OS << "reg:" << Op.getReg(); - if (Op.isImm()) - return OS << "imm:" << Op.getImm(); - if (Op.isMBBLabel()) - return OS << "mbblabel:(" - << Op.getMBBLabelFunction() << ", " << Op.getMBBLabelBlock(); - assert(Op.isMCValue() && "Invalid operand!"); - return OS << "val:" << Op.getMCValue(); + OS << ".org " << *Offset << ", " << (unsigned) Value << '\n'; } void MCAsmStreamer::EmitInstruction(const MCInst &Inst) { @@ -293,20 +263,31 @@ void MCAsmStreamer::EmitInstruction(const MCInst &Inst) { // If we have an AsmPrinter, use that to print. if (Printer) { Printer->printMCInst(&Inst); + + // Show the encoding if we have a code emitter. + if (Emitter) { + SmallString<256> Code; + raw_svector_ostream VecOS(Code); + Emitter->EncodeInstruction(Inst, VecOS); + VecOS.flush(); + + OS.indent(20); + OS << " # encoding: ["; + for (unsigned i = 0, e = Code.size(); i != e; ++i) { + if (i) + OS << ','; + OS << format("%#04x", uint8_t(Code[i])); + } + OS << "]\n"; + } + return; } // Otherwise fall back to a structural printing for now. Eventually we should // always have access to the target specific printer. - OS << "MCInst(" - << "opcode=" << Inst.getOpcode() << ", " - << "operands=["; - for (unsigned i = 0, e = Inst.getNumOperands(); i != e; ++i) { - if (i) - OS << ", "; - OS << Inst.getOperand(i); - } - OS << "])\n"; + Inst.print(OS); + OS << '\n'; } void MCAsmStreamer::Finish() { @@ -314,6 +295,7 @@ void MCAsmStreamer::Finish() { } MCStreamer *llvm::createAsmStreamer(MCContext &Context, raw_ostream &OS, - const MCAsmInfo &MAI, AsmPrinter *AP) { - return new MCAsmStreamer(Context, OS, MAI, AP); + const MCAsmInfo &MAI, AsmPrinter *AP, + MCCodeEmitter *CE) { + return new MCAsmStreamer(Context, OS, MAI, AP, CE); } diff --git a/libclamav/c++/llvm/lib/MC/MCAssembler.cpp b/libclamav/c++/llvm/lib/MC/MCAssembler.cpp index 931542250..21246ccb3 100644 --- a/libclamav/c++/llvm/lib/MC/MCAssembler.cpp +++ b/libclamav/c++/llvm/lib/MC/MCAssembler.cpp @@ -7,11 +7,13 @@ // //===----------------------------------------------------------------------===// +#define DEBUG_TYPE "assembler" #include "llvm/MC/MCAssembler.h" #include "llvm/MC/MCSectionMachO.h" #include "llvm/Target/TargetMachOWriterInfo.h" #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/SmallString.h" +#include "llvm/ADT/Statistic.h" #include "llvm/ADT/StringMap.h" #include "llvm/ADT/Twine.h" #include "llvm/Support/ErrorHandling.h" @@ -21,9 +23,25 @@ using namespace llvm; class MachObjectWriter; +STATISTIC(EmittedFragments, "Number of emitted assembler fragments"); + +// FIXME FIXME FIXME: There are number of places in this file where we convert +// what is a 64-bit assembler value used for computation into a value in the +// object file, which may truncate it. We should detect that truncation where +// invalid and report errors back. + static void WriteFileData(raw_ostream &OS, const MCSectionData &SD, MachObjectWriter &MOW); +/// isVirtualSection - Check if this is a section which does not actually exist +/// in the object file. +static bool isVirtualSection(const MCSection &Section) { + // FIXME: Lame. + const MCSectionMachO &SMO = static_cast(Section); + unsigned Type = SMO.getTypeAndAttributes() & MCSectionMachO::SECTION_TYPE; + return (Type == MCSectionMachO::S_ZEROFILL); +} + class MachObjectWriter { // See . enum { @@ -38,11 +56,16 @@ class MachObjectWriter { static const unsigned SymtabLoadCommandSize = 24; static const unsigned DysymtabLoadCommandSize = 80; static const unsigned Nlist32Size = 12; + static const unsigned RelocationInfoSize = 8; enum HeaderFileType { HFT_Object = 0x1 }; + enum HeaderFlags { + HF_SubsectionsViaSymbols = 0x2000 + }; + enum LoadCommandType { LCT_Segment = 0x1, LCT_Symtab = 0x2, @@ -66,6 +89,26 @@ class MachObjectWriter { STF_PrivateExtern = 0x10 }; + /// IndirectSymbolFlags - Flags for encoding special values in the indirect + /// symbol entry. + enum IndirectSymbolFlags { + ISF_Local = 0x80000000, + ISF_Absolute = 0x40000000 + }; + + /// RelocationFlags - Special flags for addresses. + enum RelocationFlags { + RF_Scattered = 0x80000000 + }; + + enum RelocationInfoType { + RIT_Vanilla = 0, + RIT_Pair = 1, + RIT_Difference = 2, + RIT_PreboundLazyPointer = 3, + RIT_LocalDifference = 4 + }; + /// MachSymbolData - Helper struct for containing some precomputed information /// on symbols. struct MachSymbolData { @@ -142,7 +185,13 @@ public: /// @} - void WriteHeader32(unsigned NumLoadCommands, unsigned LoadCommandsSize) { + void WriteHeader32(unsigned NumLoadCommands, unsigned LoadCommandsSize, + bool SubsectionsViaSymbols) { + uint32_t Flags = 0; + + if (SubsectionsViaSymbols) + Flags |= HF_SubsectionsViaSymbols; + // struct mach_header (28 bytes) uint64_t Start = OS.tell(); @@ -152,16 +201,13 @@ public: // FIXME: Support cputype. Write32(TargetMachOWriterInfo::HDR_CPU_TYPE_I386); - // FIXME: Support cpusubtype. Write32(TargetMachOWriterInfo::HDR_CPU_SUBTYPE_I386_ALL); - Write32(HFT_Object); - - // Object files have a single load command, the segment. - Write32(NumLoadCommands); + Write32(NumLoadCommands); // Object files have a single load command, the + // segment. Write32(LoadCommandsSize); - Write32(0); // Flags + Write32(Flags); assert(OS.tell() - Start == Header32Size); } @@ -171,6 +217,7 @@ public: /// \arg NumSections - The number of sections in this segment. /// \arg SectionDataSize - The total size of the sections. void WriteSegmentLoadCommand32(unsigned NumSections, + uint64_t VMSize, uint64_t SectionDataStartOffset, uint64_t SectionDataSize) { // struct segment_command (56 bytes) @@ -183,7 +230,7 @@ public: WriteString("", 16); Write32(0); // vmaddr - Write32(SectionDataSize); // vmsize + Write32(VMSize); // vmsize Write32(SectionDataStartOffset); // file offset Write32(SectionDataSize); // file size Write32(0x7); // maxprot @@ -194,7 +241,14 @@ public: assert(OS.tell() - Start == SegmentLoadCommand32Size); } - void WriteSection32(const MCSectionData &SD, uint64_t FileOffset) { + void WriteSection32(const MCSectionData &SD, uint64_t FileOffset, + uint64_t RelocationsStart, unsigned NumRelocations) { + // The offset is unused for virtual sections. + if (isVirtualSection(SD.getSection())) { + assert(SD.getFileSize() == 0 && "Invalid file size!"); + FileOffset = 0; + } + // struct section (68 bytes) uint64_t Start = OS.tell(); @@ -205,14 +259,14 @@ public: static_cast(SD.getSection()); WriteString(Section.getSectionName(), 16); WriteString(Section.getSegmentName(), 16); - Write32(0); // address - Write32(SD.getFileSize()); // size + Write32(SD.getAddress()); // address + Write32(SD.getSize()); // size Write32(FileOffset); assert(isPowerOf2_32(SD.getAlignment()) && "Invalid alignment!"); Write32(Log2_32(SD.getAlignment())); - Write32(0); // file offset of relocation entries - Write32(0); // number of relocation entrions + Write32(NumRelocations ? RelocationsStart : 0); + Write32(NumRelocations); Write32(Section.getTypeAndAttributes()); Write32(0); // reserved1 Write32(Section.getStubSize()); // reserved2 @@ -276,8 +330,11 @@ public: } void WriteNlist32(MachSymbolData &MSD) { - MCSymbol &Symbol = MSD.SymbolData->getSymbol(); + MCSymbolData &Data = *MSD.SymbolData; + const MCSymbol &Symbol = Data.getSymbol(); uint8_t Type = 0; + uint16_t Flags = Data.getFlags(); + uint32_t Address = 0; // Set the N_TYPE bits. See . // @@ -291,13 +348,37 @@ public: // FIXME: Set STAB bits. - if (MSD.SymbolData->isPrivateExtern()) + if (Data.isPrivateExtern()) Type |= STF_PrivateExtern; // Set external bit. - if (MSD.SymbolData->isExternal() || Symbol.isUndefined()) + if (Data.isExternal() || Symbol.isUndefined()) Type |= STF_External; + // Compute the symbol address. + if (Symbol.isDefined()) { + if (Symbol.isAbsolute()) { + llvm_unreachable("FIXME: Not yet implemented!"); + } else { + Address = Data.getFragment()->getAddress() + Data.getOffset(); + } + } else if (Data.isCommon()) { + // Common symbols are encoded with the size in the address + // field, and their alignment in the flags. + Address = Data.getCommonSize(); + + // Common alignment is packed into the 'desc' bits. + if (unsigned Align = Data.getCommonAlignment()) { + unsigned Log2Size = Log2_32(Align); + assert((1U << Log2Size) == Align && "Invalid 'common' alignment!"); + if (Log2Size > 15) + llvm_report_error("invalid 'common' alignment '" + + Twine(Align) + "'"); + // FIXME: Keep this mask with the SymbolFlags enumeration. + Flags = (Flags & 0xF0FF) | (Log2Size << 8); + } + } + // struct nlist (12 bytes) Write32(MSD.StringIndex); @@ -306,9 +387,179 @@ public: // The Mach-O streamer uses the lowest 16-bits of the flags for the 'desc' // value. - Write16(MSD.SymbolData->getFlags() & 0xFFFF); + Write16(Flags); + Write32(Address); + } - Write32(0); // FIXME: Value + struct MachRelocationEntry { + uint32_t Word0; + uint32_t Word1; + }; + void ComputeScatteredRelocationInfo(MCAssembler &Asm, + MCSectionData::Fixup &Fixup, + DenseMap &SymbolMap, + std::vector &Relocs) { + uint32_t Address = Fixup.Fragment->getOffset() + Fixup.Offset; + unsigned IsPCRel = 0; + unsigned Type = RIT_Vanilla; + + // See . + + const MCSymbol *A = Fixup.Value.getSymA(); + MCSymbolData *SD = SymbolMap.lookup(A); + uint32_t Value = SD->getFragment()->getAddress() + SD->getOffset(); + uint32_t Value2 = 0; + + if (const MCSymbol *B = Fixup.Value.getSymB()) { + Type = RIT_LocalDifference; + + MCSymbolData *SD = SymbolMap.lookup(B); + Value2 = SD->getFragment()->getAddress() + SD->getOffset(); + } + + unsigned Log2Size = Log2_32(Fixup.Size); + assert((1U << Log2Size) == Fixup.Size && "Invalid fixup size!"); + + // The value which goes in the fixup is current value of the expression. + Fixup.FixedValue = Value - Value2 + Fixup.Value.getConstant(); + + MachRelocationEntry MRE; + MRE.Word0 = ((Address << 0) | + (Type << 24) | + (Log2Size << 28) | + (IsPCRel << 30) | + RF_Scattered); + MRE.Word1 = Value; + Relocs.push_back(MRE); + + if (Type == RIT_LocalDifference) { + Type = RIT_Pair; + + MachRelocationEntry MRE; + MRE.Word0 = ((0 << 0) | + (Type << 24) | + (Log2Size << 28) | + (0 << 30) | + RF_Scattered); + MRE.Word1 = Value2; + Relocs.push_back(MRE); + } + } + + void ComputeRelocationInfo(MCAssembler &Asm, + MCSectionData::Fixup &Fixup, + DenseMap &SymbolMap, + std::vector &Relocs) { + // If this is a local symbol plus an offset or a difference, then we need a + // scattered relocation entry. + if (Fixup.Value.getSymB()) // a - b + return ComputeScatteredRelocationInfo(Asm, Fixup, SymbolMap, Relocs); + if (Fixup.Value.getSymA() && Fixup.Value.getConstant()) + if (!Fixup.Value.getSymA()->isUndefined()) + return ComputeScatteredRelocationInfo(Asm, Fixup, SymbolMap, Relocs); + + // See . + uint32_t Address = Fixup.Fragment->getOffset() + Fixup.Offset; + uint32_t Value = 0; + unsigned Index = 0; + unsigned IsPCRel = 0; + unsigned IsExtern = 0; + unsigned Type = 0; + + if (Fixup.Value.isAbsolute()) { // constant + // SymbolNum of 0 indicates the absolute section. + Type = RIT_Vanilla; + Value = 0; + llvm_unreachable("FIXME: Not yet implemented!"); + } else { + const MCSymbol *Symbol = Fixup.Value.getSymA(); + MCSymbolData *SD = SymbolMap.lookup(Symbol); + + if (Symbol->isUndefined()) { + IsExtern = 1; + Index = SD->getIndex(); + Value = 0; + } else { + // The index is the section ordinal. + // + // FIXME: O(N) + Index = 1; + for (MCAssembler::iterator it = Asm.begin(), + ie = Asm.end(); it != ie; ++it, ++Index) + if (&*it == SD->getFragment()->getParent()) + break; + Value = SD->getFragment()->getAddress() + SD->getOffset(); + } + + Type = RIT_Vanilla; + } + + // The value which goes in the fixup is current value of the expression. + Fixup.FixedValue = Value + Fixup.Value.getConstant(); + + unsigned Log2Size = Log2_32(Fixup.Size); + assert((1U << Log2Size) == Fixup.Size && "Invalid fixup size!"); + + // struct relocation_info (8 bytes) + MachRelocationEntry MRE; + MRE.Word0 = Address; + MRE.Word1 = ((Index << 0) | + (IsPCRel << 24) | + (Log2Size << 25) | + (IsExtern << 27) | + (Type << 28)); + Relocs.push_back(MRE); + } + + void BindIndirectSymbols(MCAssembler &Asm, + DenseMap &SymbolMap) { + // This is the point where 'as' creates actual symbols for indirect symbols + // (in the following two passes). It would be easier for us to do this + // sooner when we see the attribute, but that makes getting the order in the + // symbol table much more complicated than it is worth. + // + // FIXME: Revisit this when the dust settles. + + // Bind non lazy symbol pointers first. + for (MCAssembler::indirect_symbol_iterator it = Asm.indirect_symbol_begin(), + ie = Asm.indirect_symbol_end(); it != ie; ++it) { + // FIXME: cast<> support! + const MCSectionMachO &Section = + static_cast(it->SectionData->getSection()); + + unsigned Type = + Section.getTypeAndAttributes() & MCSectionMachO::SECTION_TYPE; + if (Type != MCSectionMachO::S_NON_LAZY_SYMBOL_POINTERS) + continue; + + MCSymbolData *&Entry = SymbolMap[it->Symbol]; + if (!Entry) + Entry = new MCSymbolData(*it->Symbol, 0, 0, &Asm); + } + + // Then lazy symbol pointers and symbol stubs. + for (MCAssembler::indirect_symbol_iterator it = Asm.indirect_symbol_begin(), + ie = Asm.indirect_symbol_end(); it != ie; ++it) { + // FIXME: cast<> support! + const MCSectionMachO &Section = + static_cast(it->SectionData->getSection()); + + unsigned Type = + Section.getTypeAndAttributes() & MCSectionMachO::SECTION_TYPE; + if (Type != MCSectionMachO::S_LAZY_SYMBOL_POINTERS && + Type != MCSectionMachO::S_SYMBOL_STUBS) + continue; + + MCSymbolData *&Entry = SymbolMap[it->Symbol]; + if (!Entry) { + Entry = new MCSymbolData(*it->Symbol, 0, 0, &Asm); + + // Set the symbol type to undefined lazy, but only on construction. + // + // FIXME: Do not hardcode. + Entry->setFlags(Entry->getFlags() | 0x0001); + } + } } /// ComputeSymbolTable - Compute the symbol table data @@ -316,7 +567,6 @@ public: /// \param StringTable [out] - The string table data. /// \param StringIndexMap [out] - Map from symbol names to offsets in the /// string table. - void ComputeSymbolTable(MCAssembler &Asm, SmallString<256> &StringTable, std::vector &LocalSymbolData, std::vector &ExternalSymbolData, @@ -342,7 +592,11 @@ public: // files. for (MCAssembler::symbol_iterator it = Asm.symbol_begin(), ie = Asm.symbol_end(); it != ie; ++it) { - MCSymbol &Symbol = it->getSymbol(); + const MCSymbol &Symbol = it->getSymbol(); + + // Ignore assembler temporaries. + if (it->getSymbol().isTemporary()) + continue; if (!it->isExternal() && !Symbol.isUndefined()) continue; @@ -374,7 +628,11 @@ public: // Now add the data for local symbols. for (MCAssembler::symbol_iterator it = Asm.symbol_begin(), ie = Asm.symbol_end(); it != ie; ++it) { - MCSymbol &Symbol = it->getSymbol(); + const MCSymbol &Symbol = it->getSymbol(); + + // Ignore assembler temporaries. + if (it->getSymbol().isTemporary()) + continue; if (it->isExternal() || Symbol.isUndefined()) continue; @@ -404,6 +662,15 @@ public: std::sort(ExternalSymbolData.begin(), ExternalSymbolData.end()); std::sort(UndefinedSymbolData.begin(), UndefinedSymbolData.end()); + // Set the symbol indices. + Index = 0; + for (unsigned i = 0, e = LocalSymbolData.size(); i != e; ++i) + LocalSymbolData[i].SymbolData->setIndex(Index++); + for (unsigned i = 0, e = ExternalSymbolData.size(); i != e; ++i) + ExternalSymbolData[i].SymbolData->setIndex(Index++); + for (unsigned i = 0, e = UndefinedSymbolData.size(); i != e; ++i) + UndefinedSymbolData[i].SymbolData->setIndex(Index++); + // The string table is padded to a multiple of 4. // // FIXME: Check to see if this varies per arch. @@ -414,6 +681,17 @@ public: void WriteObject(MCAssembler &Asm) { unsigned NumSections = Asm.size(); + // Compute the symbol -> symbol data map. + // + // FIXME: This should not be here. + DenseMap SymbolMap; + for (MCAssembler::symbol_iterator it = Asm.symbol_begin(), + ie = Asm.symbol_end(); it != ie; ++it) + SymbolMap[&it->getSymbol()] = it; + + // Create symbol data for any indirect symbols. + BindIndirectSymbols(Asm, SymbolMap); + // Compute symbol table information. SmallString<256> StringTable; std::vector LocalSymbolData; @@ -425,11 +703,6 @@ public: if (NumSymbols) ComputeSymbolTable(Asm, StringTable, LocalSymbolData, ExternalSymbolData, UndefinedSymbolData); - - // Compute the file offsets for all the sections in advance, so that we can - // write things out in order. - SmallVector SectionFileOffsets; - SectionFileOffsets.resize(NumSections); // The section data starts after the header, the segment load command (and // section headers) and the symbol table. @@ -443,46 +716,92 @@ public: LoadCommandsSize += SymtabLoadCommandSize + DysymtabLoadCommandSize; } - uint64_t FileOffset = Header32Size + LoadCommandsSize; - uint64_t SectionDataStartOffset = FileOffset; + // Compute the total size of the section data, as well as its file size and + // vm size. + uint64_t SectionDataStart = Header32Size + LoadCommandsSize; uint64_t SectionDataSize = 0; - unsigned Index = 0; + uint64_t SectionDataFileSize = 0; + uint64_t VMSize = 0; for (MCAssembler::iterator it = Asm.begin(), - ie = Asm.end(); it != ie; ++it, ++Index) { - SectionFileOffsets[Index] = FileOffset; - FileOffset += it->getFileSize(); - SectionDataSize += it->getFileSize(); + ie = Asm.end(); it != ie; ++it) { + MCSectionData &SD = *it; + + VMSize = std::max(VMSize, SD.getAddress() + SD.getSize()); + + if (isVirtualSection(SD.getSection())) + continue; + + SectionDataSize = std::max(SectionDataSize, + SD.getAddress() + SD.getSize()); + SectionDataFileSize = std::max(SectionDataFileSize, + SD.getAddress() + SD.getFileSize()); } + // The section data is passed to 4 bytes. + // + // FIXME: Is this machine dependent? + unsigned SectionDataPadding = OffsetToAlignment(SectionDataFileSize, 4); + SectionDataFileSize += SectionDataPadding; + // Write the prolog, starting with the header and load command... - WriteHeader32(NumLoadCommands, LoadCommandsSize); - WriteSegmentLoadCommand32(NumSections, SectionDataStartOffset, - SectionDataSize); + WriteHeader32(NumLoadCommands, LoadCommandsSize, + Asm.getSubsectionsViaSymbols()); + WriteSegmentLoadCommand32(NumSections, VMSize, + SectionDataStart, SectionDataSize); // ... and then the section headers. - Index = 0; - for (MCAssembler::iterator it = Asm.begin(), - ie = Asm.end(); it != ie; ++it, ++Index) - WriteSection32(*it, SectionFileOffsets[Index]); + // + // We also compute the section relocations while we do this. Note that + // compute relocation info will also update the fixup to have the correct + // value; this will be overwrite the appropriate data in the fragment when + // it is written. + std::vector RelocInfos; + uint64_t RelocTableEnd = SectionDataStart + SectionDataFileSize; + for (MCAssembler::iterator it = Asm.begin(), ie = Asm.end(); it != ie; + ++it) { + MCSectionData &SD = *it; + // The assembler writes relocations in the reverse order they were seen. + // + // FIXME: It is probably more complicated than this. + unsigned NumRelocsStart = RelocInfos.size(); + for (unsigned i = 0, e = SD.fixup_size(); i != e; ++i) + ComputeRelocationInfo(Asm, SD.getFixups()[e - i - 1], SymbolMap, + RelocInfos); + + unsigned NumRelocs = RelocInfos.size() - NumRelocsStart; + uint64_t SectionStart = SectionDataStart + SD.getAddress(); + WriteSection32(SD, SectionStart, RelocTableEnd, NumRelocs); + RelocTableEnd += NumRelocs * RelocationInfoSize; + } + // Write the symbol table load command, if used. if (NumSymbols) { - // The string table is written after all the section data. - uint64_t SymbolTableOffset = SectionDataStartOffset + SectionDataSize; - uint64_t StringTableOffset = - SymbolTableOffset + NumSymbols * Nlist32Size; - WriteSymtabLoadCommand(SymbolTableOffset, NumSymbols, - StringTableOffset, StringTable.size()); - unsigned FirstLocalSymbol = 0; unsigned NumLocalSymbols = LocalSymbolData.size(); unsigned FirstExternalSymbol = FirstLocalSymbol + NumLocalSymbols; unsigned NumExternalSymbols = ExternalSymbolData.size(); unsigned FirstUndefinedSymbol = FirstExternalSymbol + NumExternalSymbols; unsigned NumUndefinedSymbols = UndefinedSymbolData.size(); - // FIXME: Get correct symbol indices and counts for indirect symbols. - unsigned IndirectSymbolOffset = 0; - unsigned NumIndirectSymbols = 0; + unsigned NumIndirectSymbols = Asm.indirect_symbol_size(); + unsigned NumSymTabSymbols = + NumLocalSymbols + NumExternalSymbols + NumUndefinedSymbols; + uint64_t IndirectSymbolSize = NumIndirectSymbols * 4; + uint64_t IndirectSymbolOffset = 0; + + // If used, the indirect symbols are written after the section data. + if (NumIndirectSymbols) + IndirectSymbolOffset = RelocTableEnd; + + // The symbol table is written after the indirect symbol data. + uint64_t SymbolTableOffset = RelocTableEnd + IndirectSymbolSize; + + // The string table is written after symbol table. + uint64_t StringTableOffset = + SymbolTableOffset + NumSymTabSymbols * Nlist32Size; + WriteSymtabLoadCommand(SymbolTableOffset, NumSymTabSymbols, + StringTableOffset, StringTable.size()); + WriteDysymtabLoadCommand(FirstLocalSymbol, NumLocalSymbols, FirstExternalSymbol, NumExternalSymbols, FirstUndefinedSymbol, NumUndefinedSymbols, @@ -493,11 +812,43 @@ public: for (MCAssembler::iterator it = Asm.begin(), ie = Asm.end(); it != ie; ++it) WriteFileData(OS, *it, *this); + // Write the extra padding. + WriteZeros(SectionDataPadding); + + // Write the relocation entries. + for (unsigned i = 0, e = RelocInfos.size(); i != e; ++i) { + Write32(RelocInfos[i].Word0); + Write32(RelocInfos[i].Word1); + } + // Write the symbol table data, if used. if (NumSymbols) { - // FIXME: Check that offsets match computed ones. + // Write the indirect symbol entries. + for (MCAssembler::indirect_symbol_iterator + it = Asm.indirect_symbol_begin(), + ie = Asm.indirect_symbol_end(); it != ie; ++it) { + // Indirect symbols in the non lazy symbol pointer section have some + // special handling. + const MCSectionMachO &Section = + static_cast(it->SectionData->getSection()); + unsigned Type = + Section.getTypeAndAttributes() & MCSectionMachO::SECTION_TYPE; + if (Type == MCSectionMachO::S_NON_LAZY_SYMBOL_POINTERS) { + // If this symbol is defined and internal, mark it as such. + if (it->Symbol->isDefined() && + !SymbolMap.lookup(it->Symbol)->isExternal()) { + uint32_t Flags = ISF_Local; + if (it->Symbol->isAbsolute()) + Flags |= ISF_Absolute; + Write32(Flags); + continue; + } + } - // FIXME: Some of these are ordered by name to help the linker. + Write32(SymbolMap[it->Symbol]->getIndex()); + } + + // FIXME: Check that offsets match computed ones. // Write the symbol table entries. for (unsigned i = 0, e = LocalSymbolData.size(); i != e; ++i) @@ -518,38 +869,70 @@ public: MCFragment::MCFragment() : Kind(FragmentType(~0)) { } -MCFragment::MCFragment(FragmentType _Kind, MCSectionData *SD) +MCFragment::MCFragment(FragmentType _Kind, MCSectionData *_Parent) : Kind(_Kind), + Parent(_Parent), FileSize(~UINT64_C(0)) { - if (SD) - SD->getFragmentList().push_back(this); + if (Parent) + Parent->getFragmentList().push_back(this); } MCFragment::~MCFragment() { } +uint64_t MCFragment::getAddress() const { + assert(getParent() && "Missing Section!"); + return getParent()->getAddress() + Offset; +} + /* *** */ -MCSectionData::MCSectionData() : Section(*(MCSection*)0) {} +MCSectionData::MCSectionData() : Section(0) {} MCSectionData::MCSectionData(const MCSection &_Section, MCAssembler *A) - : Section(_Section), + : Section(&_Section), Alignment(1), - FileSize(~UINT64_C(0)) + Address(~UINT64_C(0)), + Size(~UINT64_C(0)), + FileSize(~UINT64_C(0)), + LastFixupLookup(~0) { if (A) A->getSectionList().push_back(this); } +const MCSectionData::Fixup * +MCSectionData::LookupFixup(const MCFragment *Fragment, uint64_t Offset) const { + // Use a one level cache to turn the common case of accessing the fixups in + // order into O(1) instead of O(N). + unsigned i = LastFixupLookup, Count = Fixups.size(), End = Fixups.size(); + if (i >= End) + i = 0; + while (Count--) { + const Fixup &F = Fixups[i]; + if (F.Fragment == Fragment && F.Offset == Offset) { + LastFixupLookup = i; + return &F; + } + + ++i; + if (i == End) + i = 0; + } + + return 0; +} + /* *** */ -MCSymbolData::MCSymbolData() : Symbol(*(MCSymbol*)0) {} +MCSymbolData::MCSymbolData() : Symbol(*(const MCSymbol*)0) {} -MCSymbolData::MCSymbolData(MCSymbol &_Symbol, MCFragment *_Fragment, +MCSymbolData::MCSymbolData(const MCSymbol &_Symbol, MCFragment *_Fragment, uint64_t _Offset, MCAssembler *A) : Symbol(_Symbol), Fragment(_Fragment), Offset(_Offset), - IsExternal(false), IsPrivateExtern(false), Flags(0) + IsExternal(false), IsPrivateExtern(false), + CommonSize(0), CommonAlign(0), Flags(0), Index(0) { if (A) A->getSymbolList().push_back(this); @@ -557,61 +940,97 @@ MCSymbolData::MCSymbolData(MCSymbol &_Symbol, MCFragment *_Fragment, /* *** */ -MCAssembler::MCAssembler(raw_ostream &_OS) : OS(_OS) {} +MCAssembler::MCAssembler(MCContext &_Context, raw_ostream &_OS) + : Context(_Context), OS(_OS), SubsectionsViaSymbols(false) +{ +} MCAssembler::~MCAssembler() { } void MCAssembler::LayoutSection(MCSectionData &SD) { - uint64_t Offset = 0; + uint64_t Address = SD.getAddress(); for (MCSectionData::iterator it = SD.begin(), ie = SD.end(); it != ie; ++it) { MCFragment &F = *it; - F.setOffset(Offset); + F.setOffset(Address - SD.getAddress()); // Evaluate fragment size. switch (F.getKind()) { case MCFragment::FT_Align: { MCAlignFragment &AF = cast(F); - uint64_t AlignedOffset = RoundUpToAlignment(Offset, AF.getAlignment()); - uint64_t PaddingBytes = AlignedOffset - Offset; - - if (PaddingBytes > AF.getMaxBytesToEmit()) + uint64_t Size = OffsetToAlignment(Address, AF.getAlignment()); + if (Size > AF.getMaxBytesToEmit()) AF.setFileSize(0); else - AF.setFileSize(PaddingBytes); + AF.setFileSize(Size); break; } case MCFragment::FT_Data: - case MCFragment::FT_Fill: F.setFileSize(F.getMaxFileSize()); break; + case MCFragment::FT_Fill: { + MCFillFragment &FF = cast(F); + + F.setFileSize(F.getMaxFileSize()); + + // If the fill value is constant, thats it. + if (FF.getValue().isAbsolute()) + break; + + // Otherwise, add fixups for the values. + for (uint64_t i = 0, e = FF.getCount(); i != e; ++i) { + MCSectionData::Fixup Fix(F, i * FF.getValueSize(), + FF.getValue(),FF.getValueSize()); + SD.getFixups().push_back(Fix); + } + break; + } + case MCFragment::FT_Org: { MCOrgFragment &OF = cast(F); if (!OF.getOffset().isAbsolute()) llvm_unreachable("FIXME: Not yet implemented!"); uint64_t OrgOffset = OF.getOffset().getConstant(); + uint64_t Offset = Address - SD.getAddress(); // FIXME: We need a way to communicate this error. if (OrgOffset < Offset) llvm_report_error("invalid .org offset '" + Twine(OrgOffset) + - "' (section offset '" + Twine(Offset) + "'"); + "' (at offset '" + Twine(Offset) + "'"); F.setFileSize(OrgOffset - Offset); break; } + + case MCFragment::FT_ZeroFill: { + MCZeroFillFragment &ZFF = cast(F); + + // Align the fragment offset; it is safe to adjust the offset freely since + // this is only in virtual sections. + uint64_t Aligned = RoundUpToAlignment(Address, ZFF.getAlignment()); + F.setOffset(Aligned - SD.getAddress()); + + // FIXME: This is misnamed. + F.setFileSize(ZFF.getSize()); + break; + } } - Offset += F.getFileSize(); + Address += F.getFileSize(); } - // FIXME: Pad section? - SD.setFileSize(Offset); + // Set the section sizes. + SD.setSize(Address - SD.getAddress()); + if (isVirtualSection(SD.getSection())) + SD.setFileSize(0); + else + SD.setFileSize(Address - SD.getAddress()); } /// WriteFileData - Write the \arg F data to the output file. @@ -620,6 +1039,8 @@ static void WriteFileData(raw_ostream &OS, const MCFragment &F, uint64_t Start = OS.tell(); (void) Start; + ++EmittedFragments; + // FIXME: Embed in fragments instead? switch (F.getKind()) { case MCFragment::FT_Align: { @@ -655,11 +1076,20 @@ static void WriteFileData(raw_ostream &OS, const MCFragment &F, case MCFragment::FT_Fill: { MCFillFragment &FF = cast(F); - if (!FF.getValue().isAbsolute()) - llvm_unreachable("FIXME: Not yet implemented!"); - int64_t Value = FF.getValue().getConstant(); - + int64_t Value = 0; + if (FF.getValue().isAbsolute()) + Value = FF.getValue().getConstant(); for (uint64_t i = 0, e = FF.getCount(); i != e; ++i) { + if (!FF.getValue().isAbsolute()) { + // Find the fixup. + // + // FIXME: Find a better way to write in the fixes. + const MCSectionData::Fixup *Fixup = + F.getParent()->LookupFixup(&F, i * FF.getValueSize()); + assert(Fixup && "Missing fixup for fill value!"); + Value = Fixup->FixedValue; + } + switch (FF.getValueSize()) { default: assert(0 && "Invalid size!"); @@ -680,6 +1110,11 @@ static void WriteFileData(raw_ostream &OS, const MCFragment &F, break; } + + case MCFragment::FT_ZeroFill: { + assert(0 && "Invalid zero fill fragment in concrete section!"); + break; + } } assert(OS.tell() - Start == F.getFileSize()); @@ -688,6 +1123,12 @@ static void WriteFileData(raw_ostream &OS, const MCFragment &F, /// WriteFileData - Write the \arg SD data to the output file. static void WriteFileData(raw_ostream &OS, const MCSectionData &SD, MachObjectWriter &MOW) { + // Ignore virtual sections. + if (isVirtualSection(SD.getSection())) { + assert(SD.getFileSize() == 0); + return; + } + uint64_t Start = OS.tell(); (void) Start; @@ -695,13 +1136,51 @@ static void WriteFileData(raw_ostream &OS, const MCSectionData &SD, ie = SD.end(); it != ie; ++it) WriteFileData(OS, *it, MOW); + // Add section padding. + assert(SD.getFileSize() >= SD.getSize() && "Invalid section sizes!"); + MOW.WriteZeros(SD.getFileSize() - SD.getSize()); + assert(OS.tell() - Start == SD.getFileSize()); } void MCAssembler::Finish() { - // Layout the sections and fragments. - for (iterator it = begin(), ie = end(); it != ie; ++it) - LayoutSection(*it); + // Layout the concrete sections and fragments. + uint64_t Address = 0; + MCSectionData *Prev = 0; + for (iterator it = begin(), ie = end(); it != ie; ++it) { + MCSectionData &SD = *it; + + // Skip virtual sections. + if (isVirtualSection(SD.getSection())) + continue; + + // Align this section if necessary by adding padding bytes to the previous + // section. + if (uint64_t Pad = OffsetToAlignment(Address, it->getAlignment())) { + assert(Prev && "Missing prev section!"); + Prev->setFileSize(Prev->getFileSize() + Pad); + Address += Pad; + } + + // Layout the section fragments and its size. + SD.setAddress(Address); + LayoutSection(SD); + Address += SD.getFileSize(); + + Prev = &SD; + } + + // Layout the virtual sections. + for (iterator it = begin(), ie = end(); it != ie; ++it) { + MCSectionData &SD = *it; + + if (!isVirtualSection(SD.getSection())) + continue; + + SD.setAddress(Address); + LayoutSection(SD); + Address += SD.getSize(); + } // Write the object file. MachObjectWriter MOW(OS); diff --git a/libclamav/c++/llvm/lib/MC/MCCodeEmitter.cpp b/libclamav/c++/llvm/lib/MC/MCCodeEmitter.cpp new file mode 100644 index 000000000..c122763b2 --- /dev/null +++ b/libclamav/c++/llvm/lib/MC/MCCodeEmitter.cpp @@ -0,0 +1,18 @@ +//===-- MCCodeEmitter.cpp - Instruction Encoding --------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "llvm/MC/MCCodeEmitter.h" + +using namespace llvm; + +MCCodeEmitter::MCCodeEmitter() { +} + +MCCodeEmitter::~MCCodeEmitter() { +} diff --git a/libclamav/c++/llvm/lib/MC/MCContext.cpp b/libclamav/c++/llvm/lib/MC/MCContext.cpp index 061d7c249..f36564a6a 100644 --- a/libclamav/c++/llvm/lib/MC/MCContext.cpp +++ b/libclamav/c++/llvm/lib/MC/MCContext.cpp @@ -38,7 +38,6 @@ MCSymbol *MCContext::GetOrCreateSymbol(const StringRef &Name) { return Entry = new (*this) MCSymbol(Name, false); } - MCSymbol *MCContext::CreateTemporarySymbol(const StringRef &Name) { // If unnamed, just create a symbol. if (Name.empty()) @@ -54,16 +53,16 @@ MCSymbol *MCContext::LookupSymbol(const StringRef &Name) const { return Symbols.lookup(Name); } -void MCContext::ClearSymbolValue(MCSymbol *Sym) { +void MCContext::ClearSymbolValue(const MCSymbol *Sym) { SymbolValues.erase(Sym); } -void MCContext::SetSymbolValue(MCSymbol *Sym, const MCValue &Value) { +void MCContext::SetSymbolValue(const MCSymbol *Sym, const MCValue &Value) { SymbolValues[Sym] = Value; } -const MCValue *MCContext::GetSymbolValue(MCSymbol *Sym) const { - DenseMap::iterator it = SymbolValues.find(Sym); +const MCValue *MCContext::GetSymbolValue(const MCSymbol *Sym) const { + DenseMap::iterator it = SymbolValues.find(Sym); if (it == SymbolValues.end()) return 0; diff --git a/libclamav/c++/llvm/lib/MC/MCExpr.cpp b/libclamav/c++/llvm/lib/MC/MCExpr.cpp new file mode 100644 index 000000000..bc4241560 --- /dev/null +++ b/libclamav/c++/llvm/lib/MC/MCExpr.cpp @@ -0,0 +1,249 @@ +//===- MCExpr.cpp - Assembly Level Expression Implementation --------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "llvm/MC/MCExpr.h" +#include "llvm/MC/MCContext.h" +#include "llvm/MC/MCSymbol.h" +#include "llvm/MC/MCValue.h" +#include "llvm/Support/raw_ostream.h" +using namespace llvm; + +void MCExpr::print(raw_ostream &OS) const { + switch (getKind()) { + case MCExpr::Constant: + OS << cast(*this).getValue(); + return; + + case MCExpr::SymbolRef: + cast(*this).getSymbol().print(OS); + return; + + case MCExpr::Unary: { + const MCUnaryExpr &UE = cast(*this); + switch (UE.getOpcode()) { + default: assert(0 && "Invalid opcode!"); + case MCUnaryExpr::LNot: OS << '!'; break; + case MCUnaryExpr::Minus: OS << '-'; break; + case MCUnaryExpr::Not: OS << '~'; break; + case MCUnaryExpr::Plus: OS << '+'; break; + } + UE.getSubExpr()->print(OS); + return; + } + + case MCExpr::Binary: { + const MCBinaryExpr &BE = cast(*this); + OS << '('; + BE.getLHS()->print(OS); + OS << ' '; + switch (BE.getOpcode()) { + default: assert(0 && "Invalid opcode!"); + case MCBinaryExpr::Add: OS << '+'; break; + case MCBinaryExpr::And: OS << '&'; break; + case MCBinaryExpr::Div: OS << '/'; break; + case MCBinaryExpr::EQ: OS << "=="; break; + case MCBinaryExpr::GT: OS << '>'; break; + case MCBinaryExpr::GTE: OS << ">="; break; + case MCBinaryExpr::LAnd: OS << "&&"; break; + case MCBinaryExpr::LOr: OS << "||"; break; + case MCBinaryExpr::LT: OS << '<'; break; + case MCBinaryExpr::LTE: OS << "<="; break; + case MCBinaryExpr::Mod: OS << '%'; break; + case MCBinaryExpr::Mul: OS << '*'; break; + case MCBinaryExpr::NE: OS << "!="; break; + case MCBinaryExpr::Or: OS << '|'; break; + case MCBinaryExpr::Shl: OS << "<<"; break; + case MCBinaryExpr::Shr: OS << ">>"; break; + case MCBinaryExpr::Sub: OS << '-'; break; + case MCBinaryExpr::Xor: OS << '^'; break; + } + OS << ' '; + BE.getRHS()->print(OS); + OS << ')'; + return; + } + } + + assert(0 && "Invalid expression kind!"); +} + +void MCExpr::dump() const { + print(errs()); + errs() << '\n'; +} + +/* *** */ + +const MCBinaryExpr * MCBinaryExpr::Create(Opcode Opc, + const MCExpr *LHS, + const MCExpr *RHS, + MCContext &Ctx) { + return new (Ctx) MCBinaryExpr(Opc, LHS, RHS); +} + +const MCUnaryExpr * MCUnaryExpr::Create(Opcode Opc, + const MCExpr *Expr, + MCContext &Ctx) { + return new (Ctx) MCUnaryExpr(Opc, Expr); +} + +const MCConstantExpr *MCConstantExpr::Create(int64_t Value, MCContext &Ctx) { + return new (Ctx) MCConstantExpr(Value); +} + +const MCSymbolRefExpr *MCSymbolRefExpr::Create(const MCSymbol *Sym, + MCContext &Ctx) { + return new (Ctx) MCSymbolRefExpr(Sym); +} + +/* *** */ + +bool MCExpr::EvaluateAsAbsolute(MCContext &Ctx, int64_t &Res) const { + MCValue Value; + + if (!EvaluateAsRelocatable(Ctx, Value) || !Value.isAbsolute()) + return false; + + Res = Value.getConstant(); + return true; +} + +static bool EvaluateSymbolicAdd(const MCValue &LHS, const MCSymbol *RHS_A, + const MCSymbol *RHS_B, int64_t RHS_Cst, + MCValue &Res) { + // We can't add or subtract two symbols. + if ((LHS.getSymA() && RHS_A) || + (LHS.getSymB() && RHS_B)) + return false; + + const MCSymbol *A = LHS.getSymA() ? LHS.getSymA() : RHS_A; + const MCSymbol *B = LHS.getSymB() ? LHS.getSymB() : RHS_B; + if (B) { + // If we have a negated symbol, then we must have also have a non-negated + // symbol in order to encode the expression. We can do this check later to + // permit expressions which eventually fold to a representable form -- such + // as (a + (0 - b)) -- if necessary. + if (!A) + return false; + } + Res = MCValue::get(A, B, LHS.getConstant() + RHS_Cst); + return true; +} + +bool MCExpr::EvaluateAsRelocatable(MCContext &Ctx, MCValue &Res) const { + switch (getKind()) { + case Constant: + Res = MCValue::get(cast(this)->getValue()); + return true; + + case SymbolRef: { + const MCSymbol &Sym = cast(this)->getSymbol(); + if (const MCValue *Value = Ctx.GetSymbolValue(&Sym)) + Res = *Value; + else + Res = MCValue::get(&Sym, 0, 0); + return true; + } + + case Unary: { + const MCUnaryExpr *AUE = cast(this); + MCValue Value; + + if (!AUE->getSubExpr()->EvaluateAsRelocatable(Ctx, Value)) + return false; + + switch (AUE->getOpcode()) { + case MCUnaryExpr::LNot: + if (!Value.isAbsolute()) + return false; + Res = MCValue::get(!Value.getConstant()); + break; + case MCUnaryExpr::Minus: + /// -(a - b + const) ==> (b - a - const) + if (Value.getSymA() && !Value.getSymB()) + return false; + Res = MCValue::get(Value.getSymB(), Value.getSymA(), + -Value.getConstant()); + break; + case MCUnaryExpr::Not: + if (!Value.isAbsolute()) + return false; + Res = MCValue::get(~Value.getConstant()); + break; + case MCUnaryExpr::Plus: + Res = Value; + break; + } + + return true; + } + + case Binary: { + const MCBinaryExpr *ABE = cast(this); + MCValue LHSValue, RHSValue; + + if (!ABE->getLHS()->EvaluateAsRelocatable(Ctx, LHSValue) || + !ABE->getRHS()->EvaluateAsRelocatable(Ctx, RHSValue)) + return false; + + // We only support a few operations on non-constant expressions, handle + // those first. + if (!LHSValue.isAbsolute() || !RHSValue.isAbsolute()) { + switch (ABE->getOpcode()) { + default: + return false; + case MCBinaryExpr::Sub: + // Negate RHS and add. + return EvaluateSymbolicAdd(LHSValue, + RHSValue.getSymB(), RHSValue.getSymA(), + -RHSValue.getConstant(), + Res); + + case MCBinaryExpr::Add: + return EvaluateSymbolicAdd(LHSValue, + RHSValue.getSymA(), RHSValue.getSymB(), + RHSValue.getConstant(), + Res); + } + } + + // FIXME: We need target hooks for the evaluation. It may be limited in + // width, and gas defines the result of comparisons differently from Apple + // as (the result is sign extended). + int64_t LHS = LHSValue.getConstant(), RHS = RHSValue.getConstant(); + int64_t Result = 0; + switch (ABE->getOpcode()) { + case MCBinaryExpr::Add: Result = LHS + RHS; break; + case MCBinaryExpr::And: Result = LHS & RHS; break; + case MCBinaryExpr::Div: Result = LHS / RHS; break; + case MCBinaryExpr::EQ: Result = LHS == RHS; break; + case MCBinaryExpr::GT: Result = LHS > RHS; break; + case MCBinaryExpr::GTE: Result = LHS >= RHS; break; + case MCBinaryExpr::LAnd: Result = LHS && RHS; break; + case MCBinaryExpr::LOr: Result = LHS || RHS; break; + case MCBinaryExpr::LT: Result = LHS < RHS; break; + case MCBinaryExpr::LTE: Result = LHS <= RHS; break; + case MCBinaryExpr::Mod: Result = LHS % RHS; break; + case MCBinaryExpr::Mul: Result = LHS * RHS; break; + case MCBinaryExpr::NE: Result = LHS != RHS; break; + case MCBinaryExpr::Or: Result = LHS | RHS; break; + case MCBinaryExpr::Shl: Result = LHS << RHS; break; + case MCBinaryExpr::Shr: Result = LHS >> RHS; break; + case MCBinaryExpr::Sub: Result = LHS - RHS; break; + case MCBinaryExpr::Xor: Result = LHS ^ RHS; break; + } + + Res = MCValue::get(Result); + return true; + } + } + + assert(0 && "Invalid assembly expression kind!"); + return false; +} diff --git a/libclamav/c++/llvm/lib/MC/MCInst.cpp b/libclamav/c++/llvm/lib/MC/MCInst.cpp new file mode 100644 index 000000000..ec061463b --- /dev/null +++ b/libclamav/c++/llvm/lib/MC/MCInst.cpp @@ -0,0 +1,53 @@ +//===- lib/MC/MCInst.cpp - MCInst implementation --------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "llvm/MC/MCInst.h" +#include "llvm/MC/MCExpr.h" +#include "llvm/Support/raw_ostream.h" + +using namespace llvm; + +void MCOperand::print(raw_ostream &OS) const { + OS << "print(OS); + OS << ")"; + } else + OS << "UNDEFINED"; + OS << ">"; +} + +void MCOperand::dump() const { + print(errs()); + errs() << "\n"; +} + +void MCInst::print(raw_ostream &OS) const { + OS << ""; +} + +void MCInst::dump() const { + print(errs()); + errs() << "\n"; +} diff --git a/libclamav/c++/llvm/lib/MC/MCMachOStreamer.cpp b/libclamav/c++/llvm/lib/MC/MCMachOStreamer.cpp index 9d60e3ebe..e04bd1fd1 100644 --- a/libclamav/c++/llvm/lib/MC/MCMachOStreamer.cpp +++ b/libclamav/c++/llvm/lib/MC/MCMachOStreamer.cpp @@ -11,9 +11,14 @@ #include "llvm/MC/MCAssembler.h" #include "llvm/MC/MCContext.h" +#include "llvm/MC/MCCodeEmitter.h" +#include "llvm/MC/MCExpr.h" +#include "llvm/MC/MCInst.h" #include "llvm/MC/MCSection.h" #include "llvm/MC/MCSymbol.h" +#include "llvm/MC/MCValue.h" #include "llvm/Support/ErrorHandling.h" +#include "llvm/Support/raw_ostream.h" using namespace llvm; namespace { @@ -42,6 +47,8 @@ class MCMachOStreamer : public MCStreamer { private: MCAssembler Assembler; + MCCodeEmitter *Emitter; + MCSectionData *CurSectionData; DenseMap SectionMap; @@ -58,7 +65,16 @@ private: return 0; } - MCSymbolData &getSymbolData(MCSymbol &Symbol) { + MCSectionData &getSectionData(const MCSection &Section) { + MCSectionData *&Entry = SectionMap[&Section]; + + if (!Entry) + Entry = new MCSectionData(Section, &Assembler); + + return *Entry; + } + + MCSymbolData &getSymbolData(const MCSymbol &Symbol) { MCSymbolData *&Entry = SymbolMap[&Symbol]; if (!Entry) @@ -68,10 +84,35 @@ private: } public: - MCMachOStreamer(MCContext &Context, raw_ostream &_OS) - : MCStreamer(Context), Assembler(_OS), CurSectionData(0) {} + MCMachOStreamer(MCContext &Context, raw_ostream &_OS, MCCodeEmitter *_Emitter) + : MCStreamer(Context), Assembler(Context, _OS), Emitter(_Emitter), + CurSectionData(0) {} ~MCMachOStreamer() {} + const MCExpr *AddValueSymbols(const MCExpr *Value) { + switch (Value->getKind()) { + case MCExpr::Constant: + break; + + case MCExpr::Binary: { + const MCBinaryExpr *BE = cast(Value); + AddValueSymbols(BE->getLHS()); + AddValueSymbols(BE->getRHS()); + break; + } + + case MCExpr::SymbolRef: + getSymbolData(cast(Value)->getSymbol()); + break; + + case MCExpr::Unary: + AddValueSymbols(cast(Value)->getSubExpr()); + break; + } + + return Value; + } + /// @name MCStreamer Interface /// @{ @@ -81,30 +122,27 @@ public: virtual void EmitAssemblerFlag(AssemblerFlag Flag); - virtual void EmitAssignment(MCSymbol *Symbol, const MCValue &Value, - bool MakeAbsolute = false); + virtual void EmitAssignment(MCSymbol *Symbol, const MCExpr *Value); virtual void EmitSymbolAttribute(MCSymbol *Symbol, SymbolAttr Attribute); virtual void EmitSymbolDesc(MCSymbol *Symbol, unsigned DescValue); - virtual void EmitLocalSymbol(MCSymbol *Symbol, const MCValue &Value); - virtual void EmitCommonSymbol(MCSymbol *Symbol, unsigned Size, - unsigned Pow2Alignment, bool IsLocal); + unsigned ByteAlignment); - virtual void EmitZerofill(MCSection *Section, MCSymbol *Symbol = NULL, - unsigned Size = 0, unsigned Pow2Alignment = 0); + virtual void EmitZerofill(const MCSection *Section, MCSymbol *Symbol = 0, + unsigned Size = 0, unsigned ByteAlignment = 0); virtual void EmitBytes(const StringRef &Data); - virtual void EmitValue(const MCValue &Value, unsigned Size); + virtual void EmitValue(const MCExpr *Value, unsigned Size); virtual void EmitValueToAlignment(unsigned ByteAlignment, int64_t Value = 0, unsigned ValueSize = 1, unsigned MaxBytesToEmit = 0); - virtual void EmitValueToOffset(const MCValue &Offset, + virtual void EmitValueToOffset(const MCExpr *Offset, unsigned char Value = 0); virtual void EmitInstruction(const MCInst &Inst); @@ -121,19 +159,15 @@ void MCMachOStreamer::SwitchSection(const MCSection *Section) { // If already in this section, then this is a noop. if (Section == CurSection) return; - + CurSection = Section; - MCSectionData *&Entry = SectionMap[Section]; - - if (!Entry) - Entry = new MCSectionData(*Section, &Assembler); - - CurSectionData = Entry; + CurSectionData = &getSectionData(*Section); } void MCMachOStreamer::EmitLabel(MCSymbol *Symbol) { assert(Symbol->isUndefined() && "Cannot define a symbol twice!"); + // FIXME: We should also use offsets into Fill fragments. MCDataFragment *F = dyn_cast_or_null(getCurrentFragment()); if (!F) F = new MCDataFragment(CurSectionData); @@ -150,12 +184,16 @@ void MCMachOStreamer::EmitLabel(MCSymbol *Symbol) { } void MCMachOStreamer::EmitAssemblerFlag(AssemblerFlag Flag) { - llvm_unreachable("FIXME: Not yet implemented!"); + switch (Flag) { + case SubsectionsViaSymbols: + Assembler.setSubsectionsViaSymbols(true); + return; + } + + assert(0 && "invalid assembler flag!"); } -void MCMachOStreamer::EmitAssignment(MCSymbol *Symbol, - const MCValue &Value, - bool MakeAbsolute) { +void MCMachOStreamer::EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) { // Only absolute symbols can be redefined. assert((Symbol->isUndefined() || Symbol->isAbsolute()) && "Cannot define a symbol twice!"); @@ -165,6 +203,18 @@ void MCMachOStreamer::EmitAssignment(MCSymbol *Symbol, void MCMachOStreamer::EmitSymbolAttribute(MCSymbol *Symbol, SymbolAttr Attribute) { + // Indirect symbols are handled differently, to match how 'as' handles + // them. This makes writing matching .o files easier. + if (Attribute == MCStreamer::IndirectSymbol) { + // Note that we intentionally cannot use the symbol data here; this is + // important for matching the string table that 'as' generates. + IndirectSymbolData ISD; + ISD.Symbol = Symbol; + ISD.SectionData = CurSectionData; + Assembler.getIndirectSymbols().push_back(ISD); + return; + } + // Adding a symbol attribute always introduces the symbol, note that an // important side effect of calling getSymbolData here is to register the // symbol with the assembler. @@ -177,6 +227,7 @@ void MCMachOStreamer::EmitSymbolAttribute(MCSymbol *Symbol, // In the future it might be worth trying to make these operations more well // defined. switch (Attribute) { + case MCStreamer::IndirectSymbol: case MCStreamer::Hidden: case MCStreamer::Internal: case MCStreamer::Protected: @@ -185,7 +236,7 @@ void MCMachOStreamer::EmitSymbolAttribute(MCSymbol *Symbol, break; case MCStreamer::Global: - getSymbolData(*Symbol).setExternal(true); + SD.setExternal(true); break; case MCStreamer::LazyReference: @@ -195,10 +246,6 @@ void MCMachOStreamer::EmitSymbolAttribute(MCSymbol *Symbol, SD.setFlags(SD.getFlags() | SF_ReferenceTypeUndefinedLazy); break; - case MCStreamer::IndirectSymbol: - llvm_unreachable("FIXME: Not yet implemented!"); - break; - // Since .reference sets the no dead strip bit, it is equivalent to // .no_dead_strip in practice. case MCStreamer::Reference: @@ -232,19 +279,38 @@ void MCMachOStreamer::EmitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) { getSymbolData(*Symbol).setFlags(DescValue & SF_DescFlagsMask); } -void MCMachOStreamer::EmitLocalSymbol(MCSymbol *Symbol, const MCValue &Value) { - llvm_unreachable("FIXME: Not yet implemented!"); -} - void MCMachOStreamer::EmitCommonSymbol(MCSymbol *Symbol, unsigned Size, - unsigned Pow2Alignment, - bool IsLocal) { - llvm_unreachable("FIXME: Not yet implemented!"); + unsigned ByteAlignment) { + // FIXME: Darwin 'as' does appear to allow redef of a .comm by itself. + assert(Symbol->isUndefined() && "Cannot define a symbol twice!"); + + MCSymbolData &SD = getSymbolData(*Symbol); + SD.setExternal(true); + SD.setCommon(Size, ByteAlignment); } -void MCMachOStreamer::EmitZerofill(MCSection *Section, MCSymbol *Symbol, - unsigned Size, unsigned Pow2Alignment) { - llvm_unreachable("FIXME: Not yet implemented!"); +void MCMachOStreamer::EmitZerofill(const MCSection *Section, MCSymbol *Symbol, + unsigned Size, unsigned ByteAlignment) { + MCSectionData &SectData = getSectionData(*Section); + + // The symbol may not be present, which only creates the section. + if (!Symbol) + return; + + // FIXME: Assert that this section has the zerofill type. + + assert(Symbol->isUndefined() && "Cannot define a symbol twice!"); + + MCSymbolData &SD = getSymbolData(*Symbol); + + MCFragment *F = new MCZeroFillFragment(Size, ByteAlignment, &SectData); + SD.setFragment(F); + + Symbol->setSection(*Section); + + // Update the maximum alignment on the zero fill section if necessary. + if (ByteAlignment > SectData.getAlignment()) + SectData.setAlignment(ByteAlignment); } void MCMachOStreamer::EmitBytes(const StringRef &Data) { @@ -254,8 +320,13 @@ void MCMachOStreamer::EmitBytes(const StringRef &Data) { DF->getContents().append(Data.begin(), Data.end()); } -void MCMachOStreamer::EmitValue(const MCValue &Value, unsigned Size) { - new MCFillFragment(Value, Size, 1, CurSectionData); +void MCMachOStreamer::EmitValue(const MCExpr *Value, unsigned Size) { + MCValue RelocValue; + + if (!AddValueSymbols(Value)->EvaluateAsRelocatable(getContext(), RelocValue)) + return llvm_report_error("expected relocatable expression"); + + new MCFillFragment(RelocValue, Size, 1, CurSectionData); } void MCMachOStreamer::EmitValueToAlignment(unsigned ByteAlignment, @@ -271,19 +342,38 @@ void MCMachOStreamer::EmitValueToAlignment(unsigned ByteAlignment, CurSectionData->setAlignment(ByteAlignment); } -void MCMachOStreamer::EmitValueToOffset(const MCValue &Offset, +void MCMachOStreamer::EmitValueToOffset(const MCExpr *Offset, unsigned char Value) { - new MCOrgFragment(Offset, Value, CurSectionData); + MCValue RelocOffset; + + if (!AddValueSymbols(Offset)->EvaluateAsRelocatable(getContext(), + RelocOffset)) + return llvm_report_error("expected relocatable expression"); + + new MCOrgFragment(RelocOffset, Value, CurSectionData); } void MCMachOStreamer::EmitInstruction(const MCInst &Inst) { - llvm_unreachable("FIXME: Not yet implemented!"); + // Scan for values. + for (unsigned i = 0; i != Inst.getNumOperands(); ++i) + if (Inst.getOperand(i).isExpr()) + AddValueSymbols(Inst.getOperand(i).getExpr()); + + if (!Emitter) + llvm_unreachable("no code emitter available!"); + + // FIXME: Relocations! + SmallString<256> Code; + raw_svector_ostream VecOS(Code); + Emitter->EncodeInstruction(Inst, VecOS); + EmitBytes(VecOS.str()); } void MCMachOStreamer::Finish() { Assembler.Finish(); } -MCStreamer *llvm::createMachOStreamer(MCContext &Context, raw_ostream &OS) { - return new MCMachOStreamer(Context, OS); +MCStreamer *llvm::createMachOStreamer(MCContext &Context, raw_ostream &OS, + MCCodeEmitter *CE) { + return new MCMachOStreamer(Context, OS, CE); } diff --git a/libclamav/c++/llvm/lib/MC/MCNullStreamer.cpp b/libclamav/c++/llvm/lib/MC/MCNullStreamer.cpp index 61a9d49bc..3cd22ca6f 100644 --- a/libclamav/c++/llvm/lib/MC/MCNullStreamer.cpp +++ b/libclamav/c++/llvm/lib/MC/MCNullStreamer.cpp @@ -13,7 +13,6 @@ #include "llvm/MC/MCInst.h" #include "llvm/MC/MCSectionMachO.h" #include "llvm/MC/MCSymbol.h" -#include "llvm/MC/MCValue.h" using namespace llvm; @@ -34,30 +33,27 @@ namespace { virtual void EmitAssemblerFlag(AssemblerFlag Flag) {} - virtual void EmitAssignment(MCSymbol *Symbol, const MCValue &Value, - bool MakeAbsolute = false) {} + virtual void EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) {} virtual void EmitSymbolAttribute(MCSymbol *Symbol, SymbolAttr Attribute) {} virtual void EmitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) {} - virtual void EmitLocalSymbol(MCSymbol *Symbol, const MCValue &Value) {} - virtual void EmitCommonSymbol(MCSymbol *Symbol, unsigned Size, - unsigned Pow2Alignment, bool IsLocal) {} + unsigned ByteAlignment) {} - virtual void EmitZerofill(MCSection *Section, MCSymbol *Symbol = NULL, - unsigned Size = 0, unsigned Pow2Alignment = 0) {} + virtual void EmitZerofill(const MCSection *Section, MCSymbol *Symbol = 0, + unsigned Size = 0, unsigned ByteAlignment = 0) {} virtual void EmitBytes(const StringRef &Data) {} - virtual void EmitValue(const MCValue &Value, unsigned Size) {} + virtual void EmitValue(const MCExpr *Value, unsigned Size) {} virtual void EmitValueToAlignment(unsigned ByteAlignment, int64_t Value = 0, unsigned ValueSize = 1, unsigned MaxBytesToEmit = 0) {} - virtual void EmitValueToOffset(const MCValue &Offset, + virtual void EmitValueToOffset(const MCExpr *Offset, unsigned char Value = 0) {} virtual void EmitInstruction(const MCInst &Inst) {} diff --git a/libclamav/c++/llvm/lib/Support/CMakeLists.txt b/libclamav/c++/llvm/lib/Support/CMakeLists.txt index efa5361b6..0144b28d2 100644 --- a/libclamav/c++/llvm/lib/Support/CMakeLists.txt +++ b/libclamav/c++/llvm/lib/Support/CMakeLists.txt @@ -30,7 +30,14 @@ add_llvm_library(LLVMSupport Timer.cpp Triple.cpp Twine.cpp + raw_os_ostream.cpp raw_ostream.cpp + Regex.cpp + regcomp.c + regerror.c + regexec.c + regfree.c + regstrlcpy.c ) target_link_libraries (LLVMSupport LLVMSystem) diff --git a/libclamav/c++/llvm/lib/Support/COPYRIGHT.regex b/libclamav/c++/llvm/lib/Support/COPYRIGHT.regex new file mode 100644 index 000000000..a6392fd37 --- /dev/null +++ b/libclamav/c++/llvm/lib/Support/COPYRIGHT.regex @@ -0,0 +1,54 @@ +$OpenBSD: COPYRIGHT,v 1.3 2003/06/02 20:18:36 millert Exp $ + +Copyright 1992, 1993, 1994 Henry Spencer. All rights reserved. +This software is not subject to any license of the American Telephone +and Telegraph Company or of the Regents of the University of California. + +Permission is granted to anyone to use this software for any purpose on +any computer system, and to alter it and redistribute it, subject +to the following restrictions: + +1. The author is not responsible for the consequences of use of this + software, no matter how awful, even if they arise from flaws in it. + +2. The origin of this software must not be misrepresented, either by + explicit claim or by omission. Since few users ever read sources, + credits must appear in the documentation. + +3. Altered versions must be plainly marked as such, and must not be + misrepresented as being the original software. Since few users + ever read sources, credits must appear in the documentation. + +4. This notice may not be removed or altered. + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +/*- + * Copyright (c) 1994 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)COPYRIGHT 8.1 (Berkeley) 3/16/94 + */ diff --git a/libclamav/c++/llvm/lib/Support/Regex.cpp b/libclamav/c++/llvm/lib/Support/Regex.cpp new file mode 100644 index 000000000..f8b2446e3 --- /dev/null +++ b/libclamav/c++/llvm/lib/Support/Regex.cpp @@ -0,0 +1,97 @@ +//===-- Regex.cpp - Regular Expression matcher implementation -------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file implements a POSIX regular expression matcher. +// +//===----------------------------------------------------------------------===// +#include "llvm/Support/Regex.h" +#include "llvm/Support/ErrorHandling.h" +#include "llvm/Support/raw_ostream.h" +#include "regex_impl.h" +#include + +using namespace llvm; +Regex::Regex(const StringRef ®ex, unsigned Flags) +{ + unsigned flags = 0; + preg = new struct llvm_regex; + preg->re_endp = regex.end(); + if (Flags & IgnoreCase) + flags |= REG_ICASE; + if (Flags & NoSub) { + flags |= REG_NOSUB; + sub = false; + } else { + sub = true; + } + if (Flags & Newline) + flags |= REG_NEWLINE; + error = llvm_regcomp(preg, regex.data(), flags|REG_EXTENDED|REG_PEND); +} + +bool Regex::isValid(std::string &Error) +{ + if (!error) + return true; + + size_t len = llvm_regerror(error, preg, NULL, 0); + char *errbuff = new char[len]; + llvm_regerror(error, preg, errbuff, len); + Error.assign(errbuff); + return false; +} + +Regex::~Regex() +{ + llvm_regfree(preg); + delete preg; +} + +bool Regex::match(const StringRef &String, SmallVectorImpl *Matches) +{ + unsigned nmatch = Matches ? preg->re_nsub+1 : 0; + + if (Matches) { + assert(sub && "Substring matching requested but pattern compiled without"); + Matches->clear(); + } + + // pmatch needs to have at least one element. + SmallVector pm; + pm.resize(nmatch > 0 ? nmatch : 1); + pm[0].rm_so = 0; + pm[0].rm_eo = String.size(); + + int rc = llvm_regexec(preg, String.data(), nmatch, pm.data(), REG_STARTEND); + + if (rc == REG_NOMATCH) + return false; + if (rc != 0) { + // regexec can fail due to invalid pattern or running out of memory. + error = rc; + return false; + } + + // There was a match. + + if (Matches) { // match position requested + for (unsigned i=0;ipush_back(StringRef()); + continue; + } + assert(pm[i].rm_eo > pm[i].rm_so); + Matches->push_back(StringRef(String.data()+pm[i].rm_so, + pm[i].rm_eo-pm[i].rm_so)); + } + } + + return true; +} diff --git a/libclamav/c++/llvm/lib/Support/raw_ostream.cpp b/libclamav/c++/llvm/lib/Support/raw_ostream.cpp index 230d9a813..a229efde6 100644 --- a/libclamav/c++/llvm/lib/Support/raw_ostream.cpp +++ b/libclamav/c++/llvm/lib/Support/raw_ostream.cpp @@ -335,9 +335,9 @@ void format_object_base::home() { /// if no error occurred. raw_fd_ostream::raw_fd_ostream(const char *Filename, std::string &ErrorInfo, unsigned Flags) : pos(0) { - // Verify that we don't have both "append" and "force". - assert((!(Flags & F_Force) || !(Flags & F_Append)) && - "Cannot specify both 'force' and 'append' file creation flags!"); + // Verify that we don't have both "append" and "excl". + assert((!(Flags & F_Excl) || !(Flags & F_Append)) && + "Cannot specify both 'excl' and 'append' file creation flags!"); ErrorInfo.clear(); @@ -358,11 +358,11 @@ raw_fd_ostream::raw_fd_ostream(const char *Filename, std::string &ErrorInfo, OpenFlags |= O_BINARY; #endif - if (Flags & F_Force) - OpenFlags |= O_TRUNC; - else if (Flags & F_Append) + if (Flags & F_Append) OpenFlags |= O_APPEND; else + OpenFlags |= O_TRUNC; + if (Flags & F_Excl) OpenFlags |= O_EXCL; FD = open(Filename, OpenFlags, 0664); diff --git a/libclamav/c++/llvm/lib/Support/regcclass.h b/libclamav/c++/llvm/lib/Support/regcclass.h new file mode 100644 index 000000000..2cea3e4e5 --- /dev/null +++ b/libclamav/c++/llvm/lib/Support/regcclass.h @@ -0,0 +1,70 @@ +/*- + * This code is derived from OpenBSD's libc/regex, original license follows: + * + * This code is derived from OpenBSD's libc/regex, original license follows: + * + * Copyright (c) 1992, 1993, 1994 Henry Spencer. + * Copyright (c) 1992, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Henry Spencer. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)cclass.h 8.3 (Berkeley) 3/20/94 + */ + +/* character-class table */ +static struct cclass { + const char *name; + const char *chars; + const char *multis; +} cclasses[] = { + { "alnum", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\ +0123456789", ""} , + { "alpha", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", + ""} , + { "blank", " \t", ""} , + { "cntrl", "\007\b\t\n\v\f\r\1\2\3\4\5\6\16\17\20\21\22\23\24\ +\25\26\27\30\31\32\33\34\35\36\37\177", ""} , + { "digit", "0123456789", ""} , + { "graph", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\ +0123456789!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~", + ""} , + { "lower", "abcdefghijklmnopqrstuvwxyz", + ""} , + { "print", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\ +0123456789!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~ ", + ""} , + { "punct", "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~", + ""} , + { "space", "\t\n\v\f\r ", ""} , + { "upper", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", + ""} , + { "xdigit", "0123456789ABCDEFabcdef", + ""} , + { NULL, 0, "" } +}; diff --git a/libclamav/c++/llvm/lib/Support/regcname.h b/libclamav/c++/llvm/lib/Support/regcname.h new file mode 100644 index 000000000..3c0bb248f --- /dev/null +++ b/libclamav/c++/llvm/lib/Support/regcname.h @@ -0,0 +1,139 @@ +/*- + * This code is derived from OpenBSD's libc/regex, original license follows: + * + * Copyright (c) 1992, 1993, 1994 Henry Spencer. + * Copyright (c) 1992, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Henry Spencer. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)cname.h 8.3 (Berkeley) 3/20/94 + */ + +/* character-name table */ +static struct cname { + const char *name; + char code; +} cnames[] = { + { "NUL", '\0' }, + { "SOH", '\001' }, + { "STX", '\002' }, + { "ETX", '\003' }, + { "EOT", '\004' }, + { "ENQ", '\005' }, + { "ACK", '\006' }, + { "BEL", '\007' }, + { "alert", '\007' }, + { "BS", '\010' }, + { "backspace", '\b' }, + { "HT", '\011' }, + { "tab", '\t' }, + { "LF", '\012' }, + { "newline", '\n' }, + { "VT", '\013' }, + { "vertical-tab", '\v' }, + { "FF", '\014' }, + { "form-feed", '\f' }, + { "CR", '\015' }, + { "carriage-return", '\r' }, + { "SO", '\016' }, + { "SI", '\017' }, + { "DLE", '\020' }, + { "DC1", '\021' }, + { "DC2", '\022' }, + { "DC3", '\023' }, + { "DC4", '\024' }, + { "NAK", '\025' }, + { "SYN", '\026' }, + { "ETB", '\027' }, + { "CAN", '\030' }, + { "EM", '\031' }, + { "SUB", '\032' }, + { "ESC", '\033' }, + { "IS4", '\034' }, + { "FS", '\034' }, + { "IS3", '\035' }, + { "GS", '\035' }, + { "IS2", '\036' }, + { "RS", '\036' }, + { "IS1", '\037' }, + { "US", '\037' }, + { "space", ' ' }, + { "exclamation-mark", '!' }, + { "quotation-mark", '"' }, + { "number-sign", '#' }, + { "dollar-sign", '$' }, + { "percent-sign", '%' }, + { "ampersand", '&' }, + { "apostrophe", '\'' }, + { "left-parenthesis", '(' }, + { "right-parenthesis", ')' }, + { "asterisk", '*' }, + { "plus-sign", '+' }, + { "comma", ',' }, + { "hyphen", '-' }, + { "hyphen-minus", '-' }, + { "period", '.' }, + { "full-stop", '.' }, + { "slash", '/' }, + { "solidus", '/' }, + { "zero", '0' }, + { "one", '1' }, + { "two", '2' }, + { "three", '3' }, + { "four", '4' }, + { "five", '5' }, + { "six", '6' }, + { "seven", '7' }, + { "eight", '8' }, + { "nine", '9' }, + { "colon", ':' }, + { "semicolon", ';' }, + { "less-than-sign", '<' }, + { "equals-sign", '=' }, + { "greater-than-sign", '>' }, + { "question-mark", '?' }, + { "commercial-at", '@' }, + { "left-square-bracket", '[' }, + { "backslash", '\\' }, + { "reverse-solidus", '\\' }, + { "right-square-bracket", ']' }, + { "circumflex", '^' }, + { "circumflex-accent", '^' }, + { "underscore", '_' }, + { "low-line", '_' }, + { "grave-accent", '`' }, + { "left-brace", '{' }, + { "left-curly-bracket", '{' }, + { "vertical-line", '|' }, + { "right-brace", '}' }, + { "right-curly-bracket", '}' }, + { "tilde", '~' }, + { "DEL", '\177' }, + { NULL, 0 } +}; diff --git a/libclamav/c++/llvm/lib/Support/regcomp.c b/libclamav/c++/llvm/lib/Support/regcomp.c new file mode 100644 index 000000000..2755fd83a --- /dev/null +++ b/libclamav/c++/llvm/lib/Support/regcomp.c @@ -0,0 +1,1524 @@ +/*- + * This code is derived from OpenBSD's libc/regex, original license follows: + * + * Copyright (c) 1992, 1993, 1994 Henry Spencer. + * Copyright (c) 1992, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Henry Spencer. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)regcomp.c 8.5 (Berkeley) 3/20/94 + */ + +#include +#include +#include +#include +#include +#include +#include "regex_impl.h" + +#include "regutils.h" +#include "regex2.h" + +#include "regcclass.h" +#include "regcname.h" + +/* + * parse structure, passed up and down to avoid global variables and + * other clumsinesses + */ +struct parse { + char *next; /* next character in RE */ + char *end; /* end of string (-> NUL normally) */ + int error; /* has an error been seen? */ + sop *strip; /* malloced strip */ + sopno ssize; /* malloced strip size (allocated) */ + sopno slen; /* malloced strip length (used) */ + int ncsalloc; /* number of csets allocated */ + struct re_guts *g; +# define NPAREN 10 /* we need to remember () 1-9 for back refs */ + sopno pbegin[NPAREN]; /* -> ( ([0] unused) */ + sopno pend[NPAREN]; /* -> ) ([0] unused) */ +}; + +static void p_ere(struct parse *, int); +static void p_ere_exp(struct parse *); +static void p_str(struct parse *); +static void p_bre(struct parse *, int, int); +static int p_simp_re(struct parse *, int); +static int p_count(struct parse *); +static void p_bracket(struct parse *); +static void p_b_term(struct parse *, cset *); +static void p_b_cclass(struct parse *, cset *); +static void p_b_eclass(struct parse *, cset *); +static char p_b_symbol(struct parse *); +static char p_b_coll_elem(struct parse *, int); +static char othercase(int); +static void bothcases(struct parse *, int); +static void ordinary(struct parse *, int); +static void nonnewline(struct parse *); +static void repeat(struct parse *, sopno, int, int); +static int seterr(struct parse *, int); +static cset *allocset(struct parse *); +static void freeset(struct parse *, cset *); +static int freezeset(struct parse *, cset *); +static int firstch(struct parse *, cset *); +static int nch(struct parse *, cset *); +static void mcadd(struct parse *, cset *, const char *); +static void mcinvert(struct parse *, cset *); +static void mccase(struct parse *, cset *); +static int isinsets(struct re_guts *, int); +static int samesets(struct re_guts *, int, int); +static void categorize(struct parse *, struct re_guts *); +static sopno dupl(struct parse *, sopno, sopno); +static void doemit(struct parse *, sop, size_t); +static void doinsert(struct parse *, sop, size_t, sopno); +static void dofwd(struct parse *, sopno, sop); +static void enlarge(struct parse *, sopno); +static void stripsnug(struct parse *, struct re_guts *); +static void findmust(struct parse *, struct re_guts *); +static sopno pluscount(struct parse *, struct re_guts *); + +static char nuls[10]; /* place to point scanner in event of error */ + +/* + * macros for use with parse structure + * BEWARE: these know that the parse structure is named `p' !!! + */ +#define PEEK() (*p->next) +#define PEEK2() (*(p->next+1)) +#define MORE() (p->next < p->end) +#define MORE2() (p->next+1 < p->end) +#define SEE(c) (MORE() && PEEK() == (c)) +#define SEETWO(a, b) (MORE() && MORE2() && PEEK() == (a) && PEEK2() == (b)) +#define EAT(c) ((SEE(c)) ? (NEXT(), 1) : 0) +#define EATTWO(a, b) ((SEETWO(a, b)) ? (NEXT2(), 1) : 0) +#define NEXT() (p->next++) +#define NEXT2() (p->next += 2) +#define NEXTn(n) (p->next += (n)) +#define GETNEXT() (*p->next++) +#define SETERROR(e) seterr(p, (e)) +#define REQUIRE(co, e) (void)((co) || SETERROR(e)) +#define MUSTSEE(c, e) (REQUIRE(MORE() && PEEK() == (c), e)) +#define MUSTEAT(c, e) (REQUIRE(MORE() && GETNEXT() == (c), e)) +#define MUSTNOTSEE(c, e) (REQUIRE(!MORE() || PEEK() != (c), e)) +#define EMIT(op, sopnd) doemit(p, (sop)(op), (size_t)(sopnd)) +#define INSERT(op, pos) doinsert(p, (sop)(op), HERE()-(pos)+1, pos) +#define AHEAD(pos) dofwd(p, pos, HERE()-(pos)) +#define ASTERN(sop, pos) EMIT(sop, HERE()-pos) +#define HERE() (p->slen) +#define THERE() (p->slen - 1) +#define THERETHERE() (p->slen - 2) +#define DROP(n) (p->slen -= (n)) + +#ifdef _POSIX2_RE_DUP_MAX +#define DUPMAX _POSIX2_RE_DUP_MAX +#else +#define DUPMAX 255 +#endif + +#ifndef NDEBUG +static int never = 0; /* for use in asserts; shuts lint up */ +#else +#define never 0 /* some s have bugs too */ +#endif + +/* + - llvm_regcomp - interface for parser and compilation + */ +int /* 0 success, otherwise REG_something */ +llvm_regcomp(llvm_regex_t *preg, const char *pattern, int cflags) +{ + struct parse pa; + struct re_guts *g; + struct parse *p = &pa; + int i; + size_t len; +#ifdef REDEBUG +# define GOODFLAGS(f) (f) +#else +# define GOODFLAGS(f) ((f)&~REG_DUMP) +#endif + + cflags = GOODFLAGS(cflags); + if ((cflags®_EXTENDED) && (cflags®_NOSPEC)) + return(REG_INVARG); + + if (cflags®_PEND) { + if (preg->re_endp < pattern) + return(REG_INVARG); + len = preg->re_endp - pattern; + } else + len = strlen((const char *)pattern); + + /* do the mallocs early so failure handling is easy */ + g = (struct re_guts *)malloc(sizeof(struct re_guts) + + (NC-1)*sizeof(cat_t)); + if (g == NULL) + return(REG_ESPACE); + p->ssize = len/(size_t)2*(size_t)3 + (size_t)1; /* ugh */ + p->strip = (sop *)calloc(p->ssize, sizeof(sop)); + p->slen = 0; + if (p->strip == NULL) { + free((char *)g); + return(REG_ESPACE); + } + + /* set things up */ + p->g = g; + p->next = (char *)pattern; /* convenience; we do not modify it */ + p->end = p->next + len; + p->error = 0; + p->ncsalloc = 0; + for (i = 0; i < NPAREN; i++) { + p->pbegin[i] = 0; + p->pend[i] = 0; + } + g->csetsize = NC; + g->sets = NULL; + g->setbits = NULL; + g->ncsets = 0; + g->cflags = cflags; + g->iflags = 0; + g->nbol = 0; + g->neol = 0; + g->must = NULL; + g->mlen = 0; + g->nsub = 0; + g->ncategories = 1; /* category 0 is "everything else" */ + g->categories = &g->catspace[-(CHAR_MIN)]; + (void) memset((char *)g->catspace, 0, NC*sizeof(cat_t)); + g->backrefs = 0; + + /* do it */ + EMIT(OEND, 0); + g->firststate = THERE(); + if (cflags®_EXTENDED) + p_ere(p, OUT); + else if (cflags®_NOSPEC) + p_str(p); + else + p_bre(p, OUT, OUT); + EMIT(OEND, 0); + g->laststate = THERE(); + + /* tidy up loose ends and fill things in */ + categorize(p, g); + stripsnug(p, g); + findmust(p, g); + g->nplus = pluscount(p, g); + g->magic = MAGIC2; + preg->re_nsub = g->nsub; + preg->re_g = g; + preg->re_magic = MAGIC1; +#ifndef REDEBUG + /* not debugging, so can't rely on the assert() in llvm_regexec() */ + if (g->iflags®EX_BAD) + SETERROR(REG_ASSERT); +#endif + + /* win or lose, we're done */ + if (p->error != 0) /* lose */ + llvm_regfree(preg); + return(p->error); +} + +/* + - p_ere - ERE parser top level, concatenation and alternation + */ +static void +p_ere(struct parse *p, int stop) /* character this ERE should end at */ +{ + char c; + sopno prevback = prevback; + sopno prevfwd = prevfwd; + sopno conc; + int first = 1; /* is this the first alternative? */ + + for (;;) { + /* do a bunch of concatenated expressions */ + conc = HERE(); + while (MORE() && (c = PEEK()) != '|' && c != stop) + p_ere_exp(p); + REQUIRE(HERE() != conc, REG_EMPTY); /* require nonempty */ + + if (!EAT('|')) + break; /* NOTE BREAK OUT */ + + if (first) { + INSERT(OCH_, conc); /* offset is wrong */ + prevfwd = conc; + prevback = conc; + first = 0; + } + ASTERN(OOR1, prevback); + prevback = THERE(); + AHEAD(prevfwd); /* fix previous offset */ + prevfwd = HERE(); + EMIT(OOR2, 0); /* offset is very wrong */ + } + + if (!first) { /* tail-end fixups */ + AHEAD(prevfwd); + ASTERN(O_CH, prevback); + } + + assert(!MORE() || SEE(stop)); +} + +/* + - p_ere_exp - parse one subERE, an atom possibly followed by a repetition op + */ +static void +p_ere_exp(struct parse *p) +{ + char c; + sopno pos; + int count; + int count2; + sopno subno; + int wascaret = 0; + + assert(MORE()); /* caller should have ensured this */ + c = GETNEXT(); + + pos = HERE(); + switch (c) { + case '(': + REQUIRE(MORE(), REG_EPAREN); + p->g->nsub++; + subno = p->g->nsub; + if (subno < NPAREN) + p->pbegin[subno] = HERE(); + EMIT(OLPAREN, subno); + if (!SEE(')')) + p_ere(p, ')'); + if (subno < NPAREN) { + p->pend[subno] = HERE(); + assert(p->pend[subno] != 0); + } + EMIT(ORPAREN, subno); + MUSTEAT(')', REG_EPAREN); + break; +#ifndef POSIX_MISTAKE + case ')': /* happens only if no current unmatched ( */ + /* + * You may ask, why the ifndef? Because I didn't notice + * this until slightly too late for 1003.2, and none of the + * other 1003.2 regular-expression reviewers noticed it at + * all. So an unmatched ) is legal POSIX, at least until + * we can get it fixed. + */ + SETERROR(REG_EPAREN); + break; +#endif + case '^': + EMIT(OBOL, 0); + p->g->iflags |= USEBOL; + p->g->nbol++; + wascaret = 1; + break; + case '$': + EMIT(OEOL, 0); + p->g->iflags |= USEEOL; + p->g->neol++; + break; + case '|': + SETERROR(REG_EMPTY); + break; + case '*': + case '+': + case '?': + SETERROR(REG_BADRPT); + break; + case '.': + if (p->g->cflags®_NEWLINE) + nonnewline(p); + else + EMIT(OANY, 0); + break; + case '[': + p_bracket(p); + break; + case '\\': + REQUIRE(MORE(), REG_EESCAPE); + c = GETNEXT(); + ordinary(p, c); + break; + case '{': /* okay as ordinary except if digit follows */ + REQUIRE(!MORE() || !isdigit((uch)PEEK()), REG_BADRPT); + /* FALLTHROUGH */ + default: + ordinary(p, c); + break; + } + + if (!MORE()) + return; + c = PEEK(); + /* we call { a repetition if followed by a digit */ + if (!( c == '*' || c == '+' || c == '?' || + (c == '{' && MORE2() && isdigit((uch)PEEK2())) )) + return; /* no repetition, we're done */ + NEXT(); + + REQUIRE(!wascaret, REG_BADRPT); + switch (c) { + case '*': /* implemented as +? */ + /* this case does not require the (y|) trick, noKLUDGE */ + INSERT(OPLUS_, pos); + ASTERN(O_PLUS, pos); + INSERT(OQUEST_, pos); + ASTERN(O_QUEST, pos); + break; + case '+': + INSERT(OPLUS_, pos); + ASTERN(O_PLUS, pos); + break; + case '?': + /* KLUDGE: emit y? as (y|) until subtle bug gets fixed */ + INSERT(OCH_, pos); /* offset slightly wrong */ + ASTERN(OOR1, pos); /* this one's right */ + AHEAD(pos); /* fix the OCH_ */ + EMIT(OOR2, 0); /* offset very wrong... */ + AHEAD(THERE()); /* ...so fix it */ + ASTERN(O_CH, THERETHERE()); + break; + case '{': + count = p_count(p); + if (EAT(',')) { + if (isdigit((uch)PEEK())) { + count2 = p_count(p); + REQUIRE(count <= count2, REG_BADBR); + } else /* single number with comma */ + count2 = INFINITY; + } else /* just a single number */ + count2 = count; + repeat(p, pos, count, count2); + if (!EAT('}')) { /* error heuristics */ + while (MORE() && PEEK() != '}') + NEXT(); + REQUIRE(MORE(), REG_EBRACE); + SETERROR(REG_BADBR); + } + break; + } + + if (!MORE()) + return; + c = PEEK(); + if (!( c == '*' || c == '+' || c == '?' || + (c == '{' && MORE2() && isdigit((uch)PEEK2())) ) ) + return; + SETERROR(REG_BADRPT); +} + +/* + - p_str - string (no metacharacters) "parser" + */ +static void +p_str(struct parse *p) +{ + REQUIRE(MORE(), REG_EMPTY); + while (MORE()) + ordinary(p, GETNEXT()); +} + +/* + - p_bre - BRE parser top level, anchoring and concatenation + * Giving end1 as OUT essentially eliminates the end1/end2 check. + * + * This implementation is a bit of a kludge, in that a trailing $ is first + * taken as an ordinary character and then revised to be an anchor. The + * only undesirable side effect is that '$' gets included as a character + * category in such cases. This is fairly harmless; not worth fixing. + * The amount of lookahead needed to avoid this kludge is excessive. + */ +static void +p_bre(struct parse *p, + int end1, /* first terminating character */ + int end2) /* second terminating character */ +{ + sopno start = HERE(); + int first = 1; /* first subexpression? */ + int wasdollar = 0; + + if (EAT('^')) { + EMIT(OBOL, 0); + p->g->iflags |= USEBOL; + p->g->nbol++; + } + while (MORE() && !SEETWO(end1, end2)) { + wasdollar = p_simp_re(p, first); + first = 0; + } + if (wasdollar) { /* oops, that was a trailing anchor */ + DROP(1); + EMIT(OEOL, 0); + p->g->iflags |= USEEOL; + p->g->neol++; + } + + REQUIRE(HERE() != start, REG_EMPTY); /* require nonempty */ +} + +/* + - p_simp_re - parse a simple RE, an atom possibly followed by a repetition + */ +static int /* was the simple RE an unbackslashed $? */ +p_simp_re(struct parse *p, + int starordinary) /* is a leading * an ordinary character? */ +{ + int c; + int count; + int count2; + sopno pos; + int i; + sopno subno; +# define BACKSL (1<g->cflags®_NEWLINE) + nonnewline(p); + else + EMIT(OANY, 0); + break; + case '[': + p_bracket(p); + break; + case BACKSL|'{': + SETERROR(REG_BADRPT); + break; + case BACKSL|'(': + p->g->nsub++; + subno = p->g->nsub; + if (subno < NPAREN) + p->pbegin[subno] = HERE(); + EMIT(OLPAREN, subno); + /* the MORE here is an error heuristic */ + if (MORE() && !SEETWO('\\', ')')) + p_bre(p, '\\', ')'); + if (subno < NPAREN) { + p->pend[subno] = HERE(); + assert(p->pend[subno] != 0); + } + EMIT(ORPAREN, subno); + REQUIRE(EATTWO('\\', ')'), REG_EPAREN); + break; + case BACKSL|')': /* should not get here -- must be user */ + case BACKSL|'}': + SETERROR(REG_EPAREN); + break; + case BACKSL|'1': + case BACKSL|'2': + case BACKSL|'3': + case BACKSL|'4': + case BACKSL|'5': + case BACKSL|'6': + case BACKSL|'7': + case BACKSL|'8': + case BACKSL|'9': + i = (c&~BACKSL) - '0'; + assert(i < NPAREN); + if (p->pend[i] != 0) { + assert(i <= p->g->nsub); + EMIT(OBACK_, i); + assert(p->pbegin[i] != 0); + assert(OP(p->strip[p->pbegin[i]]) == OLPAREN); + assert(OP(p->strip[p->pend[i]]) == ORPAREN); + (void) dupl(p, p->pbegin[i]+1, p->pend[i]); + EMIT(O_BACK, i); + } else + SETERROR(REG_ESUBREG); + p->g->backrefs = 1; + break; + case '*': + REQUIRE(starordinary, REG_BADRPT); + /* FALLTHROUGH */ + default: + ordinary(p, (char)c); + break; + } + + if (EAT('*')) { /* implemented as +? */ + /* this case does not require the (y|) trick, noKLUDGE */ + INSERT(OPLUS_, pos); + ASTERN(O_PLUS, pos); + INSERT(OQUEST_, pos); + ASTERN(O_QUEST, pos); + } else if (EATTWO('\\', '{')) { + count = p_count(p); + if (EAT(',')) { + if (MORE() && isdigit((uch)PEEK())) { + count2 = p_count(p); + REQUIRE(count <= count2, REG_BADBR); + } else /* single number with comma */ + count2 = INFINITY; + } else /* just a single number */ + count2 = count; + repeat(p, pos, count, count2); + if (!EATTWO('\\', '}')) { /* error heuristics */ + while (MORE() && !SEETWO('\\', '}')) + NEXT(); + REQUIRE(MORE(), REG_EBRACE); + SETERROR(REG_BADBR); + } + } else if (c == '$') /* $ (but not \$) ends it */ + return(1); + + return(0); +} + +/* + - p_count - parse a repetition count + */ +static int /* the value */ +p_count(struct parse *p) +{ + int count = 0; + int ndigits = 0; + + while (MORE() && isdigit((uch)PEEK()) && count <= DUPMAX) { + count = count*10 + (GETNEXT() - '0'); + ndigits++; + } + + REQUIRE(ndigits > 0 && count <= DUPMAX, REG_BADBR); + return(count); +} + +/* + - p_bracket - parse a bracketed character list + * + * Note a significant property of this code: if the allocset() did SETERROR, + * no set operations are done. + */ +static void +p_bracket(struct parse *p) +{ + cset *cs; + int invert = 0; + + /* Dept of Truly Sickening Special-Case Kludges */ + if (p->next + 5 < p->end && strncmp(p->next, "[:<:]]", 6) == 0) { + EMIT(OBOW, 0); + NEXTn(6); + return; + } + if (p->next + 5 < p->end && strncmp(p->next, "[:>:]]", 6) == 0) { + EMIT(OEOW, 0); + NEXTn(6); + return; + } + + if ((cs = allocset(p)) == NULL) { + /* allocset did set error status in p */ + return; + } + + if (EAT('^')) + invert++; /* make note to invert set at end */ + if (EAT(']')) + CHadd(cs, ']'); + else if (EAT('-')) + CHadd(cs, '-'); + while (MORE() && PEEK() != ']' && !SEETWO('-', ']')) + p_b_term(p, cs); + if (EAT('-')) + CHadd(cs, '-'); + MUSTEAT(']', REG_EBRACK); + + if (p->error != 0) { /* don't mess things up further */ + freeset(p, cs); + return; + } + + if (p->g->cflags®_ICASE) { + int i; + int ci; + + for (i = p->g->csetsize - 1; i >= 0; i--) + if (CHIN(cs, i) && isalpha(i)) { + ci = othercase(i); + if (ci != i) + CHadd(cs, ci); + } + if (cs->multis != NULL) + mccase(p, cs); + } + if (invert) { + int i; + + for (i = p->g->csetsize - 1; i >= 0; i--) + if (CHIN(cs, i)) + CHsub(cs, i); + else + CHadd(cs, i); + if (p->g->cflags®_NEWLINE) + CHsub(cs, '\n'); + if (cs->multis != NULL) + mcinvert(p, cs); + } + + assert(cs->multis == NULL); /* xxx */ + + if (nch(p, cs) == 1) { /* optimize singleton sets */ + ordinary(p, firstch(p, cs)); + freeset(p, cs); + } else + EMIT(OANYOF, freezeset(p, cs)); +} + +/* + - p_b_term - parse one term of a bracketed character list + */ +static void +p_b_term(struct parse *p, cset *cs) +{ + char c; + char start, finish; + int i; + + /* classify what we've got */ + switch ((MORE()) ? PEEK() : '\0') { + case '[': + c = (MORE2()) ? PEEK2() : '\0'; + break; + case '-': + SETERROR(REG_ERANGE); + return; /* NOTE RETURN */ + break; + default: + c = '\0'; + break; + } + + switch (c) { + case ':': /* character class */ + NEXT2(); + REQUIRE(MORE(), REG_EBRACK); + c = PEEK(); + REQUIRE(c != '-' && c != ']', REG_ECTYPE); + p_b_cclass(p, cs); + REQUIRE(MORE(), REG_EBRACK); + REQUIRE(EATTWO(':', ']'), REG_ECTYPE); + break; + case '=': /* equivalence class */ + NEXT2(); + REQUIRE(MORE(), REG_EBRACK); + c = PEEK(); + REQUIRE(c != '-' && c != ']', REG_ECOLLATE); + p_b_eclass(p, cs); + REQUIRE(MORE(), REG_EBRACK); + REQUIRE(EATTWO('=', ']'), REG_ECOLLATE); + break; + default: /* symbol, ordinary character, or range */ +/* xxx revision needed for multichar stuff */ + start = p_b_symbol(p); + if (SEE('-') && MORE2() && PEEK2() != ']') { + /* range */ + NEXT(); + if (EAT('-')) + finish = '-'; + else + finish = p_b_symbol(p); + } else + finish = start; +/* xxx what about signed chars here... */ + REQUIRE(start <= finish, REG_ERANGE); + for (i = start; i <= finish; i++) + CHadd(cs, i); + break; + } +} + +/* + - p_b_cclass - parse a character-class name and deal with it + */ +static void +p_b_cclass(struct parse *p, cset *cs) +{ + char *sp = p->next; + struct cclass *cp; + size_t len; + const char *u; + char c; + + while (MORE() && isalpha(PEEK())) + NEXT(); + len = p->next - sp; + for (cp = cclasses; cp->name != NULL; cp++) + if (strncmp(cp->name, sp, len) == 0 && cp->name[len] == '\0') + break; + if (cp->name == NULL) { + /* oops, didn't find it */ + SETERROR(REG_ECTYPE); + return; + } + + u = cp->chars; + while ((c = *u++) != '\0') + CHadd(cs, c); + for (u = cp->multis; *u != '\0'; u += strlen(u) + 1) + MCadd(p, cs, u); +} + +/* + - p_b_eclass - parse an equivalence-class name and deal with it + * + * This implementation is incomplete. xxx + */ +static void +p_b_eclass(struct parse *p, cset *cs) +{ + char c; + + c = p_b_coll_elem(p, '='); + CHadd(cs, c); +} + +/* + - p_b_symbol - parse a character or [..]ed multicharacter collating symbol + */ +static char /* value of symbol */ +p_b_symbol(struct parse *p) +{ + char value; + + REQUIRE(MORE(), REG_EBRACK); + if (!EATTWO('[', '.')) + return(GETNEXT()); + + /* collating symbol */ + value = p_b_coll_elem(p, '.'); + REQUIRE(EATTWO('.', ']'), REG_ECOLLATE); + return(value); +} + +/* + - p_b_coll_elem - parse a collating-element name and look it up + */ +static char /* value of collating element */ +p_b_coll_elem(struct parse *p, + int endc) /* name ended by endc,']' */ +{ + char *sp = p->next; + struct cname *cp; + int len; + + while (MORE() && !SEETWO(endc, ']')) + NEXT(); + if (!MORE()) { + SETERROR(REG_EBRACK); + return(0); + } + len = p->next - sp; + for (cp = cnames; cp->name != NULL; cp++) + if (strncmp(cp->name, sp, len) == 0 && cp->name[len] == '\0') + return(cp->code); /* known name */ + if (len == 1) + return(*sp); /* single character */ + SETERROR(REG_ECOLLATE); /* neither */ + return(0); +} + +/* + - othercase - return the case counterpart of an alphabetic + */ +static char /* if no counterpart, return ch */ +othercase(int ch) +{ + ch = (uch)ch; + assert(isalpha(ch)); + if (isupper(ch)) + return ((uch)tolower(ch)); + else if (islower(ch)) + return ((uch)toupper(ch)); + else /* peculiar, but could happen */ + return(ch); +} + +/* + - bothcases - emit a dualcase version of a two-case character + * + * Boy, is this implementation ever a kludge... + */ +static void +bothcases(struct parse *p, int ch) +{ + char *oldnext = p->next; + char *oldend = p->end; + char bracket[3]; + + ch = (uch)ch; + assert(othercase(ch) != ch); /* p_bracket() would recurse */ + p->next = bracket; + p->end = bracket+2; + bracket[0] = ch; + bracket[1] = ']'; + bracket[2] = '\0'; + p_bracket(p); + assert(p->next == bracket+2); + p->next = oldnext; + p->end = oldend; +} + +/* + - ordinary - emit an ordinary character + */ +static void +ordinary(struct parse *p, int ch) +{ + cat_t *cap = p->g->categories; + + if ((p->g->cflags®_ICASE) && isalpha((uch)ch) && othercase(ch) != ch) + bothcases(p, ch); + else { + EMIT(OCHAR, (uch)ch); + if (cap[ch] == 0) + cap[ch] = p->g->ncategories++; + } +} + +/* + - nonnewline - emit REG_NEWLINE version of OANY + * + * Boy, is this implementation ever a kludge... + */ +static void +nonnewline(struct parse *p) +{ + char *oldnext = p->next; + char *oldend = p->end; + char bracket[4]; + + p->next = bracket; + p->end = bracket+3; + bracket[0] = '^'; + bracket[1] = '\n'; + bracket[2] = ']'; + bracket[3] = '\0'; + p_bracket(p); + assert(p->next == bracket+3); + p->next = oldnext; + p->end = oldend; +} + +/* + - repeat - generate code for a bounded repetition, recursively if needed + */ +static void +repeat(struct parse *p, + sopno start, /* operand from here to end of strip */ + int from, /* repeated from this number */ + int to) /* to this number of times (maybe INFINITY) */ +{ + sopno finish = HERE(); +# define N 2 +# define INF 3 +# define REP(f, t) ((f)*8 + (t)) +# define MAP(n) (((n) <= 1) ? (n) : ((n) == INFINITY) ? INF : N) + sopno copy; + + if (p->error != 0) /* head off possible runaway recursion */ + return; + + assert(from <= to); + + switch (REP(MAP(from), MAP(to))) { + case REP(0, 0): /* must be user doing this */ + DROP(finish-start); /* drop the operand */ + break; + case REP(0, 1): /* as x{1,1}? */ + case REP(0, N): /* as x{1,n}? */ + case REP(0, INF): /* as x{1,}? */ + /* KLUDGE: emit y? as (y|) until subtle bug gets fixed */ + INSERT(OCH_, start); /* offset is wrong... */ + repeat(p, start+1, 1, to); + ASTERN(OOR1, start); + AHEAD(start); /* ... fix it */ + EMIT(OOR2, 0); + AHEAD(THERE()); + ASTERN(O_CH, THERETHERE()); + break; + case REP(1, 1): /* trivial case */ + /* done */ + break; + case REP(1, N): /* as x?x{1,n-1} */ + /* KLUDGE: emit y? as (y|) until subtle bug gets fixed */ + INSERT(OCH_, start); + ASTERN(OOR1, start); + AHEAD(start); + EMIT(OOR2, 0); /* offset very wrong... */ + AHEAD(THERE()); /* ...so fix it */ + ASTERN(O_CH, THERETHERE()); + copy = dupl(p, start+1, finish+1); + assert(copy == finish+4); + repeat(p, copy, 1, to-1); + break; + case REP(1, INF): /* as x+ */ + INSERT(OPLUS_, start); + ASTERN(O_PLUS, start); + break; + case REP(N, N): /* as xx{m-1,n-1} */ + copy = dupl(p, start, finish); + repeat(p, copy, from-1, to-1); + break; + case REP(N, INF): /* as xx{n-1,INF} */ + copy = dupl(p, start, finish); + repeat(p, copy, from-1, to); + break; + default: /* "can't happen" */ + SETERROR(REG_ASSERT); /* just in case */ + break; + } +} + +/* + - seterr - set an error condition + */ +static int /* useless but makes type checking happy */ +seterr(struct parse *p, int e) +{ + if (p->error == 0) /* keep earliest error condition */ + p->error = e; + p->next = nuls; /* try to bring things to a halt */ + p->end = nuls; + return(0); /* make the return value well-defined */ +} + +/* + - allocset - allocate a set of characters for [] + */ +static cset * +allocset(struct parse *p) +{ + int no = p->g->ncsets++; + size_t nc; + size_t nbytes; + cset *cs; + size_t css = (size_t)p->g->csetsize; + int i; + + if (no >= p->ncsalloc) { /* need another column of space */ + void *ptr; + + p->ncsalloc += CHAR_BIT; + nc = p->ncsalloc; + assert(nc % CHAR_BIT == 0); + nbytes = nc / CHAR_BIT * css; + + ptr = (cset *)realloc((char *)p->g->sets, nc * sizeof(cset)); + if (ptr == NULL) + goto nomem; + p->g->sets = ptr; + + ptr = (uch *)realloc((char *)p->g->setbits, nbytes); + if (ptr == NULL) + goto nomem; + p->g->setbits = ptr; + + for (i = 0; i < no; i++) + p->g->sets[i].ptr = p->g->setbits + css*(i/CHAR_BIT); + + (void) memset((char *)p->g->setbits + (nbytes - css), 0, css); + } + /* XXX should not happen */ + if (p->g->sets == NULL || p->g->setbits == NULL) + goto nomem; + + cs = &p->g->sets[no]; + cs->ptr = p->g->setbits + css*((no)/CHAR_BIT); + cs->mask = 1 << ((no) % CHAR_BIT); + cs->hash = 0; + cs->smultis = 0; + cs->multis = NULL; + + return(cs); +nomem: + free(p->g->sets); + p->g->sets = NULL; + free(p->g->setbits); + p->g->setbits = NULL; + + SETERROR(REG_ESPACE); + /* caller's responsibility not to do set ops */ + return(NULL); +} + +/* + - freeset - free a now-unused set + */ +static void +freeset(struct parse *p, cset *cs) +{ + size_t i; + cset *top = &p->g->sets[p->g->ncsets]; + size_t css = (size_t)p->g->csetsize; + + for (i = 0; i < css; i++) + CHsub(cs, i); + if (cs == top-1) /* recover only the easy case */ + p->g->ncsets--; +} + +/* + - freezeset - final processing on a set of characters + * + * The main task here is merging identical sets. This is usually a waste + * of time (although the hash code minimizes the overhead), but can win + * big if REG_ICASE is being used. REG_ICASE, by the way, is why the hash + * is done using addition rather than xor -- all ASCII [aA] sets xor to + * the same value! + */ +static int /* set number */ +freezeset(struct parse *p, cset *cs) +{ + uch h = cs->hash; + size_t i; + cset *top = &p->g->sets[p->g->ncsets]; + cset *cs2; + size_t css = (size_t)p->g->csetsize; + + /* look for an earlier one which is the same */ + for (cs2 = &p->g->sets[0]; cs2 < top; cs2++) + if (cs2->hash == h && cs2 != cs) { + /* maybe */ + for (i = 0; i < css; i++) + if (!!CHIN(cs2, i) != !!CHIN(cs, i)) + break; /* no */ + if (i == css) + break; /* yes */ + } + + if (cs2 < top) { /* found one */ + freeset(p, cs); + cs = cs2; + } + + return((int)(cs - p->g->sets)); +} + +/* + - firstch - return first character in a set (which must have at least one) + */ +static int /* character; there is no "none" value */ +firstch(struct parse *p, cset *cs) +{ + size_t i; + size_t css = (size_t)p->g->csetsize; + + for (i = 0; i < css; i++) + if (CHIN(cs, i)) + return((char)i); + assert(never); + return(0); /* arbitrary */ +} + +/* + - nch - number of characters in a set + */ +static int +nch(struct parse *p, cset *cs) +{ + size_t i; + size_t css = (size_t)p->g->csetsize; + int n = 0; + + for (i = 0; i < css; i++) + if (CHIN(cs, i)) + n++; + return(n); +} + +/* + - mcadd - add a collating element to a cset + */ +static void +mcadd( struct parse *p, cset *cs, const char *cp) +{ + size_t oldend = cs->smultis; + void *np; + + cs->smultis += strlen(cp) + 1; + np = realloc(cs->multis, cs->smultis); + if (np == NULL) { + if (cs->multis) + free(cs->multis); + cs->multis = NULL; + SETERROR(REG_ESPACE); + return; + } + cs->multis = np; + + llvm_strlcpy(cs->multis + oldend - 1, cp, cs->smultis - oldend + 1); +} + +/* + - mcinvert - invert the list of collating elements in a cset + * + * This would have to know the set of possibilities. Implementation + * is deferred. + */ +/* ARGSUSED */ +static void +mcinvert(struct parse *p, cset *cs) +{ + assert(cs->multis == NULL); /* xxx */ +} + +/* + - mccase - add case counterparts of the list of collating elements in a cset + * + * This would have to know the set of possibilities. Implementation + * is deferred. + */ +/* ARGSUSED */ +static void +mccase(struct parse *p, cset *cs) +{ + assert(cs->multis == NULL); /* xxx */ +} + +/* + - isinsets - is this character in any sets? + */ +static int /* predicate */ +isinsets(struct re_guts *g, int c) +{ + uch *col; + int i; + int ncols = (g->ncsets+(CHAR_BIT-1)) / CHAR_BIT; + unsigned uc = (uch)c; + + for (i = 0, col = g->setbits; i < ncols; i++, col += g->csetsize) + if (col[uc] != 0) + return(1); + return(0); +} + +/* + - samesets - are these two characters in exactly the same sets? + */ +static int /* predicate */ +samesets(struct re_guts *g, int c1, int c2) +{ + uch *col; + int i; + int ncols = (g->ncsets+(CHAR_BIT-1)) / CHAR_BIT; + unsigned uc1 = (uch)c1; + unsigned uc2 = (uch)c2; + + for (i = 0, col = g->setbits; i < ncols; i++, col += g->csetsize) + if (col[uc1] != col[uc2]) + return(0); + return(1); +} + +/* + - categorize - sort out character categories + */ +static void +categorize(struct parse *p, struct re_guts *g) +{ + cat_t *cats = g->categories; + int c; + int c2; + cat_t cat; + + /* avoid making error situations worse */ + if (p->error != 0) + return; + + for (c = CHAR_MIN; c <= CHAR_MAX; c++) + if (cats[c] == 0 && isinsets(g, c)) { + cat = g->ncategories++; + cats[c] = cat; + for (c2 = c+1; c2 <= CHAR_MAX; c2++) + if (cats[c2] == 0 && samesets(g, c, c2)) + cats[c2] = cat; + } +} + +/* + - dupl - emit a duplicate of a bunch of sops + */ +static sopno /* start of duplicate */ +dupl(struct parse *p, + sopno start, /* from here */ + sopno finish) /* to this less one */ +{ + sopno ret = HERE(); + sopno len = finish - start; + + assert(finish >= start); + if (len == 0) + return(ret); + enlarge(p, p->ssize + len); /* this many unexpected additions */ + assert(p->ssize >= p->slen + len); + (void) memmove((char *)(p->strip + p->slen), + (char *)(p->strip + start), (size_t)len*sizeof(sop)); + p->slen += len; + return(ret); +} + +/* + - doemit - emit a strip operator + * + * It might seem better to implement this as a macro with a function as + * hard-case backup, but it's just too big and messy unless there are + * some changes to the data structures. Maybe later. + */ +static void +doemit(struct parse *p, sop op, size_t opnd) +{ + /* avoid making error situations worse */ + if (p->error != 0) + return; + + /* deal with oversize operands ("can't happen", more or less) */ + assert(opnd < 1<slen >= p->ssize) + enlarge(p, (p->ssize+1) / 2 * 3); /* +50% */ + assert(p->slen < p->ssize); + + /* finally, it's all reduced to the easy case */ + p->strip[p->slen++] = SOP(op, opnd); +} + +/* + - doinsert - insert a sop into the strip + */ +static void +doinsert(struct parse *p, sop op, size_t opnd, sopno pos) +{ + sopno sn; + sop s; + int i; + + /* avoid making error situations worse */ + if (p->error != 0) + return; + + sn = HERE(); + EMIT(op, opnd); /* do checks, ensure space */ + assert(HERE() == sn+1); + s = p->strip[sn]; + + /* adjust paren pointers */ + assert(pos > 0); + for (i = 1; i < NPAREN; i++) { + if (p->pbegin[i] >= pos) { + p->pbegin[i]++; + } + if (p->pend[i] >= pos) { + p->pend[i]++; + } + } + + memmove((char *)&p->strip[pos+1], (char *)&p->strip[pos], + (HERE()-pos-1)*sizeof(sop)); + p->strip[pos] = s; +} + +/* + - dofwd - complete a forward reference + */ +static void +dofwd(struct parse *p, sopno pos, sop value) +{ + /* avoid making error situations worse */ + if (p->error != 0) + return; + + assert(value < 1<strip[pos] = OP(p->strip[pos]) | value; +} + +/* + - enlarge - enlarge the strip + */ +static void +enlarge(struct parse *p, sopno size) +{ + sop *sp; + + if (p->ssize >= size) + return; + + sp = (sop *)realloc(p->strip, size*sizeof(sop)); + if (sp == NULL) { + SETERROR(REG_ESPACE); + return; + } + p->strip = sp; + p->ssize = size; +} + +/* + - stripsnug - compact the strip + */ +static void +stripsnug(struct parse *p, struct re_guts *g) +{ + g->nstates = p->slen; + g->strip = (sop *)realloc((char *)p->strip, p->slen * sizeof(sop)); + if (g->strip == NULL) { + SETERROR(REG_ESPACE); + g->strip = p->strip; + } +} + +/* + - findmust - fill in must and mlen with longest mandatory literal string + * + * This algorithm could do fancy things like analyzing the operands of | + * for common subsequences. Someday. This code is simple and finds most + * of the interesting cases. + * + * Note that must and mlen got initialized during setup. + */ +static void +findmust(struct parse *p, struct re_guts *g) +{ + sop *scan; + sop *start = 0; /* start initialized in the default case, after that */ + sop *newstart = 0; /* newstart was initialized in the OCHAR case */ + sopno newlen; + sop s; + char *cp; + sopno i; + + /* avoid making error situations worse */ + if (p->error != 0) + return; + + /* find the longest OCHAR sequence in strip */ + newlen = 0; + scan = g->strip + 1; + do { + s = *scan++; + switch (OP(s)) { + case OCHAR: /* sequence member */ + if (newlen == 0) /* new sequence */ + newstart = scan - 1; + newlen++; + break; + case OPLUS_: /* things that don't break one */ + case OLPAREN: + case ORPAREN: + break; + case OQUEST_: /* things that must be skipped */ + case OCH_: + scan--; + do { + scan += OPND(s); + s = *scan; + /* assert() interferes w debug printouts */ + if (OP(s) != O_QUEST && OP(s) != O_CH && + OP(s) != OOR2) { + g->iflags |= REGEX_BAD; + return; + } + } while (OP(s) != O_QUEST && OP(s) != O_CH); + /* fallthrough */ + default: /* things that break a sequence */ + if (newlen > g->mlen) { /* ends one */ + start = newstart; + g->mlen = newlen; + } + newlen = 0; + break; + } + } while (OP(s) != OEND); + + if (g->mlen == 0) /* there isn't one */ + return; + + /* turn it into a character string */ + g->must = malloc((size_t)g->mlen + 1); + if (g->must == NULL) { /* argh; just forget it */ + g->mlen = 0; + return; + } + cp = g->must; + scan = start; + for (i = g->mlen; i > 0; i--) { + while (OP(s = *scan++) != OCHAR) + continue; + assert(cp < g->must + g->mlen); + *cp++ = (char)OPND(s); + } + assert(cp == g->must + g->mlen); + *cp++ = '\0'; /* just on general principles */ +} + +/* + - pluscount - count + nesting + */ +static sopno /* nesting depth */ +pluscount(struct parse *p, struct re_guts *g) +{ + sop *scan; + sop s; + sopno plusnest = 0; + sopno maxnest = 0; + + if (p->error != 0) + return(0); /* there may not be an OEND */ + + scan = g->strip + 1; + do { + s = *scan++; + switch (OP(s)) { + case OPLUS_: + plusnest++; + break; + case O_PLUS: + if (plusnest > maxnest) + maxnest = plusnest; + plusnest--; + break; + } + } while (OP(s) != OEND); + if (plusnest != 0) + g->iflags |= REGEX_BAD; + return(maxnest); +} diff --git a/libclamav/c++/llvm/lib/Support/regengine.inc b/libclamav/c++/llvm/lib/Support/regengine.inc new file mode 100644 index 000000000..ac848bcec --- /dev/null +++ b/libclamav/c++/llvm/lib/Support/regengine.inc @@ -0,0 +1,1021 @@ +/*- + * This code is derived from OpenBSD's libc/regex, original license follows: + * + * Copyright (c) 1992, 1993, 1994 Henry Spencer. + * Copyright (c) 1992, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Henry Spencer. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)engine.c 8.5 (Berkeley) 3/20/94 + */ + +/* + * The matching engine and friends. This file is #included by regexec.c + * after suitable #defines of a variety of macros used herein, so that + * different state representations can be used without duplicating masses + * of code. + */ + +#ifdef SNAMES +#define matcher smatcher +#define fast sfast +#define slow sslow +#define dissect sdissect +#define backref sbackref +#define step sstep +#define print sprint +#define at sat +#define match smat +#define nope snope +#endif +#ifdef LNAMES +#define matcher lmatcher +#define fast lfast +#define slow lslow +#define dissect ldissect +#define backref lbackref +#define step lstep +#define print lprint +#define at lat +#define match lmat +#define nope lnope +#endif + +/* another structure passed up and down to avoid zillions of parameters */ +struct match { + struct re_guts *g; + int eflags; + llvm_regmatch_t *pmatch; /* [nsub+1] (0 element unused) */ + char *offp; /* offsets work from here */ + char *beginp; /* start of string -- virtual NUL precedes */ + char *endp; /* end of string -- virtual NUL here */ + char *coldp; /* can be no match starting before here */ + char **lastpos; /* [nplus+1] */ + STATEVARS; + states st; /* current states */ + states fresh; /* states for a fresh start */ + states tmp; /* temporary */ + states empty; /* empty set of states */ +}; + +static int matcher(struct re_guts *, char *, size_t, llvm_regmatch_t[], int); +static char *dissect(struct match *, char *, char *, sopno, sopno); +static char *backref(struct match *, char *, char *, sopno, sopno, sopno, int); +static char *fast(struct match *, char *, char *, sopno, sopno); +static char *slow(struct match *, char *, char *, sopno, sopno); +static states step(struct re_guts *, sopno, sopno, states, int, states); +#define MAX_RECURSION 100 +#define BOL (OUT+1) +#define EOL (BOL+1) +#define BOLEOL (BOL+2) +#define NOTHING (BOL+3) +#define BOW (BOL+4) +#define EOW (BOL+5) +#define CODEMAX (BOL+5) /* highest code used */ +#define NONCHAR(c) ((c) > CHAR_MAX) +#define NNONCHAR (CODEMAX-CHAR_MAX) +#ifdef REDEBUG +static void print(struct match *, char *, states, int, FILE *); +#endif +#ifdef REDEBUG +static void at(struct match *, char *, char *, char *, sopno, sopno); +#endif +#ifdef REDEBUG +static char *pchar(int); +#endif + +#ifdef REDEBUG +#define SP(t, s, c) print(m, t, s, c, stdout) +#define AT(t, p1, p2, s1, s2) at(m, t, p1, p2, s1, s2) +#define NOTE(str) { if (m->eflags®_TRACE) (void)printf("=%s\n", (str)); } +static int nope = 0; +#else +#define SP(t, s, c) /* nothing */ +#define AT(t, p1, p2, s1, s2) /* nothing */ +#define NOTE(s) /* nothing */ +#endif + +/* + - matcher - the actual matching engine + */ +static int /* 0 success, REG_NOMATCH failure */ +matcher(struct re_guts *g, char *string, size_t nmatch, llvm_regmatch_t pmatch[], + int eflags) +{ + char *endp; + size_t i; + struct match mv; + struct match *m = &mv; + char *dp; + const sopno gf = g->firststate+1; /* +1 for OEND */ + const sopno gl = g->laststate; + char *start; + char *stop; + + /* simplify the situation where possible */ + if (g->cflags®_NOSUB) + nmatch = 0; + if (eflags®_STARTEND) { + start = string + pmatch[0].rm_so; + stop = string + pmatch[0].rm_eo; + } else { + start = string; + stop = start + strlen(start); + } + if (stop < start) + return(REG_INVARG); + + /* prescreening; this does wonders for this rather slow code */ + if (g->must != NULL) { + for (dp = start; dp < stop; dp++) + if (*dp == g->must[0] && stop - dp >= g->mlen && + memcmp(dp, g->must, (size_t)g->mlen) == 0) + break; + if (dp == stop) /* we didn't find g->must */ + return(REG_NOMATCH); + } + + /* match struct setup */ + m->g = g; + m->eflags = eflags; + m->pmatch = NULL; + m->lastpos = NULL; + m->offp = string; + m->beginp = start; + m->endp = stop; + STATESETUP(m, 4); + SETUP(m->st); + SETUP(m->fresh); + SETUP(m->tmp); + SETUP(m->empty); + CLEAR(m->empty); + + /* this loop does only one repetition except for backrefs */ + for (;;) { + endp = fast(m, start, stop, gf, gl); + if (endp == NULL) { /* a miss */ + free(m->pmatch); + free(m->lastpos); + STATETEARDOWN(m); + return(REG_NOMATCH); + } + if (nmatch == 0 && !g->backrefs) + break; /* no further info needed */ + + /* where? */ + assert(m->coldp != NULL); + for (;;) { + NOTE("finding start"); + endp = slow(m, m->coldp, stop, gf, gl); + if (endp != NULL) + break; + assert(m->coldp < m->endp); + m->coldp++; + } + if (nmatch == 1 && !g->backrefs) + break; /* no further info needed */ + + /* oh my, he wants the subexpressions... */ + if (m->pmatch == NULL) + m->pmatch = (llvm_regmatch_t *)malloc((m->g->nsub + 1) * + sizeof(llvm_regmatch_t)); + if (m->pmatch == NULL) { + STATETEARDOWN(m); + return(REG_ESPACE); + } + for (i = 1; i <= m->g->nsub; i++) + m->pmatch[i].rm_so = m->pmatch[i].rm_eo = -1; + if (!g->backrefs && !(m->eflags®_BACKR)) { + NOTE("dissecting"); + dp = dissect(m, m->coldp, endp, gf, gl); + } else { + if (g->nplus > 0 && m->lastpos == NULL) + m->lastpos = (char **)malloc((g->nplus+1) * + sizeof(char *)); + if (g->nplus > 0 && m->lastpos == NULL) { + free(m->pmatch); + STATETEARDOWN(m); + return(REG_ESPACE); + } + NOTE("backref dissect"); + dp = backref(m, m->coldp, endp, gf, gl, (sopno)0, 0); + } + if (dp != NULL) + break; + + /* uh-oh... we couldn't find a subexpression-level match */ + assert(g->backrefs); /* must be back references doing it */ + assert(g->nplus == 0 || m->lastpos != NULL); + for (;;) { + if (dp != NULL || endp <= m->coldp) + break; /* defeat */ + NOTE("backoff"); + endp = slow(m, m->coldp, endp-1, gf, gl); + if (endp == NULL) + break; /* defeat */ + /* try it on a shorter possibility */ +#ifndef NDEBUG + for (i = 1; i <= m->g->nsub; i++) { + assert(m->pmatch[i].rm_so == -1); + assert(m->pmatch[i].rm_eo == -1); + } +#endif + NOTE("backoff dissect"); + dp = backref(m, m->coldp, endp, gf, gl, (sopno)0, 0); + } + assert(dp == NULL || dp == endp); + if (dp != NULL) /* found a shorter one */ + break; + + /* despite initial appearances, there is no match here */ + NOTE("false alarm"); + if (m->coldp == stop) + break; + start = m->coldp + 1; /* recycle starting later */ + } + + /* fill in the details if requested */ + if (nmatch > 0) { + pmatch[0].rm_so = m->coldp - m->offp; + pmatch[0].rm_eo = endp - m->offp; + } + if (nmatch > 1) { + assert(m->pmatch != NULL); + for (i = 1; i < nmatch; i++) + if (i <= m->g->nsub) + pmatch[i] = m->pmatch[i]; + else { + pmatch[i].rm_so = -1; + pmatch[i].rm_eo = -1; + } + } + + if (m->pmatch != NULL) + free((char *)m->pmatch); + if (m->lastpos != NULL) + free((char *)m->lastpos); + STATETEARDOWN(m); + return(0); +} + +/* + - dissect - figure out what matched what, no back references + */ +static char * /* == stop (success) always */ +dissect(struct match *m, char *start, char *stop, sopno startst, sopno stopst) +{ + int i; + sopno ss; /* start sop of current subRE */ + sopno es; /* end sop of current subRE */ + char *sp; /* start of string matched by it */ + char *stp; /* string matched by it cannot pass here */ + char *rest; /* start of rest of string */ + char *tail; /* string unmatched by rest of RE */ + sopno ssub; /* start sop of subsubRE */ + sopno esub; /* end sop of subsubRE */ + char *ssp; /* start of string matched by subsubRE */ + char *sep; /* end of string matched by subsubRE */ + char *oldssp; /* previous ssp */ + char *dp; + + AT("diss", start, stop, startst, stopst); + sp = start; + for (ss = startst; ss < stopst; ss = es) { + /* identify end of subRE */ + es = ss; + switch (OP(m->g->strip[es])) { + case OPLUS_: + case OQUEST_: + es += OPND(m->g->strip[es]); + break; + case OCH_: + while (OP(m->g->strip[es]) != O_CH) + es += OPND(m->g->strip[es]); + break; + } + es++; + + /* figure out what it matched */ + switch (OP(m->g->strip[ss])) { + case OEND: + assert(nope); + break; + case OCHAR: + sp++; + break; + case OBOL: + case OEOL: + case OBOW: + case OEOW: + break; + case OANY: + case OANYOF: + sp++; + break; + case OBACK_: + case O_BACK: + assert(nope); + break; + /* cases where length of match is hard to find */ + case OQUEST_: + stp = stop; + for (;;) { + /* how long could this one be? */ + rest = slow(m, sp, stp, ss, es); + assert(rest != NULL); /* it did match */ + /* could the rest match the rest? */ + tail = slow(m, rest, stop, es, stopst); + if (tail == stop) + break; /* yes! */ + /* no -- try a shorter match for this one */ + stp = rest - 1; + assert(stp >= sp); /* it did work */ + } + ssub = ss + 1; + esub = es - 1; + /* did innards match? */ + if (slow(m, sp, rest, ssub, esub) != NULL) { + dp = dissect(m, sp, rest, ssub, esub); + assert(dp == rest); + } else /* no */ + assert(sp == rest); + sp = rest; + break; + case OPLUS_: + stp = stop; + for (;;) { + /* how long could this one be? */ + rest = slow(m, sp, stp, ss, es); + assert(rest != NULL); /* it did match */ + /* could the rest match the rest? */ + tail = slow(m, rest, stop, es, stopst); + if (tail == stop) + break; /* yes! */ + /* no -- try a shorter match for this one */ + stp = rest - 1; + assert(stp >= sp); /* it did work */ + } + ssub = ss + 1; + esub = es - 1; + ssp = sp; + oldssp = ssp; + for (;;) { /* find last match of innards */ + sep = slow(m, ssp, rest, ssub, esub); + if (sep == NULL || sep == ssp) + break; /* failed or matched null */ + oldssp = ssp; /* on to next try */ + ssp = sep; + } + if (sep == NULL) { + /* last successful match */ + sep = ssp; + ssp = oldssp; + } + assert(sep == rest); /* must exhaust substring */ + assert(slow(m, ssp, sep, ssub, esub) == rest); + dp = dissect(m, ssp, sep, ssub, esub); + assert(dp == sep); + sp = rest; + break; + case OCH_: + stp = stop; + for (;;) { + /* how long could this one be? */ + rest = slow(m, sp, stp, ss, es); + assert(rest != NULL); /* it did match */ + /* could the rest match the rest? */ + tail = slow(m, rest, stop, es, stopst); + if (tail == stop) + break; /* yes! */ + /* no -- try a shorter match for this one */ + stp = rest - 1; + assert(stp >= sp); /* it did work */ + } + ssub = ss + 1; + esub = ss + OPND(m->g->strip[ss]) - 1; + assert(OP(m->g->strip[esub]) == OOR1); + for (;;) { /* find first matching branch */ + if (slow(m, sp, rest, ssub, esub) == rest) + break; /* it matched all of it */ + /* that one missed, try next one */ + assert(OP(m->g->strip[esub]) == OOR1); + esub++; + assert(OP(m->g->strip[esub]) == OOR2); + ssub = esub + 1; + esub += OPND(m->g->strip[esub]); + if (OP(m->g->strip[esub]) == OOR2) + esub--; + else + assert(OP(m->g->strip[esub]) == O_CH); + } + dp = dissect(m, sp, rest, ssub, esub); + assert(dp == rest); + sp = rest; + break; + case O_PLUS: + case O_QUEST: + case OOR1: + case OOR2: + case O_CH: + assert(nope); + break; + case OLPAREN: + i = OPND(m->g->strip[ss]); + assert(0 < i && i <= m->g->nsub); + m->pmatch[i].rm_so = sp - m->offp; + break; + case ORPAREN: + i = OPND(m->g->strip[ss]); + assert(0 < i && i <= m->g->nsub); + m->pmatch[i].rm_eo = sp - m->offp; + break; + default: /* uh oh */ + assert(nope); + break; + } + } + + assert(sp == stop); + return(sp); +} + +/* + - backref - figure out what matched what, figuring in back references + */ +static char * /* == stop (success) or NULL (failure) */ +backref(struct match *m, char *start, char *stop, sopno startst, sopno stopst, + sopno lev, int rec) /* PLUS nesting level */ +{ + int i; + sopno ss; /* start sop of current subRE */ + char *sp; /* start of string matched by it */ + sopno ssub; /* start sop of subsubRE */ + sopno esub; /* end sop of subsubRE */ + char *ssp; /* start of string matched by subsubRE */ + char *dp; + size_t len; + int hard; + sop s; + llvm_regoff_t offsave; + cset *cs; + + AT("back", start, stop, startst, stopst); + sp = start; + + /* get as far as we can with easy stuff */ + hard = 0; + for (ss = startst; !hard && ss < stopst; ss++) + switch (OP(s = m->g->strip[ss])) { + case OCHAR: + if (sp == stop || *sp++ != (char)OPND(s)) + return(NULL); + break; + case OANY: + if (sp == stop) + return(NULL); + sp++; + break; + case OANYOF: + cs = &m->g->sets[OPND(s)]; + if (sp == stop || !CHIN(cs, *sp++)) + return(NULL); + break; + case OBOL: + if ( (sp == m->beginp && !(m->eflags®_NOTBOL)) || + (sp < m->endp && *(sp-1) == '\n' && + (m->g->cflags®_NEWLINE)) ) + { /* yes */ } + else + return(NULL); + break; + case OEOL: + if ( (sp == m->endp && !(m->eflags®_NOTEOL)) || + (sp < m->endp && *sp == '\n' && + (m->g->cflags®_NEWLINE)) ) + { /* yes */ } + else + return(NULL); + break; + case OBOW: + if (( (sp == m->beginp && !(m->eflags®_NOTBOL)) || + (sp < m->endp && *(sp-1) == '\n' && + (m->g->cflags®_NEWLINE)) || + (sp > m->beginp && + !ISWORD(*(sp-1))) ) && + (sp < m->endp && ISWORD(*sp)) ) + { /* yes */ } + else + return(NULL); + break; + case OEOW: + if (( (sp == m->endp && !(m->eflags®_NOTEOL)) || + (sp < m->endp && *sp == '\n' && + (m->g->cflags®_NEWLINE)) || + (sp < m->endp && !ISWORD(*sp)) ) && + (sp > m->beginp && ISWORD(*(sp-1))) ) + { /* yes */ } + else + return(NULL); + break; + case O_QUEST: + break; + case OOR1: /* matches null but needs to skip */ + ss++; + s = m->g->strip[ss]; + do { + assert(OP(s) == OOR2); + ss += OPND(s); + } while (OP(s = m->g->strip[ss]) != O_CH); + /* note that the ss++ gets us past the O_CH */ + break; + default: /* have to make a choice */ + hard = 1; + break; + } + if (!hard) { /* that was it! */ + if (sp != stop) + return(NULL); + return(sp); + } + ss--; /* adjust for the for's final increment */ + + /* the hard stuff */ + AT("hard", sp, stop, ss, stopst); + s = m->g->strip[ss]; + switch (OP(s)) { + case OBACK_: /* the vilest depths */ + i = OPND(s); + assert(0 < i && i <= m->g->nsub); + if (m->pmatch[i].rm_eo == -1) + return(NULL); + assert(m->pmatch[i].rm_so != -1); + len = m->pmatch[i].rm_eo - m->pmatch[i].rm_so; + if (len == 0 && rec++ > MAX_RECURSION) + return(NULL); + assert(stop - m->beginp >= len); + if (sp > stop - len) + return(NULL); /* not enough left to match */ + ssp = m->offp + m->pmatch[i].rm_so; + if (memcmp(sp, ssp, len) != 0) + return(NULL); + while (m->g->strip[ss] != SOP(O_BACK, i)) + ss++; + return(backref(m, sp+len, stop, ss+1, stopst, lev, rec)); + break; + case OQUEST_: /* to null or not */ + dp = backref(m, sp, stop, ss+1, stopst, lev, rec); + if (dp != NULL) + return(dp); /* not */ + return(backref(m, sp, stop, ss+OPND(s)+1, stopst, lev, rec)); + break; + case OPLUS_: + assert(m->lastpos != NULL); + assert(lev+1 <= m->g->nplus); + m->lastpos[lev+1] = sp; + return(backref(m, sp, stop, ss+1, stopst, lev+1, rec)); + break; + case O_PLUS: + if (sp == m->lastpos[lev]) /* last pass matched null */ + return(backref(m, sp, stop, ss+1, stopst, lev-1, rec)); + /* try another pass */ + m->lastpos[lev] = sp; + dp = backref(m, sp, stop, ss-OPND(s)+1, stopst, lev, rec); + if (dp == NULL) + return(backref(m, sp, stop, ss+1, stopst, lev-1, rec)); + else + return(dp); + break; + case OCH_: /* find the right one, if any */ + ssub = ss + 1; + esub = ss + OPND(s) - 1; + assert(OP(m->g->strip[esub]) == OOR1); + for (;;) { /* find first matching branch */ + dp = backref(m, sp, stop, ssub, esub, lev, rec); + if (dp != NULL) + return(dp); + /* that one missed, try next one */ + if (OP(m->g->strip[esub]) == O_CH) + return(NULL); /* there is none */ + esub++; + assert(OP(m->g->strip[esub]) == OOR2); + ssub = esub + 1; + esub += OPND(m->g->strip[esub]); + if (OP(m->g->strip[esub]) == OOR2) + esub--; + else + assert(OP(m->g->strip[esub]) == O_CH); + } + break; + case OLPAREN: /* must undo assignment if rest fails */ + i = OPND(s); + assert(0 < i && i <= m->g->nsub); + offsave = m->pmatch[i].rm_so; + m->pmatch[i].rm_so = sp - m->offp; + dp = backref(m, sp, stop, ss+1, stopst, lev, rec); + if (dp != NULL) + return(dp); + m->pmatch[i].rm_so = offsave; + return(NULL); + break; + case ORPAREN: /* must undo assignment if rest fails */ + i = OPND(s); + assert(0 < i && i <= m->g->nsub); + offsave = m->pmatch[i].rm_eo; + m->pmatch[i].rm_eo = sp - m->offp; + dp = backref(m, sp, stop, ss+1, stopst, lev, rec); + if (dp != NULL) + return(dp); + m->pmatch[i].rm_eo = offsave; + return(NULL); + break; + default: /* uh oh */ + assert(nope); + break; + } + + /* "can't happen" */ + assert(nope); + /* NOTREACHED */ + return NULL; +} + +/* + - fast - step through the string at top speed + */ +static char * /* where tentative match ended, or NULL */ +fast(struct match *m, char *start, char *stop, sopno startst, sopno stopst) +{ + states st = m->st; + states fresh = m->fresh; + states tmp = m->tmp; + char *p = start; + int c = (start == m->beginp) ? OUT : *(start-1); + int lastc; /* previous c */ + int flagch; + int i; + char *coldp; /* last p after which no match was underway */ + + CLEAR(st); + SET1(st, startst); + st = step(m->g, startst, stopst, st, NOTHING, st); + ASSIGN(fresh, st); + SP("start", st, *p); + coldp = NULL; + for (;;) { + /* next character */ + lastc = c; + c = (p == m->endp) ? OUT : *p; + if (EQ(st, fresh)) + coldp = p; + + /* is there an EOL and/or BOL between lastc and c? */ + flagch = '\0'; + i = 0; + if ( (lastc == '\n' && m->g->cflags®_NEWLINE) || + (lastc == OUT && !(m->eflags®_NOTBOL)) ) { + flagch = BOL; + i = m->g->nbol; + } + if ( (c == '\n' && m->g->cflags®_NEWLINE) || + (c == OUT && !(m->eflags®_NOTEOL)) ) { + flagch = (flagch == BOL) ? BOLEOL : EOL; + i += m->g->neol; + } + if (i != 0) { + for (; i > 0; i--) + st = step(m->g, startst, stopst, st, flagch, st); + SP("boleol", st, c); + } + + /* how about a word boundary? */ + if ( (flagch == BOL || (lastc != OUT && !ISWORD(lastc))) && + (c != OUT && ISWORD(c)) ) { + flagch = BOW; + } + if ( (lastc != OUT && ISWORD(lastc)) && + (flagch == EOL || (c != OUT && !ISWORD(c))) ) { + flagch = EOW; + } + if (flagch == BOW || flagch == EOW) { + st = step(m->g, startst, stopst, st, flagch, st); + SP("boweow", st, c); + } + + /* are we done? */ + if (ISSET(st, stopst) || p == stop) + break; /* NOTE BREAK OUT */ + + /* no, we must deal with this character */ + ASSIGN(tmp, st); + ASSIGN(st, fresh); + assert(c != OUT); + st = step(m->g, startst, stopst, tmp, c, st); + SP("aft", st, c); + assert(EQ(step(m->g, startst, stopst, st, NOTHING, st), st)); + p++; + } + + assert(coldp != NULL); + m->coldp = coldp; + if (ISSET(st, stopst)) + return(p+1); + else + return(NULL); +} + +/* + - slow - step through the string more deliberately + */ +static char * /* where it ended */ +slow(struct match *m, char *start, char *stop, sopno startst, sopno stopst) +{ + states st = m->st; + states empty = m->empty; + states tmp = m->tmp; + char *p = start; + int c = (start == m->beginp) ? OUT : *(start-1); + int lastc; /* previous c */ + int flagch; + int i; + char *matchp; /* last p at which a match ended */ + + AT("slow", start, stop, startst, stopst); + CLEAR(st); + SET1(st, startst); + SP("sstart", st, *p); + st = step(m->g, startst, stopst, st, NOTHING, st); + matchp = NULL; + for (;;) { + /* next character */ + lastc = c; + c = (p == m->endp) ? OUT : *p; + + /* is there an EOL and/or BOL between lastc and c? */ + flagch = '\0'; + i = 0; + if ( (lastc == '\n' && m->g->cflags®_NEWLINE) || + (lastc == OUT && !(m->eflags®_NOTBOL)) ) { + flagch = BOL; + i = m->g->nbol; + } + if ( (c == '\n' && m->g->cflags®_NEWLINE) || + (c == OUT && !(m->eflags®_NOTEOL)) ) { + flagch = (flagch == BOL) ? BOLEOL : EOL; + i += m->g->neol; + } + if (i != 0) { + for (; i > 0; i--) + st = step(m->g, startst, stopst, st, flagch, st); + SP("sboleol", st, c); + } + + /* how about a word boundary? */ + if ( (flagch == BOL || (lastc != OUT && !ISWORD(lastc))) && + (c != OUT && ISWORD(c)) ) { + flagch = BOW; + } + if ( (lastc != OUT && ISWORD(lastc)) && + (flagch == EOL || (c != OUT && !ISWORD(c))) ) { + flagch = EOW; + } + if (flagch == BOW || flagch == EOW) { + st = step(m->g, startst, stopst, st, flagch, st); + SP("sboweow", st, c); + } + + /* are we done? */ + if (ISSET(st, stopst)) + matchp = p; + if (EQ(st, empty) || p == stop) + break; /* NOTE BREAK OUT */ + + /* no, we must deal with this character */ + ASSIGN(tmp, st); + ASSIGN(st, empty); + assert(c != OUT); + st = step(m->g, startst, stopst, tmp, c, st); + SP("saft", st, c); + assert(EQ(step(m->g, startst, stopst, st, NOTHING, st), st)); + p++; + } + + return(matchp); +} + + +/* + - step - map set of states reachable before char to set reachable after + */ +static states +step(struct re_guts *g, + sopno start, /* start state within strip */ + sopno stop, /* state after stop state within strip */ + states bef, /* states reachable before */ + int ch, /* character or NONCHAR code */ + states aft) /* states already known reachable after */ +{ + cset *cs; + sop s; + sopno pc; + onestate here; /* note, macros know this name */ + sopno look; + int i; + + for (pc = start, INIT(here, pc); pc != stop; pc++, INC(here)) { + s = g->strip[pc]; + switch (OP(s)) { + case OEND: + assert(pc == stop-1); + break; + case OCHAR: + /* only characters can match */ + assert(!NONCHAR(ch) || ch != (char)OPND(s)); + if (ch == (char)OPND(s)) + FWD(aft, bef, 1); + break; + case OBOL: + if (ch == BOL || ch == BOLEOL) + FWD(aft, bef, 1); + break; + case OEOL: + if (ch == EOL || ch == BOLEOL) + FWD(aft, bef, 1); + break; + case OBOW: + if (ch == BOW) + FWD(aft, bef, 1); + break; + case OEOW: + if (ch == EOW) + FWD(aft, bef, 1); + break; + case OANY: + if (!NONCHAR(ch)) + FWD(aft, bef, 1); + break; + case OANYOF: + cs = &g->sets[OPND(s)]; + if (!NONCHAR(ch) && CHIN(cs, ch)) + FWD(aft, bef, 1); + break; + case OBACK_: /* ignored here */ + case O_BACK: + FWD(aft, aft, 1); + break; + case OPLUS_: /* forward, this is just an empty */ + FWD(aft, aft, 1); + break; + case O_PLUS: /* both forward and back */ + FWD(aft, aft, 1); + i = ISSETBACK(aft, OPND(s)); + BACK(aft, aft, OPND(s)); + if (!i && ISSETBACK(aft, OPND(s))) { + /* oho, must reconsider loop body */ + pc -= OPND(s) + 1; + INIT(here, pc); + } + break; + case OQUEST_: /* two branches, both forward */ + FWD(aft, aft, 1); + FWD(aft, aft, OPND(s)); + break; + case O_QUEST: /* just an empty */ + FWD(aft, aft, 1); + break; + case OLPAREN: /* not significant here */ + case ORPAREN: + FWD(aft, aft, 1); + break; + case OCH_: /* mark the first two branches */ + FWD(aft, aft, 1); + assert(OP(g->strip[pc+OPND(s)]) == OOR2); + FWD(aft, aft, OPND(s)); + break; + case OOR1: /* done a branch, find the O_CH */ + if (ISSTATEIN(aft, here)) { + for (look = 1; + OP(s = g->strip[pc+look]) != O_CH; + look += OPND(s)) + assert(OP(s) == OOR2); + FWD(aft, aft, look); + } + break; + case OOR2: /* propagate OCH_'s marking */ + FWD(aft, aft, 1); + if (OP(g->strip[pc+OPND(s)]) != O_CH) { + assert(OP(g->strip[pc+OPND(s)]) == OOR2); + FWD(aft, aft, OPND(s)); + } + break; + case O_CH: /* just empty */ + FWD(aft, aft, 1); + break; + default: /* ooooops... */ + assert(nope); + break; + } + } + + return(aft); +} + +#ifdef REDEBUG +/* + - print - print a set of states + */ +static void +print(struct match *m, char *caption, states st, int ch, FILE *d) +{ + struct re_guts *g = m->g; + int i; + int first = 1; + + if (!(m->eflags®_TRACE)) + return; + + (void)fprintf(d, "%s", caption); + if (ch != '\0') + (void)fprintf(d, " %s", pchar(ch)); + for (i = 0; i < g->nstates; i++) + if (ISSET(st, i)) { + (void)fprintf(d, "%s%d", (first) ? "\t" : ", ", i); + first = 0; + } + (void)fprintf(d, "\n"); +} + +/* + - at - print current situation + */ +static void +at(struct match *m, char *title, char *start, char *stop, sopno startst, + sopno stopst) +{ + if (!(m->eflags®_TRACE)) + return; + + (void)printf("%s %s-", title, pchar(*start)); + (void)printf("%s ", pchar(*stop)); + (void)printf("%ld-%ld\n", (long)startst, (long)stopst); +} + +#ifndef PCHARDONE +#define PCHARDONE /* never again */ +/* + - pchar - make a character printable + * + * Is this identical to regchar() over in debug.c? Well, yes. But a + * duplicate here avoids having a debugging-capable regexec.o tied to + * a matching debug.o, and this is convenient. It all disappears in + * the non-debug compilation anyway, so it doesn't matter much. + */ +static char * /* -> representation */ +pchar(int ch) +{ + static char pbuf[10]; + + if (isprint(ch) || ch == ' ') + (void)snprintf(pbuf, sizeof pbuf, "%c", ch); + else + (void)snprintf(pbuf, sizeof pbuf, "\\%o", ch); + return(pbuf); +} +#endif +#endif + +#undef matcher +#undef fast +#undef slow +#undef dissect +#undef backref +#undef step +#undef print +#undef at +#undef match +#undef nope diff --git a/libclamav/c++/llvm/lib/Support/regerror.c b/libclamav/c++/llvm/lib/Support/regerror.c new file mode 100644 index 000000000..88d33b886 --- /dev/null +++ b/libclamav/c++/llvm/lib/Support/regerror.c @@ -0,0 +1,131 @@ +/*- + * This code is derived from OpenBSD's libc/regex, original license follows: + * + * Copyright (c) 1992, 1993, 1994 Henry Spencer. + * Copyright (c) 1992, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Henry Spencer. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)regerror.c 8.4 (Berkeley) 3/20/94 + */ + +#include +#include +#include +#include +#include +#include +#include "regex_impl.h" + +#include "regutils.h" + +static const char *regatoi(const llvm_regex_t *, char *, int); + +static struct rerr { + int code; + const char *name; + const char *explain; +} rerrs[] = { + { REG_NOMATCH, "REG_NOMATCH", "llvm_regexec() failed to match" }, + { REG_BADPAT, "REG_BADPAT", "invalid regular expression" }, + { REG_ECOLLATE, "REG_ECOLLATE", "invalid collating element" }, + { REG_ECTYPE, "REG_ECTYPE", "invalid character class" }, + { REG_EESCAPE, "REG_EESCAPE", "trailing backslash (\\)" }, + { REG_ESUBREG, "REG_ESUBREG", "invalid backreference number" }, + { REG_EBRACK, "REG_EBRACK", "brackets ([ ]) not balanced" }, + { REG_EPAREN, "REG_EPAREN", "parentheses not balanced" }, + { REG_EBRACE, "REG_EBRACE", "braces not balanced" }, + { REG_BADBR, "REG_BADBR", "invalid repetition count(s)" }, + { REG_ERANGE, "REG_ERANGE", "invalid character range" }, + { REG_ESPACE, "REG_ESPACE", "out of memory" }, + { REG_BADRPT, "REG_BADRPT", "repetition-operator operand invalid" }, + { REG_EMPTY, "REG_EMPTY", "empty (sub)expression" }, + { REG_ASSERT, "REG_ASSERT", "\"can't happen\" -- you found a bug" }, + { REG_INVARG, "REG_INVARG", "invalid argument to regex routine" }, + { 0, "", "*** unknown regexp error code ***" } +}; + +/* + - llvm_regerror - the interface to error numbers + = extern size_t llvm_regerror(int, const llvm_regex_t *, char *, size_t); + */ +/* ARGSUSED */ +size_t +llvm_regerror(int errcode, const llvm_regex_t *preg, char *errbuf, size_t errbuf_size) +{ + struct rerr *r; + size_t len; + int target = errcode &~ REG_ITOA; + const char *s; + char convbuf[50]; + + if (errcode == REG_ATOI) + s = regatoi(preg, convbuf, sizeof convbuf); + else { + for (r = rerrs; r->code != 0; r++) + if (r->code == target) + break; + + if (errcode®_ITOA) { + if (r->code != 0) { + assert(strlen(r->name) < sizeof(convbuf)); + (void) llvm_strlcpy(convbuf, r->name, sizeof convbuf); + } else + (void)snprintf(convbuf, sizeof convbuf, + "REG_0x%x", target); + s = convbuf; + } else + s = r->explain; + } + + len = strlen(s) + 1; + if (errbuf_size > 0) { + llvm_strlcpy(errbuf, s, errbuf_size); + } + + return(len); +} + +/* + - regatoi - internal routine to implement REG_ATOI + */ +static const char * +regatoi(const llvm_regex_t *preg, char *localbuf, int localbufsize) +{ + struct rerr *r; + + for (r = rerrs; r->code != 0; r++) + if (strcmp(r->name, preg->re_endp) == 0) + break; + if (r->code == 0) + return("0"); + + (void)snprintf(localbuf, localbufsize, "%d", r->code); + return(localbuf); +} diff --git a/libclamav/c++/llvm/lib/Support/regex2.h b/libclamav/c++/llvm/lib/Support/regex2.h new file mode 100644 index 000000000..21659c344 --- /dev/null +++ b/libclamav/c++/llvm/lib/Support/regex2.h @@ -0,0 +1,157 @@ +/*- + * This code is derived from OpenBSD's libc/regex, original license follows: + * + * Copyright (c) 1992, 1993, 1994 Henry Spencer. + * Copyright (c) 1992, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Henry Spencer. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)regex2.h 8.4 (Berkeley) 3/20/94 + */ + +/* + * internals of regex_t + */ +#define MAGIC1 ((('r'^0200)<<8) | 'e') + +/* + * The internal representation is a *strip*, a sequence of + * operators ending with an endmarker. (Some terminology etc. is a + * historical relic of earlier versions which used multiple strips.) + * Certain oddities in the representation are there to permit running + * the machinery backwards; in particular, any deviation from sequential + * flow must be marked at both its source and its destination. Some + * fine points: + * + * - OPLUS_ and O_PLUS are *inside* the loop they create. + * - OQUEST_ and O_QUEST are *outside* the bypass they create. + * - OCH_ and O_CH are *outside* the multi-way branch they create, while + * OOR1 and OOR2 are respectively the end and the beginning of one of + * the branches. Note that there is an implicit OOR2 following OCH_ + * and an implicit OOR1 preceding O_CH. + * + * In state representations, an operator's bit is on to signify a state + * immediately *preceding* "execution" of that operator. + */ +typedef unsigned long sop; /* strip operator */ +typedef long sopno; +#define OPRMASK 0xf8000000LU +#define OPDMASK 0x07ffffffLU +#define OPSHIFT ((unsigned)27) +#define OP(n) ((n)&OPRMASK) +#define OPND(n) ((n)&OPDMASK) +#define SOP(op, opnd) ((op)|(opnd)) +/* operators meaning operand */ +/* (back, fwd are offsets) */ +#define OEND (1LU< uch [csetsize] */ + uch mask; /* bit within array */ + uch hash; /* hash code */ + size_t smultis; + char *multis; /* -> char[smulti] ab\0cd\0ef\0\0 */ +} cset; +/* note that CHadd and CHsub are unsafe, and CHIN doesn't yield 0/1 */ +#define CHadd(cs, c) ((cs)->ptr[(uch)(c)] |= (cs)->mask, (cs)->hash += (c)) +#define CHsub(cs, c) ((cs)->ptr[(uch)(c)] &= ~(cs)->mask, (cs)->hash -= (c)) +#define CHIN(cs, c) ((cs)->ptr[(uch)(c)] & (cs)->mask) +#define MCadd(p, cs, cp) mcadd(p, cs, cp) /* llvm_regcomp() internal fns */ +#define MCsub(p, cs, cp) mcsub(p, cs, cp) +#define MCin(p, cs, cp) mcin(p, cs, cp) + +/* stuff for character categories */ +typedef unsigned char cat_t; + +/* + * main compiled-expression structure + */ +struct re_guts { + int magic; +# define MAGIC2 ((('R'^0200)<<8)|'E') + sop *strip; /* malloced area for strip */ + int csetsize; /* number of bits in a cset vector */ + int ncsets; /* number of csets in use */ + cset *sets; /* -> cset [ncsets] */ + uch *setbits; /* -> uch[csetsize][ncsets/CHAR_BIT] */ + int cflags; /* copy of llvm_regcomp() cflags argument */ + sopno nstates; /* = number of sops */ + sopno firststate; /* the initial OEND (normally 0) */ + sopno laststate; /* the final OEND */ + int iflags; /* internal flags */ +# define USEBOL 01 /* used ^ */ +# define USEEOL 02 /* used $ */ +# define REGEX_BAD 04 /* something wrong */ + int nbol; /* number of ^ used */ + int neol; /* number of $ used */ + int ncategories; /* how many character categories */ + cat_t *categories; /* ->catspace[-CHAR_MIN] */ + char *must; /* match must contain this string */ + int mlen; /* length of must */ + size_t nsub; /* copy of re_nsub */ + int backrefs; /* does it use back references? */ + sopno nplus; /* how deep does it nest +s? */ + /* catspace must be last */ + cat_t catspace[1]; /* actually [NC] */ +}; + +/* misc utilities */ +#define OUT (CHAR_MAX+1) /* a non-character value */ +#define ISWORD(c) (isalnum(c&0xff) || (c) == '_') diff --git a/libclamav/c++/llvm/lib/Support/regex_impl.h b/libclamav/c++/llvm/lib/Support/regex_impl.h new file mode 100644 index 000000000..f8296c9ff --- /dev/null +++ b/libclamav/c++/llvm/lib/Support/regex_impl.h @@ -0,0 +1,108 @@ +/*- + * This code is derived from OpenBSD's libc/regex, original license follows: + * + * Copyright (c) 1992 Henry Spencer. + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Henry Spencer of the University of Toronto. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)regex.h 8.1 (Berkeley) 6/2/93 + */ + +#ifndef _REGEX_H_ +#define _REGEX_H_ + +#include +typedef off_t llvm_regoff_t; +typedef struct { + llvm_regoff_t rm_so; /* start of match */ + llvm_regoff_t rm_eo; /* end of match */ +} llvm_regmatch_t; + +typedef struct llvm_regex { + int re_magic; + size_t re_nsub; /* number of parenthesized subexpressions */ + const char *re_endp; /* end pointer for REG_PEND */ + struct re_guts *re_g; /* none of your business :-) */ +} llvm_regex_t; + +/* llvm_regcomp() flags */ +#define REG_BASIC 0000 +#define REG_EXTENDED 0001 +#define REG_ICASE 0002 +#define REG_NOSUB 0004 +#define REG_NEWLINE 0010 +#define REG_NOSPEC 0020 +#define REG_PEND 0040 +#define REG_DUMP 0200 + +/* llvm_regerror() flags */ +#define REG_NOMATCH 1 +#define REG_BADPAT 2 +#define REG_ECOLLATE 3 +#define REG_ECTYPE 4 +#define REG_EESCAPE 5 +#define REG_ESUBREG 6 +#define REG_EBRACK 7 +#define REG_EPAREN 8 +#define REG_EBRACE 9 +#define REG_BADBR 10 +#define REG_ERANGE 11 +#define REG_ESPACE 12 +#define REG_BADRPT 13 +#define REG_EMPTY 14 +#define REG_ASSERT 15 +#define REG_INVARG 16 +#define REG_ATOI 255 /* convert name to number (!) */ +#define REG_ITOA 0400 /* convert number to name (!) */ + +/* llvm_regexec() flags */ +#define REG_NOTBOL 00001 +#define REG_NOTEOL 00002 +#define REG_STARTEND 00004 +#define REG_TRACE 00400 /* tracing of execution */ +#define REG_LARGE 01000 /* force large representation */ +#define REG_BACKR 02000 /* force use of backref code */ + +#ifdef __cplusplus +extern "C" { +#endif + +int llvm_regcomp(llvm_regex_t *, const char *, int); +size_t llvm_regerror(int, const llvm_regex_t *, char *, size_t); +int llvm_regexec(const llvm_regex_t *, const char *, size_t, + llvm_regmatch_t [], int); +void llvm_regfree(llvm_regex_t *); +size_t llvm_strlcpy(char *dst, const char *src, size_t siz); + +#ifdef __cplusplus +} +#endif + +#endif /* !_REGEX_H_ */ diff --git a/libclamav/c++/llvm/lib/Support/regexec.c b/libclamav/c++/llvm/lib/Support/regexec.c new file mode 100644 index 000000000..7d70f6e16 --- /dev/null +++ b/libclamav/c++/llvm/lib/Support/regexec.c @@ -0,0 +1,161 @@ +/*- + * This code is derived from OpenBSD's libc/regex, original license follows: + * + * Copyright (c) 1992, 1993, 1994 Henry Spencer. + * Copyright (c) 1992, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Henry Spencer. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)regexec.c 8.3 (Berkeley) 3/20/94 + */ + +/* + * the outer shell of llvm_regexec() + * + * This file includes engine.inc *twice*, after muchos fiddling with the + * macros that code uses. This lets the same code operate on two different + * representations for state sets. + */ +#include +#include +#include +#include +#include +#include +#include "regex_impl.h" + +#include "regutils.h" +#include "regex2.h" + +/* macros for manipulating states, small version */ +#define states long +#define states1 states /* for later use in llvm_regexec() decision */ +#define CLEAR(v) ((v) = 0) +#define SET0(v, n) ((v) &= ~((unsigned long)1 << (n))) +#define SET1(v, n) ((v) |= (unsigned long)1 << (n)) +#define ISSET(v, n) (((v) & ((unsigned long)1 << (n))) != 0) +#define ASSIGN(d, s) ((d) = (s)) +#define EQ(a, b) ((a) == (b)) +#define STATEVARS long dummy /* dummy version */ +#define STATESETUP(m, n) /* nothing */ +#define STATETEARDOWN(m) /* nothing */ +#define SETUP(v) ((v) = 0) +#define onestate long +#define INIT(o, n) ((o) = (unsigned long)1 << (n)) +#define INC(o) ((o) <<= 1) +#define ISSTATEIN(v, o) (((v) & (o)) != 0) +/* some abbreviations; note that some of these know variable names! */ +/* do "if I'm here, I can also be there" etc without branches */ +#define FWD(dst, src, n) ((dst) |= ((unsigned long)(src)&(here)) << (n)) +#define BACK(dst, src, n) ((dst) |= ((unsigned long)(src)&(here)) >> (n)) +#define ISSETBACK(v, n) (((v) & ((unsigned long)here >> (n))) != 0) +/* function names */ +#define SNAMES /* engine.inc looks after details */ + +#include "regengine.inc" + +/* now undo things */ +#undef states +#undef CLEAR +#undef SET0 +#undef SET1 +#undef ISSET +#undef ASSIGN +#undef EQ +#undef STATEVARS +#undef STATESETUP +#undef STATETEARDOWN +#undef SETUP +#undef onestate +#undef INIT +#undef INC +#undef ISSTATEIN +#undef FWD +#undef BACK +#undef ISSETBACK +#undef SNAMES + +/* macros for manipulating states, large version */ +#define states char * +#define CLEAR(v) memset(v, 0, m->g->nstates) +#define SET0(v, n) ((v)[n] = 0) +#define SET1(v, n) ((v)[n] = 1) +#define ISSET(v, n) ((v)[n]) +#define ASSIGN(d, s) memmove(d, s, m->g->nstates) +#define EQ(a, b) (memcmp(a, b, m->g->nstates) == 0) +#define STATEVARS long vn; char *space +#define STATESETUP(m, nv) { (m)->space = malloc((nv)*(m)->g->nstates); \ + if ((m)->space == NULL) return(REG_ESPACE); \ + (m)->vn = 0; } +#define STATETEARDOWN(m) { free((m)->space); } +#define SETUP(v) ((v) = &m->space[m->vn++ * m->g->nstates]) +#define onestate long +#define INIT(o, n) ((o) = (n)) +#define INC(o) ((o)++) +#define ISSTATEIN(v, o) ((v)[o]) +/* some abbreviations; note that some of these know variable names! */ +/* do "if I'm here, I can also be there" etc without branches */ +#define FWD(dst, src, n) ((dst)[here+(n)] |= (src)[here]) +#define BACK(dst, src, n) ((dst)[here-(n)] |= (src)[here]) +#define ISSETBACK(v, n) ((v)[here - (n)]) +/* function names */ +#define LNAMES /* flag */ + +#include "regengine.inc" + +/* + - llvm_regexec - interface for matching + * + * We put this here so we can exploit knowledge of the state representation + * when choosing which matcher to call. Also, by this point the matchers + * have been prototyped. + */ +int /* 0 success, REG_NOMATCH failure */ +llvm_regexec(const llvm_regex_t *preg, const char *string, size_t nmatch, + llvm_regmatch_t pmatch[], int eflags) +{ + struct re_guts *g = preg->re_g; +#ifdef REDEBUG +# define GOODFLAGS(f) (f) +#else +# define GOODFLAGS(f) ((f)&(REG_NOTBOL|REG_NOTEOL|REG_STARTEND)) +#endif + + if (preg->re_magic != MAGIC1 || g->magic != MAGIC2) + return(REG_BADPAT); + assert(!(g->iflags®EX_BAD)); + if (g->iflags®EX_BAD) /* backstop for no-debug case */ + return(REG_BADPAT); + eflags = GOODFLAGS(eflags); + + if (g->nstates <= (long)(CHAR_BIT*sizeof(states1)) && !(eflags®_LARGE)) + return(smatcher(g, (char *)string, nmatch, pmatch, eflags)); + else + return(lmatcher(g, (char *)string, nmatch, pmatch, eflags)); +} diff --git a/libclamav/c++/llvm/lib/Support/regfree.c b/libclamav/c++/llvm/lib/Support/regfree.c new file mode 100644 index 000000000..dc2b4af90 --- /dev/null +++ b/libclamav/c++/llvm/lib/Support/regfree.c @@ -0,0 +1,72 @@ +/*- + * This code is derived from OpenBSD's libc/regex, original license follows: + * + * Copyright (c) 1992, 1993, 1994 Henry Spencer. + * Copyright (c) 1992, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Henry Spencer. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)regfree.c 8.3 (Berkeley) 3/20/94 + */ + +#include +#include +#include +#include "regex_impl.h" + +#include "regutils.h" +#include "regex2.h" + +/* + - llvm_regfree - free everything + */ +void +llvm_regfree(llvm_regex_t *preg) +{ + struct re_guts *g; + + if (preg->re_magic != MAGIC1) /* oops */ + return; /* nice to complain, but hard */ + + g = preg->re_g; + if (g == NULL || g->magic != MAGIC2) /* oops again */ + return; + preg->re_magic = 0; /* mark it invalid */ + g->magic = 0; /* mark it invalid */ + + if (g->strip != NULL) + free((char *)g->strip); + if (g->sets != NULL) + free((char *)g->sets); + if (g->setbits != NULL) + free((char *)g->setbits); + if (g->must != NULL) + free(g->must); + free((char *)g); +} diff --git a/libclamav/c++/llvm/lib/Support/regstrlcpy.c b/libclamav/c++/llvm/lib/Support/regstrlcpy.c new file mode 100644 index 000000000..8b68afdf7 --- /dev/null +++ b/libclamav/c++/llvm/lib/Support/regstrlcpy.c @@ -0,0 +1,52 @@ +/* + * This code is derived from OpenBSD's libc, original license follows: + * + * Copyright (c) 1998 Todd C. Miller + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include +#include + +#include "regex_impl.h" +/* + * Copy src to string dst of size siz. At most siz-1 characters + * will be copied. Always NUL terminates (unless siz == 0). + * Returns strlen(src); if retval >= siz, truncation occurred. + */ +size_t +llvm_strlcpy(char *dst, const char *src, size_t siz) +{ + char *d = dst; + const char *s = src; + size_t n = siz; + + /* Copy as many bytes as will fit */ + if (n != 0) { + while (--n != 0) { + if ((*d++ = *s++) == '\0') + break; + } + } + + /* Not enough room in dst, add NUL and traverse rest of src */ + if (n == 0) { + if (siz != 0) + *d = '\0'; /* NUL-terminate dst */ + while (*s++) + ; + } + + return(s - src - 1); /* count does not include NUL */ +} diff --git a/libclamav/c++/llvm/lib/Support/regutils.h b/libclamav/c++/llvm/lib/Support/regutils.h new file mode 100644 index 000000000..7150a3f08 --- /dev/null +++ b/libclamav/c++/llvm/lib/Support/regutils.h @@ -0,0 +1,55 @@ +/*- + * This code is derived from OpenBSD's libc/regex, original license follows: + * + * Copyright (c) 1992, 1993, 1994 Henry Spencer. + * Copyright (c) 1992, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Henry Spencer. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)utils.h 8.3 (Berkeley) 3/20/94 + */ + +/* utility definitions */ +#define DUPMAX _POSIX2_RE_DUP_MAX /* xxx is this right? */ +#define INFINITY (DUPMAX + 1) +#define NC (CHAR_MAX - CHAR_MIN + 1) +typedef unsigned char uch; + +/* switch off assertions (if not already off) if no REDEBUG */ +#ifndef REDEBUG +#ifndef NDEBUG +#define NDEBUG /* no assertions please */ +#endif +#endif +#include + +/* for old systems with bcopy() but no memmove() */ +#ifdef USEBCOPY +#define memmove(d, s, c) bcopy(s, d, c) +#endif diff --git a/libclamav/c++/llvm/lib/System/DynamicLibrary.cpp b/libclamav/c++/llvm/lib/System/DynamicLibrary.cpp index 669422c84..6efab948f 100644 --- a/libclamav/c++/llvm/lib/System/DynamicLibrary.cpp +++ b/libclamav/c++/llvm/lib/System/DynamicLibrary.cpp @@ -25,6 +25,13 @@ // Collection of symbol name/value pairs to be searched prior to any libraries. static std::map *ExplicitSymbols = 0; +static struct ExplicitSymbolsDeleter { + ~ExplicitSymbolsDeleter() { + if (ExplicitSymbols) + delete ExplicitSymbols; + } +} Dummy; + void llvm::sys::DynamicLibrary::AddSymbol(const char* symbolName, void *symbolValue) { if (ExplicitSymbols == 0) diff --git a/libclamav/c++/llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp b/libclamav/c++/llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp index d5ceedb1e..142c3f1a4 100644 --- a/libclamav/c++/llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp +++ b/libclamav/c++/llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp @@ -893,9 +893,9 @@ void llvm::emitARMRegPlusImmediate(MachineBasicBlock &MBB, } } -int llvm::rewriteARMFrameIndex(MachineInstr &MI, unsigned FrameRegIdx, - unsigned FrameReg, int Offset, - const ARMBaseInstrInfo &TII) { +bool llvm::rewriteARMFrameIndex(MachineInstr &MI, unsigned FrameRegIdx, + unsigned FrameReg, int &Offset, + const ARMBaseInstrInfo &TII) { unsigned Opcode = MI.getOpcode(); const TargetInstrDesc &Desc = MI.getDesc(); unsigned AddrMode = (Desc.TSFlags & ARMII::AddrModeMask); @@ -912,7 +912,8 @@ int llvm::rewriteARMFrameIndex(MachineInstr &MI, unsigned FrameRegIdx, MI.setDesc(TII.get(ARM::MOVr)); MI.getOperand(FrameRegIdx).ChangeToRegister(FrameReg, false); MI.RemoveOperand(FrameRegIdx+1); - return 0; + Offset = 0; + return true; } else if (Offset < 0) { Offset = -Offset; isSub = true; @@ -924,7 +925,8 @@ int llvm::rewriteARMFrameIndex(MachineInstr &MI, unsigned FrameRegIdx, // Replace the FrameIndex with sp / fp MI.getOperand(FrameRegIdx).ChangeToRegister(FrameReg, false); MI.getOperand(FrameRegIdx+1).ChangeToImmediate(Offset); - return 0; + Offset = 0; + return true; } // Otherwise, pull as much of the immedidate into this ADDri/SUBri @@ -962,7 +964,8 @@ int llvm::rewriteARMFrameIndex(MachineInstr &MI, unsigned FrameRegIdx, break; } case ARMII::AddrMode4: - break; + // Can't fold any offset even if it's zero. + return false; case ARMII::AddrMode5: { ImmIdx = FrameRegIdx+1; InstrOffs = ARM_AM::getAM5Offset(MI.getOperand(ImmIdx).getImm()); @@ -996,7 +999,8 @@ int llvm::rewriteARMFrameIndex(MachineInstr &MI, unsigned FrameRegIdx, if (isSub) ImmedOffset |= 1 << NumBits; ImmOp.ChangeToImmediate(ImmedOffset); - return 0; + Offset = 0; + return true; } // Otherwise, it didn't fit. Pull in what we can to simplify the immed. @@ -1008,5 +1012,6 @@ int llvm::rewriteARMFrameIndex(MachineInstr &MI, unsigned FrameRegIdx, } } - return (isSub) ? -Offset : Offset; + Offset = (isSub) ? -Offset : Offset; + return Offset == 0; } diff --git a/libclamav/c++/llvm/lib/Target/ARM/ARMBaseInstrInfo.h b/libclamav/c++/llvm/lib/Target/ARM/ARMBaseInstrInfo.h index f4d1ef373..3632450ed 100644 --- a/libclamav/c++/llvm/lib/Target/ARM/ARMBaseInstrInfo.h +++ b/libclamav/c++/llvm/lib/Target/ARM/ARMBaseInstrInfo.h @@ -317,15 +317,16 @@ void emitT2RegPlusImmediate(MachineBasicBlock &MBB, /// rewriteARMFrameIndex / rewriteT2FrameIndex - -/// Rewrite MI to access 'Offset' bytes from the FP. Return the offset that -/// could not be handled directly in MI. -int rewriteARMFrameIndex(MachineInstr &MI, unsigned FrameRegIdx, - unsigned FrameReg, int Offset, - const ARMBaseInstrInfo &TII); +/// Rewrite MI to access 'Offset' bytes from the FP. Return false if the +/// offset could not be handled directly in MI, and return the left-over +/// portion by reference. +bool rewriteARMFrameIndex(MachineInstr &MI, unsigned FrameRegIdx, + unsigned FrameReg, int &Offset, + const ARMBaseInstrInfo &TII); -int rewriteT2FrameIndex(MachineInstr &MI, unsigned FrameRegIdx, - unsigned FrameReg, int Offset, - const ARMBaseInstrInfo &TII); +bool rewriteT2FrameIndex(MachineInstr &MI, unsigned FrameRegIdx, + unsigned FrameReg, int &Offset, + const ARMBaseInstrInfo &TII); } // End llvm namespace diff --git a/libclamav/c++/llvm/lib/Target/ARM/ARMBaseRegisterInfo.cpp b/libclamav/c++/llvm/lib/Target/ARM/ARMBaseRegisterInfo.cpp index 07164ff6f..1c4107307 100644 --- a/libclamav/c++/llvm/lib/Target/ARM/ARMBaseRegisterInfo.cpp +++ b/libclamav/c++/llvm/lib/Target/ARM/ARMBaseRegisterInfo.cpp @@ -1047,19 +1047,22 @@ ARMBaseRegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator II, } // modify MI as necessary to handle as much of 'Offset' as possible + bool Done = false; if (!AFI->isThumbFunction()) - Offset = rewriteARMFrameIndex(MI, i, FrameReg, Offset, TII); + Done = rewriteARMFrameIndex(MI, i, FrameReg, Offset, TII); else { assert(AFI->isThumb2Function()); - Offset = rewriteT2FrameIndex(MI, i, FrameReg, Offset, TII); + Done = rewriteT2FrameIndex(MI, i, FrameReg, Offset, TII); } - if (Offset == 0) + if (Done) return; // If we get here, the immediate doesn't fit into the instruction. We folded // as much as possible above, handle the rest, providing a register that is // SP+LargeImm. - assert(Offset && "This code isn't needed if offset already handled!"); + assert((Offset || + (MI.getDesc().TSFlags & ARMII::AddrModeMask) == ARMII::AddrMode4) && + "This code isn't needed if offset already handled!"); // Insert a set of r12 with the full address: r12 = sp + offset // If the offset we have is too large to fit into the instruction, we need @@ -1073,15 +1076,20 @@ ARMBaseRegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator II, ARMCC::CondCodes Pred = (PIdx == -1) ? ARMCC::AL : (ARMCC::CondCodes)MI.getOperand(PIdx).getImm(); unsigned PredReg = (PIdx == -1) ? 0 : MI.getOperand(PIdx+1).getReg(); - if (!AFI->isThumbFunction()) - emitARMRegPlusImmediate(MBB, II, MI.getDebugLoc(), ScratchReg, FrameReg, - Offset, Pred, PredReg, TII); + if (Offset == 0) + // Must be addrmode4. + MI.getOperand(i).ChangeToRegister(FrameReg, false, false, false); else { - assert(AFI->isThumb2Function()); - emitT2RegPlusImmediate(MBB, II, MI.getDebugLoc(), ScratchReg, FrameReg, - Offset, Pred, PredReg, TII); + if (!AFI->isThumbFunction()) + emitARMRegPlusImmediate(MBB, II, MI.getDebugLoc(), ScratchReg, FrameReg, + Offset, Pred, PredReg, TII); + else { + assert(AFI->isThumb2Function()); + emitT2RegPlusImmediate(MBB, II, MI.getDebugLoc(), ScratchReg, FrameReg, + Offset, Pred, PredReg, TII); + } + MI.getOperand(i).ChangeToRegister(ScratchReg, false, false, true); } - MI.getOperand(i).ChangeToRegister(ScratchReg, false, false, true); } /// Move iterator pass the next bunch of callee save load / store ops for diff --git a/libclamav/c++/llvm/lib/Target/ARM/ARMCodeEmitter.cpp b/libclamav/c++/llvm/lib/Target/ARM/ARMCodeEmitter.cpp index aa2822c2c..37e2cfc09 100644 --- a/libclamav/c++/llvm/lib/Target/ARM/ARMCodeEmitter.cpp +++ b/libclamav/c++/llvm/lib/Target/ARM/ARMCodeEmitter.cpp @@ -417,16 +417,9 @@ void Emitter::emitConstPoolInstruction(const MachineInstr &MI) { GlobalValue *GV = ACPV->getGV(); if (GV) { - assert(!ACPV->isStub() && "Don't know how to deal this yet!"); - if (ACPV->isNonLazyPointer()) - MCE.addRelocation(MachineRelocation::getIndirectSymbol( - MCE.getCurrentPCOffset(), ARM::reloc_arm_machine_cp_entry, GV, - (intptr_t)ACPV, false)); - else - emitGlobalAddress(GV, ARM::reloc_arm_machine_cp_entry, - ACPV->isStub() || isa(GV), (intptr_t)ACPV); + emitGlobalAddress(GV, ARM::reloc_arm_machine_cp_entry, + isa(GV), (intptr_t)ACPV); } else { - assert(!ACPV->isNonLazyPointer() && "Don't know how to deal this yet!"); emitExternalSymbolAddress(ACPV->getSymbol(), ARM::reloc_arm_absolute); } emitWordLE(0); diff --git a/libclamav/c++/llvm/lib/Target/ARM/ARMConstantPoolValue.cpp b/libclamav/c++/llvm/lib/Target/ARM/ARMConstantPoolValue.cpp index b28a295cb..6c8c39f6f 100644 --- a/libclamav/c++/llvm/lib/Target/ARM/ARMConstantPoolValue.cpp +++ b/libclamav/c++/llvm/lib/Target/ARM/ARMConstantPoolValue.cpp @@ -20,29 +20,25 @@ using namespace llvm; ARMConstantPoolValue::ARMConstantPoolValue(GlobalValue *gv, unsigned id, - ARMCP::ARMCPKind k, unsigned char PCAdj, const char *Modif, bool AddCA) : MachineConstantPoolValue((const Type*)gv->getType()), - GV(gv), S(NULL), LabelId(id), Kind(k), PCAdjust(PCAdj), + GV(gv), S(NULL), LabelId(id), PCAdjust(PCAdj), Modifier(Modif), AddCurrentAddress(AddCA) {} ARMConstantPoolValue::ARMConstantPoolValue(LLVMContext &C, const char *s, unsigned id, - ARMCP::ARMCPKind k, unsigned char PCAdj, const char *Modif, bool AddCA) : MachineConstantPoolValue((const Type*)Type::getInt32Ty(C)), - GV(NULL), S(strdup(s)), LabelId(id), Kind(k), PCAdjust(PCAdj), + GV(NULL), S(strdup(s)), LabelId(id), PCAdjust(PCAdj), Modifier(Modif), AddCurrentAddress(AddCA) {} -ARMConstantPoolValue::ARMConstantPoolValue(GlobalValue *gv, - ARMCP::ARMCPKind k, - const char *Modif) +ARMConstantPoolValue::ARMConstantPoolValue(GlobalValue *gv, const char *Modif) : MachineConstantPoolValue((const Type*)Type::getInt32Ty(gv->getContext())), - GV(gv), S(NULL), LabelId(0), Kind(k), PCAdjust(0), + GV(gv), S(NULL), LabelId(0), PCAdjust(0), Modifier(Modif) {} int ARMConstantPoolValue::getExistingMachineCPValue(MachineConstantPool *CP, @@ -57,7 +53,6 @@ int ARMConstantPoolValue::getExistingMachineCPValue(MachineConstantPool *CP, if (CPV->GV == GV && CPV->S == S && CPV->LabelId == LabelId && - CPV->Kind == Kind && CPV->PCAdjust == PCAdjust) return i; } @@ -75,7 +70,6 @@ ARMConstantPoolValue::AddSelectionDAGCSEId(FoldingSetNodeID &ID) { ID.AddPointer(GV); ID.AddPointer(S); ID.AddInteger(LabelId); - ID.AddInteger((unsigned)Kind); ID.AddInteger(PCAdjust); } @@ -89,8 +83,6 @@ void ARMConstantPoolValue::print(raw_ostream &O) const { O << GV->getName(); else O << S; - if (isNonLazyPointer()) O << "$non_lazy_ptr"; - else if (isStub()) O << "$stub"; if (Modifier) O << "(" << Modifier << ")"; if (PCAdjust != 0) { O << "-(LPC" << LabelId << "+" << (unsigned)PCAdjust; diff --git a/libclamav/c++/llvm/lib/Target/ARM/ARMConstantPoolValue.h b/libclamav/c++/llvm/lib/Target/ARM/ARMConstantPoolValue.h index 95c5358f5..8a0348b79 100644 --- a/libclamav/c++/llvm/lib/Target/ARM/ARMConstantPoolValue.h +++ b/libclamav/c++/llvm/lib/Target/ARM/ARMConstantPoolValue.h @@ -21,14 +21,6 @@ namespace llvm { class GlobalValue; class LLVMContext; -namespace ARMCP { - enum ARMCPKind { - CPValue, - CPNonLazyPtr, - CPStub - }; -} - /// ARMConstantPoolValue - ARM specific constantpool value. This is used to /// represent PC relative displacement between the address of the load /// instruction and the global value being loaded, i.e. (&GV-(LPIC+8)). @@ -36,7 +28,6 @@ class ARMConstantPoolValue : public MachineConstantPoolValue { GlobalValue *GV; // GlobalValue being loaded. const char *S; // ExtSymbol being loaded. unsigned LabelId; // Label id of the load. - ARMCP::ARMCPKind Kind; // non_lazy_ptr or stub? unsigned char PCAdjust; // Extra adjustment if constantpool is pc relative. // 8 for ARM, 4 for Thumb. const char *Modifier; // GV modifier i.e. (&GV(modifier)-(LPIC+8)) @@ -44,15 +35,12 @@ class ARMConstantPoolValue : public MachineConstantPoolValue { public: ARMConstantPoolValue(GlobalValue *gv, unsigned id, - ARMCP::ARMCPKind Kind = ARMCP::CPValue, unsigned char PCAdj = 0, const char *Modifier = NULL, bool AddCurrentAddress = false); ARMConstantPoolValue(LLVMContext &C, const char *s, unsigned id, - ARMCP::ARMCPKind Kind = ARMCP::CPValue, unsigned char PCAdj = 0, const char *Modifier = NULL, bool AddCurrentAddress = false); - ARMConstantPoolValue(GlobalValue *GV, ARMCP::ARMCPKind Kind, - const char *Modifier); + ARMConstantPoolValue(GlobalValue *GV, const char *Modifier); ARMConstantPoolValue(); ~ARMConstantPoolValue(); @@ -63,8 +51,6 @@ public: bool hasModifier() const { return Modifier != NULL; } bool mustAddCurrentAddress() const { return AddCurrentAddress; } unsigned getLabelId() const { return LabelId; } - bool isNonLazyPointer() const { return Kind == ARMCP::CPNonLazyPtr; } - bool isStub() const { return Kind == ARMCP::CPStub; } unsigned char getPCAdjustment() const { return PCAdjust; } virtual unsigned getRelocationInfo() const { diff --git a/libclamav/c++/llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp b/libclamav/c++/llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp index 4c711cb90..97edb973e 100644 --- a/libclamav/c++/llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp +++ b/libclamav/c++/llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp @@ -1263,117 +1263,6 @@ SDNode *ARMDAGToDAGISel::Select(SDValue Op) { return CurDAG->SelectNodeTo(Op.getNode(), Opc, VT, Ops, 5); } - case ARMISD::VLD2D: { - SDValue MemAddr, MemUpdate, MemOpc; - if (!SelectAddrMode6(Op, N->getOperand(1), MemAddr, MemUpdate, MemOpc)) - return NULL; - unsigned Opc = 0; - EVT VT = Op.getValueType(); - switch (VT.getSimpleVT().SimpleTy) { - default: llvm_unreachable("unhandled VLD2D type"); - case MVT::v8i8: Opc = ARM::VLD2d8; break; - case MVT::v4i16: Opc = ARM::VLD2d16; break; - case MVT::v2f32: - case MVT::v2i32: Opc = ARM::VLD2d32; break; - } - SDValue Chain = N->getOperand(0); - const SDValue Ops[] = { MemAddr, MemUpdate, MemOpc, Chain }; - return CurDAG->getTargetNode(Opc, dl, VT, VT, MVT::Other, Ops, 4); - } - - case ARMISD::VLD3D: { - SDValue MemAddr, MemUpdate, MemOpc; - if (!SelectAddrMode6(Op, N->getOperand(1), MemAddr, MemUpdate, MemOpc)) - return NULL; - unsigned Opc = 0; - EVT VT = Op.getValueType(); - switch (VT.getSimpleVT().SimpleTy) { - default: llvm_unreachable("unhandled VLD3D type"); - case MVT::v8i8: Opc = ARM::VLD3d8; break; - case MVT::v4i16: Opc = ARM::VLD3d16; break; - case MVT::v2f32: - case MVT::v2i32: Opc = ARM::VLD3d32; break; - } - SDValue Chain = N->getOperand(0); - const SDValue Ops[] = { MemAddr, MemUpdate, MemOpc, Chain }; - return CurDAG->getTargetNode(Opc, dl, VT, VT, VT, MVT::Other, Ops, 4); - } - - case ARMISD::VLD4D: { - SDValue MemAddr, MemUpdate, MemOpc; - if (!SelectAddrMode6(Op, N->getOperand(1), MemAddr, MemUpdate, MemOpc)) - return NULL; - unsigned Opc = 0; - EVT VT = Op.getValueType(); - switch (VT.getSimpleVT().SimpleTy) { - default: llvm_unreachable("unhandled VLD4D type"); - case MVT::v8i8: Opc = ARM::VLD4d8; break; - case MVT::v4i16: Opc = ARM::VLD4d16; break; - case MVT::v2f32: - case MVT::v2i32: Opc = ARM::VLD4d32; break; - } - SDValue Chain = N->getOperand(0); - const SDValue Ops[] = { MemAddr, MemUpdate, MemOpc, Chain }; - std::vector ResTys(4, VT); - ResTys.push_back(MVT::Other); - return CurDAG->getTargetNode(Opc, dl, ResTys, Ops, 4); - } - - case ARMISD::VST2D: { - SDValue MemAddr, MemUpdate, MemOpc; - if (!SelectAddrMode6(Op, N->getOperand(1), MemAddr, MemUpdate, MemOpc)) - return NULL; - unsigned Opc = 0; - switch (N->getOperand(2).getValueType().getSimpleVT().SimpleTy) { - default: llvm_unreachable("unhandled VST2D type"); - case MVT::v8i8: Opc = ARM::VST2d8; break; - case MVT::v4i16: Opc = ARM::VST2d16; break; - case MVT::v2f32: - case MVT::v2i32: Opc = ARM::VST2d32; break; - } - SDValue Chain = N->getOperand(0); - const SDValue Ops[] = { MemAddr, MemUpdate, MemOpc, - N->getOperand(2), N->getOperand(3), Chain }; - return CurDAG->getTargetNode(Opc, dl, MVT::Other, Ops, 6); - } - - case ARMISD::VST3D: { - SDValue MemAddr, MemUpdate, MemOpc; - if (!SelectAddrMode6(Op, N->getOperand(1), MemAddr, MemUpdate, MemOpc)) - return NULL; - unsigned Opc = 0; - switch (N->getOperand(2).getValueType().getSimpleVT().SimpleTy) { - default: llvm_unreachable("unhandled VST3D type"); - case MVT::v8i8: Opc = ARM::VST3d8; break; - case MVT::v4i16: Opc = ARM::VST3d16; break; - case MVT::v2f32: - case MVT::v2i32: Opc = ARM::VST3d32; break; - } - SDValue Chain = N->getOperand(0); - const SDValue Ops[] = { MemAddr, MemUpdate, MemOpc, - N->getOperand(2), N->getOperand(3), - N->getOperand(4), Chain }; - return CurDAG->getTargetNode(Opc, dl, MVT::Other, Ops, 7); - } - - case ARMISD::VST4D: { - SDValue MemAddr, MemUpdate, MemOpc; - if (!SelectAddrMode6(Op, N->getOperand(1), MemAddr, MemUpdate, MemOpc)) - return NULL; - unsigned Opc = 0; - switch (N->getOperand(2).getValueType().getSimpleVT().SimpleTy) { - default: llvm_unreachable("unhandled VST4D type"); - case MVT::v8i8: Opc = ARM::VST4d8; break; - case MVT::v4i16: Opc = ARM::VST4d16; break; - case MVT::v2f32: - case MVT::v2i32: Opc = ARM::VST4d32; break; - } - SDValue Chain = N->getOperand(0); - const SDValue Ops[] = { MemAddr, MemUpdate, MemOpc, - N->getOperand(2), N->getOperand(3), - N->getOperand(4), N->getOperand(5), Chain }; - return CurDAG->getTargetNode(Opc, dl, MVT::Other, Ops, 8); - } case ARMISD::VZIP: { unsigned Opc = 0; EVT VT = N->getValueType(0); @@ -1425,6 +1314,121 @@ SDNode *ARMDAGToDAGISel::Select(SDValue Op) { return CurDAG->getTargetNode(Opc, dl, VT, VT, N->getOperand(0), N->getOperand(1)); } + + case ISD::INTRINSIC_VOID: + case ISD::INTRINSIC_W_CHAIN: { + unsigned IntNo = cast(N->getOperand(1))->getZExtValue(); + EVT VT = N->getValueType(0); + unsigned Opc = 0; + + switch (IntNo) { + default: + break; + + case Intrinsic::arm_neon_vld2: { + SDValue MemAddr, MemUpdate, MemOpc; + if (!SelectAddrMode6(Op, N->getOperand(2), MemAddr, MemUpdate, MemOpc)) + return NULL; + switch (VT.getSimpleVT().SimpleTy) { + default: llvm_unreachable("unhandled vld2 type"); + case MVT::v8i8: Opc = ARM::VLD2d8; break; + case MVT::v4i16: Opc = ARM::VLD2d16; break; + case MVT::v2f32: + case MVT::v2i32: Opc = ARM::VLD2d32; break; + } + SDValue Chain = N->getOperand(0); + const SDValue Ops[] = { MemAddr, MemUpdate, MemOpc, Chain }; + return CurDAG->getTargetNode(Opc, dl, VT, VT, MVT::Other, Ops, 4); + } + + case Intrinsic::arm_neon_vld3: { + SDValue MemAddr, MemUpdate, MemOpc; + if (!SelectAddrMode6(Op, N->getOperand(2), MemAddr, MemUpdate, MemOpc)) + return NULL; + switch (VT.getSimpleVT().SimpleTy) { + default: llvm_unreachable("unhandled vld3 type"); + case MVT::v8i8: Opc = ARM::VLD3d8; break; + case MVT::v4i16: Opc = ARM::VLD3d16; break; + case MVT::v2f32: + case MVT::v2i32: Opc = ARM::VLD3d32; break; + } + SDValue Chain = N->getOperand(0); + const SDValue Ops[] = { MemAddr, MemUpdate, MemOpc, Chain }; + return CurDAG->getTargetNode(Opc, dl, VT, VT, VT, MVT::Other, Ops, 4); + } + + case Intrinsic::arm_neon_vld4: { + SDValue MemAddr, MemUpdate, MemOpc; + if (!SelectAddrMode6(Op, N->getOperand(2), MemAddr, MemUpdate, MemOpc)) + return NULL; + switch (VT.getSimpleVT().SimpleTy) { + default: llvm_unreachable("unhandled vld4 type"); + case MVT::v8i8: Opc = ARM::VLD4d8; break; + case MVT::v4i16: Opc = ARM::VLD4d16; break; + case MVT::v2f32: + case MVT::v2i32: Opc = ARM::VLD4d32; break; + } + SDValue Chain = N->getOperand(0); + const SDValue Ops[] = { MemAddr, MemUpdate, MemOpc, Chain }; + std::vector ResTys(4, VT); + ResTys.push_back(MVT::Other); + return CurDAG->getTargetNode(Opc, dl, ResTys, Ops, 4); + } + + case Intrinsic::arm_neon_vst2: { + SDValue MemAddr, MemUpdate, MemOpc; + if (!SelectAddrMode6(Op, N->getOperand(2), MemAddr, MemUpdate, MemOpc)) + return NULL; + switch (N->getOperand(3).getValueType().getSimpleVT().SimpleTy) { + default: llvm_unreachable("unhandled vst2 type"); + case MVT::v8i8: Opc = ARM::VST2d8; break; + case MVT::v4i16: Opc = ARM::VST2d16; break; + case MVT::v2f32: + case MVT::v2i32: Opc = ARM::VST2d32; break; + } + SDValue Chain = N->getOperand(0); + const SDValue Ops[] = { MemAddr, MemUpdate, MemOpc, + N->getOperand(3), N->getOperand(4), Chain }; + return CurDAG->getTargetNode(Opc, dl, MVT::Other, Ops, 6); + } + + case Intrinsic::arm_neon_vst3: { + SDValue MemAddr, MemUpdate, MemOpc; + if (!SelectAddrMode6(Op, N->getOperand(2), MemAddr, MemUpdate, MemOpc)) + return NULL; + switch (N->getOperand(3).getValueType().getSimpleVT().SimpleTy) { + default: llvm_unreachable("unhandled vst3 type"); + case MVT::v8i8: Opc = ARM::VST3d8; break; + case MVT::v4i16: Opc = ARM::VST3d16; break; + case MVT::v2f32: + case MVT::v2i32: Opc = ARM::VST3d32; break; + } + SDValue Chain = N->getOperand(0); + const SDValue Ops[] = { MemAddr, MemUpdate, MemOpc, + N->getOperand(3), N->getOperand(4), + N->getOperand(5), Chain }; + return CurDAG->getTargetNode(Opc, dl, MVT::Other, Ops, 7); + } + + case Intrinsic::arm_neon_vst4: { + SDValue MemAddr, MemUpdate, MemOpc; + if (!SelectAddrMode6(Op, N->getOperand(2), MemAddr, MemUpdate, MemOpc)) + return NULL; + switch (N->getOperand(3).getValueType().getSimpleVT().SimpleTy) { + default: llvm_unreachable("unhandled vst4 type"); + case MVT::v8i8: Opc = ARM::VST4d8; break; + case MVT::v4i16: Opc = ARM::VST4d16; break; + case MVT::v2f32: + case MVT::v2i32: Opc = ARM::VST4d32; break; + } + SDValue Chain = N->getOperand(0); + const SDValue Ops[] = { MemAddr, MemUpdate, MemOpc, + N->getOperand(3), N->getOperand(4), + N->getOperand(5), N->getOperand(6), Chain }; + return CurDAG->getTargetNode(Opc, dl, MVT::Other, Ops, 8); + } + } + } } return SelectCode(Op); diff --git a/libclamav/c++/llvm/lib/Target/ARM/ARMISelLowering.cpp b/libclamav/c++/llvm/lib/Target/ARM/ARMISelLowering.cpp index 7d8362c93..0484fd01d 100644 --- a/libclamav/c++/llvm/lib/Target/ARM/ARMISelLowering.cpp +++ b/libclamav/c++/llvm/lib/Target/ARM/ARMISelLowering.cpp @@ -78,7 +78,6 @@ void ARMTargetLowering::addTypeForNEON(EVT VT, EVT PromotedLdStVT, setOperationAction(ISD::EXTRACT_VECTOR_ELT, VT.getSimpleVT(), Custom); setOperationAction(ISD::BUILD_VECTOR, VT.getSimpleVT(), Custom); setOperationAction(ISD::VECTOR_SHUFFLE, VT.getSimpleVT(), Custom); - setOperationAction(ISD::SCALAR_TO_VECTOR, VT.getSimpleVT(), Custom); setOperationAction(ISD::CONCAT_VECTORS, VT.getSimpleVT(), Custom); setOperationAction(ISD::EXTRACT_SUBVECTOR, VT.getSimpleVT(), Expand); if (VT.isInteger()) { @@ -483,12 +482,6 @@ const char *ARMTargetLowering::getTargetNodeName(unsigned Opcode) const { case ARMISD::VGETLANEs: return "ARMISD::VGETLANEs"; case ARMISD::VDUP: return "ARMISD::VDUP"; case ARMISD::VDUPLANE: return "ARMISD::VDUPLANE"; - case ARMISD::VLD2D: return "ARMISD::VLD2D"; - case ARMISD::VLD3D: return "ARMISD::VLD3D"; - case ARMISD::VLD4D: return "ARMISD::VLD4D"; - case ARMISD::VST2D: return "ARMISD::VST2D"; - case ARMISD::VST3D: return "ARMISD::VST3D"; - case ARMISD::VST4D: return "ARMISD::VST4D"; case ARMISD::VEXT: return "ARMISD::VEXT"; case ARMISD::VREV64: return "ARMISD::VREV64"; case ARMISD::VREV32: return "ARMISD::VREV32"; @@ -975,8 +968,8 @@ ARMTargetLowering::LowerCall(SDValue Chain, SDValue Callee, isLocalARMFunc = !Subtarget->isThumb() && !isExt; // tBX takes a register source operand. if (isARMFunc && Subtarget->isThumb1Only() && !Subtarget->hasV5TOps()) { - ARMConstantPoolValue *CPV = new ARMConstantPoolValue(GV, ARMPCLabelIndex, - ARMCP::CPStub, 4); + ARMConstantPoolValue *CPV = new ARMConstantPoolValue(GV, + ARMPCLabelIndex, 4); SDValue CPAddr = DAG.getTargetConstantPool(CPV, getPointerTy(), 4); CPAddr = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, CPAddr); Callee = DAG.getLoad(getPointerTy(), dl, @@ -995,8 +988,7 @@ ARMTargetLowering::LowerCall(SDValue Chain, SDValue Callee, const char *Sym = S->getSymbol(); if (isARMFunc && Subtarget->isThumb1Only() && !Subtarget->hasV5TOps()) { ARMConstantPoolValue *CPV = new ARMConstantPoolValue(*DAG.getContext(), - Sym, ARMPCLabelIndex, - ARMCP::CPStub, 4); + Sym, ARMPCLabelIndex, 4); SDValue CPAddr = DAG.getTargetConstantPool(CPV, getPointerTy(), 4); CPAddr = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, CPAddr); Callee = DAG.getLoad(getPointerTy(), dl, @@ -1173,7 +1165,7 @@ ARMTargetLowering::LowerToTLSGeneralDynamicModel(GlobalAddressSDNode *GA, EVT PtrVT = getPointerTy(); unsigned char PCAdj = Subtarget->isThumb() ? 4 : 8; ARMConstantPoolValue *CPV = - new ARMConstantPoolValue(GA->getGlobal(), ARMPCLabelIndex, ARMCP::CPValue, + new ARMConstantPoolValue(GA->getGlobal(), ARMPCLabelIndex, PCAdj, "tlsgd", true); SDValue Argument = DAG.getTargetConstantPool(CPV, PtrVT, 4); Argument = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, Argument); @@ -1215,7 +1207,7 @@ ARMTargetLowering::LowerToTLSExecModels(GlobalAddressSDNode *GA, // initial exec model unsigned char PCAdj = Subtarget->isThumb() ? 4 : 8; ARMConstantPoolValue *CPV = - new ARMConstantPoolValue(GA->getGlobal(), ARMPCLabelIndex, ARMCP::CPValue, + new ARMConstantPoolValue(GA->getGlobal(), ARMPCLabelIndex, PCAdj, "gottpoff", true); Offset = DAG.getTargetConstantPool(CPV, PtrVT, 4); Offset = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, Offset); @@ -1228,8 +1220,7 @@ ARMTargetLowering::LowerToTLSExecModels(GlobalAddressSDNode *GA, Offset = DAG.getLoad(PtrVT, dl, Chain, Offset, NULL, 0); } else { // local exec model - ARMConstantPoolValue *CPV = - new ARMConstantPoolValue(GV, ARMCP::CPValue, "tpoff"); + ARMConstantPoolValue *CPV = new ARMConstantPoolValue(GV, "tpoff"); Offset = DAG.getTargetConstantPool(CPV, PtrVT, 4); Offset = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, Offset); Offset = DAG.getLoad(PtrVT, dl, Chain, Offset, NULL, 0); @@ -1263,7 +1254,7 @@ SDValue ARMTargetLowering::LowerGlobalAddressELF(SDValue Op, if (RelocM == Reloc::PIC_) { bool UseGOTOFF = GV->hasLocalLinkage() || GV->hasHiddenVisibility(); ARMConstantPoolValue *CPV = - new ARMConstantPoolValue(GV, ARMCP::CPValue, UseGOTOFF ? "GOTOFF":"GOT"); + new ARMConstantPoolValue(GV, UseGOTOFF ? "GOTOFF" : "GOT"); SDValue CPAddr = DAG.getTargetConstantPool(CPV, PtrVT, 4); CPAddr = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, CPAddr); SDValue Result = DAG.getLoad(PtrVT, dl, DAG.getEntryNode(), @@ -1281,34 +1272,19 @@ SDValue ARMTargetLowering::LowerGlobalAddressELF(SDValue Op, } } -/// GVIsIndirectSymbol - true if the GV will be accessed via an indirect symbol -/// even in non-static mode. -static bool GVIsIndirectSymbol(GlobalValue *GV, Reloc::Model RelocM) { - // If symbol visibility is hidden, the extra load is not needed if - // the symbol is definitely defined in the current translation unit. - bool isDecl = GV->isDeclaration() || GV->hasAvailableExternallyLinkage(); - if (GV->hasHiddenVisibility() && (!isDecl && !GV->hasCommonLinkage())) - return false; - return RelocM != Reloc::Static && (isDecl || GV->isWeakForLinker()); -} - SDValue ARMTargetLowering::LowerGlobalAddressDarwin(SDValue Op, SelectionDAG &DAG) { EVT PtrVT = getPointerTy(); DebugLoc dl = Op.getDebugLoc(); GlobalValue *GV = cast(Op)->getGlobal(); Reloc::Model RelocM = getTargetMachine().getRelocationModel(); - bool IsIndirect = GVIsIndirectSymbol(GV, RelocM); SDValue CPAddr; if (RelocM == Reloc::Static) CPAddr = DAG.getTargetConstantPool(GV, PtrVT, 4); else { - unsigned PCAdj = (RelocM != Reloc::PIC_) - ? 0 : (Subtarget->isThumb() ? 4 : 8); - ARMCP::ARMCPKind Kind = IsIndirect ? ARMCP::CPNonLazyPtr - : ARMCP::CPValue; - ARMConstantPoolValue *CPV = new ARMConstantPoolValue(GV, ARMPCLabelIndex, - Kind, PCAdj); + unsigned PCAdj = (RelocM != Reloc::PIC_) ? 0 : (Subtarget->isThumb()?4:8); + ARMConstantPoolValue *CPV = + new ARMConstantPoolValue(GV, ARMPCLabelIndex, PCAdj); CPAddr = DAG.getTargetConstantPool(CPV, PtrVT, 4); } CPAddr = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, CPAddr); @@ -1320,7 +1296,8 @@ SDValue ARMTargetLowering::LowerGlobalAddressDarwin(SDValue Op, SDValue PICLabel = DAG.getConstant(ARMPCLabelIndex++, MVT::i32); Result = DAG.getNode(ARMISD::PIC_ADD, dl, PtrVT, Result, PICLabel); } - if (IsIndirect) + + if (Subtarget->GVIsIndirectSymbol(GV, RelocM == Reloc::Static)) Result = DAG.getLoad(PtrVT, dl, Chain, Result, NULL, 0); return Result; @@ -1335,8 +1312,7 @@ SDValue ARMTargetLowering::LowerGLOBAL_OFFSET_TABLE(SDValue Op, unsigned PCAdj = Subtarget->isThumb() ? 4 : 8; ARMConstantPoolValue *CPV = new ARMConstantPoolValue(*DAG.getContext(), "_GLOBAL_OFFSET_TABLE_", - ARMPCLabelIndex, - ARMCP::CPValue, PCAdj); + ARMPCLabelIndex, PCAdj); SDValue CPAddr = DAG.getTargetConstantPool(CPV, PtrVT, 4); CPAddr = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, CPAddr); SDValue Result = DAG.getLoad(PtrVT, dl, DAG.getEntryNode(), CPAddr, NULL, 0); @@ -1345,52 +1321,45 @@ SDValue ARMTargetLowering::LowerGLOBAL_OFFSET_TABLE(SDValue Op, } static SDValue LowerNeonVLDIntrinsic(SDValue Op, SelectionDAG &DAG, - unsigned Opcode) { + unsigned NumVecs) { SDNode *Node = Op.getNode(); EVT VT = Node->getValueType(0); - DebugLoc dl = Op.getDebugLoc(); - if (!VT.is64BitVector()) - return SDValue(); // unimplemented + // No expansion needed for 64-bit vectors. + if (VT.is64BitVector()) + return SDValue(); - SDValue Ops[] = { Node->getOperand(0), - Node->getOperand(2) }; - return DAG.getNode(Opcode, dl, Node->getVTList(), Ops, 2); + // FIXME: We need to expand VLD3 and VLD4 of 128-bit vectors into separate + // operations to load the even and odd registers. + return SDValue(); } static SDValue LowerNeonVSTIntrinsic(SDValue Op, SelectionDAG &DAG, - unsigned Opcode, unsigned NumVecs) { + unsigned NumVecs) { SDNode *Node = Op.getNode(); EVT VT = Node->getOperand(3).getValueType(); - DebugLoc dl = Op.getDebugLoc(); - if (!VT.is64BitVector()) - return SDValue(); // unimplemented + // No expansion needed for 64-bit vectors. + if (VT.is64BitVector()) + return SDValue(); - SmallVector Ops; - Ops.push_back(Node->getOperand(0)); - Ops.push_back(Node->getOperand(2)); - for (unsigned N = 0; N < NumVecs; ++N) - Ops.push_back(Node->getOperand(N + 3)); - return DAG.getNode(Opcode, dl, MVT::Other, Ops.data(), Ops.size()); + // FIXME: We need to expand VST3 and VST4 of 128-bit vectors into separate + // operations to store the even and odd registers. + return SDValue(); } SDValue ARMTargetLowering::LowerINTRINSIC_W_CHAIN(SDValue Op, SelectionDAG &DAG) { unsigned IntNo = cast(Op.getOperand(1))->getZExtValue(); switch (IntNo) { - case Intrinsic::arm_neon_vld2: - return LowerNeonVLDIntrinsic(Op, DAG, ARMISD::VLD2D); case Intrinsic::arm_neon_vld3: - return LowerNeonVLDIntrinsic(Op, DAG, ARMISD::VLD3D); + return LowerNeonVLDIntrinsic(Op, DAG, 3); case Intrinsic::arm_neon_vld4: - return LowerNeonVLDIntrinsic(Op, DAG, ARMISD::VLD4D); - case Intrinsic::arm_neon_vst2: - return LowerNeonVSTIntrinsic(Op, DAG, ARMISD::VST2D, 2); + return LowerNeonVLDIntrinsic(Op, DAG, 4); case Intrinsic::arm_neon_vst3: - return LowerNeonVSTIntrinsic(Op, DAG, ARMISD::VST3D, 3); + return LowerNeonVSTIntrinsic(Op, DAG, 3); case Intrinsic::arm_neon_vst4: - return LowerNeonVSTIntrinsic(Op, DAG, ARMISD::VST4D, 4); + return LowerNeonVSTIntrinsic(Op, DAG, 4); default: return SDValue(); // Don't custom lower most intrinsics. } } @@ -1417,14 +1386,13 @@ ARMTargetLowering::LowerINTRINSIC_WO_CHAIN(SDValue Op, SelectionDAG &DAG) { SDValue CPAddr; unsigned PCAdj = (RelocM != Reloc::PIC_) ? 0 : (Subtarget->isThumb() ? 4 : 8); - ARMCP::ARMCPKind Kind = ARMCP::CPValue; // Save off the LSDA name for the AsmPrinter to use when it's time // to emit the table std::string LSDAName = "L_lsda_"; LSDAName += MF.getFunction()->getName(); ARMConstantPoolValue *CPV = new ARMConstantPoolValue(*DAG.getContext(), LSDAName.c_str(), - ARMPCLabelIndex, Kind, PCAdj); + ARMPCLabelIndex, PCAdj); CPAddr = DAG.getTargetConstantPool(CPV, PtrVT, 4); CPAddr = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, CPAddr); SDValue Result = @@ -2500,10 +2468,12 @@ static SDValue LowerBUILD_VECTOR(SDValue Op, SelectionDAG &DAG) { unsigned SplatBitSize; bool HasAnyUndefs; if (BVN->isConstantSplat(SplatBits, SplatUndef, SplatBitSize, HasAnyUndefs)) { - SDValue Val = isVMOVSplat(SplatBits.getZExtValue(), - SplatUndef.getZExtValue(), SplatBitSize, DAG); - if (Val.getNode()) - return BuildSplat(Val, VT, DAG, dl); + if (SplatBitSize <= 64) { + SDValue Val = isVMOVSplat(SplatBits.getZExtValue(), + SplatUndef.getZExtValue(), SplatBitSize, DAG); + if (Val.getNode()) + return BuildSplat(Val, VT, DAG, dl); + } } // If there are only 2 elements in a 128-bit vector, insert them into an @@ -2718,20 +2688,23 @@ static SDValue LowerVECTOR_SHUFFLE(SDValue Op, SelectionDAG &DAG) { return SDValue(); } -static SDValue LowerSCALAR_TO_VECTOR(SDValue Op, SelectionDAG &DAG) { - return Op; -} - static SDValue LowerEXTRACT_VECTOR_ELT(SDValue Op, SelectionDAG &DAG) { EVT VT = Op.getValueType(); DebugLoc dl = Op.getDebugLoc(); - assert((VT == MVT::i8 || VT == MVT::i16) && - "unexpected type for custom-lowering vector extract"); SDValue Vec = Op.getOperand(0); SDValue Lane = Op.getOperand(1); + + // FIXME: This is invalid for 8 and 16-bit elements - the information about + // sign / zero extension is lost! Op = DAG.getNode(ARMISD::VGETLANEu, dl, MVT::i32, Vec, Lane); Op = DAG.getNode(ISD::AssertZext, dl, MVT::i32, Op, DAG.getValueType(VT)); - return DAG.getNode(ISD::TRUNCATE, dl, VT, Op); + + if (VT.bitsLT(MVT::i32)) + Op = DAG.getNode(ISD::TRUNCATE, dl, VT, Op); + else if (VT.bitsGT(MVT::i32)) + Op = DAG.getNode(ISD::ANY_EXTEND, dl, VT, Op); + + return Op; } static SDValue LowerCONCAT_VECTORS(SDValue Op, SelectionDAG &DAG) { @@ -2785,7 +2758,6 @@ SDValue ARMTargetLowering::LowerOperation(SDValue Op, SelectionDAG &DAG) { case ISD::VSETCC: return LowerVSETCC(Op, DAG); case ISD::BUILD_VECTOR: return LowerBUILD_VECTOR(Op, DAG); case ISD::VECTOR_SHUFFLE: return LowerVECTOR_SHUFFLE(Op, DAG); - case ISD::SCALAR_TO_VECTOR: return LowerSCALAR_TO_VECTOR(Op, DAG); case ISD::EXTRACT_VECTOR_ELT: return LowerEXTRACT_VECTOR_ELT(Op, DAG); case ISD::CONCAT_VECTORS: return LowerCONCAT_VECTORS(Op, DAG); } diff --git a/libclamav/c++/llvm/lib/Target/ARM/ARMISelLowering.h b/libclamav/c++/llvm/lib/Target/ARM/ARMISelLowering.h index cb88be551..80d1f00f9 100644 --- a/libclamav/c++/llvm/lib/Target/ARM/ARMISelLowering.h +++ b/libclamav/c++/llvm/lib/Target/ARM/ARMISelLowering.h @@ -119,14 +119,6 @@ namespace llvm { VDUP, VDUPLANE, - // Vector load/store with (de)interleaving - VLD2D, - VLD3D, - VLD4D, - VST2D, - VST3D, - VST4D, - // Vector shuffles: VEXT, // extract VREV64, // reverse elements within 64-bit doublewords diff --git a/libclamav/c++/llvm/lib/Target/ARM/ARMInstrFormats.td b/libclamav/c++/llvm/lib/Target/ARM/ARMInstrFormats.td index deff83b1c..62e64dbc0 100644 --- a/libclamav/c++/llvm/lib/Target/ARM/ARMInstrFormats.td +++ b/libclamav/c++/llvm/lib/Target/ARM/ARMInstrFormats.td @@ -1212,8 +1212,8 @@ class NI4 pattern } class NLdSt pattern> - : NeonI { + string asm, string cstr, list pattern> + : NeonI { let Inst{31-24} = 0b11110100; } diff --git a/libclamav/c++/llvm/lib/Target/ARM/ARMInstrInfo.td b/libclamav/c++/llvm/lib/Target/ARM/ARMInstrInfo.td index 21b42885d..233a4ea47 100644 --- a/libclamav/c++/llvm/lib/Target/ARM/ARMInstrInfo.td +++ b/libclamav/c++/llvm/lib/Target/ARM/ARMInstrInfo.td @@ -529,42 +529,42 @@ PseudoInst<(outs), (ins i32imm:$line, i32imm:$col, i32imm:$file), NoItinerary, // Address computation and loads and stores in PIC mode. let isNotDuplicable = 1 in { def PICADD : AXI1<0b0100, (outs GPR:$dst), (ins GPR:$a, pclabel:$cp, pred:$p), - Pseudo, IIC_iALUr, "$cp:\n\tadd$p $dst, pc, $a", + Pseudo, IIC_iALUr, "\n$cp:\n\tadd$p $dst, pc, $a", [(set GPR:$dst, (ARMpic_add GPR:$a, imm:$cp))]>; let AddedComplexity = 10 in { let canFoldAsLoad = 1 in def PICLDR : AXI2ldw<(outs GPR:$dst), (ins addrmodepc:$addr, pred:$p), - Pseudo, IIC_iLoadr, "${addr:label}:\n\tldr$p $dst, $addr", + Pseudo, IIC_iLoadr, "\n${addr:label}:\n\tldr$p $dst, $addr", [(set GPR:$dst, (load addrmodepc:$addr))]>; def PICLDRH : AXI3ldh<(outs GPR:$dst), (ins addrmodepc:$addr, pred:$p), - Pseudo, IIC_iLoadr, "${addr:label}:\n\tldr${p}h $dst, $addr", + Pseudo, IIC_iLoadr, "\n${addr:label}:\n\tldr${p}h $dst, $addr", [(set GPR:$dst, (zextloadi16 addrmodepc:$addr))]>; def PICLDRB : AXI2ldb<(outs GPR:$dst), (ins addrmodepc:$addr, pred:$p), - Pseudo, IIC_iLoadr, "${addr:label}:\n\tldr${p}b $dst, $addr", + Pseudo, IIC_iLoadr, "\n${addr:label}:\n\tldr${p}b $dst, $addr", [(set GPR:$dst, (zextloadi8 addrmodepc:$addr))]>; def PICLDRSH : AXI3ldsh<(outs GPR:$dst), (ins addrmodepc:$addr, pred:$p), - Pseudo, IIC_iLoadr, "${addr:label}:\n\tldr${p}sh $dst, $addr", + Pseudo, IIC_iLoadr, "\n${addr:label}:\n\tldr${p}sh $dst, $addr", [(set GPR:$dst, (sextloadi16 addrmodepc:$addr))]>; def PICLDRSB : AXI3ldsb<(outs GPR:$dst), (ins addrmodepc:$addr, pred:$p), - Pseudo, IIC_iLoadr, "${addr:label}:\n\tldr${p}sb $dst, $addr", + Pseudo, IIC_iLoadr, "\n${addr:label}:\n\tldr${p}sb $dst, $addr", [(set GPR:$dst, (sextloadi8 addrmodepc:$addr))]>; } let AddedComplexity = 10 in { def PICSTR : AXI2stw<(outs), (ins GPR:$src, addrmodepc:$addr, pred:$p), - Pseudo, IIC_iStorer, "${addr:label}:\n\tstr$p $src, $addr", + Pseudo, IIC_iStorer, "\n${addr:label}:\n\tstr$p $src, $addr", [(store GPR:$src, addrmodepc:$addr)]>; def PICSTRH : AXI3sth<(outs), (ins GPR:$src, addrmodepc:$addr, pred:$p), - Pseudo, IIC_iStorer, "${addr:label}:\n\tstr${p}h $src, $addr", + Pseudo, IIC_iStorer, "\n${addr:label}:\n\tstr${p}h $src, $addr", [(truncstorei16 GPR:$src, addrmodepc:$addr)]>; def PICSTRB : AXI2stb<(outs), (ins GPR:$src, addrmodepc:$addr, pred:$p), - Pseudo, IIC_iStorer, "${addr:label}:\n\tstr${p}b $src, $addr", + Pseudo, IIC_iStorer, "\n${addr:label}:\n\tstr${p}b $src, $addr", [(truncstorei8 GPR:$src, addrmodepc:$addr)]>; } } // isNotDuplicable = 1 @@ -767,7 +767,7 @@ let mayLoad = 1 in { // Load doubleword def LDRD : AI3ldd<(outs GPR:$dst1, GPR:$dst2), (ins addrmode3:$addr), LdMiscFrm, IIC_iLoadr, "ldr", "d $dst1, $addr", - []>, Requires<[IsARM, HasV5T]>; + []>, Requires<[IsARM, HasV5TE]>; // Indexed loads def LDR_PRE : AI2ldwpr<(outs GPR:$dst, GPR:$base_wb), @@ -829,7 +829,7 @@ def STRB : AI2stb<(outs), (ins GPR:$src, addrmode2:$addr), StFrm, IIC_iStorer, let mayStore = 1 in def STRD : AI3std<(outs), (ins GPR:$src1, GPR:$src2, addrmode3:$addr), StMiscFrm, IIC_iStorer, - "str", "d $src1, $addr", []>, Requires<[IsARM, HasV5T]>; + "str", "d $src1, $addr", []>, Requires<[IsARM, HasV5TE]>; // Indexed stores def STR_PRE : AI2stwpr<(outs GPR:$base_wb), diff --git a/libclamav/c++/llvm/lib/Target/ARM/ARMInstrNEON.td b/libclamav/c++/llvm/lib/Target/ARM/ARMInstrNEON.td index 4733ba0ff..c278e8b07 100644 --- a/libclamav/c++/llvm/lib/Target/ARM/ARMInstrNEON.td +++ b/libclamav/c++/llvm/lib/Target/ARM/ARMInstrNEON.td @@ -73,33 +73,6 @@ def NEONvduplane : SDNode<"ARMISD::VDUPLANE", SDTypeProfile<1, 2, [SDTCisVec<0>, SDTCisVec<1>, SDTCisVT<2, i32>]>>; -def SDTARMVLD2 : SDTypeProfile<2, 1, [SDTCisSameAs<0, 1>, SDTCisPtrTy<2>]>; -def SDTARMVLD3 : SDTypeProfile<3, 1, [SDTCisSameAs<0, 1>, - SDTCisSameAs<0, 2>, SDTCisPtrTy<3>]>; -def SDTARMVLD4 : SDTypeProfile<4, 1, [SDTCisSameAs<0, 1>, - SDTCisSameAs<0, 2>, - SDTCisSameAs<0, 3>, SDTCisPtrTy<4>]>; -def NEONvld2d : SDNode<"ARMISD::VLD2D", SDTARMVLD2, - [SDNPHasChain, SDNPMayLoad]>; -def NEONvld3d : SDNode<"ARMISD::VLD3D", SDTARMVLD3, - [SDNPHasChain, SDNPMayLoad]>; -def NEONvld4d : SDNode<"ARMISD::VLD4D", SDTARMVLD4, - [SDNPHasChain, SDNPMayLoad]>; - -def SDTARMVST2 : SDTypeProfile<0, 3, [SDTCisPtrTy<0>, SDTCisSameAs<1, 2>]>; -def SDTARMVST3 : SDTypeProfile<0, 4, [SDTCisPtrTy<0>, SDTCisSameAs<1, 2>, - SDTCisSameAs<1, 3>]>; -def SDTARMVST4 : SDTypeProfile<0, 5, [SDTCisPtrTy<0>, SDTCisSameAs<1, 2>, - SDTCisSameAs<1, 3>, - SDTCisSameAs<1, 4>]>; - -def NEONvst2d : SDNode<"ARMISD::VST2D", SDTARMVST2, - [SDNPHasChain, SDNPMayStore]>; -def NEONvst3d : SDNode<"ARMISD::VST3D", SDTARMVST3, - [SDNPHasChain, SDNPMayStore]>; -def NEONvst4d : SDNode<"ARMISD::VST4D", SDTARMVST4, - [SDNPHasChain, SDNPMayStore]>; - def SDTARMVEXT : SDTypeProfile<1, 3, [SDTCisVec<0>, SDTCisSameAs<0, 1>, SDTCisSameAs<0, 2>, SDTCisVT<3, i32>]>; def NEONvext : SDNode<"ARMISD::VEXT", SDTARMVEXT>; @@ -183,14 +156,12 @@ def VSTRQ : NI4<(outs), (ins QPR:$src, addrmode4:$addr), // VLD1 : Vector Load (multiple single elements) class VLD1D - : NLdSt<(outs DPR:$dst), (ins addrmode6:$addr), - NoItinerary, - !strconcat(OpcodeStr, "\t\\{$dst\\}, $addr"), + : NLdSt<(outs DPR:$dst), (ins addrmode6:$addr), NoItinerary, + !strconcat(OpcodeStr, "\t\\{$dst\\}, $addr"), "", [(set DPR:$dst, (Ty (IntOp addrmode6:$addr)))]>; class VLD1Q - : NLdSt<(outs QPR:$dst), (ins addrmode6:$addr), - NoItinerary, - !strconcat(OpcodeStr, "\t${dst:dregpair}, $addr"), + : NLdSt<(outs QPR:$dst), (ins addrmode6:$addr), NoItinerary, + !strconcat(OpcodeStr, "\t${dst:dregpair}, $addr"), "", [(set QPR:$dst, (Ty (IntOp addrmode6:$addr)))]>; def VLD1d8 : VLD1D<"vld1.8", v8i8, int_arm_neon_vld1>; @@ -209,9 +180,8 @@ let mayLoad = 1 in { // VLD2 : Vector Load (multiple 2-element structures) class VLD2D - : NLdSt<(outs DPR:$dst1, DPR:$dst2), (ins addrmode6:$addr), - NoItinerary, - !strconcat(OpcodeStr, "\t\\{$dst1,$dst2\\}, $addr"), []>; + : NLdSt<(outs DPR:$dst1, DPR:$dst2), (ins addrmode6:$addr), NoItinerary, + !strconcat(OpcodeStr, "\t\\{$dst1,$dst2\\}, $addr"), "", []>; def VLD2d8 : VLD2D<"vld2.8">; def VLD2d16 : VLD2D<"vld2.16">; @@ -221,7 +191,7 @@ def VLD2d32 : VLD2D<"vld2.32">; class VLD3D : NLdSt<(outs DPR:$dst1, DPR:$dst2, DPR:$dst3), (ins addrmode6:$addr), NoItinerary, - !strconcat(OpcodeStr, "\t\\{$dst1,$dst2,$dst3\\}, $addr"), []>; + !strconcat(OpcodeStr, "\t\\{$dst1,$dst2,$dst3\\}, $addr"), "", []>; def VLD3d8 : VLD3D<"vld3.8">; def VLD3d16 : VLD3D<"vld3.16">; @@ -230,9 +200,9 @@ def VLD3d32 : VLD3D<"vld3.32">; // VLD4 : Vector Load (multiple 4-element structures) class VLD4D : NLdSt<(outs DPR:$dst1, DPR:$dst2, DPR:$dst3, DPR:$dst4), - (ins addrmode6:$addr), - NoItinerary, - !strconcat(OpcodeStr, "\t\\{$dst1,$dst2,$dst3,$dst4\\}, $addr"), []>; + (ins addrmode6:$addr), NoItinerary, + !strconcat(OpcodeStr, "\t\\{$dst1,$dst2,$dst3,$dst4\\}, $addr"), + "", []>; def VLD4d8 : VLD4D<"vld4.8">; def VLD4d16 : VLD4D<"vld4.16">; @@ -241,14 +211,12 @@ def VLD4d32 : VLD4D<"vld4.32">; // VST1 : Vector Store (multiple single elements) class VST1D - : NLdSt<(outs), (ins addrmode6:$addr, DPR:$src), - NoItinerary, - !strconcat(OpcodeStr, "\t\\{$src\\}, $addr"), + : NLdSt<(outs), (ins addrmode6:$addr, DPR:$src), NoItinerary, + !strconcat(OpcodeStr, "\t\\{$src\\}, $addr"), "", [(IntOp addrmode6:$addr, (Ty DPR:$src))]>; class VST1Q - : NLdSt<(outs), (ins addrmode6:$addr, QPR:$src), - NoItinerary, - !strconcat(OpcodeStr, "\t${src:dregpair}, $addr"), + : NLdSt<(outs), (ins addrmode6:$addr, QPR:$src), NoItinerary, + !strconcat(OpcodeStr, "\t${src:dregpair}, $addr"), "", [(IntOp addrmode6:$addr, (Ty QPR:$src))]>; def VST1d8 : VST1D<"vst1.8", v8i8, int_arm_neon_vst1>; @@ -268,7 +236,7 @@ let mayStore = 1 in { // VST2 : Vector Store (multiple 2-element structures) class VST2D : NLdSt<(outs), (ins addrmode6:$addr, DPR:$src1, DPR:$src2), NoItinerary, - !strconcat(OpcodeStr, "\t\\{$src1,$src2\\}, $addr"), []>; + !strconcat(OpcodeStr, "\t\\{$src1,$src2\\}, $addr"), "", []>; def VST2d8 : VST2D<"vst2.8">; def VST2d16 : VST2D<"vst2.16">; @@ -278,7 +246,7 @@ def VST2d32 : VST2D<"vst2.32">; class VST3D : NLdSt<(outs), (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3), NoItinerary, - !strconcat(OpcodeStr, "\t\\{$src1,$src2,$src3\\}, $addr"), []>; + !strconcat(OpcodeStr, "\t\\{$src1,$src2,$src3\\}, $addr"), "", []>; def VST3d8 : VST3D<"vst3.8">; def VST3d16 : VST3D<"vst3.16">; @@ -288,7 +256,8 @@ def VST3d32 : VST3D<"vst3.32">; class VST4D : NLdSt<(outs), (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4), NoItinerary, - !strconcat(OpcodeStr, "\t\\{$src1,$src2,$src3,$src4\\}, $addr"), []>; + !strconcat(OpcodeStr, "\t\\{$src1,$src2,$src3,$src4\\}, $addr"), + "", []>; def VST4d8 : VST4D<"vst4.8">; def VST4d16 : VST4D<"vst4.16">; @@ -315,7 +284,7 @@ def DSubReg_f64_reg : SDNodeXFormgetTargetConstant(5 + N->getZExtValue(), MVT::i32); }]>; -// Extract S sub-registers of Q registers. +// Extract S sub-registers of Q/D registers. // (arm_ssubreg_0 is 1; arm_ssubreg_1 is 2; etc.) def SSubReg_f32_reg : SDNodeXFormgetTargetConstant(1 + N->getZExtValue(), MVT::i32); @@ -1703,6 +1672,8 @@ def : Pat<(extractelt (v4i32 QPR:$src), imm:$lane), (VGETLNi32 (v2i32 (EXTRACT_SUBREG QPR:$src, (DSubReg_i32_reg imm:$lane))), (SubReg_i32_lane imm:$lane))>; +def : Pat<(extractelt (v2f32 DPR:$src1), imm:$src2), + (EXTRACT_SUBREG DPR:$src1, (SSubReg_f32_reg imm:$src2))>; def : Pat<(extractelt (v4f32 QPR:$src1), imm:$src2), (EXTRACT_SUBREG QPR:$src1, (SSubReg_f32_reg imm:$src2))>; //def : Pat<(extractelt (v2i64 QPR:$src1), imm:$src2), @@ -1749,6 +1720,8 @@ def : Pat<(insertelt (v4i32 QPR:$src1), GPR:$src2, imm:$lane), GPR:$src2, (SubReg_i32_lane imm:$lane)), (DSubReg_i32_reg imm:$lane)))>; +def : Pat<(v2f32 (insertelt DPR:$src1, SPR:$src2, imm:$src3)), + (INSERT_SUBREG DPR:$src1, SPR:$src2, (SSubReg_f32_reg imm:$src3))>; def : Pat<(v4f32 (insertelt QPR:$src1, SPR:$src2, imm:$src3)), (INSERT_SUBREG QPR:$src1, SPR:$src2, (SSubReg_f32_reg imm:$src3))>; @@ -1757,6 +1730,33 @@ def : Pat<(v4f32 (insertelt QPR:$src1, SPR:$src2, imm:$src3)), def : Pat<(v2f64 (insertelt QPR:$src1, DPR:$src2, imm:$src3)), (INSERT_SUBREG QPR:$src1, DPR:$src2, (DSubReg_f64_reg imm:$src3))>; +def : Pat<(v2f32 (scalar_to_vector SPR:$src)), + (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$src, arm_ssubreg_0)>; +def : Pat<(v2f64 (scalar_to_vector DPR:$src)), + (INSERT_SUBREG (v2f64 (IMPLICIT_DEF)), DPR:$src, arm_dsubreg_0)>; +def : Pat<(v4f32 (scalar_to_vector SPR:$src)), + (INSERT_SUBREG (v4f32 (IMPLICIT_DEF)), SPR:$src, arm_ssubreg_0)>; + +def : Pat<(v8i8 (scalar_to_vector GPR:$src)), + (VSETLNi8 (v8i8 (IMPLICIT_DEF)), GPR:$src, (i32 0))>; +def : Pat<(v4i16 (scalar_to_vector GPR:$src)), + (VSETLNi16 (v4i16 (IMPLICIT_DEF)), GPR:$src, (i32 0))>; +def : Pat<(v2i32 (scalar_to_vector GPR:$src)), + (VSETLNi32 (v2i32 (IMPLICIT_DEF)), GPR:$src, (i32 0))>; + +def : Pat<(v16i8 (scalar_to_vector GPR:$src)), + (INSERT_SUBREG (v16i8 (IMPLICIT_DEF)), + (VSETLNi8 (v8i8 (IMPLICIT_DEF)), GPR:$src, (i32 0)), + arm_dsubreg_0)>; +def : Pat<(v8i16 (scalar_to_vector GPR:$src)), + (INSERT_SUBREG (v8i16 (IMPLICIT_DEF)), + (VSETLNi16 (v4i16 (IMPLICIT_DEF)), GPR:$src, (i32 0)), + arm_dsubreg_0)>; +def : Pat<(v4i32 (scalar_to_vector GPR:$src)), + (INSERT_SUBREG (v4i32 (IMPLICIT_DEF)), + (VSETLNi32 (v2i32 (IMPLICIT_DEF)), GPR:$src, (i32 0)), + arm_dsubreg_0)>; + // VDUP : Vector Duplicate (from ARM core register to all elements) class VDUPD opcod1, bits<2> opcod3, string asmSize, ValueType Ty> diff --git a/libclamav/c++/llvm/lib/Target/ARM/ARMInstrThumb.td b/libclamav/c++/llvm/lib/Target/ARM/ARMInstrThumb.td index b332042f5..b5159f969 100644 --- a/libclamav/c++/llvm/lib/Target/ARM/ARMInstrThumb.td +++ b/libclamav/c++/llvm/lib/Target/ARM/ARMInstrThumb.td @@ -130,7 +130,7 @@ PseudoInst<(outs), (ins i32imm:$amt), NoItinerary, // For both thumb1 and thumb2. let isNotDuplicable = 1 in def tPICADD : TIt<(outs GPR:$dst), (ins GPR:$lhs, pclabel:$cp), IIC_iALUr, - "$cp:\n\tadd $dst, pc", + "\n$cp:\n\tadd $dst, pc", [(set GPR:$dst, (ARMpic_add GPR:$lhs, imm:$cp))]>; // PC relative add. @@ -701,13 +701,19 @@ def : T1Pat<(extloadi1 t_addrmode_s1:$addr), (tLDRB t_addrmode_s1:$addr)>; def : T1Pat<(extloadi8 t_addrmode_s1:$addr), (tLDRB t_addrmode_s1:$addr)>; def : T1Pat<(extloadi16 t_addrmode_s2:$addr), (tLDRH t_addrmode_s2:$addr)>; -// If it's possible to use [r,r] address mode for sextload, select to +// If it's impossible to use [r,r] address mode for sextload, select to // ldr{b|h} + sxt{b|h} instead. def : T1Pat<(sextloadi8 t_addrmode_s1:$addr), - (tSXTB (tLDRB t_addrmode_s1:$addr))>; + (tSXTB (tLDRB t_addrmode_s1:$addr))>, + Requires<[IsThumb1Only, HasV6]>; def : T1Pat<(sextloadi16 t_addrmode_s2:$addr), - (tSXTH (tLDRH t_addrmode_s2:$addr))>; + (tSXTH (tLDRH t_addrmode_s2:$addr))>, + Requires<[IsThumb1Only, HasV6]>; +def : T1Pat<(sextloadi8 t_addrmode_s1:$addr), + (tASRri (tLSLri (tLDRB t_addrmode_s1:$addr), 24), 24)>; +def : T1Pat<(sextloadi16 t_addrmode_s1:$addr), + (tASRri (tLSLri (tLDRH t_addrmode_s1:$addr), 16), 16)>; // Large immediate handling. diff --git a/libclamav/c++/llvm/lib/Target/ARM/ARMInstrThumb2.td b/libclamav/c++/llvm/lib/Target/ARM/ARMInstrThumb2.td index 5dd40546b..0108e8fcd 100644 --- a/libclamav/c++/llvm/lib/Target/ARM/ARMInstrThumb2.td +++ b/libclamav/c++/llvm/lib/Target/ARM/ARMInstrThumb2.td @@ -384,13 +384,13 @@ multiclass T2I_st { /// T2I_picld - Defines the PIC load pattern. class T2I_picld : T2I<(outs GPR:$dst), (ins addrmodepc:$addr), IIC_iLoadi, - !strconcat("${addr:label}:\n\t", opc), " $dst, $addr", + !strconcat("\n${addr:label}:\n\t", opc), " $dst, $addr", [(set GPR:$dst, (opnode addrmodepc:$addr))]>; /// T2I_picst - Defines the PIC store pattern. class T2I_picst : T2I<(outs), (ins GPR:$src, addrmodepc:$addr), IIC_iStorer, - !strconcat("${addr:label}:\n\t", opc), " $src, $addr", + !strconcat("\n${addr:label}:\n\t", opc), " $src, $addr", [(opnode GPR:$src, addrmodepc:$addr)]>; diff --git a/libclamav/c++/llvm/lib/Target/ARM/ARMSubtarget.cpp b/libclamav/c++/llvm/lib/Target/ARM/ARMSubtarget.cpp index ba63ff42c..67669cc7b 100644 --- a/libclamav/c++/llvm/lib/Target/ARM/ARMSubtarget.cpp +++ b/libclamav/c++/llvm/lib/Target/ARM/ARMSubtarget.cpp @@ -13,6 +13,7 @@ #include "ARMSubtarget.h" #include "ARMGenSubtarget.inc" +#include "llvm/GlobalValue.h" #include "llvm/Target/TargetOptions.h" #include "llvm/Support/CommandLine.h" using namespace llvm; @@ -92,3 +93,13 @@ ARMSubtarget::ARMSubtarget(const std::string &TT, const std::string &FS, if (isTargetDarwin()) IsR9Reserved = ReserveR9 | (ARMArchVersion < V6); } + +/// GVIsIndirectSymbol - true if the GV will be accessed via an indirect symbol. +bool ARMSubtarget::GVIsIndirectSymbol(GlobalValue *GV, bool isStatic) const { + // If symbol visibility is hidden, the extra load is not needed if + // the symbol is definitely defined in the current translation unit. + bool isDecl = GV->isDeclaration() || GV->hasAvailableExternallyLinkage(); + if (GV->hasHiddenVisibility() && (!isDecl && !GV->hasCommonLinkage())) + return false; + return !isStatic && (isDecl || GV->isWeakForLinker()); +} diff --git a/libclamav/c++/llvm/lib/Target/ARM/ARMSubtarget.h b/libclamav/c++/llvm/lib/Target/ARM/ARMSubtarget.h index ca0a98ea7..73f973618 100644 --- a/libclamav/c++/llvm/lib/Target/ARM/ARMSubtarget.h +++ b/libclamav/c++/llvm/lib/Target/ARM/ARMSubtarget.h @@ -19,6 +19,7 @@ #include namespace llvm { +class GlobalValue; class ARMSubtarget : public TargetSubtarget { protected: @@ -129,6 +130,10 @@ protected: /// stack frame on entry to the function and which must be maintained by every /// function for this subtarget. unsigned getStackAlignment() const { return stackAlignment; } + + /// GVIsIndirectSymbol - true if the GV will be accessed via an indirect + /// symbol. + bool GVIsIndirectSymbol(GlobalValue *GV, bool isStatic) const; }; } // End llvm namespace diff --git a/libclamav/c++/llvm/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp b/libclamav/c++/llvm/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp index ded8c0677..d782cdedc 100644 --- a/libclamav/c++/llvm/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp +++ b/libclamav/c++/llvm/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp @@ -79,34 +79,6 @@ namespace { /// visibility that require non-lazy-pointers for indirect access. StringMap HiddenGVNonLazyPtrs; - struct FnStubInfo { - std::string Stub, LazyPtr, SLP, SCV; - - FnStubInfo() {} - - void Init(const GlobalValue *GV, Mangler *Mang) { - // Already initialized. - if (!Stub.empty()) return; - Stub = Mang->getMangledName(GV, "$stub", true); - LazyPtr = Mang->getMangledName(GV, "$lazy_ptr", true); - SLP = Mang->getMangledName(GV, "$slp", true); - SCV = Mang->getMangledName(GV, "$scv", true); - } - - void Init(const std::string &GV, Mangler *Mang) { - // Already initialized. - if (!Stub.empty()) return; - Stub = Mang->makeNameProper(GV + "$stub", Mangler::Private); - LazyPtr = Mang->makeNameProper(GV + "$lazy_ptr", Mangler::Private); - SLP = Mang->makeNameProper(GV + "$slp", Mangler::Private); - SCV = Mang->makeNameProper(GV + "$scv", Mangler::Private); - } - }; - - /// FnStubs - Keeps the set of external function GlobalAddresses that the - /// asm printer should generate stubs for. - StringMap FnStubs; - /// True if asm printer is printing a series of CONSTPOOL_ENTRY. bool InCPMode; public: @@ -188,36 +160,26 @@ namespace { GlobalValue *GV = ACPV->getGV(); std::string Name; - - if (ACPV->isNonLazyPointer()) { - std::string SymName = Mang->getMangledName(GV); - Name = Mang->getMangledName(GV, "$non_lazy_ptr", true); - - if (GV->hasHiddenVisibility()) - HiddenGVNonLazyPtrs[SymName] = Name; - else - GVNonLazyPtrs[SymName] = Name; - } else if (ACPV->isStub()) { - if (GV) { - FnStubInfo &FnInfo = FnStubs[Mang->getMangledName(GV)]; - FnInfo.Init(GV, Mang); - Name = FnInfo.Stub; - } else { - FnStubInfo &FnInfo = FnStubs[Mang->makeNameProper(ACPV->getSymbol())]; - FnInfo.Init(ACPV->getSymbol(), Mang); - Name = FnInfo.Stub; - } - } else { - if (GV) + if (GV) { + bool isIndirect = Subtarget->isTargetDarwin() && + Subtarget->GVIsIndirectSymbol(GV, + TM.getRelocationModel() == Reloc::Static); + if (!isIndirect) Name = Mang->getMangledName(GV); - else if (!strncmp(ACPV->getSymbol(), "L_lsda_", 7)) - Name = ACPV->getSymbol(); - else - Name = Mang->makeNameProper(ACPV->getSymbol()); - } - O << Name; - - + else { + // FIXME: Remove this when Darwin transition to @GOT like syntax. + std::string SymName = Mang->getMangledName(GV); + Name = Mang->getMangledName(GV, "$non_lazy_ptr", true); + if (GV->hasHiddenVisibility()) + HiddenGVNonLazyPtrs[SymName] = Name; + else + GVNonLazyPtrs[SymName] = Name; + } + } else if (!strncmp(ACPV->getSymbol(), "L_lsda_", 7)) + Name = ACPV->getSymbol(); + else + Name = Mang->makeNameProper(ACPV->getSymbol()); + O << Name; if (ACPV->hasModifier()) O << "(" << ACPV->getModifier() << ")"; if (ACPV->getPCAdjustment() != 0) { @@ -372,18 +334,7 @@ void ARMAsmPrinter::printOperand(const MachineInstr *MI, int OpNum, case MachineOperand::MO_GlobalAddress: { bool isCallOp = Modifier && !strcmp(Modifier, "call"); GlobalValue *GV = MO.getGlobal(); - std::string Name; - bool isExt = GV->isDeclaration() || GV->isWeakForLinker(); - if (isExt && isCallOp && Subtarget->isTargetDarwin() && - TM.getRelocationModel() != Reloc::Static) { - FnStubInfo &FnInfo = FnStubs[Mang->getMangledName(GV)]; - FnInfo.Init(GV, Mang); - Name = FnInfo.Stub; - } else { - Name = Mang->getMangledName(GV); - } - - O << Name; + O << Mang->getMangledName(GV); printOffset(MO.getOffset()); @@ -394,14 +345,7 @@ void ARMAsmPrinter::printOperand(const MachineInstr *MI, int OpNum, } case MachineOperand::MO_ExternalSymbol: { bool isCallOp = Modifier && !strcmp(Modifier, "call"); - std::string Name; - if (isCallOp && Subtarget->isTargetDarwin() && - TM.getRelocationModel() != Reloc::Static) { - FnStubInfo &FnInfo = FnStubs[Mang->makeNameProper(MO.getSymbolName())]; - FnInfo.Init(MO.getSymbolName(), Mang); - Name = FnInfo.Stub; - } else - Name = Mang->makeNameProper(MO.getSymbolName()); + std::string Name = Mang->makeNameProper(MO.getSymbolName()); O << Name; if (isCallOp && Subtarget->isTargetELF() && @@ -1277,55 +1221,7 @@ bool ARMAsmPrinter::doFinalization(Module &M) { static_cast(getObjFileLowering()); O << '\n'; - - if (!FnStubs.empty()) { - unsigned StubSize = 12; - const char *StubSectionName = "__symbol_stub4"; - - if (TM.getRelocationModel() == Reloc::PIC_) { - StubSize = 16; - StubSectionName = "__picsymbolstub4"; - } - - const MCSection *StubSection - = TLOFMacho.getMachOSection("__TEXT", StubSectionName, - MCSectionMachO::S_SYMBOL_STUBS, - StubSize, SectionKind::getText()); - const MCSection *LazySymbolPointerSection - = TLOFMacho.getLazySymbolPointerSection(); - - // Output stubs for dynamically-linked functions - for (StringMap::iterator I = FnStubs.begin(), - E = FnStubs.end(); I != E; ++I) { - const FnStubInfo &Info = I->second; - - OutStreamer.SwitchSection(StubSection); - EmitAlignment(2); - O << "\t.code\t32\n"; - - O << Info.Stub << ":\n"; - O << "\t.indirect_symbol " << I->getKeyData() << '\n'; - O << "\tldr ip, " << Info.SLP << '\n'; - if (TM.getRelocationModel() == Reloc::PIC_) { - O << Info.SCV << ":\n"; - O << "\tadd ip, pc, ip\n"; - } - O << "\tldr pc, [ip, #0]\n"; - O << Info.SLP << ":\n"; - O << "\t.long\t" << Info.LazyPtr; - if (TM.getRelocationModel() == Reloc::PIC_) - O << "-(" << Info.SCV << "+8)"; - O << '\n'; - - OutStreamer.SwitchSection(LazySymbolPointerSection); - O << Info.LazyPtr << ":\n"; - O << "\t.indirect_symbol " << I->getKeyData() << "\n"; - O << "\t.long\tdyld_stub_binding_helper\n"; - } - O << '\n'; - } - // Output non-lazy-pointers for external and common global variables. if (!GVNonLazyPtrs.empty()) { // Switch with ".non_lazy_symbol_pointer" directive. @@ -1349,7 +1245,6 @@ bool ARMAsmPrinter::doFinalization(Module &M) { } } - // Funny Darwin hack: This flag tells the linker that no global symbols // contain code that falls through to other global symbols (e.g. the obvious // implementation of multiple entry points). If this doesn't occur, the diff --git a/libclamav/c++/llvm/lib/Target/ARM/AsmPrinter/Makefile b/libclamav/c++/llvm/lib/Target/ARM/AsmPrinter/Makefile index ce36cec47..208beccce 100644 --- a/libclamav/c++/llvm/lib/Target/ARM/AsmPrinter/Makefile +++ b/libclamav/c++/llvm/lib/Target/ARM/AsmPrinter/Makefile @@ -1,4 +1,4 @@ -##===- lib/Target/ARM/Makefile -----------------------------*- Makefile -*-===## +##===- lib/Target/ARM/AsmPrinter/Makefile ------------------*- Makefile -*-===## # # The LLVM Compiler Infrastructure # diff --git a/libclamav/c++/llvm/lib/Target/ARM/CMakeLists.txt b/libclamav/c++/llvm/lib/Target/ARM/CMakeLists.txt index 10d50d42b..6e09eb2ff 100644 --- a/libclamav/c++/llvm/lib/Target/ARM/CMakeLists.txt +++ b/libclamav/c++/llvm/lib/Target/ARM/CMakeLists.txt @@ -22,9 +22,9 @@ add_llvm_target(ARMCodeGen ARMISelLowering.cpp ARMJITInfo.cpp ARMLoadStoreOptimizer.cpp + ARMMCAsmInfo.cpp ARMRegisterInfo.cpp ARMSubtarget.cpp - ARMMCAsmInfo.cpp ARMTargetMachine.cpp NEONPreAllocPass.cpp Thumb1InstrInfo.cpp diff --git a/libclamav/c++/llvm/lib/Target/ARM/Thumb2InstrInfo.cpp b/libclamav/c++/llvm/lib/Target/ARM/Thumb2InstrInfo.cpp index d37f61e49..8c09ebd3e 100644 --- a/libclamav/c++/llvm/lib/Target/ARM/Thumb2InstrInfo.cpp +++ b/libclamav/c++/llvm/lib/Target/ARM/Thumb2InstrInfo.cpp @@ -319,9 +319,9 @@ immediateOffsetOpcode(unsigned opcode) return 0; } -int llvm::rewriteT2FrameIndex(MachineInstr &MI, unsigned FrameRegIdx, - unsigned FrameReg, int Offset, - const ARMBaseInstrInfo &TII) { +bool llvm::rewriteT2FrameIndex(MachineInstr &MI, unsigned FrameRegIdx, + unsigned FrameReg, int &Offset, + const ARMBaseInstrInfo &TII) { unsigned Opcode = MI.getOpcode(); const TargetInstrDesc &Desc = MI.getDesc(); unsigned AddrMode = (Desc.TSFlags & ARMII::AddrModeMask); @@ -340,7 +340,8 @@ int llvm::rewriteT2FrameIndex(MachineInstr &MI, unsigned FrameRegIdx, MI.setDesc(TII.get(ARM::tMOVgpr2gpr)); MI.getOperand(FrameRegIdx).ChangeToRegister(FrameReg, false); MI.RemoveOperand(FrameRegIdx+1); - return 0; + Offset = 0; + return true; } if (Offset < 0) { @@ -355,7 +356,8 @@ int llvm::rewriteT2FrameIndex(MachineInstr &MI, unsigned FrameRegIdx, if (ARM_AM::getT2SOImmVal(Offset) != -1) { MI.getOperand(FrameRegIdx).ChangeToRegister(FrameReg, false); MI.getOperand(FrameRegIdx+1).ChangeToImmediate(Offset); - return 0; + Offset = 0; + return true; } // Another common case: imm12. if (Offset < 4096) { @@ -365,7 +367,8 @@ int llvm::rewriteT2FrameIndex(MachineInstr &MI, unsigned FrameRegIdx, MI.setDesc(TII.get(NewOpc)); MI.getOperand(FrameRegIdx).ChangeToRegister(FrameReg, false); MI.getOperand(FrameRegIdx+1).ChangeToImmediate(Offset); - return 0; + Offset = 0; + return true; } // Otherwise, extract 8 adjacent bits from the immediate into this @@ -387,7 +390,7 @@ int llvm::rewriteT2FrameIndex(MachineInstr &MI, unsigned FrameRegIdx, unsigned OffsetReg = MI.getOperand(FrameRegIdx+1).getReg(); if (OffsetReg != 0) { MI.getOperand(FrameRegIdx).ChangeToRegister(FrameReg, false); - return Offset; + return Offset == 0; } MI.RemoveOperand(FrameRegIdx+1); @@ -413,11 +416,14 @@ int llvm::rewriteT2FrameIndex(MachineInstr &MI, unsigned FrameRegIdx, NumBits = 12; } } else { - // VFP address modes. - assert(AddrMode == ARMII::AddrMode5); - int InstrOffs=ARM_AM::getAM5Offset(MI.getOperand(FrameRegIdx+1).getImm()); - if (ARM_AM::getAM5Op(MI.getOperand(FrameRegIdx+1).getImm()) ==ARM_AM::sub) - InstrOffs *= -1; + // VFP and NEON address modes. + int InstrOffs = 0; + if (AddrMode == ARMII::AddrMode5) { + const MachineOperand &OffOp = MI.getOperand(FrameRegIdx+1); + InstrOffs = ARM_AM::getAM5Offset(OffOp.getImm()); + if (ARM_AM::getAM5Op(OffOp.getImm()) == ARM_AM::sub) + InstrOffs *= -1; + } NumBits = 8; Scale = 4; Offset += InstrOffs * 4; @@ -448,7 +454,8 @@ int llvm::rewriteT2FrameIndex(MachineInstr &MI, unsigned FrameRegIdx, ImmedOffset = -ImmedOffset; } ImmOp.ChangeToImmediate(ImmedOffset); - return 0; + Offset = 0; + return true; } // Otherwise, offset doesn't fit. Pull in what we can to simplify @@ -468,5 +475,6 @@ int llvm::rewriteT2FrameIndex(MachineInstr &MI, unsigned FrameRegIdx, Offset &= ~(Mask*Scale); } - return (isSub) ? -Offset : Offset; + Offset = (isSub) ? -Offset : Offset; + return Offset == 0; } diff --git a/libclamav/c++/llvm/lib/Target/Alpha/AsmPrinter/Makefile b/libclamav/c++/llvm/lib/Target/Alpha/AsmPrinter/Makefile index c5b3e9466..3c64a3c60 100644 --- a/libclamav/c++/llvm/lib/Target/Alpha/AsmPrinter/Makefile +++ b/libclamav/c++/llvm/lib/Target/Alpha/AsmPrinter/Makefile @@ -1,4 +1,4 @@ -##===- lib/Target/Alpha/Makefile ---------------------------*- Makefile -*-===## +##===- lib/Target/Alpha/AsmPrinter/Makefile ----------------*- Makefile -*-===## # # The LLVM Compiler Infrastructure # diff --git a/libclamav/c++/llvm/lib/Target/Alpha/CMakeLists.txt b/libclamav/c++/llvm/lib/Target/Alpha/CMakeLists.txt index 13ca18e2d..b4f41aebd 100644 --- a/libclamav/c++/llvm/lib/Target/Alpha/CMakeLists.txt +++ b/libclamav/c++/llvm/lib/Target/Alpha/CMakeLists.txt @@ -19,9 +19,9 @@ add_llvm_target(AlphaCodeGen AlphaISelLowering.cpp AlphaJITInfo.cpp AlphaLLRP.cpp + AlphaMCAsmInfo.cpp AlphaRegisterInfo.cpp AlphaSubtarget.cpp - AlphaMCAsmInfo.cpp AlphaTargetMachine.cpp ) diff --git a/libclamav/c++/llvm/lib/Target/Alpha/TargetInfo/Makefile b/libclamav/c++/llvm/lib/Target/Alpha/TargetInfo/Makefile index 7250358e4..de01d7f8e 100644 --- a/libclamav/c++/llvm/lib/Target/Alpha/TargetInfo/Makefile +++ b/libclamav/c++/llvm/lib/Target/Alpha/TargetInfo/Makefile @@ -1,4 +1,4 @@ -#===- lib/Target/Alpha/TargetInfo/Makefile -----------------*- Makefile -*-===## +##===- lib/Target/Alpha/TargetInfo/Makefile ----------------*- Makefile -*-===## # # The LLVM Compiler Infrastructure # diff --git a/libclamav/c++/llvm/lib/Target/Blackfin/AsmPrinter/Makefile b/libclamav/c++/llvm/lib/Target/Blackfin/AsmPrinter/Makefile index a2b0d1d1a..091d4df0b 100644 --- a/libclamav/c++/llvm/lib/Target/Blackfin/AsmPrinter/Makefile +++ b/libclamav/c++/llvm/lib/Target/Blackfin/AsmPrinter/Makefile @@ -1,4 +1,4 @@ -##===- lib/Target/Blackfin/Makefile ------------------------*- Makefile -*-===## +##===- lib/Target/Blackfin/AsmPrinter/Makefile -------------*- Makefile -*-===## # # The LLVM Compiler Infrastructure # diff --git a/libclamav/c++/llvm/lib/Target/Blackfin/CMakeLists.txt b/libclamav/c++/llvm/lib/Target/Blackfin/CMakeLists.txt index 916ce7340..6c3b2447a 100644 --- a/libclamav/c++/llvm/lib/Target/Blackfin/CMakeLists.txt +++ b/libclamav/c++/llvm/lib/Target/Blackfin/CMakeLists.txt @@ -14,8 +14,8 @@ add_llvm_target(BlackfinCodeGen BlackfinInstrInfo.cpp BlackfinISelDAGToDAG.cpp BlackfinISelLowering.cpp + BlackfinMCAsmInfo.cpp BlackfinRegisterInfo.cpp BlackfinSubtarget.cpp - BlackfinMCAsmInfo.cpp BlackfinTargetMachine.cpp ) diff --git a/libclamav/c++/llvm/lib/Target/CBackend/CBackend.cpp b/libclamav/c++/llvm/lib/Target/CBackend/CBackend.cpp index 6fea22f14..29764aad3 100644 --- a/libclamav/c++/llvm/lib/Target/CBackend/CBackend.cpp +++ b/libclamav/c++/llvm/lib/Target/CBackend/CBackend.cpp @@ -2173,7 +2173,8 @@ void CWriter::printFloatingPointConstants(const Constant *C) { << " = { 0x" << utohexstr(p[0]) << "ULL, 0x" << utohexstr((uint16_t)p[1]) << ",{0,0,0}" << "}; /* Long double constant */\n"; - } else if (FPC->getType() == Type::getPPC_FP128Ty(FPC->getContext())) { + } else if (FPC->getType() == Type::getPPC_FP128Ty(FPC->getContext()) || + FPC->getType() == Type::getFP128Ty(FPC->getContext())) { APInt api = FPC->getValueAPF().bitcastToAPInt(); const uint64_t *p = api.getRawData(); Out << "static const ConstantFP128Ty FPConstant" << FPCounter++ diff --git a/libclamav/c++/llvm/lib/Target/CMakeLists.txt b/libclamav/c++/llvm/lib/Target/CMakeLists.txt index 888c1a3c0..8769ee297 100644 --- a/libclamav/c++/llvm/lib/Target/CMakeLists.txt +++ b/libclamav/c++/llvm/lib/Target/CMakeLists.txt @@ -12,5 +12,3 @@ add_llvm_library(LLVMTarget TargetRegisterInfo.cpp TargetSubtarget.cpp ) - -# TODO: Support other targets besides X86. See Makefile. diff --git a/libclamav/c++/llvm/lib/Target/CellSPU/AsmPrinter/Makefile b/libclamav/c++/llvm/lib/Target/CellSPU/AsmPrinter/Makefile index dd56df71a..69639efca 100644 --- a/libclamav/c++/llvm/lib/Target/CellSPU/AsmPrinter/Makefile +++ b/libclamav/c++/llvm/lib/Target/CellSPU/AsmPrinter/Makefile @@ -1,4 +1,4 @@ -##===- lib/Target/CellSPU/Makefile -------------------------*- Makefile -*-===## +##===- lib/Target/CellSPU/AsmPrinter/Makefile --------------*- Makefile -*-===## # # The LLVM Compiler Infrastructure # diff --git a/libclamav/c++/llvm/lib/Target/CellSPU/CMakeLists.txt b/libclamav/c++/llvm/lib/Target/CellSPU/CMakeLists.txt index 1b24c4448..0cb6676d7 100644 --- a/libclamav/c++/llvm/lib/Target/CellSPU/CMakeLists.txt +++ b/libclamav/c++/llvm/lib/Target/CellSPU/CMakeLists.txt @@ -17,9 +17,9 @@ add_llvm_target(CellSPUCodeGen SPUInstrInfo.cpp SPUISelDAGToDAG.cpp SPUISelLowering.cpp + SPUMCAsmInfo.cpp SPURegisterInfo.cpp SPUSubtarget.cpp - SPUMCAsmInfo.cpp SPUTargetMachine.cpp ) diff --git a/libclamav/c++/llvm/lib/Target/CellSPU/SPUISelLowering.cpp b/libclamav/c++/llvm/lib/Target/CellSPU/SPUISelLowering.cpp index d0723dc42..324b9ddf8 100644 --- a/libclamav/c++/llvm/lib/Target/CellSPU/SPUISelLowering.cpp +++ b/libclamav/c++/llvm/lib/Target/CellSPU/SPUISelLowering.cpp @@ -350,6 +350,9 @@ SPUTargetLowering::SPUTargetLowering(SPUTargetMachine &TM) // Custom lower i128 -> i64 truncates setOperationAction(ISD::TRUNCATE, MVT::i64, Custom); + // Custom lower i32/i64 -> i128 sign extend + setOperationAction(ISD::SIGN_EXTEND, MVT::i128, Custom); + setOperationAction(ISD::FP_TO_SINT, MVT::i8, Promote); setOperationAction(ISD::FP_TO_UINT, MVT::i8, Promote); setOperationAction(ISD::FP_TO_SINT, MVT::i16, Promote); @@ -511,9 +514,6 @@ SPUTargetLowering::getTargetNodeName(unsigned Opcode) const node_names[(unsigned) SPUISD::VEC2PREFSLOT] = "SPUISD::VEC2PREFSLOT"; node_names[(unsigned) SPUISD::SHLQUAD_L_BITS] = "SPUISD::SHLQUAD_L_BITS"; node_names[(unsigned) SPUISD::SHLQUAD_L_BYTES] = "SPUISD::SHLQUAD_L_BYTES"; - node_names[(unsigned) SPUISD::VEC_SHL] = "SPUISD::VEC_SHL"; - node_names[(unsigned) SPUISD::VEC_SRL] = "SPUISD::VEC_SRL"; - node_names[(unsigned) SPUISD::VEC_SRA] = "SPUISD::VEC_SRA"; node_names[(unsigned) SPUISD::VEC_ROTL] = "SPUISD::VEC_ROTL"; node_names[(unsigned) SPUISD::VEC_ROTR] = "SPUISD::VEC_ROTR"; node_names[(unsigned) SPUISD::ROTBYTES_LEFT] = "SPUISD::ROTBYTES_LEFT"; @@ -1963,7 +1963,9 @@ static SDValue LowerEXTRACT_VECTOR_ELT(SDValue Op, SelectionDAG &DAG) { assert(prefslot_begin != -1 && prefslot_end != -1 && "LowerEXTRACT_VECTOR_ELT: preferred slots uninitialized"); - unsigned int ShufBytes[16]; + unsigned int ShufBytes[16] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + }; for (int i = 0; i < 16; ++i) { // zero fill uppper part of preferred slot, don't care about the // other slots: @@ -2608,6 +2610,61 @@ static SDValue LowerTRUNCATE(SDValue Op, SelectionDAG &DAG) return SDValue(); // Leave the truncate unmolested } +/*! + * Emit the instruction sequence for i64/i32 -> i128 sign extend. The basic + * algorithm is to duplicate the sign bit using rotmai to generate at + * least one byte full of sign bits. Then propagate the "sign-byte" into + * the leftmost words and the i64/i32 into the rightmost words using shufb. + * + * @param Op The sext operand + * @param DAG The current DAG + * @return The SDValue with the entire instruction sequence + */ +static SDValue LowerSIGN_EXTEND(SDValue Op, SelectionDAG &DAG) +{ + DebugLoc dl = Op.getDebugLoc(); + + // Type to extend to + MVT OpVT = Op.getValueType().getSimpleVT(); + EVT VecVT = EVT::getVectorVT(*DAG.getContext(), + OpVT, (128 / OpVT.getSizeInBits())); + + // Type to extend from + SDValue Op0 = Op.getOperand(0); + MVT Op0VT = Op0.getValueType().getSimpleVT(); + + // The type to extend to needs to be a i128 and + // the type to extend from needs to be i64 or i32. + assert((OpVT == MVT::i128 && (Op0VT == MVT::i64 || Op0VT == MVT::i32)) && + "LowerSIGN_EXTEND: input and/or output operand have wrong size"); + + // Create shuffle mask + unsigned mask1 = 0x10101010; // byte 0 - 3 and 4 - 7 + unsigned mask2 = Op0VT == MVT::i64 ? 0x00010203 : 0x10101010; // byte 8 - 11 + unsigned mask3 = Op0VT == MVT::i64 ? 0x04050607 : 0x00010203; // byte 12 - 15 + SDValue shufMask = DAG.getNode(ISD::BUILD_VECTOR, dl, MVT::v4i32, + DAG.getConstant(mask1, MVT::i32), + DAG.getConstant(mask1, MVT::i32), + DAG.getConstant(mask2, MVT::i32), + DAG.getConstant(mask3, MVT::i32)); + + // Word wise arithmetic right shift to generate at least one byte + // that contains sign bits. + MVT mvt = Op0VT == MVT::i64 ? MVT::v2i64 : MVT::v4i32; + SDValue sraVal = DAG.getNode(ISD::SRA, + dl, + mvt, + DAG.getNode(SPUISD::PREFSLOT2VEC, dl, mvt, Op0, Op0), + DAG.getConstant(31, MVT::i32)); + + // Shuffle bytes - Copy the sign bits into the upper 64 bits + // and the input value into the lower 64 bits. + SDValue extShuffle = DAG.getNode(SPUISD::SHUFB, dl, mvt, + DAG.getNode(ISD::ANY_EXTEND, dl, MVT::i128, Op0), sraVal, shufMask); + + return DAG.getNode(ISD::BIT_CONVERT, dl, MVT::i128, extShuffle); +} + //! Custom (target-specific) lowering entry point /*! This is where LLVM's DAG selection process calls to do target-specific @@ -2700,6 +2757,9 @@ SPUTargetLowering::LowerOperation(SDValue Op, SelectionDAG &DAG) case ISD::TRUNCATE: return LowerTRUNCATE(Op, DAG); + + case ISD::SIGN_EXTEND: + return LowerSIGN_EXTEND(Op, DAG); } return SDValue(); @@ -2862,9 +2922,6 @@ SPUTargetLowering::PerformDAGCombine(SDNode *N, DAGCombinerInfo &DCI) const } case SPUISD::SHLQUAD_L_BITS: case SPUISD::SHLQUAD_L_BYTES: - case SPUISD::VEC_SHL: - case SPUISD::VEC_SRL: - case SPUISD::VEC_SRA: case SPUISD::ROTBYTES_LEFT: { SDValue Op1 = N->getOperand(1); @@ -2992,9 +3049,6 @@ SPUTargetLowering::computeMaskedBitsForTargetNode(const SDValue Op, case SPUISD::VEC2PREFSLOT: case SPUISD::SHLQUAD_L_BITS: case SPUISD::SHLQUAD_L_BYTES: - case SPUISD::VEC_SHL: - case SPUISD::VEC_SRL: - case SPUISD::VEC_SRA: case SPUISD::VEC_ROTL: case SPUISD::VEC_ROTR: case SPUISD::ROTBYTES_LEFT: diff --git a/libclamav/c++/llvm/lib/Target/CellSPU/SPUISelLowering.h b/libclamav/c++/llvm/lib/Target/CellSPU/SPUISelLowering.h index b0a118a2a..ca1a66c92 100644 --- a/libclamav/c++/llvm/lib/Target/CellSPU/SPUISelLowering.h +++ b/libclamav/c++/llvm/lib/Target/CellSPU/SPUISelLowering.h @@ -43,9 +43,6 @@ namespace llvm { VEC2PREFSLOT, ///< Extract element 0 SHLQUAD_L_BITS, ///< Rotate quad left, by bits SHLQUAD_L_BYTES, ///< Rotate quad left, by bytes - VEC_SHL, ///< Vector shift left - VEC_SRL, ///< Vector shift right (logical) - VEC_SRA, ///< Vector shift right (arithmetic) VEC_ROTL, ///< Vector rotate left VEC_ROTR, ///< Vector rotate right ROTBYTES_LEFT, ///< Rotate bytes (loads -> ROTQBYI) diff --git a/libclamav/c++/llvm/lib/Target/CellSPU/SPUNodes.td b/libclamav/c++/llvm/lib/Target/CellSPU/SPUNodes.td index 87c4115d1..c722e4b00 100644 --- a/libclamav/c++/llvm/lib/Target/CellSPU/SPUNodes.td +++ b/libclamav/c++/llvm/lib/Target/CellSPU/SPUNodes.td @@ -87,9 +87,9 @@ def SPUshlquad_l_bits: SDNode<"SPUISD::SHLQUAD_L_BITS", SPUvecshift_type, []>; def SPUshlquad_l_bytes: SDNode<"SPUISD::SHLQUAD_L_BYTES", SPUvecshift_type, []>; // Vector shifts (ISD::SHL,SRL,SRA are for _integers_ only): -def SPUvec_shl: SDNode<"SPUISD::VEC_SHL", SPUvecshift_type, []>; -def SPUvec_srl: SDNode<"SPUISD::VEC_SRL", SPUvecshift_type, []>; -def SPUvec_sra: SDNode<"SPUISD::VEC_SRA", SPUvecshift_type, []>; +def SPUvec_shl: SDNode<"ISD::SHL", SPUvecshift_type, []>; +def SPUvec_srl: SDNode<"ISD::SRL", SPUvecshift_type, []>; +def SPUvec_sra: SDNode<"ISD::SRA", SPUvecshift_type, []>; def SPUvec_rotl: SDNode<"SPUISD::VEC_ROTL", SPUvecshift_type, []>; def SPUvec_rotr: SDNode<"SPUISD::VEC_ROTR", SPUvecshift_type, []>; diff --git a/libclamav/c++/llvm/lib/Target/CppBackend/CPPBackend.cpp b/libclamav/c++/llvm/lib/Target/CppBackend/CPPBackend.cpp index bebad6679..e9b3aa901 100644 --- a/libclamav/c++/llvm/lib/Target/CppBackend/CPPBackend.cpp +++ b/libclamav/c++/llvm/lib/Target/CppBackend/CPPBackend.cpp @@ -472,6 +472,7 @@ namespace { HANDLE_ATTR(Nest); HANDLE_ATTR(ReadNone); HANDLE_ATTR(ReadOnly); + HANDLE_ATTR(InlineHint); HANDLE_ATTR(NoInline); HANDLE_ATTR(AlwaysInline); HANDLE_ATTR(OptimizeForSize); diff --git a/libclamav/c++/llvm/lib/Target/MSP430/AsmPrinter/MSP430AsmPrinter.cpp b/libclamav/c++/llvm/lib/Target/MSP430/AsmPrinter/MSP430AsmPrinter.cpp index 8724eefc6..6e2e9599d 100644 --- a/libclamav/c++/llvm/lib/Target/MSP430/AsmPrinter/MSP430AsmPrinter.cpp +++ b/libclamav/c++/llvm/lib/Target/MSP430/AsmPrinter/MSP430AsmPrinter.cpp @@ -58,6 +58,9 @@ namespace { void printCCOperand(const MachineInstr *MI, int OpNum); void printInstruction(const MachineInstr *MI); // autogenerated. void printMachineInstruction(const MachineInstr * MI); + bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo, + unsigned AsmVariant, + const char *ExtraCode); void emitFunctionHeader(const MachineFunction &MF); bool runOnMachineFunction(MachineFunction &F); @@ -243,6 +246,19 @@ void MSP430AsmPrinter::printCCOperand(const MachineInstr *MI, int OpNum) { } } +/// PrintAsmOperand - Print out an operand for an inline asm expression. +/// +bool MSP430AsmPrinter::PrintAsmOperand(const MachineInstr *MI, unsigned OpNo, + unsigned AsmVariant, + const char *ExtraCode) { + // Does this asm operand have a single letter operand modifier? + if (ExtraCode && ExtraCode[0]) + return true; // Unknown modifier. + + printOperand(MI, OpNo); + return false; +} + // Force static initialization. extern "C" void LLVMInitializeMSP430AsmPrinter() { RegisterAsmPrinter X(TheMSP430Target); diff --git a/libclamav/c++/llvm/lib/Target/MSP430/AsmPrinter/Makefile b/libclamav/c++/llvm/lib/Target/MSP430/AsmPrinter/Makefile index 888a2fa50..4f340c673 100644 --- a/libclamav/c++/llvm/lib/Target/MSP430/AsmPrinter/Makefile +++ b/libclamav/c++/llvm/lib/Target/MSP430/AsmPrinter/Makefile @@ -1,4 +1,4 @@ -##===- lib/Target/MSP430/Makefile --------------------------*- Makefile -*-===## +##===- lib/Target/MSP430/AsmPrinter/Makefile ---------------*- Makefile -*-===## # # The LLVM Compiler Infrastructure # diff --git a/libclamav/c++/llvm/lib/Target/MSP430/CMakeLists.txt b/libclamav/c++/llvm/lib/Target/MSP430/CMakeLists.txt index 85c9696e2..60e0bb185 100644 --- a/libclamav/c++/llvm/lib/Target/MSP430/CMakeLists.txt +++ b/libclamav/c++/llvm/lib/Target/MSP430/CMakeLists.txt @@ -11,11 +11,11 @@ tablegen(MSP430GenCallingConv.inc -gen-callingconv) tablegen(MSP430GenSubtarget.inc -gen-subtarget) add_llvm_target(MSP430CodeGen - MSP430ISelDAGToDAG.cpp - MSP430RegisterInfo.cpp - MSP430MCAsmInfo.cpp MSP430InstrInfo.cpp + MSP430ISelDAGToDAG.cpp MSP430ISelLowering.cpp + MSP430MCAsmInfo.cpp + MSP430RegisterInfo.cpp MSP430Subtarget.cpp MSP430TargetMachine.cpp ) diff --git a/libclamav/c++/llvm/lib/Target/MSP430/MSP430ISelLowering.cpp b/libclamav/c++/llvm/lib/Target/MSP430/MSP430ISelLowering.cpp index ec19c38e0..4c3e3984c 100644 --- a/libclamav/c++/llvm/lib/Target/MSP430/MSP430ISelLowering.cpp +++ b/libclamav/c++/llvm/lib/Target/MSP430/MSP430ISelLowering.cpp @@ -95,6 +95,8 @@ MSP430TargetLowering::MSP430TargetLowering(MSP430TargetMachine &tm) : setOperationAction(ISD::SELECT_CC, MVT::i8, Custom); setOperationAction(ISD::SELECT_CC, MVT::i16, Custom); setOperationAction(ISD::SIGN_EXTEND, MVT::i16, Custom); + setOperationAction(ISD::DYNAMIC_STACKALLOC, MVT::i8, Expand); + setOperationAction(ISD::DYNAMIC_STACKALLOC, MVT::i16, Expand); setOperationAction(ISD::CTTZ, MVT::i8, Expand); setOperationAction(ISD::CTTZ, MVT::i16, Expand); @@ -148,6 +150,44 @@ unsigned MSP430TargetLowering::getFunctionAlignment(const Function *F) const { return F->hasFnAttr(Attribute::OptimizeForSize) ? 1 : 4; } +//===----------------------------------------------------------------------===// +// MSP430 Inline Assembly Support +//===----------------------------------------------------------------------===// + +/// getConstraintType - Given a constraint letter, return the type of +/// constraint it is for this target. +TargetLowering::ConstraintType +MSP430TargetLowering::getConstraintType(const std::string &Constraint) const { + if (Constraint.size() == 1) { + switch (Constraint[0]) { + case 'r': + return C_RegisterClass; + default: + break; + } + } + return TargetLowering::getConstraintType(Constraint); +} + +std::pair +MSP430TargetLowering:: +getRegForInlineAsmConstraint(const std::string &Constraint, + EVT VT) const { + if (Constraint.size() == 1) { + // GCC Constraint Letters + switch (Constraint[0]) { + default: break; + case 'r': // GENERAL_REGS + if (VT == MVT::i8) + return std::make_pair(0U, MSP430::GR8RegisterClass); + + return std::make_pair(0U, MSP430::GR16RegisterClass); + } + } + + return TargetLowering::getRegForInlineAsmConstraint(Constraint, VT); +} + //===----------------------------------------------------------------------===// // Calling Convention Implementation //===----------------------------------------------------------------------===// diff --git a/libclamav/c++/llvm/lib/Target/MSP430/MSP430ISelLowering.h b/libclamav/c++/llvm/lib/Target/MSP430/MSP430ISelLowering.h index 1339ccda0..7947b0ff8 100644 --- a/libclamav/c++/llvm/lib/Target/MSP430/MSP430ISelLowering.h +++ b/libclamav/c++/llvm/lib/Target/MSP430/MSP430ISelLowering.h @@ -84,6 +84,11 @@ namespace llvm { SDValue LowerSELECT_CC(SDValue Op, SelectionDAG &DAG); SDValue LowerSIGN_EXTEND(SDValue Op, SelectionDAG &DAG); + TargetLowering::ConstraintType + getConstraintType(const std::string &Constraint) const; + std::pair + getRegForInlineAsmConstraint(const std::string &Constraint, EVT VT) const; + MachineBasicBlock* EmitInstrWithCustomInserter(MachineInstr *MI, MachineBasicBlock *BB) const; diff --git a/libclamav/c++/llvm/lib/Target/MSP430/MSP430RegisterInfo.cpp b/libclamav/c++/llvm/lib/Target/MSP430/MSP430RegisterInfo.cpp index d1401f5d7..72994eb12 100644 --- a/libclamav/c++/llvm/lib/Target/MSP430/MSP430RegisterInfo.cpp +++ b/libclamav/c++/llvm/lib/Target/MSP430/MSP430RegisterInfo.cpp @@ -328,7 +328,16 @@ void MSP430RegisterInfo::emitEpilogue(MachineFunction &MF, // mergeSPUpdatesUp(MBB, MBBI, StackPtr, &NumBytes); if (MFI->hasVarSizedObjects()) { - llvm_unreachable("Not implemented yet!"); + BuildMI(MBB, MBBI, DL, + TII.get(MSP430::MOV16rr), MSP430::SPW).addReg(MSP430::FPW); + if (CSSize) { + MachineInstr *MI = + BuildMI(MBB, MBBI, DL, + TII.get(MSP430::SUB16ri), MSP430::SPW) + .addReg(MSP430::SPW).addImm(CSSize); + // The SRW implicit def is dead. + MI->getOperand(3).setIsDead(); + } } else { // adjust stack pointer back: SPW += numbytes if (NumBytes) { diff --git a/libclamav/c++/llvm/lib/Target/Mips/CMakeLists.txt b/libclamav/c++/llvm/lib/Target/Mips/CMakeLists.txt index c8880b8dd..0e3bf5a96 100644 --- a/libclamav/c++/llvm/lib/Target/Mips/CMakeLists.txt +++ b/libclamav/c++/llvm/lib/Target/Mips/CMakeLists.txt @@ -15,9 +15,9 @@ add_llvm_target(MipsCodeGen MipsInstrInfo.cpp MipsISelDAGToDAG.cpp MipsISelLowering.cpp + MipsMCAsmInfo.cpp MipsRegisterInfo.cpp MipsSubtarget.cpp - MipsMCAsmInfo.cpp MipsTargetMachine.cpp MipsTargetObjectFile.cpp ) diff --git a/libclamav/c++/llvm/lib/Target/PIC16/AsmPrinter/Makefile b/libclamav/c++/llvm/lib/Target/PIC16/AsmPrinter/Makefile index aaf3af35f..f4db57e60 100644 --- a/libclamav/c++/llvm/lib/Target/PIC16/AsmPrinter/Makefile +++ b/libclamav/c++/llvm/lib/Target/PIC16/AsmPrinter/Makefile @@ -1,4 +1,4 @@ -##===- lib/Target/PIC16/Makefile ----------------------------*- Makefile -*-===## +##===- lib/Target/PIC16/AsmPrinter/Makefile ----------------*- Makefile -*-===## # # The LLVM Compiler Infrastructure # diff --git a/libclamav/c++/llvm/lib/Target/PIC16/CMakeLists.txt b/libclamav/c++/llvm/lib/Target/PIC16/CMakeLists.txt index dcc58676d..0ee88f9cd 100644 --- a/libclamav/c++/llvm/lib/Target/PIC16/CMakeLists.txt +++ b/libclamav/c++/llvm/lib/Target/PIC16/CMakeLists.txt @@ -16,9 +16,9 @@ add_llvm_target(PIC16 PIC16ISelDAGToDAG.cpp PIC16ISelLowering.cpp PIC16MemSelOpt.cpp + PIC16MCAsmInfo.cpp PIC16RegisterInfo.cpp PIC16Subtarget.cpp - PIC16MCAsmInfo.cpp PIC16TargetMachine.cpp PIC16TargetObjectFile.cpp ) diff --git a/libclamav/c++/llvm/lib/Target/PIC16/MCSectionPIC16.h b/libclamav/c++/llvm/lib/Target/PIC16/MCSectionPIC16.h index 61850fcbf..3ae432e96 100644 --- a/libclamav/c++/llvm/lib/Target/PIC16/MCSectionPIC16.h +++ b/libclamav/c++/llvm/lib/Target/PIC16/MCSectionPIC16.h @@ -18,20 +18,65 @@ namespace llvm { + /// MCSectionPIC16 - Represents a physical section in PIC16 COFF. + /// Contains data objects. + /// class MCSectionPIC16 : public MCSection { + /// Name of the section to uniquely identify it. std::string Name; + + /// User can specify an address at which a section should be placed. + /// Negative value here means user hasn't specified any. + int Address; + + /// FIXME: Keep overlay information here. uncomment the decl below. + /// Overlay information - Sections with same color can be overlaid on + /// one another. + /// std::string Color; + + /// Conatined data objects. + std::vectorItems; + + /// Total size of all data objects contained here. + unsigned Size; - MCSectionPIC16(const StringRef &name, SectionKind K) - : MCSection(K), Name(name) { + MCSectionPIC16(const StringRef &name, SectionKind K, int addr) + : MCSection(K), Name(name), Address(addr) { } public: - + /// Return the name of the section. const std::string &getName() const { return Name; } + + /// Return the Address of the section. + int getAddress() const { return Address; } + + /// PIC16 Terminology for section kinds is as below. + /// UDATA - BSS + /// IDATA - initialized data (equiv to Metadata) + /// ROMDATA - ReadOnly. + /// UDATA_OVR - Sections that can be overlaid. Section of such type is + /// used to contain function autos an frame. We can think of + /// it as equiv to llvm ThreadBSS) + /// So, let's have some convenience functions to Map PIC16 Section types + /// to SectionKind just for the sake of better readability. + static SectionKind UDATA_Kind() { return SectionKind::getBSS(); } + static SectionKind IDATA_Kind() { return SectionKind::getMetadata(); } + static SectionKind ROMDATA_Kind() { return SectionKind::getReadOnly(); } + static SectionKind UDATA_OVR_Kind() { return SectionKind::getThreadBSS(); } + + // If we could just do getKind() == UDATA_Kind() ? + bool isUDATA_Kind() { return getKind().isBSS(); } + bool isIDATA_Kind() { return getKind().isMetadata(); } + bool isROMDATA_Kind() { return getKind().isMetadata(); } + bool isUDATA_OVR_Kind() { return getKind().isThreadBSS(); } + + /// This would be the only way to create a section. + static MCSectionPIC16 *Create(const StringRef &Name, SectionKind K, + int Address, MCContext &Ctx); - static MCSectionPIC16 *Create(const StringRef &Name, - SectionKind K, MCContext &Ctx); - + /// Override this as PIC16 has its own way of printing switching + /// to a section. virtual void PrintSwitchToSection(const MCAsmInfo &MAI, raw_ostream &OS) const; }; diff --git a/libclamav/c++/llvm/lib/Target/PIC16/PIC16DebugInfo.cpp b/libclamav/c++/llvm/lib/Target/PIC16/PIC16DebugInfo.cpp index 19927cb8b..4dcd84dc5 100644 --- a/libclamav/c++/llvm/lib/Target/PIC16/PIC16DebugInfo.cpp +++ b/libclamav/c++/llvm/lib/Target/PIC16/PIC16DebugInfo.cpp @@ -1,3 +1,4 @@ + //===-- PIC16DebugInfo.cpp - Implementation for PIC16 Debug Information ======// // // The LLVM Compiler Infrastructure @@ -69,7 +70,7 @@ void PIC16DbgInfo::PopulateDerivedTypeInfo (DIType Ty, unsigned short &TypeNo, // We also need to encode the the information about the base type of // pointer in TypeNo. - DIType BaseType = DIDerivedType(Ty.getGV()).getTypeDerivedFrom(); + DIType BaseType = DIDerivedType(Ty.getNode()).getTypeDerivedFrom(); PopulateDebugInfo(BaseType, TypeNo, HasAux, Aux, TagName); } @@ -78,7 +79,7 @@ void PIC16DbgInfo::PopulateArrayTypeInfo (DIType Ty, unsigned short &TypeNo, bool &HasAux, int Aux[], std::string &TagName) { - DICompositeType CTy = DICompositeType(Ty.getGV()); + DICompositeType CTy = DICompositeType(Ty.getNode()); DIArray Elements = CTy.getTypeArray(); unsigned short size = 1; unsigned short Dimension[4]={0,0,0,0}; @@ -87,7 +88,7 @@ void PIC16DbgInfo::PopulateArrayTypeInfo (DIType Ty, unsigned short &TypeNo, if (Element.getTag() == dwarf::DW_TAG_subrange_type) { TypeNo = TypeNo << PIC16Dbg::S_DERIVED; TypeNo = TypeNo | PIC16Dbg::DT_ARY; - DISubrange SubRange = DISubrange(Element.getGV()); + DISubrange SubRange = DISubrange(Element.getNode()); Dimension[i] = SubRange.getHi() - SubRange.getLo() + 1; // Each dimension is represented by 2 bytes starting at byte 9. Aux[8+i*2+0] = Dimension[i]; @@ -110,7 +111,7 @@ void PIC16DbgInfo::PopulateStructOrUnionTypeInfo (DIType Ty, unsigned short &TypeNo, bool &HasAux, int Aux[], std::string &TagName) { - DICompositeType CTy = DICompositeType(Ty.getGV()); + DICompositeType CTy = DICompositeType(Ty.getNode()); TypeNo = TypeNo << PIC16Dbg::S_BASIC; if (Ty.getTag() == dwarf::DW_TAG_structure_type) TypeNo = TypeNo | PIC16Dbg::T_STRUCT; @@ -123,7 +124,7 @@ void PIC16DbgInfo::PopulateStructOrUnionTypeInfo (DIType Ty, // llvm.dbg.composite* global variable. Since we need to revisit // PIC16DebugInfo implementation anyways after the MDNodes based // framework is done, let us continue with the way it is. - std::string UniqueSuffix = "." + Ty.getGV()->getNameStr().substr(18); + std::string UniqueSuffix = "." + Ty.getNode()->getNameStr().substr(18); TagName += UniqueSuffix; unsigned short size = CTy.getSizeInBits()/8; // 7th and 8th byte represent size. @@ -210,11 +211,10 @@ void PIC16DbgInfo::BeginModule(Module &M) { DbgFinder.processModule(M); if (DbgFinder.compile_unit_count() != 0) { // FIXME : What if more then one CUs are present in a module ? - GlobalVariable *CU = *DbgFinder.compile_unit_begin(); + MDNode *CU = *DbgFinder.compile_unit_begin(); EmitDebugDirectives = true; SwitchToCU(CU); } - // Emit debug info for decls of composite types. EmitCompositeTypeDecls(M); } @@ -259,7 +259,7 @@ void PIC16DbgInfo::ChangeDebugLoc(const MachineFunction &MF, if (! EmitDebugDirectives) return; assert (! DL.isUnknown() && "can't change to invalid debug loc"); - GlobalVariable *CU = MF.getDebugLocTuple(DL).CompileUnit; + MDNode *CU = MF.getDebugLocTuple(DL).CompileUnit; unsigned line = MF.getDebugLocTuple(DL).Line; SwitchToCU(CU); @@ -306,8 +306,7 @@ void PIC16DbgInfo::EmitCompositeTypeElements (DICompositeType CTy, int ElementAux[PIC16Dbg::AuxSize] = { 0 }; std::string TagName = ""; std::string ElementName; - GlobalVariable *GV = Element.getGV(); - DIDerivedType DITy(GV); + DIDerivedType DITy(Element.getNode()); DITy.getName(ElementName); unsigned short ElementSize = DITy.getSizeInBits()/8; // Get mangleddd name for this structure/union element. @@ -343,7 +342,7 @@ void PIC16DbgInfo::EmitCompositeTypeDecls(Module &M) { CTy.getName(Name); // Get the number after llvm.dbg.composite and make UniqueSuffix from // it. - std::string DIVar = CTy.getGV()->getNameStr(); + std::string DIVar = CTy.getNode()->getNameStr(); std::string UniqueSuffix = "." + DIVar.substr(18); std::string MangledCTyName = Name + UniqueSuffix; unsigned short size = CTy.getSizeInBits()/8; @@ -441,7 +440,7 @@ void PIC16DbgInfo::EmitSymbol(std::string Name, short Class, unsigned short void PIC16DbgInfo::EmitVarDebugInfo(Module &M) { DebugInfoFinder DbgFinder; DbgFinder.processModule(M); - + for (DebugInfoFinder::iterator I = DbgFinder.global_variable_begin(), E = DbgFinder.global_variable_end(); I != E; ++I) { DIGlobalVariable DIGV(*I); @@ -466,7 +465,7 @@ void PIC16DbgInfo::EmitVarDebugInfo(Module &M) { /// SwitchToCU - Switch to a new compilation unit. /// -void PIC16DbgInfo::SwitchToCU(GlobalVariable *CU) { +void PIC16DbgInfo::SwitchToCU(MDNode *CU) { // Get the file path from CU. DICompileUnit cu(CU); std::string DirName, FileName; diff --git a/libclamav/c++/llvm/lib/Target/PIC16/PIC16DebugInfo.h b/libclamav/c++/llvm/lib/Target/PIC16/PIC16DebugInfo.h index 2ccaba323..54e27c7c3 100644 --- a/libclamav/c++/llvm/lib/Target/PIC16/PIC16DebugInfo.h +++ b/libclamav/c++/llvm/lib/Target/PIC16/PIC16DebugInfo.h @@ -117,7 +117,7 @@ namespace llvm { private: - void SwitchToCU (GlobalVariable *CU); + void SwitchToCU (MDNode *CU); void SwitchToLine (unsigned Line, bool IsInBeginFunction = false); void PopulateDebugInfo (DIType Ty, unsigned short &TypeNo, bool &HasAux, diff --git a/libclamav/c++/llvm/lib/Target/PIC16/PIC16ISelLowering.cpp b/libclamav/c++/llvm/lib/Target/PIC16/PIC16ISelLowering.cpp index d4cbc0a1c..7a5b5ff40 100644 --- a/libclamav/c++/llvm/lib/Target/PIC16/PIC16ISelLowering.cpp +++ b/libclamav/c++/llvm/lib/Target/PIC16/PIC16ISelLowering.cpp @@ -533,6 +533,10 @@ SDValue PIC16TargetLowering::ExpandStore(SDNode *N, SelectionDAG &DAG) { SDValue SrcLo, SrcHi; GetExpandedParts(Src, DAG, SrcLo, SrcHi); SDValue ChainLo = Chain, ChainHi = Chain; + // FIXME: This makes unsafe assumptions. The Chain may be a TokenFactor + // created for an unrelated purpose, in which case it may not have + // exactly two operands. Also, even if it does have two operands, they + // may not be the low and high parts of an aligned load that was split. if (Chain.getOpcode() == ISD::TokenFactor) { ChainLo = Chain.getOperand(0); ChainHi = Chain.getOperand(1); @@ -560,16 +564,19 @@ SDValue PIC16TargetLowering::ExpandStore(SDNode *N, SelectionDAG &DAG) { GetExpandedParts(SrcHi, DAG, SrcHi1, SrcHi2); SDValue ChainLo = Chain, ChainHi = Chain; + // FIXME: This makes unsafe assumptions; see the FIXME above. if (Chain.getOpcode() == ISD::TokenFactor) { ChainLo = Chain.getOperand(0); ChainHi = Chain.getOperand(1); } SDValue ChainLo1 = ChainLo, ChainLo2 = ChainLo, ChainHi1 = ChainHi, ChainHi2 = ChainHi; + // FIXME: This makes unsafe assumptions; see the FIXME above. if (ChainLo.getOpcode() == ISD::TokenFactor) { ChainLo1 = ChainLo.getOperand(0); ChainLo2 = ChainLo.getOperand(1); } + // FIXME: This makes unsafe assumptions; see the FIXME above. if (ChainHi.getOpcode() == ISD::TokenFactor) { ChainHi1 = ChainHi.getOperand(0); ChainHi2 = ChainHi.getOperand(1); @@ -601,6 +608,7 @@ SDValue PIC16TargetLowering::ExpandStore(SDNode *N, SelectionDAG &DAG) { SDValue SrcLo, SrcHi; GetExpandedParts(Src, DAG, SrcLo, SrcHi); SDValue ChainLo = Chain, ChainHi = Chain; + // FIXME: This makes unsafe assumptions; see the FIXME above. if (Chain.getOpcode() == ISD::TokenFactor) { ChainLo = Chain.getOperand(0); ChainHi = Chain.getOperand(1); diff --git a/libclamav/c++/llvm/lib/Target/PIC16/PIC16TargetObjectFile.cpp b/libclamav/c++/llvm/lib/Target/PIC16/PIC16TargetObjectFile.cpp index 7e94b2506..beb7cc726 100644 --- a/libclamav/c++/llvm/lib/Target/PIC16/PIC16TargetObjectFile.cpp +++ b/libclamav/c++/llvm/lib/Target/PIC16/PIC16TargetObjectFile.cpp @@ -19,9 +19,9 @@ using namespace llvm; -MCSectionPIC16 *MCSectionPIC16::Create(const StringRef &Name, - SectionKind K, MCContext &Ctx) { - return new (Ctx) MCSectionPIC16(Name, K); +MCSectionPIC16 *MCSectionPIC16::Create(const StringRef &Name, SectionKind K, + int Address, MCContext &Ctx) { + return new (Ctx) MCSectionPIC16(Name, K, Address); } @@ -38,12 +38,12 @@ PIC16TargetObjectFile::PIC16TargetObjectFile() } const MCSectionPIC16 *PIC16TargetObjectFile:: -getPIC16Section(const char *Name, SectionKind Kind) const { +getPIC16Section(const char *Name, SectionKind Kind, int Address) const { MCSectionPIC16 *&Entry = SectionsByName[Name]; if (Entry) return Entry; - return Entry = MCSectionPIC16::Create(Name, Kind, getContext()); + return Entry = MCSectionPIC16::Create(Name, Kind, Address, getContext()); } diff --git a/libclamav/c++/llvm/lib/Target/PIC16/PIC16TargetObjectFile.h b/libclamav/c++/llvm/lib/Target/PIC16/PIC16TargetObjectFile.h index 1c6d9cf38..358978092 100644 --- a/libclamav/c++/llvm/lib/Target/PIC16/PIC16TargetObjectFile.h +++ b/libclamav/c++/llvm/lib/Target/PIC16/PIC16TargetObjectFile.h @@ -53,7 +53,8 @@ namespace llvm { const TargetMachine *TM; const MCSectionPIC16 *getPIC16Section(const char *Name, - SectionKind K) const; + SectionKind K, + int Address = -1) const; public: mutable std::vector BSSSections; mutable std::vector IDATASections; diff --git a/libclamav/c++/llvm/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp b/libclamav/c++/llvm/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp index bf16b7ed2..704a439db 100644 --- a/libclamav/c++/llvm/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp +++ b/libclamav/c++/llvm/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp @@ -518,7 +518,9 @@ bool PPCAsmPrinter::PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo, if (ExtraCode && ExtraCode[0]) return true; // Unknown modifier. assert (MI->getOperand(OpNo).isReg()); + O << "0("; printOperand(MI, OpNo); + O << ")"; return false; } diff --git a/libclamav/c++/llvm/lib/Target/PowerPC/CMakeLists.txt b/libclamav/c++/llvm/lib/Target/PowerPC/CMakeLists.txt index 564321da0..bdd6d3623 100644 --- a/libclamav/c++/llvm/lib/Target/PowerPC/CMakeLists.txt +++ b/libclamav/c++/llvm/lib/Target/PowerPC/CMakeLists.txt @@ -20,10 +20,10 @@ add_llvm_target(PowerPCCodeGen PPCISelLowering.cpp PPCJITInfo.cpp PPCMachOWriterInfo.cpp + PPCMCAsmInfo.cpp PPCPredicates.cpp PPCRegisterInfo.cpp PPCSubtarget.cpp - PPCMCAsmInfo.cpp PPCTargetMachine.cpp ) diff --git a/libclamav/c++/llvm/lib/Target/PowerPC/TargetInfo/Makefile b/libclamav/c++/llvm/lib/Target/PowerPC/TargetInfo/Makefile index 4253ce8b8..a101aa4a4 100644 --- a/libclamav/c++/llvm/lib/Target/PowerPC/TargetInfo/Makefile +++ b/libclamav/c++/llvm/lib/Target/PowerPC/TargetInfo/Makefile @@ -1,4 +1,4 @@ -##===- lib/Target/PowerPC/TargetInfo/Makefile ------------------*- Makefile -*-===## +##===- lib/Target/PowerPC/TargetInfo/Makefile --------------*- Makefile -*-===## # # The LLVM Compiler Infrastructure # diff --git a/libclamav/c++/llvm/lib/Target/Sparc/AsmPrinter/Makefile b/libclamav/c++/llvm/lib/Target/Sparc/AsmPrinter/Makefile index f12a6ac39..a856828ce 100644 --- a/libclamav/c++/llvm/lib/Target/Sparc/AsmPrinter/Makefile +++ b/libclamav/c++/llvm/lib/Target/Sparc/AsmPrinter/Makefile @@ -1,4 +1,4 @@ -##===- lib/Target/Sparc/Makefile ---------------------------*- Makefile -*-===## +##===- lib/Target/Sparc/AsmPrinter/Makefile ----------------*- Makefile -*-===## # # The LLVM Compiler Infrastructure # diff --git a/libclamav/c++/llvm/lib/Target/Sparc/CMakeLists.txt b/libclamav/c++/llvm/lib/Target/Sparc/CMakeLists.txt index 48dd66cd8..74f320a00 100644 --- a/libclamav/c++/llvm/lib/Target/Sparc/CMakeLists.txt +++ b/libclamav/c++/llvm/lib/Target/Sparc/CMakeLists.txt @@ -16,9 +16,9 @@ add_llvm_target(SparcCodeGen SparcInstrInfo.cpp SparcISelDAGToDAG.cpp SparcISelLowering.cpp + SparcMCAsmInfo.cpp SparcRegisterInfo.cpp SparcSubtarget.cpp - SparcMCAsmInfo.cpp SparcTargetMachine.cpp ) diff --git a/libclamav/c++/llvm/lib/Target/Sparc/SparcInstrInfo.td b/libclamav/c++/llvm/lib/Target/Sparc/SparcInstrInfo.td index 8ecc5889c..fcb462620 100644 --- a/libclamav/c++/llvm/lib/Target/Sparc/SparcInstrInfo.td +++ b/libclamav/c++/llvm/lib/Target/Sparc/SparcInstrInfo.td @@ -117,7 +117,7 @@ def SPitof : SDNode<"SPISD::ITOF", SDTSPITOF>; def SPselecticc : SDNode<"SPISD::SELECT_ICC", SDTSPselectcc, [SDNPInFlag]>; def SPselectfcc : SDNode<"SPISD::SELECT_FCC", SDTSPselectcc, [SDNPInFlag]>; -// These are target-independent nodes, but have target-specific formats. +// These are target-independent nodes, but have target-specific formats. def SDT_SPCallSeqStart : SDCallSeqStart<[ SDTCisVT<0, i32> ]>; def SDT_SPCallSeqEnd : SDCallSeqEnd<[ SDTCisVT<0, i32>, SDTCisVT<1, i32> ]>; diff --git a/libclamav/c++/llvm/lib/Target/Sparc/SparcMCAsmInfo.cpp b/libclamav/c++/llvm/lib/Target/Sparc/SparcMCAsmInfo.cpp index e9d1c38f8..c45d124a1 100644 --- a/libclamav/c++/llvm/lib/Target/Sparc/SparcMCAsmInfo.cpp +++ b/libclamav/c++/llvm/lib/Target/Sparc/SparcMCAsmInfo.cpp @@ -24,6 +24,12 @@ SparcELFMCAsmInfo::SparcELFMCAsmInfo(const Target &T, const StringRef &TT) { COMMDirectiveTakesAlignment = true; SunStyleELFSectionSwitchSyntax = true; + UsesELFSectionDirectiveForBSS = true; + + WeakRefDirective = "\t.weak\t"; + SetDirective = "\t.set\t"; + + PrivateGlobalPrefix = ".L"; } diff --git a/libclamav/c++/llvm/lib/Target/SystemZ/AsmPrinter/Makefile b/libclamav/c++/llvm/lib/Target/SystemZ/AsmPrinter/Makefile index 06998837c..9a350dfe6 100644 --- a/libclamav/c++/llvm/lib/Target/SystemZ/AsmPrinter/Makefile +++ b/libclamav/c++/llvm/lib/Target/SystemZ/AsmPrinter/Makefile @@ -1,4 +1,4 @@ -##===- lib/Target/SystemZ/Makefile ------------- -----------*- Makefile -*-===## +##===- lib/Target/SystemZ/AsmPrinter/Makefile --------------*- Makefile -*-===## # # The LLVM Compiler Infrastructure # diff --git a/libclamav/c++/llvm/lib/Target/SystemZ/CMakeLists.txt b/libclamav/c++/llvm/lib/Target/SystemZ/CMakeLists.txt index ccde93498..81e51d89a 100644 --- a/libclamav/c++/llvm/lib/Target/SystemZ/CMakeLists.txt +++ b/libclamav/c++/llvm/lib/Target/SystemZ/CMakeLists.txt @@ -14,9 +14,9 @@ add_llvm_target(SystemZCodeGen SystemZISelDAGToDAG.cpp SystemZISelLowering.cpp SystemZInstrInfo.cpp + SystemZMCAsmInfo.cpp SystemZRegisterInfo.cpp SystemZSubtarget.cpp - SystemZMCAsmInfo.cpp SystemZTargetMachine.cpp ) diff --git a/libclamav/c++/llvm/lib/Target/TargetLoweringObjectFile.cpp b/libclamav/c++/llvm/lib/Target/TargetLoweringObjectFile.cpp index 84b1b93ab..b2ee95501 100644 --- a/libclamav/c++/llvm/lib/Target/TargetLoweringObjectFile.cpp +++ b/libclamav/c++/llvm/lib/Target/TargetLoweringObjectFile.cpp @@ -655,12 +655,12 @@ getMachOSection(const StringRef &Segment, const StringRef &Section, // Form the name to look up. SmallString<64> Name; - Name.append(Segment.begin(), Segment.end()); + Name += Segment; Name.push_back(','); - Name.append(Section.begin(), Section.end()); + Name += Section; // Do the lookup, if we have a hit, return it. - const MCSectionMachO *&Entry = Map[StringRef(Name.data(), Name.size())]; + const MCSectionMachO *&Entry = Map[Name.str()]; if (Entry) return Entry; // Otherwise, return a new section. diff --git a/libclamav/c++/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp b/libclamav/c++/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp index 5232beb9c..d06350b80 100644 --- a/libclamav/c++/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp +++ b/libclamav/c++/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp @@ -12,8 +12,8 @@ #include "llvm/ADT/Twine.h" #include "llvm/MC/MCAsmLexer.h" #include "llvm/MC/MCAsmParser.h" +#include "llvm/MC/MCExpr.h" #include "llvm/MC/MCInst.h" -#include "llvm/MC/MCValue.h" #include "llvm/Support/SourceMgr.h" #include "llvm/Target/TargetRegistry.h" #include "llvm/Target/TargetAsmParser.h" @@ -85,12 +85,12 @@ struct X86Operand { } Reg; struct { - MCValue Val; + const MCExpr *Val; } Imm; struct { unsigned SegReg; - MCValue Disp; + const MCExpr *Disp; unsigned BaseReg; unsigned IndexReg; unsigned Scale; @@ -107,12 +107,12 @@ struct X86Operand { return Reg.RegNo; } - const MCValue &getImm() const { + const MCExpr *getImm() const { assert(Kind == Immediate && "Invalid access!"); return Imm.Val; } - const MCValue &getMemDisp() const { + const MCExpr *getMemDisp() const { assert(Kind == Memory && "Invalid access!"); return Mem.Disp; } @@ -143,11 +143,12 @@ struct X86Operand { if (!isImm()) return false; - if (!getImm().isAbsolute()) - return true; + if (const MCConstantExpr *CE = dyn_cast(getImm())) { + int64_t Value = CE->getValue(); + return Value == (int64_t) (int8_t) Value; + } - int64_t Value = getImm().getConstant(); - return Value == (int64_t) (int8_t) Value; + return true; } bool isMem() const { return Kind == Memory; } @@ -161,13 +162,13 @@ struct X86Operand { void addImmOperands(MCInst &Inst, unsigned N) const { assert(N == 1 && "Invalid number of operands!"); - Inst.addOperand(MCOperand::CreateMCValue(getImm())); + Inst.addOperand(MCOperand::CreateExpr(getImm())); } void addImmSExt8Operands(MCInst &Inst, unsigned N) const { // FIXME: Support user customization of the render method. assert(N == 1 && "Invalid number of operands!"); - Inst.addOperand(MCOperand::CreateMCValue(getImm())); + Inst.addOperand(MCOperand::CreateExpr(getImm())); } void addMemOperands(MCInst &Inst, unsigned N) const { @@ -176,7 +177,7 @@ struct X86Operand { Inst.addOperand(MCOperand::CreateReg(getMemBaseReg())); Inst.addOperand(MCOperand::CreateImm(getMemScale())); Inst.addOperand(MCOperand::CreateReg(getMemIndexReg())); - Inst.addOperand(MCOperand::CreateMCValue(getMemDisp())); + Inst.addOperand(MCOperand::CreateExpr(getMemDisp())); // FIXME: What a hack. if (N == 5) @@ -198,15 +199,16 @@ struct X86Operand { return Res; } - static X86Operand CreateImm(MCValue Val) { + static X86Operand CreateImm(const MCExpr *Val) { X86Operand Res; Res.Kind = Immediate; Res.Imm.Val = Val; return Res; } - static X86Operand CreateMem(unsigned SegReg, MCValue Disp, unsigned BaseReg, - unsigned IndexReg, unsigned Scale) { + static X86Operand CreateMem(unsigned SegReg, const MCExpr *Disp, + unsigned BaseReg, unsigned IndexReg, + unsigned Scale) { // We should never just have a displacement, that would be an immediate. assert((SegReg || BaseReg || IndexReg) && "Invalid memory operand!"); @@ -257,8 +259,8 @@ bool X86ATTAsmParser::ParseOperand(X86Operand &Op) { case AsmToken::Dollar: { // $42 -> immediate. getLexer().Lex(); - MCValue Val; - if (getParser().ParseRelocatableExpression(Val)) + const MCExpr *Val; + if (getParser().ParseExpression(Val)) return true; Op = X86Operand::CreateImm(Val); return false; @@ -275,9 +277,9 @@ bool X86ATTAsmParser::ParseMemOperand(X86Operand &Op) { // of a memory operand with a missing displacement "(%ebx)" or "(,%eax)". The // only way to do this without lookahead is to eat the ( and see what is after // it. - MCValue Disp = MCValue::get(0, 0, 0); + const MCExpr *Disp = MCConstantExpr::Create(0, getParser().getContext()); if (getLexer().isNot(AsmToken::LParen)) { - if (getParser().ParseRelocatableExpression(Disp)) return true; + if (getParser().ParseExpression(Disp)) return true; // After parsing the base expression we could either have a parenthesized // memory address or not. If not, return now. If so, eat the (. @@ -302,7 +304,7 @@ bool X86ATTAsmParser::ParseMemOperand(X86Operand &Op) { // memory operand consumed. } else { // It must be an parenthesized expression, parse it now. - if (getParser().ParseParenRelocatableExpression(Disp)) + if (getParser().ParseParenExpression(Disp)) return true; // After parsing the base expression we could either have a parenthesized diff --git a/libclamav/c++/llvm/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp b/libclamav/c++/llvm/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp index a2abbc203..2058d7d0a 100644 --- a/libclamav/c++/llvm/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp +++ b/libclamav/c++/llvm/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp @@ -28,6 +28,7 @@ #include "llvm/ADT/StringExtras.h" #include "llvm/Assembly/Writer.h" #include "llvm/MC/MCContext.h" +#include "llvm/MC/MCExpr.h" #include "llvm/MC/MCInst.h" #include "llvm/MC/MCSectionMachO.h" #include "llvm/MC/MCStreamer.h" @@ -625,6 +626,10 @@ bool X86ATTAsmPrinter::PrintAsmOperand(const MachineInstr *MI, unsigned OpNo, O << MO.getImm(); return false; } + if (MO.isGlobal() || MO.isCPI() || MO.isJTI() || MO.isSymbol()) { + printSymbolOperand(MO); + return false; + } if (MO.isReg()) { O << '('; printOperand(MI, OpNo); @@ -790,8 +795,17 @@ MCOperand X86ATTAsmPrinter::LowerGlobalAddressOperand(const MachineOperand &MO){ // Create a symbol for the name. MCSymbol *Sym = OutContext.GetOrCreateSymbol(Name); - return MCOperand::CreateMCValue(MCValue::get(Sym, NegatedSymbol, - MO.getOffset())); + // FIXME: We would like an efficient form for this, so we don't have to do a + // lot of extra uniquing. + const MCExpr *Expr = MCSymbolRefExpr::Create(Sym, OutContext); + if (NegatedSymbol) + Expr = MCBinaryExpr::CreateSub(Expr, MCSymbolRefExpr::Create(NegatedSymbol, + OutContext), + OutContext); + Expr = MCBinaryExpr::CreateAdd(Expr, MCConstantExpr::Create(MO.getOffset(), + OutContext), + OutContext); + return MCOperand::CreateExpr(Expr); } MCOperand X86ATTAsmPrinter:: @@ -803,7 +817,13 @@ LowerExternalSymbolOperand(const MachineOperand &MO){ } MCSymbol *Sym = OutContext.GetOrCreateSymbol(Name); - return MCOperand::CreateMCValue(MCValue::get(Sym, 0, MO.getOffset())); + // FIXME: We would like an efficient form for this, so we don't have to do a + // lot of extra uniquing. + const MCExpr *Expr = + MCBinaryExpr::CreateAdd(MCSymbolRefExpr::Create(Sym, OutContext), + MCConstantExpr::Create(MO.getOffset(),OutContext), + OutContext); + return MCOperand::CreateExpr(Expr); } @@ -844,7 +864,10 @@ void X86ATTAsmPrinter::printMachineInstruction(const MachineInstr *MI) { // Emit the call. MCSymbol *PICBase = GetPICBaseSymbol(); TmpInst.setOpcode(X86::CALLpcrel32); - TmpInst.addOperand(MCOperand::CreateMCValue(MCValue::get(PICBase))); + // FIXME: We would like an efficient form for this, so we don't have to do a + // lot of extra uniquing. + TmpInst.addOperand(MCOperand::CreateExpr(MCSymbolRefExpr::Create(PICBase, + OutContext))); printInstruction(&TmpInst); // Emit the label. diff --git a/libclamav/c++/llvm/lib/Target/X86/AsmPrinter/X86ATTInstPrinter.cpp b/libclamav/c++/llvm/lib/Target/X86/AsmPrinter/X86ATTInstPrinter.cpp index f45df0c88..ee797915f 100644 --- a/libclamav/c++/llvm/lib/Target/X86/AsmPrinter/X86ATTInstPrinter.cpp +++ b/libclamav/c++/llvm/lib/Target/X86/AsmPrinter/X86ATTInstPrinter.cpp @@ -16,6 +16,7 @@ #include "llvm/MC/MCInst.h" #include "X86ATTAsmPrinter.h" #include "llvm/MC/MCAsmInfo.h" +#include "llvm/MC/MCExpr.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/FormattedStream.h" using namespace llvm; @@ -55,8 +56,8 @@ void X86ATTAsmPrinter::print_pcrel_imm(const MCInst *MI, unsigned OpNo) { if (Op.isImm()) O << Op.getImm(); - else if (Op.isMCValue()) - Op.getMCValue().print(O); + else if (Op.isExpr()) + Op.getExpr()->print(O); else if (Op.isMBBLabel()) // FIXME: Keep in sync with printBasicBlockLabel. printBasicBlockLabel // should eventually call into this code, not the other way around. @@ -90,9 +91,9 @@ void X86ATTAsmPrinter::printOperand(const MCInst *MI, unsigned OpNo, O << '$'; O << Op.getImm(); return; - } else if (Op.isMCValue()) { + } else if (Op.isExpr()) { O << '$'; - Op.getMCValue().print(O); + Op.getExpr()->print(O); return; } @@ -109,8 +110,8 @@ void X86ATTAsmPrinter::printLeaMemReference(const MCInst *MI, unsigned Op) { int64_t DispVal = DispSpec.getImm(); if (DispVal || (!IndexReg.getReg() && !BaseReg.getReg())) O << DispVal; - } else if (DispSpec.isMCValue()) { - DispSpec.getMCValue().print(O); + } else if (DispSpec.isExpr()) { + DispSpec.getExpr()->print(O); } else { llvm_unreachable("non-immediate displacement for LEA?"); //assert(DispSpec.isGlobal() || DispSpec.isCPI() || diff --git a/libclamav/c++/llvm/lib/Target/X86/CMakeLists.txt b/libclamav/c++/llvm/lib/Target/X86/CMakeLists.txt index 73d580dc9..346d6c854 100644 --- a/libclamav/c++/llvm/lib/Target/X86/CMakeLists.txt +++ b/libclamav/c++/llvm/lib/Target/X86/CMakeLists.txt @@ -22,9 +22,9 @@ set(sources X86ISelLowering.cpp X86InstrInfo.cpp X86JITInfo.cpp + X86MCAsmInfo.cpp X86RegisterInfo.cpp X86Subtarget.cpp - X86MCAsmInfo.cpp X86TargetMachine.cpp X86FastISel.cpp ) diff --git a/libclamav/c++/llvm/lib/Target/X86/X86.h b/libclamav/c++/llvm/lib/Target/X86/X86.h index 2647d6870..a1671185a 100644 --- a/libclamav/c++/llvm/lib/Target/X86/X86.h +++ b/libclamav/c++/llvm/lib/Target/X86/X86.h @@ -22,7 +22,9 @@ namespace llvm { class X86TargetMachine; class FunctionPass; class MachineCodeEmitter; +class MCCodeEmitter; class JITCodeEmitter; +class Target; class formatted_raw_ostream; /// createX86ISelDag - This pass converts a legalized DAG into a @@ -52,6 +54,8 @@ FunctionPass *createX86JITCodeEmitterPass(X86TargetMachine &TM, FunctionPass *createX86ObjectCodeEmitterPass(X86TargetMachine &TM, ObjectCodeEmitter &OCE); +MCCodeEmitter *createX86MCCodeEmitter(const Target &, TargetMachine &TM); + /// createX86EmitCodeToMemory - Returns a pass that converts a register /// allocated function into raw machine code in a dynamically /// allocated chunk of memory. diff --git a/libclamav/c++/llvm/lib/Target/X86/X86CodeEmitter.cpp b/libclamav/c++/llvm/lib/Target/X86/X86CodeEmitter.cpp index 2f7898073..7e2fd975c 100644 --- a/libclamav/c++/llvm/lib/Target/X86/X86CodeEmitter.cpp +++ b/libclamav/c++/llvm/lib/Target/X86/X86CodeEmitter.cpp @@ -29,6 +29,9 @@ #include "llvm/CodeGen/Passes.h" #include "llvm/Function.h" #include "llvm/ADT/Statistic.h" +#include "llvm/MC/MCCodeEmitter.h" +#include "llvm/MC/MCExpr.h" +#include "llvm/MC/MCInst.h" #include "llvm/Support/Compiler.h" #include "llvm/Support/Debug.h" #include "llvm/Support/ErrorHandling.h" @@ -858,3 +861,256 @@ void Emitter::emitInstruction(const MachineInstr &MI, llvm_unreachable(0); } } + +// Adapt the Emitter / CodeEmitter interfaces to MCCodeEmitter. +// +// FIXME: This is a total hack designed to allow work on llvm-mc to proceed +// without being blocked on various cleanups needed to support a clean interface +// to instruction encoding. +// +// Look away! + +#include "llvm/DerivedTypes.h" + +namespace { +class MCSingleInstructionCodeEmitter : public MachineCodeEmitter { + uint8_t Data[256]; + +public: + MCSingleInstructionCodeEmitter() { reset(); } + + void reset() { + BufferBegin = Data; + BufferEnd = array_endof(Data); + CurBufferPtr = Data; + } + + StringRef str() { + return StringRef(reinterpret_cast(BufferBegin), + CurBufferPtr - BufferBegin); + } + + virtual void startFunction(MachineFunction &F) {} + virtual bool finishFunction(MachineFunction &F) { return false; } + virtual void emitLabel(uint64_t LabelID) {} + virtual void StartMachineBasicBlock(MachineBasicBlock *MBB) {} + virtual bool earlyResolveAddresses() const { return false; } + virtual void addRelocation(const MachineRelocation &MR) { } + virtual uintptr_t getConstantPoolEntryAddress(unsigned Index) const { + return 0; + } + virtual uintptr_t getJumpTableEntryAddress(unsigned Index) const { + return 0; + } + virtual uintptr_t getMachineBasicBlockAddress(MachineBasicBlock *MBB) const { + return 0; + } + virtual uintptr_t getLabelAddress(uint64_t LabelID) const { + return 0; + } + virtual void setModuleInfo(MachineModuleInfo* Info) {} +}; + +class X86MCCodeEmitter : public MCCodeEmitter { + X86MCCodeEmitter(const X86MCCodeEmitter &); // DO NOT IMPLEMENT + void operator=(const X86MCCodeEmitter &); // DO NOT IMPLEMENT + +private: + X86TargetMachine &TM; + llvm::Function *DummyF; + TargetData *DummyTD; + mutable llvm::MachineFunction *DummyMF; + llvm::MachineBasicBlock *DummyMBB; + + MCSingleInstructionCodeEmitter *InstrEmitter; + Emitter *Emit; + +public: + X86MCCodeEmitter(X86TargetMachine &_TM) : TM(_TM) { + // Verily, thou shouldst avert thine eyes. + const llvm::FunctionType *FTy = + FunctionType::get(llvm::Type::getVoidTy(getGlobalContext()), false); + DummyF = Function::Create(FTy, GlobalValue::InternalLinkage); + DummyTD = new TargetData(""); + DummyMF = new MachineFunction(DummyF, TM); + DummyMBB = DummyMF->CreateMachineBasicBlock(); + + InstrEmitter = new MCSingleInstructionCodeEmitter(); + Emit = new Emitter(TM, *InstrEmitter, + *TM.getInstrInfo(), + *DummyTD, false); + } + ~X86MCCodeEmitter() { + delete Emit; + delete InstrEmitter; + delete DummyMF; + delete DummyF; + } + + bool AddRegToInstr(const MCInst &MI, MachineInstr *Instr, + unsigned Start) const { + if (Start + 1 > MI.getNumOperands()) + return false; + + const MCOperand &Op = MI.getOperand(Start); + if (!Op.isReg()) return false; + + Instr->addOperand(MachineOperand::CreateReg(Op.getReg(), false)); + return true; + } + + bool AddImmToInstr(const MCInst &MI, MachineInstr *Instr, + unsigned Start) const { + if (Start + 1 > MI.getNumOperands()) + return false; + + const MCOperand &Op = MI.getOperand(Start); + if (Op.isImm()) { + Instr->addOperand(MachineOperand::CreateImm(Op.getImm())); + return true; + } + if (!Op.isExpr()) + return false; + + const MCExpr *Expr = Op.getExpr(); + if (const MCConstantExpr *CE = dyn_cast(Expr)) { + Instr->addOperand(MachineOperand::CreateImm(CE->getValue())); + return true; + } + + // FIXME: Relocation / fixup. + Instr->addOperand(MachineOperand::CreateImm(0)); + return true; + } + + bool AddLMemToInstr(const MCInst &MI, MachineInstr *Instr, + unsigned Start) const { + return (AddRegToInstr(MI, Instr, Start + 0) && + AddImmToInstr(MI, Instr, Start + 1) && + AddRegToInstr(MI, Instr, Start + 2) && + AddImmToInstr(MI, Instr, Start + 3)); + } + + bool AddMemToInstr(const MCInst &MI, MachineInstr *Instr, + unsigned Start) const { + return (AddRegToInstr(MI, Instr, Start + 0) && + AddImmToInstr(MI, Instr, Start + 1) && + AddRegToInstr(MI, Instr, Start + 2) && + AddImmToInstr(MI, Instr, Start + 3) && + AddRegToInstr(MI, Instr, Start + 4)); + } + + void EncodeInstruction(const MCInst &MI, raw_ostream &OS) const { + // Don't look yet! + + // Convert the MCInst to a MachineInstr so we can (ab)use the regular + // emitter. + const X86InstrInfo &II = *TM.getInstrInfo(); + const TargetInstrDesc &Desc = II.get(MI.getOpcode()); + MachineInstr *Instr = DummyMF->CreateMachineInstr(Desc, DebugLoc()); + DummyMBB->push_back(Instr); + + unsigned Opcode = MI.getOpcode(); + unsigned NumOps = MI.getNumOperands(); + unsigned CurOp = 0; + if (NumOps > 1 && Desc.getOperandConstraint(1, TOI::TIED_TO) != -1) { + Instr->addOperand(MachineOperand::CreateReg(0, false)); + ++CurOp; + } else if (NumOps > 2 && + Desc.getOperandConstraint(NumOps-1, TOI::TIED_TO)== 0) + // Skip the last source operand that is tied_to the dest reg. e.g. LXADD32 + --NumOps; + + bool OK = true; + switch (Desc.TSFlags & X86II::FormMask) { + case X86II::MRMDestReg: + case X86II::MRMSrcReg: + // Matching doesn't fill this in completely, we have to choose operand 0 + // for a tied register. + OK &= AddRegToInstr(MI, Instr, 0); CurOp++; + OK &= AddRegToInstr(MI, Instr, CurOp++); + if (CurOp < NumOps) + OK &= AddImmToInstr(MI, Instr, CurOp); + break; + + case X86II::RawFrm: + if (CurOp < NumOps) { + // Hack to make branches work. + if (!(Desc.TSFlags & X86II::ImmMask) && + MI.getOperand(0).isExpr() && + isa(MI.getOperand(0).getExpr())) + Instr->addOperand(MachineOperand::CreateMBB(DummyMBB)); + else + OK &= AddImmToInstr(MI, Instr, CurOp); + } + break; + + case X86II::AddRegFrm: + OK &= AddRegToInstr(MI, Instr, CurOp++); + if (CurOp < NumOps) + OK &= AddImmToInstr(MI, Instr, CurOp); + break; + + case X86II::MRM0r: case X86II::MRM1r: + case X86II::MRM2r: case X86II::MRM3r: + case X86II::MRM4r: case X86II::MRM5r: + case X86II::MRM6r: case X86II::MRM7r: + // Matching doesn't fill this in completely, we have to choose operand 0 + // for a tied register. + OK &= AddRegToInstr(MI, Instr, 0); CurOp++; + if (CurOp < NumOps) + OK &= AddImmToInstr(MI, Instr, CurOp); + break; + + case X86II::MRM0m: case X86II::MRM1m: + case X86II::MRM2m: case X86II::MRM3m: + case X86II::MRM4m: case X86II::MRM5m: + case X86II::MRM6m: case X86II::MRM7m: + OK &= AddMemToInstr(MI, Instr, CurOp); CurOp += 5; + if (CurOp < NumOps) + OK &= AddImmToInstr(MI, Instr, CurOp); + break; + + case X86II::MRMSrcMem: + OK &= AddRegToInstr(MI, Instr, CurOp++); + if (Opcode == X86::LEA64r || Opcode == X86::LEA64_32r || + Opcode == X86::LEA16r || Opcode == X86::LEA32r) + OK &= AddLMemToInstr(MI, Instr, CurOp); + else + OK &= AddMemToInstr(MI, Instr, CurOp); + break; + + case X86II::MRMDestMem: + OK &= AddMemToInstr(MI, Instr, CurOp); CurOp += 5; + OK &= AddRegToInstr(MI, Instr, CurOp); + break; + + default: + case X86II::MRMInitReg: + case X86II::Pseudo: + OK = false; + break; + } + + if (!OK) { + errs() << "couldn't convert inst '"; + MI.print(errs()); + errs() << "' to machine instr:\n"; + Instr->dump(); + } + + InstrEmitter->reset(); + if (OK) + Emit->emitInstruction(*Instr, &Desc); + OS << InstrEmitter->str(); + + Instr->eraseFromParent(); + } +}; +} + +// Ok, now you can look. +MCCodeEmitter *llvm::createX86MCCodeEmitter(const Target &, + TargetMachine &TM) { + return new X86MCCodeEmitter(static_cast(TM)); +} diff --git a/libclamav/c++/llvm/lib/Target/X86/X86FastISel.cpp b/libclamav/c++/llvm/lib/Target/X86/X86FastISel.cpp index 5e9a39f05..a184c3995 100644 --- a/libclamav/c++/llvm/lib/Target/X86/X86FastISel.cpp +++ b/libclamav/c++/llvm/lib/Target/X86/X86FastISel.cpp @@ -195,6 +195,7 @@ bool X86FastISel::X86FastEmitLoad(EVT VT, const X86AddressMode &AM, const TargetRegisterClass *RC = NULL; switch (VT.getSimpleVT().SimpleTy) { default: return false; + case MVT::i1: case MVT::i8: Opc = X86::MOV8rm; RC = X86::GR8RegisterClass; @@ -252,6 +253,14 @@ X86FastISel::X86FastEmitStore(EVT VT, unsigned Val, switch (VT.getSimpleVT().SimpleTy) { case MVT::f80: // No f80 support yet. default: return false; + case MVT::i1: { + // Mask out all but lowest bit. + unsigned AndResult = createResultReg(X86::GR8RegisterClass); + BuildMI(MBB, DL, + TII.get(X86::AND8ri), AndResult).addReg(Val).addImm(1); + Val = AndResult; + } + // FALLTHROUGH, handling i1 as i8. case MVT::i8: Opc = X86::MOV8mr; break; case MVT::i16: Opc = X86::MOV16mr; break; case MVT::i32: Opc = X86::MOV32mr; break; @@ -277,8 +286,10 @@ bool X86FastISel::X86FastEmitStore(EVT VT, Value *Val, // If this is a store of a simple constant, fold the constant into the store. if (ConstantInt *CI = dyn_cast(Val)) { unsigned Opc = 0; + bool Signed = true; switch (VT.getSimpleVT().SimpleTy) { default: break; + case MVT::i1: Signed = false; // FALLTHROUGH to handle as i8. case MVT::i8: Opc = X86::MOV8mi; break; case MVT::i16: Opc = X86::MOV16mi; break; case MVT::i32: Opc = X86::MOV32mi; break; @@ -291,7 +302,8 @@ bool X86FastISel::X86FastEmitStore(EVT VT, Value *Val, if (Opc) { addFullAddress(BuildMI(MBB, DL, TII.get(Opc)), AM) - .addImm(CI->getSExtValue()); + .addImm(Signed ? CI->getSExtValue() : + CI->getZExtValue()); return true; } } @@ -606,7 +618,7 @@ bool X86FastISel::X86SelectCallAddress(Value *V, X86AddressMode &AM) { /// X86SelectStore - Select and emit code to implement store instructions. bool X86FastISel::X86SelectStore(Instruction* I) { EVT VT; - if (!isTypeLegal(I->getOperand(0)->getType(), VT)) + if (!isTypeLegal(I->getOperand(0)->getType(), VT, /*AllowI1=*/true)) return false; X86AddressMode AM; @@ -620,7 +632,7 @@ bool X86FastISel::X86SelectStore(Instruction* I) { /// bool X86FastISel::X86SelectLoad(Instruction *I) { EVT VT; - if (!isTypeLegal(I->getType(), VT)) + if (!isTypeLegal(I->getType(), VT, /*AllowI1=*/true)) return false; X86AddressMode AM; diff --git a/libclamav/c++/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp b/libclamav/c++/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp index edf25333d..22d676e5d 100644 --- a/libclamav/c++/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp +++ b/libclamav/c++/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp @@ -79,7 +79,8 @@ namespace { X86ISelAddressMode() : BaseType(RegBase), Scale(1), IndexReg(), Disp(0), - Segment(), GV(0), CP(0), ES(0), JT(-1), Align(0), SymbolFlags(0) { + Segment(), GV(0), CP(0), ES(0), JT(-1), Align(0), + SymbolFlags(X86II::MO_NO_FLAG) { } bool hasSymbolicDisplacement() const { @@ -821,7 +822,7 @@ bool X86DAGToDAGISel::MatchAddress(SDValue N, X86ISelAddressMode &AM) { AM.BaseType == X86ISelAddressMode::RegBase && AM.Base.Reg.getNode() == 0 && AM.IndexReg.getNode() == 0 && - AM.SymbolFlags == 0 && + AM.SymbolFlags == X86II::MO_NO_FLAG && AM.hasSymbolicDisplacement()) AM.Base.Reg = CurDAG->getRegister(X86::RIP, MVT::i64); diff --git a/libclamav/c++/llvm/lib/Target/X86/X86ISelLowering.cpp b/libclamav/c++/llvm/lib/Target/X86/X86ISelLowering.cpp index 72a2727ad..15af42e8c 100644 --- a/libclamav/c++/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/libclamav/c++/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -63,7 +63,7 @@ static TargetLoweringObjectFile *createTLOF(X86TargetMachine &TM) { case X86Subtarget::isWindows: return new TargetLoweringObjectFileCOFF(); } - + } X86TargetLowering::X86TargetLowering(X86TargetMachine &TM) @@ -276,9 +276,9 @@ X86TargetLowering::X86TargetLowering(X86TargetMachine &TM) setOperationAction(ISD::BSWAP , MVT::i16 , Expand); // These should be promoted to a larger select which is supported. - setOperationAction(ISD::SELECT , MVT::i1 , Promote); - setOperationAction(ISD::SELECT , MVT::i8 , Promote); + setOperationAction(ISD::SELECT , MVT::i1 , Promote); // X86 wants to expand cmov itself. + setOperationAction(ISD::SELECT , MVT::i8 , Custom); setOperationAction(ISD::SELECT , MVT::i16 , Custom); setOperationAction(ISD::SELECT , MVT::i32 , Custom); setOperationAction(ISD::SELECT , MVT::f32 , Custom); @@ -885,7 +885,7 @@ X86TargetLowering::X86TargetLowering(X86TargetMachine &TM) if (Subtarget->is64Bit()) { setOperationAction(ISD::INSERT_VECTOR_ELT, MVT::v4i64, Custom); setOperationAction(ISD::EXTRACT_VECTOR_ELT, MVT::v4i64, Custom); - } + } #endif #if 0 @@ -1775,7 +1775,7 @@ X86TargetLowering::LowerCall(SDValue Chain, SDValue Callee, InFlag = Chain.getValue(1); } - + if (Subtarget->isPICStyleGOT()) { // ELF / PIC requires GOT in the EBX register before function calls via PLT // GOT pointer. @@ -1902,7 +1902,7 @@ X86TargetLowering::LowerCall(SDValue Chain, SDValue Callee, GlobalValue *GV = G->getGlobal(); if (!GV->hasDLLImportLinkage()) { unsigned char OpFlags = 0; - + // On ELF targets, in both X86-64 and X86-32 mode, direct calls to // external symbols most go through the PLT in PIC mode. If the symbol // has hidden or protected visibility, or if it is static or local, then @@ -1938,7 +1938,7 @@ X86TargetLowering::LowerCall(SDValue Chain, SDValue Callee, // automatically synthesizes these stubs. OpFlags = X86II::MO_DARWIN_STUB; } - + Callee = DAG.getTargetExternalSymbol(S->getSymbol(), getPointerTy(), OpFlags); } else if (isTailCall) { @@ -2306,7 +2306,7 @@ static bool isPSHUFDMask(const SmallVectorImpl &Mask, EVT VT) { } bool X86::isPSHUFDMask(ShuffleVectorSDNode *N) { - SmallVector M; + SmallVector M; N->getMask(M); return ::isPSHUFDMask(M, N->getValueType(0)); } @@ -2316,22 +2316,22 @@ bool X86::isPSHUFDMask(ShuffleVectorSDNode *N) { static bool isPSHUFHWMask(const SmallVectorImpl &Mask, EVT VT) { if (VT != MVT::v8i16) return false; - + // Lower quadword copied in order or undef. for (int i = 0; i != 4; ++i) if (Mask[i] >= 0 && Mask[i] != i) return false; - + // Upper quadword shuffled. for (int i = 4; i != 8; ++i) if (Mask[i] >= 0 && (Mask[i] < 4 || Mask[i] > 7)) return false; - + return true; } bool X86::isPSHUFHWMask(ShuffleVectorSDNode *N) { - SmallVector M; + SmallVector M; N->getMask(M); return ::isPSHUFHWMask(M, N->getValueType(0)); } @@ -2341,22 +2341,22 @@ bool X86::isPSHUFHWMask(ShuffleVectorSDNode *N) { static bool isPSHUFLWMask(const SmallVectorImpl &Mask, EVT VT) { if (VT != MVT::v8i16) return false; - + // Upper quadword copied in order. for (int i = 4; i != 8; ++i) if (Mask[i] >= 0 && Mask[i] != i) return false; - + // Lower quadword shuffled. for (int i = 0; i != 4; ++i) if (Mask[i] >= 4) return false; - + return true; } bool X86::isPSHUFLWMask(ShuffleVectorSDNode *N) { - SmallVector M; + SmallVector M; N->getMask(M); return ::isPSHUFLWMask(M, N->getValueType(0)); } @@ -2367,7 +2367,7 @@ static bool isSHUFPMask(const SmallVectorImpl &Mask, EVT VT) { int NumElems = VT.getVectorNumElements(); if (NumElems != 2 && NumElems != 4) return false; - + int Half = NumElems / 2; for (int i = 0; i < Half; ++i) if (!isUndefOrInRange(Mask[i], 0, NumElems)) @@ -2375,7 +2375,7 @@ static bool isSHUFPMask(const SmallVectorImpl &Mask, EVT VT) { for (int i = Half; i < NumElems; ++i) if (!isUndefOrInRange(Mask[i], NumElems, NumElems*2)) return false; - + return true; } @@ -2391,10 +2391,10 @@ bool X86::isSHUFPMask(ShuffleVectorSDNode *N) { /// the upper half to come from vector 2. static bool isCommutedSHUFPMask(const SmallVectorImpl &Mask, EVT VT) { int NumElems = VT.getVectorNumElements(); - - if (NumElems != 2 && NumElems != 4) + + if (NumElems != 2 && NumElems != 4) return false; - + int Half = NumElems / 2; for (int i = 0; i < Half; ++i) if (!isUndefOrInRange(Mask[i], NumElems, NumElems*2)) @@ -2468,13 +2468,13 @@ bool X86::isMOVHPMask(ShuffleVectorSDNode *N) { /// <2, 3, 2, 3> bool X86::isMOVHLPS_v_undef_Mask(ShuffleVectorSDNode *N) { unsigned NumElems = N->getValueType(0).getVectorNumElements(); - + if (NumElems != 4) return false; - - return isUndefOrEqual(N->getMaskElt(0), 2) && + + return isUndefOrEqual(N->getMaskElt(0), 2) && isUndefOrEqual(N->getMaskElt(1), 3) && - isUndefOrEqual(N->getMaskElt(2), 2) && + isUndefOrEqual(N->getMaskElt(2), 2) && isUndefOrEqual(N->getMaskElt(3), 3); } @@ -2485,7 +2485,7 @@ static bool isUNPCKLMask(const SmallVectorImpl &Mask, EVT VT, int NumElts = VT.getVectorNumElements(); if (NumElts != 2 && NumElts != 4 && NumElts != 8 && NumElts != 16) return false; - + for (int i = 0, j = 0; i != NumElts; i += 2, ++j) { int BitI = Mask[i]; int BitI1 = Mask[i+1]; @@ -2510,12 +2510,12 @@ bool X86::isUNPCKLMask(ShuffleVectorSDNode *N, bool V2IsSplat) { /// isUNPCKHMask - Return true if the specified VECTOR_SHUFFLE operand /// specifies a shuffle of elements that is suitable for input to UNPCKH. -static bool isUNPCKHMask(const SmallVectorImpl &Mask, EVT VT, +static bool isUNPCKHMask(const SmallVectorImpl &Mask, EVT VT, bool V2IsSplat = false) { int NumElts = VT.getVectorNumElements(); if (NumElts != 2 && NumElts != 4 && NumElts != 8 && NumElts != 16) return false; - + for (int i = 0, j = 0; i != NumElts; i += 2, ++j) { int BitI = Mask[i]; int BitI1 = Mask[i+1]; @@ -2545,7 +2545,7 @@ static bool isUNPCKL_v_undef_Mask(const SmallVectorImpl &Mask, EVT VT) { int NumElems = VT.getVectorNumElements(); if (NumElems != 2 && NumElems != 4 && NumElems != 8 && NumElems != 16) return false; - + for (int i = 0, j = 0; i != NumElems; i += 2, ++j) { int BitI = Mask[i]; int BitI1 = Mask[i+1]; @@ -2570,7 +2570,7 @@ static bool isUNPCKH_v_undef_Mask(const SmallVectorImpl &Mask, EVT VT) { int NumElems = VT.getVectorNumElements(); if (NumElems != 2 && NumElems != 4 && NumElems != 8 && NumElems != 16) return false; - + for (int i = 0, j = NumElems / 2; i != NumElems; i += 2, ++j) { int BitI = Mask[i]; int BitI1 = Mask[i+1]; @@ -2596,14 +2596,14 @@ static bool isMOVLMask(const SmallVectorImpl &Mask, EVT VT) { return false; int NumElts = VT.getVectorNumElements(); - + if (!isUndefOrEqual(Mask[0], NumElts)) return false; - + for (int i = 1; i < NumElts; ++i) if (!isUndefOrEqual(Mask[i], i)) return false; - + return true; } @@ -2621,16 +2621,16 @@ static bool isCommutedMOVLMask(const SmallVectorImpl &Mask, EVT VT, int NumOps = VT.getVectorNumElements(); if (NumOps != 2 && NumOps != 4 && NumOps != 8 && NumOps != 16) return false; - + if (!isUndefOrEqual(Mask[0], 0)) return false; - + for (int i = 1; i < NumOps; ++i) if (!(isUndefOrEqual(Mask[i], i+NumOps) || (V2IsUndef && isUndefOrInRange(Mask[i], NumOps, NumOps*2)) || (V2IsSplat && isUndefOrEqual(Mask[i], NumOps)))) return false; - + return true; } @@ -2694,7 +2694,7 @@ bool X86::isMOVSLDUPMask(ShuffleVectorSDNode *N) { /// specifies a shuffle of elements that is suitable for input to MOVDDUP. bool X86::isMOVDDUPMask(ShuffleVectorSDNode *N) { int e = N->getValueType(0).getVectorNumElements() / 2; - + for (int i = 0; i < e; ++i) if (!isUndefOrEqual(N->getMaskElt(i), i)) return false; @@ -2774,7 +2774,7 @@ static SDValue CommuteVectorShuffle(ShuffleVectorSDNode *SVOp, EVT VT = SVOp->getValueType(0); unsigned NumElems = VT.getVectorNumElements(); SmallVector MaskVec; - + for (unsigned i = 0; i != NumElems; ++i) { int idx = SVOp->getMaskElt(i); if (idx < 0) @@ -2848,7 +2848,7 @@ static bool ShouldXformToMOVLP(SDNode *V1, SDNode *V2, return false; unsigned NumElems = Op->getValueType(0).getVectorNumElements(); - + if (NumElems != 2 && NumElems != 4) return false; for (unsigned i = 0, e = NumElems/2; i != e; ++i) @@ -2874,7 +2874,7 @@ static bool isSplatVector(SDNode *N) { } /// isZeroShuffle - Returns true if N is a VECTOR_SHUFFLE that can be resolved -/// to an zero vector. +/// to an zero vector. /// FIXME: move to dag combiner / method on ShuffleVectorSDNode static bool isZeroShuffle(ShuffleVectorSDNode *N) { SDValue V1 = N->getOperand(0); @@ -2945,11 +2945,11 @@ static SDValue getOnesVector(EVT VT, SelectionDAG &DAG, DebugLoc dl) { static SDValue NormalizeMask(ShuffleVectorSDNode *SVOp, SelectionDAG &DAG) { EVT VT = SVOp->getValueType(0); unsigned NumElems = VT.getVectorNumElements(); - + bool Changed = false; SmallVector MaskVec; SVOp->getMask(MaskVec); - + for (unsigned i = 0; i != NumElems; ++i) { if (MaskVec[i] > (int)NumElems) { MaskVec[i] = NumElems; @@ -3000,11 +3000,11 @@ static SDValue getUnpackh(SelectionDAG &DAG, DebugLoc dl, EVT VT, SDValue V1, } /// PromoteSplat - Promote a splat of v4f32, v8i16 or v16i8 to v4i32. -static SDValue PromoteSplat(ShuffleVectorSDNode *SV, SelectionDAG &DAG, +static SDValue PromoteSplat(ShuffleVectorSDNode *SV, SelectionDAG &DAG, bool HasSSE2) { if (SV->getValueType(0).getVectorNumElements() <= 4) return SDValue(SV, 0); - + EVT PVT = MVT::v4f32; EVT VT = SV->getValueType(0); DebugLoc dl = SV->getDebugLoc(); @@ -3022,7 +3022,7 @@ static SDValue PromoteSplat(ShuffleVectorSDNode *SV, SelectionDAG &DAG, } NumElems >>= 1; } - + // Perform the splat. int SplatMask[4] = { EltNo, EltNo, EltNo, EltNo }; V1 = DAG.getNode(ISD::BIT_CONVERT, dl, PVT, V1); @@ -3280,7 +3280,7 @@ X86TargetLowering::LowerBUILD_VECTOR(SDValue Op, SelectionDAG &DAG) { for (unsigned i = 1; i != VecElts; ++i) Mask.push_back(i); Item = DAG.getVectorShuffle(VecVT, dl, Item, - DAG.getUNDEF(Item.getValueType()), + DAG.getUNDEF(Item.getValueType()), &Mask[0]); } return DAG.getNode(ISD::BIT_CONVERT, dl, Op.getValueType(), Item); @@ -3421,9 +3421,9 @@ X86TargetLowering::LowerBUILD_VECTOR(SDValue Op, SelectionDAG &DAG) { // If we have SSE 4.1, Expand into a number of inserts unless the number of // values to be inserted is equal to the number of elements, in which case // use the unpack code below in the hopes of matching the consecutive elts - // load merge pattern for shuffles. + // load merge pattern for shuffles. // FIXME: We could probably just check that here directly. - if (Values.size() < NumElems && VT.getSizeInBits() == 128 && + if (Values.size() < NumElems && VT.getSizeInBits() == 128 && getSubtarget()->hasSSE41()) { V[0] = DAG.getUNDEF(VT); for (unsigned i = 0; i < NumElems; ++i) @@ -3504,7 +3504,7 @@ SDValue LowerVECTOR_SHUFFLEv8i16(ShuffleVectorSDNode *SVOp, } // For SSSE3, If all 8 words of the result come from only 1 quadword of each - // of the two input vectors, shuffle them into one input vector so only a + // of the two input vectors, shuffle them into one input vector so only a // single pshufb instruction is necessary. If There are more than 2 input // quads, disable the next transformation since it does not help SSSE3. bool V1Used = InputQuads[0] || InputQuads[1]; @@ -3528,7 +3528,7 @@ SDValue LowerVECTOR_SHUFFLEv8i16(ShuffleVectorSDNode *SVOp, SmallVector MaskV; MaskV.push_back(BestLoQuad < 0 ? 0 : BestLoQuad); MaskV.push_back(BestHiQuad < 0 ? 1 : BestHiQuad); - NewV = DAG.getVectorShuffle(MVT::v2i64, dl, + NewV = DAG.getVectorShuffle(MVT::v2i64, dl, DAG.getNode(ISD::BIT_CONVERT, dl, MVT::v2i64, V1), DAG.getNode(ISD::BIT_CONVERT, dl, MVT::v2i64, V2), &MaskV[0]); NewV = DAG.getNode(ISD::BIT_CONVERT, dl, MVT::v8i16, NewV); @@ -3553,7 +3553,7 @@ SDValue LowerVECTOR_SHUFFLEv8i16(ShuffleVectorSDNode *SVOp, int idx = MaskVals[i]; if (idx < 0) continue; - idx = MaskVals[i] = (idx / 4) == BestLoQuad ? (idx & 3) : (idx & 3) + 4; + idx = MaskVals[i] = (idx / 4) == BestLoQuad ? (idx & 3) : (idx & 3) + 4; if ((idx != i) && idx < 4) pshufhw = false; if ((idx != i) && idx > 3) @@ -3568,19 +3568,19 @@ SDValue LowerVECTOR_SHUFFLEv8i16(ShuffleVectorSDNode *SVOp, // If we've eliminated the use of V2, and the new mask is a pshuflw or // pshufhw, that's as cheap as it gets. Return the new shuffle. if ((pshufhw && InOrder[0]) || (pshuflw && InOrder[1])) { - return DAG.getVectorShuffle(MVT::v8i16, dl, NewV, + return DAG.getVectorShuffle(MVT::v8i16, dl, NewV, DAG.getUNDEF(MVT::v8i16), &MaskVals[0]); } } - + // If we have SSSE3, and all words of the result are from 1 input vector, // case 2 is generated, otherwise case 3 is generated. If no SSSE3 // is present, fall back to case 4. if (TLI.getSubtarget()->hasSSSE3()) { SmallVector pshufbMask; - + // If we have elements from both input vectors, set the high bit of the - // shuffle mask element to zero out elements that come from V2 in the V1 + // shuffle mask element to zero out elements that come from V2 in the V1 // mask, and elements that come from V1 in the V2 mask, so that the two // results can be OR'd together. bool TwoInputs = V1Used && V2Used; @@ -3595,12 +3595,12 @@ SDValue LowerVECTOR_SHUFFLEv8i16(ShuffleVectorSDNode *SVOp, pshufbMask.push_back(DAG.getConstant(EltIdx+1, MVT::i8)); } V1 = DAG.getNode(ISD::BIT_CONVERT, dl, MVT::v16i8, V1); - V1 = DAG.getNode(X86ISD::PSHUFB, dl, MVT::v16i8, V1, + V1 = DAG.getNode(X86ISD::PSHUFB, dl, MVT::v16i8, V1, DAG.getNode(ISD::BUILD_VECTOR, dl, MVT::v16i8, &pshufbMask[0], 16)); if (!TwoInputs) return DAG.getNode(ISD::BIT_CONVERT, dl, MVT::v8i16, V1); - + // Calculate the shuffle mask for the second input, shuffle it, and // OR it with the first shuffled input. pshufbMask.clear(); @@ -3615,7 +3615,7 @@ SDValue LowerVECTOR_SHUFFLEv8i16(ShuffleVectorSDNode *SVOp, pshufbMask.push_back(DAG.getConstant(EltIdx - 15, MVT::i8)); } V2 = DAG.getNode(ISD::BIT_CONVERT, dl, MVT::v16i8, V2); - V2 = DAG.getNode(X86ISD::PSHUFB, dl, MVT::v16i8, V2, + V2 = DAG.getNode(X86ISD::PSHUFB, dl, MVT::v16i8, V2, DAG.getNode(ISD::BUILD_VECTOR, dl, MVT::v16i8, &pshufbMask[0], 16)); V1 = DAG.getNode(ISD::OR, dl, MVT::v16i8, V1, V2); @@ -3644,7 +3644,7 @@ SDValue LowerVECTOR_SHUFFLEv8i16(ShuffleVectorSDNode *SVOp, NewV = DAG.getVectorShuffle(MVT::v8i16, dl, NewV, DAG.getUNDEF(MVT::v8i16), &MaskV[0]); } - + // If BestHi >= 0, generate a pshufhw to put the high elements in order, // and update MaskVals with the new element order. if (BestHiQuad >= 0) { @@ -3666,7 +3666,7 @@ SDValue LowerVECTOR_SHUFFLEv8i16(ShuffleVectorSDNode *SVOp, NewV = DAG.getVectorShuffle(MVT::v8i16, dl, NewV, DAG.getUNDEF(MVT::v8i16), &MaskV[0]); } - + // In case BestHi & BestLo were both -1, which means each quadword has a word // from each of the four input quadwords, calculate the InOrder bitvector now // before falling through to the insert/extract cleanup. @@ -3676,7 +3676,7 @@ SDValue LowerVECTOR_SHUFFLEv8i16(ShuffleVectorSDNode *SVOp, if (MaskVals[i] < 0 || MaskVals[i] == i) InOrder.set(i); } - + // The other elements are put in the right place using pextrw and pinsrw. for (unsigned i = 0; i != 8; ++i) { if (InOrder[i]) @@ -3707,9 +3707,9 @@ SDValue LowerVECTOR_SHUFFLEv16i8(ShuffleVectorSDNode *SVOp, DebugLoc dl = SVOp->getDebugLoc(); SmallVector MaskVals; SVOp->getMask(MaskVals); - + // If we have SSSE3, case 1 is generated when all result bytes come from - // one of the inputs. Otherwise, case 2 is generated. If no SSSE3 is + // one of the inputs. Otherwise, case 2 is generated. If no SSSE3 is // present, fall back to case 3. // FIXME: kill V2Only once shuffles are canonizalized by getNode. bool V1Only = true; @@ -3723,13 +3723,13 @@ SDValue LowerVECTOR_SHUFFLEv16i8(ShuffleVectorSDNode *SVOp, else V1Only = false; } - + // If SSSE3, use 1 pshufb instruction per vector with elements in the result. if (TLI.getSubtarget()->hasSSSE3()) { SmallVector pshufbMask; - + // If all result elements are from one input vector, then only translate - // undef mask values to 0x80 (zero out result) in the pshufb mask. + // undef mask values to 0x80 (zero out result) in the pshufb mask. // // Otherwise, we have elements from both input vectors, and must zero out // elements that come from V2 in the first mask, and V1 in the second mask @@ -3752,7 +3752,7 @@ SDValue LowerVECTOR_SHUFFLEv16i8(ShuffleVectorSDNode *SVOp, MVT::v16i8, &pshufbMask[0], 16)); if (!TwoInputs) return V1; - + // Calculate the shuffle mask for the second input, shuffle it, and // OR it with the first shuffled input. pshufbMask.clear(); @@ -3769,7 +3769,7 @@ SDValue LowerVECTOR_SHUFFLEv16i8(ShuffleVectorSDNode *SVOp, MVT::v16i8, &pshufbMask[0], 16)); return DAG.getNode(ISD::OR, dl, MVT::v16i8, V1, V2); } - + // No SSSE3 - Calculate in place words and then fix all out of place words // With 0-16 extracts & inserts. Worst case is 16 bytes out of order from // the 16 different words that comprise the two doublequadword input vectors. @@ -3779,17 +3779,17 @@ SDValue LowerVECTOR_SHUFFLEv16i8(ShuffleVectorSDNode *SVOp, for (int i = 0; i != 8; ++i) { int Elt0 = MaskVals[i*2]; int Elt1 = MaskVals[i*2+1]; - + // This word of the result is all undef, skip it. if (Elt0 < 0 && Elt1 < 0) continue; - + // This word of the result is already in the correct place, skip it. if (V1Only && (Elt0 == i*2) && (Elt1 == i*2+1)) continue; if (V2Only && (Elt0 == i*2+16) && (Elt1 == i*2+17)) continue; - + SDValue Elt0Src = Elt0 < 16 ? V1 : V2; SDValue Elt1Src = Elt1 < 16 ? V1 : V2; SDValue InsElt; @@ -3937,7 +3937,7 @@ LowerVECTOR_SHUFFLE_4wide(ShuffleVectorSDNode *SVOp, SelectionDAG &DAG) { SDValue V2 = SVOp->getOperand(1); DebugLoc dl = SVOp->getDebugLoc(); EVT VT = SVOp->getValueType(0); - + SmallVector, 8> Locs; Locs.resize(4); SmallVector Mask1(4U, -1); @@ -3973,7 +3973,7 @@ LowerVECTOR_SHUFFLE_4wide(ShuffleVectorSDNode *SVOp, SelectionDAG &DAG) { V1 = DAG.getVectorShuffle(VT, dl, V1, V2, &Mask1[0]); SmallVector Mask2(4U, -1); - + for (unsigned i = 0; i != 4; ++i) { if (Locs[i].first == -1) continue; @@ -4097,7 +4097,7 @@ X86TargetLowering::LowerVECTOR_SHUFFLE(SDValue Op, SelectionDAG &DAG) { // Promote splats to v4f32. if (SVOp->isSplat()) { - if (isMMX || NumElems < 4) + if (isMMX || NumElems < 4) return Op; return PromoteSplat(SVOp, DAG, Subtarget->hasSSE2()); } @@ -4126,10 +4126,10 @@ X86TargetLowering::LowerVECTOR_SHUFFLE(SDValue Op, SelectionDAG &DAG) { DAG, Subtarget, dl); } } - + if (X86::isPSHUFDMask(SVOp)) return Op; - + // Check if this can be converted into a logical shift. bool isLeft = false; unsigned ShAmt = 0; @@ -4143,7 +4143,7 @@ X86TargetLowering::LowerVECTOR_SHUFFLE(SDValue Op, SelectionDAG &DAG) { ShAmt *= EVT.getSizeInBits(); return getVShift(isLeft, VT, ShVal, ShAmt, DAG, *this, dl); } - + if (X86::isMOVLMask(SVOp)) { if (V1IsUndef) return V2; @@ -4152,7 +4152,7 @@ X86TargetLowering::LowerVECTOR_SHUFFLE(SDValue Op, SelectionDAG &DAG) { if (!isMMX) return Op; } - + // FIXME: fold these into legal mask. if (!isMMX && (X86::isMOVSHDUPMask(SVOp) || X86::isMOVSLDUPMask(SVOp) || @@ -4171,7 +4171,7 @@ X86TargetLowering::LowerVECTOR_SHUFFLE(SDValue Op, SelectionDAG &DAG) { ShAmt *= EVT.getSizeInBits(); return getVShift(isLeft, VT, ShVal, ShAmt, DAG, *this, dl); } - + bool Commuted = false; // FIXME: This should also accept a bitcast of a splat? Be careful, not // 1,1,1,1 -> v8i16 though. @@ -4191,7 +4191,7 @@ X86TargetLowering::LowerVECTOR_SHUFFLE(SDValue Op, SelectionDAG &DAG) { if (isCommutedMOVL(SVOp, V2IsSplat, V2IsUndef)) { // Shuffling low element of v1 into undef, just return v1. - if (V2IsUndef) + if (V2IsUndef) return V1; // If V2 is a splat, the mask may be malformed such as <4,3,3,3>, which // the instruction selector will not match, so get a canonical MOVL with @@ -4243,7 +4243,7 @@ X86TargetLowering::LowerVECTOR_SHUFFLE(SDValue Op, SelectionDAG &DAG) { SVOp->getMask(PermMask); if (isShuffleMaskLegal(PermMask, VT)) return Op; - + // Handle v8i16 specifically since SSE can do byte extraction and insertion. if (VT == MVT::v8i16) { SDValue NewOp = LowerVECTOR_SHUFFLEv8i16(SVOp, DAG, *this); @@ -4256,7 +4256,7 @@ X86TargetLowering::LowerVECTOR_SHUFFLE(SDValue Op, SelectionDAG &DAG) { if (NewOp.getNode()) return NewOp; } - + // Handle all 4 wide cases with a number of shuffles except for MMX. if (NumElems == 4 && !isMMX) return LowerVECTOR_SHUFFLE_4wide(SVOp, DAG); @@ -4353,11 +4353,11 @@ X86TargetLowering::LowerEXTRACT_VECTOR_ELT(SDValue Op, SelectionDAG &DAG) { unsigned Idx = cast(Op.getOperand(1))->getZExtValue(); if (Idx == 0) return Op; - + // SHUFPS the element to the lowest double word, then movss. int Mask[4] = { Idx, -1, -1, -1 }; EVT VVT = Op.getOperand(0).getValueType(); - SDValue Vec = DAG.getVectorShuffle(VVT, dl, Op.getOperand(0), + SDValue Vec = DAG.getVectorShuffle(VVT, dl, Op.getOperand(0), DAG.getUNDEF(VVT), Mask); return DAG.getNode(ISD::EXTRACT_VECTOR_ELT, dl, VT, Vec, DAG.getIntPtrConstant(0)); @@ -4374,7 +4374,7 @@ X86TargetLowering::LowerEXTRACT_VECTOR_ELT(SDValue Op, SelectionDAG &DAG) { // to a f64mem, the whole operation is folded into a single MOVHPDmr. int Mask[2] = { 1, -1 }; EVT VVT = Op.getOperand(0).getValueType(); - SDValue Vec = DAG.getVectorShuffle(VVT, dl, Op.getOperand(0), + SDValue Vec = DAG.getVectorShuffle(VVT, dl, Op.getOperand(0), DAG.getUNDEF(VVT), Mask); return DAG.getNode(ISD::EXTRACT_VECTOR_ELT, dl, VT, Vec, DAG.getIntPtrConstant(0)); @@ -4486,7 +4486,7 @@ X86TargetLowering::LowerSCALAR_TO_VECTOR(SDValue Op, SelectionDAG &DAG) { SDValue X86TargetLowering::LowerConstantPool(SDValue Op, SelectionDAG &DAG) { ConstantPoolSDNode *CP = cast(Op); - + // In PIC mode (unless we're in RIPRel PIC mode) we add an offset to the // global base reg. unsigned char OpFlag = 0; @@ -4500,7 +4500,7 @@ X86TargetLowering::LowerConstantPool(SDValue Op, SelectionDAG &DAG) { OpFlag = X86II::MO_GOTOFF; else if (Subtarget->isPICStyleStubPIC()) OpFlag = X86II::MO_PIC_BASE_OFFSET; - + SDValue Result = DAG.getTargetConstantPool(CP->getConstVal(), getPointerTy(), CP->getAlignment(), CP->getOffset(), OpFlag); @@ -4519,7 +4519,7 @@ X86TargetLowering::LowerConstantPool(SDValue Op, SelectionDAG &DAG) { SDValue X86TargetLowering::LowerJumpTable(SDValue Op, SelectionDAG &DAG) { JumpTableSDNode *JT = cast(Op); - + // In PIC mode (unless we're in RIPRel PIC mode) we add an offset to the // global base reg. unsigned char OpFlag = 0; @@ -4533,12 +4533,12 @@ SDValue X86TargetLowering::LowerJumpTable(SDValue Op, SelectionDAG &DAG) { OpFlag = X86II::MO_GOTOFF; else if (Subtarget->isPICStyleStubPIC()) OpFlag = X86II::MO_PIC_BASE_OFFSET; - + SDValue Result = DAG.getTargetJumpTable(JT->getIndex(), getPointerTy(), OpFlag); DebugLoc DL = JT->getDebugLoc(); Result = DAG.getNode(WrapperKind, DL, getPointerTy(), Result); - + // With PIC, the address is actually $g + Offset. if (OpFlag) { Result = DAG.getNode(ISD::ADD, DL, getPointerTy(), @@ -4546,14 +4546,14 @@ SDValue X86TargetLowering::LowerJumpTable(SDValue Op, SelectionDAG &DAG) { DebugLoc::getUnknownLoc(), getPointerTy()), Result); } - + return Result; } SDValue X86TargetLowering::LowerExternalSymbol(SDValue Op, SelectionDAG &DAG) { const char *Sym = cast(Op)->getSymbol(); - + // In PIC mode (unless we're in RIPRel PIC mode) we add an offset to the // global base reg. unsigned char OpFlag = 0; @@ -4567,13 +4567,13 @@ X86TargetLowering::LowerExternalSymbol(SDValue Op, SelectionDAG &DAG) { OpFlag = X86II::MO_GOTOFF; else if (Subtarget->isPICStyleStubPIC()) OpFlag = X86II::MO_PIC_BASE_OFFSET; - + SDValue Result = DAG.getTargetExternalSymbol(Sym, getPointerTy(), OpFlag); - + DebugLoc DL = Op.getDebugLoc(); Result = DAG.getNode(WrapperKind, DL, getPointerTy(), Result); - - + + // With PIC, the address is actually $g + Offset. if (getTargetMachine().getRelocationModel() == Reloc::PIC_ && !Subtarget->is64Bit()) { @@ -4583,7 +4583,7 @@ X86TargetLowering::LowerExternalSymbol(SDValue Op, SelectionDAG &DAG) { getPointerTy()), Result); } - + return Result; } @@ -4605,7 +4605,7 @@ X86TargetLowering::LowerGlobalAddress(const GlobalValue *GV, DebugLoc dl, } else { Result = DAG.getTargetGlobalAddress(GV, getPointerTy(), 0, OpFlags); } - + if (Subtarget->isPICStyleRIPRel() && (M == CodeModel::Small || M == CodeModel::Kernel)) Result = DAG.getNode(X86ISD::WrapperRIP, dl, getPointerTy(), Result); @@ -4714,7 +4714,7 @@ static SDValue LowerToTLSExecModel(GlobalAddressSDNode *GA, SelectionDAG &DAG, assert(model == TLSModel::InitialExec); OperandFlags = X86II::MO_INDNTPOFF; } - + // emit "addl x@ntpoff,%eax" (local exec) or "addl x@indntpoff,%eax" (initial // exec) SDValue TGA = DAG.getTargetGlobalAddress(GA->getGlobal(), GA->getValueType(0), @@ -4738,28 +4738,28 @@ X86TargetLowering::LowerGlobalTLSAddress(SDValue Op, SelectionDAG &DAG) { "TLS not implemented for non-ELF targets"); GlobalAddressSDNode *GA = cast(Op); const GlobalValue *GV = GA->getGlobal(); - + // If GV is an alias then use the aliasee for determining // thread-localness. if (const GlobalAlias *GA = dyn_cast(GV)) GV = GA->resolveAliasedGlobal(false); - + TLSModel::Model model = getTLSModel(GV, getTargetMachine().getRelocationModel()); - + switch (model) { case TLSModel::GeneralDynamic: case TLSModel::LocalDynamic: // not implemented if (Subtarget->is64Bit()) return LowerToTLSGeneralDynamicModel64(GA, DAG, getPointerTy()); return LowerToTLSGeneralDynamicModel32(GA, DAG, getPointerTy()); - + case TLSModel::InitialExec: case TLSModel::LocalExec: return LowerToTLSExecModel(GA, DAG, getPointerTy(), model, Subtarget->is64Bit()); } - + llvm_unreachable("Unreachable"); return SDValue(); } @@ -5082,7 +5082,7 @@ FP_TO_INTHelper(SDValue Op, SelectionDAG &DAG, bool IsSigned) { unsigned MemSize = DstTy.getSizeInBits()/8; int SSFI = MF.getFrameInfo()->CreateStackObject(MemSize, MemSize); SDValue StackSlot = DAG.getFrameIndex(SSFI, getPointerTy()); - + unsigned Opc; switch (DstTy.getSimpleVT().SimpleTy) { default: llvm_unreachable("Invalid FP_TO_SINT to lower!"); @@ -6241,12 +6241,12 @@ X86TargetLowering::LowerINTRINSIC_WO_CHAIN(SDValue Op, SelectionDAG &DAG) { // CF = 1 X86CC = X86::COND_B; break; - case Intrinsic::x86_sse41_ptestnzc: + case Intrinsic::x86_sse41_ptestnzc: // ZF and CF = 0 X86CC = X86::COND_A; break; } - + SDValue LHS = Op.getOperand(1); SDValue RHS = Op.getOperand(2); SDValue Test = DAG.getNode(X86ISD::PTEST, dl, MVT::i32, LHS, RHS); @@ -7197,7 +7197,7 @@ bool X86TargetLowering::isNarrowingProfitable(EVT VT1, EVT VT2) const { /// By default, if a target supports the VECTOR_SHUFFLE node, all mask values /// are assumed to be legal. bool -X86TargetLowering::isShuffleMaskLegal(const SmallVectorImpl &M, +X86TargetLowering::isShuffleMaskLegal(const SmallVectorImpl &M, EVT VT) const { // Only do shuffles on 128-bit vector types for now. if (VT.getSizeInBits() == 64) @@ -7595,6 +7595,8 @@ X86TargetLowering::EmitAtomicMinMaxWithCustomInserter(MachineInstr *mInstr, return nextMBB; } +// FIXME: When we get size specific XMM0 registers, i.e. XMM0_V16I8 +// all of this code can be replaced with that in the .td file. MachineBasicBlock * X86TargetLowering::EmitPCMP(MachineInstr *MI, MachineBasicBlock *BB, unsigned numArgs, bool memArg) const { @@ -7707,6 +7709,7 @@ X86TargetLowering::EmitInstrWithCustomInserter(MachineInstr *MI, const TargetInstrInfo *TII = getTargetMachine().getInstrInfo(); switch (MI->getOpcode()) { default: assert(false && "Unexpected instr type to insert"); + case X86::CMOV_GR8: case X86::CMOV_V1I64: case X86::CMOV_FR32: case X86::CMOV_FR64: @@ -8166,7 +8169,7 @@ static SDValue PerformSELECTCombine(SDNode *N, SelectionDAG &DAG, // Get the LHS/RHS of the select. SDValue LHS = N->getOperand(1); SDValue RHS = N->getOperand(2); - + // If we have SSE[12] support, try to form min/max nodes. if (Subtarget->hasSSE2() && (LHS.getValueType() == MVT::f32 || LHS.getValueType() == MVT::f64) && @@ -8225,7 +8228,7 @@ static SDValue PerformSELECTCombine(SDNode *N, SelectionDAG &DAG, if (Opcode) return DAG.getNode(Opcode, DL, N->getValueType(0), LHS, RHS); } - + // If this is a select between two integer constants, try to do some // optimizations. if (ConstantSDNode *TrueC = dyn_cast(LHS)) { @@ -8235,7 +8238,7 @@ static SDValue PerformSELECTCombine(SDNode *N, SelectionDAG &DAG, // If this is efficiently invertible, canonicalize the LHSC/RHSC values // so that TrueC (the true value) is larger than FalseC. bool NeedsCondInvert = false; - + if (TrueC->getAPIntValue().ult(FalseC->getAPIntValue()) && // Efficiently invertible. (Cond.getOpcode() == ISD::SETCC || // setcc -> invertible. @@ -8244,41 +8247,41 @@ static SDValue PerformSELECTCombine(SDNode *N, SelectionDAG &DAG, NeedsCondInvert = true; std::swap(TrueC, FalseC); } - + // Optimize C ? 8 : 0 -> zext(C) << 3. Likewise for any pow2/0. if (FalseC->getAPIntValue() == 0 && TrueC->getAPIntValue().isPowerOf2()) { if (NeedsCondInvert) // Invert the condition if needed. Cond = DAG.getNode(ISD::XOR, DL, Cond.getValueType(), Cond, DAG.getConstant(1, Cond.getValueType())); - + // Zero extend the condition if needed. Cond = DAG.getNode(ISD::ZERO_EXTEND, DL, LHS.getValueType(), Cond); - + unsigned ShAmt = TrueC->getAPIntValue().logBase2(); return DAG.getNode(ISD::SHL, DL, LHS.getValueType(), Cond, DAG.getConstant(ShAmt, MVT::i8)); } - + // Optimize Cond ? cst+1 : cst -> zext(setcc(C)+cst. if (FalseC->getAPIntValue()+1 == TrueC->getAPIntValue()) { if (NeedsCondInvert) // Invert the condition if needed. Cond = DAG.getNode(ISD::XOR, DL, Cond.getValueType(), Cond, DAG.getConstant(1, Cond.getValueType())); - + // Zero extend the condition if needed. Cond = DAG.getNode(ISD::ZERO_EXTEND, DL, FalseC->getValueType(0), Cond); return DAG.getNode(ISD::ADD, DL, Cond.getValueType(), Cond, SDValue(FalseC, 0)); } - + // Optimize cases that will turn into an LEA instruction. This requires // an i32 or i64 and an efficient multiplier (1, 2, 3, 4, 5, 8, 9). if (N->getValueType(0) == MVT::i32 || N->getValueType(0) == MVT::i64) { uint64_t Diff = TrueC->getZExtValue()-FalseC->getZExtValue(); if (N->getValueType(0) == MVT::i32) Diff = (unsigned)Diff; - + bool isFastMultiplier = false; if (Diff < 10) { switch ((unsigned char)Diff) { @@ -8294,13 +8297,13 @@ static SDValue PerformSELECTCombine(SDNode *N, SelectionDAG &DAG, break; } } - + if (isFastMultiplier) { APInt Diff = TrueC->getAPIntValue()-FalseC->getAPIntValue(); if (NeedsCondInvert) // Invert the condition if needed. Cond = DAG.getNode(ISD::XOR, DL, Cond.getValueType(), Cond, DAG.getConstant(1, Cond.getValueType())); - + // Zero extend the condition if needed. Cond = DAG.getNode(ISD::ZERO_EXTEND, DL, FalseC->getValueType(0), Cond); @@ -8308,17 +8311,17 @@ static SDValue PerformSELECTCombine(SDNode *N, SelectionDAG &DAG, if (Diff != 1) Cond = DAG.getNode(ISD::MUL, DL, Cond.getValueType(), Cond, DAG.getConstant(Diff, Cond.getValueType())); - + // Add the base if non-zero. if (FalseC->getAPIntValue() != 0) Cond = DAG.getNode(ISD::ADD, DL, Cond.getValueType(), Cond, SDValue(FalseC, 0)); return Cond; } - } + } } } - + return SDValue(); } @@ -8326,11 +8329,11 @@ static SDValue PerformSELECTCombine(SDNode *N, SelectionDAG &DAG, static SDValue PerformCMOVCombine(SDNode *N, SelectionDAG &DAG, TargetLowering::DAGCombinerInfo &DCI) { DebugLoc DL = N->getDebugLoc(); - + // If the flag operand isn't dead, don't touch this CMOV. if (N->getNumValues() == 2 && !SDValue(N, 1).use_empty()) return SDValue(); - + // If this is a select between two integer constants, try to do some // optimizations. Note that the operands are ordered the opposite of SELECT // operands. @@ -8339,12 +8342,12 @@ static SDValue PerformCMOVCombine(SDNode *N, SelectionDAG &DAG, // Canonicalize the TrueC/FalseC values so that TrueC (the true value) is // larger than FalseC (the false value). X86::CondCode CC = (X86::CondCode)N->getConstantOperandVal(2); - + if (TrueC->getAPIntValue().ult(FalseC->getAPIntValue())) { CC = X86::GetOppositeBranchCondition(CC); std::swap(TrueC, FalseC); } - + // Optimize C ? 8 : 0 -> zext(setcc(C)) << 3. Likewise for any pow2/0. // This is efficient for any integer data type (including i8/i16) and // shift amount. @@ -8352,10 +8355,10 @@ static SDValue PerformCMOVCombine(SDNode *N, SelectionDAG &DAG, SDValue Cond = N->getOperand(3); Cond = DAG.getNode(X86ISD::SETCC, DL, MVT::i8, DAG.getConstant(CC, MVT::i8), Cond); - + // Zero extend the condition if needed. Cond = DAG.getNode(ISD::ZERO_EXTEND, DL, TrueC->getValueType(0), Cond); - + unsigned ShAmt = TrueC->getAPIntValue().logBase2(); Cond = DAG.getNode(ISD::SHL, DL, Cond.getValueType(), Cond, DAG.getConstant(ShAmt, MVT::i8)); @@ -8363,31 +8366,31 @@ static SDValue PerformCMOVCombine(SDNode *N, SelectionDAG &DAG, return DCI.CombineTo(N, Cond, SDValue()); return Cond; } - + // Optimize Cond ? cst+1 : cst -> zext(setcc(C)+cst. This is efficient // for any integer data type, including i8/i16. if (FalseC->getAPIntValue()+1 == TrueC->getAPIntValue()) { SDValue Cond = N->getOperand(3); Cond = DAG.getNode(X86ISD::SETCC, DL, MVT::i8, DAG.getConstant(CC, MVT::i8), Cond); - + // Zero extend the condition if needed. Cond = DAG.getNode(ISD::ZERO_EXTEND, DL, FalseC->getValueType(0), Cond); Cond = DAG.getNode(ISD::ADD, DL, Cond.getValueType(), Cond, SDValue(FalseC, 0)); - + if (N->getNumValues() == 2) // Dead flag value? return DCI.CombineTo(N, Cond, SDValue()); return Cond; } - + // Optimize cases that will turn into an LEA instruction. This requires // an i32 or i64 and an efficient multiplier (1, 2, 3, 4, 5, 8, 9). if (N->getValueType(0) == MVT::i32 || N->getValueType(0) == MVT::i64) { uint64_t Diff = TrueC->getZExtValue()-FalseC->getZExtValue(); if (N->getValueType(0) == MVT::i32) Diff = (unsigned)Diff; - + bool isFastMultiplier = false; if (Diff < 10) { switch ((unsigned char)Diff) { @@ -8403,7 +8406,7 @@ static SDValue PerformCMOVCombine(SDNode *N, SelectionDAG &DAG, break; } } - + if (isFastMultiplier) { APInt Diff = TrueC->getAPIntValue()-FalseC->getAPIntValue(); SDValue Cond = N->getOperand(3); @@ -8425,7 +8428,7 @@ static SDValue PerformCMOVCombine(SDNode *N, SelectionDAG &DAG, return DCI.CombineTo(N, Cond, SDValue()); return Cond; } - } + } } } return SDValue(); @@ -8479,17 +8482,17 @@ static SDValue PerformMulCombine(SDNode *N, SelectionDAG &DAG, std::swap(MulAmt1, MulAmt2); SDValue NewMul; - if (isPowerOf2_64(MulAmt1)) + if (isPowerOf2_64(MulAmt1)) NewMul = DAG.getNode(ISD::SHL, DL, VT, N->getOperand(0), DAG.getConstant(Log2_64(MulAmt1), MVT::i8)); else NewMul = DAG.getNode(X86ISD::MUL_IMM, DL, VT, N->getOperand(0), DAG.getConstant(MulAmt1, VT)); - if (isPowerOf2_64(MulAmt2)) + if (isPowerOf2_64(MulAmt2)) NewMul = DAG.getNode(ISD::SHL, DL, VT, NewMul, DAG.getConstant(Log2_64(MulAmt2), MVT::i8)); - else + else NewMul = DAG.getNode(X86ISD::MUL_IMM, DL, VT, NewMul, DAG.getConstant(MulAmt2, VT)); @@ -8611,7 +8614,7 @@ static SDValue PerformSTORECombine(SDNode *N, SelectionDAG &DAG, const Function *F = DAG.getMachineFunction().getFunction(); bool NoImplicitFloatOps = F->hasFnAttr(Attribute::NoImplicitFloat); - bool F64IsLegal = !UseSoftFloat && !NoImplicitFloatOps + bool F64IsLegal = !UseSoftFloat && !NoImplicitFloatOps && Subtarget->hasSSE2(); if ((VT.isVector() || (VT == MVT::i64 && F64IsLegal && !Subtarget->is64Bit())) && @@ -8760,7 +8763,7 @@ static SDValue PerformVZEXT_MOVLCombine(SDNode *N, SelectionDAG &DAG) { Op = Op.getOperand(0); EVT VT = N->getValueType(0), OpVT = Op.getValueType(); if (Op.getOpcode() == X86ISD::VZEXT_LOAD && - VT.getVectorElementType().getSizeInBits() == + VT.getVectorElementType().getSizeInBits() == OpVT.getVectorElementType().getSizeInBits()) { return DAG.getNode(ISD::BIT_CONVERT, N->getDebugLoc(), VT, Op); } @@ -8770,7 +8773,7 @@ static SDValue PerformVZEXT_MOVLCombine(SDNode *N, SelectionDAG &DAG) { // On X86 and X86-64, atomic operations are lowered to locked instructions. // Locked instructions, in turn, have implicit fence semantics (all memory // operations are flushed before issuing the locked instruction, and the -// are not buffered), so we can fold away the common pattern of +// are not buffered), so we can fold away the common pattern of // fence-atomic-fence. static SDValue PerformMEMBARRIERCombine(SDNode* N, SelectionDAG &DAG) { SDValue atomic = N->getOperand(0); @@ -8791,11 +8794,11 @@ static SDValue PerformMEMBARRIERCombine(SDNode* N, SelectionDAG &DAG) { default: return SDValue(); } - + SDValue fence = atomic.getOperand(0); if (fence.getOpcode() != ISD::MEMBARRIER) return SDValue(); - + switch (atomic.getOpcode()) { case ISD::ATOMIC_CMP_SWAP: return DAG.UpdateNodeOperands(atomic, fence.getOperand(0), @@ -8852,25 +8855,25 @@ static bool LowerToBSwap(CallInst *CI) { // we will turn this bswap into something that will be lowered to logical ops // instead of emitting the bswap asm. For now, we don't support 486 or lower // so don't worry about this. - + // Verify this is a simple bswap. if (CI->getNumOperands() != 2 || CI->getType() != CI->getOperand(1)->getType() || !CI->getType()->isInteger()) return false; - + const IntegerType *Ty = dyn_cast(CI->getType()); if (!Ty || Ty->getBitWidth() % 16 != 0) return false; - + // Okay, we can do this xform, do so now. const Type *Tys[] = { Ty }; Module *M = CI->getParent()->getParent()->getParent(); Constant *Int = Intrinsic::getDeclaration(M, Intrinsic::bswap, Tys, 1); - + Value *Op = CI->getOperand(1); Op = CallInst::Create(Int, Op, CI->getName(), CI); - + CI->replaceAllUsesWith(Op); CI->eraseFromParent(); return true; @@ -8915,7 +8918,7 @@ bool X86TargetLowering::ExpandInlineAsm(CallInst *CI) const { } break; case 3: - if (CI->getType() == Type::getInt64Ty(CI->getContext()) && + if (CI->getType() == Type::getInt64Ty(CI->getContext()) && Constraints.size() >= 2 && Constraints[0].Codes.size() == 1 && Constraints[0].Codes[0] == "A" && Constraints[1].Codes.size() == 1 && Constraints[1].Codes[0] == "0") { @@ -9094,7 +9097,7 @@ void X86TargetLowering::LowerAsmOperandForConstraint(SDValue Op, // Otherwise, this isn't something we can handle, reject it. return; } - + GlobalValue *GV = GA->getGlobal(); // If we require an extra load to get this address, as in PIC mode, we // can't accept it. @@ -9156,7 +9159,7 @@ getRegClassForInlineAsmConstraint(const std::string &Constraint, break; } - // 32-bit fallthrough + // 32-bit fallthrough case 'Q': // Q_REGS if (VT == MVT::i32) return make_vector(X86::EAX, X86::EDX, X86::ECX, X86::EBX, 0); diff --git a/libclamav/c++/llvm/lib/Target/X86/X86Instr64bit.td b/libclamav/c++/llvm/lib/Target/X86/X86Instr64bit.td index 7eaf15d0f..00dfc048d 100644 --- a/libclamav/c++/llvm/lib/Target/X86/X86Instr64bit.td +++ b/libclamav/c++/llvm/lib/Target/X86/X86Instr64bit.td @@ -1599,30 +1599,15 @@ def : Pat<(extloadi64i16 addr:$src), (MOVZX64rm16 addr:$src)>; // For other extloads, use subregs, since the high contents of the register are // defined after an extload. def : Pat<(extloadi64i32 addr:$src), - (INSERT_SUBREG (i64 (IMPLICIT_DEF)), (MOV32rm addr:$src), + (SUBREG_TO_REG (i64 0), (MOV32rm addr:$src), x86_subreg_32bit)>; -def : Pat<(extloadi16i1 addr:$src), - (INSERT_SUBREG (i16 (IMPLICIT_DEF)), (MOV8rm addr:$src), - x86_subreg_8bit)>, - Requires<[In64BitMode]>; -def : Pat<(extloadi16i8 addr:$src), - (INSERT_SUBREG (i16 (IMPLICIT_DEF)), (MOV8rm addr:$src), - x86_subreg_8bit)>, - Requires<[In64BitMode]>; -// anyext -def : Pat<(i64 (anyext GR8:$src)), - (INSERT_SUBREG (i64 (IMPLICIT_DEF)), GR8:$src, x86_subreg_8bit)>; -def : Pat<(i64 (anyext GR16:$src)), - (INSERT_SUBREG (i64 (IMPLICIT_DEF)), GR16:$src, x86_subreg_16bit)>; -def : Pat<(i64 (anyext GR32:$src)), - (INSERT_SUBREG (i64 (IMPLICIT_DEF)), GR32:$src, x86_subreg_32bit)>; -def : Pat<(i16 (anyext GR8:$src)), - (INSERT_SUBREG (i16 (IMPLICIT_DEF)), GR8:$src, x86_subreg_8bit)>, - Requires<[In64BitMode]>; -def : Pat<(i32 (anyext GR8:$src)), - (INSERT_SUBREG (i32 (IMPLICIT_DEF)), GR8:$src, x86_subreg_8bit)>, - Requires<[In64BitMode]>; +// anyext. Define these to do an explicit zero-extend to +// avoid partial-register updates. +def : Pat<(i64 (anyext GR8 :$src)), (MOVZX64rr8 GR8 :$src)>; +def : Pat<(i64 (anyext GR16:$src)), (MOVZX64rr16 GR16 :$src)>; +def : Pat<(i64 (anyext GR32:$src)), + (SUBREG_TO_REG (i64 0), GR32:$src, x86_subreg_32bit)>; //===----------------------------------------------------------------------===// // Some peepholes @@ -1720,6 +1705,11 @@ def : Pat<(i32 (zext (srl_su GR16:$src, (i8 8)))), (EXTRACT_SUBREG (COPY_TO_REGCLASS GR16:$src, GR16_ABCD), x86_subreg_8bit_hi))>, Requires<[In64BitMode]>; +def : Pat<(i32 (anyext (srl_su GR16:$src, (i8 8)))), + (MOVZX32_NOREXrr8 + (EXTRACT_SUBREG (COPY_TO_REGCLASS GR16:$src, GR16_ABCD), + x86_subreg_8bit_hi))>, + Requires<[In64BitMode]>; def : Pat<(i64 (zext (srl_su GR16:$src, (i8 8)))), (SUBREG_TO_REG (i64 0), @@ -1727,6 +1717,13 @@ def : Pat<(i64 (zext (srl_su GR16:$src, (i8 8)))), (EXTRACT_SUBREG (COPY_TO_REGCLASS GR16:$src, GR16_ABCD), x86_subreg_8bit_hi)), x86_subreg_32bit)>; +def : Pat<(i64 (anyext (srl_su GR16:$src, (i8 8)))), + (SUBREG_TO_REG + (i64 0), + (MOVZX32_NOREXrr8 + (EXTRACT_SUBREG (COPY_TO_REGCLASS GR16:$src, GR16_ABCD), + x86_subreg_8bit_hi)), + x86_subreg_32bit)>; // h-register extract and store. def : Pat<(store (i8 (trunc_su (srl_su GR64:$src, (i8 8)))), addr:$dst), diff --git a/libclamav/c++/llvm/lib/Target/X86/X86InstrInfo.cpp b/libclamav/c++/llvm/lib/Target/X86/X86InstrInfo.cpp index 97dcc75a6..c52a9092a 100644 --- a/libclamav/c++/llvm/lib/Target/X86/X86InstrInfo.cpp +++ b/libclamav/c++/llvm/lib/Target/X86/X86InstrInfo.cpp @@ -2035,6 +2035,7 @@ bool X86InstrInfo::spillCalleeSavedRegisters(MachineBasicBlock &MBB, if (MI != MBB.end()) DL = MI->getDebugLoc(); bool is64Bit = TM.getSubtarget().is64Bit(); + bool isWin64 = TM.getSubtarget().isTargetWin64(); unsigned SlotSize = is64Bit ? 8 : 4; MachineFunction &MF = *MBB.getParent(); @@ -2051,7 +2052,7 @@ bool X86InstrInfo::spillCalleeSavedRegisters(MachineBasicBlock &MBB, if (Reg == FPReg) // X86RegisterInfo::emitPrologue will handle spilling of frame register. continue; - if (RegClass != &X86::VR128RegClass) { + if (RegClass != &X86::VR128RegClass && !isWin64) { CalleeFrameSize += SlotSize; BuildMI(MBB, MI, DL, get(Opc)).addReg(Reg, RegState::Kill); } else { @@ -2075,6 +2076,7 @@ bool X86InstrInfo::restoreCalleeSavedRegisters(MachineBasicBlock &MBB, MachineFunction &MF = *MBB.getParent(); unsigned FPReg = RI.getFrameRegister(MF); bool is64Bit = TM.getSubtarget().is64Bit(); + bool isWin64 = TM.getSubtarget().isTargetWin64(); unsigned Opc = is64Bit ? X86::POP64r : X86::POP32r; for (unsigned i = 0, e = CSI.size(); i != e; ++i) { unsigned Reg = CSI[i].getReg(); @@ -2082,7 +2084,7 @@ bool X86InstrInfo::restoreCalleeSavedRegisters(MachineBasicBlock &MBB, // X86RegisterInfo::emitEpilogue will handle restoring of frame register. continue; const TargetRegisterClass *RegClass = CSI[i].getRegClass(); - if (RegClass != &X86::VR128RegClass) { + if (RegClass != &X86::VR128RegClass && !isWin64) { BuildMI(MBB, MI, DL, get(Opc), Reg); } else { loadRegFromStackSlot(MBB, MI, Reg, CSI[i].getFrameIdx(), RegClass); diff --git a/libclamav/c++/llvm/lib/Target/X86/X86InstrInfo.td b/libclamav/c++/llvm/lib/Target/X86/X86InstrInfo.td index f13102640..056335f16 100644 --- a/libclamav/c++/llvm/lib/Target/X86/X86InstrInfo.td +++ b/libclamav/c++/llvm/lib/Target/X86/X86InstrInfo.td @@ -1034,6 +1034,20 @@ let isTwoAddress = 1 in { // Conditional moves let Uses = [EFLAGS] in { + +// X86 doesn't have 8-bit conditional moves. Use a customDAGSchedInserter to +// emit control flow. An alternative to this is to mark i8 SELECT as Promote, +// however that requires promoting the operands, and can induce additional +// i8 register pressure. Note that CMOV_GR8 is conservatively considered to +// clobber EFLAGS, because if one of the operands is zero, the expansion +// could involve an xor. +let usesCustomDAGSchedInserter = 1, isTwoAddress = 0, Defs = [EFLAGS] in +def CMOV_GR8 : I<0, Pseudo, + (outs GR8:$dst), (ins GR8:$src1, GR8:$src2, i8imm:$cond), + "#CMOV_GR8 PSEUDO!", + [(set GR8:$dst, (X86cmov GR8:$src1, GR8:$src2, + imm:$cond, EFLAGS))]>; + let isCommutable = 1 in { def CMOVB16rr : I<0x42, MRMSrcReg, // if ; @@ -3630,21 +3644,17 @@ def : Pat<(zextloadi32i1 addr:$src), (MOVZX32rm8 addr:$src)>; // extload bool -> extload byte def : Pat<(extloadi8i1 addr:$src), (MOV8rm addr:$src)>; -def : Pat<(extloadi16i1 addr:$src), (MOVZX16rm8 addr:$src)>, - Requires<[In32BitMode]>; +def : Pat<(extloadi16i1 addr:$src), (MOVZX16rm8 addr:$src)>; def : Pat<(extloadi32i1 addr:$src), (MOVZX32rm8 addr:$src)>; -def : Pat<(extloadi16i8 addr:$src), (MOVZX16rm8 addr:$src)>, - Requires<[In32BitMode]>; +def : Pat<(extloadi16i8 addr:$src), (MOVZX16rm8 addr:$src)>; def : Pat<(extloadi32i8 addr:$src), (MOVZX32rm8 addr:$src)>; def : Pat<(extloadi32i16 addr:$src), (MOVZX32rm16 addr:$src)>; -// anyext -def : Pat<(i16 (anyext GR8 :$src)), (MOVZX16rr8 GR8 :$src)>, - Requires<[In32BitMode]>; -def : Pat<(i32 (anyext GR8 :$src)), (MOVZX32rr8 GR8 :$src)>, - Requires<[In32BitMode]>; -def : Pat<(i32 (anyext GR16:$src)), - (INSERT_SUBREG (i32 (IMPLICIT_DEF)), GR16:$src, x86_subreg_16bit)>; +// anyext. Define these to do an explicit zero-extend to +// avoid partial-register updates. +def : Pat<(i16 (anyext GR8 :$src)), (MOVZX16rr8 GR8 :$src)>; +def : Pat<(i32 (anyext GR8 :$src)), (MOVZX32rr8 GR8 :$src)>; +def : Pat<(i32 (anyext GR16:$src)), (MOVZX32rr16 GR16:$src)>; // (and (i32 load), 255) -> (zextload i8) def : Pat<(i32 (and (nvloadi32 addr:$src), (i32 255))), @@ -3725,6 +3735,10 @@ def : Pat<(i32 (zext (srl_su GR16:$src, (i8 8)))), (MOVZX32rr8 (EXTRACT_SUBREG (COPY_TO_REGCLASS GR16:$src, GR16_ABCD), x86_subreg_8bit_hi))>, Requires<[In32BitMode]>; +def : Pat<(i32 (anyext (srl_su GR16:$src, (i8 8)))), + (MOVZX32rr8 (EXTRACT_SUBREG (COPY_TO_REGCLASS GR16:$src, GR16_ABCD), + x86_subreg_8bit_hi))>, + Requires<[In32BitMode]>; def : Pat<(and (srl_su GR32:$src, (i8 8)), (i32 255)), (MOVZX32rr8 (EXTRACT_SUBREG (COPY_TO_REGCLASS GR32:$src, GR32_ABCD), x86_subreg_8bit_hi))>, diff --git a/libclamav/c++/llvm/lib/Target/X86/X86JITInfo.cpp b/libclamav/c++/llvm/lib/Target/X86/X86JITInfo.cpp index 5c3d10149..d36f87a08 100644 --- a/libclamav/c++/llvm/lib/Target/X86/X86JITInfo.cpp +++ b/libclamav/c++/llvm/lib/Target/X86/X86JITInfo.cpp @@ -23,7 +23,7 @@ using namespace llvm; // Determine the platform we're running on -#if defined (__x86_64__) || defined (_M_AMD64) +#if defined (__x86_64__) || defined (_M_AMD64) || defined (_M_X64) # define X86_64_JIT #elif defined(__i386__) || defined(i386) || defined(_M_IX86) # define X86_32_JIT diff --git a/libclamav/c++/llvm/lib/Target/X86/X86Subtarget.cpp b/libclamav/c++/llvm/lib/Target/X86/X86Subtarget.cpp index 51048a932..730872819 100644 --- a/libclamav/c++/llvm/lib/Target/X86/X86Subtarget.cpp +++ b/libclamav/c++/llvm/lib/Target/X86/X86Subtarget.cpp @@ -160,7 +160,7 @@ unsigned X86Subtarget::getSpecialAddressLatency() const { /// specified arguments. If we can't run cpuid on the host, return true. bool X86::GetCpuIDAndInfo(unsigned value, unsigned *rEAX, unsigned *rEBX, unsigned *rECX, unsigned *rEDX) { -#if defined(__x86_64__) || defined(_M_AMD64) +#if defined(__x86_64__) || defined(_M_AMD64) || defined (_M_X64) #if defined(__GNUC__) // gcc doesn't know cpuid would clobber ebx/rbx. Preseve it manually. asm ("movq\t%%rbx, %%rsi\n\t" diff --git a/libclamav/c++/llvm/lib/Target/X86/X86TargetMachine.cpp b/libclamav/c++/llvm/lib/Target/X86/X86TargetMachine.cpp index 4651f462a..a61de1cd1 100644 --- a/libclamav/c++/llvm/lib/Target/X86/X86TargetMachine.cpp +++ b/libclamav/c++/llvm/lib/Target/X86/X86TargetMachine.cpp @@ -47,6 +47,10 @@ extern "C" void LLVMInitializeX86Target() { // Register the target asm info. RegisterAsmInfoFn A(TheX86_32Target, createMCAsmInfo); RegisterAsmInfoFn B(TheX86_64Target, createMCAsmInfo); + + // Register the code emitter. + TargetRegistry::RegisterCodeEmitter(TheX86_32Target, createX86MCCodeEmitter); + TargetRegistry::RegisterCodeEmitter(TheX86_64Target, createX86MCCodeEmitter); } diff --git a/libclamav/c++/llvm/lib/Target/XCore/CMakeLists.txt b/libclamav/c++/llvm/lib/Target/XCore/CMakeLists.txt index dad4f92d7..0965323b9 100644 --- a/libclamav/c++/llvm/lib/Target/XCore/CMakeLists.txt +++ b/libclamav/c++/llvm/lib/Target/XCore/CMakeLists.txt @@ -16,9 +16,9 @@ add_llvm_target(XCore XCoreInstrInfo.cpp XCoreISelDAGToDAG.cpp XCoreISelLowering.cpp + XCoreMCAsmInfo.cpp XCoreRegisterInfo.cpp XCoreSubtarget.cpp - XCoreMCAsmInfo.cpp XCoreTargetMachine.cpp XCoreTargetObjectFile.cpp ) diff --git a/libclamav/c++/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp b/libclamav/c++/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp index 75843e84d..b1f7f045a 100644 --- a/libclamav/c++/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp +++ b/libclamav/c++/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp @@ -65,7 +65,7 @@ namespace { CallGraphSCCPass::getAnalysisUsage(AU); } - virtual bool runOnSCC(const std::vector &SCC); + virtual bool runOnSCC(std::vector &SCC); static char ID; // Pass identification, replacement for typeid explicit ArgPromotion(unsigned maxElements = 3) : CallGraphSCCPass(&ID), maxElements(maxElements) {} @@ -74,11 +74,11 @@ namespace { typedef std::vector IndicesVector; private: - bool PromoteArguments(CallGraphNode *CGN); + CallGraphNode *PromoteArguments(CallGraphNode *CGN); bool isSafeToPromoteArgument(Argument *Arg, bool isByVal) const; - Function *DoPromotion(Function *F, - SmallPtrSet &ArgsToPromote, - SmallPtrSet &ByValArgsToTransform); + CallGraphNode *DoPromotion(Function *F, + SmallPtrSet &ArgsToPromote, + SmallPtrSet &ByValArgsToTransform); /// The maximum number of elements to expand, or 0 for unlimited. unsigned maxElements; }; @@ -92,14 +92,17 @@ Pass *llvm::createArgumentPromotionPass(unsigned maxElements) { return new ArgPromotion(maxElements); } -bool ArgPromotion::runOnSCC(const std::vector &SCC) { +bool ArgPromotion::runOnSCC(std::vector &SCC) { bool Changed = false, LocalChange; do { // Iterate until we stop promoting from this SCC. LocalChange = false; // Attempt to promote arguments from all functions in this SCC. for (unsigned i = 0, e = SCC.size(); i != e; ++i) - LocalChange |= PromoteArguments(SCC[i]); + if (CallGraphNode *CGN = PromoteArguments(SCC[i])) { + LocalChange = true; + SCC[i] = CGN; + } Changed |= LocalChange; // Remember that we changed something. } while (LocalChange); @@ -111,11 +114,11 @@ bool ArgPromotion::runOnSCC(const std::vector &SCC) { /// example, all callers are direct). If safe to promote some arguments, it /// calls the DoPromotion method. /// -bool ArgPromotion::PromoteArguments(CallGraphNode *CGN) { +CallGraphNode *ArgPromotion::PromoteArguments(CallGraphNode *CGN) { Function *F = CGN->getFunction(); // Make sure that it is local to this module. - if (!F || !F->hasLocalLinkage()) return false; + if (!F || !F->hasLocalLinkage()) return 0; // First check: see if there are any pointer arguments! If not, quick exit. SmallVector, 16> PointerArgs; @@ -124,12 +127,12 @@ bool ArgPromotion::PromoteArguments(CallGraphNode *CGN) { I != E; ++I, ++ArgNo) if (isa(I->getType())) PointerArgs.push_back(std::pair(I, ArgNo)); - if (PointerArgs.empty()) return false; + if (PointerArgs.empty()) return 0; // Second check: make sure that all callers are direct callers. We can't // transform functions that have indirect callers. if (F->hasAddressTaken()) - return false; + return 0; // Check to see which arguments are promotable. If an argument is promotable, // add it to ArgsToPromote. @@ -174,13 +177,10 @@ bool ArgPromotion::PromoteArguments(CallGraphNode *CGN) { } // No promotable pointer arguments. - if (ArgsToPromote.empty() && ByValArgsToTransform.empty()) return false; + if (ArgsToPromote.empty() && ByValArgsToTransform.empty()) + return 0; - Function *NewF = DoPromotion(F, ArgsToPromote, ByValArgsToTransform); - - // Update the call graph to know that the function has been transformed. - getAnalysis().changeFunction(F, NewF); - return true; + return DoPromotion(F, ArgsToPromote, ByValArgsToTransform); } /// IsAlwaysValidPointer - Return true if the specified pointer is always legal @@ -469,8 +469,8 @@ bool ArgPromotion::isSafeToPromoteArgument(Argument *Arg, bool isByVal) const { /// DoPromotion - This method actually performs the promotion of the specified /// arguments, and returns the new function. At this point, we know that it's /// safe to do so. -Function *ArgPromotion::DoPromotion(Function *F, - SmallPtrSet &ArgsToPromote, +CallGraphNode *ArgPromotion::DoPromotion(Function *F, + SmallPtrSet &ArgsToPromote, SmallPtrSet &ByValArgsToTransform) { // Start by computing a new prototype for the function, which is the same as @@ -593,6 +593,10 @@ Function *ArgPromotion::DoPromotion(Function *F, Function *NF = Function::Create(NFTy, F->getLinkage(), F->getName()); NF->copyAttributesFrom(F); + + DEBUG(errs() << "ARG PROMOTION: Promoting to:" << *NF << "\n" + << "From: " << *F); + // Recompute the parameter attributes list based on the new arguments for // the function. NF->setAttributes(AttrListPtr::get(AttributesVec.begin(), AttributesVec.end())); @@ -608,6 +612,10 @@ Function *ArgPromotion::DoPromotion(Function *F, // Get the callgraph information that we need to update to reflect our // changes. CallGraph &CG = getAnalysis(); + + // Get a new callgraph node for NF. + CallGraphNode *NF_CGN = CG.getOrInsertFunction(NF); + // Loop over all of the callers of the function, transforming the call sites // to pass in the loaded pointers. @@ -720,7 +728,7 @@ Function *ArgPromotion::DoPromotion(Function *F, AA.replaceWithNewValue(Call, New); // Update the callgraph to know that the callsite has been transformed. - CG[Call->getParent()->getParent()]->replaceCallSite(Call, New); + CG[Call->getParent()->getParent()]->replaceCallSite(Call, New, NF_CGN); if (!Call->use_empty()) { Call->replaceAllUsesWith(New); @@ -856,7 +864,11 @@ Function *ArgPromotion::DoPromotion(Function *F, // Tell the alias analysis that the old function is about to disappear. AA.replaceWithNewValue(F, NF); + + NF_CGN->stealCalledFunctionsFrom(CG[F]); + // Now that the old function is dead, delete it. - F->eraseFromParent(); - return NF; + delete CG.removeFunctionFromModule(F); + + return NF_CGN; } diff --git a/libclamav/c++/llvm/lib/Transforms/IPO/FunctionAttrs.cpp b/libclamav/c++/llvm/lib/Transforms/IPO/FunctionAttrs.cpp index e8315247b..26b415229 100644 --- a/libclamav/c++/llvm/lib/Transforms/IPO/FunctionAttrs.cpp +++ b/libclamav/c++/llvm/lib/Transforms/IPO/FunctionAttrs.cpp @@ -44,7 +44,7 @@ namespace { FunctionAttrs() : CallGraphSCCPass(&ID) {} // runOnSCC - Analyze the SCC, performing the transformation if possible. - bool runOnSCC(const std::vector &SCC); + bool runOnSCC(std::vector &SCC); // AddReadAttrs - Deduce readonly/readnone attributes for the SCC. bool AddReadAttrs(const std::vector &SCC); @@ -54,7 +54,7 @@ namespace { // IsFunctionMallocLike - Does this function allocate new memory? bool IsFunctionMallocLike(Function *F, - SmallPtrSet &) const; + SmallPtrSet &) const; // AddNoAliasAttrs - Deduce noalias attributes for the SCC. bool AddNoAliasAttrs(const std::vector &SCC); @@ -93,13 +93,12 @@ bool FunctionAttrs::PointsToLocalMemory(Value *V) { /// AddReadAttrs - Deduce readonly/readnone attributes for the SCC. bool FunctionAttrs::AddReadAttrs(const std::vector &SCC) { - SmallPtrSet SCCNodes; - CallGraph &CG = getAnalysis(); + SmallPtrSet SCCNodes; // Fill SCCNodes with the elements of the SCC. Used for quickly // looking up whether a given CallGraphNode is in this SCC. for (unsigned i = 0, e = SCC.size(); i != e; ++i) - SCCNodes.insert(SCC[i]); + SCCNodes.insert(SCC[i]->getFunction()); // Check if any of the functions in the SCC read or write memory. If they // write memory then they can't be marked readnone or readonly. @@ -133,9 +132,9 @@ bool FunctionAttrs::AddReadAttrs(const std::vector &SCC) { // Some instructions can be ignored even if they read or write memory. // Detect these now, skipping to the next instruction if one is found. CallSite CS = CallSite::get(I); - if (CS.getInstruction()) { + if (CS.getInstruction() && CS.getCalledFunction()) { // Ignore calls to functions in the same SCC. - if (SCCNodes.count(CG[CS.getCalledFunction()])) + if (SCCNodes.count(CS.getCalledFunction())) continue; } else if (LoadInst *LI = dyn_cast(I)) { // Ignore loads from local memory. @@ -226,9 +225,7 @@ bool FunctionAttrs::AddNoCaptureAttrs(const std::vector &SCC) { /// IsFunctionMallocLike - A function is malloc-like if it returns either null /// or a pointer that doesn't alias any other pointer visible to the caller. bool FunctionAttrs::IsFunctionMallocLike(Function *F, - SmallPtrSet &SCCNodes) const { - CallGraph &CG = getAnalysis(); - + SmallPtrSet &SCCNodes) const { UniqueVector FlowsToReturn; for (Function::iterator I = F->begin(), E = F->end(); I != E; ++I) if (ReturnInst *Ret = dyn_cast(I->getTerminator())) @@ -275,7 +272,7 @@ bool FunctionAttrs::IsFunctionMallocLike(Function *F, if (CS.paramHasAttr(0, Attribute::NoAlias)) break; if (CS.getCalledFunction() && - SCCNodes.count(CG[CS.getCalledFunction()])) + SCCNodes.count(CS.getCalledFunction())) break; } // fall-through default: @@ -291,12 +288,12 @@ bool FunctionAttrs::IsFunctionMallocLike(Function *F, /// AddNoAliasAttrs - Deduce noalias attributes for the SCC. bool FunctionAttrs::AddNoAliasAttrs(const std::vector &SCC) { - SmallPtrSet SCCNodes; + SmallPtrSet SCCNodes; // Fill SCCNodes with the elements of the SCC. Used for quickly // looking up whether a given CallGraphNode is in this SCC. for (unsigned i = 0, e = SCC.size(); i != e; ++i) - SCCNodes.insert(SCC[i]); + SCCNodes.insert(SCC[i]->getFunction()); // Check each function in turn, determining which functions return noalias // pointers. @@ -339,7 +336,7 @@ bool FunctionAttrs::AddNoAliasAttrs(const std::vector &SCC) { return MadeChange; } -bool FunctionAttrs::runOnSCC(const std::vector &SCC) { +bool FunctionAttrs::runOnSCC(std::vector &SCC) { bool Changed = AddReadAttrs(SCC); Changed |= AddNoCaptureAttrs(SCC); Changed |= AddNoAliasAttrs(SCC); diff --git a/libclamav/c++/llvm/lib/Transforms/IPO/Inliner.cpp b/libclamav/c++/llvm/lib/Transforms/IPO/Inliner.cpp index ba0372b5b..617726515 100644 --- a/libclamav/c++/llvm/lib/Transforms/IPO/Inliner.cpp +++ b/libclamav/c++/llvm/lib/Transforms/IPO/Inliner.cpp @@ -21,19 +21,22 @@ #include "llvm/Support/CallSite.h" #include "llvm/Target/TargetData.h" #include "llvm/Transforms/IPO/InlinerPass.h" +#include "llvm/Transforms/Utils/InlineCost.h" #include "llvm/Transforms/Utils/Cloning.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/Debug.h" #include "llvm/Support/raw_ostream.h" +#include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/Statistic.h" #include using namespace llvm; STATISTIC(NumInlined, "Number of functions inlined"); STATISTIC(NumDeleted, "Number of functions deleted because all callers found"); +STATISTIC(NumMergedAllocas, "Number of allocas merged together"); static cl::opt -InlineLimit("inline-threshold", cl::Hidden, cl::init(200), +InlineLimit("inline-threshold", cl::Hidden, cl::init(200), cl::ZeroOrMore, cl::desc("Control the amount of inlining to perform (default = 200)")); Inliner::Inliner(void *ID) @@ -49,15 +52,29 @@ void Inliner::getAnalysisUsage(AnalysisUsage &Info) const { CallGraphSCCPass::getAnalysisUsage(Info); } -// InlineCallIfPossible - If it is possible to inline the specified call site, -// do so and update the CallGraph for this operation. -bool Inliner::InlineCallIfPossible(CallSite CS, CallGraph &CG, - const SmallPtrSet &SCCFunctions, - const TargetData *TD) { + +typedef DenseMap > +InlinedArrayAllocasTy; + +/// InlineCallIfPossible - If it is possible to inline the specified call site, +/// do so and update the CallGraph for this operation. +/// +/// This function also does some basic book-keeping to update the IR. The +/// InlinedArrayAllocas map keeps track of any allocas that are already +/// available from other functions inlined into the caller. If we are able to +/// inline this call site we attempt to reuse already available allocas or add +/// any new allocas to the set if not possible. +static bool InlineCallIfPossible(CallSite CS, CallGraph &CG, + const TargetData *TD, + InlinedArrayAllocasTy &InlinedArrayAllocas) { Function *Callee = CS.getCalledFunction(); Function *Caller = CS.getCaller(); - if (!InlineFunction(CS, &CG, TD)) return false; + // Try to inline the function. Get the list of static allocas that were + // inlined. + SmallVector StaticAllocas; + if (!InlineFunction(CS, &CG, TD, &StaticAllocas)) + return false; // If the inlined function had a higher stack protection level than the // calling function, then bump up the caller's stack protection level. @@ -67,24 +84,89 @@ bool Inliner::InlineCallIfPossible(CallSite CS, CallGraph &CG, !Caller->hasFnAttr(Attribute::StackProtectReq)) Caller->addFnAttr(Attribute::StackProtect); - // If we inlined the last possible call site to the function, delete the - // function body now. - if (Callee->use_empty() && (Callee->hasLocalLinkage() || - Callee->hasAvailableExternallyLinkage()) && - !SCCFunctions.count(Callee)) { - DEBUG(errs() << " -> Deleting dead function: " - << Callee->getName() << "\n"); - CallGraphNode *CalleeNode = CG[Callee]; + + // Look at all of the allocas that we inlined through this call site. If we + // have already inlined other allocas through other calls into this function, + // then we know that they have disjoint lifetimes and that we can merge them. + // + // There are many heuristics possible for merging these allocas, and the + // different options have different tradeoffs. One thing that we *really* + // don't want to hurt is SRoA: once inlining happens, often allocas are no + // longer address taken and so they can be promoted. + // + // Our "solution" for that is to only merge allocas whose outermost type is an + // array type. These are usually not promoted because someone is using a + // variable index into them. These are also often the most important ones to + // merge. + // + // A better solution would be to have real memory lifetime markers in the IR + // and not have the inliner do any merging of allocas at all. This would + // allow the backend to do proper stack slot coloring of all allocas that + // *actually make it to the backend*, which is really what we want. + // + // Because we don't have this information, we do this simple and useful hack. + // + SmallPtrSet UsedAllocas; + + // Loop over all the allocas we have so far and see if they can be merged with + // a previously inlined alloca. If not, remember that we had it. + for (unsigned AllocaNo = 0, e = StaticAllocas.size(); + AllocaNo != e; ++AllocaNo) { + AllocaInst *AI = StaticAllocas[AllocaNo]; + + // Don't bother trying to merge array allocations (they will usually be + // canonicalized to be an allocation *of* an array), or allocations whose + // type is not itself an array (because we're afraid of pessimizing SRoA). + const ArrayType *ATy = dyn_cast(AI->getAllocatedType()); + if (ATy == 0 || AI->isArrayAllocation()) + continue; + + // Get the list of all available allocas for this array type. + std::vector &AllocasForType = InlinedArrayAllocas[ATy]; + + // Loop over the allocas in AllocasForType to see if we can reuse one. Note + // that we have to be careful not to reuse the same "available" alloca for + // multiple different allocas that we just inlined, we use the 'UsedAllocas' + // set to keep track of which "available" allocas are being used by this + // function. Also, AllocasForType can be empty of course! + bool MergedAwayAlloca = false; + for (unsigned i = 0, e = AllocasForType.size(); i != e; ++i) { + AllocaInst *AvailableAlloca = AllocasForType[i]; + + // The available alloca has to be in the right function, not in some other + // function in this SCC. + if (AvailableAlloca->getParent() != AI->getParent()) + continue; + + // If the inlined function already uses this alloca then we can't reuse + // it. + if (!UsedAllocas.insert(AvailableAlloca)) + continue; + + // Otherwise, we *can* reuse it, RAUW AI into AvailableAlloca and declare + // success! + DEBUG(errs() << " ***MERGED ALLOCA: " << *AI); + + AI->replaceAllUsesWith(AvailableAlloca); + AI->eraseFromParent(); + MergedAwayAlloca = true; + ++NumMergedAllocas; + break; + } - // Remove any call graph edges from the callee to its callees. - CalleeNode->removeAllCalledFunctions(); + // If we already nuked the alloca, we're done with it. + if (MergedAwayAlloca) + continue; - resetCachedCostInfo(CalleeNode->getFunction()); - - // Removing the node for callee from the call graph and delete it. - delete CG.removeFunctionFromModule(CalleeNode); - ++NumDeleted; + // If we were unable to merge away the alloca either because there are no + // allocas of the right type available or because we reused them all + // already, remember that this alloca came from an inlined function and mark + // it used so we don't reuse it for other allocas from this inline + // operation. + AllocasForType.push_back(AI); + UsedAllocas.insert(AI); } + return true; } @@ -92,7 +174,6 @@ bool Inliner::InlineCallIfPossible(CallSite CS, CallGraph &CG, /// at the given CallSite. bool Inliner::shouldInline(CallSite CS) { InlineCost IC = getInlineCost(CS); - float FudgeFactor = getInlineFudgeFactor(CS); if (IC.isAlways()) { DEBUG(errs() << " Inlining: cost=always" @@ -114,18 +195,19 @@ bool Inliner::shouldInline(CallSite CS) { InlineThreshold != 50) CurrentThreshold = 50; + float FudgeFactor = getInlineFudgeFactor(CS); if (Cost >= (int)(CurrentThreshold * FudgeFactor)) { DEBUG(errs() << " NOT Inlining: cost=" << Cost << ", Call: " << *CS.getInstruction() << "\n"); return false; - } else { - DEBUG(errs() << " Inlining: cost=" << Cost - << ", Call: " << *CS.getInstruction() << "\n"); - return true; } + + DEBUG(errs() << " Inlining: cost=" << Cost + << ", Call: " << *CS.getInstruction() << "\n"); + return true; } -bool Inliner::runOnSCC(const std::vector &SCC) { +bool Inliner::runOnSCC(std::vector &SCC) { CallGraph &CG = getAnalysis(); const TargetData *TD = getAnalysisIfAvailable(); @@ -140,18 +222,29 @@ bool Inliner::runOnSCC(const std::vector &SCC) { // Scan through and identify all call sites ahead of time so that we only // inline call sites in the original functions, not call sites that result // from inlining other functions. - std::vector CallSites; + SmallVector CallSites; - for (unsigned i = 0, e = SCC.size(); i != e; ++i) - if (Function *F = SCC[i]->getFunction()) - for (Function::iterator BB = F->begin(), E = F->end(); BB != E; ++BB) - for (BasicBlock::iterator I = BB->begin(); I != BB->end(); ++I) { - CallSite CS = CallSite::get(I); - if (CS.getInstruction() && !isa(I) && - (!CS.getCalledFunction() || - !CS.getCalledFunction()->isDeclaration())) - CallSites.push_back(CS); - } + for (unsigned i = 0, e = SCC.size(); i != e; ++i) { + Function *F = SCC[i]->getFunction(); + if (!F) continue; + + for (Function::iterator BB = F->begin(), E = F->end(); BB != E; ++BB) + for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ++I) { + CallSite CS = CallSite::get(I); + // If this this isn't a call, or it is a call to an intrinsic, it can + // never be inlined. + if (CS.getInstruction() == 0 || isa(I)) + continue; + + // If this is a direct call to an external function, we can never inline + // it. If it is an indirect call, inlining may resolve it to be a + // direct call, so we keep it. + if (CS.getCalledFunction() && CS.getCalledFunction()->isDeclaration()) + continue; + + CallSites.push_back(CS); + } + } DEBUG(errs() << ": " << CallSites.size() << " call sites.\n"); @@ -163,6 +256,9 @@ bool Inliner::runOnSCC(const std::vector &SCC) { if (SCCFunctions.count(F)) std::swap(CallSites[i--], CallSites[--FirstCallInSCC]); + + InlinedArrayAllocasTy InlinedArrayAllocas; + // Now that we have all of the call sites, loop over them and inline them if // it looks profitable to do so. bool Changed = false; @@ -171,51 +267,68 @@ bool Inliner::runOnSCC(const std::vector &SCC) { LocalChange = false; // Iterate over the outer loop because inlining functions can cause indirect // calls to become direct calls. - for (unsigned CSi = 0; CSi != CallSites.size(); ++CSi) - if (Function *Callee = CallSites[CSi].getCalledFunction()) { - // Calls to external functions are never inlinable. - if (Callee->isDeclaration()) { - if (SCC.size() == 1) { - std::swap(CallSites[CSi], CallSites.back()); - CallSites.pop_back(); - } else { - // Keep the 'in SCC / not in SCC' boundary correct. - CallSites.erase(CallSites.begin()+CSi); - } - --CSi; - continue; - } - - // If the policy determines that we should inline this function, - // try to do so. - CallSite CS = CallSites[CSi]; - if (shouldInline(CS)) { - Function *Caller = CS.getCaller(); - // Attempt to inline the function... - if (InlineCallIfPossible(CS, CG, SCCFunctions, TD)) { - // Remove any cached cost info for this caller, as inlining the - // callee has increased the size of the caller (which may be the - // same as the callee). - resetCachedCostInfo(Caller); - - // Remove this call site from the list. If possible, use - // swap/pop_back for efficiency, but do not use it if doing so would - // move a call site to a function in this SCC before the - // 'FirstCallInSCC' barrier. - if (SCC.size() == 1) { - std::swap(CallSites[CSi], CallSites.back()); - CallSites.pop_back(); - } else { - CallSites.erase(CallSites.begin()+CSi); - } - --CSi; - - ++NumInlined; - Changed = true; - LocalChange = true; - } - } + for (unsigned CSi = 0; CSi != CallSites.size(); ++CSi) { + CallSite CS = CallSites[CSi]; + + Function *Callee = CS.getCalledFunction(); + // We can only inline direct calls to non-declarations. + if (Callee == 0 || Callee->isDeclaration()) continue; + + // If the policy determines that we should inline this function, + // try to do so. + if (!shouldInline(CS)) + continue; + + Function *Caller = CS.getCaller(); + // Attempt to inline the function... + if (!InlineCallIfPossible(CS, CG, TD, InlinedArrayAllocas)) + continue; + + // If we inlined the last possible call site to the function, delete the + // function body now. + if (Callee->use_empty() && Callee->hasLocalLinkage() && + // TODO: Can remove if in SCC now. + !SCCFunctions.count(Callee) && + + // The function may be apparently dead, but if there are indirect + // callgraph references to the node, we cannot delete it yet, this + // could invalidate the CGSCC iterator. + CG[Callee]->getNumReferences() == 0) { + DEBUG(errs() << " -> Deleting dead function: " + << Callee->getName() << "\n"); + CallGraphNode *CalleeNode = CG[Callee]; + + // Remove any call graph edges from the callee to its callees. + CalleeNode->removeAllCalledFunctions(); + + resetCachedCostInfo(Callee); + + // Removing the node for callee from the call graph and delete it. + delete CG.removeFunctionFromModule(CalleeNode); + ++NumDeleted; } + + // Remove any cached cost info for this caller, as inlining the + // callee has increased the size of the caller (which may be the + // same as the callee). + resetCachedCostInfo(Caller); + + // Remove this call site from the list. If possible, use + // swap/pop_back for efficiency, but do not use it if doing so would + // move a call site to a function in this SCC before the + // 'FirstCallInSCC' barrier. + if (SCC.size() == 1) { + std::swap(CallSites[CSi], CallSites.back()); + CallSites.pop_back(); + } else { + CallSites.erase(CallSites.begin()+CSi); + } + --CSi; + + ++NumInlined; + Changed = true; + LocalChange = true; + } } while (LocalChange); return Changed; @@ -227,47 +340,55 @@ bool Inliner::doFinalization(CallGraph &CG) { return removeDeadFunctions(CG); } - /// removeDeadFunctions - Remove dead functions that are not included in - /// DNR (Do Not Remove) list. +/// removeDeadFunctions - Remove dead functions that are not included in +/// DNR (Do Not Remove) list. bool Inliner::removeDeadFunctions(CallGraph &CG, - SmallPtrSet *DNR) { - std::set FunctionsToRemove; + SmallPtrSet *DNR) { + SmallPtrSet FunctionsToRemove; // Scan for all of the functions, looking for ones that should now be removed // from the program. Insert the dead ones in the FunctionsToRemove set. for (CallGraph::iterator I = CG.begin(), E = CG.end(); I != E; ++I) { CallGraphNode *CGN = I->second; - if (Function *F = CGN ? CGN->getFunction() : 0) { - // If the only remaining users of the function are dead constants, remove - // them. - F->removeDeadConstantUsers(); + if (CGN->getFunction() == 0) + continue; + + Function *F = CGN->getFunction(); + + // If the only remaining users of the function are dead constants, remove + // them. + F->removeDeadConstantUsers(); - if (DNR && DNR->count(F)) - continue; + if (DNR && DNR->count(F)) + continue; + if (!F->hasLinkOnceLinkage() && !F->hasLocalLinkage() && + !F->hasAvailableExternallyLinkage()) + continue; + if (!F->use_empty()) + continue; + + // Remove any call graph edges from the function to its callees. + CGN->removeAllCalledFunctions(); - if ((F->hasLinkOnceLinkage() || F->hasLocalLinkage()) && - F->use_empty()) { + // Remove any edges from the external node to the function's call graph + // node. These edges might have been made irrelegant due to + // optimization of the program. + CG.getExternalCallingNode()->removeAnyCallEdgeTo(CGN); - // Remove any call graph edges from the function to its callees. - CGN->removeAllCalledFunctions(); - - // Remove any edges from the external node to the function's call graph - // node. These edges might have been made irrelegant due to - // optimization of the program. - CG.getExternalCallingNode()->removeAnyCallEdgeTo(CGN); - - // Removing the node for callee from the call graph and delete it. - FunctionsToRemove.insert(CGN); - } - } + // Removing the node for callee from the call graph and delete it. + FunctionsToRemove.insert(CGN); } // Now that we know which functions to delete, do so. We didn't want to do // this inline, because that would invalidate our CallGraph::iterator // objects. :( + // + // Note that it doesn't matter that we are iterating over a non-stable set + // here to do this, it doesn't matter which order the functions are deleted + // in. bool Changed = false; - for (std::set::iterator I = FunctionsToRemove.begin(), - E = FunctionsToRemove.end(); I != E; ++I) { + for (SmallPtrSet::iterator I = FunctionsToRemove.begin(), + E = FunctionsToRemove.end(); I != E; ++I) { resetCachedCostInfo((*I)->getFunction()); delete CG.removeFunctionFromModule(*I); ++NumDeleted; diff --git a/libclamav/c++/llvm/lib/Transforms/IPO/MergeFunctions.cpp b/libclamav/c++/llvm/lib/Transforms/IPO/MergeFunctions.cpp index f037c4fa2..9c8592e8e 100644 --- a/libclamav/c++/llvm/lib/Transforms/IPO/MergeFunctions.cpp +++ b/libclamav/c++/llvm/lib/Transforms/IPO/MergeFunctions.cpp @@ -188,7 +188,8 @@ static bool isEquivalentOperation(const Instruction *I1, const Instruction *I2) { if (I1->getOpcode() != I2->getOpcode() || I1->getNumOperands() != I2->getNumOperands() || - !isEquivalentType(I1->getType(), I2->getType())) + !isEquivalentType(I1->getType(), I2->getType()) || + !I1->hasSameSubclassOptionalData(I2)) return false; // We have two instructions of identical opcode and #operands. Check to see diff --git a/libclamav/c++/llvm/lib/Transforms/IPO/PruneEH.cpp b/libclamav/c++/llvm/lib/Transforms/IPO/PruneEH.cpp index 5cc43a5fe..d9b867e82 100644 --- a/libclamav/c++/llvm/lib/Transforms/IPO/PruneEH.cpp +++ b/libclamav/c++/llvm/lib/Transforms/IPO/PruneEH.cpp @@ -41,7 +41,7 @@ namespace { PruneEH() : CallGraphSCCPass(&ID) {} // runOnSCC - Analyze the SCC, performing the transformation if possible. - bool runOnSCC(const std::vector &SCC); + bool runOnSCC(std::vector &SCC); bool SimplifyFunction(Function *F); void DeleteBasicBlock(BasicBlock *BB); @@ -55,7 +55,7 @@ X("prune-eh", "Remove unused exception handling info"); Pass *llvm::createPruneEHPass() { return new PruneEH(); } -bool PruneEH::runOnSCC(const std::vector &SCC) { +bool PruneEH::runOnSCC(std::vector &SCC) { SmallPtrSet SCCNodes; CallGraph &CG = getAnalysis(); bool MadeChange = false; @@ -187,7 +187,7 @@ bool PruneEH::SimplifyFunction(Function *F) { UnwindBlock->removePredecessor(II->getParent()); // Fix up the call graph. - CGN->replaceCallSite(II, Call); + CGN->replaceCallSite(II, Call, 0/*keep callee*/); // Insert a branch to the normal destination right before the // invoke. diff --git a/libclamav/c++/llvm/lib/Transforms/IPO/StripSymbols.cpp b/libclamav/c++/llvm/lib/Transforms/IPO/StripSymbols.cpp index 316b0d797..0bd1696f7 100644 --- a/libclamav/c++/llvm/lib/Transforms/IPO/StripSymbols.cpp +++ b/libclamav/c++/llvm/lib/Transforms/IPO/StripSymbols.cpp @@ -203,167 +203,56 @@ static bool StripSymbolNames(Module &M, bool PreserveDbgInfo) { // llvm.dbg.region.end calls, and any globals they point to if now dead. static bool StripDebugInfo(Module &M) { - SmallPtrSet llvmUsedValues; - findUsedValues(M.getGlobalVariable("llvm.used"), llvmUsedValues); - findUsedValues(M.getGlobalVariable("llvm.compiler.used"), llvmUsedValues); - - DebugInfoFinder DbgFinder; - DbgFinder.processModule(M); - - // These anchors use LinkOnce linkage so that the optimizer does not - // remove them accidently. Set InternalLinkage for all these debug - // info anchors. - for (DebugInfoFinder::iterator I = DbgFinder.compile_unit_begin(), - E = DbgFinder.compile_unit_end(); I != E; ++I) - (*I)->setLinkage(GlobalValue::InternalLinkage); - for (DebugInfoFinder::iterator I = DbgFinder.global_variable_begin(), - E = DbgFinder.global_variable_end(); I != E; ++I) - (*I)->setLinkage(GlobalValue::InternalLinkage); - for (DebugInfoFinder::iterator I = DbgFinder.subprogram_begin(), - E = DbgFinder.subprogram_end(); I != E; ++I) - (*I)->setLinkage(GlobalValue::InternalLinkage); - - - // Delete all dbg variables. - for (Module::global_iterator I = M.global_begin(), E = M.global_end(); - I != E; ++I) { - GlobalVariable *GV = dyn_cast(I); - if (!GV) continue; - if (!GV->use_empty() && llvmUsedValues.count(I) == 0) { - if (GV->getName().startswith("llvm.dbg")) { - GV->replaceAllUsesWith(UndefValue::get(GV->getType())); - } - } - } - + // Remove all of the calls to the debugger intrinsics, and remove them from + // the module. Function *FuncStart = M.getFunction("llvm.dbg.func.start"); Function *StopPoint = M.getFunction("llvm.dbg.stoppoint"); Function *RegionStart = M.getFunction("llvm.dbg.region.start"); Function *RegionEnd = M.getFunction("llvm.dbg.region.end"); Function *Declare = M.getFunction("llvm.dbg.declare"); - std::vector DeadConstants; - - // Remove all of the calls to the debugger intrinsics, and remove them from - // the module. if (FuncStart) { while (!FuncStart->use_empty()) { CallInst *CI = cast(FuncStart->use_back()); - Value *Arg = CI->getOperand(1); - assert(CI->use_empty() && "llvm.dbg intrinsic should have void result"); CI->eraseFromParent(); - if (Arg->use_empty()) - if (Constant *C = dyn_cast(Arg)) - DeadConstants.push_back(C); } FuncStart->eraseFromParent(); } if (StopPoint) { while (!StopPoint->use_empty()) { CallInst *CI = cast(StopPoint->use_back()); - Value *Arg = CI->getOperand(3); - assert(CI->use_empty() && "llvm.dbg intrinsic should have void result"); CI->eraseFromParent(); - if (Arg->use_empty()) - if (Constant *C = dyn_cast(Arg)) - DeadConstants.push_back(C); } StopPoint->eraseFromParent(); } if (RegionStart) { while (!RegionStart->use_empty()) { CallInst *CI = cast(RegionStart->use_back()); - Value *Arg = CI->getOperand(1); - assert(CI->use_empty() && "llvm.dbg intrinsic should have void result"); CI->eraseFromParent(); - if (Arg->use_empty()) - if (Constant *C = dyn_cast(Arg)) - DeadConstants.push_back(C); } RegionStart->eraseFromParent(); } if (RegionEnd) { while (!RegionEnd->use_empty()) { CallInst *CI = cast(RegionEnd->use_back()); - Value *Arg = CI->getOperand(1); - assert(CI->use_empty() && "llvm.dbg intrinsic should have void result"); CI->eraseFromParent(); - if (Arg->use_empty()) - if (Constant *C = dyn_cast(Arg)) - DeadConstants.push_back(C); } RegionEnd->eraseFromParent(); } if (Declare) { while (!Declare->use_empty()) { CallInst *CI = cast(Declare->use_back()); - Value *Arg1 = CI->getOperand(1); - Value *Arg2 = CI->getOperand(2); - assert(CI->use_empty() && "llvm.dbg intrinsic should have void result"); CI->eraseFromParent(); - if (Arg1->use_empty()) { - if (Constant *C = dyn_cast(Arg1)) - DeadConstants.push_back(C); - else - RecursivelyDeleteTriviallyDeadInstructions(Arg1); - } - if (Arg2->use_empty()) - if (Constant *C = dyn_cast(Arg2)) - DeadConstants.push_back(C); } Declare->eraseFromParent(); } - // llvm.dbg.compile_units and llvm.dbg.subprograms are marked as linkonce - // but since we are removing all debug information, make them internal now. - // FIXME: Use private linkage maybe? - if (Constant *C = M.getNamedGlobal("llvm.dbg.compile_units")) - if (GlobalVariable *GV = dyn_cast(C)) - GV->setLinkage(GlobalValue::InternalLinkage); + NamedMDNode *NMD = M.getNamedMetadata("llvm.dbg.gv"); + if (NMD) + NMD->eraseFromParent(); - if (Constant *C = M.getNamedGlobal("llvm.dbg.subprograms")) - if (GlobalVariable *GV = dyn_cast(C)) - GV->setLinkage(GlobalValue::InternalLinkage); - - if (Constant *C = M.getNamedGlobal("llvm.dbg.global_variables")) - if (GlobalVariable *GV = dyn_cast(C)) - GV->setLinkage(GlobalValue::InternalLinkage); - - // Delete all dbg variables. - for (Module::global_iterator I = M.global_begin(), E = M.global_end(); - I != E; ++I) { - GlobalVariable *GV = dyn_cast(I); - if (!GV) continue; - if (GV->use_empty() && llvmUsedValues.count(I) == 0 - && (!GV->hasSection() - || strcmp(GV->getSection().c_str(), "llvm.metadata") == 0)) - DeadConstants.push_back(GV); - } - - if (DeadConstants.empty()) - return false; - - // Delete any internal globals that were only used by the debugger intrinsics. - while (!DeadConstants.empty()) { - Constant *C = DeadConstants.back(); - DeadConstants.pop_back(); - if (GlobalVariable *GV = dyn_cast(C)) { - if (GV->hasLocalLinkage()) - RemoveDeadConstant(GV); - } - else - RemoveDeadConstant(C); - } - - // Remove all llvm.dbg types. - TypeSymbolTable &ST = M.getTypeSymbolTable(); - for (TypeSymbolTable::iterator TI = ST.begin(), TE = ST.end(); TI != TE; ) { - if (!strncmp(TI->first.c_str(), "llvm.dbg.", 9)) - ST.remove(TI++); - else - ++TI; - } - + // Remove dead metadata. + M.getContext().RemoveDeadMetadata(); return true; } diff --git a/libclamav/c++/llvm/lib/Transforms/IPO/StructRetPromotion.cpp b/libclamav/c++/llvm/lib/Transforms/IPO/StructRetPromotion.cpp index e28fc42ed..4c4c6d682 100644 --- a/libclamav/c++/llvm/lib/Transforms/IPO/StructRetPromotion.cpp +++ b/libclamav/c++/llvm/lib/Transforms/IPO/StructRetPromotion.cpp @@ -49,15 +49,15 @@ namespace { CallGraphSCCPass::getAnalysisUsage(AU); } - virtual bool runOnSCC(const std::vector &SCC); + virtual bool runOnSCC(std::vector &SCC); static char ID; // Pass identification, replacement for typeid SRETPromotion() : CallGraphSCCPass(&ID) {} private: - bool PromoteReturn(CallGraphNode *CGN); + CallGraphNode *PromoteReturn(CallGraphNode *CGN); bool isSafeToUpdateAllCallers(Function *F); Function *cloneFunctionBody(Function *F, const StructType *STy); - void updateCallSites(Function *F, Function *NF); + CallGraphNode *updateCallSites(Function *F, Function *NF); bool nestedStructType(const StructType *STy); }; } @@ -70,44 +70,47 @@ Pass *llvm::createStructRetPromotionPass() { return new SRETPromotion(); } -bool SRETPromotion::runOnSCC(const std::vector &SCC) { +bool SRETPromotion::runOnSCC(std::vector &SCC) { bool Changed = false; for (unsigned i = 0, e = SCC.size(); i != e; ++i) - Changed |= PromoteReturn(SCC[i]); + if (CallGraphNode *NewNode = PromoteReturn(SCC[i])) { + SCC[i] = NewNode; + Changed = true; + } return Changed; } /// PromoteReturn - This method promotes function that uses StructRet paramater -/// into a function that uses mulitple return value. -bool SRETPromotion::PromoteReturn(CallGraphNode *CGN) { +/// into a function that uses multiple return values. +CallGraphNode *SRETPromotion::PromoteReturn(CallGraphNode *CGN) { Function *F = CGN->getFunction(); if (!F || F->isDeclaration() || !F->hasLocalLinkage()) - return false; + return 0; // Make sure that function returns struct. if (F->arg_size() == 0 || !F->hasStructRetAttr() || F->doesNotReturn()) - return false; + return 0; DEBUG(errs() << "SretPromotion: Looking at sret function " << F->getName() << "\n"); - assert (F->getReturnType() == Type::getVoidTy(F->getContext()) && - "Invalid function return type"); + assert(F->getReturnType() == Type::getVoidTy(F->getContext()) && + "Invalid function return type"); Function::arg_iterator AI = F->arg_begin(); const llvm::PointerType *FArgType = dyn_cast(AI->getType()); - assert (FArgType && "Invalid sret parameter type"); + assert(FArgType && "Invalid sret parameter type"); const llvm::StructType *STy = dyn_cast(FArgType->getElementType()); - assert (STy && "Invalid sret parameter element type"); + assert(STy && "Invalid sret parameter element type"); // Check if it is ok to perform this promotion. if (isSafeToUpdateAllCallers(F) == false) { DEBUG(errs() << "SretPromotion: Not all callers can be updated\n"); NumRejectedSRETUses++; - return false; + return 0; } DEBUG(errs() << "SretPromotion: sret argument will be promoted\n"); @@ -135,11 +138,13 @@ bool SRETPromotion::PromoteReturn(CallGraphNode *CGN) { Function *NF = cloneFunctionBody(F, STy); // [4] Update all call sites to use new function - updateCallSites(F, NF); + CallGraphNode *NF_CFN = updateCallSites(F, NF); - F->eraseFromParent(); - getAnalysis().changeFunction(F, NF); - return true; + CallGraph &CG = getAnalysis(); + NF_CFN->stealCalledFunctionsFrom(CG[F]); + + delete CG.removeFunctionFromModule(F); + return NF_CFN; } // Check if it is ok to perform this promotion. @@ -247,23 +252,26 @@ Function *SRETPromotion::cloneFunctionBody(Function *F, Function::arg_iterator NI = NF->arg_begin(); ++I; while (I != E) { - I->replaceAllUsesWith(NI); - NI->takeName(I); - ++I; - ++NI; + I->replaceAllUsesWith(NI); + NI->takeName(I); + ++I; + ++NI; } return NF; } /// updateCallSites - Update all sites that call F to use NF. -void SRETPromotion::updateCallSites(Function *F, Function *NF) { +CallGraphNode *SRETPromotion::updateCallSites(Function *F, Function *NF) { CallGraph &CG = getAnalysis(); SmallVector Args; // Attributes - Keep track of the parameter attributes for the arguments. SmallVector ArgAttrsVec; + // Get a new callgraph node for NF. + CallGraphNode *NF_CGN = CG.getOrInsertFunction(NF); + while (!F->use_empty()) { CallSite CS = CallSite::get(*F->use_begin()); Instruction *Call = CS.getInstruction(); @@ -313,7 +321,7 @@ void SRETPromotion::updateCallSites(Function *F, Function *NF) { New->takeName(Call); // Update the callgraph to know that the callsite has been transformed. - CG[Call->getParent()->getParent()]->replaceCallSite(Call, New); + CG[Call->getParent()->getParent()]->replaceCallSite(Call, New, NF_CGN); // Update all users of sret parameter to extract value using extractvalue. for (Value::use_iterator UI = FirstCArg->use_begin(), @@ -322,7 +330,8 @@ void SRETPromotion::updateCallSites(Function *F, Function *NF) { CallInst *C2 = dyn_cast(U2); if (C2 && (C2 == Call)) continue; - else if (GetElementPtrInst *UGEP = dyn_cast(U2)) { + + if (GetElementPtrInst *UGEP = dyn_cast(U2)) { ConstantInt *Idx = dyn_cast(UGEP->getOperand(2)); assert (Idx && "Unexpected getelementptr index!"); Value *GR = ExtractValueInst::Create(New, Idx->getZExtValue(), @@ -335,11 +344,15 @@ void SRETPromotion::updateCallSites(Function *F, Function *NF) { L->eraseFromParent(); } UGEP->eraseFromParent(); + continue; } - else assert( 0 && "Unexpected sret parameter use"); + + assert(0 && "Unexpected sret parameter use"); } Call->eraseFromParent(); } + + return NF_CGN; } /// nestedStructType - Return true if STy includes any diff --git a/libclamav/c++/llvm/lib/Transforms/Instrumentation/MaximumSpanningTree.cpp b/libclamav/c++/llvm/lib/Transforms/Instrumentation/MaximumSpanningTree.cpp new file mode 100644 index 000000000..80f1a15d6 --- /dev/null +++ b/libclamav/c++/llvm/lib/Transforms/Instrumentation/MaximumSpanningTree.cpp @@ -0,0 +1,121 @@ +//===- MaximumSpanningTree.cpp - LLVM Pass to estimate profile info -------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This module privides means for calculating a maximum spanning tree for the +// CFG of a function according to a given profile. The tree does not contain +// leaf edges, since they are needed for optimal edge profiling. +// +//===----------------------------------------------------------------------===// +#define DEBUG_TYPE "maximum-spanning-tree" +#include "MaximumSpanningTree.h" +#include "llvm/Pass.h" +#include "llvm/Analysis/Passes.h" +#include "llvm/ADT/EquivalenceClasses.h" +#include "llvm/Support/Compiler.h" +#include "llvm/Support/CFG.h" +#include "llvm/Support/Debug.h" +#include "llvm/Support/Format.h" +using namespace llvm; + +namespace { + // compare two weighted edges + struct VISIBILITY_HIDDEN EdgeWeightCompare { + bool operator()(const ProfileInfo::EdgeWeight X, + const ProfileInfo::EdgeWeight Y) const { + if (X.second > Y.second) return true; + if (X.second < Y.second) return false; +#ifndef NDEBUG + if (X.first.first != 0 && Y.first.first == 0) return true; + if (X.first.first == 0 && Y.first.first != 0) return false; + if (X.first.first == 0 && Y.first.first == 0) return false; + + if (X.first.first->size() > Y.first.first->size()) return true; + if (X.first.first->size() < Y.first.first->size()) return false; + + if (X.first.second != 0 && Y.first.second == 0) return true; + if (X.first.second == 0 && Y.first.second != 0) return false; + if (X.first.second == 0 && Y.first.second == 0) return false; + + if (X.first.second->size() > Y.first.second->size()) return true; + if (X.first.second->size() < Y.first.second->size()) return false; +#endif + return false; + } + }; +} + +static void inline printMSTEdge(ProfileInfo::EdgeWeight E, + const char *M) { + DEBUG(errs() << "--Edge " << E.first + <<" (Weight "<< format("%g",E.second) << ") " + << (M) << "\n"); +} + +// MaximumSpanningTree() - Takes a function and returns a spanning tree +// according to the currently active profiling information, the leaf edges are +// NOT in the MST. MaximumSpanningTree uses the algorithm of Kruskal. +MaximumSpanningTree::MaximumSpanningTree(Function *F, ProfileInfo *PI, + bool inverted = false) { + + // Copy edges to vector, sort them biggest first. + ProfileInfo::EdgeWeights ECs = PI->getEdgeWeights(F); + std::vector EdgeVector(ECs.begin(), ECs.end()); + std::sort(EdgeVector.begin(), EdgeVector.end(), EdgeWeightCompare()); + + // Create spanning tree, Forest contains a special data structure + // that makes checking if two nodes are already in a common (sub-)tree + // fast and cheap. + EquivalenceClasses Forest; + for (std::vector::iterator bbi = EdgeVector.begin(), + bbe = EdgeVector.end(); bbi != bbe; ++bbi) { + Forest.insert(bbi->first.first); + Forest.insert(bbi->first.second); + } + Forest.insert(0); + + // Iterate over the sorted edges, biggest first. + for (std::vector::iterator bbi = EdgeVector.begin(), + bbe = EdgeVector.end(); bbi != bbe; ++bbi) { + ProfileInfo::Edge e = (*bbi).first; + + if (Forest.findLeader(e.first) != Forest.findLeader(e.second)) { + Forest.unionSets(e.first, e.second); + // So we know now that the edge is not already in a subtree (and not + // (0,entry)), so we push the edge to the MST if it has some successors. + if (!inverted) { MST.push_back(e); } + printMSTEdge(*bbi,"in MST"); + } else { + // This edge is either (0,entry) or (BB,0) or would create a circle in a + // subtree. + if (inverted) { MST.push_back(e); } + printMSTEdge(*bbi,"*not* in MST"); + } + } + + // Sort the MST edges. + std::stable_sort(MST.begin(),MST.end()); +} + +MaximumSpanningTree::MaxSpanTree::iterator MaximumSpanningTree::begin() { + return MST.begin(); +} + +MaximumSpanningTree::MaxSpanTree::iterator MaximumSpanningTree::end() { + return MST.end(); +} + +void MaximumSpanningTree::dump() { + errs()<<"{"; + for ( MaxSpanTree::iterator ei = MST.begin(), ee = MST.end(); + ei!=ee; ++ei ) { + errs()<<"("<<((*ei).first?(*ei).first->getNameStr():"0")<<","; + errs()<<(*ei).second->getNameStr()<<")"; + } + errs()<<"}\n"; +} diff --git a/libclamav/c++/llvm/lib/Transforms/Instrumentation/MaximumSpanningTree.h b/libclamav/c++/llvm/lib/Transforms/Instrumentation/MaximumSpanningTree.h new file mode 100644 index 000000000..5ef8659fe --- /dev/null +++ b/libclamav/c++/llvm/lib/Transforms/Instrumentation/MaximumSpanningTree.h @@ -0,0 +1,51 @@ +//===- llvm/Analysis/MaximumSpanningTree.h - Interface ----------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This module privides means for calculating a maximum spanning tree for the +// CFG of a function according to a given profile. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_ANALYSIS_MAXIMUMSPANNINGTREE_H +#define LLVM_ANALYSIS_MAXIMUMSPANNINGTREE_H + +#include "llvm/Analysis/ProfileInfo.h" +#include "llvm/Support/raw_ostream.h" +#include + +namespace llvm { + class Function; + + class MaximumSpanningTree { + public: + typedef std::vector MaxSpanTree; + + protected: + MaxSpanTree MST; + + public: + static char ID; // Class identification, replacement for typeinfo + + // MaxSpanTree() - Calculates a MST for a function according to a profile. + // If inverted is true, all the edges *not* in the MST are returned. As a + // special also all leaf edges of the MST are not included, this makes it + // easier for the OptimalEdgeProfileInstrumentation to use this MST to do + // an optimal profiling. + MaximumSpanningTree(Function *F, ProfileInfo *PI, bool invert); + virtual ~MaximumSpanningTree() {} + + virtual MaxSpanTree::iterator begin(); + virtual MaxSpanTree::iterator end(); + + virtual void dump(); + }; + +} // End llvm namespace + +#endif diff --git a/libclamav/c++/llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp b/libclamav/c++/llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp index db6d819b0..566abd869 100644 --- a/libclamav/c++/llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp +++ b/libclamav/c++/llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp @@ -519,7 +519,7 @@ static bool OptimizeCmpExpression(CmpInst *CI) { BasicBlock::iterator InsertPt = UserBB->getFirstNonPHI(); InsertedCmp = - CmpInst::Create(DefBB->getContext(), CI->getOpcode(), + CmpInst::Create(CI->getOpcode(), CI->getPredicate(), CI->getOperand(0), CI->getOperand(1), "", InsertPt); MadeChange = true; diff --git a/libclamav/c++/llvm/lib/Transforms/Scalar/GVN.cpp b/libclamav/c++/llvm/lib/Transforms/Scalar/GVN.cpp index c782f7da7..a667a98d1 100644 --- a/libclamav/c++/llvm/lib/Transforms/Scalar/GVN.cpp +++ b/libclamav/c++/llvm/lib/Transforms/Scalar/GVN.cpp @@ -730,10 +730,8 @@ namespace { void dump(DenseMap& d); bool iterateOnFunction(Function &F); Value* CollapsePhi(PHINode* p); - bool isSafeReplacement(PHINode* p, Instruction* inst); bool performPRE(Function& F); Value* lookupNumber(BasicBlock* BB, uint32_t num); - bool mergeBlockIntoPredecessor(BasicBlock* BB); Value* AttemptRedundancyElimination(Instruction* orig, unsigned valno); void cleanupGlobalSets(); void verifyRemoved(const Instruction *I) const; @@ -758,6 +756,19 @@ void GVN::dump(DenseMap& d) { printf("}\n"); } +static bool isSafeReplacement(PHINode* p, Instruction* inst) { + if (!isa(inst)) + return true; + + for (Instruction::use_iterator UI = p->use_begin(), E = p->use_end(); + UI != E; ++UI) + if (PHINode* use_phi = dyn_cast(UI)) + if (use_phi->getParent() == inst->getParent()) + return false; + + return true; +} + Value* GVN::CollapsePhi(PHINode* p) { Value* constVal = p->hasConstantValue(); if (!constVal) return 0; @@ -772,19 +783,6 @@ Value* GVN::CollapsePhi(PHINode* p) { return 0; } -bool GVN::isSafeReplacement(PHINode* p, Instruction* inst) { - if (!isa(inst)) - return true; - - for (Instruction::use_iterator UI = p->use_begin(), E = p->use_end(); - UI != E; ++UI) - if (PHINode* use_phi = dyn_cast(UI)) - if (use_phi->getParent() == inst->getParent()) - return false; - - return true; -} - /// GetValueForBlock - Get the value to use within the specified basic block. /// available values are in Phis. Value *GVN::GetValueForBlock(BasicBlock *BB, Instruction* orig, diff --git a/libclamav/c++/llvm/lib/Transforms/Scalar/GVNPRE.cpp b/libclamav/c++/llvm/lib/Transforms/Scalar/GVNPRE.cpp index b577fa71f..b6296f72f 100644 --- a/libclamav/c++/llvm/lib/Transforms/Scalar/GVNPRE.cpp +++ b/libclamav/c++/llvm/lib/Transforms/Scalar/GVNPRE.cpp @@ -800,8 +800,6 @@ void GVNPRE::val_replace(ValueNumberedSet& s, Value* v) { Value* GVNPRE::phi_translate(Value* V, BasicBlock* pred, BasicBlock* succ) { if (V == 0) return 0; - - LLVMContext &Context = V->getContext(); // Unary Operations if (CastInst* U = dyn_cast(V)) { @@ -864,7 +862,7 @@ Value* GVNPRE::phi_translate(Value* V, BasicBlock* pred, BasicBlock* succ) { newOp1, newOp2, BO->getName()+".expr"); else if (CmpInst* C = dyn_cast(U)) - newVal = CmpInst::Create(Context, C->getOpcode(), + newVal = CmpInst::Create(C->getOpcode(), C->getPredicate(), newOp1, newOp2, C->getName()+".expr"); @@ -1597,7 +1595,6 @@ void GVNPRE::buildsets(Function& F) { void GVNPRE::insertion_pre(Value* e, BasicBlock* BB, DenseMap& avail, std::map& new_sets) { - LLVMContext &Context = e->getContext(); for (pred_iterator PI = pred_begin(BB), PE = pred_end(BB); PI != PE; ++PI) { Value* e2 = avail[*PI]; if (!availableOut[*PI].test(VN.lookup(e2))) { @@ -1684,7 +1681,7 @@ void GVNPRE::insertion_pre(Value* e, BasicBlock* BB, BO->getName()+".gvnpre", (*PI)->getTerminator()); else if (CmpInst* C = dyn_cast(U)) - newVal = CmpInst::Create(Context, C->getOpcode(), + newVal = CmpInst::Create(C->getOpcode(), C->getPredicate(), s1, s2, C->getName()+".gvnpre", (*PI)->getTerminator()); diff --git a/libclamav/c++/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp b/libclamav/c++/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp index 790a4fc51..ceca45220 100644 --- a/libclamav/c++/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp +++ b/libclamav/c++/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp @@ -553,6 +553,11 @@ void IndVarSimplify::SinkUnusedInvariants(Loop *L) { // dominates the exit block. if (I->mayHaveSideEffects() || I->mayReadFromMemory()) continue; + // Don't sink static AllocaInsts out of the entry block, which would + // turn them into dynamic allocas! + if (AllocaInst *AI = dyn_cast(I)) + if (AI->isStaticAlloca()) + continue; // Determine if there is a use in or before the loop (direct or // otherwise). bool UsedInLoop = false; diff --git a/libclamav/c++/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/libclamav/c++/llvm/lib/Transforms/Scalar/InstructionCombining.cpp index 6dd2641ad..b4bb0a849 100644 --- a/libclamav/c++/llvm/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/libclamav/c++/llvm/lib/Transforms/Scalar/InstructionCombining.cpp @@ -52,6 +52,7 @@ #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/GetElementPtrTypeIterator.h" #include "llvm/Support/InstVisitor.h" +#include "llvm/Support/IRBuilder.h" #include "llvm/Support/MathExtras.h" #include "llvm/Support/PatternMatch.h" #include "llvm/Support/Compiler.h" @@ -63,7 +64,6 @@ #include "llvm/ADT/STLExtras.h" #include #include -#include using namespace llvm; using namespace llvm::PatternMatch; @@ -74,30 +74,33 @@ STATISTIC(NumDeadStore, "Number of dead stores eliminated"); STATISTIC(NumSunkInst , "Number of instructions sunk"); namespace { - class VISIBILITY_HIDDEN InstCombiner - : public FunctionPass, - public InstVisitor { - // Worklist of all of the instructions that need to be simplified. + /// InstCombineWorklist - This is the worklist management logic for + /// InstCombine. + class InstCombineWorklist { SmallVector Worklist; DenseMap WorklistMap; - TargetData *TD; - bool MustPreserveLCSSA; + + void operator=(const InstCombineWorklist&RHS); // DO NOT IMPLEMENT + InstCombineWorklist(const InstCombineWorklist&); // DO NOT IMPLEMENT public: - static char ID; // Pass identification, replacement for typeid - InstCombiner() : FunctionPass(&ID) {} - - LLVMContext *Context; - LLVMContext *getContext() const { return Context; } - - /// AddToWorkList - Add the specified instruction to the worklist if it - /// isn't already in it. - void AddToWorkList(Instruction *I) { + InstCombineWorklist() {} + + bool isEmpty() const { return Worklist.empty(); } + + /// Add - Add the specified instruction to the worklist if it isn't already + /// in it. + void Add(Instruction *I) { if (WorklistMap.insert(std::make_pair(I, Worklist.size())).second) Worklist.push_back(I); } - // RemoveFromWorkList - remove I from the worklist if it exists. - void RemoveFromWorkList(Instruction *I) { + void AddValue(Value *V) { + if (Instruction *I = dyn_cast(V)) + Add(I); + } + + // Remove - remove I from the worklist if it exists. + void Remove(Instruction *I) { DenseMap::iterator It = WorklistMap.find(I); if (It == WorklistMap.end()) return; // Not in worklist. @@ -107,51 +110,75 @@ namespace { WorklistMap.erase(It); } - Instruction *RemoveOneFromWorkList() { + Instruction *RemoveOne() { Instruction *I = Worklist.back(); Worklist.pop_back(); WorklistMap.erase(I); return I; } - /// AddUsersToWorkList - When an instruction is simplified, add all users of /// the instruction to the work lists because they might get more simplified /// now. /// - void AddUsersToWorkList(Value &I) { + void AddUsersToWorkList(Instruction &I) { for (Value::use_iterator UI = I.use_begin(), UE = I.use_end(); UI != UE; ++UI) - AddToWorkList(cast(*UI)); - } - - /// AddUsesToWorkList - When an instruction is simplified, add operands to - /// the work lists because they might get more simplified now. - /// - void AddUsesToWorkList(Instruction &I) { - for (User::op_iterator i = I.op_begin(), e = I.op_end(); i != e; ++i) - if (Instruction *Op = dyn_cast(*i)) - AddToWorkList(Op); + Add(cast(*UI)); } - /// AddSoonDeadInstToWorklist - The specified instruction is about to become - /// dead. Add all of its operands to the worklist, turning them into - /// undef's to reduce the number of uses of those instructions. - /// - /// Return the specified operand before it is turned into an undef. - /// - Value *AddSoonDeadInstToWorklist(Instruction &I, unsigned op) { - Value *R = I.getOperand(op); + + /// Zap - check that the worklist is empty and nuke the backing store for + /// the map if it is large. + void Zap() { + assert(WorklistMap.empty() && "Worklist empty, but map not?"); - for (User::op_iterator i = I.op_begin(), e = I.op_end(); i != e; ++i) - if (Instruction *Op = dyn_cast(*i)) { - AddToWorkList(Op); - // Set the operand to undef to drop the use. - *i = UndefValue::get(Op->getType()); - } - - return R; + // Do an explicit clear, this shrinks the map if needed. + WorklistMap.clear(); } + }; +} // end anonymous namespace. + + +namespace { + /// InstCombineIRInserter - This is an IRBuilder insertion helper that works + /// just like the normal insertion helper, but also adds any new instructions + /// to the instcombine worklist. + class InstCombineIRInserter : public IRBuilderDefaultInserter { + InstCombineWorklist &Worklist; + public: + InstCombineIRInserter(InstCombineWorklist &WL) : Worklist(WL) {} + + void InsertHelper(Instruction *I, const Twine &Name, + BasicBlock *BB, BasicBlock::iterator InsertPt) const { + IRBuilderDefaultInserter::InsertHelper(I, Name, BB, InsertPt); + Worklist.Add(I); + } + }; +} // end anonymous namespace + + +namespace { + class VISIBILITY_HIDDEN InstCombiner + : public FunctionPass, + public InstVisitor { + TargetData *TD; + bool MustPreserveLCSSA; + bool MadeIRChange; + public: + /// Worklist - All of the instructions that need to be simplified. + InstCombineWorklist Worklist; + + /// Builder - This is an IRBuilder that automatically inserts new + /// instructions into the worklist when they are created. + typedef IRBuilder BuilderTy; + BuilderTy *Builder; + + static char ID; // Pass identification, replacement for typeid + InstCombiner() : FunctionPass(&ID), TD(0), Builder(0) {} + + LLVMContext *Context; + LLVMContext *getContext() const { return Context; } public: virtual bool runOnFunction(Function &F); @@ -274,30 +301,10 @@ namespace { "New instruction already inserted into a basic block!"); BasicBlock *BB = Old.getParent(); BB->getInstList().insert(&Old, New); // Insert inst - AddToWorkList(New); + Worklist.Add(New); return New; } - - /// InsertCastBefore - Insert a cast of V to TY before the instruction POS. - /// This also adds the cast to the worklist. Finally, this returns the - /// cast. - Value *InsertCastBefore(Instruction::CastOps opc, Value *V, const Type *Ty, - Instruction &Pos) { - if (V->getType() == Ty) return V; - - if (Constant *CV = dyn_cast(V)) - return ConstantExpr::getCast(opc, CV, Ty); - - Instruction *C = CastInst::Create(opc, V, Ty, V->getName(), &Pos); - AddToWorkList(C); - return C; - } - Value *InsertBitCastBefore(Value *V, const Type *Ty, Instruction &Pos) { - return InsertCastBefore(Instruction::BitCast, V, Ty, Pos); - } - - // ReplaceInstUsesWith - This method is to be used when an instruction is // found to be dead, replacable with another preexisting expression. Here // we add all uses of I to the worklist, replace all uses of I with the new @@ -305,16 +312,15 @@ namespace { // modified. // Instruction *ReplaceInstUsesWith(Instruction &I, Value *V) { - AddUsersToWorkList(I); // Add all modified instrs to worklist - if (&I != V) { - I.replaceAllUsesWith(V); - return &I; - } else { - // If we are replacing the instruction with itself, this must be in a - // segment of unreachable code, so just clobber the instruction. - I.replaceAllUsesWith(UndefValue::get(I.getType())); - return &I; - } + Worklist.AddUsersToWorkList(I); // Add all modified instrs to worklist. + + // If we are replacing the instruction with itself, this must be in a + // segment of unreachable code, so just clobber the instruction. + if (&I == V) + V = UndefValue::get(I.getType()); + + I.replaceAllUsesWith(V); + return &I; } // EraseInstFromFunction - When dealing with an instruction that has side @@ -322,10 +328,19 @@ namespace { // instruction. Instead, visit methods should return the value returned by // this function. Instruction *EraseInstFromFunction(Instruction &I) { + DEBUG(errs() << "IC: erase " << I); + assert(I.use_empty() && "Cannot erase instruction that is used!"); - AddUsesToWorkList(I); - RemoveFromWorkList(&I); + // Make sure that we reprocess all operands now that we reduced their + // use counts. + if (I.getNumOperands() < 8) { + for (User::op_iterator i = I.op_begin(), e = I.op_end(); i != e; ++i) + if (Instruction *Op = dyn_cast(*i)) + Worklist.Add(Op); + } + Worklist.Remove(&I); I.eraseFromParent(); + MadeIRChange = true; return 0; // Don't do anything with FI } @@ -404,7 +419,7 @@ namespace { unsigned PrefAlign = 0); }; -} +} // end anonymous namespace char InstCombiner::ID = 0; static RegisterPass @@ -412,7 +427,7 @@ X("instcombine", "Combine redundant instructions"); // getComplexity: Assign a complexity or rank value to LLVM Values... // 0 -> undef, 1 -> Const, 2 -> Other, 3 -> Arg, 3 -> Unary, 4 -> OtherInst -static unsigned getComplexity(LLVMContext *Context, Value *V) { +static unsigned getComplexity(Value *V) { if (isa(V)) { if (BinaryOperator::isNeg(V) || BinaryOperator::isFNeg(V) || @@ -512,8 +527,7 @@ static bool ValueRequiresCast(Instruction::CastOps opcode, const Value *V, // bool InstCombiner::SimplifyCommutative(BinaryOperator &I) { bool Changed = false; - if (getComplexity(Context, I.getOperand(0)) < - getComplexity(Context, I.getOperand(1))) + if (getComplexity(I.getOperand(0)) < getComplexity(I.getOperand(1))) Changed = !I.swapOperands(); if (!I.isAssociative()) return Changed; @@ -538,7 +552,7 @@ bool InstCombiner::SimplifyCommutative(BinaryOperator &I) { Instruction *New = BinaryOperator::Create(Opcode, Op->getOperand(0), Op1->getOperand(0), Op1->getName(), &I); - AddToWorkList(New); + Worklist.Add(New); I.setOperand(0, New); I.setOperand(1, Folded); return true; @@ -551,8 +565,7 @@ bool InstCombiner::SimplifyCommutative(BinaryOperator &I) { /// so that theyare listed from right (least complex) to left (most complex). /// This puts constants before unary operators before binary operators. bool InstCombiner::SimplifyCompare(CmpInst &I) { - if (getComplexity(Context, I.getOperand(0)) >= - getComplexity(Context, I.getOperand(1))) + if (getComplexity(I.getOperand(0)) >= getComplexity(I.getOperand(1))) return false; I.swapOperands(); // Compare instructions are not associative so there's nothing else we can do. @@ -1002,7 +1015,7 @@ Value *InstCombiner::SimplifyDemandedUseBits(Value *V, APInt DemandedMask, // other, turn this into an *inclusive* or. // e.g. (A & C1)^(B & C2) -> (A & C1)|(B & C2) iff C1&C2 == 0 if ((DemandedMask & ~RHSKnownZero & ~LHSKnownZero) == 0) { - Instruction *Or = + Instruction *Or = BinaryOperator::CreateOr(I->getOperand(0), I->getOperand(1), I->getName()); return InsertNewInstBefore(Or, *I); @@ -1522,8 +1535,10 @@ Value *InstCombiner::SimplifyDemandedVectorElts(Value *V, APInt DemandedElts, // If this is inserting an element that isn't demanded, remove this // insertelement. unsigned IdxNo = Idx->getZExtValue(); - if (IdxNo >= VWidth || !DemandedElts[IdxNo]) - return AddSoonDeadInstToWorklist(*I, 0); + if (IdxNo >= VWidth || !DemandedElts[IdxNo]) { + Worklist.Add(I); + return I->getOperand(0); + } // Otherwise, the element inserted overwrites whatever was there, so the // input demanded set is simpler than the output set. @@ -1745,7 +1760,6 @@ Value *InstCombiner::SimplifyDemandedVectorElts(Value *V, APInt DemandedElts, UndefValue::get(II->getType()), TmpV, ConstantInt::get(Type::getInt32Ty(*Context), 0U, false), II->getName()); InsertNewInstBefore(New, *II); - AddSoonDeadInstToWorklist(*II, 0); return New; } } @@ -1870,11 +1884,8 @@ struct AddMaskingAnd { static Value *FoldOperationIntoSelectOperand(Instruction &I, Value *SO, InstCombiner *IC) { - LLVMContext *Context = IC->getContext(); - - if (CastInst *CI = dyn_cast(&I)) { - return IC->InsertCastBefore(CI->getOpcode(), SO, I.getType(), I); - } + if (CastInst *CI = dyn_cast(&I)) + return IC->Builder->CreateCast(CI->getOpcode(), SO, I.getType()); // Figure out if the constant is the left or the right argument. bool ConstIsRHS = isa(I.getOperand(1)); @@ -1889,16 +1900,17 @@ static Value *FoldOperationIntoSelectOperand(Instruction &I, Value *SO, Value *Op0 = SO, *Op1 = ConstOperand; if (!ConstIsRHS) std::swap(Op0, Op1); - Instruction *New; + if (BinaryOperator *BO = dyn_cast(&I)) - New = BinaryOperator::Create(BO->getOpcode(), Op0, Op1,SO->getName()+".op"); - else if (CmpInst *CI = dyn_cast(&I)) - New = CmpInst::Create(*Context, CI->getOpcode(), CI->getPredicate(), - Op0, Op1, SO->getName()+".cmp"); - else { - llvm_unreachable("Unknown binary instruction type!"); - } - return IC->InsertNewInstBefore(New, I); + return IC->Builder->CreateBinOp(BO->getOpcode(), Op0, Op1, + SO->getName()+".op"); + if (ICmpInst *CI = dyn_cast(&I)) + return IC->Builder->CreateICmp(CI->getPredicate(), Op0, Op1, + SO->getName()+".cmp"); + if (FCmpInst *CI = dyn_cast(&I)) + return IC->Builder->CreateICmp(CI->getPredicate(), Op0, Op1, + SO->getName()+".cmp"); + llvm_unreachable("Unknown binary instruction type!"); } // FoldOpIntoSelect - Given an instruction with a select as one operand and a @@ -1982,14 +1994,14 @@ Instruction *InstCombiner::FoldOpIntoPhi(Instruction &I) { PN->getIncomingValue(i), C, "phitmp", NonConstBB->getTerminator()); else if (CmpInst *CI = dyn_cast(&I)) - InV = CmpInst::Create(*Context, CI->getOpcode(), + InV = CmpInst::Create(CI->getOpcode(), CI->getPredicate(), PN->getIncomingValue(i), C, "phitmp", NonConstBB->getTerminator()); else llvm_unreachable("Unknown binop!"); - AddToWorkList(cast(InV)); + Worklist.Add(cast(InV)); } NewPN->addIncoming(InV, PN->getIncomingBlock(i)); } @@ -2005,7 +2017,7 @@ Instruction *InstCombiner::FoldOpIntoPhi(Instruction &I) { InV = CastInst::Create(CI->getOpcode(), PN->getIncomingValue(i), I.getType(), "phitmp", NonConstBB->getTerminator()); - AddToWorkList(cast(InV)); + Worklist.Add(cast(InV)); } NewPN->addIncoming(InV, PN->getIncomingBlock(i)); } @@ -2116,8 +2128,7 @@ Instruction *InstCombiner::visitAdd(BinaryOperator &I) { case 8: MiddleType = Type::getInt8Ty(*Context); break; } if (MiddleType) { - Instruction *NewTrunc = new TruncInst(XorLHS, MiddleType, "sext"); - InsertNewInstBefore(NewTrunc, I); + Value *NewTrunc = Builder->CreateTrunc(XorLHS, MiddleType, "sext"); return new SExtInst(NewTrunc, I.getType(), I.getName()); } } @@ -2148,8 +2159,7 @@ Instruction *InstCombiner::visitAdd(BinaryOperator &I) { if (Value *LHSV = dyn_castNegVal(LHS)) { if (LHS->getType()->isIntOrIntVector()) { if (Value *RHSV = dyn_castNegVal(RHS)) { - Instruction *NewAdd = BinaryOperator::CreateAdd(LHSV, RHSV, "sum"); - InsertNewInstBefore(NewAdd, I); + Value *NewAdd = Builder->CreateAdd(LHSV, RHSV, "sum"); return BinaryOperator::CreateNeg(NewAdd); } } @@ -2223,8 +2233,7 @@ Instruction *InstCombiner::visitAdd(BinaryOperator &I) { } if (W == Y) { - Value *NewAdd = InsertNewInstBefore(BinaryOperator::CreateAdd(X, Z, - LHS->getName()), I); + Value *NewAdd = Builder->CreateAdd(X, Z, LHS->getName()); return BinaryOperator::CreateMul(W, NewAdd); } } @@ -2252,8 +2261,7 @@ Instruction *InstCombiner::visitAdd(BinaryOperator &I) { if (AddRHSHighBits == AddRHSHighBitsAnd) { // Okay, the xform is safe. Insert the new add pronto. - Value *NewAdd = InsertNewInstBefore(BinaryOperator::CreateAdd(X, CRHS, - LHS->getName()), I); + Value *NewAdd = Builder->CreateAdd(X, CRHS, LHS->getName()); return BinaryOperator::CreateAnd(NewAdd, C2); } } @@ -2302,9 +2310,8 @@ Instruction *InstCombiner::visitAdd(BinaryOperator &I) { ConstantExpr::getSExt(CI, I.getType()) == RHSC && WillNotOverflowSignedAdd(LHSConv->getOperand(0), CI)) { // Insert the new, smaller add. - Instruction *NewAdd = BinaryOperator::CreateAdd(LHSConv->getOperand(0), - CI, "addconv"); - InsertNewInstBefore(NewAdd, I); + Value *NewAdd = Builder->CreateAdd(LHSConv->getOperand(0), + CI, "addconv"); return new SExtInst(NewAdd, I.getType()); } } @@ -2319,10 +2326,8 @@ Instruction *InstCombiner::visitAdd(BinaryOperator &I) { WillNotOverflowSignedAdd(LHSConv->getOperand(0), RHSConv->getOperand(0))) { // Insert the new integer add. - Instruction *NewAdd = BinaryOperator::CreateAdd(LHSConv->getOperand(0), - RHSConv->getOperand(0), - "addconv"); - InsertNewInstBefore(NewAdd, I); + Value *NewAdd = Builder->CreateAdd(LHSConv->getOperand(0), + RHSConv->getOperand(0), "addconv"); return new SExtInst(NewAdd, I.getType()); } } @@ -2378,9 +2383,8 @@ Instruction *InstCombiner::visitFAdd(BinaryOperator &I) { ConstantExpr::getSIToFP(CI, I.getType()) == CFP && WillNotOverflowSignedAdd(LHSConv->getOperand(0), CI)) { // Insert the new integer add. - Instruction *NewAdd = BinaryOperator::CreateAdd(LHSConv->getOperand(0), - CI, "addconv"); - InsertNewInstBefore(NewAdd, I); + Value *NewAdd = Builder->CreateAdd(LHSConv->getOperand(0), + CI, "addconv"); return new SIToFPInst(NewAdd, I.getType()); } } @@ -2395,10 +2399,8 @@ Instruction *InstCombiner::visitFAdd(BinaryOperator &I) { WillNotOverflowSignedAdd(LHSConv->getOperand(0), RHSConv->getOperand(0))) { // Insert the new integer add. - Instruction *NewAdd = BinaryOperator::CreateAdd(LHSConv->getOperand(0), - RHSConv->getOperand(0), - "addconv"); - InsertNewInstBefore(NewAdd, I); + Value *NewAdd = Builder->CreateAdd(LHSConv->getOperand(0), + RHSConv->getOperand(0), "addconv"); return new SIToFPInst(NewAdd, I.getType()); } } @@ -2511,8 +2513,7 @@ Instruction *InstCombiner::visitSub(BinaryOperator &I) { (Op1I->getOperand(0) == Op0 || Op1I->getOperand(1) == Op0)) { Value *OtherOp = Op1I->getOperand(Op1I->getOperand(0) == Op0); - Value *NewNot = - InsertNewInstBefore(BinaryOperator::CreateNot(OtherOp, "B.not"), I); + Value *NewNot = Builder->CreateNot(OtherOp, "B.not"); return BinaryOperator::CreateAnd(Op0, NewNot); } @@ -2662,11 +2663,8 @@ Instruction *InstCombiner::visitMul(BinaryOperator &I) { if (Op0I->getOpcode() == Instruction::Add && Op0I->hasOneUse() && isa(Op0I->getOperand(1)) && isa(Op1)) { // Canonicalize (X+C1)*C2 -> X*C2+C1*C2. - Instruction *Add = BinaryOperator::CreateMul(Op0I->getOperand(0), - Op1, "tmp"); - InsertNewInstBefore(Add, I); - Value *C1C2 = ConstantExpr::getMul(Op1, - cast(Op0I->getOperand(1))); + Value *Add = Builder->CreateMul(Op0I->getOperand(0), Op1, "tmp"); + Value *C1C2 = Builder->CreateMul(Op1, Op0I->getOperand(1)); return BinaryOperator::CreateAdd(Add, C1C2); } @@ -2712,19 +2710,16 @@ Instruction *InstCombiner::visitMul(BinaryOperator &I) { return BinaryOperator::CreateNeg(Op0BO); } - Instruction *Rem; + Value *Rem; if (BO->getOpcode() == Instruction::UDiv) - Rem = BinaryOperator::CreateURem(Op0BO, Op1BO); + Rem = Builder->CreateURem(Op0BO, Op1BO); else - Rem = BinaryOperator::CreateSRem(Op0BO, Op1BO); - - InsertNewInstBefore(Rem, I); + Rem = Builder->CreateSRem(Op0BO, Op1BO); Rem->takeName(BO); if (Op1BO == Op1) return BinaryOperator::CreateSub(Op0BO, Rem); - else - return BinaryOperator::CreateSub(Rem, Op0BO); + return BinaryOperator::CreateSub(Rem, Op0BO); } } @@ -2757,22 +2752,13 @@ Instruction *InstCombiner::visitMul(BinaryOperator &I) { // Shift the X value right to turn it into "all signbits". Constant *Amt = ConstantInt::get(SCIOp0->getType(), SCOpTy->getPrimitiveSizeInBits()-1); - Value *V = - InsertNewInstBefore( - BinaryOperator::Create(Instruction::AShr, SCIOp0, Amt, - BoolCast->getOperand(0)->getName()+ - ".mask"), I); + Value *V = Builder->CreateAShr(SCIOp0, Amt, + BoolCast->getOperand(0)->getName()+".mask"); // If the multiply type is not the same as the source type, sign extend // or truncate to the multiply type. - if (I.getType() != V->getType()) { - uint32_t SrcBits = V->getType()->getPrimitiveSizeInBits(); - uint32_t DstBits = I.getType()->getPrimitiveSizeInBits(); - Instruction::CastOps opcode = - (SrcBits == DstBits ? Instruction::BitCast : - (SrcBits < DstBits ? Instruction::SExt : Instruction::Trunc)); - V = InsertCastBefore(opcode, V, I.getType(), I); - } + if (I.getType() != V->getType()) + V = Builder->CreateIntCast(V, I.getType(), true); Value *OtherOp = Op0 == BoolCast ? I.getOperand(1) : Op0; return BinaryOperator::CreateAnd(V, OtherOp); @@ -2871,11 +2857,11 @@ bool InstCombiner::SimplifyDivRemOfSelect(BinaryOperator &I) { I != E; ++I) { if (*I == SI) { *I = SI->getOperand(NonNullOperand); - AddToWorkList(BBI); + Worklist.Add(BBI); } else if (*I == SelectCond) { *I = NonNullOperand == 1 ? ConstantInt::getTrue(*Context) : ConstantInt::getFalse(*Context); - AddToWorkList(BBI); + Worklist.Add(BBI); } } @@ -3006,9 +2992,7 @@ Instruction *InstCombiner::visitUDiv(BinaryOperator &I) { // X udiv C, where C >= signbit if (C->getValue().isNegative()) { - Value *IC = InsertNewInstBefore(new ICmpInst(*Context, - ICmpInst::ICMP_ULT, Op0, C), - I); + Value *IC = Builder->CreateICmpULT( Op0, C); return SelectInst::Create(IC, Constant::getNullValue(I.getType()), ConstantInt::get(I.getType(), 1)); } @@ -3022,10 +3006,8 @@ Instruction *InstCombiner::visitUDiv(BinaryOperator &I) { if (C1.isPowerOf2()) { Value *N = RHSI->getOperand(1); const Type *NTy = N->getType(); - if (uint32_t C2 = C1.logBase2()) { - Constant *C2V = ConstantInt::get(NTy, C2); - N = InsertNewInstBefore(BinaryOperator::CreateAdd(N, C2V, "tmp"), I); - } + if (uint32_t C2 = C1.logBase2()) + N = Builder->CreateAdd(N, ConstantInt::get(NTy, C2), "tmp"); return BinaryOperator::CreateLShr(Op0, N); } } @@ -3042,15 +3024,11 @@ Instruction *InstCombiner::visitUDiv(BinaryOperator &I) { uint32_t TSA = TVA.logBase2(), FSA = FVA.logBase2(); // Construct the "on true" case of the select Constant *TC = ConstantInt::get(Op0->getType(), TSA); - Instruction *TSI = BinaryOperator::CreateLShr( - Op0, TC, SI->getName()+".t"); - TSI = InsertNewInstBefore(TSI, I); + Value *TSI = Builder->CreateLShr(Op0, TC, SI->getName()+".t"); // Construct the "on false" case of the select Constant *FC = ConstantInt::get(Op0->getType(), FSA); - Instruction *FSI = BinaryOperator::CreateLShr( - Op0, FC, SI->getName()+".f"); - FSI = InsertNewInstBefore(FSI, I); + Value *FSI = Builder->CreateLShr(Op0, FC, SI->getName()+".f"); // construct the select instruction and return it. return SelectInst::Create(SI->getOperand(0), TSI, FSI, SI->getName()); @@ -3201,8 +3179,7 @@ Instruction *InstCombiner::visitURem(BinaryOperator &I) { isa(RHSI->getOperand(0))) { if (cast(RHSI->getOperand(0))->getValue().isPowerOf2()) { Constant *N1 = Constant::getAllOnesValue(I.getType()); - Value *Add = InsertNewInstBefore(BinaryOperator::CreateAdd(RHSI, N1, - "tmp"), I); + Value *Add = Builder->CreateAdd(RHSI, N1, "tmp"); return BinaryOperator::CreateAnd(Op0, Add); } } @@ -3216,12 +3193,10 @@ Instruction *InstCombiner::visitURem(BinaryOperator &I) { // STO == 0 and SFO == 0 handled above. if ((STO->getValue().isPowerOf2()) && (SFO->getValue().isPowerOf2())) { - Value *TrueAnd = InsertNewInstBefore( - BinaryOperator::CreateAnd(Op0, SubOne(STO), - SI->getName()+".t"), I); - Value *FalseAnd = InsertNewInstBefore( - BinaryOperator::CreateAnd(Op0, SubOne(SFO), - SI->getName()+".f"), I); + Value *TrueAnd = Builder->CreateAnd(Op0, SubOne(STO), + SI->getName()+".t"); + Value *FalseAnd = Builder->CreateAnd(Op0, SubOne(SFO), + SI->getName()+".f"); return SelectInst::Create(SI->getOperand(0), TrueAnd, FalseAnd); } } @@ -3234,15 +3209,15 @@ Instruction *InstCombiner::visitSRem(BinaryOperator &I) { Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1); // Handle the integer rem common cases - if (Instruction *common = commonIRemTransforms(I)) - return common; + if (Instruction *Common = commonIRemTransforms(I)) + return Common; if (Value *RHSNeg = dyn_castNegVal(Op1)) if (!isa(RHSNeg) || (isa(RHSNeg) && cast(RHSNeg)->getValue().isStrictlyPositive())) { // X % -Y -> X % Y - AddUsesToWorkList(I); + Worklist.AddValue(I.getOperand(1)); I.setOperand(1, RHSNeg); return &I; } @@ -3280,7 +3255,7 @@ Instruction *InstCombiner::visitSRem(BinaryOperator &I) { Constant *NewRHSV = ConstantVector::get(Elts); if (NewRHSV != RHSV) { - AddUsesToWorkList(I); + Worklist.AddValue(I.getOperand(1)); I.setOperand(1, NewRHSV); return &I; } @@ -3388,26 +3363,26 @@ static Value *getICmpValue(bool sign, unsigned code, Value *LHS, Value *RHS, case 0: return ConstantInt::getFalse(*Context); case 1: if (sign) - return new ICmpInst(*Context, ICmpInst::ICMP_SGT, LHS, RHS); + return new ICmpInst(ICmpInst::ICMP_SGT, LHS, RHS); else - return new ICmpInst(*Context, ICmpInst::ICMP_UGT, LHS, RHS); - case 2: return new ICmpInst(*Context, ICmpInst::ICMP_EQ, LHS, RHS); + return new ICmpInst(ICmpInst::ICMP_UGT, LHS, RHS); + case 2: return new ICmpInst(ICmpInst::ICMP_EQ, LHS, RHS); case 3: if (sign) - return new ICmpInst(*Context, ICmpInst::ICMP_SGE, LHS, RHS); + return new ICmpInst(ICmpInst::ICMP_SGE, LHS, RHS); else - return new ICmpInst(*Context, ICmpInst::ICMP_UGE, LHS, RHS); + return new ICmpInst(ICmpInst::ICMP_UGE, LHS, RHS); case 4: if (sign) - return new ICmpInst(*Context, ICmpInst::ICMP_SLT, LHS, RHS); + return new ICmpInst(ICmpInst::ICMP_SLT, LHS, RHS); else - return new ICmpInst(*Context, ICmpInst::ICMP_ULT, LHS, RHS); - case 5: return new ICmpInst(*Context, ICmpInst::ICMP_NE, LHS, RHS); + return new ICmpInst(ICmpInst::ICMP_ULT, LHS, RHS); + case 5: return new ICmpInst(ICmpInst::ICMP_NE, LHS, RHS); case 6: if (sign) - return new ICmpInst(*Context, ICmpInst::ICMP_SLE, LHS, RHS); + return new ICmpInst(ICmpInst::ICMP_SLE, LHS, RHS); else - return new ICmpInst(*Context, ICmpInst::ICMP_ULE, LHS, RHS); + return new ICmpInst(ICmpInst::ICMP_ULE, LHS, RHS); case 7: return ConstantInt::getTrue(*Context); } } @@ -3421,39 +3396,39 @@ static Value *getFCmpValue(bool isordered, unsigned code, default: llvm_unreachable("Illegal FCmp code!"); case 0: if (isordered) - return new FCmpInst(*Context, FCmpInst::FCMP_ORD, LHS, RHS); + return new FCmpInst(FCmpInst::FCMP_ORD, LHS, RHS); else - return new FCmpInst(*Context, FCmpInst::FCMP_UNO, LHS, RHS); + return new FCmpInst(FCmpInst::FCMP_UNO, LHS, RHS); case 1: if (isordered) - return new FCmpInst(*Context, FCmpInst::FCMP_OGT, LHS, RHS); + return new FCmpInst(FCmpInst::FCMP_OGT, LHS, RHS); else - return new FCmpInst(*Context, FCmpInst::FCMP_UGT, LHS, RHS); + return new FCmpInst(FCmpInst::FCMP_UGT, LHS, RHS); case 2: if (isordered) - return new FCmpInst(*Context, FCmpInst::FCMP_OEQ, LHS, RHS); + return new FCmpInst(FCmpInst::FCMP_OEQ, LHS, RHS); else - return new FCmpInst(*Context, FCmpInst::FCMP_UEQ, LHS, RHS); + return new FCmpInst(FCmpInst::FCMP_UEQ, LHS, RHS); case 3: if (isordered) - return new FCmpInst(*Context, FCmpInst::FCMP_OGE, LHS, RHS); + return new FCmpInst(FCmpInst::FCMP_OGE, LHS, RHS); else - return new FCmpInst(*Context, FCmpInst::FCMP_UGE, LHS, RHS); + return new FCmpInst(FCmpInst::FCMP_UGE, LHS, RHS); case 4: if (isordered) - return new FCmpInst(*Context, FCmpInst::FCMP_OLT, LHS, RHS); + return new FCmpInst(FCmpInst::FCMP_OLT, LHS, RHS); else - return new FCmpInst(*Context, FCmpInst::FCMP_ULT, LHS, RHS); + return new FCmpInst(FCmpInst::FCMP_ULT, LHS, RHS); case 5: if (isordered) - return new FCmpInst(*Context, FCmpInst::FCMP_ONE, LHS, RHS); + return new FCmpInst(FCmpInst::FCMP_ONE, LHS, RHS); else - return new FCmpInst(*Context, FCmpInst::FCMP_UNE, LHS, RHS); + return new FCmpInst(FCmpInst::FCMP_UNE, LHS, RHS); case 6: if (isordered) - return new FCmpInst(*Context, FCmpInst::FCMP_OLE, LHS, RHS); + return new FCmpInst(FCmpInst::FCMP_OLE, LHS, RHS); else - return new FCmpInst(*Context, FCmpInst::FCMP_ULE, LHS, RHS); + return new FCmpInst(FCmpInst::FCMP_ULE, LHS, RHS); case 7: return ConstantInt::getTrue(*Context); } } @@ -3528,8 +3503,7 @@ Instruction *InstCombiner::OptAndOp(Instruction *Op, case Instruction::Xor: if (Op->hasOneUse()) { // (X ^ C1) & C2 --> (X & C2) ^ (C1&C2) - Instruction *And = BinaryOperator::CreateAnd(X, AndRHS); - InsertNewInstBefore(And, TheAnd); + Value *And = Builder->CreateAnd(X, AndRHS); And->takeName(Op); return BinaryOperator::CreateXor(And, Together); } @@ -3540,8 +3514,7 @@ Instruction *InstCombiner::OptAndOp(Instruction *Op, if (Op->hasOneUse() && Together != OpRHS) { // (X | C1) & C2 --> (X | (C1&C2)) & C2 - Instruction *Or = BinaryOperator::CreateOr(X, Together); - InsertNewInstBefore(Or, TheAnd); + Value *Or = Builder->CreateOr(X, Together); Or->takeName(Op); return BinaryOperator::CreateAnd(Or, AndRHS); } @@ -3571,8 +3544,7 @@ Instruction *InstCombiner::OptAndOp(Instruction *Op, return &TheAnd; } else { // Pull the XOR out of the AND. - Instruction *NewAnd = BinaryOperator::CreateAnd(X, AndRHS); - InsertNewInstBefore(NewAnd, TheAnd); + Value *NewAnd = Builder->CreateAnd(X, AndRHS); NewAnd->takeName(Op); return BinaryOperator::CreateXor(NewAnd, AndRHS); } @@ -3632,9 +3604,7 @@ Instruction *InstCombiner::OptAndOp(Instruction *Op, // (Val ashr C1) & C2 -> (Val lshr C1) & C2 // Make the argument unsigned. Value *ShVal = Op->getOperand(0); - ShVal = InsertNewInstBefore( - BinaryOperator::CreateLShr(ShVal, OpRHS, - Op->getName()), TheAnd); + ShVal = Builder->CreateLShr(ShVal, OpRHS, Op->getName()); return BinaryOperator::CreateAnd(ShVal, AndRHS, TheAnd.getName()); } } @@ -3658,41 +3628,39 @@ Instruction *InstCombiner::InsertRangeTest(Value *V, Constant *Lo, Constant *Hi, if (Inside) { if (Lo == Hi) // Trivially false. - return new ICmpInst(*Context, ICmpInst::ICMP_NE, V, V); + return new ICmpInst(ICmpInst::ICMP_NE, V, V); // V >= Min && V < Hi --> V < Hi if (cast(Lo)->isMinValue(isSigned)) { ICmpInst::Predicate pred = (isSigned ? ICmpInst::ICMP_SLT : ICmpInst::ICMP_ULT); - return new ICmpInst(*Context, pred, V, Hi); + return new ICmpInst(pred, V, Hi); } // Emit V-Lo getName()+".off"); - InsertNewInstBefore(Add, IB); + Value *Add = Builder->CreateAdd(V, NegLo, V->getName()+".off"); Constant *UpperBound = ConstantExpr::getAdd(NegLo, Hi); - return new ICmpInst(*Context, ICmpInst::ICMP_ULT, Add, UpperBound); + return new ICmpInst(ICmpInst::ICMP_ULT, Add, UpperBound); } if (Lo == Hi) // Trivially true. - return new ICmpInst(*Context, ICmpInst::ICMP_EQ, V, V); + return new ICmpInst(ICmpInst::ICMP_EQ, V, V); // V < Min || V >= Hi -> V > Hi-1 Hi = SubOne(cast(Hi)); if (cast(Lo)->isMinValue(isSigned)) { ICmpInst::Predicate pred = (isSigned ? ICmpInst::ICMP_SGT : ICmpInst::ICMP_UGT); - return new ICmpInst(*Context, pred, V, Hi); + return new ICmpInst(pred, V, Hi); } // Emit V-Lo >u Hi-1-Lo // Note that Hi has already had one subtracted from it, above. ConstantInt *NegLo = cast(ConstantExpr::getNeg(Lo)); - Instruction *Add = BinaryOperator::CreateAdd(V, NegLo, V->getName()+".off"); - InsertNewInstBefore(Add, IB); + Value *Add = Builder->CreateAdd(V, NegLo, V->getName()+".off"); Constant *LowerBound = ConstantExpr::getAdd(NegLo, Hi); - return new ICmpInst(*Context, ICmpInst::ICMP_UGT, Add, LowerBound); + return new ICmpInst(ICmpInst::ICMP_UGT, Add, LowerBound); } // isRunOfOnes - Returns true iff Val consists of one contiguous run of 1s with @@ -3762,12 +3730,9 @@ Value *InstCombiner::FoldLogicalPlusAnd(Value *LHS, Value *RHS, return 0; } - Instruction *New; if (isSub) - New = BinaryOperator::CreateSub(LHSI->getOperand(0), RHS, "fold"); - else - New = BinaryOperator::CreateAdd(LHSI->getOperand(0), RHS, "fold"); - return InsertNewInstBefore(New, I); + return Builder->CreateSub(LHSI->getOperand(0), RHS, "fold"); + return Builder->CreateAdd(LHSI->getOperand(0), RHS, "fold"); } /// FoldAndOfICmps - Fold (icmp)&(icmp) if possible. @@ -3788,9 +3753,8 @@ Instruction *InstCombiner::FoldAndOfICmps(Instruction &I, // where C is a power of 2 if (LHSCst == RHSCst && LHSCC == RHSCC && LHSCC == ICmpInst::ICMP_ULT && LHSCst->getValue().isPowerOf2()) { - Instruction *NewOr = BinaryOperator::CreateOr(Val, Val2); - InsertNewInstBefore(NewOr, I); - return new ICmpInst(*Context, LHSCC, NewOr, LHSCst); + Value *NewOr = Builder->CreateOr(Val, Val2); + return new ICmpInst(LHSCC, NewOr, LHSCst); } // From here on, we only handle: @@ -3850,11 +3814,11 @@ Instruction *InstCombiner::FoldAndOfICmps(Instruction &I, default: llvm_unreachable("Unknown integer condition code!"); case ICmpInst::ICMP_ULT: if (LHSCst == SubOne(RHSCst)) // (X != 13 & X u< 14) -> X < 13 - return new ICmpInst(*Context, ICmpInst::ICMP_ULT, Val, LHSCst); + return new ICmpInst(ICmpInst::ICMP_ULT, Val, LHSCst); break; // (X != 13 & X u< 15) -> no change case ICmpInst::ICMP_SLT: if (LHSCst == SubOne(RHSCst)) // (X != 13 & X s< 14) -> X < 13 - return new ICmpInst(*Context, ICmpInst::ICMP_SLT, Val, LHSCst); + return new ICmpInst(ICmpInst::ICMP_SLT, Val, LHSCst); break; // (X != 13 & X s< 15) -> no change case ICmpInst::ICMP_EQ: // (X != 13 & X == 15) -> X == 15 case ICmpInst::ICMP_UGT: // (X != 13 & X u> 15) -> X u> 15 @@ -3863,10 +3827,8 @@ Instruction *InstCombiner::FoldAndOfICmps(Instruction &I, case ICmpInst::ICMP_NE: if (LHSCst == SubOne(RHSCst)){// (X != 13 & X != 14) -> X-13 >u 1 Constant *AddCST = ConstantExpr::getNeg(LHSCst); - Instruction *Add = BinaryOperator::CreateAdd(Val, AddCST, - Val->getName()+".off"); - InsertNewInstBefore(Add, I); - return new ICmpInst(*Context, ICmpInst::ICMP_UGT, Add, + Value *Add = Builder->CreateAdd(Val, AddCST, Val->getName()+".off"); + return new ICmpInst(ICmpInst::ICMP_UGT, Add, ConstantInt::get(Add->getType(), 1)); } break; // (X != 13 & X != 15) -> no change @@ -3912,7 +3874,7 @@ Instruction *InstCombiner::FoldAndOfICmps(Instruction &I, break; case ICmpInst::ICMP_NE: if (RHSCst == AddOne(LHSCst)) // (X u> 13 & X != 14) -> X u> 14 - return new ICmpInst(*Context, LHSCC, Val, RHSCst); + return new ICmpInst(LHSCC, Val, RHSCst); break; // (X u> 13 & X != 15) -> no change case ICmpInst::ICMP_ULT: // (X u> 13 & X u< 15) -> (X-14) 13 & X != 14) -> X s> 14 - return new ICmpInst(*Context, LHSCC, Val, RHSCst); + return new ICmpInst(LHSCC, Val, RHSCst); break; // (X s> 13 & X != 15) -> no change case ICmpInst::ICMP_SLT: // (X s> 13 & X s< 15) -> (X-14) s< 1 return InsertRangeTest(Val, AddOne(LHSCst), @@ -3957,7 +3919,7 @@ Instruction *InstCombiner::FoldAndOfFCmps(Instruction &I, FCmpInst *LHS, // false. if (LHSC->getValueAPF().isNaN() || RHSC->getValueAPF().isNaN()) return ReplaceInstUsesWith(I, ConstantInt::getFalse(*Context)); - return new FCmpInst(*Context, FCmpInst::FCMP_ORD, + return new FCmpInst(FCmpInst::FCMP_ORD, LHS->getOperand(0), RHS->getOperand(0)); } @@ -3965,7 +3927,7 @@ Instruction *InstCombiner::FoldAndOfFCmps(Instruction &I, FCmpInst *LHS, // "fcmp ord x,x" is "fcmp ord x, 0". if (isa(LHS->getOperand(1)) && isa(RHS->getOperand(1))) - return new FCmpInst(*Context, FCmpInst::FCMP_ORD, + return new FCmpInst(FCmpInst::FCMP_ORD, LHS->getOperand(0), RHS->getOperand(0)); return 0; } @@ -3984,7 +3946,7 @@ Instruction *InstCombiner::FoldAndOfFCmps(Instruction &I, FCmpInst *LHS, if (Op0LHS == Op1LHS && Op0RHS == Op1RHS) { // Simplify (fcmp cc0 x, y) & (fcmp cc1 x, y). if (Op0CC == Op1CC) - return new FCmpInst(*Context, (FCmpInst::Predicate)Op0CC, Op0LHS, Op0RHS); + return new FCmpInst((FCmpInst::Predicate)Op0CC, Op0LHS, Op0RHS); if (Op0CC == FCmpInst::FCMP_FALSE || Op1CC == FCmpInst::FCMP_FALSE) return ReplaceInstUsesWith(I, ConstantInt::getFalse(*Context)); @@ -4062,18 +4024,16 @@ Instruction *InstCombiner::visitAnd(BinaryOperator &I) { if (Op0I->hasOneUse()) { if (MaskedValueIsZero(Op0LHS, NotAndRHS)) { // Not masking anything out for the LHS, move to RHS. - Instruction *NewRHS = BinaryOperator::CreateAnd(Op0RHS, AndRHS, - Op0RHS->getName()+".masked"); - InsertNewInstBefore(NewRHS, I); + Value *NewRHS = Builder->CreateAnd(Op0RHS, AndRHS, + Op0RHS->getName()+".masked"); return BinaryOperator::Create( cast(Op0I)->getOpcode(), Op0LHS, NewRHS); } if (!isa(Op0RHS) && MaskedValueIsZero(Op0RHS, NotAndRHS)) { // Not masking anything out for the RHS, move to LHS. - Instruction *NewLHS = BinaryOperator::CreateAnd(Op0LHS, AndRHS, - Op0LHS->getName()+".masked"); - InsertNewInstBefore(NewLHS, I); + Value *NewLHS = Builder->CreateAnd(Op0LHS, AndRHS, + Op0LHS->getName()+".masked"); return BinaryOperator::Create( cast(Op0I)->getOpcode(), NewLHS, Op0RHS); } @@ -4107,8 +4067,7 @@ Instruction *InstCombiner::visitAnd(BinaryOperator &I) { ConstantInt *A = dyn_cast(Op0LHS); if (!(A && A->isZero()) && // avoid infinite recursion. MaskedValueIsZero(Op0LHS, Mask)) { - Instruction *NewNeg = BinaryOperator::CreateNeg(Op0RHS); - InsertNewInstBefore(NewNeg, I); + Value *NewNeg = Builder->CreateNeg(Op0RHS); return BinaryOperator::CreateAnd(NewNeg, AndRHS); } } @@ -4119,9 +4078,8 @@ Instruction *InstCombiner::visitAnd(BinaryOperator &I) { // (1 << x) & 1 --> zext(x == 0) // (1 >> x) & 1 --> zext(x == 0) if (AndRHSMask == 1 && Op0LHS == AndRHS) { - Instruction *NewICmp = new ICmpInst(*Context, ICmpInst::ICMP_EQ, - Op0RHS, Constant::getNullValue(I.getType())); - InsertNewInstBefore(NewICmp, I); + Value *NewICmp = + Builder->CreateICmpEQ(Op0RHS, Constant::getNullValue(I.getType())); return new ZExtInst(NewICmp, I.getType()); } break; @@ -4143,20 +4101,17 @@ Instruction *InstCombiner::visitAnd(BinaryOperator &I) { // into : and (cast X to T), trunc_or_bitcast(C1)&C2 // This will fold the two constants together, which may allow // other simplifications. - Instruction *NewCast = CastInst::CreateTruncOrBitCast( + Value *NewCast = Builder->CreateTruncOrBitCast( CastOp->getOperand(0), I.getType(), CastOp->getName()+".shrunk"); - NewCast = InsertNewInstBefore(NewCast, I); // trunc_or_bitcast(C1)&C2 - Constant *C3 = - ConstantExpr::getTruncOrBitCast(AndCI,I.getType()); + Constant *C3 = ConstantExpr::getTruncOrBitCast(AndCI,I.getType()); C3 = ConstantExpr::getAnd(C3, AndRHS); return BinaryOperator::CreateAnd(NewCast, C3); } else if (CastOp->getOpcode() == Instruction::Or) { // Change: and (cast (or X, C1) to T), C2 // into : trunc(C1)&C2 iff trunc(C1)&C2 == C2 - Constant *C3 = - ConstantExpr::getTruncOrBitCast(AndCI,I.getType()); + Constant *C3 = ConstantExpr::getTruncOrBitCast(AndCI,I.getType()); if (ConstantExpr::getAnd(C3, AndRHS) == AndRHS) // trunc(C1)&C2 return ReplaceInstUsesWith(I, AndRHS); @@ -4182,9 +4137,8 @@ Instruction *InstCombiner::visitAnd(BinaryOperator &I) { // (~A & ~B) == (~(A | B)) - De Morgan's Law if (Op0NotVal && Op1NotVal && isOnlyUse(Op0) && isOnlyUse(Op1)) { - Instruction *Or = BinaryOperator::CreateOr(Op0NotVal, Op1NotVal, - I.getName()+".demorgan"); - InsertNewInstBefore(Or, I); + Value *Or = Builder->CreateOr(Op0NotVal, Op1NotVal, + I.getName()+".demorgan"); return BinaryOperator::CreateNot(Or); } @@ -4230,11 +4184,8 @@ Instruction *InstCombiner::visitAnd(BinaryOperator &I) { cast(Op1)->swapOperands(); std::swap(A, B); } - if (A == Op0) { // A&(A^B) -> A & ~B - Instruction *NotB = BinaryOperator::CreateNot(B, "tmp"); - InsertNewInstBefore(NotB, I); - return BinaryOperator::CreateAnd(A, NotB); - } + if (A == Op0) // A&(A^B) -> A & ~B + return BinaryOperator::CreateAnd(A, Builder->CreateNot(B, "tmp")); } // (A&((~A)|B)) -> A&B @@ -4268,10 +4219,8 @@ Instruction *InstCombiner::visitAnd(BinaryOperator &I) { I.getType(), TD) && ValueRequiresCast(Op1C->getOpcode(), Op1C->getOperand(0), I.getType(), TD)) { - Instruction *NewOp = BinaryOperator::CreateAnd(Op0C->getOperand(0), - Op1C->getOperand(0), - I.getName()); - InsertNewInstBefore(NewOp, I); + Value *NewOp = Builder->CreateAnd(Op0C->getOperand(0), + Op1C->getOperand(0), I.getName()); return CastInst::Create(Op0C->getOpcode(), NewOp, I.getType()); } } @@ -4282,10 +4231,9 @@ Instruction *InstCombiner::visitAnd(BinaryOperator &I) { if (SI0->isShift() && SI0->getOpcode() == SI1->getOpcode() && SI0->getOperand(1) == SI1->getOperand(1) && (SI0->hasOneUse() || SI1->hasOneUse())) { - Instruction *NewOp = - InsertNewInstBefore(BinaryOperator::CreateAnd(SI0->getOperand(0), - SI1->getOperand(0), - SI0->getName()), I); + Value *NewOp = + Builder->CreateAnd(SI0->getOperand(0), SI1->getOperand(0), + SI0->getName()); return BinaryOperator::Create(SI1->getOpcode(), NewOp, SI1->getOperand(1)); } @@ -4546,11 +4494,9 @@ Instruction *InstCombiner::FoldOrOfICmps(Instruction &I, if (LHSCst == SubOne(RHSCst)) { // (X == 13 | X == 14) -> X-13 getName()+".off"); - InsertNewInstBefore(Add, I); + Value *Add = Builder->CreateAdd(Val, AddCST, Val->getName()+".off"); AddCST = ConstantExpr::getSub(AddOne(RHSCst), LHSCst); - return new ICmpInst(*Context, ICmpInst::ICMP_ULT, Add, AddCST); + return new ICmpInst(ICmpInst::ICMP_ULT, Add, AddCST); } break; // (X == 13 | X == 15) -> no change case ICmpInst::ICMP_UGT: // (X == 13 | X u> 14) -> no change @@ -4665,7 +4611,7 @@ Instruction *InstCombiner::FoldOrOfFCmps(Instruction &I, FCmpInst *LHS, // Otherwise, no need to compare the two constants, compare the // rest. - return new FCmpInst(*Context, FCmpInst::FCMP_UNO, + return new FCmpInst(FCmpInst::FCMP_UNO, LHS->getOperand(0), RHS->getOperand(0)); } @@ -4673,7 +4619,7 @@ Instruction *InstCombiner::FoldOrOfFCmps(Instruction &I, FCmpInst *LHS, // "fcmp uno x,x" is "fcmp uno x, 0". if (isa(LHS->getOperand(1)) && isa(RHS->getOperand(1))) - return new FCmpInst(*Context, FCmpInst::FCMP_UNO, + return new FCmpInst(FCmpInst::FCMP_UNO, LHS->getOperand(0), RHS->getOperand(0)); return 0; @@ -4691,7 +4637,7 @@ Instruction *InstCombiner::FoldOrOfFCmps(Instruction &I, FCmpInst *LHS, if (Op0LHS == Op1LHS && Op0RHS == Op1RHS) { // Simplify (fcmp cc0 x, y) | (fcmp cc1 x, y). if (Op0CC == Op1CC) - return new FCmpInst(*Context, (FCmpInst::Predicate)Op0CC, + return new FCmpInst((FCmpInst::Predicate)Op0CC, Op0LHS, Op0RHS); if (Op0CC == FCmpInst::FCMP_TRUE || Op1CC == FCmpInst::FCMP_TRUE) return ReplaceInstUsesWith(I, ConstantInt::getTrue(*Context)); @@ -4739,8 +4685,7 @@ Instruction *InstCombiner::FoldOrWithConstants(BinaryOperator &I, Value *Op, if (!Xor.isAllOnesValue()) return 0; if (V1 == A || V1 == B) { - Instruction *NewOp = - InsertNewInstBefore(BinaryOperator::CreateAnd((V1 == A) ? B : A, CI1), I); + Value *NewOp = Builder->CreateAnd((V1 == A) ? B : A, CI1); return BinaryOperator::CreateOr(NewOp, V1); } @@ -4777,8 +4722,7 @@ Instruction *InstCombiner::visitOr(BinaryOperator &I) { // (X & C1) | C2 --> (X | C2) & (C1|C2) if (match(Op0, m_And(m_Value(X), m_ConstantInt(C1))) && isOnlyUse(Op0)) { - Instruction *Or = BinaryOperator::CreateOr(X, RHS); - InsertNewInstBefore(Or, I); + Value *Or = Builder->CreateOr(X, RHS); Or->takeName(Op0); return BinaryOperator::CreateAnd(Or, ConstantInt::get(*Context, RHS->getValue() | C1->getValue())); @@ -4787,8 +4731,7 @@ Instruction *InstCombiner::visitOr(BinaryOperator &I) { // (X ^ C1) | C2 --> (X | C2) ^ (C1&~C2) if (match(Op0, m_Xor(m_Value(X), m_ConstantInt(C1))) && isOnlyUse(Op0)) { - Instruction *Or = BinaryOperator::CreateOr(X, RHS); - InsertNewInstBefore(Or, I); + Value *Or = Builder->CreateOr(X, RHS); Or->takeName(Op0); return BinaryOperator::CreateXor(Or, ConstantInt::get(*Context, C1->getValue() & ~RHS->getValue())); @@ -4827,8 +4770,7 @@ Instruction *InstCombiner::visitOr(BinaryOperator &I) { if (Op0->hasOneUse() && match(Op0, m_Xor(m_Value(A), m_ConstantInt(C1))) && MaskedValueIsZero(Op1, C1->getValue())) { - Instruction *NOr = BinaryOperator::CreateOr(A, Op1); - InsertNewInstBefore(NOr, I); + Value *NOr = Builder->CreateOr(A, Op1); NOr->takeName(Op0); return BinaryOperator::CreateXor(NOr, C1); } @@ -4837,8 +4779,7 @@ Instruction *InstCombiner::visitOr(BinaryOperator &I) { if (Op1->hasOneUse() && match(Op1, m_Xor(m_Value(A), m_ConstantInt(C1))) && MaskedValueIsZero(Op0, C1->getValue())) { - Instruction *NOr = BinaryOperator::CreateOr(A, Op0); - InsertNewInstBefore(NOr, I); + Value *NOr = Builder->CreateOr(A, Op0); NOr->takeName(Op0); return BinaryOperator::CreateXor(NOr, C1); } @@ -4889,8 +4830,7 @@ Instruction *InstCombiner::visitOr(BinaryOperator &I) { V1 = C, V2 = A, V3 = B; if (V1) { - Value *Or = - InsertNewInstBefore(BinaryOperator::CreateOr(V2, V3, "tmp"), I); + Value *Or = Builder->CreateOr(V2, V3, "tmp"); return BinaryOperator::CreateAnd(V1, Or); } } @@ -4929,10 +4869,8 @@ Instruction *InstCombiner::visitOr(BinaryOperator &I) { if (SI0->isShift() && SI0->getOpcode() == SI1->getOpcode() && SI0->getOperand(1) == SI1->getOperand(1) && (SI0->hasOneUse() || SI1->hasOneUse())) { - Instruction *NewOp = - InsertNewInstBefore(BinaryOperator::CreateOr(SI0->getOperand(0), - SI1->getOperand(0), - SI0->getName()), I); + Value *NewOp = Builder->CreateOr(SI0->getOperand(0), SI1->getOperand(0), + SI0->getName()); return BinaryOperator::Create(SI1->getOpcode(), NewOp, SI1->getOperand(1)); } @@ -4964,8 +4902,7 @@ Instruction *InstCombiner::visitOr(BinaryOperator &I) { // (~A | ~B) == (~(A & B)) - De Morgan's Law if (A && isOnlyUse(Op0) && isOnlyUse(Op1)) { - Value *And = InsertNewInstBefore(BinaryOperator::CreateAnd(A, B, - I.getName()+".demorgan"), I); + Value *And = Builder->CreateAnd(A, B, I.getName()+".demorgan"); return BinaryOperator::CreateNot(And); } } @@ -4995,10 +4932,8 @@ Instruction *InstCombiner::visitOr(BinaryOperator &I) { I.getType(), TD) && ValueRequiresCast(Op1C->getOpcode(), Op1C->getOperand(0), I.getType(), TD)) { - Instruction *NewOp = BinaryOperator::CreateOr(Op0C->getOperand(0), - Op1C->getOperand(0), - I.getName()); - InsertNewInstBefore(NewOp, I); + Value *NewOp = Builder->CreateOr(Op0C->getOperand(0), + Op1C->getOperand(0), I.getName()); return CastInst::Create(Op0C->getOpcode(), NewOp, I.getType()); } } @@ -5065,14 +5000,12 @@ Instruction *InstCombiner::visitXor(BinaryOperator &I) { Op0I->getOpcode() == Instruction::Or) { if (dyn_castNotVal(Op0I->getOperand(1))) Op0I->swapOperands(); if (Value *Op0NotVal = dyn_castNotVal(Op0I->getOperand(0))) { - Instruction *NotY = - BinaryOperator::CreateNot(Op0I->getOperand(1), - Op0I->getOperand(1)->getName()+".not"); - InsertNewInstBefore(NotY, I); + Value *NotY = + Builder->CreateNot(Op0I->getOperand(1), + Op0I->getOperand(1)->getName()+".not"); if (Op0I->getOpcode() == Instruction::And) return BinaryOperator::CreateOr(Op0NotVal, NotY); - else - return BinaryOperator::CreateAnd(Op0NotVal, NotY); + return BinaryOperator::CreateAnd(Op0NotVal, NotY); } } } @@ -5083,11 +5016,11 @@ Instruction *InstCombiner::visitXor(BinaryOperator &I) { if (RHS == ConstantInt::getTrue(*Context) && Op0->hasOneUse()) { // xor (cmp A, B), true = not (cmp A, B) = !cmp A, B if (ICmpInst *ICI = dyn_cast(Op0)) - return new ICmpInst(*Context, ICI->getInversePredicate(), + return new ICmpInst(ICI->getInversePredicate(), ICI->getOperand(0), ICI->getOperand(1)); if (FCmpInst *FCI = dyn_cast(Op0)) - return new FCmpInst(*Context, FCI->getInversePredicate(), + return new FCmpInst(FCI->getInversePredicate(), FCI->getOperand(0), FCI->getOperand(1)); } @@ -5096,17 +5029,12 @@ Instruction *InstCombiner::visitXor(BinaryOperator &I) { if (CmpInst *CI = dyn_cast(Op0C->getOperand(0))) { if (CI->hasOneUse() && Op0C->hasOneUse()) { Instruction::CastOps Opcode = Op0C->getOpcode(); - if (Opcode == Instruction::ZExt || Opcode == Instruction::SExt) { - if (RHS == ConstantExpr::getCast(Opcode, - ConstantInt::getTrue(*Context), - Op0C->getDestTy())) { - Instruction *NewCI = InsertNewInstBefore(CmpInst::Create( - *Context, - CI->getOpcode(), CI->getInversePredicate(), - CI->getOperand(0), CI->getOperand(1)), I); - NewCI->takeName(CI); - return CastInst::Create(Opcode, NewCI, Op0C->getType()); - } + if ((Opcode == Instruction::ZExt || Opcode == Instruction::SExt) && + (RHS == ConstantExpr::getCast(Opcode, + ConstantInt::getTrue(*Context), + Op0C->getDestTy()))) { + CI->setPredicate(CI->getInversePredicate()); + return CastInst::Create(Opcode, CI, Op0C->getType()); } } } @@ -5147,7 +5075,7 @@ Instruction *InstCombiner::visitXor(BinaryOperator &I) { Constant *CommonBits = ConstantExpr::getAnd(Op0CI, RHS); NewRHS = ConstantExpr::getAnd(NewRHS, ConstantExpr::getNot(CommonBits)); - AddToWorkList(Op0I); + Worklist.Add(Op0I); I.setOperand(0, Op0I->getOperand(0)); I.setOperand(1, NewRHS); return &I; @@ -5210,11 +5138,8 @@ Instruction *InstCombiner::visitXor(BinaryOperator &I) { Op0I->hasOneUse()) { if (A == Op1) // (B|A)^B == (A|B)^B std::swap(A, B); - if (B == Op1) { // (A|B)^B == A & ~B - Instruction *NotB = - InsertNewInstBefore(BinaryOperator::CreateNot(Op1, "tmp"), I); - return BinaryOperator::CreateAnd(A, NotB); - } + if (B == Op1) // (A|B)^B == A & ~B + return BinaryOperator::CreateAnd(A, Builder->CreateNot(Op1, "tmp")); } else if (match(Op0I, m_Xor(m_Specific(Op1), m_Value(B)))) { return ReplaceInstUsesWith(I, B); // (A^B)^A == B } else if (match(Op0I, m_Xor(m_Value(A), m_Specific(Op1)))) { @@ -5225,9 +5150,7 @@ Instruction *InstCombiner::visitXor(BinaryOperator &I) { std::swap(A, B); if (B == Op1 && // (B&A)^A == ~B & A !isa(Op1)) { // Canonical form is (B&C)^C - Instruction *N = - InsertNewInstBefore(BinaryOperator::CreateNot(A, "tmp"), I); - return BinaryOperator::CreateAnd(N, Op1); + return BinaryOperator::CreateAnd(Builder->CreateNot(A, "tmp"), Op1); } } } @@ -5237,10 +5160,9 @@ Instruction *InstCombiner::visitXor(BinaryOperator &I) { Op0I->getOpcode() == Op1I->getOpcode() && Op0I->getOperand(1) == Op1I->getOperand(1) && (Op1I->hasOneUse() || Op1I->hasOneUse())) { - Instruction *NewOp = - InsertNewInstBefore(BinaryOperator::CreateXor(Op0I->getOperand(0), - Op1I->getOperand(0), - Op0I->getName()), I); + Value *NewOp = + Builder->CreateXor(Op0I->getOperand(0), Op1I->getOperand(0), + Op0I->getName()); return BinaryOperator::Create(Op1I->getOpcode(), NewOp, Op1I->getOperand(1)); } @@ -5276,8 +5198,7 @@ Instruction *InstCombiner::visitXor(BinaryOperator &I) { X = B, Y = A, Z = C; if (X) { - Instruction *NewOp = - InsertNewInstBefore(BinaryOperator::CreateXor(Y, Z, Op0->getName()), I); + Value *NewOp = Builder->CreateXor(Y, Z, Op0->getName()); return BinaryOperator::CreateAnd(NewOp, X); } } @@ -5299,10 +5220,8 @@ Instruction *InstCombiner::visitXor(BinaryOperator &I) { I.getType(), TD) && ValueRequiresCast(Op1C->getOpcode(), Op1C->getOperand(0), I.getType(), TD)) { - Instruction *NewOp = BinaryOperator::CreateXor(Op0C->getOperand(0), - Op1C->getOperand(0), - I.getName()); - InsertNewInstBefore(NewOp, I); + Value *NewOp = Builder->CreateXor(Op0C->getOperand(0), + Op1C->getOperand(0), I.getName()); return CastInst::Create(Op0C->getOpcode(), NewOp, I.getType()); } } @@ -5395,7 +5314,6 @@ static Value *EmitGEPOffset(User *GEP, Instruction &I, InstCombiner &IC) { TargetData &TD = *IC.getTargetData(); gep_type_iterator GTI = gep_type_begin(GEP); const Type *IntPtrTy = TD.getIntPtrType(I.getContext()); - LLVMContext *Context = IC.getContext(); Value *Result = Constant::getNullValue(IntPtrTy); // Build a mask for high order bits. @@ -5413,15 +5331,9 @@ static Value *EmitGEPOffset(User *GEP, Instruction &I, InstCombiner &IC) { if (const StructType *STy = dyn_cast(*GTI)) { Size = TD.getStructLayout(STy)->getElementOffset(OpC->getZExtValue()); - if (ConstantInt *RC = dyn_cast(Result)) - Result = - ConstantInt::get(*Context, - RC->getValue() + APInt(IntPtrWidth, Size)); - else - Result = IC.InsertNewInstBefore( - BinaryOperator::CreateAdd(Result, - ConstantInt::get(IntPtrTy, Size), - GEP->getName()+".offs"), I); + Result = IC.Builder->CreateAdd(Result, + ConstantInt::get(IntPtrTy, Size), + GEP->getName()+".offs"); continue; } @@ -5429,41 +5341,21 @@ static Value *EmitGEPOffset(User *GEP, Instruction &I, InstCombiner &IC) { Constant *OC = ConstantExpr::getIntegerCast(OpC, IntPtrTy, true /*SExt*/); Scale = ConstantExpr::getMul(OC, Scale); - if (Constant *RC = dyn_cast(Result)) - Result = ConstantExpr::getAdd(RC, Scale); - else { - // Emit an add instruction. - Result = IC.InsertNewInstBefore( - BinaryOperator::CreateAdd(Result, Scale, - GEP->getName()+".offs"), I); - } + // Emit an add instruction. + Result = IC.Builder->CreateAdd(Result, Scale, GEP->getName()+".offs"); continue; } // Convert to correct type. - if (Op->getType() != IntPtrTy) { - if (Constant *OpC = dyn_cast(Op)) - Op = ConstantExpr::getIntegerCast(OpC, IntPtrTy, true); - else - Op = IC.InsertNewInstBefore(CastInst::CreateIntegerCast(Op, IntPtrTy, - true, - Op->getName()+".c"), I); - } + if (Op->getType() != IntPtrTy) + Op = IC.Builder->CreateIntCast(Op, IntPtrTy, true, Op->getName()+".c"); if (Size != 1) { Constant *Scale = ConstantInt::get(IntPtrTy, Size); - if (Constant *OpC = dyn_cast(Op)) - Op = ConstantExpr::getMul(OpC, Scale); - else // We'll let instcombine(mul) convert this to a shl if possible. - Op = IC.InsertNewInstBefore(BinaryOperator::CreateMul(Op, Scale, - GEP->getName()+".idx"), I); + // We'll let instcombine(mul) convert this to a shl if possible. + Op = IC.Builder->CreateMul(Op, Scale, GEP->getName()+".idx"); } // Emit an add instruction. - if (isa(Op) && isa(Result)) - Result = ConstantExpr::getAdd(cast(Op), - cast(Result)); - else - Result = IC.InsertNewInstBefore(BinaryOperator::CreateAdd(Op, Result, - GEP->getName()+".offs"), I); + Result = IC.Builder->CreateAdd(Op, Result, GEP->getName()+".offs"); } return Result; } @@ -5596,7 +5488,7 @@ Instruction *InstCombiner::FoldGEPICmp(GEPOperator *GEPLHS, Value *RHS, // If not, synthesize the offset the hard way. if (Offset == 0) Offset = EmitGEPOffset(GEPLHS, I, *this); - return new ICmpInst(*Context, ICmpInst::getSignedPredicate(Cond), Offset, + return new ICmpInst(ICmpInst::getSignedPredicate(Cond), Offset, Constant::getNullValue(Offset->getType())); } else if (GEPOperator *GEPRHS = dyn_cast(RHS)) { // If the base pointers are different, but the indices are the same, just @@ -5614,7 +5506,7 @@ Instruction *InstCombiner::FoldGEPICmp(GEPOperator *GEPLHS, Value *RHS, // If all indices are the same, just compare the base pointers. if (IndicesTheSame) - return new ICmpInst(*Context, ICmpInst::getSignedPredicate(Cond), + return new ICmpInst(ICmpInst::getSignedPredicate(Cond), GEPLHS->getOperand(0), GEPRHS->getOperand(0)); // Otherwise, the base pointers are different and the indices are @@ -5671,8 +5563,7 @@ Instruction *InstCombiner::FoldGEPICmp(GEPOperator *GEPLHS, Value *RHS, Value *LHSV = GEPLHS->getOperand(DiffOperand); Value *RHSV = GEPRHS->getOperand(DiffOperand); // Make sure we do a signed comparison here. - return new ICmpInst(*Context, - ICmpInst::getSignedPredicate(Cond), LHSV, RHSV); + return new ICmpInst(ICmpInst::getSignedPredicate(Cond), LHSV, RHSV); } } @@ -5684,7 +5575,7 @@ Instruction *InstCombiner::FoldGEPICmp(GEPOperator *GEPLHS, Value *RHS, // ((gep Ptr, OFFSET1) cmp (gep Ptr, OFFSET2) ---> (OFFSET1 cmp OFFSET2) Value *L = EmitGEPOffset(GEPLHS, I, *this); Value *R = EmitGEPOffset(GEPRHS, I, *this); - return new ICmpInst(*Context, ICmpInst::getSignedPredicate(Cond), L, R); + return new ICmpInst(ICmpInst::getSignedPredicate(Cond), L, R); } } return 0; @@ -5879,7 +5770,7 @@ Instruction *InstCombiner::FoldFCmp_IntToFP_Cst(FCmpInst &I, // Lower this FP comparison into an appropriate integer version of the // comparison. - return new ICmpInst(*Context, Pred, LHSI->getOperand(0), RHSInt); + return new ICmpInst(Pred, LHSI->getOperand(0), RHSInt); } Instruction *InstCombiner::visitFCmpInst(FCmpInst &I) { @@ -5967,16 +5858,14 @@ Instruction *InstCombiner::visitFCmpInst(FCmpInst &I) { // Fold the known value into the constant operand. Op1 = ConstantExpr::getCompare(I.getPredicate(), C, RHSC); // Insert a new FCmp of the other select operand. - Op2 = InsertNewInstBefore(new FCmpInst(*Context, I.getPredicate(), - LHSI->getOperand(2), RHSC, - I.getName()), I); + Op2 = Builder->CreateFCmp(I.getPredicate(), + LHSI->getOperand(2), RHSC, I.getName()); } else if (Constant *C = dyn_cast(LHSI->getOperand(2))) { // Fold the known value into the constant operand. Op2 = ConstantExpr::getCompare(I.getPredicate(), C, RHSC); // Insert a new FCmp of the other select operand. - Op1 = InsertNewInstBefore(new FCmpInst(*Context, I.getPredicate(), - LHSI->getOperand(1), RHSC, - I.getName()), I); + Op1 = Builder->CreateFCmp(I.getPredicate(), LHSI->getOperand(1), + RHSC, I.getName()); } } @@ -6016,8 +5905,7 @@ Instruction *InstCombiner::visitICmpInst(ICmpInst &I) { switch (I.getPredicate()) { default: llvm_unreachable("Invalid icmp instruction!"); case ICmpInst::ICMP_EQ: { // icmp eq i1 A, B -> ~(A^B) - Instruction *Xor = BinaryOperator::CreateXor(Op0, Op1, I.getName()+"tmp"); - InsertNewInstBefore(Xor, I); + Value *Xor = Builder->CreateXor(Op0, Op1, I.getName()+"tmp"); return BinaryOperator::CreateNot(Xor); } case ICmpInst::ICMP_NE: // icmp eq i1 A, B -> A^B @@ -6027,32 +5915,28 @@ Instruction *InstCombiner::visitICmpInst(ICmpInst &I) { std::swap(Op0, Op1); // Change icmp ugt -> icmp ult // FALL THROUGH case ICmpInst::ICMP_ULT:{ // icmp ult i1 A, B -> ~A & B - Instruction *Not = BinaryOperator::CreateNot(Op0, I.getName()+"tmp"); - InsertNewInstBefore(Not, I); + Value *Not = Builder->CreateNot(Op0, I.getName()+"tmp"); return BinaryOperator::CreateAnd(Not, Op1); } case ICmpInst::ICMP_SGT: std::swap(Op0, Op1); // Change icmp sgt -> icmp slt // FALL THROUGH case ICmpInst::ICMP_SLT: { // icmp slt i1 A, B -> A & ~B - Instruction *Not = BinaryOperator::CreateNot(Op1, I.getName()+"tmp"); - InsertNewInstBefore(Not, I); + Value *Not = Builder->CreateNot(Op1, I.getName()+"tmp"); return BinaryOperator::CreateAnd(Not, Op0); } case ICmpInst::ICMP_UGE: std::swap(Op0, Op1); // Change icmp uge -> icmp ule // FALL THROUGH case ICmpInst::ICMP_ULE: { // icmp ule i1 A, B -> ~A | B - Instruction *Not = BinaryOperator::CreateNot(Op0, I.getName()+"tmp"); - InsertNewInstBefore(Not, I); + Value *Not = Builder->CreateNot(Op0, I.getName()+"tmp"); return BinaryOperator::CreateOr(Not, Op1); } case ICmpInst::ICMP_SGE: std::swap(Op0, Op1); // Change icmp sge -> icmp sle // FALL THROUGH case ICmpInst::ICMP_SLE: { // icmp sle i1 A, B -> A | ~B - Instruction *Not = BinaryOperator::CreateNot(Op1, I.getName()+"tmp"); - InsertNewInstBefore(Not, I); + Value *Not = Builder->CreateNot(Op1, I.getName()+"tmp"); return BinaryOperator::CreateOr(Not, Op0); } } @@ -6074,7 +5958,7 @@ Instruction *InstCombiner::visitICmpInst(ICmpInst &I) { if (I.isEquality() && CI->isNullValue() && match(Op0, m_Sub(m_Value(A), m_Value(B)))) { // (icmp cond A B) if cond is equality - return new ICmpInst(*Context, I.getPredicate(), A, B); + return new ICmpInst(I.getPredicate(), A, B); } // If we have an icmp le or icmp ge instruction, turn it into the @@ -6085,22 +5969,22 @@ Instruction *InstCombiner::visitICmpInst(ICmpInst &I) { case ICmpInst::ICMP_ULE: if (CI->isMaxValue(false)) // A <=u MAX -> TRUE return ReplaceInstUsesWith(I, ConstantInt::getTrue(*Context)); - return new ICmpInst(*Context, ICmpInst::ICMP_ULT, Op0, + return new ICmpInst(ICmpInst::ICMP_ULT, Op0, AddOne(CI)); case ICmpInst::ICMP_SLE: if (CI->isMaxValue(true)) // A <=s MAX -> TRUE return ReplaceInstUsesWith(I, ConstantInt::getTrue(*Context)); - return new ICmpInst(*Context, ICmpInst::ICMP_SLT, Op0, + return new ICmpInst(ICmpInst::ICMP_SLT, Op0, AddOne(CI)); case ICmpInst::ICMP_UGE: if (CI->isMinValue(false)) // A >=u MIN -> TRUE return ReplaceInstUsesWith(I, ConstantInt::getTrue(*Context)); - return new ICmpInst(*Context, ICmpInst::ICMP_UGT, Op0, + return new ICmpInst(ICmpInst::ICMP_UGT, Op0, SubOne(CI)); case ICmpInst::ICMP_SGE: if (CI->isMinValue(true)) // A >=s MIN -> TRUE return ReplaceInstUsesWith(I, ConstantInt::getTrue(*Context)); - return new ICmpInst(*Context, ICmpInst::ICMP_SGT, Op0, + return new ICmpInst(ICmpInst::ICMP_SGT, Op0, SubOne(CI)); } @@ -6147,10 +6031,10 @@ Instruction *InstCombiner::visitICmpInst(ICmpInst &I) { // figured out that the LHS is a constant. Just constant fold this now so // that code below can assume that Min != Max. if (!isa(Op0) && Op0Min == Op0Max) - return new ICmpInst(*Context, I.getPredicate(), + return new ICmpInst(I.getPredicate(), ConstantInt::get(*Context, Op0Min), Op1); if (!isa(Op1) && Op1Min == Op1Max) - return new ICmpInst(*Context, I.getPredicate(), Op0, + return new ICmpInst(I.getPredicate(), Op0, ConstantInt::get(*Context, Op1Min)); // Based on the range information we know about the LHS, see if we can @@ -6171,15 +6055,15 @@ Instruction *InstCombiner::visitICmpInst(ICmpInst &I) { if (Op0Min.uge(Op1Max)) // A false if min(A) >= max(B) return ReplaceInstUsesWith(I, ConstantInt::getFalse(*Context)); if (Op1Min == Op0Max) // A A != B if max(A) == min(B) - return new ICmpInst(*Context, ICmpInst::ICMP_NE, Op0, Op1); + return new ICmpInst(ICmpInst::ICMP_NE, Op0, Op1); if (ConstantInt *CI = dyn_cast(Op1)) { if (Op1Max == Op0Min+1) // A A == C-1 if min(A)+1 == C - return new ICmpInst(*Context, ICmpInst::ICMP_EQ, Op0, + return new ICmpInst(ICmpInst::ICMP_EQ, Op0, SubOne(CI)); // (x (x >s -1) -> true if sign bit clear if (CI->isMinValue(true)) - return new ICmpInst(*Context, ICmpInst::ICMP_SGT, Op0, + return new ICmpInst(ICmpInst::ICMP_SGT, Op0, Constant::getAllOnesValue(Op0->getType())); } break; @@ -6190,15 +6074,15 @@ Instruction *InstCombiner::visitICmpInst(ICmpInst &I) { return ReplaceInstUsesWith(I, ConstantInt::getFalse(*Context)); if (Op1Max == Op0Min) // A >u B -> A != B if min(A) == max(B) - return new ICmpInst(*Context, ICmpInst::ICMP_NE, Op0, Op1); + return new ICmpInst(ICmpInst::ICMP_NE, Op0, Op1); if (ConstantInt *CI = dyn_cast(Op1)) { if (Op1Min == Op0Max-1) // A >u C -> A == C+1 if max(a)-1 == C - return new ICmpInst(*Context, ICmpInst::ICMP_EQ, Op0, + return new ICmpInst(ICmpInst::ICMP_EQ, Op0, AddOne(CI)); // (x >u 2147483647) -> (x true if sign bit set if (CI->isMaxValue(true)) - return new ICmpInst(*Context, ICmpInst::ICMP_SLT, Op0, + return new ICmpInst(ICmpInst::ICMP_SLT, Op0, Constant::getNullValue(Op0->getType())); } break; @@ -6208,10 +6092,10 @@ Instruction *InstCombiner::visitICmpInst(ICmpInst &I) { if (Op0Min.sge(Op1Max)) // A false if min(A) >= max(C) return ReplaceInstUsesWith(I, ConstantInt::getFalse(*Context)); if (Op1Min == Op0Max) // A A != B if max(A) == min(B) - return new ICmpInst(*Context, ICmpInst::ICMP_NE, Op0, Op1); + return new ICmpInst(ICmpInst::ICMP_NE, Op0, Op1); if (ConstantInt *CI = dyn_cast(Op1)) { if (Op1Max == Op0Min+1) // A A == C-1 if min(A)+1 == C - return new ICmpInst(*Context, ICmpInst::ICMP_EQ, Op0, + return new ICmpInst(ICmpInst::ICMP_EQ, Op0, SubOne(CI)); } break; @@ -6222,10 +6106,10 @@ Instruction *InstCombiner::visitICmpInst(ICmpInst &I) { return ReplaceInstUsesWith(I, ConstantInt::getFalse(*Context)); if (Op1Max == Op0Min) // A >s B -> A != B if min(A) == max(B) - return new ICmpInst(*Context, ICmpInst::ICMP_NE, Op0, Op1); + return new ICmpInst(ICmpInst::ICMP_NE, Op0, Op1); if (ConstantInt *CI = dyn_cast(Op1)) { if (Op1Min == Op0Max-1) // A >s C -> A == C+1 if max(A)-1 == C - return new ICmpInst(*Context, ICmpInst::ICMP_EQ, Op0, + return new ICmpInst(ICmpInst::ICMP_EQ, Op0, AddOne(CI)); } break; @@ -6264,7 +6148,7 @@ Instruction *InstCombiner::visitICmpInst(ICmpInst &I) { if (I.isSignedPredicate() && ((Op0KnownZero.isNegative() && Op1KnownZero.isNegative()) || (Op0KnownOne.isNegative() && Op1KnownOne.isNegative()))) - return new ICmpInst(*Context, I.getUnsignedPredicate(), Op0, Op1); + return new ICmpInst(I.getUnsignedPredicate(), Op0, Op1); } // Test if the ICmpInst instruction is used exclusively by a select as @@ -6306,7 +6190,7 @@ Instruction *InstCombiner::visitICmpInst(ICmpInst &I) { break; } if (isAllZeros) - return new ICmpInst(*Context, I.getPredicate(), LHSI->getOperand(0), + return new ICmpInst(I.getPredicate(), LHSI->getOperand(0), Constant::getNullValue(LHSI->getOperand(0)->getType())); } break; @@ -6329,16 +6213,14 @@ Instruction *InstCombiner::visitICmpInst(ICmpInst &I) { // Fold the known value into the constant operand. Op1 = ConstantExpr::getICmp(I.getPredicate(), C, RHSC); // Insert a new ICmp of the other select operand. - Op2 = InsertNewInstBefore(new ICmpInst(*Context, I.getPredicate(), - LHSI->getOperand(2), RHSC, - I.getName()), I); + Op2 = Builder->CreateICmp(I.getPredicate(), LHSI->getOperand(2), + RHSC, I.getName()); } else if (Constant *C = dyn_cast(LHSI->getOperand(2))) { // Fold the known value into the constant operand. Op2 = ConstantExpr::getICmp(I.getPredicate(), C, RHSC); // Insert a new ICmp of the other select operand. - Op1 = InsertNewInstBefore(new ICmpInst(*Context, I.getPredicate(), - LHSI->getOperand(1), RHSC, - I.getName()), I); + Op1 = Builder->CreateICmp(I.getPredicate(), LHSI->getOperand(1), + RHSC, I.getName()); } } @@ -6350,7 +6232,7 @@ Instruction *InstCombiner::visitICmpInst(ICmpInst &I) { // If we have (malloc != null), and if the malloc has a single use, we // can assume it is successful and remove the malloc. if (LHSI->hasOneUse() && isa(RHSC)) { - AddToWorkList(LHSI); + Worklist.Add(LHSI); return ReplaceInstUsesWith(I, ConstantInt::get(Type::getInt1Ty(*Context), !I.isTrueWhenEqual())); } @@ -6388,10 +6270,10 @@ Instruction *InstCombiner::visitICmpInst(ICmpInst &I) { Op1 = ConstantExpr::getBitCast(Op1C, Op0->getType()); } else { // Otherwise, cast the RHS right before the icmp - Op1 = InsertBitCastBefore(Op1, Op0->getType(), I); + Op1 = Builder->CreateBitCast(Op1, Op0->getType()); } } - return new ICmpInst(*Context, I.getPredicate(), Op0, Op1); + return new ICmpInst(I.getPredicate(), Op0, Op1); } } @@ -6418,7 +6300,7 @@ Instruction *InstCombiner::visitICmpInst(ICmpInst &I) { case Instruction::Sub: case Instruction::Xor: if (I.isEquality()) // a+x icmp eq/ne b+x --> a icmp b - return new ICmpInst(*Context, I.getPredicate(), Op0I->getOperand(0), + return new ICmpInst(I.getPredicate(), Op0I->getOperand(0), Op1I->getOperand(0)); // icmp u/s (a ^ signbit), (b ^ signbit) --> icmp s/u a, b if (ConstantInt *CI = dyn_cast(Op0I->getOperand(1))) { @@ -6426,7 +6308,7 @@ Instruction *InstCombiner::visitICmpInst(ICmpInst &I) { ICmpInst::Predicate Pred = I.isSignedPredicate() ? I.getUnsignedPredicate() : I.getSignedPredicate(); - return new ICmpInst(*Context, Pred, Op0I->getOperand(0), + return new ICmpInst(Pred, Op0I->getOperand(0), Op1I->getOperand(0)); } @@ -6435,7 +6317,7 @@ Instruction *InstCombiner::visitICmpInst(ICmpInst &I) { ? I.getUnsignedPredicate() : I.getSignedPredicate(); Pred = I.getSwappedPredicate(Pred); - return new ICmpInst(*Context, Pred, Op0I->getOperand(0), + return new ICmpInst(Pred, Op0I->getOperand(0), Op1I->getOperand(0)); } } @@ -6453,13 +6335,9 @@ Instruction *InstCombiner::visitICmpInst(ICmpInst &I) { APInt::getLowBitsSet(AP.getBitWidth(), AP.getBitWidth() - AP.countTrailingZeros())); - Instruction *And1 = BinaryOperator::CreateAnd(Op0I->getOperand(0), - Mask); - Instruction *And2 = BinaryOperator::CreateAnd(Op1I->getOperand(0), - Mask); - InsertNewInstBefore(And1, I); - InsertNewInstBefore(And2, I); - return new ICmpInst(*Context, I.getPredicate(), And1, And2); + Value *And1 = Builder->CreateAnd(Op0I->getOperand(0), Mask); + Value *And2 = Builder->CreateAnd(Op1I->getOperand(0), Mask); + return new ICmpInst(I.getPredicate(), And1, And2); } } break; @@ -6472,7 +6350,7 @@ Instruction *InstCombiner::visitICmpInst(ICmpInst &I) { { Value *A, *B; if (match(Op0, m_Not(m_Value(A))) && match(Op1, m_Not(m_Value(B)))) - return new ICmpInst(*Context, I.getPredicate(), B, A); + return new ICmpInst(I.getPredicate(), B, A); } if (I.isEquality()) { @@ -6481,12 +6359,12 @@ Instruction *InstCombiner::visitICmpInst(ICmpInst &I) { // -x == -y --> x == y if (match(Op0, m_Neg(m_Value(A))) && match(Op1, m_Neg(m_Value(B)))) - return new ICmpInst(*Context, I.getPredicate(), A, B); + return new ICmpInst(I.getPredicate(), A, B); if (match(Op0, m_Xor(m_Value(A), m_Value(B)))) { if (A == Op1 || B == Op1) { // (A^B) == A -> B == 0 Value *OtherVal = A == Op1 ? B : A; - return new ICmpInst(*Context, I.getPredicate(), OtherVal, + return new ICmpInst(I.getPredicate(), OtherVal, Constant::getNullValue(A->getType())); } @@ -6497,16 +6375,15 @@ Instruction *InstCombiner::visitICmpInst(ICmpInst &I) { match(D, m_ConstantInt(C2)) && Op1->hasOneUse()) { Constant *NC = ConstantInt::get(*Context, C1->getValue() ^ C2->getValue()); - Instruction *Xor = BinaryOperator::CreateXor(C, NC, "tmp"); - return new ICmpInst(*Context, I.getPredicate(), A, - InsertNewInstBefore(Xor, I)); + Value *Xor = Builder->CreateXor(C, NC, "tmp"); + return new ICmpInst(I.getPredicate(), A, Xor); } // A^B == A^D -> B == D - if (A == C) return new ICmpInst(*Context, I.getPredicate(), B, D); - if (A == D) return new ICmpInst(*Context, I.getPredicate(), B, C); - if (B == C) return new ICmpInst(*Context, I.getPredicate(), A, D); - if (B == D) return new ICmpInst(*Context, I.getPredicate(), A, C); + if (A == C) return new ICmpInst(I.getPredicate(), B, D); + if (A == D) return new ICmpInst(I.getPredicate(), B, C); + if (B == C) return new ICmpInst(I.getPredicate(), A, D); + if (B == D) return new ICmpInst(I.getPredicate(), A, C); } } @@ -6514,18 +6391,18 @@ Instruction *InstCombiner::visitICmpInst(ICmpInst &I) { (A == Op0 || B == Op0)) { // A == (A^B) -> B == 0 Value *OtherVal = A == Op0 ? B : A; - return new ICmpInst(*Context, I.getPredicate(), OtherVal, + return new ICmpInst(I.getPredicate(), OtherVal, Constant::getNullValue(A->getType())); } // (A-B) == A -> B == 0 if (match(Op0, m_Sub(m_Specific(Op1), m_Value(B)))) - return new ICmpInst(*Context, I.getPredicate(), B, + return new ICmpInst(I.getPredicate(), B, Constant::getNullValue(B->getType())); // A == (A-B) -> B == 0 if (match(Op1, m_Sub(m_Specific(Op0), m_Value(B)))) - return new ICmpInst(*Context, I.getPredicate(), B, + return new ICmpInst(I.getPredicate(), B, Constant::getNullValue(B->getType())); // (X&Z) == (Y&Z) -> (X^Y) & Z == 0 @@ -6545,8 +6422,8 @@ Instruction *InstCombiner::visitICmpInst(ICmpInst &I) { } if (X) { // Build (X^Y) & Z - Op1 = InsertNewInstBefore(BinaryOperator::CreateXor(X, Y, "tmp"), I); - Op1 = InsertNewInstBefore(BinaryOperator::CreateAnd(Op1, Z, "tmp"), I); + Op1 = Builder->CreateXor(X, Y, "tmp"); + Op1 = Builder->CreateAnd(Op1, Z, "tmp"); I.setOperand(0, Op1); I.setOperand(1, Constant::getNullValue(Op1->getType())); return &I; @@ -6669,10 +6546,10 @@ Instruction *InstCombiner::FoldICmpDivCst(ICmpInst &ICI, BinaryOperator *DivI, if (LoOverflow && HiOverflow) return ReplaceInstUsesWith(ICI, ConstantInt::getFalse(*Context)); else if (HiOverflow) - return new ICmpInst(*Context, DivIsSigned ? ICmpInst::ICMP_SGE : + return new ICmpInst(DivIsSigned ? ICmpInst::ICMP_SGE : ICmpInst::ICMP_UGE, X, LoBound); else if (LoOverflow) - return new ICmpInst(*Context, DivIsSigned ? ICmpInst::ICMP_SLT : + return new ICmpInst(DivIsSigned ? ICmpInst::ICMP_SLT : ICmpInst::ICMP_ULT, X, HiBound); else return InsertRangeTest(X, LoBound, HiBound, DivIsSigned, true, ICI); @@ -6680,10 +6557,10 @@ Instruction *InstCombiner::FoldICmpDivCst(ICmpInst &ICI, BinaryOperator *DivI, if (LoOverflow && HiOverflow) return ReplaceInstUsesWith(ICI, ConstantInt::getTrue(*Context)); else if (HiOverflow) - return new ICmpInst(*Context, DivIsSigned ? ICmpInst::ICMP_SLT : + return new ICmpInst(DivIsSigned ? ICmpInst::ICMP_SLT : ICmpInst::ICMP_ULT, X, LoBound); else if (LoOverflow) - return new ICmpInst(*Context, DivIsSigned ? ICmpInst::ICMP_SGE : + return new ICmpInst(DivIsSigned ? ICmpInst::ICMP_SGE : ICmpInst::ICMP_UGE, X, HiBound); else return InsertRangeTest(X, LoBound, HiBound, DivIsSigned, false, ICI); @@ -6693,7 +6570,7 @@ Instruction *InstCombiner::FoldICmpDivCst(ICmpInst &ICI, BinaryOperator *DivI, return ReplaceInstUsesWith(ICI, ConstantInt::getTrue(*Context)); if (LoOverflow == -1) // Low bound is less than input range. return ReplaceInstUsesWith(ICI, ConstantInt::getFalse(*Context)); - return new ICmpInst(*Context, Pred, X, LoBound); + return new ICmpInst(Pred, X, LoBound); case ICmpInst::ICMP_UGT: case ICmpInst::ICMP_SGT: if (HiOverflow == +1) // High bound greater than input range. @@ -6701,9 +6578,9 @@ Instruction *InstCombiner::FoldICmpDivCst(ICmpInst &ICI, BinaryOperator *DivI, else if (HiOverflow == -1) // High bound less than input range. return ReplaceInstUsesWith(ICI, ConstantInt::getTrue(*Context)); if (Pred == ICmpInst::ICMP_UGT) - return new ICmpInst(*Context, ICmpInst::ICMP_UGE, X, HiBound); + return new ICmpInst(ICmpInst::ICMP_UGE, X, HiBound); else - return new ICmpInst(*Context, ICmpInst::ICMP_SGE, X, HiBound); + return new ICmpInst(ICmpInst::ICMP_SGE, X, HiBound); } } @@ -6732,7 +6609,7 @@ Instruction *InstCombiner::visitICmpInstWithInstAndIntCst(ICmpInst &ICI, APInt NewRHS(RHS->getValue()); NewRHS.zext(SrcBits); NewRHS |= KnownOne; - return new ICmpInst(*Context, ICI.getPredicate(), LHSI->getOperand(0), + return new ICmpInst(ICI.getPredicate(), LHSI->getOperand(0), ConstantInt::get(*Context, NewRHS)); } } @@ -6750,7 +6627,7 @@ Instruction *InstCombiner::visitICmpInstWithInstAndIntCst(ICmpInst &ICI, // the operation, just stop using the Xor. if (!XorCST->getValue().isNegative()) { ICI.setOperand(0, CompareVal); - AddToWorkList(LHSI); + Worklist.Add(LHSI); return &ICI; } @@ -6761,10 +6638,10 @@ Instruction *InstCombiner::visitICmpInstWithInstAndIntCst(ICmpInst &ICI, isTrueIfPositive ^= true; if (isTrueIfPositive) - return new ICmpInst(*Context, ICmpInst::ICMP_SGT, CompareVal, + return new ICmpInst(ICmpInst::ICMP_SGT, CompareVal, SubOne(RHS)); else - return new ICmpInst(*Context, ICmpInst::ICMP_SLT, CompareVal, + return new ICmpInst(ICmpInst::ICMP_SLT, CompareVal, AddOne(RHS)); } @@ -6775,7 +6652,7 @@ Instruction *InstCombiner::visitICmpInstWithInstAndIntCst(ICmpInst &ICI, ICmpInst::Predicate Pred = ICI.isSignedPredicate() ? ICI.getUnsignedPredicate() : ICI.getSignedPredicate(); - return new ICmpInst(*Context, Pred, LHSI->getOperand(0), + return new ICmpInst(Pred, LHSI->getOperand(0), ConstantInt::get(*Context, RHSV ^ SignBit)); } @@ -6786,7 +6663,7 @@ Instruction *InstCombiner::visitICmpInstWithInstAndIntCst(ICmpInst &ICI, ? ICI.getUnsignedPredicate() : ICI.getSignedPredicate(); Pred = ICI.getSwappedPredicate(Pred); - return new ICmpInst(*Context, Pred, LHSI->getOperand(0), + return new ICmpInst(Pred, LHSI->getOperand(0), ConstantInt::get(*Context, RHSV ^ NotSignBit)); } } @@ -6814,11 +6691,10 @@ Instruction *InstCombiner::visitICmpInstWithInstAndIntCst(ICmpInst &ICI, NewCST.zext(BitWidth); APInt NewCI = RHSV; NewCI.zext(BitWidth); - Instruction *NewAnd = - BinaryOperator::CreateAnd(Cast->getOperand(0), + Value *NewAnd = + Builder->CreateAnd(Cast->getOperand(0), ConstantInt::get(*Context, NewCST), LHSI->getName()); - InsertNewInstBefore(NewAnd, ICI); - return new ICmpInst(*Context, ICI.getPredicate(), NewAnd, + return new ICmpInst(ICI.getPredicate(), NewAnd, ConstantInt::get(*Context, NewCI)); } } @@ -6880,8 +6756,7 @@ Instruction *InstCombiner::visitICmpInstWithInstAndIntCst(ICmpInst &ICI, NewAndCST = ConstantExpr::getShl(AndCST, ShAmt); LHSI->setOperand(1, NewAndCST); LHSI->setOperand(0, Shift->getOperand(0)); - AddToWorkList(Shift); // Shift is dead. - AddUsesToWorkList(ICI); + Worklist.Add(Shift); // Shift is dead. return &ICI; } } @@ -6896,19 +6771,15 @@ Instruction *InstCombiner::visitICmpInstWithInstAndIntCst(ICmpInst &ICI, // Compute C << Y. Value *NS; if (Shift->getOpcode() == Instruction::LShr) { - NS = BinaryOperator::CreateShl(AndCST, - Shift->getOperand(1), "tmp"); + NS = Builder->CreateShl(AndCST, Shift->getOperand(1), "tmp"); } else { // Insert a logical shift. - NS = BinaryOperator::CreateLShr(AndCST, - Shift->getOperand(1), "tmp"); + NS = Builder->CreateLShr(AndCST, Shift->getOperand(1), "tmp"); } - InsertNewInstBefore(cast(NS), ICI); // Compute X & (C << Y). - Instruction *NewAnd = - BinaryOperator::CreateAnd(Shift->getOperand(0), NS, LHSI->getName()); - InsertNewInstBefore(NewAnd, ICI); + Value *NewAnd = + Builder->CreateAnd(Shift->getOperand(0), NS, LHSI->getName()); ICI.setOperand(0, NewAnd); return &ICI; @@ -6947,11 +6818,9 @@ Instruction *InstCombiner::visitICmpInstWithInstAndIntCst(ICmpInst &ICI, ConstantInt::get(*Context, APInt::getLowBitsSet(TypeBits, TypeBits-ShAmtVal)); - Instruction *AndI = - BinaryOperator::CreateAnd(LHSI->getOperand(0), - Mask, LHSI->getName()+".mask"); - Value *And = InsertNewInstBefore(AndI, ICI); - return new ICmpInst(*Context, ICI.getPredicate(), And, + Value *And = + Builder->CreateAnd(LHSI->getOperand(0),Mask, LHSI->getName()+".mask"); + return new ICmpInst(ICI.getPredicate(), And, ConstantInt::get(*Context, RHSV.lshr(ShAmtVal))); } } @@ -6963,13 +6832,9 @@ Instruction *InstCombiner::visitICmpInstWithInstAndIntCst(ICmpInst &ICI, // (X << 31) (X&1) != 0 Constant *Mask = ConstantInt::get(*Context, APInt(TypeBits, 1) << (TypeBits-ShAmt->getZExtValue()-1)); - Instruction *AndI = - BinaryOperator::CreateAnd(LHSI->getOperand(0), - Mask, LHSI->getName()+".mask"); - Value *And = InsertNewInstBefore(AndI, ICI); - - return new ICmpInst(*Context, - TrueIfSigned ? ICmpInst::ICMP_NE : ICmpInst::ICMP_EQ, + Value *And = + Builder->CreateAnd(LHSI->getOperand(0), Mask, LHSI->getName()+".mask"); + return new ICmpInst(TrueIfSigned ? ICmpInst::ICMP_NE : ICmpInst::ICMP_EQ, And, Constant::getNullValue(And->getType())); } break; @@ -7010,7 +6875,7 @@ Instruction *InstCombiner::visitICmpInstWithInstAndIntCst(ICmpInst &ICI, if (LHSI->hasOneUse() && MaskedValueIsZero(LHSI->getOperand(0), APInt::getLowBitsSet(Comp.getBitWidth(), ShAmtVal))) { - return new ICmpInst(*Context, ICI.getPredicate(), LHSI->getOperand(0), + return new ICmpInst(ICI.getPredicate(), LHSI->getOperand(0), ConstantExpr::getShl(RHS, ShAmt)); } @@ -7019,11 +6884,9 @@ Instruction *InstCombiner::visitICmpInstWithInstAndIntCst(ICmpInst &ICI, APInt Val(APInt::getHighBitsSet(TypeBits, TypeBits - ShAmtVal)); Constant *Mask = ConstantInt::get(*Context, Val); - Instruction *AndI = - BinaryOperator::CreateAnd(LHSI->getOperand(0), - Mask, LHSI->getName()+".mask"); - Value *And = InsertNewInstBefore(AndI, ICI); - return new ICmpInst(*Context, ICI.getPredicate(), And, + Value *And = Builder->CreateAnd(LHSI->getOperand(0), + Mask, LHSI->getName()+".mask"); + return new ICmpInst(ICI.getPredicate(), And, ConstantExpr::getShl(RHS, ShAmt)); } break; @@ -7056,18 +6919,18 @@ Instruction *InstCombiner::visitICmpInstWithInstAndIntCst(ICmpInst &ICI, if (ICI.isSignedPredicate()) { if (CR.getLower().isSignBit()) { - return new ICmpInst(*Context, ICmpInst::ICMP_SLT, LHSI->getOperand(0), + return new ICmpInst(ICmpInst::ICMP_SLT, LHSI->getOperand(0), ConstantInt::get(*Context, CR.getUpper())); } else if (CR.getUpper().isSignBit()) { - return new ICmpInst(*Context, ICmpInst::ICMP_SGE, LHSI->getOperand(0), + return new ICmpInst(ICmpInst::ICMP_SGE, LHSI->getOperand(0), ConstantInt::get(*Context, CR.getLower())); } } else { if (CR.getLower().isMinValue()) { - return new ICmpInst(*Context, ICmpInst::ICMP_ULT, LHSI->getOperand(0), + return new ICmpInst(ICmpInst::ICMP_ULT, LHSI->getOperand(0), ConstantInt::get(*Context, CR.getUpper())); } else if (CR.getUpper().isMinValue()) { - return new ICmpInst(*Context, ICmpInst::ICMP_UGE, LHSI->getOperand(0), + return new ICmpInst(ICmpInst::ICMP_UGE, LHSI->getOperand(0), ConstantInt::get(*Context, CR.getLower())); } } @@ -7088,11 +6951,10 @@ Instruction *InstCombiner::visitICmpInstWithInstAndIntCst(ICmpInst &ICI, if (RHSV == 0 && isa(BO->getOperand(1)) &&BO->hasOneUse()){ const APInt &V = cast(BO->getOperand(1))->getValue(); if (V.sgt(APInt(V.getBitWidth(), 1)) && V.isPowerOf2()) { - Instruction *NewRem = - BinaryOperator::CreateURem(BO->getOperand(0), BO->getOperand(1), - BO->getName()); - InsertNewInstBefore(NewRem, ICI); - return new ICmpInst(*Context, ICI.getPredicate(), NewRem, + Value *NewRem = + Builder->CreateURem(BO->getOperand(0), BO->getOperand(1), + BO->getName()); + return new ICmpInst(ICI.getPredicate(), NewRem, Constant::getNullValue(BO->getType())); } } @@ -7101,7 +6963,7 @@ Instruction *InstCombiner::visitICmpInstWithInstAndIntCst(ICmpInst &ICI, // Replace ((add A, B) != C) with (A != C-B) if B & C are constants. if (ConstantInt *BOp1C = dyn_cast(BO->getOperand(1))) { if (BO->hasOneUse()) - return new ICmpInst(*Context, ICI.getPredicate(), BO->getOperand(0), + return new ICmpInst(ICI.getPredicate(), BO->getOperand(0), ConstantExpr::getSub(RHS, BOp1C)); } else if (RHSV == 0) { // Replace ((add A, B) != 0) with (A != -B) if A or B is @@ -7109,14 +6971,13 @@ Instruction *InstCombiner::visitICmpInstWithInstAndIntCst(ICmpInst &ICI, Value *BOp0 = BO->getOperand(0), *BOp1 = BO->getOperand(1); if (Value *NegVal = dyn_castNegVal(BOp1)) - return new ICmpInst(*Context, ICI.getPredicate(), BOp0, NegVal); + return new ICmpInst(ICI.getPredicate(), BOp0, NegVal); else if (Value *NegVal = dyn_castNegVal(BOp0)) - return new ICmpInst(*Context, ICI.getPredicate(), NegVal, BOp1); + return new ICmpInst(ICI.getPredicate(), NegVal, BOp1); else if (BO->hasOneUse()) { - Instruction *Neg = BinaryOperator::CreateNeg(BOp1); - InsertNewInstBefore(Neg, ICI); + Value *Neg = Builder->CreateNeg(BOp1); Neg->takeName(BO); - return new ICmpInst(*Context, ICI.getPredicate(), BOp0, Neg); + return new ICmpInst(ICI.getPredicate(), BOp0, Neg); } } break; @@ -7124,14 +6985,14 @@ Instruction *InstCombiner::visitICmpInstWithInstAndIntCst(ICmpInst &ICI, // For the xor case, we can xor two constants together, eliminating // the explicit xor. if (Constant *BOC = dyn_cast(BO->getOperand(1))) - return new ICmpInst(*Context, ICI.getPredicate(), BO->getOperand(0), + return new ICmpInst(ICI.getPredicate(), BO->getOperand(0), ConstantExpr::getXor(RHS, BOC)); // FALLTHROUGH case Instruction::Sub: // Replace (([sub|xor] A, B) != 0) with (A != B) if (RHSV == 0) - return new ICmpInst(*Context, ICI.getPredicate(), BO->getOperand(0), + return new ICmpInst(ICI.getPredicate(), BO->getOperand(0), BO->getOperand(1)); break; @@ -7158,7 +7019,7 @@ Instruction *InstCombiner::visitICmpInstWithInstAndIntCst(ICmpInst &ICI, // If we have ((X & C) == C), turn it into ((X & C) != 0). if (RHS == BOC && RHSV.isPowerOf2()) - return new ICmpInst(*Context, isICMP_NE ? ICmpInst::ICMP_EQ : + return new ICmpInst(isICMP_NE ? ICmpInst::ICMP_EQ : ICmpInst::ICMP_NE, LHSI, Constant::getNullValue(RHS->getType())); @@ -7168,7 +7029,7 @@ Instruction *InstCombiner::visitICmpInstWithInstAndIntCst(ICmpInst &ICI, Constant *Zero = Constant::getNullValue(X->getType()); ICmpInst::Predicate pred = isICMP_NE ? ICmpInst::ICMP_SLT : ICmpInst::ICMP_SGE; - return new ICmpInst(*Context, pred, X, Zero); + return new ICmpInst(pred, X, Zero); } // ((X & ~7) == 0) --> X < 8 @@ -7177,7 +7038,7 @@ Instruction *InstCombiner::visitICmpInstWithInstAndIntCst(ICmpInst &ICI, Constant *NegX = ConstantExpr::getNeg(BOC); ICmpInst::Predicate pred = isICMP_NE ? ICmpInst::ICMP_UGE : ICmpInst::ICMP_ULT; - return new ICmpInst(*Context, pred, X, NegX); + return new ICmpInst(pred, X, NegX); } } default: break; @@ -7185,7 +7046,7 @@ Instruction *InstCombiner::visitICmpInstWithInstAndIntCst(ICmpInst &ICI, } else if (IntrinsicInst *II = dyn_cast(LHSI)) { // Handle icmp {eq|ne} , intcst. if (II->getIntrinsicID() == Intrinsic::bswap) { - AddToWorkList(II); + Worklist.Add(II); ICI.setOperand(0, II->getOperand(1)); ICI.setOperand(1, ConstantInt::get(*Context, RHSV.byteSwap())); return &ICI; @@ -7217,11 +7078,11 @@ Instruction *InstCombiner::visitICmpInstWithCastAndCast(ICmpInst &ICI) { RHSOp = RHSC->getOperand(0); // If the pointer types don't match, insert a bitcast. if (LHSCIOp->getType() != RHSOp->getType()) - RHSOp = InsertBitCastBefore(RHSOp, LHSCIOp->getType(), ICI); + RHSOp = Builder->CreateBitCast(RHSOp, LHSCIOp->getType()); } if (RHSOp) - return new ICmpInst(*Context, ICI.getPredicate(), LHSCIOp, RHSOp); + return new ICmpInst(ICI.getPredicate(), LHSCIOp, RHSOp); } // The code below only handles extension cast instructions, so far. @@ -7246,15 +7107,15 @@ Instruction *InstCombiner::visitICmpInstWithCastAndCast(ICmpInst &ICI) { // Deal with equality cases early. if (ICI.isEquality()) - return new ICmpInst(*Context, ICI.getPredicate(), LHSCIOp, RHSCIOp); + return new ICmpInst(ICI.getPredicate(), LHSCIOp, RHSCIOp); // A signed comparison of sign extended values simplifies into a // signed comparison. if (isSignedCmp && isSignedExt) - return new ICmpInst(*Context, ICI.getPredicate(), LHSCIOp, RHSCIOp); + return new ICmpInst(ICI.getPredicate(), LHSCIOp, RHSCIOp); // The other three cases all fold into an unsigned comparison. - return new ICmpInst(*Context, ICI.getUnsignedPredicate(), LHSCIOp, RHSCIOp); + return new ICmpInst(ICI.getUnsignedPredicate(), LHSCIOp, RHSCIOp); } // If we aren't dealing with a constant on the RHS, exit early @@ -7281,7 +7142,7 @@ Instruction *InstCombiner::visitICmpInstWithCastAndCast(ICmpInst &ICI) { // However, we allow this when the compare is EQ/NE, because they are // signless. if (isSignedExt == isSignedCmp || ICI.isEquality()) - return new ICmpInst(*Context, ICI.getPredicate(), LHSCIOp, Res1); + return new ICmpInst(ICI.getPredicate(), LHSCIOp, Res1); return 0; } @@ -7310,8 +7171,7 @@ Instruction *InstCombiner::visitICmpInstWithCastAndCast(ICmpInst &ICI) { // We're performing an unsigned comp with a sign extended value. // This is true if the input is >= 0. [aka >s -1] Constant *NegOne = Constant::getAllOnesValue(SrcTy); - Result = InsertNewInstBefore(new ICmpInst(*Context, ICmpInst::ICMP_SGT, - LHSCIOp, NegOne, ICI.getName()), ICI); + Result = Builder->CreateICmpSGT(LHSCIOp, NegOne, ICI.getName()); } else { // Unsigned extend & unsigned compare -> always true. Result = ConstantInt::getTrue(*Context); @@ -7449,9 +7309,8 @@ Instruction *InstCombiner::FoldShiftByConstant(Value *Op0, ConstantInt *Op1, isa(TrOp->getOperand(1))) { // Okay, we'll do this xform. Make the shift of shift. Constant *ShAmt = ConstantExpr::getZExt(Op1, TrOp->getType()); - Instruction *NSh = BinaryOperator::Create(I.getOpcode(), TrOp, ShAmt, - I.getName()); - InsertNewInstBefore(NSh, I); // (shift2 (shift1 & 0x00FF), c2) + // (shift2 (shift1 & 0x00FF), c2) + Value *NSh = Builder->CreateBinOp(I.getOpcode(), TrOp, ShAmt,I.getName()); // For logical shifts, the truncation has the effect of making the high // part of the register be zeros. Emulate this by inserting an AND to @@ -7472,10 +7331,9 @@ Instruction *InstCombiner::FoldShiftByConstant(Value *Op0, ConstantInt *Op1, MaskV = MaskV.lshr(Op1->getZExtValue()); } - Instruction *And = - BinaryOperator::CreateAnd(NSh, ConstantInt::get(*Context, MaskV), - TI->getName()); - InsertNewInstBefore(And, I); // shift1 & 0x00FF + // shift1 & 0x00FF + Value *And = Builder->CreateAnd(NSh, ConstantInt::get(*Context, MaskV), + TI->getName()); // Return the value truncated to the interesting size. return new TruncInst(And, I.getType()); @@ -7497,15 +7355,12 @@ Instruction *InstCombiner::FoldShiftByConstant(Value *Op0, ConstantInt *Op1, // Turn (Y + (X >> C)) << C -> (X + (Y << C)) & (~0 << C) if (isLeftShift && Op0BO->getOperand(1)->hasOneUse() && match(Op0BO->getOperand(1), m_Shr(m_Value(V1), - m_Specific(Op1)))){ - Instruction *YS = BinaryOperator::CreateShl( - Op0BO->getOperand(0), Op1, - Op0BO->getName()); - InsertNewInstBefore(YS, I); // (Y << C) - Instruction *X = - BinaryOperator::Create(Op0BO->getOpcode(), YS, V1, - Op0BO->getOperand(1)->getName()); - InsertNewInstBefore(X, I); // (X + (Y << C)) + m_Specific(Op1)))) { + Value *YS = // (Y << C) + Builder->CreateShl(Op0BO->getOperand(0), Op1, Op0BO->getName()); + // (X + (Y << C)) + Value *X = Builder->CreateBinOp(Op0BO->getOpcode(), YS, V1, + Op0BO->getOperand(1)->getName()); uint32_t Op1Val = Op1->getLimitedValue(TypeBits); return BinaryOperator::CreateAnd(X, ConstantInt::get(*Context, APInt::getHighBitsSet(TypeBits, TypeBits-Op1Val))); @@ -7518,16 +7373,12 @@ Instruction *InstCombiner::FoldShiftByConstant(Value *Op0, ConstantInt *Op1, m_And(m_Shr(m_Value(V1), m_Specific(Op1)), m_ConstantInt(CC))) && cast(Op0BOOp1)->getOperand(0)->hasOneUse()) { - Instruction *YS = BinaryOperator::CreateShl( - Op0BO->getOperand(0), Op1, - Op0BO->getName()); - InsertNewInstBefore(YS, I); // (Y << C) - Instruction *XM = - BinaryOperator::CreateAnd(V1, - ConstantExpr::getShl(CC, Op1), - V1->getName()+".mask"); - InsertNewInstBefore(XM, I); // X & (CC << C) - + Value *YS = // (Y << C) + Builder->CreateShl(Op0BO->getOperand(0), Op1, + Op0BO->getName()); + // X & (CC << C) + Value *XM = Builder->CreateAnd(V1, ConstantExpr::getShl(CC, Op1), + V1->getName()+".mask"); return BinaryOperator::Create(Op0BO->getOpcode(), YS, XM); } } @@ -7538,14 +7389,11 @@ Instruction *InstCombiner::FoldShiftByConstant(Value *Op0, ConstantInt *Op1, if (isLeftShift && Op0BO->getOperand(0)->hasOneUse() && match(Op0BO->getOperand(0), m_Shr(m_Value(V1), m_Specific(Op1)))) { - Instruction *YS = BinaryOperator::CreateShl( - Op0BO->getOperand(1), Op1, - Op0BO->getName()); - InsertNewInstBefore(YS, I); // (Y << C) - Instruction *X = - BinaryOperator::Create(Op0BO->getOpcode(), V1, YS, - Op0BO->getOperand(0)->getName()); - InsertNewInstBefore(X, I); // (X + (Y << C)) + Value *YS = // (Y << C) + Builder->CreateShl(Op0BO->getOperand(1), Op1, Op0BO->getName()); + // (X + (Y << C)) + Value *X = Builder->CreateBinOp(Op0BO->getOpcode(), V1, YS, + Op0BO->getOperand(0)->getName()); uint32_t Op1Val = Op1->getLimitedValue(TypeBits); return BinaryOperator::CreateAnd(X, ConstantInt::get(*Context, APInt::getHighBitsSet(TypeBits, TypeBits-Op1Val))); @@ -7558,15 +7406,11 @@ Instruction *InstCombiner::FoldShiftByConstant(Value *Op0, ConstantInt *Op1, m_ConstantInt(CC))) && V2 == Op1 && cast(Op0BO->getOperand(0)) ->getOperand(0)->hasOneUse()) { - Instruction *YS = BinaryOperator::CreateShl( - Op0BO->getOperand(1), Op1, - Op0BO->getName()); - InsertNewInstBefore(YS, I); // (Y << C) - Instruction *XM = - BinaryOperator::CreateAnd(V1, - ConstantExpr::getShl(CC, Op1), - V1->getName()+".mask"); - InsertNewInstBefore(XM, I); // X & (CC << C) + Value *YS = // (Y << C) + Builder->CreateShl(Op0BO->getOperand(1), Op1, Op0BO->getName()); + // X & (CC << C) + Value *XM = Builder->CreateAnd(V1, ConstantExpr::getShl(CC, Op1), + V1->getName()+".mask"); return BinaryOperator::Create(Op0BO->getOpcode(), XM, YS); } @@ -7608,9 +7452,8 @@ Instruction *InstCombiner::FoldShiftByConstant(Value *Op0, ConstantInt *Op1, if (isValid) { Constant *NewRHS = ConstantExpr::get(I.getOpcode(), Op0C, Op1); - Instruction *NewShift = - BinaryOperator::Create(I.getOpcode(), Op0BO->getOperand(0), Op1); - InsertNewInstBefore(NewShift, I); + Value *NewShift = + Builder->CreateBinOp(I.getOpcode(), Op0BO->getOperand(0), Op1); NewShift->takeName(Op0BO); return BinaryOperator::Create(Op0BO->getOpcode(), NewShift, @@ -7649,22 +7492,24 @@ Instruction *InstCombiner::FoldShiftByConstant(Value *Op0, ConstantInt *Op1, return BinaryOperator::Create(I.getOpcode(), X, ConstantInt::get(Ty, AmtSum)); - } else if (ShiftOp->getOpcode() == Instruction::LShr && - I.getOpcode() == Instruction::AShr) { + } + + if (ShiftOp->getOpcode() == Instruction::LShr && + I.getOpcode() == Instruction::AShr) { if (AmtSum >= TypeBits) return ReplaceInstUsesWith(I, Constant::getNullValue(I.getType())); // ((X >>u C1) >>s C2) -> (X >>u (C1+C2)) since C1 != 0. return BinaryOperator::CreateLShr(X, ConstantInt::get(Ty, AmtSum)); - } else if (ShiftOp->getOpcode() == Instruction::AShr && - I.getOpcode() == Instruction::LShr) { + } + + if (ShiftOp->getOpcode() == Instruction::AShr && + I.getOpcode() == Instruction::LShr) { // ((X >>s C1) >>u C2) -> ((X >>s (C1+C2)) & mask) since C1 != 0. if (AmtSum >= TypeBits) AmtSum = TypeBits-1; - Instruction *Shift = - BinaryOperator::CreateAShr(X, ConstantInt::get(Ty, AmtSum)); - InsertNewInstBefore(Shift, I); + Value *Shift = Builder->CreateAShr(X, ConstantInt::get(Ty, AmtSum)); APInt Mask(APInt::getLowBitsSet(TypeBits, TypeBits - ShiftAmt2)); return BinaryOperator::CreateAnd(Shift, ConstantInt::get(*Context, Mask)); @@ -7699,11 +7544,8 @@ Instruction *InstCombiner::FoldShiftByConstant(Value *Op0, ConstantInt *Op1, break; default: break; } - if (SExtType) { - Instruction *NewTrunc = new TruncInst(X, SExtType, "sext"); - InsertNewInstBefore(NewTrunc, I); - return new SExtInst(NewTrunc, Ty); - } + if (SExtType) + return new SExtInst(Builder->CreateTrunc(X, SExtType, "sext"), Ty); // Otherwise, we can't handle it yet. } else if (ShiftAmt1 < ShiftAmt2) { uint32_t ShiftDiff = ShiftAmt2-ShiftAmt1; @@ -7712,9 +7554,7 @@ Instruction *InstCombiner::FoldShiftByConstant(Value *Op0, ConstantInt *Op1, if (I.getOpcode() == Instruction::Shl) { assert(ShiftOp->getOpcode() == Instruction::LShr || ShiftOp->getOpcode() == Instruction::AShr); - Instruction *Shift = - BinaryOperator::CreateShl(X, ConstantInt::get(Ty, ShiftDiff)); - InsertNewInstBefore(Shift, I); + Value *Shift = Builder->CreateShl(X, ConstantInt::get(Ty, ShiftDiff)); APInt Mask(APInt::getHighBitsSet(TypeBits, TypeBits - ShiftAmt2)); return BinaryOperator::CreateAnd(Shift, @@ -7724,9 +7564,7 @@ Instruction *InstCombiner::FoldShiftByConstant(Value *Op0, ConstantInt *Op1, // (X << C1) >>u C2 --> X >>u (C2-C1) & (-1 >> C2) if (I.getOpcode() == Instruction::LShr) { assert(ShiftOp->getOpcode() == Instruction::Shl); - Instruction *Shift = - BinaryOperator::CreateLShr(X, ConstantInt::get(Ty, ShiftDiff)); - InsertNewInstBefore(Shift, I); + Value *Shift = Builder->CreateLShr(X, ConstantInt::get(Ty, ShiftDiff)); APInt Mask(APInt::getLowBitsSet(TypeBits, TypeBits - ShiftAmt2)); return BinaryOperator::CreateAnd(Shift, @@ -7742,10 +7580,8 @@ Instruction *InstCombiner::FoldShiftByConstant(Value *Op0, ConstantInt *Op1, if (I.getOpcode() == Instruction::Shl) { assert(ShiftOp->getOpcode() == Instruction::LShr || ShiftOp->getOpcode() == Instruction::AShr); - Instruction *Shift = - BinaryOperator::Create(ShiftOp->getOpcode(), X, - ConstantInt::get(Ty, ShiftDiff)); - InsertNewInstBefore(Shift, I); + Value *Shift = Builder->CreateBinOp(ShiftOp->getOpcode(), X, + ConstantInt::get(Ty, ShiftDiff)); APInt Mask(APInt::getHighBitsSet(TypeBits, TypeBits - ShiftAmt2)); return BinaryOperator::CreateAnd(Shift, @@ -7755,9 +7591,7 @@ Instruction *InstCombiner::FoldShiftByConstant(Value *Op0, ConstantInt *Op1, // (X << C1) >>u C2 --> X << (C1-C2) & (-1 >> C2) if (I.getOpcode() == Instruction::LShr) { assert(ShiftOp->getOpcode() == Instruction::Shl); - Instruction *Shift = - BinaryOperator::CreateShl(X, ConstantInt::get(Ty, ShiftDiff)); - InsertNewInstBefore(Shift, I); + Value *Shift = Builder->CreateShl(X, ConstantInt::get(Ty, ShiftDiff)); APInt Mask(APInt::getLowBitsSet(TypeBits, TypeBits - ShiftAmt2)); return BinaryOperator::CreateAnd(Shift, @@ -7777,7 +7611,8 @@ Instruction *InstCombiner::FoldShiftByConstant(Value *Op0, ConstantInt *Op1, /// static Value *DecomposeSimpleLinearExpr(Value *Val, unsigned &Scale, int &Offset, LLVMContext *Context) { - assert(Val->getType() == Type::getInt32Ty(*Context) && "Unexpected allocation size type!"); + assert(Val->getType() == Type::getInt32Ty(*Context) && + "Unexpected allocation size type!"); if (ConstantInt *CI = dyn_cast(Val)) { Offset = CI->getZExtValue(); Scale = 0; @@ -7821,6 +7656,9 @@ Instruction *InstCombiner::PromoteCastOfAllocation(BitCastInst &CI, AllocationInst &AI) { const PointerType *PTy = cast(CI.getType()); + BuilderTy AllocaBuilder(*Builder); + AllocaBuilder.SetInsertPoint(AI.getParent(), &AI); + // Remove any uses of AI that are dead. assert(!CI.use_empty() && "Dead instructions should be removed earlier!"); @@ -7877,30 +7715,22 @@ Instruction *InstCombiner::PromoteCastOfAllocation(BitCastInst &CI, if (Scale == 1) { Amt = NumElements; } else { - // If the allocation size is constant, form a constant mul expression Amt = ConstantInt::get(Type::getInt32Ty(*Context), Scale); - if (isa(NumElements)) - Amt = ConstantExpr::getMul(cast(NumElements), - cast(Amt)); - // otherwise multiply the amount and the number of elements - else { - Instruction *Tmp = BinaryOperator::CreateMul(Amt, NumElements, "tmp"); - Amt = InsertNewInstBefore(Tmp, AI); - } + // Insert before the alloca, not before the cast. + Amt = AllocaBuilder.CreateMul(Amt, NumElements, "tmp"); } if (int Offset = (AllocElTySize*ArrayOffset)/CastElTySize) { Value *Off = ConstantInt::get(Type::getInt32Ty(*Context), Offset, true); - Instruction *Tmp = BinaryOperator::CreateAdd(Amt, Off, "tmp"); - Amt = InsertNewInstBefore(Tmp, AI); + Amt = AllocaBuilder.CreateAdd(Amt, Off, "tmp"); } AllocationInst *New; if (isa(AI)) - New = new MallocInst(CastElTy, Amt, AI.getAlignment()); + New = AllocaBuilder.CreateMalloc(CastElTy, Amt); else - New = new AllocaInst(CastElTy, Amt, AI.getAlignment()); - InsertNewInstBefore(New, AI); + New = AllocaBuilder.CreateAlloca(CastElTy, Amt); + New->setAlignment(AI.getAlignment()); New->takeName(&AI); // If the allocation has one real use plus a dbg.declare, just remove the @@ -7912,11 +7742,9 @@ Instruction *InstCombiner::PromoteCastOfAllocation(BitCastInst &CI, // things that used it to use the new cast. This will also hack on CI, but it // will die soon. else if (!AI.hasOneUse()) { - AddUsesToWorkList(AI); // New is the allocation instruction, pointer typed. AI is the original // allocation instruction, also pointer typed. Thus, cast to use is BitCast. - CastInst *NewCast = new BitCastInst(New, AI.getType(), "tmpcast"); - InsertNewInstBefore(NewCast, AI); + Value *NewCast = AllocaBuilder.CreateBitCast(New, AI.getType(), "tmpcast"); AI.replaceAllUsesWith(NewCast); } return ReplaceInstUsesWith(CI, New); @@ -8235,7 +8063,7 @@ Instruction *InstCombiner::commonPointerCastTransforms(CastInst &CI) { // Changing the cast operand is usually not a good idea but it is safe // here because the pointer operand is being replaced with another // pointer operand so the opcode doesn't need to change. - AddToWorkList(GEP); + Worklist.Add(GEP); CI.setOperand(0, GEP->getOperand(0)); return &CI; } @@ -8260,12 +8088,10 @@ Instruction *InstCombiner::commonPointerCastTransforms(CastInst &CI) { // If we were able to index down into an element, create the GEP // and bitcast the result. This eliminates one bitcast, potentially // two. - Instruction *NGEP = GetElementPtrInst::Create(OrigBase, - NewIndices.begin(), - NewIndices.end(), ""); - InsertNewInstBefore(NGEP, CI); + Value *NGEP = Builder->CreateGEP(OrigBase, NewIndices.begin(), + NewIndices.end()); NGEP->takeName(GEP); - if (cast(GEP)->isInBounds()) + if (isa(NGEP) && cast(GEP)->isInBounds()) cast(NGEP)->setIsInBounds(true); if (isa(CI)) @@ -8423,9 +8249,7 @@ Instruction *InstCombiner::commonIntCastTransforms(CastInst &CI) { return ReplaceInstUsesWith(CI, Res); // We need to emit a cast to truncate, then a cast to sext. - return CastInst::Create(Instruction::SExt, - InsertCastBefore(Instruction::Trunc, Res, Src->getType(), - CI), DestTy); + return new SExtInst(Builder->CreateTrunc(Res, Src->getType()), DestTy); } } } @@ -8445,8 +8269,8 @@ Instruction *InstCombiner::commonIntCastTransforms(CastInst &CI) { // Don't insert two casts unless at least one can be eliminated. if (!ValueRequiresCast(CI.getOpcode(), Op1, DestTy, TD) || !ValueRequiresCast(CI.getOpcode(), Op0, DestTy, TD)) { - Value *Op0c = InsertCastBefore(Instruction::Trunc, Op0, DestTy, *SrcI); - Value *Op1c = InsertCastBefore(Instruction::Trunc, Op1, DestTy, *SrcI); + Value *Op0c = Builder->CreateTrunc(Op0, DestTy, Op0->getName()); + Value *Op1c = Builder->CreateTrunc(Op1, DestTy, Op1->getName()); return BinaryOperator::Create( cast(SrcI)->getOpcode(), Op0c, Op1c); } @@ -8457,7 +8281,7 @@ Instruction *InstCombiner::commonIntCastTransforms(CastInst &CI) { SrcI->getOpcode() == Instruction::Xor && Op1 == ConstantInt::getTrue(*Context) && (!Op0->hasOneUse() || !isa(Op0))) { - Value *New = InsertCastBefore(Instruction::ZExt, Op0, DestTy, CI); + Value *New = Builder->CreateZExt(Op0, DestTy, Op0->getName()); return BinaryOperator::CreateXor(New, ConstantInt::get(CI.getType(), 1)); } @@ -8468,8 +8292,8 @@ Instruction *InstCombiner::commonIntCastTransforms(CastInst &CI) { ConstantInt *CI = dyn_cast(Op1); if (CI && DestBitSize < SrcBitSize && CI->getLimitedValue(DestBitSize) < DestBitSize) { - Value *Op0c = InsertCastBefore(Instruction::Trunc, Op0, DestTy, *SrcI); - Value *Op1c = InsertCastBefore(Instruction::Trunc, Op1, DestTy, *SrcI); + Value *Op0c = Builder->CreateTrunc(Op0, DestTy, Op0->getName()); + Value *Op1c = Builder->CreateTrunc(Op1, DestTy, Op1->getName()); return BinaryOperator::CreateShl(Op0c, Op1c); } break; @@ -8490,9 +8314,9 @@ Instruction *InstCombiner::visitTrunc(TruncInst &CI) { // Canonicalize trunc x to i1 -> (icmp ne (and x, 1), 0) if (DestBitWidth == 1) { Constant *One = ConstantInt::get(Src->getType(), 1); - Src = InsertNewInstBefore(BinaryOperator::CreateAnd(Src, One, "tmp"), CI); + Src = Builder->CreateAnd(Src, One, "tmp"); Value *Zero = Constant::getNullValue(Src->getType()); - return new ICmpInst(*Context, ICmpInst::ICMP_NE, Src, Zero); + return new ICmpInst(ICmpInst::ICMP_NE, Src, Zero); } // Optimize trunc(lshr(), c) to pull the shift through the truncate. @@ -8510,7 +8334,7 @@ Instruction *InstCombiner::visitTrunc(TruncInst &CI) { // Okay, we can shrink this. Truncate the input, then return a new // shift. - Value *V1 = InsertCastBefore(Instruction::Trunc, ShiftOp, Ty, CI); + Value *V1 = Builder->CreateTrunc(ShiftOp, Ty, ShiftOp->getName()); Value *V2 = ConstantExpr::getTrunc(ShAmtV, Ty); return BinaryOperator::CreateLShr(V1, V2); } @@ -8538,18 +8362,13 @@ Instruction *InstCombiner::transformZExtICmp(ICmpInst *ICI, Instruction &CI, Value *In = ICI->getOperand(0); Value *Sh = ConstantInt::get(In->getType(), In->getType()->getScalarSizeInBits()-1); - In = InsertNewInstBefore(BinaryOperator::CreateLShr(In, Sh, - In->getName()+".lobit"), - CI); + In = Builder->CreateLShr(In, Sh, In->getName()+".lobit"); if (In->getType() != CI.getType()) - In = CastInst::CreateIntegerCast(In, CI.getType(), - false/*ZExt*/, "tmp", &CI); + In = Builder->CreateIntCast(In, CI.getType(), false/*ZExt*/, "tmp"); if (ICI->getPredicate() == ICmpInst::ICMP_SGT) { Constant *One = ConstantInt::get(In->getType(), 1); - In = InsertNewInstBefore(BinaryOperator::CreateXor(In, One, - In->getName()+".not"), - CI); + In = Builder->CreateXor(In, One, In->getName()+".not"); } return ReplaceInstUsesWith(CI, In); @@ -8592,15 +8411,13 @@ Instruction *InstCombiner::transformZExtICmp(ICmpInst *ICI, Instruction &CI, if (ShiftAmt) { // Perform a logical shr by shiftamt. // Insert the shift to put the result in the low bit. - In = InsertNewInstBefore(BinaryOperator::CreateLShr(In, - ConstantInt::get(In->getType(), ShiftAmt), - In->getName()+".lobit"), CI); + In = Builder->CreateLShr(In, ConstantInt::get(In->getType(),ShiftAmt), + In->getName()+".lobit"); } if ((Op1CV != 0) == isNE) { // Toggle the low bit. Constant *One = ConstantInt::get(In->getType(), 1); - In = BinaryOperator::CreateXor(In, One, "tmp"); - InsertNewInstBefore(cast(In), CI); + In = Builder->CreateXor(In, One, "tmp"); } if (CI.getType() == In->getType()) @@ -8638,17 +8455,17 @@ Instruction *InstCombiner::visitZExt(ZExtInst &CI) { if (SrcSize < DstSize) { APInt AndValue(APInt::getLowBitsSet(SrcSize, MidSize)); Constant *AndConst = ConstantInt::get(A->getType(), AndValue); - Instruction *And = - BinaryOperator::CreateAnd(A, AndConst, CSrc->getName()+".mask"); - InsertNewInstBefore(And, CI); + Value *And = Builder->CreateAnd(A, AndConst, CSrc->getName()+".mask"); return new ZExtInst(And, CI.getType()); - } else if (SrcSize == DstSize) { + } + + if (SrcSize == DstSize) { APInt AndValue(APInt::getLowBitsSet(SrcSize, MidSize)); return BinaryOperator::CreateAnd(A, ConstantInt::get(A->getType(), AndValue)); - } else if (SrcSize > DstSize) { - Instruction *Trunc = new TruncInst(A, CI.getType(), "tmp"); - InsertNewInstBefore(Trunc, CI); + } + if (SrcSize > DstSize) { + Value *Trunc = Builder->CreateTrunc(A, CI.getType(), "tmp"); APInt AndValue(APInt::getLowBitsSet(DstSize, MidSize)); return BinaryOperator::CreateAnd(Trunc, ConstantInt::get(Trunc->getType(), @@ -8668,8 +8485,8 @@ Instruction *InstCombiner::visitZExt(ZExtInst &CI) { if (LHS && RHS && LHS->hasOneUse() && RHS->hasOneUse() && (transformZExtICmp(LHS, CI, false) || transformZExtICmp(RHS, CI, false))) { - Value *LCast = InsertCastBefore(Instruction::ZExt, LHS, CI.getType(), CI); - Value *RCast = InsertCastBefore(Instruction::ZExt, RHS, CI.getType(), CI); + Value *LCast = Builder->CreateZExt(LHS, CI.getType(), LHS->getName()); + Value *RCast = Builder->CreateZExt(RHS, CI.getType(), RHS->getName()); return BinaryOperator::Create(Instruction::Or, LCast, RCast); } } @@ -8695,8 +8512,7 @@ Instruction *InstCombiner::visitZExt(ZExtInst &CI) { Value *TI0 = TI->getOperand(0); if (TI0->getType() == CI.getType()) { Constant *ZC = ConstantExpr::getZExt(C, CI.getType()); - Instruction *NewAnd = BinaryOperator::CreateAnd(TI0, ZC, "tmp"); - InsertNewInstBefore(NewAnd, *And); + Value *NewAnd = Builder->CreateAnd(TI0, ZC, "tmp"); return BinaryOperator::CreateXor(NewAnd, ZC); } } @@ -8767,8 +8583,7 @@ Instruction *InstCombiner::visitSExt(SExtInst &CI) { unsigned SrcDstSize = CI.getType()->getScalarSizeInBits(); unsigned ShAmt = CA->getZExtValue()+SrcDstSize-MidSize; Constant *ShAmtV = ConstantInt::get(CI.getType(), ShAmt); - I = InsertNewInstBefore(BinaryOperator::CreateShl(I, ShAmtV, - CI.getName()), CI); + I = Builder->CreateShl(I, ShAmtV, CI.getName()); return BinaryOperator::CreateAShr(I, ShAmtV); } } @@ -8841,10 +8656,8 @@ Instruction *InstCombiner::visitFPTrunc(FPTruncInst &CI) { // the cast, do this xform. if (LHSTrunc->getType()->getScalarSizeInBits() <= DstSize && RHSTrunc->getType()->getScalarSizeInBits() <= DstSize) { - LHSTrunc = InsertCastBefore(Instruction::FPExt, LHSTrunc, - CI.getType(), CI); - RHSTrunc = InsertCastBefore(Instruction::FPExt, RHSTrunc, - CI.getType(), CI); + LHSTrunc = Builder->CreateFPExt(LHSTrunc, CI.getType()); + RHSTrunc = Builder->CreateFPExt(RHSTrunc, CI.getType()); return BinaryOperator::Create(OpI->getOpcode(), LHSTrunc, RHSTrunc); } } @@ -8914,9 +8727,9 @@ Instruction *InstCombiner::visitPtrToInt(PtrToIntInst &CI) { // pointers. if (TD && CI.getType()->getScalarSizeInBits() < TD->getPointerSizeInBits()) { - Value *P = InsertNewInstBefore(new PtrToIntInst(CI.getOperand(0), - TD->getIntPtrType(CI.getContext()), - "tmp"), CI); + Value *P = Builder->CreatePtrToInt(CI.getOperand(0), + TD->getIntPtrType(CI.getContext()), + "tmp"); return new TruncInst(P, CI.getType()); } @@ -8929,12 +8742,10 @@ Instruction *InstCombiner::visitIntToPtr(IntToPtrInst &CI) { // allows the trunc to be exposed to other transforms. Don't do this for // extending inttoptr's, because we don't know if the target sign or zero // extends to pointers. - if (TD && - CI.getOperand(0)->getType()->getScalarSizeInBits() > + if (TD && CI.getOperand(0)->getType()->getScalarSizeInBits() > TD->getPointerSizeInBits()) { - Value *P = InsertNewInstBefore(new TruncInst(CI.getOperand(0), - TD->getIntPtrType(CI.getContext()), - "tmp"), CI); + Value *P = Builder->CreateTrunc(CI.getOperand(0), + TD->getIntPtrType(CI.getContext()), "tmp"); return new IntToPtrInst(P, CI.getType()); } @@ -9007,10 +8818,9 @@ Instruction *InstCombiner::visitBitCast(BitCastInst &CI) { if (const VectorType *DestVTy = dyn_cast(DestTy)) { if (DestVTy->getNumElements() == 1) { if (!isa(SrcTy)) { - Value *Elem = InsertCastBefore(Instruction::BitCast, Src, - DestVTy->getElementType(), CI); + Value *Elem = Builder->CreateBitCast(Src, DestVTy->getElementType()); return InsertElementInst::Create(UndefValue::get(DestTy), Elem, - Constant::getNullValue(Type::getInt32Ty(*Context))); + Constant::getNullValue(Type::getInt32Ty(*Context))); } // FIXME: Canonicalize bitcast(insertelement) -> insertelement(bitcast) } @@ -9019,9 +8829,9 @@ Instruction *InstCombiner::visitBitCast(BitCastInst &CI) { if (const VectorType *SrcVTy = dyn_cast(SrcTy)) { if (SrcVTy->getNumElements() == 1) { if (!isa(DestTy)) { - Instruction *Elem = - ExtractElementInst::Create(Src, Constant::getNullValue(Type::getInt32Ty(*Context))); - InsertNewInstBefore(Elem, CI); + Value *Elem = + Builder->CreateExtractElement(Src, + Constant::getNullValue(Type::getInt32Ty(*Context))); return CastInst::Create(Instruction::BitCast, Elem, DestTy); } } @@ -9044,10 +8854,8 @@ Instruction *InstCombiner::visitBitCast(BitCastInst &CI) { Tmp->getOperand(0)->getType() == DestTy) || ((Tmp = dyn_cast(SVI->getOperand(1))) && Tmp->getOperand(0)->getType() == DestTy)) { - Value *LHS = InsertCastBefore(Instruction::BitCast, - SVI->getOperand(0), DestTy, CI); - Value *RHS = InsertCastBefore(Instruction::BitCast, - SVI->getOperand(1), DestTy, CI); + Value *LHS = Builder->CreateBitCast(SVI->getOperand(0), DestTy); + Value *RHS = Builder->CreateBitCast(SVI->getOperand(1), DestTy); // Return a new shuffle vector. Use the same element ID's, as we // know the vector types match #elts. return new ShuffleVectorInst(LHS, RHS, SVI->getOperand(2)); @@ -9750,8 +9558,8 @@ Instruction *InstCombiner::SimplifyMemTransfer(MemIntrinsic *MI) { SrcAlign = std::max(SrcAlign, CopyAlign); DstAlign = std::max(DstAlign, CopyAlign); - Value *Src = InsertBitCastBefore(MI->getOperand(2), NewPtrTy, *MI); - Value *Dest = InsertBitCastBefore(MI->getOperand(1), NewPtrTy, *MI); + Value *Src = Builder->CreateBitCast(MI->getOperand(2), NewPtrTy); + Value *Dest = Builder->CreateBitCast(MI->getOperand(1), NewPtrTy); Instruction *L = new LoadInst(Src, "tmp", false, SrcAlign); InsertNewInstBefore(L, *MI); InsertNewInstBefore(new StoreInst(L, Dest, false, DstAlign), *MI); @@ -9785,7 +9593,7 @@ Instruction *InstCombiner::SimplifyMemSet(MemSetInst *MI) { const Type *ITy = IntegerType::get(*Context, Len*8); // n=1 -> i8. Value *Dest = MI->getDest(); - Dest = InsertBitCastBefore(Dest, PointerType::getUnqual(ITy), *MI); + Dest = Builder->CreateBitCast(Dest, PointerType::getUnqual(ITy)); // Alignment 0 is identity for alignment 1 for memset, but not store. if (Alignment == 0) Alignment = 1; @@ -9817,8 +9625,6 @@ Instruction *InstCombiner::visitCallInst(CallInst &CI) { return &CI; } - - IntrinsicInst *II = dyn_cast(&CI); if (!II) return visitCallSite(&CI); @@ -9888,9 +9694,8 @@ Instruction *InstCombiner::visitCallInst(CallInst &CI) { // Turn PPC lvx -> load if the pointer is known aligned. // Turn X86 loadups -> load if the pointer is known aligned. if (GetOrEnforceKnownAlignment(II->getOperand(1), 16) >= 16) { - Value *Ptr = InsertBitCastBefore(II->getOperand(1), - PointerType::getUnqual(II->getType()), - CI); + Value *Ptr = Builder->CreateBitCast(II->getOperand(1), + PointerType::getUnqual(II->getType())); return new LoadInst(Ptr); } break; @@ -9900,7 +9705,7 @@ Instruction *InstCombiner::visitCallInst(CallInst &CI) { if (GetOrEnforceKnownAlignment(II->getOperand(2), 16) >= 16) { const Type *OpPtrTy = PointerType::getUnqual(II->getOperand(1)->getType()); - Value *Ptr = InsertBitCastBefore(II->getOperand(2), OpPtrTy, CI); + Value *Ptr = Builder->CreateBitCast(II->getOperand(2), OpPtrTy); return new StoreInst(II->getOperand(1), Ptr); } break; @@ -9911,7 +9716,7 @@ Instruction *InstCombiner::visitCallInst(CallInst &CI) { if (GetOrEnforceKnownAlignment(II->getOperand(1), 16) >= 16) { const Type *OpPtrTy = PointerType::getUnqual(II->getOperand(2)->getType()); - Value *Ptr = InsertBitCastBefore(II->getOperand(1), OpPtrTy, CI); + Value *Ptr = Builder->CreateBitCast(II->getOperand(1), OpPtrTy); return new StoreInst(II->getOperand(2), Ptr); } break; @@ -9948,8 +9753,8 @@ Instruction *InstCombiner::visitCallInst(CallInst &CI) { if (AllEltsOk) { // Cast the input vectors to byte vectors. - Value *Op0 =InsertBitCastBefore(II->getOperand(1),Mask->getType(),CI); - Value *Op1 =InsertBitCastBefore(II->getOperand(2),Mask->getType(),CI); + Value *Op0 = Builder->CreateBitCast(II->getOperand(1), Mask->getType()); + Value *Op1 = Builder->CreateBitCast(II->getOperand(2), Mask->getType()); Value *Result = UndefValue::get(Op0->getType()); // Only extract each element once. @@ -9963,18 +9768,16 @@ Instruction *InstCombiner::visitCallInst(CallInst &CI) { Idx &= 31; // Match the hardware behavior. if (ExtractedElts[Idx] == 0) { - Instruction *Elt = - ExtractElementInst::Create(Idx < 16 ? Op0 : Op1, - ConstantInt::get(Type::getInt32Ty(*Context), Idx&15, false), "tmp"); - InsertNewInstBefore(Elt, CI); - ExtractedElts[Idx] = Elt; + ExtractedElts[Idx] = + Builder->CreateExtractElement(Idx < 16 ? Op0 : Op1, + ConstantInt::get(Type::getInt32Ty(*Context), Idx&15, false), + "tmp"); } // Insert this value into the result vector. - Result = InsertElementInst::Create(Result, ExtractedElts[Idx], - ConstantInt::get(Type::getInt32Ty(*Context), i, false), - "tmp"); - InsertNewInstBefore(cast(Result), CI); + Result = Builder->CreateInsertElement(Result, ExtractedElts[Idx], + ConstantInt::get(Type::getInt32Ty(*Context), i, false), + "tmp"); } return CastInst::Create(Instruction::BitCast, Result, CI.getType()); } @@ -10263,8 +10066,7 @@ bool InstCombiner::transformConstExprCastCall(CallSite CS) { } else { Instruction::CastOps opcode = CastInst::getCastOpcode(*AI, false, ParamTy, false); - CastInst *NewCast = CastInst::Create(opcode, *AI, ParamTy, "tmp"); - Args.push_back(InsertNewInstBefore(NewCast, *Caller)); + Args.push_back(Builder->CreateCast(opcode, *AI, ParamTy, "tmp")); } // Add any parameter attributes. @@ -10273,26 +10075,24 @@ bool InstCombiner::transformConstExprCastCall(CallSite CS) { } // If the function takes more arguments than the call was taking, add them - // now... + // now. for (unsigned i = NumCommonArgs; i != FT->getNumParams(); ++i) Args.push_back(Constant::getNullValue(FT->getParamType(i))); - // If we are removing arguments to the function, emit an obnoxious warning... + // If we are removing arguments to the function, emit an obnoxious warning. if (FT->getNumParams() < NumActualArgs) { if (!FT->isVarArg()) { errs() << "WARNING: While resolving call to function '" << Callee->getName() << "' arguments were dropped!\n"; } else { - // Add all of the arguments in their promoted form to the arg list... + // Add all of the arguments in their promoted form to the arg list. for (unsigned i = FT->getNumParams(); i != NumActualArgs; ++i, ++AI) { const Type *PTy = getPromotedType((*AI)->getType()); if (PTy != (*AI)->getType()) { // Must promote to pass through va_arg area! - Instruction::CastOps opcode = CastInst::getCastOpcode(*AI, false, - PTy, false); - Instruction *Cast = CastInst::Create(opcode, *AI, PTy, "tmp"); - InsertNewInstBefore(Cast, *Caller); - Args.push_back(Cast); + Instruction::CastOps opcode = + CastInst::getCastOpcode(*AI, false, PTy, false); + Args.push_back(Builder->CreateCast(opcode, *AI, PTy, "tmp")); } else { Args.push_back(*AI); } @@ -10347,16 +10147,17 @@ bool InstCombiner::transformConstExprCastCall(CallSite CS) { // Otherwise, it's a call, just insert cast right after the call instr InsertNewInstBefore(NC, *Caller); } - AddUsersToWorkList(*Caller); + Worklist.AddUsersToWorkList(*Caller); } else { NV = UndefValue::get(Caller->getType()); } } - if (Caller->getType() != Type::getVoidTy(*Context) && !Caller->use_empty()) + + if (!Caller->use_empty()) Caller->replaceAllUsesWith(NV); - Caller->eraseFromParent(); - RemoveFromWorkList(Caller); + + EraseInstFromFunction(*Caller); return true; } @@ -10502,7 +10303,7 @@ Instruction *InstCombiner::transformCallThroughTrampoline(CallSite CS) { if (Caller->getType() != Type::getVoidTy(*Context) && !Caller->use_empty()) Caller->replaceAllUsesWith(NewCaller); Caller->eraseFromParent(); - RemoveFromWorkList(Caller); + Worklist.Remove(Caller); return 0; } } @@ -10593,7 +10394,7 @@ Instruction *InstCombiner::FoldPHIArgBinOpIntoPHI(PHINode &PN) { if (BinaryOperator *BinOp = dyn_cast(FirstInst)) return BinaryOperator::Create(BinOp->getOpcode(), LHSVal, RHSVal); CmpInst *CIOp = cast(FirstInst); - return CmpInst::Create(*Context, CIOp->getOpcode(), CIOp->getPredicate(), + return CmpInst::Create(CIOp->getOpcode(), CIOp->getPredicate(), LHSVal, RHSVal); } @@ -10844,7 +10645,7 @@ Instruction *InstCombiner::FoldPHIArgOpIntoPHI(PHINode &PN) { if (BinaryOperator *BinOp = dyn_cast(FirstInst)) return BinaryOperator::Create(BinOp->getOpcode(), PhiVal, ConstantOp); if (CmpInst *CIOp = dyn_cast(FirstInst)) - return CmpInst::Create(*Context, CIOp->getOpcode(), CIOp->getPredicate(), + return CmpInst::Create(CIOp->getOpcode(), CIOp->getPredicate(), PhiVal, ConstantOp); assert(isa(FirstInst) && "Unknown operation"); @@ -10990,25 +10791,9 @@ Instruction *InstCombiner::visitPHINode(PHINode &PN) { return 0; } -static Value *InsertCastToIntPtrTy(Value *V, const Type *DTy, - Instruction *InsertPoint, - InstCombiner *IC) { - unsigned PtrSize = DTy->getScalarSizeInBits(); - unsigned VTySize = V->getType()->getScalarSizeInBits(); - // We must cast correctly to the pointer type. Ensure that we - // sign extend the integer value if it is smaller as this is - // used for address computation. - Instruction::CastOps opcode = - (VTySize < PtrSize ? Instruction::SExt : - (VTySize == PtrSize ? Instruction::BitCast : Instruction::Trunc)); - return IC->InsertCastBefore(opcode, V, DTy, *InsertPoint); -} - - Instruction *InstCombiner::visitGetElementPtrInst(GetElementPtrInst &GEP) { Value *PtrOp = GEP.getOperand(0); - // Is it 'getelementptr %P, i32 0' or 'getelementptr %P' - // If so, eliminate the noop. + // Eliminate 'getelementptr %P, i32 0' and 'getelementptr %P', they are noops. if (GEP.getNumOperands() == 1) return ReplaceInstUsesWith(GEP, PtrOp); @@ -11023,84 +10808,48 @@ Instruction *InstCombiner::visitGetElementPtrInst(GetElementPtrInst &GEP) { return ReplaceInstUsesWith(GEP, PtrOp); // Eliminate unneeded casts for indices. - bool MadeChange = false; - - gep_type_iterator GTI = gep_type_begin(GEP); - for (User::op_iterator i = GEP.op_begin() + 1, e = GEP.op_end(); - i != e; ++i, ++GTI) { - if (TD && isa(*GTI)) { - if (CastInst *CI = dyn_cast(*i)) { - if (CI->getOpcode() == Instruction::ZExt || - CI->getOpcode() == Instruction::SExt) { - const Type *SrcTy = CI->getOperand(0)->getType(); - // We can eliminate a cast from i32 to i64 iff the target - // is a 32-bit pointer target. - if (SrcTy->getScalarSizeInBits() >= TD->getPointerSizeInBits()) { - MadeChange = true; - *i = CI->getOperand(0); - } - } - } + if (TD) { + bool MadeChange = false; + unsigned PtrSize = TD->getPointerSizeInBits(); + + gep_type_iterator GTI = gep_type_begin(GEP); + for (User::op_iterator I = GEP.op_begin() + 1, E = GEP.op_end(); + I != E; ++I, ++GTI) { + if (!isa(*GTI)) continue; + // If we are using a wider index than needed for this platform, shrink it - // to what we need. If narrower, sign-extend it to what we need. - // If the incoming value needs a cast instruction, - // insert it. This explicit cast can make subsequent optimizations more - // obvious. - Value *Op = *i; - if (TD->getTypeSizeInBits(Op->getType()) > TD->getPointerSizeInBits()) { - if (Constant *C = dyn_cast(Op)) { - *i = ConstantExpr::getTrunc(C, TD->getIntPtrType(GEP.getContext())); - MadeChange = true; - } else { - Op = InsertCastBefore(Instruction::Trunc, Op, - TD->getIntPtrType(GEP.getContext()), - GEP); - *i = Op; - MadeChange = true; - } - } else if (TD->getTypeSizeInBits(Op->getType()) - < TD->getPointerSizeInBits()) { - if (Constant *C = dyn_cast(Op)) { - *i = ConstantExpr::getSExt(C, TD->getIntPtrType(GEP.getContext())); - MadeChange = true; - } else { - Op = InsertCastBefore(Instruction::SExt, Op, - TD->getIntPtrType(GEP.getContext()), GEP); - *i = Op; - MadeChange = true; - } - } + // to what we need. If narrower, sign-extend it to what we need. This + // explicit cast can make subsequent optimizations more obvious. + unsigned OpBits = cast((*I)->getType())->getBitWidth(); + if (OpBits == PtrSize) + continue; + + *I = Builder->CreateIntCast(*I, TD->getIntPtrType(GEP.getContext()),true); + MadeChange = true; } + if (MadeChange) return &GEP; } - if (MadeChange) return &GEP; // Combine Indices - If the source pointer to this getelementptr instruction // is a getelementptr instruction, combine the indices of the two // getelementptr instructions into a single instruction. // - SmallVector SrcGEPOperands; - bool BothInBounds = cast(&GEP)->isInBounds(); if (GEPOperator *Src = dyn_cast(PtrOp)) { - SrcGEPOperands.append(Src->op_begin(), Src->op_end()); - if (!Src->isInBounds()) - BothInBounds = false; - } - - if (!SrcGEPOperands.empty()) { // Note that if our source is a gep chain itself that we wait for that // chain to be resolved before we perform this transformation. This // avoids us creating a TON of code in some cases. // - if (isa(SrcGEPOperands[0]) && - cast(SrcGEPOperands[0])->getNumOperands() == 2) - return 0; // Wait until our source is folded to completion. + if (GetElementPtrInst *SrcGEP = + dyn_cast(Src->getOperand(0))) + if (SrcGEP->getNumOperands() == 2) + return 0; // Wait until our source is folded to completion. SmallVector Indices; // Find out whether the last index in the source GEP is a sequential idx. bool EndsWithSequential = false; - for (gep_type_iterator I = gep_type_begin(*cast(PtrOp)), - E = gep_type_end(*cast(PtrOp)); I != E; ++I) + for (gep_type_iterator I = gep_type_begin(*Src), E = gep_type_end(*Src); + I != E; ++I) EndsWithSequential = !isa(*I); // Can we combine the two pointer arithmetics offsets? @@ -11108,104 +10857,69 @@ Instruction *InstCombiner::visitGetElementPtrInst(GetElementPtrInst &GEP) { // Replace: gep (gep %P, long B), long A, ... // With: T = long A+B; gep %P, T, ... // - Value *Sum, *SO1 = SrcGEPOperands.back(), *GO1 = GEP.getOperand(1); + Value *Sum; + Value *SO1 = Src->getOperand(Src->getNumOperands()-1); + Value *GO1 = GEP.getOperand(1); if (SO1 == Constant::getNullValue(SO1->getType())) { Sum = GO1; } else if (GO1 == Constant::getNullValue(GO1->getType())) { Sum = SO1; } else { - // If they aren't the same type, convert both to an integer of the - // target's pointer size. - if (SO1->getType() != GO1->getType()) { - if (Constant *SO1C = dyn_cast(SO1)) { - SO1 = - ConstantExpr::getIntegerCast(SO1C, GO1->getType(), true); - } else if (Constant *GO1C = dyn_cast(GO1)) { - GO1 = - ConstantExpr::getIntegerCast(GO1C, SO1->getType(), true); - } else if (TD) { - unsigned PS = TD->getPointerSizeInBits(); - if (TD->getTypeSizeInBits(SO1->getType()) == PS) { - // Convert GO1 to SO1's type. - GO1 = InsertCastToIntPtrTy(GO1, SO1->getType(), &GEP, this); - - } else if (TD->getTypeSizeInBits(GO1->getType()) == PS) { - // Convert SO1 to GO1's type. - SO1 = InsertCastToIntPtrTy(SO1, GO1->getType(), &GEP, this); - } else { - const Type *PT = TD->getIntPtrType(GEP.getContext()); - SO1 = InsertCastToIntPtrTy(SO1, PT, &GEP, this); - GO1 = InsertCastToIntPtrTy(GO1, PT, &GEP, this); - } - } - } - if (isa(SO1) && isa(GO1)) - Sum = ConstantExpr::getAdd(cast(SO1), - cast(GO1)); - else { - Sum = BinaryOperator::CreateAdd(SO1, GO1, PtrOp->getName()+".sum"); - InsertNewInstBefore(cast(Sum), GEP); - } + // If they aren't the same type, then the input hasn't been processed + // by the loop above yet (which canonicalizes sequential index types to + // intptr_t). Just avoid transforming this until the input has been + // normalized. + if (SO1->getType() != GO1->getType()) + return 0; + Sum = Builder->CreateAdd(SO1, GO1, PtrOp->getName()+".sum"); } - // Recycle the GEP we already have if possible. - if (SrcGEPOperands.size() == 2) { - GEP.setOperand(0, SrcGEPOperands[0]); + // Update the GEP in place if possible. + if (Src->getNumOperands() == 2) { + GEP.setOperand(0, Src->getOperand(0)); GEP.setOperand(1, Sum); return &GEP; - } else { - Indices.insert(Indices.end(), SrcGEPOperands.begin()+1, - SrcGEPOperands.end()-1); - Indices.push_back(Sum); - Indices.insert(Indices.end(), GEP.op_begin()+2, GEP.op_end()); } + Indices.append(Src->op_begin()+1, Src->op_end()-1); + Indices.push_back(Sum); + Indices.append(GEP.op_begin()+2, GEP.op_end()); } else if (isa(*GEP.idx_begin()) && cast(*GEP.idx_begin())->isNullValue() && - SrcGEPOperands.size() != 1) { + Src->getNumOperands() != 1) { // Otherwise we can do the fold if the first index of the GEP is a zero - Indices.insert(Indices.end(), SrcGEPOperands.begin()+1, - SrcGEPOperands.end()); - Indices.insert(Indices.end(), GEP.idx_begin()+1, GEP.idx_end()); + Indices.append(Src->op_begin()+1, Src->op_end()); + Indices.append(GEP.idx_begin()+1, GEP.idx_end()); } if (!Indices.empty()) { - GetElementPtrInst *NewGEP = GetElementPtrInst::Create(SrcGEPOperands[0], - Indices.begin(), - Indices.end(), - GEP.getName()); - if (BothInBounds) + GetElementPtrInst *NewGEP = + GetElementPtrInst::Create(Src->getOperand(0), Indices.begin(), + Indices.end(), GEP.getName()); + if (cast(&GEP)->isInBounds() && Src->isInBounds()) cast(NewGEP)->setIsInBounds(true); return NewGEP; } + } + + // Handle gep(bitcast x) and gep(gep x, 0, 0, 0). + if (Value *X = getBitCastOperand(PtrOp)) { + assert(isa(X->getType()) && "Must be cast from pointer"); - } else if (GlobalValue *GV = dyn_cast(PtrOp)) { - // GEP of global variable. If all of the indices for this GEP are - // constants, we can promote this to a constexpr instead of an instruction. - - // Scan for nonconstants... - SmallVector Indices; - User::op_iterator I = GEP.idx_begin(), E = GEP.idx_end(); - for (; I != E && isa(*I); ++I) - Indices.push_back(cast(*I)); - - if (I == E) { // If they are all constants... - Constant *CE = ConstantExpr::getGetElementPtr(GV, - &Indices[0],Indices.size()); - - // Replace all uses of the GEP with the new constexpr... - return ReplaceInstUsesWith(GEP, CE); + // If the input bitcast is actually "bitcast(bitcast(x))", then we don't + // want to change the gep until the bitcasts are eliminated. + if (getBitCastOperand(X)) { + Worklist.AddValue(PtrOp); + return 0; } - } else if (Value *X = getBitCastOperand(PtrOp)) { // Is the operand a cast? - if (!isa(X->getType())) { - // Not interesting. Source pointer must be a cast from pointer. - } else if (HasZeroPointerIndex) { - // transform: GEP (bitcast [10 x i8]* X to [0 x i8]*), i32 0, ... - // into : GEP [10 x i8]* X, i32 0, ... - // - // Likewise, transform: GEP (bitcast i8* X to [0 x i8]*), i32 0, ... - // into : GEP i8* X, ... - // - // This occurs when the program declares an array extern like "int X[];" + + // Transform: GEP (bitcast [10 x i8]* X to [0 x i8]*), i32 0, ... + // into : GEP [10 x i8]* X, i32 0, ... + // + // Likewise, transform: GEP (bitcast i8* X to [0 x i8]*), i32 0, ... + // into : GEP i8* X, ... + // + // This occurs when the program declares an array extern like "int X[];" + if (HasZeroPointerIndex) { const PointerType *CPTy = cast(PtrOp->getType()); const PointerType *XTy = cast(X->getType()); if (const ArrayType *CATy = @@ -11220,8 +10934,9 @@ Instruction *InstCombiner::visitGetElementPtrInst(GetElementPtrInst &GEP) { if (cast(&GEP)->isInBounds()) cast(NewGEP)->setIsInBounds(true); return NewGEP; - } else if (const ArrayType *XATy = - dyn_cast(XTy->getElementType())) { + } + + if (const ArrayType *XATy = dyn_cast(XTy->getElementType())){ // GEP (bitcast [10 x i8]* X to [0 x i8]*), i32 0, ... ? if (CATy->getElementType() == XATy->getElementType()) { // -> GEP [10 x i8]* X, i32 0, ... @@ -11246,13 +10961,12 @@ Instruction *InstCombiner::visitGetElementPtrInst(GetElementPtrInst &GEP) { Value *Idx[2]; Idx[0] = Constant::getNullValue(Type::getInt32Ty(*Context)); Idx[1] = GEP.getOperand(1); - GetElementPtrInst *NewGEP = - GetElementPtrInst::Create(X, Idx, Idx + 2, GEP.getName()); + Value *NewGEP = + Builder->CreateGEP(X, Idx, Idx + 2, GEP.getName()); if (cast(&GEP)->isInBounds()) cast(NewGEP)->setIsInBounds(true); - Value *V = InsertNewInstBefore(NewGEP, GEP); // V and GEP are both pointer types --> BitCast - return new BitCastInst(V, GEP.getType()); + return new BitCastInst(NewGEP, GEP.getType()); } // Transform things like: @@ -11270,8 +10984,7 @@ Instruction *InstCombiner::visitGetElementPtrInst(GetElementPtrInst &GEP) { ConstantInt *Scale = 0; if (ArrayEltSize == 1) { NewIdx = GEP.getOperand(1); - Scale = - ConstantInt::get(cast(NewIdx->getType()), 1); + Scale = ConstantInt::get(cast(NewIdx->getType()), 1); } else if (ConstantInt *CI = dyn_cast(GEP.getOperand(1))) { NewIdx = ConstantInt::get(CI->getType(), 1); Scale = CI; @@ -11299,22 +11012,18 @@ Instruction *InstCombiner::visitGetElementPtrInst(GetElementPtrInst &GEP) { Scale = ConstantInt::get(Scale->getType(), Scale->getZExtValue() / ArrayEltSize); if (Scale->getZExtValue() != 1) { - Constant *C = - ConstantExpr::getIntegerCast(Scale, NewIdx->getType(), + Constant *C = ConstantExpr::getIntegerCast(Scale, NewIdx->getType(), false /*ZExt*/); - Instruction *Sc = BinaryOperator::CreateMul(NewIdx, C, "idxscale"); - NewIdx = InsertNewInstBefore(Sc, GEP); + NewIdx = Builder->CreateMul(NewIdx, C, "idxscale"); } // Insert the new GEP instruction. Value *Idx[2]; Idx[0] = Constant::getNullValue(Type::getInt32Ty(*Context)); Idx[1] = NewIdx; - Instruction *NewGEP = - GetElementPtrInst::Create(X, Idx, Idx + 2, GEP.getName()); + Value *NewGEP = Builder->CreateGEP(X, Idx, Idx + 2, GEP.getName()); if (cast(&GEP)->isInBounds()) cast(NewGEP)->setIsInBounds(true); - NewGEP = InsertNewInstBefore(NewGEP, GEP); // The NewGEP must be pointer typed, so must the old one -> BitCast return new BitCastInst(NewGEP, GEP.getType()); } @@ -11323,7 +11032,7 @@ Instruction *InstCombiner::visitGetElementPtrInst(GetElementPtrInst &GEP) { } /// See if we can simplify: - /// X = bitcast A to B* + /// X = bitcast A* to B* /// Y = gep X, <...constant indices...> /// into a gep of the original struct. This is important for SROA and alias /// analysis of unions. If "A" is also a bitcast, wait for A/X to be merged. @@ -11362,13 +11071,13 @@ Instruction *InstCombiner::visitGetElementPtrInst(GetElementPtrInst &GEP) { const Type *InTy = cast(BCI->getOperand(0)->getType())->getElementType(); if (FindElementAtOffset(InTy, Offset, NewIndices, TD, Context)) { - Instruction *NGEP = - GetElementPtrInst::Create(BCI->getOperand(0), NewIndices.begin(), - NewIndices.end()); - if (NGEP->getType() == GEP.getType()) return NGEP; + Value *NGEP = Builder->CreateGEP(BCI->getOperand(0), NewIndices.begin(), + NewIndices.end()); if (cast(&GEP)->isInBounds()) cast(NGEP)->setIsInBounds(true); - InsertNewInstBefore(NGEP, GEP); + + if (NGEP->getType() == GEP.getType()) + return ReplaceInstUsesWith(GEP, NGEP); NGEP->takeName(&GEP); return new BitCastInst(NGEP, GEP.getType()); } @@ -11388,13 +11097,12 @@ Instruction *InstCombiner::visitAllocationInst(AllocationInst &AI) { // Create and insert the replacement instruction... if (isa(AI)) - New = new MallocInst(NewTy, 0, AI.getAlignment(), AI.getName()); + New = Builder->CreateMalloc(NewTy, 0, AI.getName()); else { assert(isa(AI) && "Unknown type of allocation inst!"); - New = new AllocaInst(NewTy, 0, AI.getAlignment(), AI.getName()); + New = Builder->CreateAlloca(NewTy, 0, AI.getName()); } - - InsertNewInstBefore(New, AI); + New->setAlignment(AI.getAlignment()); // Scan to the end of the allocation instructions, to skip over a block of // allocas if possible...also skip interleaved debug info @@ -11461,7 +11169,7 @@ Instruction *InstCombiner::visitFreeInst(FreeInst &FI) { // Change free (gep X, 0,0,0,0) into free(X) if (GetElementPtrInst *GEPI = dyn_cast(Op)) { if (GEPI->hasAllZeroIndices()) { - AddToWorkList(GEPI); + Worklist.Add(GEPI); FI.setOperand(0, GEPI->getOperand(0)); return &FI; } @@ -11556,9 +11264,8 @@ static Instruction *InstCombineLoadCast(InstCombiner &IC, LoadInst &LI, // Okay, we are casting from one integer or pointer type to another of // the same size. Instead of casting the pointer before the load, cast // the result of the loaded value. - Value *NewLoad = IC.InsertNewInstBefore(new LoadInst(CastOp, - CI->getName(), - LI.isVolatile()),LI); + Value *NewLoad = + IC.Builder->CreateLoad(CastOp, LI.isVolatile(), CI->getName()); // Now cast the result of the load. return new BitCastInst(NewLoad, LI.getType()); } @@ -11580,7 +11287,7 @@ Instruction *InstCombiner::visitLoadInst(LoadInst &LI) { LI.setAlignment(KnownAlign); } - // load (cast X) --> cast (load X) iff safe + // load (cast X) --> cast (load X) iff safe. if (isa(Op)) if (Instruction *Res = InstCombineLoadCast(*this, LI, TD)) return Res; @@ -11598,8 +11305,7 @@ Instruction *InstCombiner::visitLoadInst(LoadInst &LI) { if (GetElementPtrInst *GEPI = dyn_cast(Op)) { const Value *GEPI0 = GEPI->getOperand(0); // TODO: Consider a target hook for valid address spaces for this xform. - if (isa(GEPI0) && - cast(GEPI0->getType())->getAddressSpace() == 0) { + if (isa(GEPI0) && GEPI->getPointerAddressSpace() == 0){ // Insert a new store to null instruction before the load to indicate // that this code is not reachable. We do this instead of inserting // an unreachable instruction directly because we cannot modify the @@ -11613,8 +11319,8 @@ Instruction *InstCombiner::visitLoadInst(LoadInst &LI) { if (Constant *C = dyn_cast(Op)) { // load null/undef -> undef // TODO: Consider a target hook for valid address spaces for this xform. - if (isa(C) || (C->isNullValue() && - cast(Op->getType())->getAddressSpace() == 0)) { + if (isa(C) || + (C->isNullValue() && LI.getPointerAddressSpace() == 0)) { // Insert a new store to null instruction before the load to indicate that // this code is not reachable. We do this instead of inserting an // unreachable instruction directly because we cannot modify the CFG. @@ -11680,10 +11386,10 @@ Instruction *InstCombiner::visitLoadInst(LoadInst &LI) { // load (select (Cond, &V1, &V2)) --> select(Cond, load &V1, load &V2). if (isSafeToLoadUnconditionally(SI->getOperand(1), SI) && isSafeToLoadUnconditionally(SI->getOperand(2), SI)) { - Value *V1 = InsertNewInstBefore(new LoadInst(SI->getOperand(1), - SI->getOperand(1)->getName()+".val"), LI); - Value *V2 = InsertNewInstBefore(new LoadInst(SI->getOperand(2), - SI->getOperand(2)->getName()+".val"), LI); + Value *V1 = Builder->CreateLoad(SI->getOperand(1), + SI->getOperand(1)->getName()+".val"); + Value *V2 = Builder->CreateLoad(SI->getOperand(2), + SI->getOperand(2)->getName()+".val"); return SelectInst::Create(SI->getCondition(), V1, V2); } @@ -11783,22 +11489,13 @@ static Instruction *InstCombineStoreToCast(InstCombiner &IC, StoreInst &SI) { // SIOp0 is a pointer to aggregate and this is a store to the first field, // emit a GEP to index into its first field. if (!NewGEPIndices.empty()) { - if (Constant *C = dyn_cast(CastOp)) - CastOp = ConstantExpr::getGetElementPtr(C, &NewGEPIndices[0], - NewGEPIndices.size()); - else - CastOp = IC.InsertNewInstBefore( - GetElementPtrInst::Create(CastOp, NewGEPIndices.begin(), - NewGEPIndices.end()), SI); + CastOp = IC.Builder->CreateGEP(CastOp, NewGEPIndices.begin(), + NewGEPIndices.end()); cast(CastOp)->setIsInBounds(true); } - if (Constant *C = dyn_cast(SIOp0)) - NewCast = ConstantExpr::getCast(opcode, C, CastDstTy); - else - NewCast = IC.InsertNewInstBefore( - CastInst::Create(opcode, SIOp0, CastDstTy, SIOp0->getName()+".c"), - SI); + NewCast = IC.Builder->CreateCast(opcode, SIOp0, CastDstTy, + SIOp0->getName()+".c"); return new StoreInst(NewCast, CastOp); } @@ -11815,12 +11512,16 @@ static bool equivalentAddressValues(Value *A, Value *B) { if (A == B) return true; // Test if the values come form identical arithmetic instructions. + // This uses isIdenticalToWhenDefined instead of isIdenticalTo because + // its only used to compare two uses within the same basic block, which + // means that they'll always either have the same value or one of them + // will have an undefined value. if (isa(A) || isa(A) || isa(A) || isa(A)) if (Instruction *BI = dyn_cast(B)) - if (cast(A)->isIdenticalTo(BI)) + if (cast(A)->isIdenticalToWhenDefined(BI)) return true; // Otherwise they may not be equivalent. @@ -11954,12 +11655,11 @@ Instruction *InstCombiner::visitStoreInst(StoreInst &SI) { if (SI.isVolatile()) return 0; // Don't hack volatile stores. // store X, null -> turns into 'unreachable' in SimplifyCFG - if (isa(Ptr) && - cast(Ptr->getType())->getAddressSpace() == 0) { + if (isa(Ptr) && SI.getPointerAddressSpace() == 0) { if (!isa(Val)) { SI.setOperand(0, UndefValue::get(Val->getType())); if (Instruction *U = dyn_cast(Val)) - AddToWorkList(U); // Dropped a use. + Worklist.Add(U); // Dropped a use. ++NumCombined; } return 0; // Do not modify these! @@ -12136,41 +11836,34 @@ Instruction *InstCombiner::visitBranchInst(BranchInst &BI) { // Cannonicalize fcmp_one -> fcmp_oeq FCmpInst::Predicate FPred; Value *Y; if (match(&BI, m_Br(m_FCmp(FPred, m_Value(X), m_Value(Y)), - TrueDest, FalseDest))) - if ((FPred == FCmpInst::FCMP_ONE || FPred == FCmpInst::FCMP_OLE || - FPred == FCmpInst::FCMP_OGE) && BI.getCondition()->hasOneUse()) { - FCmpInst *I = cast(BI.getCondition()); - FCmpInst::Predicate NewPred = FCmpInst::getInversePredicate(FPred); - Instruction *NewSCC = new FCmpInst(I, NewPred, X, Y, ""); - NewSCC->takeName(I); - // Swap Destinations and condition... - BI.setCondition(NewSCC); + TrueDest, FalseDest)) && + BI.getCondition()->hasOneUse()) + if (FPred == FCmpInst::FCMP_ONE || FPred == FCmpInst::FCMP_OLE || + FPred == FCmpInst::FCMP_OGE) { + FCmpInst *Cond = cast(BI.getCondition()); + Cond->setPredicate(FCmpInst::getInversePredicate(FPred)); + + // Swap Destinations and condition. BI.setSuccessor(0, FalseDest); BI.setSuccessor(1, TrueDest); - RemoveFromWorkList(I); - I->eraseFromParent(); - AddToWorkList(NewSCC); + Worklist.Add(Cond); return &BI; } // Cannonicalize icmp_ne -> icmp_eq ICmpInst::Predicate IPred; if (match(&BI, m_Br(m_ICmp(IPred, m_Value(X), m_Value(Y)), - TrueDest, FalseDest))) - if ((IPred == ICmpInst::ICMP_NE || IPred == ICmpInst::ICMP_ULE || - IPred == ICmpInst::ICMP_SLE || IPred == ICmpInst::ICMP_UGE || - IPred == ICmpInst::ICMP_SGE) && BI.getCondition()->hasOneUse()) { - ICmpInst *I = cast(BI.getCondition()); - ICmpInst::Predicate NewPred = ICmpInst::getInversePredicate(IPred); - Instruction *NewSCC = new ICmpInst(I, NewPred, X, Y, ""); - NewSCC->takeName(I); - // Swap Destinations and condition... - BI.setCondition(NewSCC); + TrueDest, FalseDest)) && + BI.getCondition()->hasOneUse()) + if (IPred == ICmpInst::ICMP_NE || IPred == ICmpInst::ICMP_ULE || + IPred == ICmpInst::ICMP_SLE || IPred == ICmpInst::ICMP_UGE || + IPred == ICmpInst::ICMP_SGE) { + ICmpInst *Cond = cast(BI.getCondition()); + Cond->setPredicate(ICmpInst::getInversePredicate(IPred)); + // Swap Destinations and condition. BI.setSuccessor(0, FalseDest); BI.setSuccessor(1, TrueDest); - RemoveFromWorkList(I); - I->eraseFromParent();; - AddToWorkList(NewSCC); + Worklist.Add(Cond); return &BI; } @@ -12188,7 +11881,7 @@ Instruction *InstCombiner::visitSwitchInst(SwitchInst &SI) { ConstantExpr::getSub(cast(SI.getOperand(i)), AddRHS)); SI.setOperand(0, I->getOperand(0)); - AddToWorkList(I); + Worklist.Add(I); return &SI; } } @@ -12254,10 +11947,8 @@ Instruction *InstCombiner::visitExtractValueInst(ExtractValueInst &EV) { // %E = insertvalue { i32 } %X, i32 42, 0 // by switching the order of the insert and extract (though the // insertvalue should be left in, since it may have other uses). - Value *NewEV = InsertNewInstBefore( - ExtractValueInst::Create(IV->getAggregateOperand(), - EV.idx_begin(), EV.idx_end()), - EV); + Value *NewEV = Builder->CreateExtractValue(IV->getAggregateOperand(), + EV.idx_begin(), EV.idx_end()); return InsertValueInst::Create(NewEV, IV->getInsertedValueOperand(), insi, inse); } @@ -12457,27 +12148,33 @@ Instruction *InstCombiner::visitExtractElementInst(ExtractElementInst &EI) { if (BinaryOperator *BO = dyn_cast(I)) { bool isConstantElt = isa(EI.getOperand(1)); if (CheapToScalarize(BO, isConstantElt)) { - ExtractElementInst *newEI0 = - ExtractElementInst::Create(BO->getOperand(0), EI.getOperand(1), - EI.getName()+".lhs"); - ExtractElementInst *newEI1 = - ExtractElementInst::Create(BO->getOperand(1), EI.getOperand(1), - EI.getName()+".rhs"); - InsertNewInstBefore(newEI0, EI); - InsertNewInstBefore(newEI1, EI); + Value *newEI0 = + Builder->CreateExtractElement(BO->getOperand(0), EI.getOperand(1), + EI.getName()+".lhs"); + Value *newEI1 = + Builder->CreateExtractElement(BO->getOperand(1), EI.getOperand(1), + EI.getName()+".rhs"); return BinaryOperator::Create(BO->getOpcode(), newEI0, newEI1); } - } else if (isa(I)) { - unsigned AS = - cast(I->getOperand(0)->getType())->getAddressSpace(); - Value *Ptr = InsertBitCastBefore(I->getOperand(0), - PointerType::get(EI.getType(), AS),*I); - GetElementPtrInst *GEP = - GetElementPtrInst::Create(Ptr, EI.getOperand(1), I->getName()+".gep"); + } else if (LoadInst *LI = dyn_cast(I)) { + unsigned AS = LI->getPointerAddressSpace(); + Value *Ptr = Builder->CreateBitCast(I->getOperand(0), + PointerType::get(EI.getType(), AS), + I->getOperand(0)->getName()); + Value *GEP = + Builder->CreateGEP(Ptr, EI.getOperand(1), I->getName()+".gep"); cast(GEP)->setIsInBounds(true); - InsertNewInstBefore(GEP, *I); - LoadInst* Load = new LoadInst(GEP, "tmp"); - InsertNewInstBefore(Load, *I); + + LoadInst *Load = Builder->CreateLoad(GEP, "tmp"); + + // Make sure the Load goes before the load instruction in the source, + // not wherever the extract happens to be. + if (Instruction *P = dyn_cast(Ptr)) + P->moveBefore(I); + if (Instruction *G = dyn_cast(GEP)) + G->moveBefore(I); + Load->moveBefore(I); + return ReplaceInstUsesWith(EI, Load); } } @@ -12487,9 +12184,8 @@ Instruction *InstCombiner::visitExtractElementInst(ExtractElementInst &EI) { return ReplaceInstUsesWith(EI, IE->getOperand(1)); // If the inserted and extracted elements are constants, they must not // be the same value, extract from the pre-inserted value instead. - if (isa(IE->getOperand(2)) && - isa(EI.getOperand(1))) { - AddUsesToWorkList(EI); + if (isa(IE->getOperand(2)) && isa(EI.getOperand(1))) { + Worklist.AddValue(EI.getOperand(0)); EI.setOperand(0, IE->getOperand(0)); return &EI; } @@ -12511,7 +12207,8 @@ Instruction *InstCombiner::visitExtractElementInst(ExtractElementInst &EI) { return ReplaceInstUsesWith(EI, UndefValue::get(EI.getType())); } return ExtractElementInst::Create(Src, - ConstantInt::get(Type::getInt32Ty(*Context), SrcIdx, false)); + ConstantInt::get(Type::getInt32Ty(*Context), SrcIdx, + false)); } } // FIXME: Canonicalize extractelement(bitcast) -> bitcast(extractelement) @@ -12938,7 +12635,7 @@ static void AddReachableCodeToWorklist(BasicBlock *BB, if (DBI_Prev && DBI_Prev->getIntrinsicID() == llvm::Intrinsic::dbg_stoppoint && DBI_Next->getIntrinsicID() == llvm::Intrinsic::dbg_stoppoint) { - IC.RemoveFromWorkList(DBI_Prev); + IC.Worklist.Remove(DBI_Prev); DBI_Prev->eraseFromParent(); } DBI_Prev = DBI_Next; @@ -12946,7 +12643,7 @@ static void AddReachableCodeToWorklist(BasicBlock *BB, DBI_Prev = 0; } - IC.AddToWorkList(Inst); + IC.Worklist.Add(Inst); } // Recursively visit successors. If this is a branch or switch on a @@ -12981,7 +12678,7 @@ static void AddReachableCodeToWorklist(BasicBlock *BB, } bool InstCombiner::DoOneIteration(Function &F, unsigned Iteration) { - bool Changed = false; + MadeIRChange = false; TD = getAnalysisIfAvailable(); DEBUG(errs() << "\n\nINSTCOMBINE ITERATION #" << Iteration << " on " @@ -13008,7 +12705,7 @@ bool InstCombiner::DoOneIteration(Function &F, unsigned Iteration) { // going to do one without it. if (!isa(I)) { ++NumDeadInst; - Changed = true; + MadeIRChange = true; } if (!I->use_empty()) I->replaceAllUsesWith(UndefValue::get(I->getType())); @@ -13017,22 +12714,16 @@ bool InstCombiner::DoOneIteration(Function &F, unsigned Iteration) { } } - while (!Worklist.empty()) { - Instruction *I = RemoveOneFromWorkList(); + while (!Worklist.isEmpty()) { + Instruction *I = Worklist.RemoveOne(); if (I == 0) continue; // skip null values. // Check to see if we can DCE the instruction. if (isInstructionTriviallyDead(I)) { - // Add operands to the worklist. - if (I->getNumOperands() < 4) - AddUsesToWorkList(*I); - ++NumDeadInst; - DEBUG(errs() << "IC: DCE: " << *I << '\n'); - - I->eraseFromParent(); - RemoveFromWorkList(I); - Changed = true; + EraseInstFromFunction(*I); + ++NumDeadInst; + MadeIRChange = true; continue; } @@ -13041,13 +12732,10 @@ bool InstCombiner::DoOneIteration(Function &F, unsigned Iteration) { DEBUG(errs() << "IC: ConstFold to: " << *C << " from: " << *I << '\n'); // Add operands to the worklist. - AddUsesToWorkList(*I); ReplaceInstUsesWith(*I, C); - ++NumConstProp; - I->eraseFromParent(); - RemoveFromWorkList(I); - Changed = true; + EraseInstFromFunction(*I); + MadeIRChange = true; continue; } @@ -13059,7 +12747,7 @@ bool InstCombiner::DoOneIteration(Function &F, unsigned Iteration) { F.getContext(), TD)) if (NewC != CE) { i->set(NewC); - Changed = true; + MadeIRChange = true; } } @@ -13082,15 +12770,18 @@ bool InstCombiner::DoOneIteration(Function &F, unsigned Iteration) { if (UserIsSuccessor && !isa(I->use_back()) && next(pred_begin(UserParent)) == pred_end(UserParent)) // Okay, the CFG is simple enough, try to sink this instruction. - Changed |= TryToSinkInstruction(I, UserParent); + MadeIRChange |= TryToSinkInstruction(I, UserParent); } } - // Now that we have an instruction, try combining it to simplify it... + // Now that we have an instruction, try combining it to simplify it. + Builder->SetInsertPoint(I->getParent(), I); + #ifndef NDEBUG std::string OrigI; #endif DEBUG(raw_string_ostream SS(OrigI); I->print(SS); OrigI = SS.str();); + if (Instruction *Result = visit(*I)) { ++NumCombined; // Should we replace the old instruction with a new one? @@ -13102,8 +12793,8 @@ bool InstCombiner::DoOneIteration(Function &F, unsigned Iteration) { I->replaceAllUsesWith(Result); // Push the new instruction and any users onto the worklist. - AddToWorkList(Result); - AddUsersToWorkList(*Result); + Worklist.Add(Result); + Worklist.AddUsersToWorkList(*Result); // Move the name to the new instruction first. Result->takeName(I); @@ -13118,16 +12809,7 @@ bool InstCombiner::DoOneIteration(Function &F, unsigned Iteration) { InstParent->getInstList().insert(InsertPos, Result); - // Make sure that we reprocess all operands now that we reduced their - // use counts. - AddUsesToWorkList(*I); - - // Instructions can end up on the worklist more than once. Make sure - // we do not process an instruction that has been deleted. - RemoveFromWorkList(I); - - // Erase the old instruction. - InstParent->getInstList().erase(I); + EraseInstFromFunction(*I); } else { #ifndef NDEBUG DEBUG(errs() << "IC: Mod = " << OrigI << '\n' @@ -13137,28 +12819,18 @@ bool InstCombiner::DoOneIteration(Function &F, unsigned Iteration) { // If the instruction was modified, it's possible that it is now dead. // if so, remove it. if (isInstructionTriviallyDead(I)) { - // Make sure we process all operands now that we are reducing their - // use counts. - AddUsesToWorkList(*I); - - // Instructions may end up in the worklist more than once. Erase all - // occurrences of this instruction. - RemoveFromWorkList(I); - I->eraseFromParent(); + EraseInstFromFunction(*I); } else { - AddToWorkList(I); - AddUsersToWorkList(*I); + Worklist.Add(I); + Worklist.AddUsersToWorkList(*I); } } - Changed = true; + MadeIRChange = true; } } - assert(WorklistMap.empty() && "Worklist empty, but map not?"); - - // Do an explicit clear, this shrinks the map if needed. - WorklistMap.clear(); - return Changed; + Worklist.Zap(); + return MadeIRChange; } @@ -13166,12 +12838,22 @@ bool InstCombiner::runOnFunction(Function &F) { MustPreserveLCSSA = mustPreserveAnalysisID(LCSSAID); Context = &F.getContext(); + + /// Builder - This is an IRBuilder that automatically inserts new + /// instructions into the worklist when they are created. + IRBuilder + TheBuilder(F.getContext(), ConstantFolder(F.getContext()), + InstCombineIRInserter(Worklist)); + Builder = &TheBuilder; + bool EverMadeChange = false; // Iterate while there is work to do. unsigned Iteration = 0; while (DoOneIteration(F, Iteration++)) EverMadeChange = true; + + Builder = 0; return EverMadeChange; } diff --git a/libclamav/c++/llvm/lib/Transforms/Scalar/LoopIndexSplit.cpp b/libclamav/c++/llvm/lib/Transforms/Scalar/LoopIndexSplit.cpp index 792b7537e..259427e99 100644 --- a/libclamav/c++/llvm/lib/Transforms/Scalar/LoopIndexSplit.cpp +++ b/libclamav/c++/llvm/lib/Transforms/Scalar/LoopIndexSplit.cpp @@ -435,7 +435,7 @@ bool LoopIndexSplit::processOneIterationLoop() { CmpInst::Predicate C2P = ExitCondition->getPredicate(); BranchInst *LatchBR = cast(Latch->getTerminator()); - if (LatchBR->getOperand(0) != Header) + if (LatchBR->getOperand(1) != Header) C2P = CmpInst::getInversePredicate(C2P); Instruction *C2 = new ICmpInst(BR, C2P, SplitValue, ExitValue, "lisplit"); Instruction *NSplitCond = BinaryOperator::CreateAnd(C1, C2, "lisplit", BR); diff --git a/libclamav/c++/llvm/lib/Transforms/Scalar/SCCP.cpp b/libclamav/c++/llvm/lib/Transforms/Scalar/SCCP.cpp index 3c6dcadaa..155e91ec7 100644 --- a/libclamav/c++/llvm/lib/Transforms/Scalar/SCCP.cpp +++ b/libclamav/c++/llvm/lib/Transforms/Scalar/SCCP.cpp @@ -1131,8 +1131,7 @@ void SCCPSolver::visitLoadInst(LoadInst &I) { if (PtrVal.isConstant() && !I.isVolatile()) { Value *Ptr = PtrVal.getConstant(); // TODO: Consider a target hook for valid address spaces for this xform. - if (isa(Ptr) && - cast(Ptr->getType())->getAddressSpace() == 0) { + if (isa(Ptr) && I.getPointerAddressSpace() == 0) { // load null -> null markConstant(IV, &I, Constant::getNullValue(I.getType())); return; diff --git a/libclamav/c++/llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp b/libclamav/c++/llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp index 5de79c49c..ca4292bca 100644 --- a/libclamav/c++/llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp +++ b/libclamav/c++/llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp @@ -132,7 +132,7 @@ static bool MarkAliveBlocks(BasicBlock *BB, if (isa(Ptr) || (isa(Ptr) && - cast(Ptr->getType())->getAddressSpace() == 0)) { + SI->getPointerAddressSpace() == 0)) { ChangeToUnreachable(SI, Context); Changed = true; break; diff --git a/libclamav/c++/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp b/libclamav/c++/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp index 3072cee61..c3d619480 100644 --- a/libclamav/c++/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp +++ b/libclamav/c++/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp @@ -504,11 +504,15 @@ static bool AreEquivalentAddressValues(const Value *A, const Value *B) { // Test if the values are trivially equivalent. if (A == B) return true; - // Test if the values come form identical arithmetic instructions. + // Test if the values come from identical arithmetic instructions. + // Use isIdenticalToWhenDefined instead of isIdenticalTo because + // this function is only used when one address use dominates the + // other, which means that they'll always either have the same + // value or one of them will have an undefined value. if (isa(A) || isa(A) || isa(A) || isa(A)) if (const Instruction *BI = dyn_cast(B)) - if (cast(A)->isIdenticalTo(BI)) + if (cast(A)->isIdenticalToWhenDefined(BI)) return true; // Otherwise they may not be equivalent. diff --git a/libclamav/c++/llvm/lib/Transforms/Utils/CMakeLists.txt b/libclamav/c++/llvm/lib/Transforms/Utils/CMakeLists.txt index e11aca164..aca4bca50 100644 --- a/libclamav/c++/llvm/lib/Transforms/Utils/CMakeLists.txt +++ b/libclamav/c++/llvm/lib/Transforms/Utils/CMakeLists.txt @@ -6,7 +6,6 @@ add_llvm_library(LLVMTransformUtils CloneFunction.cpp CloneLoop.cpp CloneModule.cpp - CloneTrace.cpp CodeExtractor.cpp DemoteRegToStack.cpp InlineCost.cpp diff --git a/libclamav/c++/llvm/lib/Transforms/Utils/CloneFunction.cpp b/libclamav/c++/llvm/lib/Transforms/Utils/CloneFunction.cpp index a6df16174..fd72ca1d9 100644 --- a/libclamav/c++/llvm/lib/Transforms/Utils/CloneFunction.cpp +++ b/libclamav/c++/llvm/lib/Transforms/Utils/CloneFunction.cpp @@ -73,7 +73,7 @@ BasicBlock *llvm::CloneBasicBlock(const BasicBlock *BB, // void llvm::CloneFunctionInto(Function *NewFunc, const Function *OldFunc, DenseMap &ValueMap, - std::vector &Returns, + SmallVectorImpl &Returns, const char *NameSuffix, ClonedCodeInfo *CodeInfo) { assert(NameSuffix && "NameSuffix cannot be null!"); @@ -166,7 +166,7 @@ Function *llvm::CloneFunction(const Function *F, ValueMap[I] = DestI++; // Add mapping to ValueMap } - std::vector Returns; // Ignore returns cloned... + SmallVector Returns; // Ignore returns cloned. CloneFunctionInto(NewF, F, ValueMap, Returns, "", CodeInfo); return NewF; } @@ -180,7 +180,7 @@ namespace { Function *NewFunc; const Function *OldFunc; DenseMap &ValueMap; - std::vector &Returns; + SmallVectorImpl &Returns; const char *NameSuffix; ClonedCodeInfo *CodeInfo; const TargetData *TD; @@ -188,7 +188,7 @@ namespace { public: PruningFunctionCloner(Function *newFunc, const Function *oldFunc, DenseMap &valueMap, - std::vector &returns, + SmallVectorImpl &returns, const char *nameSuffix, ClonedCodeInfo *codeInfo, const TargetData *td) @@ -238,7 +238,7 @@ void PruningFunctionCloner::CloneBlock(const BasicBlock *BB, // Do not clone llvm.dbg.region.end. It will be adjusted by the inliner. if (const DbgFuncStartInst *DFSI = dyn_cast(II)) { if (DbgFnStart == NULL) { - DISubprogram SP(cast(DFSI->getSubprogram())); + DISubprogram SP(DFSI->getSubprogram()); if (SP.describes(BB->getParent())) DbgFnStart = DFSI->getSubprogram(); } @@ -361,7 +361,7 @@ ConstantFoldMappedInstruction(const Instruction *I) { /// used for things like CloneFunction or CloneModule. void llvm::CloneAndPruneFunctionInto(Function *NewFunc, const Function *OldFunc, DenseMap &ValueMap, - std::vector &Returns, + SmallVectorImpl &Returns, const char *NameSuffix, ClonedCodeInfo *CodeInfo, const TargetData *TD) { @@ -391,7 +391,7 @@ void llvm::CloneAndPruneFunctionInto(Function *NewFunc, const Function *OldFunc, // insert it into the new function in the right order. If not, ignore it. // // Defer PHI resolution until rest of function is resolved. - std::vector PHIToResolve; + SmallVector PHIToResolve; for (Function::const_iterator BI = OldFunc->begin(), BE = OldFunc->end(); BI != BE; ++BI) { BasicBlock *NewBB = cast_or_null(ValueMap[BI]); diff --git a/libclamav/c++/llvm/lib/Transforms/Utils/CloneModule.cpp b/libclamav/c++/llvm/lib/Transforms/Utils/CloneModule.cpp index 13b2d4697..0285f8c8d 100644 --- a/libclamav/c++/llvm/lib/Transforms/Utils/CloneModule.cpp +++ b/libclamav/c++/llvm/lib/Transforms/Utils/CloneModule.cpp @@ -108,7 +108,7 @@ Module *llvm::CloneModule(const Module *M, ValueMap[J] = DestI++; } - std::vector Returns; // Ignore returns cloned... + SmallVector Returns; // Ignore returns cloned. CloneFunctionInto(F, I, ValueMap, Returns); } diff --git a/libclamav/c++/llvm/lib/Transforms/Utils/CloneTrace.cpp b/libclamav/c++/llvm/lib/Transforms/Utils/CloneTrace.cpp deleted file mode 100644 index 07111393e..000000000 --- a/libclamav/c++/llvm/lib/Transforms/Utils/CloneTrace.cpp +++ /dev/null @@ -1,119 +0,0 @@ -//===- CloneTrace.cpp - Clone a trace -------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file implements the CloneTrace interface, which is used when writing -// runtime optimizations. It takes a vector of basic blocks clones the basic -// blocks, removes internal phi nodes, adds it to the same function as the -// original (although there is no jump to it) and returns the new vector of -// basic blocks. -// -//===----------------------------------------------------------------------===// - -#include "llvm/Analysis/Trace.h" -#include "llvm/Transforms/Utils/Cloning.h" -#include "llvm/Instructions.h" -#include "llvm/Function.h" -#include "llvm/Transforms/Utils/ValueMapper.h" -using namespace llvm; - -//Clones the trace (a vector of basic blocks) -std::vector -llvm::CloneTrace(const std::vector &origTrace) { - std::vector clonedTrace; - DenseMap ValueMap; - - //First, loop over all the Basic Blocks in the trace and copy - //them using CloneBasicBlock. Also fix the phi nodes during - //this loop. To fix the phi nodes, we delete incoming branches - //that are not in the trace. - for (std::vector::const_iterator T = origTrace.begin(), - End = origTrace.end(); T != End; ++T) { - - //Clone Basic Block - BasicBlock *clonedBlock = - CloneBasicBlock(*T, ValueMap, ".tr", (*T)->getParent()); - - //Add it to our new trace - clonedTrace.push_back(clonedBlock); - - //Add this new mapping to our Value Map - ValueMap[*T] = clonedBlock; - - //Loop over the phi instructions and delete operands - //that are from blocks not in the trace - //only do this if we are NOT the first block - if (T != origTrace.begin()) { - for (BasicBlock::iterator I = clonedBlock->begin(); - isa(I); ++I) { - PHINode *PN = cast(I); - //get incoming value for the previous BB - Value *V = PN->getIncomingValueForBlock(*(T-1)); - assert(V && "No incoming value from a BasicBlock in our trace!"); - - //remap our phi node to point to incoming value - ValueMap[*&I] = V; - - //remove phi node - clonedBlock->getInstList().erase(PN); - } - } - } - - //Second loop to do the remapping - for (std::vector::const_iterator BB = clonedTrace.begin(), - BE = clonedTrace.end(); BB != BE; ++BB) { - for (BasicBlock::iterator I = (*BB)->begin(); I != (*BB)->end(); ++I) { - //Loop over all the operands of the instruction - for (unsigned op=0, E = I->getNumOperands(); op != E; ++op) { - const Value *Op = I->getOperand(op); - - //Get it out of the value map - Value *V = ValueMap[Op]; - - //If not in the value map, then its outside our trace so ignore - if (V != 0) - I->setOperand(op,V); - } - } - } - - //return new vector of basic blocks - return clonedTrace; -} - -/// CloneTraceInto - Clone T into NewFunc. Original<->clone mapping is -/// saved in ValueMap. -/// -void llvm::CloneTraceInto(Function *NewFunc, Trace &T, - DenseMap &ValueMap, - const char *NameSuffix) { - assert(NameSuffix && "NameSuffix cannot be null!"); - - // Loop over all of the basic blocks in the trace, cloning them as - // appropriate. - // - for (Trace::const_iterator BI = T.begin(), BE = T.end(); BI != BE; ++BI) { - const BasicBlock *BB = *BI; - - // Create a new basic block and copy instructions into it! - BasicBlock *CBB = CloneBasicBlock(BB, ValueMap, NameSuffix, NewFunc); - ValueMap[BB] = CBB; // Add basic block mapping. - } - - // Loop over all of the instructions in the new function, fixing up operand - // references as we go. This uses ValueMap to do all the hard work. - // - for (Function::iterator BB = - cast(ValueMap[T.getEntryBasicBlock()]), - BE = NewFunc->end(); BB != BE; ++BB) - // Loop over all instructions, fixing each one as we find it... - for (BasicBlock::iterator II = BB->begin(); II != BB->end(); ++II) - RemapInstruction(II, ValueMap); -} - diff --git a/libclamav/c++/llvm/lib/Transforms/Utils/CodeExtractor.cpp b/libclamav/c++/llvm/lib/Transforms/Utils/CodeExtractor.cpp index 0558bf09c..c39ccf7d3 100644 --- a/libclamav/c++/llvm/lib/Transforms/Utils/CodeExtractor.cpp +++ b/libclamav/c++/llvm/lib/Transforms/Utils/CodeExtractor.cpp @@ -183,8 +183,24 @@ void CodeExtractor::severSplitPHINodes(BasicBlock *&Header) { void CodeExtractor::splitReturnBlocks() { for (std::set::iterator I = BlocksToExtract.begin(), E = BlocksToExtract.end(); I != E; ++I) - if (ReturnInst *RI = dyn_cast((*I)->getTerminator())) - (*I)->splitBasicBlock(RI, (*I)->getName()+".ret"); + if (ReturnInst *RI = dyn_cast((*I)->getTerminator())) { + BasicBlock *New = (*I)->splitBasicBlock(RI, (*I)->getName()+".ret"); + if (DT) { + // Old dominates New. New node domiantes all other nodes dominated + //by Old. + DomTreeNode *OldNode = DT->getNode(*I); + SmallVector Children; + for (DomTreeNode::iterator DI = OldNode->begin(), DE = OldNode->end(); + DI != DE; ++DI) + Children.push_back(*DI); + + DomTreeNode *NewNode = DT->addNewBlock(New, *I); + + for (SmallVector::iterator I = Children.begin(), + E = Children.end(); I != E; ++I) + DT->changeImmediateDominator(*I, NewNode); + } + } } // findInputsOutputs - Find inputs to, outputs from the code region. @@ -345,6 +361,20 @@ Function *CodeExtractor::constructFunction(const Values &inputs, return newFunction; } +/// FindPhiPredForUseInBlock - Given a value and a basic block, find a PHI +/// that uses the value within the basic block, and return the predecessor +/// block associated with that use, or return 0 if none is found. +static BasicBlock* FindPhiPredForUseInBlock(Value* Used, BasicBlock* BB) { + for (Value::use_iterator UI = Used->use_begin(), + UE = Used->use_end(); UI != UE; ++UI) { + PHINode *P = dyn_cast(*UI); + if (P && P->getParent() == BB) + return P->getIncomingBlock(UI); + } + + return 0; +} + /// emitCallAndSwitchStatement - This method sets up the caller side by adding /// the call instruction, splitting any PHI nodes in the header block as /// necessary. @@ -353,7 +383,7 @@ emitCallAndSwitchStatement(Function *newFunction, BasicBlock *codeReplacer, Values &inputs, Values &outputs) { // Emit a call to the new function, passing in: *pointer to struct (if // aggregating parameters), or plan inputs and allocated memory for outputs - std::vector params, StructValues, ReloadOutputs; + std::vector params, StructValues, ReloadOutputs, Reloads; LLVMContext &Context = newFunction->getContext(); @@ -430,6 +460,7 @@ emitCallAndSwitchStatement(Function *newFunction, BasicBlock *codeReplacer, Output = ReloadOutputs[i]; } LoadInst *load = new LoadInst(Output, outputs[i]->getName()+".reload"); + Reloads.push_back(load); codeReplacer->getInstList().push_back(load); std::vector Users(outputs[i]->use_begin(), outputs[i]->use_end()); for (unsigned u = 0, e = Users.size(); u != e; ++u) { @@ -516,8 +547,18 @@ emitCallAndSwitchStatement(Function *newFunction, BasicBlock *codeReplacer, DominatesDef = false; } - if (DT) + if (DT) { DominatesDef = DT->dominates(DefBlock, OldTarget); + + // If the output value is used by a phi in the target block, + // then we need to test for dominance of the phi's predecessor + // instead. Unfortunately, this a little complicated since we + // have already rewritten uses of the value to uses of the reload. + BasicBlock* pred = FindPhiPredForUseInBlock(Reloads[out], + OldTarget); + if (pred && DT && DT->dominates(DefBlock, pred)) + DominatesDef = true; + } if (DominatesDef) { if (AggregateArgs) { diff --git a/libclamav/c++/llvm/lib/Transforms/Utils/InlineCost.cpp b/libclamav/c++/llvm/lib/Transforms/Utils/InlineCost.cpp index 1a04b96be..fe4d060e9 100644 --- a/libclamav/c++/llvm/lib/Transforms/Utils/InlineCost.cpp +++ b/libclamav/c++/llvm/lib/Transforms/Utils/InlineCost.cpp @@ -16,7 +16,7 @@ #include "llvm/Support/CallSite.h" #include "llvm/CallingConv.h" #include "llvm/IntrinsicInst.h" - +#include "llvm/ADT/SmallPtrSet.h" using namespace llvm; // CountCodeReductionForConstant - Figure out an approximation for how many diff --git a/libclamav/c++/llvm/lib/Transforms/Utils/InlineFunction.cpp b/libclamav/c++/llvm/lib/Transforms/Utils/InlineFunction.cpp index c0d10f489..4e738e498 100644 --- a/libclamav/c++/llvm/lib/Transforms/Utils/InlineFunction.cpp +++ b/libclamav/c++/llvm/lib/Transforms/Utils/InlineFunction.cpp @@ -29,13 +29,89 @@ #include "llvm/Support/CallSite.h" using namespace llvm; -bool llvm::InlineFunction(CallInst *CI, CallGraph *CG, const TargetData *TD) { - return InlineFunction(CallSite(CI), CG, TD); +bool llvm::InlineFunction(CallInst *CI, CallGraph *CG, const TargetData *TD, + SmallVectorImpl *StaticAllocas) { + return InlineFunction(CallSite(CI), CG, TD, StaticAllocas); } -bool llvm::InlineFunction(InvokeInst *II, CallGraph *CG, const TargetData *TD) { - return InlineFunction(CallSite(II), CG, TD); +bool llvm::InlineFunction(InvokeInst *II, CallGraph *CG, const TargetData *TD, + SmallVectorImpl *StaticAllocas) { + return InlineFunction(CallSite(II), CG, TD, StaticAllocas); } + +/// HandleCallsInBlockInlinedThroughInvoke - When we inline a basic block into +/// an invoke, we have to check all of all of the calls that can throw into +/// invokes. This function analyze BB to see if there are any calls, and if so, +/// it rewrites them to be invokes that jump to InvokeDest and fills in the PHI +/// nodes in that block with the values specified in InvokeDestPHIValues. If +/// CallerCGN is specified, this function updates the call graph. +/// +static void HandleCallsInBlockInlinedThroughInvoke(BasicBlock *BB, + BasicBlock *InvokeDest, + const SmallVectorImpl &InvokeDestPHIValues, + CallGraphNode *CallerCGN) { + for (BasicBlock::iterator BBI = BB->begin(), E = BB->end(); BBI != E; ) { + Instruction *I = BBI++; + + // We only need to check for function calls: inlined invoke + // instructions require no special handling. + CallInst *CI = dyn_cast(I); + if (CI == 0) continue; + + // If this call cannot unwind, don't convert it to an invoke. + if (CI->doesNotThrow()) + continue; + + // Convert this function call into an invoke instruction. + // First, split the basic block. + BasicBlock *Split = BB->splitBasicBlock(CI, CI->getName()+".noexc"); + + // Next, create the new invoke instruction, inserting it at the end + // of the old basic block. + SmallVector InvokeArgs(CI->op_begin()+1, CI->op_end()); + InvokeInst *II = + InvokeInst::Create(CI->getCalledValue(), Split, InvokeDest, + InvokeArgs.begin(), InvokeArgs.end(), + CI->getName(), BB->getTerminator()); + II->setCallingConv(CI->getCallingConv()); + II->setAttributes(CI->getAttributes()); + + // Make sure that anything using the call now uses the invoke! + CI->replaceAllUsesWith(II); + + // Update the callgraph if present. + if (CallerCGN) { + // We should be able to do this: + // (*CG)[Caller]->replaceCallSite(CI, II); + // but that fails if the old call site isn't in the call graph, + // which, because of LLVM bug 3601, it sometimes isn't. + for (CallGraphNode::iterator NI = CallerCGN->begin(), NE = CallerCGN->end(); + NI != NE; ++NI) { + if (NI->first == CI) { + NI->first = II; + break; + } + } + } + + // Delete the unconditional branch inserted by splitBasicBlock + BB->getInstList().pop_back(); + Split->getInstList().pop_front(); // Delete the original call + + // Update any PHI nodes in the exceptional block to indicate that + // there is now a new entry in them. + unsigned i = 0; + for (BasicBlock::iterator I = InvokeDest->begin(); + isa(I); ++I, ++i) + cast(I)->addIncoming(InvokeDestPHIValues[i], BB); + + // This basic block is now complete, the caller will continue scanning the + // next one. + return; + } +} + + /// HandleInlinedInvoke - If we inlined an invoke site, we need to convert calls /// in the body of the inlined function into invokes and turn unwind /// instructions into branches to the invoke unwind dest. @@ -47,7 +123,7 @@ static void HandleInlinedInvoke(InvokeInst *II, BasicBlock *FirstNewBlock, ClonedCodeInfo &InlinedCodeInfo, CallGraph *CG) { BasicBlock *InvokeDest = II->getUnwindDest(); - std::vector InvokeDestPHIValues; + SmallVector InvokeDestPHIValues; // If there are PHI nodes in the unwind destination block, we need to // keep track of which values came into them from this invoke, then remove @@ -63,92 +139,42 @@ static void HandleInlinedInvoke(InvokeInst *II, BasicBlock *FirstNewBlock, // The inlined code is currently at the end of the function, scan from the // start of the inlined code to its end, checking for stuff we need to - // rewrite. - if (InlinedCodeInfo.ContainsCalls || InlinedCodeInfo.ContainsUnwinds) { - for (Function::iterator BB = FirstNewBlock, E = Caller->end(); - BB != E; ++BB) { - if (InlinedCodeInfo.ContainsCalls) { - for (BasicBlock::iterator BBI = BB->begin(), E = BB->end(); BBI != E; ){ - Instruction *I = BBI++; + // rewrite. If the code doesn't have calls or unwinds, we know there is + // nothing to rewrite. + if (!InlinedCodeInfo.ContainsCalls && !InlinedCodeInfo.ContainsUnwinds) { + // Now that everything is happy, we have one final detail. The PHI nodes in + // the exception destination block still have entries due to the original + // invoke instruction. Eliminate these entries (which might even delete the + // PHI node) now. + InvokeDest->removePredecessor(II->getParent()); + return; + } + + CallGraphNode *CallerCGN = 0; + if (CG) CallerCGN = (*CG)[Caller]; + + for (Function::iterator BB = FirstNewBlock, E = Caller->end(); BB != E; ++BB){ + if (InlinedCodeInfo.ContainsCalls) + HandleCallsInBlockInlinedThroughInvoke(BB, InvokeDest, + InvokeDestPHIValues, CallerCGN); - // We only need to check for function calls: inlined invoke - // instructions require no special handling. - if (!isa(I)) continue; - CallInst *CI = cast(I); + if (UnwindInst *UI = dyn_cast(BB->getTerminator())) { + // An UnwindInst requires special handling when it gets inlined into an + // invoke site. Once this happens, we know that the unwind would cause + // a control transfer to the invoke exception destination, so we can + // transform it into a direct branch to the exception destination. + BranchInst::Create(InvokeDest, UI); - // If this call cannot unwind, don't convert it to an invoke. - if (CI->doesNotThrow()) - continue; + // Delete the unwind instruction! + UI->eraseFromParent(); - // Convert this function call into an invoke instruction. - // First, split the basic block. - BasicBlock *Split = BB->splitBasicBlock(CI, CI->getName()+".noexc"); - - // Next, create the new invoke instruction, inserting it at the end - // of the old basic block. - SmallVector InvokeArgs(CI->op_begin()+1, CI->op_end()); - InvokeInst *II = - InvokeInst::Create(CI->getCalledValue(), Split, InvokeDest, - InvokeArgs.begin(), InvokeArgs.end(), - CI->getName(), BB->getTerminator()); - II->setCallingConv(CI->getCallingConv()); - II->setAttributes(CI->getAttributes()); - - // Make sure that anything using the call now uses the invoke! - CI->replaceAllUsesWith(II); - - // Update the callgraph. - if (CG) { - // We should be able to do this: - // (*CG)[Caller]->replaceCallSite(CI, II); - // but that fails if the old call site isn't in the call graph, - // which, because of LLVM bug 3601, it sometimes isn't. - CallGraphNode *CGN = (*CG)[Caller]; - for (CallGraphNode::iterator NI = CGN->begin(), NE = CGN->end(); - NI != NE; ++NI) { - if (NI->first == CI) { - NI->first = II; - break; - } - } - } - - // Delete the unconditional branch inserted by splitBasicBlock - BB->getInstList().pop_back(); - Split->getInstList().pop_front(); // Delete the original call - - // Update any PHI nodes in the exceptional block to indicate that - // there is now a new entry in them. - unsigned i = 0; - for (BasicBlock::iterator I = InvokeDest->begin(); - isa(I); ++I, ++i) { - PHINode *PN = cast(I); - PN->addIncoming(InvokeDestPHIValues[i], BB); - } - - // This basic block is now complete, start scanning the next one. - break; - } - } - - if (UnwindInst *UI = dyn_cast(BB->getTerminator())) { - // An UnwindInst requires special handling when it gets inlined into an - // invoke site. Once this happens, we know that the unwind would cause - // a control transfer to the invoke exception destination, so we can - // transform it into a direct branch to the exception destination. - BranchInst::Create(InvokeDest, UI); - - // Delete the unwind instruction! - UI->eraseFromParent(); - - // Update any PHI nodes in the exceptional block to indicate that - // there is now a new entry in them. - unsigned i = 0; - for (BasicBlock::iterator I = InvokeDest->begin(); - isa(I); ++I, ++i) { - PHINode *PN = cast(I); - PN->addIncoming(InvokeDestPHIValues[i], BB); - } + // Update any PHI nodes in the exceptional block to indicate that + // there is now a new entry in them. + unsigned i = 0; + for (BasicBlock::iterator I = InvokeDest->begin(); + isa(I); ++I, ++i) { + PHINode *PN = cast(I); + PN->addIncoming(InvokeDestPHIValues[i], BB); } } } @@ -190,13 +216,15 @@ static void UpdateCallGraphAfterInlining(CallSite CS, DenseMap::iterator VMI = ValueMap.find(OrigCall); // Only copy the edge if the call was inlined! - if (VMI != ValueMap.end() && VMI->second) { - // If the call was inlined, but then constant folded, there is no edge to - // add. Check for this case. - if (Instruction *NewCall = dyn_cast(VMI->second)) - CallerNode->addCalledFunction(CallSite::get(NewCall), I->second); - } + if (VMI == ValueMap.end() || VMI->second == 0) + continue; + + // If the call was inlined, but then constant folded, there is no edge to + // add. Check for this case. + if (Instruction *NewCall = dyn_cast(VMI->second)) + CallerNode->addCalledFunction(CallSite::get(NewCall), I->second); } + // Update the call graph by deleting the edge from Callee to Caller. We must // do this after the loop above in case Caller and Callee are the same. CallerNode->removeCallEdgeFor(CS); @@ -205,25 +233,27 @@ static void UpdateCallGraphAfterInlining(CallSite CS, /// findFnRegionEndMarker - This is a utility routine that is used by /// InlineFunction. Return llvm.dbg.region.end intrinsic that corresponds /// to the llvm.dbg.func.start of the function F. Otherwise return NULL. +/// static const DbgRegionEndInst *findFnRegionEndMarker(const Function *F) { - GlobalVariable *FnStart = NULL; + MDNode *FnStart = NULL; const DbgRegionEndInst *FnEnd = NULL; for (Function::const_iterator FI = F->begin(), FE =F->end(); FI != FE; ++FI) for (BasicBlock::const_iterator BI = FI->begin(), BE = FI->end(); BI != BE; ++BI) { if (FnStart == NULL) { if (const DbgFuncStartInst *FSI = dyn_cast(BI)) { - DISubprogram SP(cast(FSI->getSubprogram())); + DISubprogram SP(FSI->getSubprogram()); assert (SP.isNull() == false && "Invalid llvm.dbg.func.start"); if (SP.describes(F)) - FnStart = SP.getGV(); + FnStart = SP.getNode(); } - } else { - if (const DbgRegionEndInst *REI = dyn_cast(BI)) - if (REI->getContext() == FnStart) - FnEnd = REI; + continue; } + + if (const DbgRegionEndInst *REI = dyn_cast(BI)) + if (REI->getContext() == FnStart) + FnEnd = REI; } return FnEnd; } @@ -237,7 +267,8 @@ static const DbgRegionEndInst *findFnRegionEndMarker(const Function *F) { // exists in the instruction stream. Similiarly this will inline a recursive // function by one level. // -bool llvm::InlineFunction(CallSite CS, CallGraph *CG, const TargetData *TD) { +bool llvm::InlineFunction(CallSite CS, CallGraph *CG, const TargetData *TD, + SmallVectorImpl *StaticAllocas) { Instruction *TheCall = CS.getInstruction(); LLVMContext &Context = TheCall->getContext(); assert(TheCall->getParent() && TheCall->getParent()->getParent() && @@ -279,7 +310,7 @@ bool llvm::InlineFunction(CallSite CS, CallGraph *CG, const TargetData *TD) { // Make sure to capture all of the return instructions from the cloned // function. - std::vector Returns; + SmallVector Returns; ClonedCodeInfo InlinedFunctionInfo; Function::iterator FirstNewBlock; @@ -358,13 +389,12 @@ bool llvm::InlineFunction(CallSite CS, CallGraph *CG, const TargetData *TD) { // call site. The function body cloner does not clone original // region end marker from the CalledFunc. This will ensure that // inlined function's scope ends at the right place. - const DbgRegionEndInst *DREI = findFnRegionEndMarker(CalledFunc); - if (DREI) { - for (BasicBlock::iterator BI = TheCall, - BE = TheCall->getParent()->end(); BI != BE; ++BI) { + if (const DbgRegionEndInst *DREI = findFnRegionEndMarker(CalledFunc)) { + for (BasicBlock::iterator BI = TheCall, BE = TheCall->getParent()->end(); + BI != BE; ++BI) { if (DbgStopPointInst *DSPI = dyn_cast(BI)) { if (DbgRegionEndInst *NewDREI = - dyn_cast(DREI->clone(Context))) + dyn_cast(DREI->clone(Context))) NewDREI->insertAfter(DSPI); break; } @@ -394,31 +424,39 @@ bool llvm::InlineFunction(CallSite CS, CallGraph *CG, const TargetData *TD) { { BasicBlock::iterator InsertPoint = Caller->begin()->begin(); for (BasicBlock::iterator I = FirstNewBlock->begin(), - E = FirstNewBlock->end(); I != E; ) - if (AllocaInst *AI = dyn_cast(I++)) { - // If the alloca is now dead, remove it. This often occurs due to code - // specialization. - if (AI->use_empty()) { - AI->eraseFromParent(); - continue; - } - - if (isa(AI->getArraySize())) { - // Scan for the block of allocas that we can move over, and move them - // all at once. - while (isa(I) && - isa(cast(I)->getArraySize())) - ++I; - - // Transfer all of the allocas over in a block. Using splice means - // that the instructions aren't removed from the symbol table, then - // reinserted. - Caller->getEntryBlock().getInstList().splice( - InsertPoint, - FirstNewBlock->getInstList(), - AI, I); - } + E = FirstNewBlock->end(); I != E; ) { + AllocaInst *AI = dyn_cast(I++); + if (AI == 0) continue; + + // If the alloca is now dead, remove it. This often occurs due to code + // specialization. + if (AI->use_empty()) { + AI->eraseFromParent(); + continue; } + + if (!isa(AI->getArraySize())) + continue; + + // Keep track of the static allocas that we inline into the caller if the + // StaticAllocas pointer is non-null. + if (StaticAllocas) StaticAllocas->push_back(AI); + + // Scan for the block of allocas that we can move over, and move them + // all at once. + while (isa(I) && + isa(cast(I)->getArraySize())) { + if (StaticAllocas) StaticAllocas->push_back(cast(I)); + ++I; + } + + // Transfer all of the allocas over in a block. Using splice means + // that the instructions aren't removed from the symbol table, then + // reinserted. + Caller->getEntryBlock().getInstList().splice(InsertPoint, + FirstNewBlock->getInstList(), + AI, I); + } } // If the inlined code contained dynamic alloca instructions, wrap the inlined diff --git a/libclamav/c++/llvm/lib/Transforms/Utils/LowerSwitch.cpp b/libclamav/c++/llvm/lib/Transforms/Utils/LowerSwitch.cpp index 974698d45..764f0980c 100644 --- a/libclamav/c++/llvm/lib/Transforms/Utils/LowerSwitch.cpp +++ b/libclamav/c++/llvm/lib/Transforms/Utils/LowerSwitch.cpp @@ -159,7 +159,7 @@ BasicBlock* LowerSwitch::switchConvert(CaseItr Begin, CaseItr End, Function::iterator FI = OrigBlock; F->getBasicBlockList().insert(++FI, NewNode); - ICmpInst* Comp = new ICmpInst(Default->getContext(), ICmpInst::ICMP_SLT, + ICmpInst* Comp = new ICmpInst(ICmpInst::ICMP_SLT, Val, Pivot.Low, "Pivot"); NewNode->getInstList().push_back(Comp); BranchInst::Create(LBranch, RBranch, Comp, NewNode); diff --git a/libclamav/c++/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/libclamav/c++/llvm/lib/Transforms/Utils/SimplifyCFG.cpp index 7b7495e66..0938c44c9 100644 --- a/libclamav/c++/llvm/lib/Transforms/Utils/SimplifyCFG.cpp +++ b/libclamav/c++/llvm/lib/Transforms/Utils/SimplifyCFG.cpp @@ -872,7 +872,7 @@ static bool HoistThenElseCodeToIf(BranchInst *BI) { while (isa(I2)) I2 = BB2_Itr++; if (I1->getOpcode() != I2->getOpcode() || isa(I1) || - !I1->isIdenticalTo(I2) || + !I1->isIdenticalToWhenDefined(I2) || (isa(I1) && !isSafeToHoistInvoke(BB1, BB2, I1, I2))) return false; @@ -891,6 +891,7 @@ static bool HoistThenElseCodeToIf(BranchInst *BI) { BIParent->getInstList().splice(BI, BB1->getInstList(), I1); if (!I2->use_empty()) I2->replaceAllUsesWith(I1); + I1->intersectOptionalDataWith(I2); BB2->getInstList().erase(I2); I1 = BB1_Itr++; @@ -899,7 +900,8 @@ static bool HoistThenElseCodeToIf(BranchInst *BI) { I2 = BB2_Itr++; while (isa(I2)) I2 = BB2_Itr++; - } while (I1->getOpcode() == I2->getOpcode() && I1->isIdenticalTo(I2)); + } while (I1->getOpcode() == I2->getOpcode() && + I1->isIdenticalToWhenDefined(I2)); return true; diff --git a/libclamav/c++/llvm/lib/VMCore/Attributes.cpp b/libclamav/c++/llvm/lib/VMCore/Attributes.cpp index 51fd5f02a..d68bba307 100644 --- a/libclamav/c++/llvm/lib/VMCore/Attributes.cpp +++ b/libclamav/c++/llvm/lib/VMCore/Attributes.cpp @@ -55,6 +55,8 @@ std::string Attribute::getAsString(Attributes Attrs) { Result += "optsize "; if (Attrs & Attribute::NoInline) Result += "noinline "; + if (Attrs & Attribute::InlineHint) + Result += "inlinehint "; if (Attrs & Attribute::AlwaysInline) Result += "alwaysinline "; if (Attrs & Attribute::StackProtect) diff --git a/libclamav/c++/llvm/lib/VMCore/AutoUpgrade.cpp b/libclamav/c++/llvm/lib/VMCore/AutoUpgrade.cpp index e4c0d1afc..3f23b8d99 100644 --- a/libclamav/c++/llvm/lib/VMCore/AutoUpgrade.cpp +++ b/libclamav/c++/llvm/lib/VMCore/AutoUpgrade.cpp @@ -16,8 +16,7 @@ #include "llvm/Function.h" #include "llvm/LLVMContext.h" #include "llvm/Module.h" -#include "llvm/Instructions.h" -#include "llvm/Intrinsics.h" +#include "llvm/IntrinsicInst.h" #include "llvm/ADT/SmallVector.h" #include "llvm/Support/ErrorHandling.h" #include @@ -434,3 +433,74 @@ void llvm::UpgradeCallsToIntrinsic(Function* F) { } } } + +/// This function checks debug info intrinsics. If an intrinsic is invalid +/// then this function simply removes the intrinsic. +void llvm::CheckDebugInfoIntrinsics(Module *M) { + + + if (Function *FuncStart = M->getFunction("llvm.dbg.func.start")) { + if (!FuncStart->use_empty()) { + DbgFuncStartInst *DFSI = cast(FuncStart->use_back()); + if (!isa(DFSI->getOperand(1))) { + while (!FuncStart->use_empty()) { + CallInst *CI = cast(FuncStart->use_back()); + CI->eraseFromParent(); + } + FuncStart->eraseFromParent(); + } + } + } + + if (Function *StopPoint = M->getFunction("llvm.dbg.stoppoint")) { + if (!StopPoint->use_empty()) { + DbgStopPointInst *DSPI = cast(StopPoint->use_back()); + if (!isa(DSPI->getOperand(3))) { + while (!StopPoint->use_empty()) { + CallInst *CI = cast(StopPoint->use_back()); + CI->eraseFromParent(); + } + StopPoint->eraseFromParent(); + } + } + } + + if (Function *RegionStart = M->getFunction("llvm.dbg.region.start")) { + if (!RegionStart->use_empty()) { + DbgRegionStartInst *DRSI = cast(RegionStart->use_back()); + if (!isa(DRSI->getOperand(1))) { + while (!RegionStart->use_empty()) { + CallInst *CI = cast(RegionStart->use_back()); + CI->eraseFromParent(); + } + RegionStart->eraseFromParent(); + } + } + } + + if (Function *RegionEnd = M->getFunction("llvm.dbg.region.end")) { + if (!RegionEnd->use_empty()) { + DbgRegionEndInst *DREI = cast(RegionEnd->use_back()); + if (!isa(DREI->getOperand(1))) { + while (!RegionEnd->use_empty()) { + CallInst *CI = cast(RegionEnd->use_back()); + CI->eraseFromParent(); + } + RegionEnd->eraseFromParent(); + } + } + } + + if (Function *Declare = M->getFunction("llvm.dbg.declare")) { + if (!Declare->use_empty()) { + DbgDeclareInst *DDI = cast(Declare->use_back()); + if (!isa(DDI->getOperand(2))) { + while (!Declare->use_empty()) { + CallInst *CI = cast(Declare->use_back()); + CI->eraseFromParent(); + } + Declare->eraseFromParent(); + } + } + } +} diff --git a/libclamav/c++/llvm/lib/VMCore/ConstantFold.cpp b/libclamav/c++/llvm/lib/VMCore/ConstantFold.cpp index eda336a58..701a195f7 100644 --- a/libclamav/c++/llvm/lib/VMCore/ConstantFold.cpp +++ b/libclamav/c++/llvm/lib/VMCore/ConstantFold.cpp @@ -49,7 +49,7 @@ static Constant *BitCastConstantVector(LLVMContext &Context, ConstantVector *CV, unsigned NumElts = DstTy->getNumElements(); if (NumElts != CV->getNumOperands()) return 0; - + // Check to verify that all elements of the input are simple. for (unsigned i = 0; i != NumElts; ++i) { if (!isa(CV->getOperand(i)) && @@ -79,7 +79,7 @@ foldConstantCastPair( assert(Op && Op->isCast() && "Can't fold cast of cast without a cast!"); assert(DstTy && DstTy->isFirstClassType() && "Invalid cast destination type"); assert(CastInst::isCast(opc) && "Invalid cast opcode"); - + // The the types and opcodes for the two Cast constant expressions const Type *SrcTy = Op->getOperand(0)->getType(); const Type *MidTy = Op->getType(); @@ -96,7 +96,7 @@ static Constant *FoldBitCast(LLVMContext &Context, const Type *SrcTy = V->getType(); if (SrcTy == DestTy) return V; // no-op cast - + // Check to see if we are casting a pointer to an aggregate to a pointer to // the first element. If so, return the appropriate GEP instruction. if (const PointerType *PTy = dyn_cast(V->getType())) @@ -120,13 +120,13 @@ static Constant *FoldBitCast(LLVMContext &Context, break; } } - + if (ElTy == DPTy->getElementType()) // This GEP is inbounds because all indices are zero. return ConstantExpr::getInBoundsGetElementPtr(V, &IdxList[0], IdxList.size()); } - + // Handle casts from one vector constant to another. We know that the src // and dest type have the same size (otherwise its an illegal cast). if (const VectorType *DestPTy = dyn_cast(DestTy)) { @@ -137,7 +137,7 @@ static Constant *FoldBitCast(LLVMContext &Context, // First, check for null. Undef is already handled. if (isa(V)) return Constant::getNullValue(DestTy); - + if (ConstantVector *CV = dyn_cast(V)) return BitCastConstantVector(Context, CV, DestPTy); } @@ -149,12 +149,12 @@ static Constant *FoldBitCast(LLVMContext &Context, return ConstantExpr::getBitCast( ConstantVector::get(&V, 1), DestPTy); } - + // Finally, implement bitcast folding now. The code below doesn't handle // bitcast right. if (isa(V)) // ptr->ptr cast. return ConstantPointerNull::get(cast(DestTy)); - + // Handle integral constant input. if (const ConstantInt *CI = dyn_cast(V)) { if (DestTy->isInteger()) @@ -341,7 +341,7 @@ Constant *llvm::ConstantFoldExtractElementInstruction(LLVMContext &Context, if (Val->isNullValue()) // ee(zero, x) -> zero return Constant::getNullValue( cast(Val->getType())->getElementType()); - + if (const ConstantVector *CVal = dyn_cast(Val)) { if (const ConstantInt *CIdx = dyn_cast(Idx)) { return CVal->getOperand(CIdx->getZExtValue()); @@ -417,7 +417,7 @@ static Constant *GetVectorElement(LLVMContext &Context, const Constant *C, unsigned EltNo) { if (const ConstantVector *CV = dyn_cast(C)) return CV->getOperand(EltNo); - + const Type *EltTy = cast(C->getType())->getElementType(); if (isa(C)) return Constant::getNullValue(EltTy); @@ -661,7 +661,7 @@ Constant *llvm::ConstantFoldBinaryInstruction(LLVMContext &Context, if (CI2->isZero()) return const_cast(C2); // X & 0 == 0 if (CI2->isAllOnesValue()) return const_cast(C1); // X & -1 == X - + if (const ConstantExpr *CE1 = dyn_cast(C1)) { // (zext i32 to i64) & 4294967295 -> (zext i32 to i64) if (CE1->getOpcode() == Instruction::ZExt) { @@ -672,17 +672,17 @@ Constant *llvm::ConstantFoldBinaryInstruction(LLVMContext &Context, if ((PossiblySetBits & CI2->getValue()) == PossiblySetBits) return const_cast(C1); } - + // If and'ing the address of a global with a constant, fold it. if (CE1->getOpcode() == Instruction::PtrToInt && isa(CE1->getOperand(0))) { GlobalValue *GV = cast(CE1->getOperand(0)); - + // Functions are at least 4-byte aligned. unsigned GVAlign = GV->getAlignment(); if (isa(GV)) GVAlign = std::max(GVAlign, 4U); - + if (GVAlign > 1) { unsigned DstWidth = CI2->getType()->getBitWidth(); unsigned SrcWidth = std::min(DstWidth, Log2_32(GVAlign)); @@ -712,7 +712,7 @@ Constant *llvm::ConstantFoldBinaryInstruction(LLVMContext &Context, break; } } - + // At this point we know neither constant is an UndefValue. if (const ConstantInt *CI1 = dyn_cast(C1)) { if (const ConstantInt *CI2 = dyn_cast(C2)) { @@ -989,7 +989,7 @@ Constant *llvm::ConstantFoldBinaryInstruction(LLVMContext &Context, case Instruction::Xor: // No change of opcode required. return ConstantFoldBinaryInstruction(Context, Opcode, C2, C1); - + case Instruction::Shl: case Instruction::LShr: case Instruction::AShr: @@ -1005,7 +1005,7 @@ Constant *llvm::ConstantFoldBinaryInstruction(LLVMContext &Context, break; } } - + // We don't know how to fold this. return 0; } @@ -1113,7 +1113,7 @@ static FCmpInst::Predicate evaluateFCmpRelation(LLVMContext &Context, // Nothing more we can do return FCmpInst::BAD_FCMP_PREDICATE; } - + // If the first operand is simple and second is ConstantExpr, swap operands. FCmpInst::Predicate SwappedRelation = evaluateFCmpRelation(Context, V2, V1); if (SwappedRelation != FCmpInst::BAD_FCMP_PREDICATE) @@ -1177,11 +1177,11 @@ static ICmpInst::Predicate evaluateICmpRelation(LLVMContext &Context, R = dyn_cast(ConstantExpr::getICmp(pred, C1, C2)); if (R && !R->isZero()) return pred; - + // If we couldn't figure it out, bail. return ICmpInst::BAD_ICMP_PREDICATE; } - + // If the first operand is simple, swap operands. ICmpInst::Predicate SwappedRelation = evaluateICmpRelation(Context, V2, V1, isSigned); @@ -1489,7 +1489,7 @@ Constant *llvm::ConstantFoldCompareInstruction(LLVMContext &Context, SmallVector C1Elts, C2Elts; C1->getVectorElements(Context, C1Elts); C2->getVectorElements(Context, C2Elts); - + // If we can constant fold the comparison of each element, constant fold // the whole vector comparison. SmallVector ResElts; @@ -1554,7 +1554,7 @@ Constant *llvm::ConstantFoldCompareInstruction(LLVMContext &Context, Result = 1; break; } - + // If we evaluated the result, return it now. if (Result != -1) return ConstantInt::get(Type::getInt1Ty(Context), Result); @@ -1631,11 +1631,11 @@ Constant *llvm::ConstantFoldCompareInstruction(LLVMContext &Context, if (pred == ICmpInst::ICMP_NE) Result = 1; break; } - + // If we evaluated the result, return it now. if (Result != -1) return ConstantInt::get(Type::getInt1Ty(Context), Result); - + if (!isa(C1) && isa(C2)) { // If C2 is a constant expr and C1 isn't, flip them around and fold the // other way if possible. @@ -1663,7 +1663,7 @@ Constant *llvm::ConstantFoldCompareInstruction(LLVMContext &Context, } } return 0; - } +} Constant *llvm::ConstantFoldGetElementPtr(LLVMContext &Context, const Constant *C, @@ -1759,7 +1759,7 @@ Constant *llvm::ConstantFoldGetElementPtr(LLVMContext &Context, return ConstantExpr::getGetElementPtr( (Constant*)CE->getOperand(0), Idxs, NumIdx); } - + // Fold: getelementptr (i8* inttoptr (i64 1 to i8*), i32 -1) // Into: inttoptr (i64 0 to i8*) // This happens with pointers to member functions in C++. @@ -1768,7 +1768,7 @@ Constant *llvm::ConstantFoldGetElementPtr(LLVMContext &Context, cast(CE->getType())->getElementType() == Type::getInt8Ty(Context)) { Constant *Base = CE->getOperand(0); Constant *Offset = Idxs[0]; - + // Convert the smaller integer to the larger type. if (Offset->getType()->getPrimitiveSizeInBits() < Base->getType()->getPrimitiveSizeInBits()) @@ -1776,11 +1776,10 @@ Constant *llvm::ConstantFoldGetElementPtr(LLVMContext &Context, else if (Base->getType()->getPrimitiveSizeInBits() < Offset->getType()->getPrimitiveSizeInBits()) Base = ConstantExpr::getZExt(Base, Offset->getType()); - + Base = ConstantExpr::getAdd(Base, Offset); return ConstantExpr::getIntToPtr(Base, CE->getType()); } } return 0; } - diff --git a/libclamav/c++/llvm/lib/VMCore/ConstantsContext.h b/libclamav/c++/llvm/lib/VMCore/ConstantsContext.h index 22aba7e1d..f4a2cde5d 100644 --- a/libclamav/c++/llvm/lib/VMCore/ConstantsContext.h +++ b/libclamav/c++/llvm/lib/VMCore/ConstantsContext.h @@ -575,6 +575,14 @@ public: // to enforce proper synchronization. typename MapTy::iterator map_begin() { return Map.begin(); } typename MapTy::iterator map_end() { return Map.end(); } + + void freeConstants() { + for (typename MapTy::iterator I=Map.begin(), E=Map.end(); + I != E; ++I) { + if (I->second->use_empty()) + delete I->second; + } + } /// InsertOrGetItem - Return an iterator for the specified element. /// If the element exists in the map, the returned iterator points to the diff --git a/libclamav/c++/llvm/lib/VMCore/Instruction.cpp b/libclamav/c++/llvm/lib/VMCore/Instruction.cpp index e19ad1c16..815dd7e7b 100644 --- a/libclamav/c++/llvm/lib/VMCore/Instruction.cpp +++ b/libclamav/c++/llvm/lib/VMCore/Instruction.cpp @@ -168,6 +168,14 @@ const char *Instruction::getOpcodeName(unsigned OpCode) { /// identical to the current one. This means that all operands match and any /// extra information (e.g. load is volatile) agree. bool Instruction::isIdenticalTo(const Instruction *I) const { + return isIdenticalToWhenDefined(I) && + SubclassOptionalData == I->SubclassOptionalData; +} + +/// isIdenticalToWhenDefined - This is like isIdenticalTo, except that it +/// ignores the SubclassOptionalData flags, which specify conditions +/// under which the instruction's result is undefined. +bool Instruction::isIdenticalToWhenDefined(const Instruction *I) const { if (getOpcode() != I->getOpcode() || getNumOperands() != I->getNumOperands() || getType() != I->getType()) diff --git a/libclamav/c++/llvm/lib/VMCore/Instructions.cpp b/libclamav/c++/llvm/lib/VMCore/Instructions.cpp index bbea62bde..e4cf5f461 100644 --- a/libclamav/c++/llvm/lib/VMCore/Instructions.cpp +++ b/libclamav/c++/llvm/lib/VMCore/Instructions.cpp @@ -154,6 +154,7 @@ PHINode::PHINode(const PHINode &PN) OL[i] = PN.getOperand(i); OL[i+1] = PN.getOperand(i+1); } + SubclassOptionalData = PN.SubclassOptionalData; } PHINode::~PHINode() { @@ -403,6 +404,7 @@ CallInst::CallInst(const CallInst &CI) Use *InOL = CI.OperandList; for (unsigned i = 0, e = CI.getNumOperands(); i != e; ++i) OL[i] = InOL[i]; + SubclassOptionalData = CI.SubclassOptionalData; } void CallInst::addAttribute(unsigned i, Attributes attr) { @@ -464,6 +466,7 @@ InvokeInst::InvokeInst(const InvokeInst &II) Use *OL = OperandList, *InOL = II.OperandList; for (unsigned i = 0, e = II.getNumOperands(); i != e; ++i) OL[i] = InOL[i]; + SubclassOptionalData = II.SubclassOptionalData; } BasicBlock *InvokeInst::getSuccessorV(unsigned idx) const { @@ -508,6 +511,7 @@ ReturnInst::ReturnInst(const ReturnInst &RI) RI.getNumOperands()) { if (RI.getNumOperands()) Op<0>() = RI.Op<0>(); + SubclassOptionalData = RI.SubclassOptionalData; } ReturnInst::ReturnInst(LLVMContext &C, Value *retVal, Instruction *InsertBefore) @@ -663,6 +667,7 @@ BranchInst::BranchInst(const BranchInst &BI) : Op<-3>() = BI.Op<-3>(); Op<-2>() = BI.Op<-2>(); } + SubclassOptionalData = BI.SubclassOptionalData; } @@ -757,12 +762,6 @@ const Type *AllocationInst::getAllocatedType() const { return getType()->getElementType(); } -AllocaInst::AllocaInst(const AllocaInst &AI) - : AllocationInst(AI.getType()->getElementType(), - (Value*)AI.getOperand(0), Instruction::Alloca, - AI.getAlignment()) { -} - /// isStaticAlloca - Return true if this alloca is in the entry block of the /// function and is a constant size. If so, the code generator will fold it /// into the prolog/epilog code, so it is basically free. @@ -775,12 +774,6 @@ bool AllocaInst::isStaticAlloca() const { return Parent == &Parent->getParent()->front(); } -MallocInst::MallocInst(const MallocInst &MI) - : AllocationInst(MI.getType()->getElementType(), - (Value*)MI.getOperand(0), Instruction::Malloc, - MI.getAlignment()) { -} - //===----------------------------------------------------------------------===// // FreeInst Implementation //===----------------------------------------------------------------------===// @@ -1048,6 +1041,7 @@ GetElementPtrInst::GetElementPtrInst(const GetElementPtrInst &GEPI) Use *GEPIOL = GEPI.OperandList; for (unsigned i = 0, E = NumOperands; i != E; ++i) OL[i] = GEPIOL[i]; + SubclassOptionalData = GEPI.SubclassOptionalData; } GetElementPtrInst::GetElementPtrInst(Value *Ptr, Value *Idx, @@ -1211,13 +1205,6 @@ bool ExtractElementInst::isValidOperands(const Value *Val, const Value *Index) { // InsertElementInst Implementation //===----------------------------------------------------------------------===// -InsertElementInst::InsertElementInst(const InsertElementInst &IE) - : Instruction(IE.getType(), InsertElement, - OperandTraits::op_begin(this), 3) { - Op<0>() = IE.Op<0>(); - Op<1>() = IE.Op<1>(); - Op<2>() = IE.Op<2>(); -} InsertElementInst::InsertElementInst(Value *Vec, Value *Elt, Value *Index, const Twine &Name, Instruction *InsertBef) @@ -1265,15 +1252,6 @@ bool InsertElementInst::isValidOperands(const Value *Vec, const Value *Elt, // ShuffleVectorInst Implementation //===----------------------------------------------------------------------===// -ShuffleVectorInst::ShuffleVectorInst(const ShuffleVectorInst &SV) - : Instruction(SV.getType(), ShuffleVector, - OperandTraits::op_begin(this), - OperandTraits::operands(this)) { - Op<0>() = SV.Op<0>(); - Op<1>() = SV.Op<1>(); - Op<2>() = SV.Op<2>(); -} - ShuffleVectorInst::ShuffleVectorInst(Value *V1, Value *V2, Value *Mask, const Twine &Name, Instruction *InsertBefore) @@ -1294,10 +1272,12 @@ ShuffleVectorInst::ShuffleVectorInst(Value *V1, Value *V2, Value *Mask, ShuffleVectorInst::ShuffleVectorInst(Value *V1, Value *V2, Value *Mask, const Twine &Name, BasicBlock *InsertAtEnd) - : Instruction(V1->getType(), ShuffleVector, - OperandTraits::op_begin(this), - OperandTraits::operands(this), - InsertAtEnd) { +: Instruction(VectorType::get(cast(V1->getType())->getElementType(), + cast(Mask->getType())->getNumElements()), + ShuffleVector, + OperandTraits::op_begin(this), + OperandTraits::operands(this), + InsertAtEnd) { assert(isValidOperands(V1, V2, Mask) && "Invalid shuffle vector instruction operands!"); @@ -1364,6 +1344,7 @@ InsertValueInst::InsertValueInst(const InsertValueInst &IVI) Indices(IVI.Indices) { Op<0>() = IVI.getOperand(0); Op<1>() = IVI.getOperand(1); + SubclassOptionalData = IVI.SubclassOptionalData; } InsertValueInst::InsertValueInst(Value *Agg, @@ -1410,6 +1391,7 @@ void ExtractValueInst::init(unsigned Idx, const Twine &Name) { ExtractValueInst::ExtractValueInst(const ExtractValueInst &EVI) : UnaryInstruction(EVI.getType(), ExtractValue, EVI.getOperand(0)), Indices(EVI.Indices) { + SubclassOptionalData = EVI.SubclassOptionalData; } // getIndexedType - Returns the type of the element that would be extracted @@ -2526,7 +2508,7 @@ CmpInst::CmpInst(const Type *ty, OtherOps op, unsigned short predicate, } CmpInst * -CmpInst::Create(LLVMContext &Context, OtherOps Op, unsigned short predicate, +CmpInst::Create(OtherOps Op, unsigned short predicate, Value *S1, Value *S2, const Twine &Name, Instruction *InsertBefore) { if (Op == Instruction::ICmp) { @@ -2534,7 +2516,7 @@ CmpInst::Create(LLVMContext &Context, OtherOps Op, unsigned short predicate, return new ICmpInst(InsertBefore, CmpInst::Predicate(predicate), S1, S2, Name); else - return new ICmpInst(Context, CmpInst::Predicate(predicate), + return new ICmpInst(CmpInst::Predicate(predicate), S1, S2, Name); } @@ -2542,7 +2524,7 @@ CmpInst::Create(LLVMContext &Context, OtherOps Op, unsigned short predicate, return new FCmpInst(InsertBefore, CmpInst::Predicate(predicate), S1, S2, Name); else - return new FCmpInst(Context, CmpInst::Predicate(predicate), + return new FCmpInst(CmpInst::Predicate(predicate), S1, S2, Name); } @@ -2790,6 +2772,7 @@ SwitchInst::SwitchInst(const SwitchInst &SI) OL[i] = InOL[i]; OL[i+1] = InOL[i+1]; } + SubclassOptionalData = SI.SubclassOptionalData; } SwitchInst::~SwitchInst() { @@ -2882,144 +2865,230 @@ void SwitchInst::setSuccessorV(unsigned idx, BasicBlock *B) { // unit that uses these classes. GetElementPtrInst *GetElementPtrInst::clone(LLVMContext&) const { - return new(getNumOperands()) GetElementPtrInst(*this); + GetElementPtrInst *New = new(getNumOperands()) GetElementPtrInst(*this); + New->SubclassOptionalData = SubclassOptionalData; + return New; } BinaryOperator *BinaryOperator::clone(LLVMContext&) const { - return Create(getOpcode(), Op<0>(), Op<1>()); + BinaryOperator *New = Create(getOpcode(), Op<0>(), Op<1>()); + New->SubclassOptionalData = SubclassOptionalData; + return New; } FCmpInst* FCmpInst::clone(LLVMContext &Context) const { - return new FCmpInst(Context, getPredicate(), Op<0>(), Op<1>()); + FCmpInst *New = new FCmpInst(getPredicate(), Op<0>(), Op<1>()); + New->SubclassOptionalData = SubclassOptionalData; + return New; } ICmpInst* ICmpInst::clone(LLVMContext &Context) const { - return new ICmpInst(Context, getPredicate(), Op<0>(), Op<1>()); + ICmpInst *New = new ICmpInst(getPredicate(), Op<0>(), Op<1>()); + New->SubclassOptionalData = SubclassOptionalData; + return New; } ExtractValueInst *ExtractValueInst::clone(LLVMContext&) const { - return new ExtractValueInst(*this); + ExtractValueInst *New = new ExtractValueInst(*this); + New->SubclassOptionalData = SubclassOptionalData; + return New; } InsertValueInst *InsertValueInst::clone(LLVMContext&) const { - return new InsertValueInst(*this); + InsertValueInst *New = new InsertValueInst(*this); + New->SubclassOptionalData = SubclassOptionalData; + return New; } MallocInst *MallocInst::clone(LLVMContext&) const { - return new MallocInst(*this); + MallocInst *New = new MallocInst(getAllocatedType(), + (Value*)getOperand(0), + getAlignment()); + New->SubclassOptionalData = SubclassOptionalData; + return New; } AllocaInst *AllocaInst::clone(LLVMContext&) const { - return new AllocaInst(*this); + AllocaInst *New = new AllocaInst(getAllocatedType(), + (Value*)getOperand(0), + getAlignment()); + New->SubclassOptionalData = SubclassOptionalData; + return New; } FreeInst *FreeInst::clone(LLVMContext&) const { - return new FreeInst(getOperand(0)); + FreeInst *New = new FreeInst(getOperand(0)); + New->SubclassOptionalData = SubclassOptionalData; + return New; } LoadInst *LoadInst::clone(LLVMContext&) const { - return new LoadInst(*this); + LoadInst *New = new LoadInst(getOperand(0), + Twine(), isVolatile(), + getAlignment()); + New->SubclassOptionalData = SubclassOptionalData; + return New; } StoreInst *StoreInst::clone(LLVMContext&) const { - return new StoreInst(*this); + StoreInst *New = new StoreInst(getOperand(0), getOperand(1), + isVolatile(), getAlignment()); + New->SubclassOptionalData = SubclassOptionalData; + return New; } -CastInst *TruncInst::clone(LLVMContext&) const { - return new TruncInst(*this); +TruncInst *TruncInst::clone(LLVMContext&) const { + TruncInst *New = new TruncInst(getOperand(0), getType()); + New->SubclassOptionalData = SubclassOptionalData; + return New; } -CastInst *ZExtInst::clone(LLVMContext&) const { - return new ZExtInst(*this); +ZExtInst *ZExtInst::clone(LLVMContext&) const { + ZExtInst *New = new ZExtInst(getOperand(0), getType()); + New->SubclassOptionalData = SubclassOptionalData; + return New; } -CastInst *SExtInst::clone(LLVMContext&) const { - return new SExtInst(*this); +SExtInst *SExtInst::clone(LLVMContext&) const { + SExtInst *New = new SExtInst(getOperand(0), getType()); + New->SubclassOptionalData = SubclassOptionalData; + return New; } -CastInst *FPTruncInst::clone(LLVMContext&) const { - return new FPTruncInst(*this); +FPTruncInst *FPTruncInst::clone(LLVMContext&) const { + FPTruncInst *New = new FPTruncInst(getOperand(0), getType()); + New->SubclassOptionalData = SubclassOptionalData; + return New; } -CastInst *FPExtInst::clone(LLVMContext&) const { - return new FPExtInst(*this); +FPExtInst *FPExtInst::clone(LLVMContext&) const { + FPExtInst *New = new FPExtInst(getOperand(0), getType()); + New->SubclassOptionalData = SubclassOptionalData; + return New; } -CastInst *UIToFPInst::clone(LLVMContext&) const { - return new UIToFPInst(*this); +UIToFPInst *UIToFPInst::clone(LLVMContext&) const { + UIToFPInst *New = new UIToFPInst(getOperand(0), getType()); + New->SubclassOptionalData = SubclassOptionalData; + return New; } -CastInst *SIToFPInst::clone(LLVMContext&) const { - return new SIToFPInst(*this); +SIToFPInst *SIToFPInst::clone(LLVMContext&) const { + SIToFPInst *New = new SIToFPInst(getOperand(0), getType()); + New->SubclassOptionalData = SubclassOptionalData; + return New; } -CastInst *FPToUIInst::clone(LLVMContext&) const { - return new FPToUIInst(*this); +FPToUIInst *FPToUIInst::clone(LLVMContext&) const { + FPToUIInst *New = new FPToUIInst(getOperand(0), getType()); + New->SubclassOptionalData = SubclassOptionalData; + return New; } -CastInst *FPToSIInst::clone(LLVMContext&) const { - return new FPToSIInst(*this); +FPToSIInst *FPToSIInst::clone(LLVMContext&) const { + FPToSIInst *New = new FPToSIInst(getOperand(0), getType()); + New->SubclassOptionalData = SubclassOptionalData; + return New; } -CastInst *PtrToIntInst::clone(LLVMContext&) const { - return new PtrToIntInst(*this); +PtrToIntInst *PtrToIntInst::clone(LLVMContext&) const { + PtrToIntInst *New = new PtrToIntInst(getOperand(0), getType()); + New->SubclassOptionalData = SubclassOptionalData; + return New; } -CastInst *IntToPtrInst::clone(LLVMContext&) const { - return new IntToPtrInst(*this); +IntToPtrInst *IntToPtrInst::clone(LLVMContext&) const { + IntToPtrInst *New = new IntToPtrInst(getOperand(0), getType()); + New->SubclassOptionalData = SubclassOptionalData; + return New; } -CastInst *BitCastInst::clone(LLVMContext&) const { - return new BitCastInst(*this); +BitCastInst *BitCastInst::clone(LLVMContext&) const { + BitCastInst *New = new BitCastInst(getOperand(0), getType()); + New->SubclassOptionalData = SubclassOptionalData; + return New; } CallInst *CallInst::clone(LLVMContext&) const { - return new(getNumOperands()) CallInst(*this); + CallInst *New = new(getNumOperands()) CallInst(*this); + New->SubclassOptionalData = SubclassOptionalData; + return New; } -SelectInst *SelectInst::clone(LLVMContext&) const { - return new(getNumOperands()) SelectInst(*this); +SelectInst *SelectInst::clone(LLVMContext&) const { + SelectInst *New = SelectInst::Create(getOperand(0), + getOperand(1), + getOperand(2)); + New->SubclassOptionalData = SubclassOptionalData; + return New; } VAArgInst *VAArgInst::clone(LLVMContext&) const { - return new VAArgInst(*this); + VAArgInst *New = new VAArgInst(getOperand(0), getType()); + New->SubclassOptionalData = SubclassOptionalData; + return New; } ExtractElementInst *ExtractElementInst::clone(LLVMContext&) const { - return ExtractElementInst::Create(*this); + ExtractElementInst *New = ExtractElementInst::Create(getOperand(0), + getOperand(1)); + New->SubclassOptionalData = SubclassOptionalData; + return New; } InsertElementInst *InsertElementInst::clone(LLVMContext&) const { - return InsertElementInst::Create(*this); + InsertElementInst *New = InsertElementInst::Create(getOperand(0), + getOperand(1), + getOperand(2)); + New->SubclassOptionalData = SubclassOptionalData; + return New; } ShuffleVectorInst *ShuffleVectorInst::clone(LLVMContext&) const { - return new ShuffleVectorInst(*this); + ShuffleVectorInst *New = new ShuffleVectorInst(getOperand(0), + getOperand(1), + getOperand(2)); + New->SubclassOptionalData = SubclassOptionalData; + return New; } PHINode *PHINode::clone(LLVMContext&) const { - return new PHINode(*this); + PHINode *New = new PHINode(*this); + New->SubclassOptionalData = SubclassOptionalData; + return New; } ReturnInst *ReturnInst::clone(LLVMContext&) const { - return new(getNumOperands()) ReturnInst(*this); + ReturnInst *New = new(getNumOperands()) ReturnInst(*this); + New->SubclassOptionalData = SubclassOptionalData; + return New; } BranchInst *BranchInst::clone(LLVMContext&) const { unsigned Ops(getNumOperands()); - return new(Ops, Ops == 1) BranchInst(*this); + BranchInst *New = new(Ops, Ops == 1) BranchInst(*this); + New->SubclassOptionalData = SubclassOptionalData; + return New; } SwitchInst *SwitchInst::clone(LLVMContext&) const { - return new SwitchInst(*this); + SwitchInst *New = new SwitchInst(*this); + New->SubclassOptionalData = SubclassOptionalData; + return New; } InvokeInst *InvokeInst::clone(LLVMContext&) const { - return new(getNumOperands()) InvokeInst(*this); + InvokeInst *New = new(getNumOperands()) InvokeInst(*this); + New->SubclassOptionalData = SubclassOptionalData; + return New; } UnwindInst *UnwindInst::clone(LLVMContext &C) const { - return new UnwindInst(C); + UnwindInst *New = new UnwindInst(C); + New->SubclassOptionalData = SubclassOptionalData; + return New; } UnreachableInst *UnreachableInst::clone(LLVMContext &C) const { - return new UnreachableInst(C); + UnreachableInst *New = new UnreachableInst(C); + New->SubclassOptionalData = SubclassOptionalData; + return New; } diff --git a/libclamav/c++/llvm/lib/VMCore/LLVMContextImpl.h b/libclamav/c++/llvm/lib/VMCore/LLVMContextImpl.h index 1433ef9af..2faf6ac6e 100644 --- a/libclamav/c++/llvm/lib/VMCore/LLVMContextImpl.h +++ b/libclamav/c++/llvm/lib/VMCore/LLVMContextImpl.h @@ -96,7 +96,6 @@ struct DenseMapAPFloatKeyInfo { class LLVMContextImpl { public: sys::SmartRWMutex ConstantsLock; - typedef DenseMap IntMapTy; IntMapTy IntConstants; @@ -147,6 +146,21 @@ public: // multithreaded mode. sys::SmartMutex AbstractTypeUsersLock; + // Basic type instances. + const Type VoidTy; + const Type LabelTy; + const Type FloatTy; + const Type DoubleTy; + const Type MetadataTy; + const Type X86_FP80Ty; + const Type FP128Ty; + const Type PPC_FP128Ty; + const IntegerType Int1Ty; + const IntegerType Int8Ty; + const IntegerType Int16Ty; + const IntegerType Int32Ty; + const IntegerType Int64Ty; + // Concrete/Abstract TypeDescriptions - We lazily calculate type descriptions // for types as they are needed. Because resolution of types must invalidate // all of the abstract type descriptions, we keep them in a seperate map to @@ -160,22 +174,7 @@ public: TypeMap FunctionTypes; TypeMap StructTypes; TypeMap IntegerTypes; - - const Type *VoidTy; - const Type *LabelTy; - const Type *FloatTy; - const Type *DoubleTy; - const Type *MetadataTy; - const Type *X86_FP80Ty; - const Type *FP128Ty; - const Type *PPC_FP128Ty; - - const IntegerType *Int1Ty; - const IntegerType *Int8Ty; - const IntegerType *Int16Ty; - const IntegerType *Int32Ty; - const IntegerType *Int64Ty; - + /// ValueHandles - This map keeps track of all of the value handles that are /// watching a Value*. The Value::HasValueHandle bit is used to know // whether or not a value has an entry in this map. @@ -183,41 +182,40 @@ public: ValueHandlesTy ValueHandles; LLVMContextImpl(LLVMContext &C) : TheTrueVal(0), TheFalseVal(0), - VoidTy(new Type(C, Type::VoidTyID)), - LabelTy(new Type(C, Type::LabelTyID)), - FloatTy(new Type(C, Type::FloatTyID)), - DoubleTy(new Type(C, Type::DoubleTyID)), - MetadataTy(new Type(C, Type::MetadataTyID)), - X86_FP80Ty(new Type(C, Type::X86_FP80TyID)), - FP128Ty(new Type(C, Type::FP128TyID)), - PPC_FP128Ty(new Type(C, Type::PPC_FP128TyID)), - Int1Ty(new IntegerType(C, 1)), - Int8Ty(new IntegerType(C, 8)), - Int16Ty(new IntegerType(C, 16)), - Int32Ty(new IntegerType(C, 32)), - Int64Ty(new IntegerType(C, 64)) { } - - ~LLVMContextImpl() { - // In principle, we should delete the member types here. However, - // this causes destruction order issues with the types in the TypeMaps. - // For now, just leak this, which is at least not a regression from the - // previous behavior, though still undesirable. -#if 0 - delete VoidTy; - delete LabelTy; - delete FloatTy; - delete DoubleTy; - delete MetadataTy; - delete X86_FP80Ty; - delete FP128Ty; - delete PPC_FP128Ty; - - delete Int1Ty; - delete Int8Ty; - delete Int16Ty; - delete Int32Ty; - delete Int64Ty; -#endif + VoidTy(C, Type::VoidTyID), + LabelTy(C, Type::LabelTyID), + FloatTy(C, Type::FloatTyID), + DoubleTy(C, Type::DoubleTyID), + MetadataTy(C, Type::MetadataTyID), + X86_FP80Ty(C, Type::X86_FP80TyID), + FP128Ty(C, Type::FP128TyID), + PPC_FP128Ty(C, Type::PPC_FP128TyID), + Int1Ty(C, 1), + Int8Ty(C, 8), + Int16Ty(C, 16), + Int32Ty(C, 32), + Int64Ty(C, 64) { } + + ~LLVMContextImpl() + { + ExprConstants.freeConstants(); + ArrayConstants.freeConstants(); + StructConstants.freeConstants(); + VectorConstants.freeConstants(); + + AggZeroConstants.freeConstants(); + NullPtrConstants.freeConstants(); + UndefValueConstants.freeConstants(); + for (IntMapTy::iterator I=IntConstants.begin(), E=IntConstants.end(); + I != E; ++I) { + if (I->second->use_empty()) + delete I->second; + } + for (FPMapTy::iterator I=FPConstants.begin(), E=FPConstants.end(); + I != E; ++I) { + if (I->second->use_empty()) + delete I->second; + } } }; diff --git a/libclamav/c++/llvm/lib/VMCore/Metadata.cpp b/libclamav/c++/llvm/lib/VMCore/Metadata.cpp index 208e1bced..60ec1c5c6 100644 --- a/libclamav/c++/llvm/lib/VMCore/Metadata.cpp +++ b/libclamav/c++/llvm/lib/VMCore/Metadata.cpp @@ -101,8 +101,8 @@ static std::vector getValType(MDNode *N) { } MDNode::~MDNode() { - dropAllReferences(); getType()->getContext().pImpl->MDNodes.remove(this); + dropAllReferences(); } //===----------------------------------------------------------------------===// diff --git a/libclamav/c++/llvm/lib/VMCore/Pass.cpp b/libclamav/c++/llvm/lib/VMCore/Pass.cpp index e2a8d744e..1278074ef 100644 --- a/libclamav/c++/llvm/lib/VMCore/Pass.cpp +++ b/libclamav/c++/llvm/lib/VMCore/Pass.cpp @@ -132,9 +132,7 @@ class PassRegistrar { /// AnalysisGroupInfo - Keep track of information for each analysis group. struct AnalysisGroupInfo { - const PassInfo *DefaultImpl; std::set Implementations; - AnalysisGroupInfo() : DefaultImpl(0) {} }; /// AnalysisGroupInfoMap - Information for each analysis group. @@ -177,11 +175,10 @@ public: "Cannot add a pass to the same analysis group more than once!"); AGI.Implementations.insert(ImplementationInfo); if (isDefault) { - assert(AGI.DefaultImpl == 0 && InterfaceInfo->getNormalCtor() == 0 && + assert(InterfaceInfo->getNormalCtor() == 0 && "Default implementation for analysis group already specified!"); assert(ImplementationInfo->getNormalCtor() && "Cannot specify pass as default if it does not have a default ctor"); - AGI.DefaultImpl = ImplementationInfo; InterfaceInfo->setNormalCtor(ImplementationInfo->getNormalCtor()); } } @@ -253,10 +250,10 @@ void PassInfo::unregisterPass() { // RegisterAGBase::RegisterAGBase(const char *Name, intptr_t InterfaceID, intptr_t PassID, bool isDefault) - : PassInfo(Name, InterfaceID), - ImplementationInfo(0), isDefaultImplementation(isDefault) { + : PassInfo(Name, InterfaceID) { - InterfaceInfo = const_cast(Pass::lookupPassInfo(InterfaceID)); + PassInfo *InterfaceInfo = + const_cast(Pass::lookupPassInfo(InterfaceID)); if (InterfaceInfo == 0) { // First reference to Interface, register it now. registerPass(); @@ -266,7 +263,7 @@ RegisterAGBase::RegisterAGBase(const char *Name, intptr_t InterfaceID, "Trying to join an analysis group that is a normal pass!"); if (PassID) { - ImplementationInfo = Pass::lookupPassInfo(PassID); + const PassInfo *ImplementationInfo = Pass::lookupPassInfo(PassID); assert(ImplementationInfo && "Must register pass before adding to AnalysisGroup!"); diff --git a/libclamav/c++/llvm/lib/VMCore/Type.cpp b/libclamav/c++/llvm/lib/VMCore/Type.cpp index 36dcbccdc..ba190d923 100644 --- a/libclamav/c++/llvm/lib/VMCore/Type.cpp +++ b/libclamav/c++/llvm/lib/VMCore/Type.cpp @@ -304,55 +304,55 @@ const Type *StructType::getTypeAtIndex(unsigned Idx) const { //===----------------------------------------------------------------------===// const Type *Type::getVoidTy(LLVMContext &C) { - return C.pImpl->VoidTy; + return &C.pImpl->VoidTy; } const Type *Type::getLabelTy(LLVMContext &C) { - return C.pImpl->LabelTy; + return &C.pImpl->LabelTy; } const Type *Type::getFloatTy(LLVMContext &C) { - return C.pImpl->FloatTy; + return &C.pImpl->FloatTy; } const Type *Type::getDoubleTy(LLVMContext &C) { - return C.pImpl->DoubleTy; + return &C.pImpl->DoubleTy; } const Type *Type::getMetadataTy(LLVMContext &C) { - return C.pImpl->MetadataTy; + return &C.pImpl->MetadataTy; } const Type *Type::getX86_FP80Ty(LLVMContext &C) { - return C.pImpl->X86_FP80Ty; + return &C.pImpl->X86_FP80Ty; } const Type *Type::getFP128Ty(LLVMContext &C) { - return C.pImpl->FP128Ty; + return &C.pImpl->FP128Ty; } const Type *Type::getPPC_FP128Ty(LLVMContext &C) { - return C.pImpl->PPC_FP128Ty; + return &C.pImpl->PPC_FP128Ty; } const IntegerType *Type::getInt1Ty(LLVMContext &C) { - return C.pImpl->Int1Ty; + return &C.pImpl->Int1Ty; } const IntegerType *Type::getInt8Ty(LLVMContext &C) { - return C.pImpl->Int8Ty; + return &C.pImpl->Int8Ty; } const IntegerType *Type::getInt16Ty(LLVMContext &C) { - return C.pImpl->Int16Ty; + return &C.pImpl->Int16Ty; } const IntegerType *Type::getInt32Ty(LLVMContext &C) { - return C.pImpl->Int32Ty; + return &C.pImpl->Int32Ty; } const IntegerType *Type::getInt64Ty(LLVMContext &C) { - return C.pImpl->Int64Ty; + return &C.pImpl->Int64Ty; } //===----------------------------------------------------------------------===// @@ -500,7 +500,7 @@ void DerivedType::dropAllTypeUses() { llvm_release_global_lock(); } - } else { + } else if (!AlwaysOpaqueTy) { AlwaysOpaqueTy = OpaqueType::get(getContext()); Holder = new PATypeHolder(AlwaysOpaqueTy); } diff --git a/libclamav/c++/llvm/lib/VMCore/TypesContext.h b/libclamav/c++/llvm/lib/VMCore/TypesContext.h index 2a287fe5d..e7950bd21 100644 --- a/libclamav/c++/llvm/lib/VMCore/TypesContext.h +++ b/libclamav/c++/llvm/lib/VMCore/TypesContext.h @@ -221,7 +221,6 @@ public: // PATypeHolder won't destroy non-abstract types. // We can't destroy them by simply iterating, because // they may contain references to each-other. -#if 0 for (std::multimap::iterator I = TypesByHash.begin(), E = TypesByHash.end(); I != E; ++I) { Type *Ty = const_cast(I->second.Ty); @@ -235,7 +234,6 @@ public: operator delete(Ty); } } -#endif } void RemoveFromTypesByHash(unsigned Hash, const Type *Ty) { diff --git a/libclamav/c++/llvm/lib/VMCore/Value.cpp b/libclamav/c++/llvm/lib/VMCore/Value.cpp index 34291b9d7..f67406260 100644 --- a/libclamav/c++/llvm/lib/VMCore/Value.cpp +++ b/libclamav/c++/llvm/lib/VMCore/Value.cpp @@ -340,6 +340,10 @@ Value *Value::stripPointerCasts() { V = GEP->getPointerOperand(); } else if (Operator::getOpcode(V) == Instruction::BitCast) { V = cast(V)->getOperand(0); + } else if (GlobalAlias *GA = dyn_cast(V)) { + if (GA->mayBeOverridden()) + return V; + V = GA->getAliasee(); } else { return V; } @@ -357,6 +361,10 @@ Value *Value::getUnderlyingObject() { V = GEP->getPointerOperand(); } else if (Operator::getOpcode(V) == Instruction::BitCast) { V = cast(V)->getOperand(0); + } else if (GlobalAlias *GA = dyn_cast(V)) { + if (GA->mayBeOverridden()) + return V; + V = GA->getAliasee(); } else { return V; } diff --git a/libclamav/c++/llvm/lib/VMCore/ValueTypes.cpp b/libclamav/c++/llvm/lib/VMCore/ValueTypes.cpp index b10b3c120..7f9a6cde2 100644 --- a/libclamav/c++/llvm/lib/VMCore/ValueTypes.cpp +++ b/libclamav/c++/llvm/lib/VMCore/ValueTypes.cpp @@ -169,6 +169,7 @@ const Type *EVT::getTypeForEVT(LLVMContext &Context) const { case MVT::v8f32: return VectorType::get(Type::getFloatTy(Context), 8); case MVT::v2f64: return VectorType::get(Type::getDoubleTy(Context), 2); case MVT::v4f64: return VectorType::get(Type::getDoubleTy(Context), 4); + case MVT::Metadata: return Type::getMetadataTy(Context); } } diff --git a/libclamav/c++/llvm/projects/sample/configure b/libclamav/c++/llvm/projects/sample/configure index 2efb85397..f6aa8476e 100755 --- a/libclamav/c++/llvm/projects/sample/configure +++ b/libclamav/c++/llvm/projects/sample/configure @@ -2320,15 +2320,15 @@ esac echo "$as_me: executing $ac_dest commands" >&6;} case $ac_dest in Makefile ) ${llvm_src}/autoconf/mkinstalldirs `dirname Makefile` - ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/Makefile Makefile ;; + ${SHELL} ${llvm_src}/autoconf/install-sh -m 0644 -c ${srcdir}/Makefile Makefile ;; lib/Makefile ) ${llvm_src}/autoconf/mkinstalldirs `dirname lib/Makefile` - ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/lib/Makefile lib/Makefile ;; + ${SHELL} ${llvm_src}/autoconf/install-sh -m 0644 -c ${srcdir}/lib/Makefile lib/Makefile ;; lib/sample/Makefile ) ${llvm_src}/autoconf/mkinstalldirs `dirname lib/sample/Makefile` - ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/lib/sample/Makefile lib/sample/Makefile ;; + ${SHELL} ${llvm_src}/autoconf/install-sh -m 0644 -c ${srcdir}/lib/sample/Makefile lib/sample/Makefile ;; tools/Makefile ) ${llvm_src}/autoconf/mkinstalldirs `dirname tools/Makefile` - ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/tools/Makefile tools/Makefile ;; + ${SHELL} ${llvm_src}/autoconf/install-sh -m 0644 -c ${srcdir}/tools/Makefile tools/Makefile ;; tools/sample/Makefile ) ${llvm_src}/autoconf/mkinstalldirs `dirname tools/sample/Makefile` - ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/tools/sample/Makefile tools/sample/Makefile ;; + ${SHELL} ${llvm_src}/autoconf/install-sh -m 0644 -c ${srcdir}/tools/sample/Makefile tools/sample/Makefile ;; esac done _ACEOF diff --git a/libclamav/c++/llvm/runtime/Makefile b/libclamav/c++/llvm/runtime/Makefile index a1b89af37..1e1045142 100644 --- a/libclamav/c++/llvm/runtime/Makefile +++ b/libclamav/c++/llvm/runtime/Makefile @@ -10,6 +10,8 @@ LEVEL = .. include $(LEVEL)/Makefile.config +ifndef NO_RUNTIME_LIBS + PARALLEL_DIRS := libprofile # Disable libprofile: a faulty libtool is generated by autoconf which breaks the @@ -18,7 +20,8 @@ ifeq ($(ARCH), Sparc) PARALLEL_DIRS := $(filter-out libprofile, $(PARALLEL_DIRS)) endif +endif + include $(LEVEL)/Makefile.common install:: - diff --git a/libclamav/c++/llvm/runtime/libprofile/Makefile b/libclamav/c++/llvm/runtime/libprofile/Makefile index f79d42a05..92a85584d 100644 --- a/libclamav/c++/llvm/runtime/libprofile/Makefile +++ b/libclamav/c++/llvm/runtime/libprofile/Makefile @@ -8,6 +8,8 @@ ##===----------------------------------------------------------------------===## LEVEL = ../.. +include $(LEVEL)/Makefile.config + ifneq ($(wildcard $(LLVMGCC)),) BYTECODE_LIBRARY = 1 endif diff --git a/libclamav/c++/llvm/runtime/libprofile/exported_symbols.lst b/libclamav/c++/llvm/runtime/libprofile/exported_symbols.lst index 6f6c3cc84..5fc6559ce 100644 --- a/libclamav/c++/llvm/runtime/libprofile/exported_symbols.lst +++ b/libclamav/c++/llvm/runtime/libprofile/exported_symbols.lst @@ -1,5 +1,6 @@ llvm_start_func_profiling llvm_start_block_profiling +llvm_start_edge_profiling llvm_start_basic_block_tracing llvm_trace_basic_block diff --git a/libclamav/c++/llvm/test/Analysis/BasicAA/licmtest.ll b/libclamav/c++/llvm/test/Analysis/BasicAA/store-promote.ll similarity index 73% rename from libclamav/c++/llvm/test/Analysis/BasicAA/licmtest.ll rename to libclamav/c++/llvm/test/Analysis/BasicAA/store-promote.ll index cfef63b1f..033a1842c 100644 --- a/libclamav/c++/llvm/test/Analysis/BasicAA/licmtest.ll +++ b/libclamav/c++/llvm/test/Analysis/BasicAA/store-promote.ll @@ -2,13 +2,13 @@ ; disambiguating some obvious cases. If LICM is able to disambiguate the ; two pointers, then the load should be hoisted, and the store sunk. -; RUN: llvm-as < %s | opt -basicaa -licm | llvm-dis | %prcontext @A 1 | not grep Loop +; RUN: llvm-as < %s | opt -basicaa -licm | llvm-dis | FileCheck %s @A = global i32 7 ; [#uses=3] @B = global i32 8 ; [#uses=2] @C = global [2 x i32] [ i32 4, i32 8 ] ; <[2 x i32]*> [#uses=2] -define i32 @test(i1 %c) { +define i32 @test1(i1 %c) { %Atmp = load i32* @A ; [#uses=2] br label %Loop @@ -20,6 +20,14 @@ Loop: ; preds = %Loop, %0 Out: ; preds = %Loop %X = sub i32 %ToRemove, %Atmp ; [#uses=1] ret i32 %X + +; The Loop block should be empty after the load/store are promoted. +; CHECK: @test1 +; CHECK: load i32* @B +; CHECK: Loop: +; CHECK-NEXT: br i1 %c, label %Out, label %Loop +; CHECK: Out: +; CHECK: store i32 %Atmp, i32* @B } define i32 @test2(i1 %c) { @@ -37,5 +45,9 @@ Loop: ; preds = %Loop, %0 Out: ; preds = %Loop %X = sub i32 %AVal, %BVal ; [#uses=1] ret i32 %X +; The Loop block should be empty after the load/store are promoted. +; CHECK: @test2 +; CHECK: Loop: +; CHECK-NEXT: br i1 %c, label %Out, label %Loop } diff --git a/libclamav/c++/llvm/test/Analysis/Profiling/dg.exp b/libclamav/c++/llvm/test/Analysis/Profiling/dg.exp new file mode 100644 index 000000000..1eb4755c4 --- /dev/null +++ b/libclamav/c++/llvm/test/Analysis/Profiling/dg.exp @@ -0,0 +1,4 @@ +load_lib llvm.exp + +RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]] + diff --git a/libclamav/c++/llvm/test/Analysis/Profiling/profiling-tool-chain.ll b/libclamav/c++/llvm/test/Analysis/Profiling/profiling-tool-chain.ll new file mode 100644 index 000000000..0ddc11deb --- /dev/null +++ b/libclamav/c++/llvm/test/Analysis/Profiling/profiling-tool-chain.ll @@ -0,0 +1,182 @@ +; RUN: llvm-as %s -o %t1 +; RUN: opt %t1 -insert-edge-profiling -o %t2 +; RUN: llvm-dis < %t2 | FileCheck --check-prefix=INST %s +; RUN: rm -f llvmprof.out +; RUN: lli -load %llvmlibsdir/profile_rt%shlibext %t2 +; RUN: lli -load %llvmlibsdir/profile_rt%shlibext %t2 1 2 +; RUN: llvm-prof -print-all-code %t1 | FileCheck --check-prefix=PROF %s +; RUN: rm llvmprof.out + +; PROF: 1. 2/4 oneblock +; PROF: 2. 2/4 main +; PROF: 1. 15.7895% 12/76 main() - bb6 +; PROF: 2. 11.8421% 9/76 main() - bb2 +; PROF: 3. 11.8421% 9/76 main() - bb3 +; PROF: 4. 11.8421% 9/76 main() - bb5 +; PROF: 5. 10.5263% 8/76 main() - bb10 +; PROF: 6. 7.89474% 6/76 main() - bb +; PROF: 7. 7.89474% 6/76 main() - bb9 +; PROF: 8. 3.94737% 3/76 main() - bb1 +; PROF: 9. 3.94737% 3/76 main() - bb7 +; PROF: 10. 3.94737% 3/76 main() - bb8 +; PROF: 11. 2.63158% 2/76 oneblock() - entry +; PROF: 12. 2.63158% 2/76 main() - entry +; PROF: 13. 2.63158% 2/76 main() - bb11 +; PROF: 14. 2.63158% 2/76 main() - return + +; ModuleID = '' +target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128" +target triple = "x86_64-unknown-linux-gnu" + +@.str = private constant [12 x i8] c"hello world\00", align 1 ; <[12 x i8]*> [#uses=1] +@.str1 = private constant [6 x i8] c"franz\00", align 1 ; <[6 x i8]*> [#uses=1] +@.str2 = private constant [9 x i8] c"argc > 2\00", align 1 ; <[9 x i8]*> [#uses=1] +@.str3 = private constant [9 x i8] c"argc = 1\00", align 1 ; <[9 x i8]*> [#uses=1] +@.str4 = private constant [6 x i8] c"fritz\00", align 1 ; <[6 x i8]*> [#uses=1] +@.str5 = private constant [10 x i8] c"argc <= 1\00", align 1 ; <[10 x i8]*> [#uses=1] +; INST:@EdgeProfCounters +; INST:[19 x i32] +; INST:zeroinitializer + +; PROF:;;; %oneblock called 2 times. +; PROF:;;; +define void @oneblock() nounwind { +entry: +; PROF:entry: +; PROF: ;;; Basic block executed 2 times. + %0 = call i32 @puts(i8* getelementptr inbounds ([12 x i8]* @.str, i64 0, i64 0)) nounwind ; [#uses=0] + ret void +} + +declare i32 @puts(i8*) + +; PROF:;;; %main called 2 times. +; PROF:;;; +define i32 @main(i32 %argc, i8** %argv) nounwind { +entry: +; PROF:entry: +; PROF: ;;; Basic block executed 2 times. + %argc_addr = alloca i32 ; [#uses=4] + %argv_addr = alloca i8** ; [#uses=1] + %retval = alloca i32 ; [#uses=2] + %j = alloca i32 ; [#uses=4] + %i = alloca i32 ; [#uses=4] + %0 = alloca i32 ; [#uses=2] +; INST:call +; INST:@llvm_start_edge_profiling +; INST:@EdgeProfCounters + %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] + store i32 %argc, i32* %argc_addr + store i8** %argv, i8*** %argv_addr + store i32 0, i32* %i, align 4 + br label %bb10 +; PROF: ;;; Out-edge counts: [2.000000e+00 -> bb10] + +bb: ; preds = %bb10 +; PROF:bb: +; PROF: ;;; Basic block executed 6 times. + %1 = load i32* %argc_addr, align 4 ; [#uses=1] + %2 = icmp sgt i32 %1, 1 ; [#uses=1] + br i1 %2, label %bb1, label %bb8 +; PROF: ;;; Out-edge counts: [3.000000e+00 -> bb1] [3.000000e+00 -> bb8] + +bb1: ; preds = %bb +; PROF:bb1: +; PROF: ;;; Basic block executed 3 times. + store i32 0, i32* %j, align 4 + br label %bb6 +; PROF: ;;; Out-edge counts: [3.000000e+00 -> bb6] + +bb2: ; preds = %bb6 +; PROF:bb2: +; PROF: ;;; Basic block executed 9 times. + %3 = call i32 @puts(i8* getelementptr inbounds ([6 x i8]* @.str1, i64 0, i64 0)) nounwind ; [#uses=0] + %4 = load i32* %argc_addr, align 4 ; [#uses=1] + %5 = icmp sgt i32 %4, 2 ; [#uses=1] + br i1 %5, label %bb3, label %bb4 +; PROF: ;;; Out-edge counts: [9.000000e+00 -> bb3] + +bb3: ; preds = %bb2 +; PROF:bb3: +; PROF: ;;; Basic block executed 9 times. + %6 = call i32 @puts(i8* getelementptr inbounds ([9 x i8]* @.str2, i64 0, i64 0)) nounwind ; [#uses=0] + br label %bb5 +; PROF: ;;; Out-edge counts: [9.000000e+00 -> bb5] + +bb4: ; preds = %bb2 +; PROF:bb4: +; PROF: ;;; Never executed! + %7 = call i32 @puts(i8* getelementptr inbounds ([9 x i8]* @.str3, i64 0, i64 0)) nounwind ; [#uses=0] + br label %bb11 + +bb5: ; preds = %bb3 +; PROF:bb5: +; PROF: ;;; Basic block executed 9 times. + %8 = call i32 @puts(i8* getelementptr inbounds ([6 x i8]* @.str4, i64 0, i64 0)) nounwind ; [#uses=0] + %9 = load i32* %j, align 4 ; [#uses=1] + %10 = add nsw i32 %9, 1 ; [#uses=1] + store i32 %10, i32* %j, align 4 + br label %bb6 +; PROF: ;;; Out-edge counts: [9.000000e+00 -> bb6] + +bb6: ; preds = %bb5, %bb1 +; PROF:bb6: +; PROF: ;;; Basic block executed 12 times. + %11 = load i32* %j, align 4 ; [#uses=1] + %12 = load i32* %argc_addr, align 4 ; [#uses=1] + %13 = icmp slt i32 %11, %12 ; [#uses=1] + br i1 %13, label %bb2, label %bb7 +; PROF: ;;; Out-edge counts: [9.000000e+00 -> bb2] [3.000000e+00 -> bb7] + +bb7: ; preds = %bb6 +; PROF:bb7: +; PROF: ;;; Basic block executed 3 times. + br label %bb9 +; PROF: ;;; Out-edge counts: [3.000000e+00 -> bb9] + +bb8: ; preds = %bb +; PROF:bb8: +; PROF: ;;; Basic block executed 3 times. + %14 = call i32 @puts(i8* getelementptr inbounds ([10 x i8]* @.str5, i64 0, i64 0)) nounwind ; [#uses=0] + br label %bb9 +; PROF: ;;; Out-edge counts: [3.000000e+00 -> bb9] + +bb9: ; preds = %bb8, %bb7 +; PROF:bb9: +; PROF: ;;; Basic block executed 6 times. + %15 = load i32* %i, align 4 ; [#uses=1] + %16 = add nsw i32 %15, 1 ; [#uses=1] + store i32 %16, i32* %i, align 4 + br label %bb10 +; PROF: ;;; Out-edge counts: [6.000000e+00 -> bb10] + +bb10: ; preds = %bb9, %entry +; PROF:bb10: +; PROF: ;;; Basic block executed 8 times. + %17 = load i32* %i, align 4 ; [#uses=1] + %18 = icmp ne i32 %17, 3 ; [#uses=1] + br i1 %18, label %bb, label %bb11 +; INST:br +; INST:label %bb10.bb11_crit_edge +; PROF: ;;; Out-edge counts: [6.000000e+00 -> bb] [2.000000e+00 -> bb11] + +; INST:bb10.bb11_crit_edge: +; INST:br +; INST:label %bb11 + +bb11: ; preds = %bb10, %bb4 +; PROF:bb11: +; PROF: ;;; Basic block executed 2 times. + call void @oneblock() nounwind + store i32 0, i32* %0, align 4 + %19 = load i32* %0, align 4 ; [#uses=1] + store i32 %19, i32* %retval, align 4 + br label %return +; PROF: ;;; Out-edge counts: [2.000000e+00 -> return] + +return: ; preds = %bb11 +; PROF:return: +; PROF: ;;; Basic block executed 2 times. + %retval12 = load i32* %retval ; [#uses=1] + ret i32 %retval12 +} diff --git a/libclamav/c++/llvm/test/Analysis/ScalarEvolution/scev-aa.ll b/libclamav/c++/llvm/test/Analysis/ScalarEvolution/scev-aa.ll new file mode 100644 index 000000000..2208b3db4 --- /dev/null +++ b/libclamav/c++/llvm/test/Analysis/ScalarEvolution/scev-aa.ll @@ -0,0 +1,194 @@ +; RUN: llvm-as < %s | opt -scev-aa -aa-eval -print-all-alias-modref-info \ +; RUN: |& FileCheck %s + +; At the time of this writing, all of these CHECK lines are cases that +; plain -basicaa misses. + +target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64" + +; p[i] and p[i+1] don't alias. + +; CHECK: Function: loop: 3 pointers, 0 call sites +; CHECK: NoAlias: double* %pi, double* %pi.next + +define void @loop(double* nocapture %p, i64 %n) nounwind { +entry: + %j = icmp sgt i64 %n, 0 + br i1 %j, label %bb, label %return + +bb: + %i = phi i64 [ 0, %entry ], [ %i.next, %bb ] + %pi = getelementptr double* %p, i64 %i + %i.next = add i64 %i, 1 + %pi.next = getelementptr double* %p, i64 %i.next + %x = load double* %pi + %y = load double* %pi.next + %z = fmul double %x, %y + store double %z, double* %pi + %exitcond = icmp eq i64 %i.next, %n + br i1 %exitcond, label %return, label %bb + +return: + ret void +} + +; Slightly more involved: p[j][i], p[j][i+1], and p[j+1][i] don't alias. + +; CHECK: Function: nestedloop: 4 pointers, 0 call sites +; CHECK: NoAlias: double* %pi.j, double* %pi.next.j +; CHECK: NoAlias: double* %pi.j, double* %pi.j.next +; CHECK: NoAlias: double* %pi.j.next, double* %pi.next.j + +define void @nestedloop(double* nocapture %p, i64 %m) nounwind { +entry: + %k = icmp sgt i64 %m, 0 + br i1 %k, label %guard, label %return + +guard: + %l = icmp sgt i64 91, 0 + br i1 %l, label %outer.loop, label %return + +outer.loop: + %j = phi i64 [ 0, %guard ], [ %j.next, %outer.latch ] + br label %bb + +bb: + %i = phi i64 [ 0, %outer.loop ], [ %i.next, %bb ] + %i.next = add i64 %i, 1 + + %e = add i64 %i, %j + %pi.j = getelementptr double* %p, i64 %e + %f = add i64 %i.next, %j + %pi.next.j = getelementptr double* %p, i64 %f + %x = load double* %pi.j + %y = load double* %pi.next.j + %z = fmul double %x, %y + store double %z, double* %pi.j + + %o = add i64 %j, 91 + %g = add i64 %i, %o + %pi.j.next = getelementptr double* %p, i64 %g + %a = load double* %pi.j.next + %b = fmul double %x, %a + store double %b, double* %pi.j.next + + %exitcond = icmp eq i64 %i.next, 91 + br i1 %exitcond, label %outer.latch, label %bb + +outer.latch: + %j.next = add i64 %j, 91 + %h = icmp eq i64 %j.next, %m + br i1 %h, label %return, label %outer.loop + +return: + ret void +} + +; Even more involved: same as nestedloop, but with a variable extent. +; When n is 1, p[j+1][i] does alias p[j][i+1], and there's no way to +; prove whether n will be greater than 1, so that relation will always +; by MayAlias. The loop is guarded by a n > 0 test though, so +; p[j+1][i] and p[j][i] can theoretically be determined to be NoAlias, +; however the analysis currently doesn't do that. +; TODO: Make the analysis smarter and turn that MayAlias into a NoAlias. + +; CHECK: Function: nestedloop_more: 4 pointers, 0 call sites +; CHECK: NoAlias: double* %pi.j, double* %pi.next.j +; CHECK: MayAlias: double* %pi.j, double* %pi.j.next + +define void @nestedloop_more(double* nocapture %p, i64 %n, i64 %m) nounwind { +entry: + %k = icmp sgt i64 %m, 0 + br i1 %k, label %guard, label %return + +guard: + %l = icmp sgt i64 %n, 0 + br i1 %l, label %outer.loop, label %return + +outer.loop: + %j = phi i64 [ 0, %guard ], [ %j.next, %outer.latch ] + br label %bb + +bb: + %i = phi i64 [ 0, %outer.loop ], [ %i.next, %bb ] + %i.next = add i64 %i, 1 + + %e = add i64 %i, %j + %pi.j = getelementptr double* %p, i64 %e + %f = add i64 %i.next, %j + %pi.next.j = getelementptr double* %p, i64 %f + %x = load double* %pi.j + %y = load double* %pi.next.j + %z = fmul double %x, %y + store double %z, double* %pi.j + + %o = add i64 %j, %n + %g = add i64 %i, %o + %pi.j.next = getelementptr double* %p, i64 %g + %a = load double* %pi.j.next + %b = fmul double %x, %a + store double %b, double* %pi.j.next + + %exitcond = icmp eq i64 %i.next, %n + br i1 %exitcond, label %outer.latch, label %bb + +outer.latch: + %j.next = add i64 %j, %n + %h = icmp eq i64 %j.next, %m + br i1 %h, label %return, label %outer.loop + +return: + ret void +} + +; ScalarEvolution expands field offsets into constants, which allows it to +; do aggressive analysis. Contrast this with BasicAA, which works by +; recognizing GEP idioms. + +%struct.A = type { %struct.B, i32, i32 } +%struct.B = type { double } + +; CHECK: Function: foo: 7 pointers, 0 call sites +; CHECK: NoAlias: %struct.B* %B, i32* %Z +; CHECK: NoAlias: %struct.B* %B, %struct.B* %C +; CHECK: MustAlias: %struct.B* %C, i32* %Z +; CHECK: NoAlias: %struct.B* %B, i32* %X +; CHECK: MustAlias: i32* %X, i32* %Z +; CHECK: MustAlias: %struct.B* %C, i32* %Y +; CHECK: MustAlias: i32* %X, i32* %Y + +define void @foo() { +entry: + %A = alloca %struct.A + %B = getelementptr %struct.A* %A, i32 0, i32 0 + %Q = bitcast %struct.B* %B to %struct.A* + %Z = getelementptr %struct.A* %Q, i32 0, i32 1 + %C = getelementptr %struct.B* %B, i32 1 + %X = bitcast %struct.B* %C to i32* + %Y = getelementptr %struct.A* %A, i32 0, i32 1 + ret void +} + +; CHECK: Function: bar: 7 pointers, 0 call sites +; CHECK: NoAlias: %struct.B* %N, i32* %P +; CHECK: NoAlias: %struct.B* %N, %struct.B* %R +; CHECK: MustAlias: %struct.B* %R, i32* %P +; CHECK: NoAlias: %struct.B* %N, i32* %W +; CHECK: MustAlias: i32* %P, i32* %W +; CHECK: MustAlias: %struct.B* %R, i32* %V +; CHECK: MustAlias: i32* %V, i32* %W + +define void @bar() { + %M = alloca %struct.A + %N = getelementptr %struct.A* %M, i32 0, i32 0 + %O = bitcast %struct.B* %N to %struct.A* + %P = getelementptr %struct.A* %O, i32 0, i32 1 + %R = getelementptr %struct.B* %N, i32 1 + %W = bitcast %struct.B* %R to i32* + %V = getelementptr %struct.A* %M, i32 0, i32 1 + ret void +} + +; CHECK: 13 no alias responses +; CHECK: 26 may alias responses +; CHECK: 18 must alias responses diff --git a/libclamav/c++/llvm/test/Assembler/2002-01-24-BadSymbolTableAssert.ll b/libclamav/c++/llvm/test/Assembler/2002-01-24-BadSymbolTableAssert.ll index b2a48f556..7c49e2bd9 100644 --- a/libclamav/c++/llvm/test/Assembler/2002-01-24-BadSymbolTableAssert.ll +++ b/libclamav/c++/llvm/test/Assembler/2002-01-24-BadSymbolTableAssert.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as %s -o /dev/null -f +; RUN: llvm-as %s -o /dev/null ; This testcase failed due to a bad assertion in SymbolTable.cpp, removed in ; the 1.20 revision. Basically the symbol table assumed that if there was an diff --git a/libclamav/c++/llvm/test/Assembler/2002-01-24-ValueRefineAbsType.ll b/libclamav/c++/llvm/test/Assembler/2002-01-24-ValueRefineAbsType.ll index fb7c4fbf5..6e49674a3 100644 --- a/libclamav/c++/llvm/test/Assembler/2002-01-24-ValueRefineAbsType.ll +++ b/libclamav/c++/llvm/test/Assembler/2002-01-24-ValueRefineAbsType.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as %s -o /dev/null -f +; RUN: llvm-as %s -o /dev/null ; This testcase used to fail due to a lack of this diff in Value.cpp: ; diff -r1.16 Value.cpp diff --git a/libclamav/c++/llvm/test/Assembler/2002-02-19-TypeParsing.ll b/libclamav/c++/llvm/test/Assembler/2002-02-19-TypeParsing.ll index b7cadbdb0..0df678497 100644 --- a/libclamav/c++/llvm/test/Assembler/2002-02-19-TypeParsing.ll +++ b/libclamav/c++/llvm/test/Assembler/2002-02-19-TypeParsing.ll @@ -1,3 +1,3 @@ -; RUN: llvm-as %s -o /dev/null -f +; RUN: llvm-as %s -o /dev/null %Hosp = type { i32, i32, i32, { \2*, { i32, i32, i32, { [4 x \3], \2, \5, %Hosp, i32, i32 }* }*, \2* }, { \2*, { i32, i32, i32, { [4 x \3], \2, \5, %Hosp, i32, i32 }* }*, \2* }, { \2*, { i32, i32, i32, { [4 x \3], \2, \5, %Hosp, i32, i32 }* }*, \2* }, { \2*, { i32, i32, i32, { [4 x \3], \2, \5, %Hosp, i32, i32 }* }*, \2* } } diff --git a/libclamav/c++/llvm/test/Assembler/2002-03-08-NameCollision.ll b/libclamav/c++/llvm/test/Assembler/2002-03-08-NameCollision.ll index 539dfd671..b49789b29 100644 --- a/libclamav/c++/llvm/test/Assembler/2002-03-08-NameCollision.ll +++ b/libclamav/c++/llvm/test/Assembler/2002-03-08-NameCollision.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as %s -o /dev/null -f +; RUN: llvm-as %s -o /dev/null ; Method arguments were being checked for collisions at the global scope before ; the method object was created by the parser. Because of this, false diff --git a/libclamav/c++/llvm/test/Assembler/2002-03-08-NameCollision2.ll b/libclamav/c++/llvm/test/Assembler/2002-03-08-NameCollision2.ll index 57dc517d3..1f7a4e16f 100644 --- a/libclamav/c++/llvm/test/Assembler/2002-03-08-NameCollision2.ll +++ b/libclamav/c++/llvm/test/Assembler/2002-03-08-NameCollision2.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as %s -o /dev/null -f +; RUN: llvm-as %s -o /dev/null ; Another name collision problem. Here the problem was that if a forward ; declaration for a method was found, that this would cause spurious conflicts diff --git a/libclamav/c++/llvm/test/Assembler/2002-04-04-PureVirtMethCall.ll b/libclamav/c++/llvm/test/Assembler/2002-04-04-PureVirtMethCall.ll index 4c63e44e9..29aed55a3 100644 --- a/libclamav/c++/llvm/test/Assembler/2002-04-04-PureVirtMethCall.ll +++ b/libclamav/c++/llvm/test/Assembler/2002-04-04-PureVirtMethCall.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as %s -o /dev/null -f +; RUN: llvm-as %s -o /dev/null type { { \2 *, \4 ** }, { \2 *, \4 ** } diff --git a/libclamav/c++/llvm/test/Assembler/2002-04-04-PureVirtMethCall2.ll b/libclamav/c++/llvm/test/Assembler/2002-04-04-PureVirtMethCall2.ll index 553401f56..a0968999a 100644 --- a/libclamav/c++/llvm/test/Assembler/2002-04-04-PureVirtMethCall2.ll +++ b/libclamav/c++/llvm/test/Assembler/2002-04-04-PureVirtMethCall2.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as %s -o /dev/null -f +; RUN: llvm-as %s -o /dev/null %t = type { { \2*, \2 }, { \2*, \2 } diff --git a/libclamav/c++/llvm/test/Assembler/2002-04-05-TypeParsing.ll b/libclamav/c++/llvm/test/Assembler/2002-04-05-TypeParsing.ll index 82db75f1c..f725944b9 100644 --- a/libclamav/c++/llvm/test/Assembler/2002-04-05-TypeParsing.ll +++ b/libclamav/c++/llvm/test/Assembler/2002-04-05-TypeParsing.ll @@ -1,3 +1,3 @@ -; RUN: llvm-as %s -o /dev/null -f +; RUN: llvm-as %s -o /dev/null %Hosp = type { { \2*, { \2, %Hosp }* }, { \2*, { \2, %Hosp }* } } diff --git a/libclamav/c++/llvm/test/Assembler/2002-05-02-InvalidForwardRef.ll b/libclamav/c++/llvm/test/Assembler/2002-05-02-InvalidForwardRef.ll index 00a0a0153..234545c29 100644 --- a/libclamav/c++/llvm/test/Assembler/2002-05-02-InvalidForwardRef.ll +++ b/libclamav/c++/llvm/test/Assembler/2002-05-02-InvalidForwardRef.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as %s -o /dev/null -f +; RUN: llvm-as %s -o /dev/null ; It looks like the assembler is not forward resolving the function declaraion ; correctly. diff --git a/libclamav/c++/llvm/test/Assembler/2002-05-02-ParseError.ll b/libclamav/c++/llvm/test/Assembler/2002-05-02-ParseError.ll index b198edfd3..5a9817c1e 100644 --- a/libclamav/c++/llvm/test/Assembler/2002-05-02-ParseError.ll +++ b/libclamav/c++/llvm/test/Assembler/2002-05-02-ParseError.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as %s -o /dev/null -f +; RUN: llvm-as %s -o /dev/null %T = type i32 * diff --git a/libclamav/c++/llvm/test/Assembler/2002-07-08-HugePerformanceProblem.ll b/libclamav/c++/llvm/test/Assembler/2002-07-08-HugePerformanceProblem.ll index b9ebfbe2a..52c90af18 100644 --- a/libclamav/c++/llvm/test/Assembler/2002-07-08-HugePerformanceProblem.ll +++ b/libclamav/c++/llvm/test/Assembler/2002-07-08-HugePerformanceProblem.ll @@ -1,6 +1,6 @@ ; This file takes about 48 __MINUTES__ to assemble using as. This is WAY too ; long. The type resolution code needs to be sped up a lot. -; RUN: llvm-as %s -o /dev/null -f +; RUN: llvm-as %s -o /dev/null %ALL_INTERSECTIONS_METHOD = type i32 (%OBJECT*, %RAY*, %ISTACK*)* %BBOX = type { %BBOX_VECT, %BBOX_VECT } %BBOX_TREE = type { i16, i16, %BBOX, %BBOX_TREE** } diff --git a/libclamav/c++/llvm/test/Assembler/2002-07-25-ParserAssertionFailure.ll b/libclamav/c++/llvm/test/Assembler/2002-07-25-ParserAssertionFailure.ll index 29c7c02ff..3c5c5546b 100644 --- a/libclamav/c++/llvm/test/Assembler/2002-07-25-ParserAssertionFailure.ll +++ b/libclamav/c++/llvm/test/Assembler/2002-07-25-ParserAssertionFailure.ll @@ -1,6 +1,6 @@ ; Make sure we don't get an assertion failure, even though this is a parse ; error -; RUN: not llvm-as %s -o /dev/null -f |& grep {'@foo' defined with} +; RUN: not llvm-as %s -o /dev/null |& grep {'@foo' defined with} %ty = type void (i32) diff --git a/libclamav/c++/llvm/test/Assembler/2002-08-15-CastAmbiguity.ll b/libclamav/c++/llvm/test/Assembler/2002-08-15-CastAmbiguity.ll index c10f91103..c71652446 100644 --- a/libclamav/c++/llvm/test/Assembler/2002-08-15-CastAmbiguity.ll +++ b/libclamav/c++/llvm/test/Assembler/2002-08-15-CastAmbiguity.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as %s -o /dev/null -f +; RUN: llvm-as %s -o /dev/null define void @test(i32 %X) { call void @test( i32 6 ) diff --git a/libclamav/c++/llvm/test/Assembler/2002-08-15-ConstantExprProblem.ll b/libclamav/c++/llvm/test/Assembler/2002-08-15-ConstantExprProblem.ll index d02c26a80..02b9ea9ad 100644 --- a/libclamav/c++/llvm/test/Assembler/2002-08-15-ConstantExprProblem.ll +++ b/libclamav/c++/llvm/test/Assembler/2002-08-15-ConstantExprProblem.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as %s -o /dev/null -f +; RUN: llvm-as %s -o /dev/null @.LC0 = internal global [12 x i8] c"hello world\00" ; <[12 x i8]*> [#uses=1] diff --git a/libclamav/c++/llvm/test/Assembler/2002-08-15-UnresolvedGlobalReference.ll b/libclamav/c++/llvm/test/Assembler/2002-08-15-UnresolvedGlobalReference.ll index 5252be266..2ba3f14a4 100644 --- a/libclamav/c++/llvm/test/Assembler/2002-08-15-UnresolvedGlobalReference.ll +++ b/libclamav/c++/llvm/test/Assembler/2002-08-15-UnresolvedGlobalReference.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as %s -o /dev/null -f +; RUN: llvm-as %s -o /dev/null @.LC0 = internal global [12 x i8] c"hello world\00" ; <[12 x i8]*> [#uses=1] diff --git a/libclamav/c++/llvm/test/Assembler/2002-08-22-DominanceProblem.ll b/libclamav/c++/llvm/test/Assembler/2002-08-22-DominanceProblem.ll index a841dfa83..0dc192df2 100644 --- a/libclamav/c++/llvm/test/Assembler/2002-08-22-DominanceProblem.ll +++ b/libclamav/c++/llvm/test/Assembler/2002-08-22-DominanceProblem.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as %s -o /dev/null -f +; RUN: llvm-as %s -o /dev/null ; Dominance relationships is not calculated correctly for unreachable blocks, ; which causes the verifier to barf on this input. diff --git a/libclamav/c++/llvm/test/Assembler/2002-10-08-LargeArrayPerformance.ll b/libclamav/c++/llvm/test/Assembler/2002-10-08-LargeArrayPerformance.ll index 2c4cba412..34a993214 100644 --- a/libclamav/c++/llvm/test/Assembler/2002-10-08-LargeArrayPerformance.ll +++ b/libclamav/c++/llvm/test/Assembler/2002-10-08-LargeArrayPerformance.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as %s -o /dev/null -f +; RUN: llvm-as %s -o /dev/null ; This testcase comes from the following really simple c file: ;; int foo[30000] ;;; We should not be soo slow for such a simple case! diff --git a/libclamav/c++/llvm/test/Assembler/2002-10-15-NameClash.ll b/libclamav/c++/llvm/test/Assembler/2002-10-15-NameClash.ll index 8ba5ed250..89346cba9 100644 --- a/libclamav/c++/llvm/test/Assembler/2002-10-15-NameClash.ll +++ b/libclamav/c++/llvm/test/Assembler/2002-10-15-NameClash.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as %s -o /dev/null -f +; RUN: llvm-as %s -o /dev/null declare i32 @"ArrayRef"([100 x i32] * %Array) diff --git a/libclamav/c++/llvm/test/Assembler/2002-12-15-GlobalResolve.ll b/libclamav/c++/llvm/test/Assembler/2002-12-15-GlobalResolve.ll index da049c4f4..f9ad12e54 100644 --- a/libclamav/c++/llvm/test/Assembler/2002-12-15-GlobalResolve.ll +++ b/libclamav/c++/llvm/test/Assembler/2002-12-15-GlobalResolve.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as %s -o /dev/null -f +; RUN: llvm-as %s -o /dev/null @X = external global i32* @X1 = external global %T* diff --git a/libclamav/c++/llvm/test/Assembler/2003-01-30-UnsignedString.ll b/libclamav/c++/llvm/test/Assembler/2003-01-30-UnsignedString.ll index 5eaa9c2c8..3c14d7162 100644 --- a/libclamav/c++/llvm/test/Assembler/2003-01-30-UnsignedString.ll +++ b/libclamav/c++/llvm/test/Assembler/2003-01-30-UnsignedString.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as %s -o /dev/null -f +; RUN: llvm-as %s -o /dev/null @spell_order = global [4 x i8] c"\FF\00\F7\00" diff --git a/libclamav/c++/llvm/test/Assembler/2003-04-25-UnresolvedGlobalReference.ll b/libclamav/c++/llvm/test/Assembler/2003-04-25-UnresolvedGlobalReference.ll index 608eb6ae3..f1a5ed7b5 100644 --- a/libclamav/c++/llvm/test/Assembler/2003-04-25-UnresolvedGlobalReference.ll +++ b/libclamav/c++/llvm/test/Assembler/2003-04-25-UnresolvedGlobalReference.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as %s -o /dev/null -f +; RUN: llvm-as %s -o /dev/null ; There should be absolutely no problem with this testcase. define i32 @test(i32 %arg1, i32 %arg2) { diff --git a/libclamav/c++/llvm/test/Assembler/2003-05-15-AssemblerProblem.ll b/libclamav/c++/llvm/test/Assembler/2003-05-15-AssemblerProblem.ll index 17967a936..146ce6534 100644 --- a/libclamav/c++/llvm/test/Assembler/2003-05-15-AssemblerProblem.ll +++ b/libclamav/c++/llvm/test/Assembler/2003-05-15-AssemblerProblem.ll @@ -1,6 +1,6 @@ ; This bug was caused by two CPR's existing for the same global variable, ; colliding in the Module level CPR map. -; RUN: llvm-as %s -o /dev/null -f +; RUN: llvm-as %s -o /dev/null define void @test() { call void (...)* bitcast (void (i16*, i32)* @AddString to void (...)*)( i16* null, i32 0 ) diff --git a/libclamav/c++/llvm/test/Assembler/2003-05-15-SwitchBug.ll b/libclamav/c++/llvm/test/Assembler/2003-05-15-SwitchBug.ll index af42020ca..3768d9c9a 100644 --- a/libclamav/c++/llvm/test/Assembler/2003-05-15-SwitchBug.ll +++ b/libclamav/c++/llvm/test/Assembler/2003-05-15-SwitchBug.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as %s -o /dev/null -f +; RUN: llvm-as %s -o /dev/null ; Check minimal switch statement diff --git a/libclamav/c++/llvm/test/Assembler/2003-05-21-ConstantShiftExpr.ll b/libclamav/c++/llvm/test/Assembler/2003-05-21-ConstantShiftExpr.ll index 667bc9b93..40b96514e 100644 --- a/libclamav/c++/llvm/test/Assembler/2003-05-21-ConstantShiftExpr.ll +++ b/libclamav/c++/llvm/test/Assembler/2003-05-21-ConstantShiftExpr.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as %s -o /dev/null -f +; RUN: llvm-as %s -o /dev/null ; Test that shift instructions can be used in constant expressions. global i32 3670016 diff --git a/libclamav/c++/llvm/test/Assembler/2003-05-21-EmptyStructTest.ll b/libclamav/c++/llvm/test/Assembler/2003-05-21-EmptyStructTest.ll index 6925d2693..26e83d931 100644 --- a/libclamav/c++/llvm/test/Assembler/2003-05-21-EmptyStructTest.ll +++ b/libclamav/c++/llvm/test/Assembler/2003-05-21-EmptyStructTest.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as %s -o /dev/null -f +; RUN: llvm-as %s -o /dev/null ; The old C front-end never generated empty structures, now the new one ; can. For some reason we never handled them in the parser. Weird. diff --git a/libclamav/c++/llvm/test/Assembler/2003-06-30-RecursiveTypeProblem.ll b/libclamav/c++/llvm/test/Assembler/2003-06-30-RecursiveTypeProblem.ll index 33f63a621..5db31140a 100644 --- a/libclamav/c++/llvm/test/Assembler/2003-06-30-RecursiveTypeProblem.ll +++ b/libclamav/c++/llvm/test/Assembler/2003-06-30-RecursiveTypeProblem.ll @@ -1,3 +1,3 @@ -; RUN: llvm-as %s -o /dev/null -f +; RUN: llvm-as %s -o /dev/null %MidFnTy = type void (%MidFnTy*) diff --git a/libclamav/c++/llvm/test/Assembler/2003-10-04-NotMergingGlobalConstants.ll b/libclamav/c++/llvm/test/Assembler/2003-10-04-NotMergingGlobalConstants.ll index 10a0280e9..5fec05d8c 100644 --- a/libclamav/c++/llvm/test/Assembler/2003-10-04-NotMergingGlobalConstants.ll +++ b/libclamav/c++/llvm/test/Assembler/2003-10-04-NotMergingGlobalConstants.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as %s -o /dev/null -f +; RUN: llvm-as %s -o /dev/null %T = type i32 @X = global i32* null ; [#uses=0] diff --git a/libclamav/c++/llvm/test/Assembler/2003-12-30-TypeMapInvalidMemory.ll b/libclamav/c++/llvm/test/Assembler/2003-12-30-TypeMapInvalidMemory.ll index bdb4d5468..93f9a7081 100644 --- a/libclamav/c++/llvm/test/Assembler/2003-12-30-TypeMapInvalidMemory.ll +++ b/libclamav/c++/llvm/test/Assembler/2003-12-30-TypeMapInvalidMemory.ll @@ -1,4 +1,4 @@ -; RUN: not llvm-as %s -o /dev/null -f |& grep {use of undefined type named 'struct.D_Scope'} +; RUN: not llvm-as %s -o /dev/null |& grep {use of undefined type named 'struct.D_Scope'} ; END. @d_reduction_0_dparser_gram = global { diff --git a/libclamav/c++/llvm/test/Assembler/2004-02-27-SelfUseAssertError.ll b/libclamav/c++/llvm/test/Assembler/2004-02-27-SelfUseAssertError.ll index ff4c0b43e..7052eac5c 100644 --- a/libclamav/c++/llvm/test/Assembler/2004-02-27-SelfUseAssertError.ll +++ b/libclamav/c++/llvm/test/Assembler/2004-02-27-SelfUseAssertError.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as %s -o /dev/null -f +; RUN: llvm-as %s -o /dev/null ; %inc2 uses it's own value, but that's ok, as it's unreachable! diff --git a/libclamav/c++/llvm/test/Assembler/2004-04-04-GetElementPtrIndexTypes.ll b/libclamav/c++/llvm/test/Assembler/2004-04-04-GetElementPtrIndexTypes.ll index c9363dbcd..ab46f887b 100644 --- a/libclamav/c++/llvm/test/Assembler/2004-04-04-GetElementPtrIndexTypes.ll +++ b/libclamav/c++/llvm/test/Assembler/2004-04-04-GetElementPtrIndexTypes.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as %s -o /dev/null -f +; RUN: llvm-as %s -o /dev/null define i32* @t1({ float, i32 }* %X) { %W = getelementptr { float, i32 }* %X, i32 20, i32 1 ; [#uses=0] diff --git a/libclamav/c++/llvm/test/Assembler/2004-10-22-BCWriterUndefBug.ll b/libclamav/c++/llvm/test/Assembler/2004-10-22-BCWriterUndefBug.ll index 4b2ebeee9..694b80b78 100644 --- a/libclamav/c++/llvm/test/Assembler/2004-10-22-BCWriterUndefBug.ll +++ b/libclamav/c++/llvm/test/Assembler/2004-10-22-BCWriterUndefBug.ll @@ -1,5 +1,5 @@ ;; The bytecode writer was trying to treat undef values as ConstantArray's when ;; they looked like strings. -;; RUN: llvm-as %s -o /dev/null -f +;; RUN: llvm-as %s -o /dev/null @G = internal global [8 x i8] undef diff --git a/libclamav/c++/llvm/test/Assembler/2004-11-28-InvalidTypeCrash.ll b/libclamav/c++/llvm/test/Assembler/2004-11-28-InvalidTypeCrash.ll index 6f264393a..f9b453b57 100644 --- a/libclamav/c++/llvm/test/Assembler/2004-11-28-InvalidTypeCrash.ll +++ b/libclamav/c++/llvm/test/Assembler/2004-11-28-InvalidTypeCrash.ll @@ -1,4 +1,4 @@ ; Test for PR463. This program is erroneous, but should not crash llvm-as. -; RUN: not llvm-as %s -o /dev/null -f |& grep {invalid type for null constant} +; RUN: not llvm-as %s -o /dev/null |& grep {invalid type for null constant} @.FOO = internal global %struct.none zeroinitializer diff --git a/libclamav/c++/llvm/test/Assembler/2005-01-31-CallingAggregateFunction.ll b/libclamav/c++/llvm/test/Assembler/2005-01-31-CallingAggregateFunction.ll index 14045138f..ce769a2e9 100644 --- a/libclamav/c++/llvm/test/Assembler/2005-01-31-CallingAggregateFunction.ll +++ b/libclamav/c++/llvm/test/Assembler/2005-01-31-CallingAggregateFunction.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as %s -o /dev/null -f +; RUN: llvm-as %s -o /dev/null define void @test() { call {i32} @foo() diff --git a/libclamav/c++/llvm/test/Assembler/2007-01-02-Undefined-Arg-Type.ll b/libclamav/c++/llvm/test/Assembler/2007-01-02-Undefined-Arg-Type.ll index 1962ae70c..a39de1cb6 100644 --- a/libclamav/c++/llvm/test/Assembler/2007-01-02-Undefined-Arg-Type.ll +++ b/libclamav/c++/llvm/test/Assembler/2007-01-02-Undefined-Arg-Type.ll @@ -1,5 +1,5 @@ ; The assembler should catch an undefined argument type . -; RUN: not llvm-as %s -o /dev/null -f |& grep {use of undefined type named 'typedef.bc_struct'} +; RUN: not llvm-as %s -o /dev/null |& grep {use of undefined type named 'typedef.bc_struct'} ; %typedef.bc_struct = type opaque diff --git a/libclamav/c++/llvm/test/Assembler/2007-01-05-Cmp-ConstExpr.ll b/libclamav/c++/llvm/test/Assembler/2007-01-05-Cmp-ConstExpr.ll index 8c25989d2..e3f67ba13 100644 --- a/libclamav/c++/llvm/test/Assembler/2007-01-05-Cmp-ConstExpr.ll +++ b/libclamav/c++/llvm/test/Assembler/2007-01-05-Cmp-ConstExpr.ll @@ -1,5 +1,5 @@ ; Test Case for PR1080 -; RUN: llvm-as %s -o /dev/null -f +; RUN: llvm-as %s -o /dev/null @str = internal constant [4 x i8] c"-ga\00" ; <[4 x i8]*> [#uses=2] diff --git a/libclamav/c++/llvm/test/Assembler/2007-01-16-CrashOnBadCast.ll b/libclamav/c++/llvm/test/Assembler/2007-01-16-CrashOnBadCast.ll index 33666b8cb..81f5458b2 100644 --- a/libclamav/c++/llvm/test/Assembler/2007-01-16-CrashOnBadCast.ll +++ b/libclamav/c++/llvm/test/Assembler/2007-01-16-CrashOnBadCast.ll @@ -1,5 +1,5 @@ ; PR1117 -; RUN: not llvm-as %s -o /dev/null -f |& grep {invalid cast opcode for cast from} +; RUN: not llvm-as %s -o /dev/null |& grep {invalid cast opcode for cast from} define i8* @nada(i64 %X) { %result = trunc i64 %X to i8* diff --git a/libclamav/c++/llvm/test/Assembler/2007-01-16-CrashOnBadCast2.ll b/libclamav/c++/llvm/test/Assembler/2007-01-16-CrashOnBadCast2.ll index 49c539f50..c05c60952 100644 --- a/libclamav/c++/llvm/test/Assembler/2007-01-16-CrashOnBadCast2.ll +++ b/libclamav/c++/llvm/test/Assembler/2007-01-16-CrashOnBadCast2.ll @@ -1,4 +1,4 @@ ; PR1117 -; RUN: not llvm-as %s -o /dev/null -f |& grep {invalid cast opcode for cast from} +; RUN: not llvm-as %s -o /dev/null |& grep {invalid cast opcode for cast from} @X = constant i8* trunc (i64 0 to i8*) diff --git a/libclamav/c++/llvm/test/Assembler/2007-03-18-InvalidNumberedVar.ll b/libclamav/c++/llvm/test/Assembler/2007-03-18-InvalidNumberedVar.ll index 12bac6112..b2193b170 100644 --- a/libclamav/c++/llvm/test/Assembler/2007-03-18-InvalidNumberedVar.ll +++ b/libclamav/c++/llvm/test/Assembler/2007-03-18-InvalidNumberedVar.ll @@ -1,5 +1,5 @@ ; PR 1258 -; RUN: not llvm-as < %s >/dev/null -f |& grep {'%0' defined with type 'i1'} +; RUN: not llvm-as < %s >/dev/null |& grep {'%0' defined with type 'i1'} define i32 @test1(i32 %a, i32 %b) { entry: diff --git a/libclamav/c++/llvm/test/Assembler/2008-09-02-FunctionNotes2.ll b/libclamav/c++/llvm/test/Assembler/2008-09-02-FunctionNotes2.ll index dbe75be70..8a49e8990 100644 --- a/libclamav/c++/llvm/test/Assembler/2008-09-02-FunctionNotes2.ll +++ b/libclamav/c++/llvm/test/Assembler/2008-09-02-FunctionNotes2.ll @@ -1,5 +1,5 @@ ; Test function notes -; RUN: not llvm-as %s -o /dev/null -f |& grep "Attributes noinline alwaysinline are incompatible" +; RUN: not llvm-as %s -o /dev/null |& grep "Attributes noinline alwaysinline are incompatible" define void @fn1() alwaysinline noinline { ret void } diff --git a/libclamav/c++/llvm/test/Assembler/2009-07-24-ZeroArgGEP.ll b/libclamav/c++/llvm/test/Assembler/2009-07-24-ZeroArgGEP.ll index ce4a96148..2a3d11477 100644 --- a/libclamav/c++/llvm/test/Assembler/2009-07-24-ZeroArgGEP.ll +++ b/libclamav/c++/llvm/test/Assembler/2009-07-24-ZeroArgGEP.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as %s -o /dev/null -f +; RUN: llvm-as %s -o /dev/null @foo = global i32 0 @bar = constant i32* getelementptr(i32* @foo) diff --git a/libclamav/c++/llvm/test/Assembler/select.ll b/libclamav/c++/llvm/test/Assembler/select.ll index b018fbe9c..2d3f412d2 100644 --- a/libclamav/c++/llvm/test/Assembler/select.ll +++ b/libclamav/c++/llvm/test/Assembler/select.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as %s -o /dev/null -f +; RUN: llvm-as %s -o /dev/null define i32 @test(i1 %C, i32 %V1, i32 %V2) { diff --git a/libclamav/c++/llvm/test/Bitcode/memcpy.ll b/libclamav/c++/llvm/test/Bitcode/memcpy.ll index fb509b8e8..85b95fe57 100644 --- a/libclamav/c++/llvm/test/Bitcode/memcpy.ll +++ b/libclamav/c++/llvm/test/Bitcode/memcpy.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as %s -o /dev/null -f +; RUN: llvm-as %s -o /dev/null define void @test(i32* %P, i32* %Q) { entry: diff --git a/libclamav/c++/llvm/test/Bitcode/metadata-2.ll b/libclamav/c++/llvm/test/Bitcode/metadata-2.ll index cb2962bba..1a59ce6f9 100644 --- a/libclamav/c++/llvm/test/Bitcode/metadata-2.ll +++ b/libclamav/c++/llvm/test/Bitcode/metadata-2.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llvm-dis -f -o /dev/null +; RUN: llvm-as < %s | llvm-dis -o /dev/null type { %object.ModuleInfo.__vtbl*, i8*, %"byte[]", %1, %"ClassInfo[]", i32, void ()*, void ()*, void ()*, i8*, void ()* } ; type %0 type { i64, %object.ModuleInfo* } ; type %1 type { i32, void ()* } ; type %2 diff --git a/libclamav/c++/llvm/test/Bitcode/metadata.ll b/libclamav/c++/llvm/test/Bitcode/metadata.ll index 593cefa30..19db3eac2 100644 --- a/libclamav/c++/llvm/test/Bitcode/metadata.ll +++ b/libclamav/c++/llvm/test/Bitcode/metadata.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llvm-dis -f -o /dev/null +; RUN: llvm-as < %s | llvm-dis -o /dev/null !llvm.foo = !{!0} !0 = metadata !{i32 42} diff --git a/libclamav/c++/llvm/test/CodeGen/ARM/2009-08-21-PostRAKill.ll b/libclamav/c++/llvm/test/CodeGen/ARM/2009-08-21-PostRAKill.ll new file mode 100644 index 000000000..08038b0e8 --- /dev/null +++ b/libclamav/c++/llvm/test/CodeGen/ARM/2009-08-21-PostRAKill.ll @@ -0,0 +1,40 @@ +; RUN: llvm-as < %s | llc -march=arm -mattr=+vfp2 -mcpu=cortex-a8 -disable-post-RA-scheduler=0 -avoid-hazards + +; ModuleID = '' +target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:32-f32:32:32-f64:32:32-v64:64:64-v128:128:128-a0:0:64" +target triple = "armv7-apple-darwin9" + +%struct.tree = type { i32, double, double, %struct.tree*, %struct.tree*, %struct.tree*, %struct.tree* } +@g = common global %struct.tree* null + +define arm_apcscc %struct.tree* @tsp(%struct.tree* %t, i32 %nproc) nounwind { +entry: + %t.idx51.val.i = load double* null ; [#uses=1] + br i1 undef, label %bb4.i, label %bb.i + +bb.i: ; preds = %entry + unreachable + +bb4.i: ; preds = %entry + %0 = load %struct.tree** @g, align 4 ; <%struct.tree*> [#uses=2] + %.idx45.i = getelementptr %struct.tree* %0, i32 0, i32 1 ; [#uses=1] + %.idx45.val.i = load double* %.idx45.i ; [#uses=1] + %.idx46.i = getelementptr %struct.tree* %0, i32 0, i32 2 ; [#uses=1] + %.idx46.val.i = load double* %.idx46.i ; [#uses=1] + %1 = fsub double 0.000000e+00, %.idx45.val.i ; [#uses=2] + %2 = fmul double %1, %1 ; [#uses=1] + %3 = fsub double %t.idx51.val.i, %.idx46.val.i ; [#uses=2] + %4 = fmul double %3, %3 ; [#uses=1] + %5 = fadd double %2, %4 ; [#uses=1] + %6 = tail call double @llvm.sqrt.f64(double %5) nounwind ; [#uses=1] + br i1 undef, label %bb7.i4, label %bb6.i + +bb6.i: ; preds = %bb4.i + br label %bb7.i4 + +bb7.i4: ; preds = %bb6.i, %bb4.i + %tton1.0.i = phi double [ %6, %bb6.i ], [ undef, %bb4.i ] ; [#uses=0] + unreachable +} + +declare double @llvm.sqrt.f64(double) nounwind readonly diff --git a/libclamav/c++/llvm/test/CodeGen/ARM/2009-08-21-PostRAKill2.ll b/libclamav/c++/llvm/test/CodeGen/ARM/2009-08-21-PostRAKill2.ll new file mode 100644 index 000000000..e32bca98f --- /dev/null +++ b/libclamav/c++/llvm/test/CodeGen/ARM/2009-08-21-PostRAKill2.ll @@ -0,0 +1,38 @@ +; RUN: llvm-as < %s | llc -asm-verbose=false -O3 -relocation-model=pic -disable-fp-elim -mtriple=thumbv7-apple-darwin -mcpu=cortex-a8 -disable-post-RA-scheduler=0 -avoid-hazards + +; ModuleID = '' +target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:32-f32:32:32-f64:32:32-v64:64:64-v128:128:128-a0:0:64" +target triple = "armv7-apple-darwin9" + +%struct.anon = type { [3 x double], double, %struct.node*, [64 x %struct.bnode*], [64 x %struct.bnode*] } +%struct.bnode = type { i16, double, [3 x double], i32, i32, [3 x double], [3 x double], [3 x double], double, %struct.bnode*, %struct.bnode* } +%struct.icstruct = type { [3 x i32], i16 } +%struct.node = type { i16, double, [3 x double], i32, i32 } + +declare arm_apcscc double @floor(double) nounwind readnone + +define void @intcoord(%struct.icstruct* noalias nocapture sret %agg.result, i1 %a, double %b) { +entry: + br i1 %a, label %bb3, label %bb1 + +bb1: ; preds = %entry + unreachable + +bb3: ; preds = %entry + br i1 %a, label %bb7, label %bb5 + +bb5: ; preds = %bb3 + unreachable + +bb7: ; preds = %bb3 + br i1 %a, label %bb11, label %bb9 + +bb9: ; preds = %bb7 + %0 = tail call arm_apcscc double @floor(double %b) nounwind readnone ; [#uses=0] + br label %bb11 + +bb11: ; preds = %bb9, %bb7 + %1 = getelementptr %struct.icstruct* %agg.result, i32 0, i32 0, i32 0 ; [#uses=1] + store i32 0, i32* %1 + ret void +} diff --git a/libclamav/c++/llvm/test/CodeGen/ARM/2009-08-21-PostRAKill3.ll b/libclamav/c++/llvm/test/CodeGen/ARM/2009-08-21-PostRAKill3.ll new file mode 100644 index 000000000..ddc16dec0 --- /dev/null +++ b/libclamav/c++/llvm/test/CodeGen/ARM/2009-08-21-PostRAKill3.ll @@ -0,0 +1,31 @@ +; RUN: llvm-as < %s | llc -asm-verbose=false -O3 -relocation-model=pic -disable-fp-elim -mtriple=thumbv7-apple-darwin -mcpu=cortex-a8 -disable-post-RA-scheduler=0 -avoid-hazards + +; ModuleID = '' +target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:32-f32:32:32-f64:32:32-v64:64:64-v128:128:128-a0:0:64" +target triple = "armv7-apple-darwin9" + +%struct.Hosp = type { i32, i32, i32, %struct.List, %struct.List, %struct.List, %struct.List } +%struct.List = type { %struct.List*, %struct.Patient*, %struct.List* } +%struct.Patient = type { i32, i32, i32, %struct.Village* } +%struct.Village = type { [4 x %struct.Village*], %struct.Village*, %struct.List, %struct.Hosp, i32, i32 } + +define arm_apcscc %struct.Village* @alloc_tree(i32 %level, i32 %label, %struct.Village* %back, i1 %p) nounwind { +entry: + br i1 %p, label %bb8, label %bb1 + +bb1: ; preds = %entry + %0 = malloc %struct.Village ; <%struct.Village*> [#uses=3] + %exp2 = call double @ldexp(double 1.000000e+00, i32 %level) nounwind ; [#uses=1] + %.c = fptosi double %exp2 to i32 ; [#uses=1] + store i32 %.c, i32* null + %1 = getelementptr %struct.Village* %0, i32 0, i32 3, i32 6, i32 0 ; <%struct.List**> [#uses=1] + store %struct.List* null, %struct.List** %1 + %2 = getelementptr %struct.Village* %0, i32 0, i32 3, i32 6, i32 2 ; <%struct.List**> [#uses=1] + store %struct.List* null, %struct.List** %2 + ret %struct.Village* %0 + +bb8: ; preds = %entry + ret %struct.Village* null +} + +declare double @ldexp(double, i32) diff --git a/libclamav/c++/llvm/test/CodeGen/ARM/2009-08-23-linkerprivate.ll b/libclamav/c++/llvm/test/CodeGen/ARM/2009-08-23-linkerprivate.ll new file mode 100644 index 000000000..93fb151ca --- /dev/null +++ b/libclamav/c++/llvm/test/CodeGen/ARM/2009-08-23-linkerprivate.ll @@ -0,0 +1,8 @@ +; RUN: llvm-as < %s | llc -march=arm -mtriple=arm-apple-darwin | FileCheck %s + +; ModuleID = '/Volumes/MacOS9/tests/WebKit/JavaScriptCore/profiler/ProfilerServer.mm' + +@"\01l_objc_msgSend_fixup_alloc" = linker_private hidden global i32 0, section "__DATA, __objc_msgrefs, coalesced", align 16 ; [#uses=0] + +; CHECK: .globl l_objc_msgSend_fixup_alloc +; CHECK: .weak_definition l_objc_msgSend_fixup_alloc diff --git a/libclamav/c++/llvm/test/CodeGen/ARM/2009-08-26-ScalarToVector.ll b/libclamav/c++/llvm/test/CodeGen/ARM/2009-08-26-ScalarToVector.ll new file mode 100644 index 000000000..5d1157028 --- /dev/null +++ b/libclamav/c++/llvm/test/CodeGen/ARM/2009-08-26-ScalarToVector.ll @@ -0,0 +1,27 @@ +; RUN: llvm-as < %s | llc -mattr=+neon | not grep fldmfdd +target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:32-f32:32:32-f64:32:32-v64:64:64-v128:128:128-a0:0:32" +target triple = "thumbv7-elf" + +%bar = type { float, float, float } +%baz = type { i32, [16 x %bar], [16 x float], [16 x i32], i8 } +%foo = type { <4 x float> } +%quux = type { i32 (...)**, %baz*, i32 } +%quuz = type { %quux, i32, %bar, [128 x i8], [16 x %foo], %foo, %foo, %foo } + +declare <2 x i32> @llvm.arm.neon.vpadd.v2i32(<2 x i32>, <2 x i32>) nounwind readnone + +define arm_apcscc void @_ZN6squish10ClusterFit9Compress3EPv(%quuz* %this, i8* %block) { +entry: + %0 = lshr <4 x i32> zeroinitializer, ; <<4 x i32>> [#uses=1] + %1 = shufflevector <4 x i32> %0, <4 x i32> undef, <2 x i32> ; <<2 x i32>> [#uses=1] + %2 = call <2 x i32> @llvm.arm.neon.vpadd.v2i32(<2 x i32> undef, <2 x i32> %1) nounwind ; <<2 x i32>> [#uses=1] + %3 = extractelement <2 x i32> %2, i32 0 ; [#uses=1] + %not..i = icmp eq i32 %3, undef ; [#uses=1] + br i1 %not..i, label %return, label %bb221 + +bb221: ; preds = %bb221, %entry + br label %bb221 + +return: ; preds = %entry + ret void +} diff --git a/libclamav/c++/llvm/test/CodeGen/ARM/2009-08-27-ScalarToVector.ll b/libclamav/c++/llvm/test/CodeGen/ARM/2009-08-27-ScalarToVector.ll new file mode 100644 index 000000000..fbe0a2372 --- /dev/null +++ b/libclamav/c++/llvm/test/CodeGen/ARM/2009-08-27-ScalarToVector.ll @@ -0,0 +1,35 @@ +; RUN: llvm-as < %s | llc -mattr=+neon | not grep fldmfdd +target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:32-f32:32:32-f64:32:32-v64:64:64-v128:128:128-a0:0:32" +target triple = "thumbv7-elf" + +%bar = type { float, float, float } +%baz = type { i32, [16 x %bar], [16 x float], [16 x i32], i8 } +%foo = type { <4 x float> } +%quux = type { i32 (...)**, %baz*, i32 } +%quuz = type { %quux, i32, %bar, [128 x i8], [16 x %foo], %foo, %foo, %foo } + +define arm_apcscc void @aaaa(%quuz* %this, i8* %block) { +entry: + br i1 undef, label %bb.nph269, label %bb201 + +bb.nph269: ; preds = %entry + br label %bb12 + +bb12: ; preds = %bb194, %bb.nph269 + %0 = fmul <4 x float> undef, undef ; <<4 x float>> [#uses=1] + %1 = shufflevector <4 x float> %0, <4 x float> undef, <2 x i32> ; <<2 x float>> [#uses=1] + %2 = shufflevector <2 x float> %1, <2 x float> undef, <4 x i32> zeroinitializer ; <<4 x float>> [#uses=1] + %3 = fadd <4 x float> undef, %2 ; <<4 x float>> [#uses=1] + br i1 undef, label %bb194, label %bb186 + +bb186: ; preds = %bb12 + br label %bb194 + +bb194: ; preds = %bb186, %bb12 + %besterror.0.0 = phi <4 x float> [ %3, %bb186 ], [ undef, %bb12 ] ; <<4 x float>> [#uses=0] + %indvar.next294 = add i32 undef, 1 ; [#uses=0] + br label %bb12 + +bb201: ; preds = %entry + ret void +} diff --git a/libclamav/c++/llvm/test/CodeGen/ARM/2009-08-29-ExtractEltf32.ll b/libclamav/c++/llvm/test/CodeGen/ARM/2009-08-29-ExtractEltf32.ll new file mode 100644 index 000000000..4a044a550 --- /dev/null +++ b/libclamav/c++/llvm/test/CodeGen/ARM/2009-08-29-ExtractEltf32.ll @@ -0,0 +1,25 @@ +; RUN: llvm-as < %s | llc -mattr=+neon +target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:32-f32:32:32-f64:32:32-v64:64:64-v128:128:128-a0:0:32" +target triple = "thumbv7-elf" + +define arm_apcscc void @foo() nounwind { +entry: + %0 = tail call <2 x float> @llvm.arm.neon.vpadd.v2f32(<2 x float> undef, <2 x float> undef) nounwind ; <<2 x float>> [#uses=1] + %tmp28 = extractelement <2 x float> %0, i32 0 ; [#uses=1] + %1 = fcmp une float %tmp28, 4.900000e+01 ; [#uses=1] + br i1 %1, label %bb, label %bb7 + +bb: ; preds = %entry + unreachable + +bb7: ; preds = %entry + br i1 undef, label %bb8, label %bb9 + +bb8: ; preds = %bb7 + unreachable + +bb9: ; preds = %bb7 + ret void +} + +declare <2 x float> @llvm.arm.neon.vpadd.v2f32(<2 x float>, <2 x float>) nounwind readnone diff --git a/libclamav/c++/llvm/test/CodeGen/ARM/2009-08-29-TooLongSplat.ll b/libclamav/c++/llvm/test/CodeGen/ARM/2009-08-29-TooLongSplat.ll new file mode 100644 index 000000000..3b1413bee --- /dev/null +++ b/libclamav/c++/llvm/test/CodeGen/ARM/2009-08-29-TooLongSplat.ll @@ -0,0 +1,23 @@ +; RUN: llvm-as < %s | llc -mattr=+neon +target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:32-f32:32:32-f64:32:32-v64:64:64-v128:128:128-a0:0:32" +target triple = "thumbv7-elf" + +define arm_apcscc void @aaa() nounwind { +entry: + %0 = fmul <4 x float> undef, ; <<4 x float>> [#uses=1] + %tmp31 = extractelement <4 x float> %0, i32 0 ; [#uses=1] + %1 = fpext float %tmp31 to double ; [#uses=1] + %2 = fsub double 1.000000e+00, %1 ; [#uses=1] + %3 = fdiv double %2, 1.000000e+00 ; [#uses=1] + %4 = tail call double @fabs(double %3) nounwind readnone ; [#uses=1] + %5 = fcmp ogt double %4, 1.000000e-05 ; [#uses=1] + br i1 %5, label %bb, label %bb7 + +bb: ; preds = %entry + unreachable + +bb7: ; preds = %entry + unreachable +} + +declare double @fabs(double) diff --git a/libclamav/c++/llvm/test/CodeGen/ARM/aliases.ll b/libclamav/c++/llvm/test/CodeGen/ARM/aliases.ll index 70b2c4d41..ea39da833 100644 --- a/libclamav/c++/llvm/test/CodeGen/ARM/aliases.ll +++ b/libclamav/c++/llvm/test/CodeGen/ARM/aliases.ll @@ -1,5 +1,5 @@ ; RUN: llvm-as < %s | \ -; RUN: llc -mtriple=arm-linux-gnueabi -o %t -f +; RUN: llc -mtriple=arm-linux-gnueabi -o %t ; RUN: grep set %t | count 5 ; RUN: grep globl %t | count 4 ; RUN: grep weak %t | count 1 diff --git a/libclamav/c++/llvm/test/CodeGen/ARM/ldr_ext.ll b/libclamav/c++/llvm/test/CodeGen/ARM/ldr_ext.ll index b99c72197..dc76a1c18 100644 --- a/libclamav/c++/llvm/test/CodeGen/ARM/ldr_ext.ll +++ b/libclamav/c++/llvm/test/CodeGen/ARM/ldr_ext.ll @@ -1,27 +1,36 @@ -; RUN: llvm-as < %s | llc -march=arm | grep ldrb | count 1 -; RUN: llvm-as < %s | llc -march=arm | grep ldrh | count 1 -; RUN: llvm-as < %s | llc -march=arm | grep ldrsb | count 1 -; RUN: llvm-as < %s | llc -march=arm | grep ldrsh | count 1 +; RUN: llvm-as < %s | llc -march=arm | FileCheck %s -define i32 @test1(i8* %v.pntr.s0.u1) { - %tmp.u = load i8* %v.pntr.s0.u1 +define i32 @test1(i8* %t1) nounwind { +; CHECK: ldrb + %tmp.u = load i8* %t1 %tmp1.s = zext i8 %tmp.u to i32 ret i32 %tmp1.s } -define i32 @test2(i16* %v.pntr.s0.u1) { - %tmp.u = load i16* %v.pntr.s0.u1 +define i32 @test2(i16* %t1) nounwind { +; CHECK: ldrh + %tmp.u = load i16* %t1 %tmp1.s = zext i16 %tmp.u to i32 ret i32 %tmp1.s } -define i32 @test3(i8* %v.pntr.s1.u0) { - %tmp.s = load i8* %v.pntr.s1.u0 +define i32 @test3(i8* %t0) nounwind { +; CHECK: ldrsb + %tmp.s = load i8* %t0 %tmp1.s = sext i8 %tmp.s to i32 ret i32 %tmp1.s } -define i32 @test4() { +define i32 @test4(i16* %t0) nounwind { +; CHECK: ldrsh + %tmp.s = load i16* %t0 + %tmp1.s = sext i16 %tmp.s to i32 + ret i32 %tmp1.s +} + +define i32 @test5() nounwind { +; CHECK: mov r0, #0 +; CHECK: ldrsh %tmp.s = load i16* null %tmp1.s = sext i16 %tmp.s to i32 ret i32 %tmp1.s diff --git a/libclamav/c++/llvm/test/CodeGen/ARM/spill-q.ll b/libclamav/c++/llvm/test/CodeGen/ARM/spill-q.ll new file mode 100644 index 000000000..8775e050b --- /dev/null +++ b/libclamav/c++/llvm/test/CodeGen/ARM/spill-q.ll @@ -0,0 +1,57 @@ +; RUN: llvm-as < %s | llc -mtriple=armv7-elf -mattr=+neon | FileCheck %s +; PR4789 + +%bar = type { float, float, float } +%baz = type { i32, [16 x %bar], [16 x float], [16 x i32], i8 } +%foo = type { <4 x float> } +%quux = type { i32 (...)**, %baz*, i32 } +%quuz = type { %quux, i32, %bar, [128 x i8], [16 x %foo], %foo, %foo, %foo } + +declare <4 x float> @llvm.arm.neon.vld1.v4f32(i8*) nounwind readonly + +define arm_apcscc void @aaa(%quuz* %this, i8* %block) { +; CHECK: aaa: +; CHECK: vstmia sp +; CHECK: vldmia sp +entry: + %0 = call <4 x float> @llvm.arm.neon.vld1.v4f32(i8* undef) nounwind ; <<4 x float>> [#uses=1] + store float 6.300000e+01, float* undef, align 4 + %1 = call <4 x float> @llvm.arm.neon.vld1.v4f32(i8* undef) nounwind ; <<4 x float>> [#uses=1] + store float 0.000000e+00, float* undef, align 4 + %2 = call <4 x float> @llvm.arm.neon.vld1.v4f32(i8* undef) nounwind ; <<4 x float>> [#uses=1] + %val173 = load <4 x float>* undef ; <<4 x float>> [#uses=1] + br label %bb4 + +bb4: ; preds = %bb193, %entry + %besterror.0.2264 = phi <4 x float> [ undef, %entry ], [ %besterror.0.0, %bb193 ] ; <<4 x float>> [#uses=2] + %part0.0.0261 = phi <4 x float> [ zeroinitializer, %entry ], [ %23, %bb193 ] ; <<4 x float>> [#uses=2] + %3 = fmul <4 x float> zeroinitializer, %0 ; <<4 x float>> [#uses=2] + %4 = fadd <4 x float> %3, %part0.0.0261 ; <<4 x float>> [#uses=1] + %5 = shufflevector <4 x float> %3, <4 x float> undef, <2 x i32> ; <<2 x float>> [#uses=1] + %6 = shufflevector <2 x float> %5, <2 x float> undef, <4 x i32> ; <<4 x float>> [#uses=1] + %7 = fmul <4 x float> %1, undef ; <<4 x float>> [#uses=1] + %8 = fadd <4 x float> %7, ; <<4 x float>> [#uses=1] + %9 = fptosi <4 x float> %8 to <4 x i32> ; <<4 x i32>> [#uses=1] + %10 = sitofp <4 x i32> %9 to <4 x float> ; <<4 x float>> [#uses=1] + %11 = fmul <4 x float> %10, %2 ; <<4 x float>> [#uses=1] + %12 = fmul <4 x float> undef, %6 ; <<4 x float>> [#uses=1] + %13 = fmul <4 x float> %11, %4 ; <<4 x float>> [#uses=1] + %14 = fsub <4 x float> %12, %13 ; <<4 x float>> [#uses=1] + %15 = fsub <4 x float> %14, undef ; <<4 x float>> [#uses=1] + %16 = fmul <4 x float> %15, ; <<4 x float>> [#uses=1] + %17 = fadd <4 x float> %16, undef ; <<4 x float>> [#uses=1] + %18 = fmul <4 x float> %17, %val173 ; <<4 x float>> [#uses=1] + %19 = shufflevector <4 x float> %18, <4 x float> undef, <2 x i32> ; <<2 x float>> [#uses=1] + %20 = shufflevector <2 x float> %19, <2 x float> undef, <4 x i32> zeroinitializer ; <<4 x float>> [#uses=1] + %21 = fadd <4 x float> zeroinitializer, %20 ; <<4 x float>> [#uses=2] + %22 = fcmp ogt <4 x float> %besterror.0.2264, %21 ; <<4 x i1>> [#uses=0] + br i1 undef, label %bb193, label %bb186 + +bb186: ; preds = %bb4 + br label %bb193 + +bb193: ; preds = %bb186, %bb4 + %besterror.0.0 = phi <4 x float> [ %21, %bb186 ], [ %besterror.0.2264, %bb4 ] ; <<4 x float>> [#uses=1] + %23 = fadd <4 x float> %part0.0.0261, zeroinitializer ; <<4 x float>> [#uses=1] + br label %bb4 +} diff --git a/libclamav/c++/llvm/test/CodeGen/ARM/stubs.ll b/libclamav/c++/llvm/test/CodeGen/ARM/stubs.ll deleted file mode 100644 index baf6b7e63..000000000 --- a/libclamav/c++/llvm/test/CodeGen/ARM/stubs.ll +++ /dev/null @@ -1,67 +0,0 @@ -; RUN: llvm-as < %s | llc -relocation-model=static | FileCheck %s -check-prefix=STATIC -; RUN: llvm-as < %s | llc -relocation-model=pic | FileCheck %s -check-prefix=PIC -; RUN: llvm-as < %s | llc -relocation-model=dynamic-no-pic | FileCheck %s -check-prefix=DYNAMIC -; PR4482 -target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" -target triple = "armv6-apple-darwin2" - -define i32 @foo(i64 %x) nounwind { -entry: -; STATIC: _foo: -; STATIC: bl _exact_log2 -; STATIC: ldmfd sp!, {r7, pc} -; STATIC: .subsections_via_symbols - -; PIC: _foo: -; PIC: bl L_exact_log2$stub -; PIC: ldmfd sp!, {r7, pc} - -; DYNAMIC: _foo: -; DYNAMIC: bl L_exact_log2$stub -; DYNAMIC: ldmfd sp!, {r7, pc} - - %A = call i32 @exact_log2(i64 %x) - ret i32 %A -} - -define available_externally i32 @exact_log2(i64 %x) nounwind { - ret i32 4 -} - - -; PIC: .section __TEXT,__picsymbolstub4,symbol_stubs,none,16 -; PIC: L_exact_log2$stub: -; PIC: .indirect_symbol _exact_log2 -; PIC: ldr ip, L_exact_log2$slp -; PIC: L_exact_log2$scv: -; PIC: add ip, pc, ip -; PIC: ldr pc, [ip, #0] -; PIC: L_exact_log2$slp: -; PIC: .long L_exact_log2$lazy_ptr-(L_exact_log2$scv+8) - -; PIC: .section __DATA,__la_symbol_ptr,lazy_symbol_pointers -; PIC: L_exact_log2$lazy_ptr: -; PIC: .indirect_symbol _exact_log2 -; PIC: .long dyld_stub_binding_helper - -; PIC: .subsections_via_symbols - - -; DYNAMIC: .section __TEXT,__symbol_stub4,symbol_stubs,none,12 -; DYNAMIC: L_exact_log2$stub: -; DYNAMIC: .indirect_symbol _exact_log2 -; DYNAMIC: ldr ip, L_exact_log2$slp -; DYNAMIC: ldr pc, [ip, #0] -; DYNAMIC: L_exact_log2$slp: -; DYNAMIC: .long L_exact_log2$lazy_ptr - -; DYNAMIC: .section __DATA,__la_symbol_ptr,lazy_symbol_pointers -; DYNAMIC: L_exact_log2$lazy_ptr: -; DYNAMIC: .indirect_symbol _exact_log2 -; DYNAMIC: .long dyld_stub_binding_helper -; DYNAMIC: .subsections_via_symbols - - - - - diff --git a/libclamav/c++/llvm/test/CodeGen/ARM/vcls.ll b/libclamav/c++/llvm/test/CodeGen/ARM/vcls.ll index 69e4bdbe1..25b94db72 100644 --- a/libclamav/c++/llvm/test/CodeGen/ARM/vcls.ll +++ b/libclamav/c++/llvm/test/CodeGen/ARM/vcls.ll @@ -1,39 +1,48 @@ -; RUN: llvm-as < %s | llc -march=arm -mattr=+neon > %t -; RUN: grep {vcls\\.s8} %t | count 2 -; RUN: grep {vcls\\.s16} %t | count 2 -; RUN: grep {vcls\\.s32} %t | count 2 +; RUN: llvm-as < %s | llc -march=arm -mattr=+neon | FileCheck %s define <8 x i8> @vclss8(<8 x i8>* %A) nounwind { +;CHECK: vclss8: +;CHECK: vcls.s8 %tmp1 = load <8 x i8>* %A %tmp2 = call <8 x i8> @llvm.arm.neon.vcls.v8i8(<8 x i8> %tmp1) ret <8 x i8> %tmp2 } define <4 x i16> @vclss16(<4 x i16>* %A) nounwind { +;CHECK: vclss16: +;CHECK: vcls.s16 %tmp1 = load <4 x i16>* %A %tmp2 = call <4 x i16> @llvm.arm.neon.vcls.v4i16(<4 x i16> %tmp1) ret <4 x i16> %tmp2 } define <2 x i32> @vclss32(<2 x i32>* %A) nounwind { +;CHECK: vclss32: +;CHECK: vcls.s32 %tmp1 = load <2 x i32>* %A %tmp2 = call <2 x i32> @llvm.arm.neon.vcls.v2i32(<2 x i32> %tmp1) ret <2 x i32> %tmp2 } define <16 x i8> @vclsQs8(<16 x i8>* %A) nounwind { +;CHECK: vclsQs8: +;CHECK: vcls.s8 %tmp1 = load <16 x i8>* %A %tmp2 = call <16 x i8> @llvm.arm.neon.vcls.v16i8(<16 x i8> %tmp1) ret <16 x i8> %tmp2 } define <8 x i16> @vclsQs16(<8 x i16>* %A) nounwind { +;CHECK: vclsQs16: +;CHECK: vcls.s16 %tmp1 = load <8 x i16>* %A %tmp2 = call <8 x i16> @llvm.arm.neon.vcls.v8i16(<8 x i16> %tmp1) ret <8 x i16> %tmp2 } define <4 x i32> @vclsQs32(<4 x i32>* %A) nounwind { +;CHECK: vclsQs32: +;CHECK: vcls.s32 %tmp1 = load <4 x i32>* %A %tmp2 = call <4 x i32> @llvm.arm.neon.vcls.v4i32(<4 x i32> %tmp1) ret <4 x i32> %tmp2 diff --git a/libclamav/c++/llvm/test/CodeGen/ARM/vclz.ll b/libclamav/c++/llvm/test/CodeGen/ARM/vclz.ll index 575ea7d2e..cd9daa5d8 100644 --- a/libclamav/c++/llvm/test/CodeGen/ARM/vclz.ll +++ b/libclamav/c++/llvm/test/CodeGen/ARM/vclz.ll @@ -1,39 +1,48 @@ -; RUN: llvm-as < %s | llc -march=arm -mattr=+neon > %t -; RUN: grep {vclz\\.i8} %t | count 2 -; RUN: grep {vclz\\.i16} %t | count 2 -; RUN: grep {vclz\\.i32} %t | count 2 +; RUN: llvm-as < %s | llc -march=arm -mattr=+neon | FileCheck %s define <8 x i8> @vclz8(<8 x i8>* %A) nounwind { +;CHECK: vclz8: +;CHECK: vclz.i8 %tmp1 = load <8 x i8>* %A %tmp2 = call <8 x i8> @llvm.arm.neon.vclz.v8i8(<8 x i8> %tmp1) ret <8 x i8> %tmp2 } define <4 x i16> @vclz16(<4 x i16>* %A) nounwind { +;CHECK: vclz16: +;CHECK: vclz.i16 %tmp1 = load <4 x i16>* %A %tmp2 = call <4 x i16> @llvm.arm.neon.vclz.v4i16(<4 x i16> %tmp1) ret <4 x i16> %tmp2 } define <2 x i32> @vclz32(<2 x i32>* %A) nounwind { +;CHECK: vclz32: +;CHECK: vclz.i32 %tmp1 = load <2 x i32>* %A %tmp2 = call <2 x i32> @llvm.arm.neon.vclz.v2i32(<2 x i32> %tmp1) ret <2 x i32> %tmp2 } define <16 x i8> @vclzQ8(<16 x i8>* %A) nounwind { +;CHECK: vclzQ8: +;CHECK: vclz.i8 %tmp1 = load <16 x i8>* %A %tmp2 = call <16 x i8> @llvm.arm.neon.vclz.v16i8(<16 x i8> %tmp1) ret <16 x i8> %tmp2 } define <8 x i16> @vclzQ16(<8 x i16>* %A) nounwind { +;CHECK: vclzQ16: +;CHECK: vclz.i16 %tmp1 = load <8 x i16>* %A %tmp2 = call <8 x i16> @llvm.arm.neon.vclz.v8i16(<8 x i16> %tmp1) ret <8 x i16> %tmp2 } define <4 x i32> @vclzQ32(<4 x i32>* %A) nounwind { +;CHECK: vclzQ32: +;CHECK: vclz.i32 %tmp1 = load <4 x i32>* %A %tmp2 = call <4 x i32> @llvm.arm.neon.vclz.v4i32(<4 x i32> %tmp1) ret <4 x i32> %tmp2 diff --git a/libclamav/c++/llvm/test/CodeGen/ARM/vcnt.ll b/libclamav/c++/llvm/test/CodeGen/ARM/vcnt.ll index 981716895..bf98eefa9 100644 --- a/libclamav/c++/llvm/test/CodeGen/ARM/vcnt.ll +++ b/libclamav/c++/llvm/test/CodeGen/ARM/vcnt.ll @@ -1,13 +1,16 @@ -; RUN: llvm-as < %s | llc -march=arm -mattr=+neon > %t -; RUN: grep {vcnt\\.8} %t | count 2 +; RUN: llvm-as < %s | llc -march=arm -mattr=+neon | FileCheck %s define <8 x i8> @vcnt8(<8 x i8>* %A) nounwind { +;CHECK: vcnt8: +;CHECK: vcnt.8 %tmp1 = load <8 x i8>* %A %tmp2 = call <8 x i8> @llvm.arm.neon.vcnt.v8i8(<8 x i8> %tmp1) ret <8 x i8> %tmp2 } define <16 x i8> @vcntQ8(<16 x i8>* %A) nounwind { +;CHECK: vcntQ8: +;CHECK: vcnt.8 %tmp1 = load <16 x i8>* %A %tmp2 = call <16 x i8> @llvm.arm.neon.vcnt.v16i8(<16 x i8> %tmp1) ret <16 x i8> %tmp2 diff --git a/libclamav/c++/llvm/test/CodeGen/ARM/vcvt.ll b/libclamav/c++/llvm/test/CodeGen/ARM/vcvt.ll index 1cb42bf15..b89b82b12 100644 --- a/libclamav/c++/llvm/test/CodeGen/ARM/vcvt.ll +++ b/libclamav/c++/llvm/test/CodeGen/ARM/vcvt.ll @@ -1,52 +1,64 @@ -; RUN: llvm-as < %s | llc -march=arm -mattr=+neon > %t -; RUN: grep {vcvt\\.s32\\.f32} %t | count 2 -; RUN: grep {vcvt\\.u32\\.f32} %t | count 2 -; RUN: grep {vcvt\\.f32\\.s32} %t | count 2 -; RUN: grep {vcvt\\.f32\\.u32} %t | count 2 +; RUN: llvm-as < %s | llc -march=arm -mattr=+neon | FileCheck %s define <2 x i32> @vcvt_f32tos32(<2 x float>* %A) nounwind { +;CHECK: vcvt_f32tos32: +;CHECK: vcvt.s32.f32 %tmp1 = load <2 x float>* %A %tmp2 = fptosi <2 x float> %tmp1 to <2 x i32> ret <2 x i32> %tmp2 } define <2 x i32> @vcvt_f32tou32(<2 x float>* %A) nounwind { +;CHECK: vcvt_f32tou32: +;CHECK: vcvt.u32.f32 %tmp1 = load <2 x float>* %A %tmp2 = fptoui <2 x float> %tmp1 to <2 x i32> ret <2 x i32> %tmp2 } define <2 x float> @vcvt_s32tof32(<2 x i32>* %A) nounwind { +;CHECK: vcvt_s32tof32: +;CHECK: vcvt.f32.s32 %tmp1 = load <2 x i32>* %A %tmp2 = sitofp <2 x i32> %tmp1 to <2 x float> ret <2 x float> %tmp2 } define <2 x float> @vcvt_u32tof32(<2 x i32>* %A) nounwind { +;CHECK: vcvt_u32tof32: +;CHECK: vcvt.f32.u32 %tmp1 = load <2 x i32>* %A %tmp2 = uitofp <2 x i32> %tmp1 to <2 x float> ret <2 x float> %tmp2 } define <4 x i32> @vcvtQ_f32tos32(<4 x float>* %A) nounwind { +;CHECK: vcvtQ_f32tos32: +;CHECK: vcvt.s32.f32 %tmp1 = load <4 x float>* %A %tmp2 = fptosi <4 x float> %tmp1 to <4 x i32> ret <4 x i32> %tmp2 } define <4 x i32> @vcvtQ_f32tou32(<4 x float>* %A) nounwind { +;CHECK: vcvtQ_f32tou32: +;CHECK: vcvt.u32.f32 %tmp1 = load <4 x float>* %A %tmp2 = fptoui <4 x float> %tmp1 to <4 x i32> ret <4 x i32> %tmp2 } define <4 x float> @vcvtQ_s32tof32(<4 x i32>* %A) nounwind { +;CHECK: vcvtQ_s32tof32: +;CHECK: vcvt.f32.s32 %tmp1 = load <4 x i32>* %A %tmp2 = sitofp <4 x i32> %tmp1 to <4 x float> ret <4 x float> %tmp2 } define <4 x float> @vcvtQ_u32tof32(<4 x i32>* %A) nounwind { +;CHECK: vcvtQ_u32tof32: +;CHECK: vcvt.f32.u32 %tmp1 = load <4 x i32>* %A %tmp2 = uitofp <4 x i32> %tmp1 to <4 x float> ret <4 x float> %tmp2 diff --git a/libclamav/c++/llvm/test/CodeGen/ARM/vget_lane2.ll b/libclamav/c++/llvm/test/CodeGen/ARM/vget_lane2.ll new file mode 100644 index 000000000..e8aa82a96 --- /dev/null +++ b/libclamav/c++/llvm/test/CodeGen/ARM/vget_lane2.ll @@ -0,0 +1,63 @@ +; RUN: llvm-as < %s | llc -mattr=+neon | FileCheck %s +target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:32-f32:32:32-f64:32:32-v64:64:64-v128:128:128-a0:0:32" +target triple = "thumbv7-elf" + +define arm_aapcs_vfpcc void @test_vget_laneu16() nounwind { +entry: +; CHECK: vmov.u16 r0, d0[1] + %arg0_uint16x4_t = alloca <4 x i16> ; <<4 x i16>*> [#uses=1] + %out_uint16_t = alloca i16 ; [#uses=1] + %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] + %0 = load <4 x i16>* %arg0_uint16x4_t, align 8 ; <<4 x i16>> [#uses=1] + %1 = extractelement <4 x i16> %0, i32 1 ; [#uses=1] + store i16 %1, i16* %out_uint16_t, align 2 + br label %return + +return: ; preds = %entry + ret void +} + +define arm_aapcs_vfpcc void @test_vget_laneu8() nounwind { +entry: +; CHECK: vmov.u8 r0, d0[1] + %arg0_uint8x8_t = alloca <8 x i8> ; <<8 x i8>*> [#uses=1] + %out_uint8_t = alloca i8 ; [#uses=1] + %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] + %0 = load <8 x i8>* %arg0_uint8x8_t, align 8 ; <<8 x i8>> [#uses=1] + %1 = extractelement <8 x i8> %0, i32 1 ; [#uses=1] + store i8 %1, i8* %out_uint8_t, align 1 + br label %return + +return: ; preds = %entry + ret void +} + +define arm_aapcs_vfpcc void @test_vgetQ_laneu16() nounwind { +entry: +; CHECK: vmov.u16 r0, d0[1] + %arg0_uint16x8_t = alloca <8 x i16> ; <<8 x i16>*> [#uses=1] + %out_uint16_t = alloca i16 ; [#uses=1] + %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] + %0 = load <8 x i16>* %arg0_uint16x8_t, align 16 ; <<8 x i16>> [#uses=1] + %1 = extractelement <8 x i16> %0, i32 1 ; [#uses=1] + store i16 %1, i16* %out_uint16_t, align 2 + br label %return + +return: ; preds = %entry + ret void +} + +define arm_aapcs_vfpcc void @test_vgetQ_laneu8() nounwind { +entry: +; CHECK: vmov.u8 r0, d0[1] + %arg0_uint8x16_t = alloca <16 x i8> ; <<16 x i8>*> [#uses=1] + %out_uint8_t = alloca i8 ; [#uses=1] + %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] + %0 = load <16 x i8>* %arg0_uint8x16_t, align 16 ; <<16 x i8>> [#uses=1] + %1 = extractelement <16 x i8> %0, i32 1 ; [#uses=1] + store i8 %1, i8* %out_uint8_t, align 1 + br label %return + +return: ; preds = %entry + ret void +} diff --git a/libclamav/c++/llvm/test/CodeGen/ARM/vset_lane.ll b/libclamav/c++/llvm/test/CodeGen/ARM/vset_lane.ll index 279c628ae..f45f92a65 100644 --- a/libclamav/c++/llvm/test/CodeGen/ARM/vset_lane.ll +++ b/libclamav/c++/llvm/test/CodeGen/ARM/vset_lane.ll @@ -2,6 +2,7 @@ ; RUN: grep {vmov\\.8} %t | count 2 ; RUN: grep {vmov\\.16} %t | count 2 ; RUN: grep {vmov\\.32} %t | count 2 +; RUN: grep {fcpys} %t | count 2 define <8 x i8> @vset_lane8(<8 x i8>* %A, i8 %B) nounwind { %tmp1 = load <8 x i8>* %A @@ -38,3 +39,9 @@ define <4 x i32> @vsetQ_lane32(<4 x i32>* %A, i32 %B) nounwind { %tmp2 = insertelement <4 x i32> %tmp1, i32 %B, i32 1 ret <4 x i32> %tmp2 } + +define arm_aapcs_vfpcc <2 x float> @test_vset_lanef32(float %arg0_float32_t, <2 x float> %arg1_float32x2_t) nounwind { +entry: + %0 = insertelement <2 x float> %arg1_float32x2_t, float %arg0_float32_t, i32 1 ; <<2 x float>> [#uses=1] + ret <2 x float> %0 +} diff --git a/libclamav/c++/llvm/test/CodeGen/Alpha/add.ll b/libclamav/c++/llvm/test/CodeGen/Alpha/add.ll index 260584b79..ad25a3498 100644 --- a/libclamav/c++/llvm/test/CodeGen/Alpha/add.ll +++ b/libclamav/c++/llvm/test/CodeGen/Alpha/add.ll @@ -1,6 +1,6 @@ ;test all the shifted and signextending adds and subs with and without consts ; -; RUN: llvm-as < %s | llc -march=alpha -o %t.s -f +; RUN: llvm-as < %s | llc -march=alpha -o %t.s ; RUN: grep { addl} %t.s | count 2 ; RUN: grep { addq} %t.s | count 2 ; RUN: grep { subl} %t.s | count 2 diff --git a/libclamav/c++/llvm/test/CodeGen/CPP/2009-05-01-Long-Double.ll b/libclamav/c++/llvm/test/CodeGen/CPP/2009-05-01-Long-Double.ll index 9d132ec00..e2d2dd8c8 100644 --- a/libclamav/c++/llvm/test/CodeGen/CPP/2009-05-01-Long-Double.ll +++ b/libclamav/c++/llvm/test/CodeGen/CPP/2009-05-01-Long-Double.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=cpp -cppgen=program -f -o %t +; RUN: llvm-as < %s | llc -march=cpp -cppgen=program -o %t define x86_fp80 @some_func() nounwind { entry: diff --git a/libclamav/c++/llvm/test/CodeGen/CPP/2009-05-04-CondBr.ll b/libclamav/c++/llvm/test/CodeGen/CPP/2009-05-04-CondBr.ll index 6c3f98428..5af9aa7d7 100644 --- a/libclamav/c++/llvm/test/CodeGen/CPP/2009-05-04-CondBr.ll +++ b/libclamav/c++/llvm/test/CodeGen/CPP/2009-05-04-CondBr.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=cpp -cppgen=program -f -o %t +; RUN: llvm-as < %s | llc -march=cpp -cppgen=program -o %t ; RUN: grep "BranchInst::Create(label_if_then, label_if_end, int1_cmp, label_entry);" %t define i32 @some_func(i32 %a) nounwind { diff --git a/libclamav/c++/llvm/test/CodeGen/CellSPU/loads.ll b/libclamav/c++/llvm/test/CodeGen/CellSPU/loads.ll index 3b9746c80..4addbab87 100644 --- a/libclamav/c++/llvm/test/CodeGen/CellSPU/loads.ll +++ b/libclamav/c++/llvm/test/CodeGen/CellSPU/loads.ll @@ -1,6 +1,4 @@ -; RUN: llvm-as -o - %s | llc -march=cellspu > %t1.s -; RUN: grep {lqd.*0(\$3)} %t1.s | count 1 -; RUN: grep {lqd.*16(\$3)} %t1.s | count 1 +; RUN: llvm-as -o - %s | llc -march=cellspu | FileCheck %s ; ModuleID = 'loads.bc' target datalayout = "E-p:32:32:128-f64:64:128-f32:32:128-i64:32:128-i32:32:128-i16:16:128-i8:8:128-i1:8:128-a0:0:128-v128:128:128-s0:128:128" @@ -10,11 +8,13 @@ define <4 x float> @load_v4f32_1(<4 x float>* %a) nounwind readonly { entry: %tmp1 = load <4 x float>* %a ret <4 x float> %tmp1 +; CHECK: lqd $3, 0($3) } define <4 x float> @load_v4f32_2(<4 x float>* %a) nounwind readonly { entry: - %arrayidx = getelementptr <4 x float>* %a, i32 1 ; <<4 x float>*> [#uses=1] - %tmp1 = load <4 x float>* %arrayidx ; <<4 x float>> [#uses=1] + %arrayidx = getelementptr <4 x float>* %a, i32 1 + %tmp1 = load <4 x float>* %arrayidx ret <4 x float> %tmp1 +; CHECK: lqd $3, 16($3) } diff --git a/libclamav/c++/llvm/test/CodeGen/CellSPU/rotate_ops.ll b/libclamav/c++/llvm/test/CodeGen/CellSPU/rotate_ops.ll index e30817248..9a10264c8 100644 --- a/libclamav/c++/llvm/test/CodeGen/CellSPU/rotate_ops.ll +++ b/libclamav/c++/llvm/test/CodeGen/CellSPU/rotate_ops.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as -o - %s | llc -march=cellspu -f -o %t1.s +; RUN: llvm-as -o - %s | llc -march=cellspu -o %t1.s ; RUN: grep rot %t1.s | count 85 ; RUN: grep roth %t1.s | count 8 ; RUN: grep roti.*5 %t1.s | count 1 diff --git a/libclamav/c++/llvm/test/CodeGen/CellSPU/sext128.ll b/libclamav/c++/llvm/test/CodeGen/CellSPU/sext128.ll new file mode 100644 index 000000000..71962a942 --- /dev/null +++ b/libclamav/c++/llvm/test/CodeGen/CellSPU/sext128.ll @@ -0,0 +1,47 @@ +; RUN: llvm-as -o - %s | llc -march=cellspu | FileCheck %s + +; ModuleID = 'sext128.bc' +target datalayout = "E-p:32:32:128-i1:8:128-i8:8:128-i16:16:128-i32:32:128-i64:32:128-f32:32:128-f64:64:128-v64:128:128-v128:128:128-a0:0:128-s0:128:128" +target triple = "spu" + +define i128 @sext_i64_i128(i64 %a) { +entry: + %0 = sext i64 %a to i128 + ret i128 %0 +; CHECK: long 269488144 +; CHECK: long 269488144 +; CHECK: long 66051 +; CHECK: long 67438087 +; CHECK: rotmai +; CHECK: lqa +; CHECK: shufb +} + +define i128 @sext_i32_i128(i32 %a) { +entry: + %0 = sext i32 %a to i128 + ret i128 %0 +; CHECK: long 269488144 +; CHECK: long 269488144 +; CHECK: long 269488144 +; CHECK: long 66051 +; CHECK: rotmai +; CHECK: lqa +; CHECK: shufb +} + +define i128 @sext_i32_i128a(float %a) { +entry: + %0 = call i32 @myfunc(float %a) + %1 = sext i32 %0 to i128 + ret i128 %1 +; CHECK: long 269488144 +; CHECK: long 269488144 +; CHECK: long 269488144 +; CHECK: long 66051 +; CHECK: rotmai +; CHECK: lqa +; CHECK: shufb +} + +declare i32 @myfunc(float) diff --git a/libclamav/c++/llvm/test/CodeGen/Generic/Makefile b/libclamav/c++/llvm/test/CodeGen/Generic/Makefile index d228f69a8..26ebc316a 100644 --- a/libclamav/c++/llvm/test/CodeGen/Generic/Makefile +++ b/libclamav/c++/llvm/test/CodeGen/Generic/Makefile @@ -1,10 +1,10 @@ # Makefile for running ad-hoc custom LLVM tests # %.bc: %.ll - llvm-as -f $< + llvm-as $< %.llc.s: %.bc - llc -f $< -o $@ + llc $< -o $@ %.gcc.s: %.c gcc -O0 -S $< -o $@ diff --git a/libclamav/c++/llvm/test/CodeGen/Generic/nested-select.ll b/libclamav/c++/llvm/test/CodeGen/Generic/nested-select.ll index a723a4d74..6f45f0f4e 100644 --- a/libclamav/c++/llvm/test/CodeGen/Generic/nested-select.ll +++ b/libclamav/c++/llvm/test/CodeGen/Generic/nested-select.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -o /dev/null -f +; RUN: llvm-as < %s | llc -o /dev/null ; Test that select of a select works diff --git a/libclamav/c++/llvm/test/CodeGen/Generic/switch-lower-feature-2.ll b/libclamav/c++/llvm/test/CodeGen/Generic/switch-lower-feature-2.ll index 5e532a8db..d3833e77e 100644 --- a/libclamav/c++/llvm/test/CodeGen/Generic/switch-lower-feature-2.ll +++ b/libclamav/c++/llvm/test/CodeGen/Generic/switch-lower-feature-2.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=x86 -o %t -f +; RUN: llvm-as < %s | llc -march=x86 -o %t ; RUN: grep jb %t | count 1 ; RUN: grep \\\$6 %t | count 2 ; RUN: grep 1024 %t | count 1 diff --git a/libclamav/c++/llvm/test/CodeGen/MSP430/2009-08-25-DynamicStackAlloc.ll b/libclamav/c++/llvm/test/CodeGen/MSP430/2009-08-25-DynamicStackAlloc.ll new file mode 100644 index 000000000..0ec05f75e --- /dev/null +++ b/libclamav/c++/llvm/test/CodeGen/MSP430/2009-08-25-DynamicStackAlloc.ll @@ -0,0 +1,30 @@ +; RUN: llvm-as < %s | llc +; PR4769 +target datalayout = "e-p:16:8:8-i8:8:8-i16:8:8-i32:8:8" +target triple = "msp430-generic-generic" + +define i16 @foo() nounwind readnone { +entry: + %result = alloca i16, align 1 ; [#uses=2] + volatile store i16 0, i16* %result + %tmp = volatile load i16* %result ; [#uses=1] + ret i16 %tmp +} + +define i16 @main() nounwind { +entry: + br label %while.cond + +while.cond: ; preds = %while.cond, %entry + %call = call i16 @bar() nounwind ; [#uses=1] + %tobool = icmp eq i16 %call, 0 ; [#uses=1] + br i1 %tobool, label %while.end, label %while.cond + +while.end: ; preds = %while.cond + %result.i = alloca i16, align 1 ; [#uses=2] + volatile store i16 0, i16* %result.i + %tmp.i = volatile load i16* %result.i ; [#uses=0] + ret i16 0 +} + +declare i16 @bar() diff --git a/libclamav/c++/llvm/test/CodeGen/MSP430/inline-asm.ll b/libclamav/c++/llvm/test/CodeGen/MSP430/inline-asm.ll new file mode 100644 index 000000000..83e8d12c5 --- /dev/null +++ b/libclamav/c++/llvm/test/CodeGen/MSP430/inline-asm.ll @@ -0,0 +1,16 @@ +; RUN: llvm-as < %s | llc +; PR4778 +target datalayout = "e-p:16:8:8-i8:8:8-i16:8:8-i32:8:8" +target triple = "msp430-generic-generic" + +define signext i8 @__nesc_atomic_start() nounwind { +entry: + %0 = tail call i16 asm sideeffect "mov r2, $0", "=r"() nounwind ; [#uses=1] + %1 = trunc i16 %0 to i8 ; [#uses=1] + %and3 = lshr i8 %1, 3 ; [#uses=1] + %conv1 = and i8 %and3, 1 ; [#uses=1] + tail call void asm sideeffect "dint", ""() nounwind + tail call void asm sideeffect "nop", ""() nounwind + tail call void asm sideeffect "", "~{memory}"() nounwind + ret i8 %conv1 +} diff --git a/libclamav/c++/llvm/test/CodeGen/Mips/2008-06-05-Carry.ll b/libclamav/c++/llvm/test/CodeGen/Mips/2008-06-05-Carry.ll index 9cd7c8057..800ba112d 100644 --- a/libclamav/c++/llvm/test/CodeGen/Mips/2008-06-05-Carry.ll +++ b/libclamav/c++/llvm/test/CodeGen/Mips/2008-06-05-Carry.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=mips -f -o %t +; RUN: llvm-as < %s | llc -march=mips -o %t ; RUN: grep subu %t | count 2 ; RUN: grep addu %t | count 4 diff --git a/libclamav/c++/llvm/test/CodeGen/Mips/2008-07-07-IntDoubleConvertions.ll b/libclamav/c++/llvm/test/CodeGen/Mips/2008-07-07-IntDoubleConvertions.ll index ab6a9c8ed..2f10a3f2a 100644 --- a/libclamav/c++/llvm/test/CodeGen/Mips/2008-07-07-IntDoubleConvertions.ll +++ b/libclamav/c++/llvm/test/CodeGen/Mips/2008-07-07-IntDoubleConvertions.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=mips -f -o %t +; RUN: llvm-as < %s | llc -march=mips -o %t ; RUN: grep __floatsidf %t | count 1 ; RUN: grep __floatunsidf %t | count 1 ; RUN: grep __fixdfsi %t | count 1 diff --git a/libclamav/c++/llvm/test/CodeGen/Mips/2008-07-15-InternalConstant.ll b/libclamav/c++/llvm/test/CodeGen/Mips/2008-07-15-InternalConstant.ll index 4d218cf6b..33b240bbc 100644 --- a/libclamav/c++/llvm/test/CodeGen/Mips/2008-07-15-InternalConstant.ll +++ b/libclamav/c++/llvm/test/CodeGen/Mips/2008-07-15-InternalConstant.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=mips -f -o %t +; RUN: llvm-as < %s | llc -march=mips -o %t ; RUN: grep {rodata.str1.4,"aMS",@progbits} %t | count 1 ; RUN: grep {r.data,} %t | count 1 ; RUN: grep {\%hi} %t | count 2 diff --git a/libclamav/c++/llvm/test/CodeGen/Mips/2008-07-15-SmallSection.ll b/libclamav/c++/llvm/test/CodeGen/Mips/2008-07-15-SmallSection.ll index 0e3f86479..671fa9404 100644 --- a/libclamav/c++/llvm/test/CodeGen/Mips/2008-07-15-SmallSection.ll +++ b/libclamav/c++/llvm/test/CodeGen/Mips/2008-07-15-SmallSection.ll @@ -1,5 +1,5 @@ -; RUN: llvm-as < %s | llc -mips-ssection-threshold=8 -march=mips -f -o %t0 -; RUN: llvm-as < %s | llc -mips-ssection-threshold=0 -march=mips -f -o %t1 +; RUN: llvm-as < %s | llc -mips-ssection-threshold=8 -march=mips -o %t0 +; RUN: llvm-as < %s | llc -mips-ssection-threshold=0 -march=mips -o %t1 ; RUN: grep {sdata} %t0 | count 1 ; RUN: grep {sbss} %t0 | count 1 ; RUN: grep {gp_rel} %t0 | count 2 diff --git a/libclamav/c++/llvm/test/CodeGen/Mips/2008-07-16-SignExtInReg.ll b/libclamav/c++/llvm/test/CodeGen/Mips/2008-07-16-SignExtInReg.ll index fc03bb5fe..a1523d1af 100644 --- a/libclamav/c++/llvm/test/CodeGen/Mips/2008-07-16-SignExtInReg.ll +++ b/libclamav/c++/llvm/test/CodeGen/Mips/2008-07-16-SignExtInReg.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=mips -f -o %t +; RUN: llvm-as < %s | llc -march=mips -o %t ; RUN: grep seh %t | count 1 ; RUN: grep seb %t | count 1 diff --git a/libclamav/c++/llvm/test/CodeGen/Mips/2008-07-22-Cstpool.ll b/libclamav/c++/llvm/test/CodeGen/Mips/2008-07-22-Cstpool.ll index 2af7ab17c..cf04b0fa3 100644 --- a/libclamav/c++/llvm/test/CodeGen/Mips/2008-07-22-Cstpool.ll +++ b/libclamav/c++/llvm/test/CodeGen/Mips/2008-07-22-Cstpool.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=mips -f -o %t +; RUN: llvm-as < %s | llc -march=mips -o %t ; RUN: grep {CPI\[01\]_\[01\]:} %t | count 2 ; RUN: grep {rodata.cst4,"aM",@progbits} %t | count 1 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:32-i16:16:32-i32:32:32-i64:32:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64" diff --git a/libclamav/c++/llvm/test/CodeGen/Mips/2008-07-23-fpcmp.ll b/libclamav/c++/llvm/test/CodeGen/Mips/2008-07-23-fpcmp.ll index 4580215b3..12a502687 100644 --- a/libclamav/c++/llvm/test/CodeGen/Mips/2008-07-23-fpcmp.ll +++ b/libclamav/c++/llvm/test/CodeGen/Mips/2008-07-23-fpcmp.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=mips -f -o %t +; RUN: llvm-as < %s | llc -march=mips -o %t ; RUN: grep {c\\..*\\.s} %t | count 3 ; RUN: grep {bc1\[tf\]} %t | count 3 diff --git a/libclamav/c++/llvm/test/CodeGen/Mips/2008-07-31-fcopysign.ll b/libclamav/c++/llvm/test/CodeGen/Mips/2008-07-31-fcopysign.ll index de11ac77c..58fa70826 100644 --- a/libclamav/c++/llvm/test/CodeGen/Mips/2008-07-31-fcopysign.ll +++ b/libclamav/c++/llvm/test/CodeGen/Mips/2008-07-31-fcopysign.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=mips -f -o %t +; RUN: llvm-as < %s | llc -march=mips -o %t ; RUN: grep abs.s %t | count 1 ; RUN: grep neg.s %t | count 1 diff --git a/libclamav/c++/llvm/test/CodeGen/Mips/2008-08-01-AsmInline.ll b/libclamav/c++/llvm/test/CodeGen/Mips/2008-08-01-AsmInline.ll index fea5730f7..2cf411956 100644 --- a/libclamav/c++/llvm/test/CodeGen/Mips/2008-08-01-AsmInline.ll +++ b/libclamav/c++/llvm/test/CodeGen/Mips/2008-08-01-AsmInline.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=mips -f -o %t +; RUN: llvm-as < %s | llc -march=mips -o %t ; RUN: grep mfhi %t | count 1 ; RUN: grep mflo %t | count 1 ; RUN: grep multu %t | count 1 diff --git a/libclamav/c++/llvm/test/CodeGen/Mips/2008-08-03-fabs64.ll b/libclamav/c++/llvm/test/CodeGen/Mips/2008-08-03-fabs64.ll index 9d18f47bc..e3d402848 100644 --- a/libclamav/c++/llvm/test/CodeGen/Mips/2008-08-03-fabs64.ll +++ b/libclamav/c++/llvm/test/CodeGen/Mips/2008-08-03-fabs64.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=mips -f -o %t +; RUN: llvm-as < %s | llc -march=mips -o %t ; RUN: grep {lui.*32767} %t | count 1 ; RUN: grep {ori.*65535} %t | count 1 diff --git a/libclamav/c++/llvm/test/CodeGen/Mips/2008-08-04-Bitconvert.ll b/libclamav/c++/llvm/test/CodeGen/Mips/2008-08-04-Bitconvert.ll index f7a64c32f..f6d7d64c9 100644 --- a/libclamav/c++/llvm/test/CodeGen/Mips/2008-08-04-Bitconvert.ll +++ b/libclamav/c++/llvm/test/CodeGen/Mips/2008-08-04-Bitconvert.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=mips -f -o %t +; RUN: llvm-as < %s | llc -march=mips -o %t ; RUN: grep mtc1 %t | count 1 ; RUN: grep mfc1 %t | count 1 diff --git a/libclamav/c++/llvm/test/CodeGen/Mips/2008-08-07-CC.ll b/libclamav/c++/llvm/test/CodeGen/Mips/2008-08-07-CC.ll index e276f5e90..fd90dda95 100644 --- a/libclamav/c++/llvm/test/CodeGen/Mips/2008-08-07-CC.ll +++ b/libclamav/c++/llvm/test/CodeGen/Mips/2008-08-07-CC.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=mips -f +; RUN: llvm-as < %s | llc -march=mips ; Mips must ignore fastcc target datalayout = diff --git a/libclamav/c++/llvm/test/CodeGen/PowerPC/2009-08-17-inline-asm-addr-mode-breakage.ll b/libclamav/c++/llvm/test/CodeGen/PowerPC/2009-08-17-inline-asm-addr-mode-breakage.ll index 9e0c5de39..e1fa30a0b 100644 --- a/libclamav/c++/llvm/test/CodeGen/PowerPC/2009-08-17-inline-asm-addr-mode-breakage.ll +++ b/libclamav/c++/llvm/test/CodeGen/PowerPC/2009-08-17-inline-asm-addr-mode-breakage.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=ppc32 | grep add +; RUN: llvm-as < %s | llc -march=ppc32 | FileCheck %s ; ModuleID = '' target datalayout = "E-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f128:64:128" target triple = "powerpc-apple-darwin10.0" @@ -9,6 +9,9 @@ target triple = "powerpc-apple-darwin10.0" define void @foo(i32 %y) nounwind ssp { entry: +; CHECK: foo +; CHECK: add r2 +; CHECK: 0(r2) %y_addr = alloca i32 ; [#uses=2] %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] store i32 %y, i32* %y_addr diff --git a/libclamav/c++/llvm/test/CodeGen/Generic/2009-08-23-linkerprivate.ll b/libclamav/c++/llvm/test/CodeGen/PowerPC/2009-08-23-linkerprivate.ll similarity index 72% rename from libclamav/c++/llvm/test/CodeGen/Generic/2009-08-23-linkerprivate.ll rename to libclamav/c++/llvm/test/CodeGen/PowerPC/2009-08-23-linkerprivate.ll index b4150de7d..6fe33e89c 100644 --- a/libclamav/c++/llvm/test/CodeGen/Generic/2009-08-23-linkerprivate.ll +++ b/libclamav/c++/llvm/test/CodeGen/PowerPC/2009-08-23-linkerprivate.ll @@ -1,6 +1,4 @@ -; RUN: llvm-as < %s | llc -march=x86 -mtriple=i686-apple-darwin | FileCheck %s ; RUN: llvm-as < %s | llc -march=ppc32 -mtriple=ppc-apple-darwin | FileCheck %s -; RUN: llvm-as < %s | llc -march=arm -mtriple=arm-apple-darwin | FileCheck %s ; ModuleID = '/Volumes/MacOS9/tests/WebKit/JavaScriptCore/profiler/ProfilerServer.mm' diff --git a/libclamav/c++/llvm/test/CodeGen/PowerPC/Frames-alloca.ll b/libclamav/c++/llvm/test/CodeGen/PowerPC/Frames-alloca.ll index 45c13a7bf..0a653e833 100644 --- a/libclamav/c++/llvm/test/CodeGen/PowerPC/Frames-alloca.ll +++ b/libclamav/c++/llvm/test/CodeGen/PowerPC/Frames-alloca.ll @@ -1,35 +1,28 @@ -; RUN: llvm-as < %s | llc -march=ppc32 -mtriple=powerpc-apple-darwin8 | \ -; RUN: grep {stw r31, 20(r1)} -; RUN: llvm-as < %s | llc -march=ppc32 -mtriple=powerpc-apple-darwin8 -enable-ppc32-regscavenger | \ -; RUN: grep {stwu r1, -80(r1)} -; RUN: llvm-as < %s | llc -march=ppc32 -mtriple=powerpc-apple-darwin8 | \ -; RUN: grep {lwz r1, 0(r1)} -; RUN: llvm-as < %s | llc -march=ppc32 -mtriple=powerpc-apple-darwin8 | \ -; RUN: grep {lwz r31, 20(r1)} -; RUN: llvm-as < %s | llc -march=ppc32 -mtriple=powerpc-apple-darwin8 -disable-fp-elim | \ -; RUN: grep {stw r31, 20(r1)} -; RUN: llvm-as < %s | llc -march=ppc32 -mtriple=powerpc-apple-darwin8 -disable-fp-elim -enable-ppc32-regscavenger | \ -; RUN: grep {stwu r1, -80(r1)} -; RUN: llvm-as < %s | llc -march=ppc32 -mtriple=powerpc-apple-darwin8 -disable-fp-elim | \ -; RUN: grep {lwz r1, 0(r1)} -; RUN: llvm-as < %s | llc -march=ppc32 -mtriple=powerpc-apple-darwin8 -disable-fp-elim | \ -; RUN: grep {lwz r31, 20(r1)} -; RUN: llvm-as < %s | llc -march=ppc64 -mtriple=powerpc-apple-darwin8 | \ -; RUN: grep {std r31, 40(r1)} -; RUN: llvm-as < %s | llc -march=ppc64 -mtriple=powerpc-apple-darwin8 | \ -; RUN: grep {stdu r1, -112(r1)} -; RUN: llvm-as < %s | llc -march=ppc64 -mtriple=powerpc-apple-darwin8 | \ -; RUN: grep {ld r1, 0(r1)} -; RUN: llvm-as < %s | llc -march=ppc64 -mtriple=powerpc-apple-darwin8 | \ -; RUN: grep {ld r31, 40(r1)} -; RUN: llvm-as < %s | llc -march=ppc64 -mtriple=powerpc-apple-darwin8 -disable-fp-elim | \ -; RUN: grep {std r31, 40(r1)} -; RUN: llvm-as < %s | llc -march=ppc64 -mtriple=powerpc-apple-darwin8 -disable-fp-elim | \ -; RUN: grep {stdu r1, -112(r1)} -; RUN: llvm-as < %s | llc -march=ppc64 -mtriple=powerpc-apple-darwin8 -disable-fp-elim | \ -; RUN: grep {ld r1, 0(r1)} -; RUN: llvm-as < %s | llc -march=ppc64 -mtriple=powerpc-apple-darwin8 -disable-fp-elim | \ -; RUN: grep {ld r31, 40(r1)} +; RUN: llvm-as < %s | llc -march=ppc32 -mtriple=powerpc-apple-darwin8 | FileCheck %s -check-prefix=PPC32 +; RUN: llvm-as < %s | llc -march=ppc64 -mtriple=powerpc-apple-darwin8 | FileCheck %s -check-prefix=PPC64 +; RUN: llvm-as < %s | llc -march=ppc32 -mtriple=powerpc-apple-darwin8 -disable-fp-elim | FileCheck %s -check-prefix=PPC32-NOFP +; RUN: llvm-as < %s | llc -march=ppc64 -mtriple=powerpc-apple-darwin8 -disable-fp-elim | FileCheck %s -check-prefix=PPC64-NOFP +; RUN: llvm-as < %s | llc -march=ppc32 -mtriple=powerpc-apple-darwin8 -enable-ppc32-regscavenger | FileCheck %s -check-prefix=PPC32 +; RUN: llvm-as < %s | llc -march=ppc32 -mtriple=powerpc-apple-darwin8 -enable-ppc32-regscavenger | FileCheck %s -check-prefix=PPC32-RS +; RUN: llvm-as < %s | llc -march=ppc32 -mtriple=powerpc-apple-darwin8 -disable-fp-elim -enable-ppc32-regscavenger | FileCheck %s -check-prefix=PPC32-RS-NOFP + +; CHECK-PPC32: stw r31, 20(r1) +; CHECK-PPC32: lwz r1, 0(r1) +; CHECK-PPC32: lwz r31, 20(r1) +; CHECK-PPC32-NOFP: stw r31, 20(r1) +; CHECK-PPC32-NOFP: lwz r1, 0(r1) +; CHECK-PPC32-NOFP: lwz r31, 20(r1) +; CHECK-PPC32-RS: stwu r1, -80(r1) +; CHECK-PPC32-RS-NOFP: stwu r1, -80(r1) + +; CHECK-PPC64: std r31, 40(r1) +; CHECK-PPC64: stdu r1, -112(r1) +; CHECK-PPC64: ld r1, 0(r1) +; CHECK-PPC64: ld r31, 40(r1) +; CHECK-PPC64-NOFP: std r31, 40(r1) +; CHECK-PPC64-NOFP: stdu r1, -112(r1) +; CHECK-PPC64-NOFP: ld r1, 0(r1) +; CHECK-PPC64-NOFP: ld r31, 40(r1) define i32* @f1(i32 %n) { %tmp = alloca i32, i32 %n ; [#uses=1] diff --git a/libclamav/c++/llvm/test/CodeGen/PowerPC/Frames-large.ll b/libclamav/c++/llvm/test/CodeGen/PowerPC/Frames-large.ll index 0a15d2233..fda2e4ff9 100644 --- a/libclamav/c++/llvm/test/CodeGen/PowerPC/Frames-large.ll +++ b/libclamav/c++/llvm/test/CodeGen/PowerPC/Frames-large.ll @@ -1,77 +1,52 @@ -; RUN: llvm-as < %s | \ -; RUN: llc -march=ppc32 -mtriple=powerpc-apple-darwin8 | \ -; RUN: not grep {stw r31, 20(r1)} -; RUN: llvm-as < %s | \ -; RUN: llc -march=ppc32 -mtriple=powerpc-apple-darwin8 | grep {lis r0, -1} -; RUN: llvm-as < %s | \ -; RUN: llc -march=ppc32 -mtriple=powerpc-apple-darwin8 | \ -; RUN: grep {ori r0, r0, 32704} -; RUN: llvm-as < %s | \ -; RUN: llc -march=ppc32 -mtriple=powerpc-apple-darwin8 | \ -; RUN: grep {stwux r1, r1, r0} -; RUN: llvm-as < %s | \ -; RUN: llc -march=ppc32 -mtriple=powerpc-apple-darwin8 | \ -; RUN: grep {lwz r1, 0(r1)} -; RUN: llvm-as < %s | \ -; RUN: llc -march=ppc32 -mtriple=powerpc-apple-darwin8 | \ -; RUN: not grep {lwz r31, 20(r1)} -; RUN: llvm-as < %s | \ -; RUN: llc -march=ppc32 -mtriple=powerpc-apple-darwin8 -disable-fp-elim | \ -; RUN: grep {stw r31, 20(r1)} -; RUN: llvm-as < %s | \ -; RUN: llc -march=ppc32 -mtriple=powerpc-apple-darwin8 -disable-fp-elim | \ -; RUN: grep {lis r0, -1} -; RUN: llvm-as < %s | \ -; RUN: llc -march=ppc32 -mtriple=powerpc-apple-darwin8 -disable-fp-elim | \ -; RUN: grep {ori r0, r0, 32704} -; RUN: llvm-as < %s | \ -; RUN: llc -march=ppc32 -mtriple=powerpc-apple-darwin8 -disable-fp-elim | \ -; RUN: grep {stwux r1, r1, r0} -; RUN: llvm-as < %s | \ -; RUN: llc -march=ppc32 -mtriple=powerpc-apple-darwin8 -disable-fp-elim | \ -; RUN: grep {lwz r1, 0(r1)} -; RUN: llvm-as < %s | \ -; RUN: llc -march=ppc32 -mtriple=powerpc-apple-darwin8 -disable-fp-elim | \ -; RUN: grep {lwz r31, 20(r1)} -; RUN: llvm-as < %s | \ -; RUN: llc -march=ppc64 -mtriple=powerpc-apple-darwin8 | \ -; RUN: not grep {std r31, 40(r1)} -; RUN: llvm-as < %s | \ -; RUN: llc -march=ppc64 -mtriple=powerpc-apple-darwin8 | \ -; RUN: grep {lis r0, -1} -; RUN: llvm-as < %s | \ -; RUN: llc -march=ppc64 -mtriple=powerpc-apple-darwin8 | \ -; RUN: grep {ori r0, r0, 32656} -; RUN: llvm-as < %s | \ -; RUN: llc -march=ppc64 -mtriple=powerpc-apple-darwin8 | \ -; RUN: grep {stdux r1, r1, r0} -; RUN: llvm-as < %s | \ -; RUN: llc -march=ppc64 -mtriple=powerpc-apple-darwin8 | \ -; RUN: grep {ld r1, 0(r1)} -; RUN: llvm-as < %s | \ -; RUN: llc -march=ppc64 -mtriple=powerpc-apple-darwin8 | \ -; RUN: not grep {ld r31, 40(r1)} -; RUN: llvm-as < %s | \ -; RUN: llc -march=ppc64 -mtriple=powerpc-apple-darwin8 -disable-fp-elim | \ -; RUN: grep {std r31, 40(r1)} -; RUN: llvm-as < %s | \ -; RUN: llc -march=ppc64 -mtriple=powerpc-apple-darwin8 -disable-fp-elim | \ -; RUN: grep {lis r0, -1} -; RUN: llvm-as < %s | \ -; RUN: llc -march=ppc64 -mtriple=powerpc-apple-darwin8 -disable-fp-elim | \ -; RUN: grep {ori r0, r0, 32656} -; RUN: llvm-as < %s | \ -; RUN: llc -march=ppc64 -mtriple=powerpc-apple-darwin8 -disable-fp-elim | \ -; RUN: grep {stdux r1, r1, r0} -; RUN: llvm-as < %s | \ -; RUN: llc -march=ppc64 -mtriple=powerpc-apple-darwin8 -disable-fp-elim | \ -; RUN: grep {ld r1, 0(r1)} -; RUN: llvm-as < %s | \ -; RUN: llc -march=ppc64 -mtriple=powerpc-apple-darwin8 -disable-fp-elim | \ -; RUN: grep {ld r31, 40(r1)} +; RUN: llvm-as < %s > %t.bc +; RUN: llc < %t.bc -march=ppc32 | FileCheck %s -check-prefix=PPC32-NOFP +; RUN: llc < %t.bc -march=ppc32 -disable-fp-elim | FileCheck %s -check-prefix=PPC32-FP -define i32* @f1() { +; RUN: llc < %t.bc -march=ppc64 | FileCheck %s -check-prefix=PPC64-NOFP +; RUN: llc < %t.bc -march=ppc64 -disable-fp-elim | FileCheck %s -check-prefix=PPC64-FP + + +target triple = "powerpc-apple-darwin8" + +define i32* @f1() nounwind { %tmp = alloca i32, i32 8191 ; [#uses=1] ret i32* %tmp } +; PPC32-NOFP: _f1: +; PPC32-NOFP: lis r0, -1 +; PPC32-NOFP: ori r0, r0, 32704 +; PPC32-NOFP: stwux r1, r1, r0 +; PPC32-NOFP: addi r3, r1, 68 +; PPC32-NOFP: lwz r1, 0(r1) +; PPC32-NOFP: blr + +; PPC32-FP: _f1: +; PPC32-FP: stw r31, 20(r1) +; PPC32-FP: lis r0, -1 +; PPC32-FP: ori r0, r0, 32704 +; PPC32-FP: stwux r1, r1, r0 +; ... +; PPC32-FP: lwz r1, 0(r1) +; PPC32-FP: lwz r31, 20(r1) +; PPC32-FP: blr + + +; PPC64-NOFP: _f1: +; PPC64-NOFP: lis r0, -1 +; PPC64-NOFP: ori r0, r0, 32656 +; PPC64-NOFP: stdux r1, r1, r0 +; PPC64-NOFP: addi r3, r1, 116 +; PPC64-NOFP: ld r1, 0(r1) +; PPC64-NOFP: blr + + +; PPC64-FP: _f1: +; PPC64-FP: std r31, 40(r1) +; PPC64-FP: lis r0, -1 +; PPC64-FP: ori r0, r0, 32656 +; PPC64-FP: stdux r1, r1, r0 +; ... +; PPC64-FP: ld r1, 0(r1) +; PPC64-FP: ld r31, 40(r1) +; PPC64-FP: blr diff --git a/libclamav/c++/llvm/test/CodeGen/PowerPC/Frames-small.ll b/libclamav/c++/llvm/test/CodeGen/PowerPC/Frames-small.ll index 4ea3afba8..c12dd44e6 100644 --- a/libclamav/c++/llvm/test/CodeGen/PowerPC/Frames-small.ll +++ b/libclamav/c++/llvm/test/CodeGen/PowerPC/Frames-small.ll @@ -1,5 +1,5 @@ ; RUN: llvm-as < %s | \ -; RUN: llc -march=ppc32 -mtriple=powerpc-apple-darwin8 -o %t1 -f +; RUN: llc -march=ppc32 -mtriple=powerpc-apple-darwin8 -o %t1 ; RUN not grep {stw r31, 20(r1)} %t1 ; RUN: grep {stwu r1, -16448(r1)} %t1 ; RUN: grep {addi r1, r1, 16448} %t1 @@ -7,20 +7,20 @@ ; RUN: not grep {lwz r31, 20(r1)} ; RUN: llvm-as < %s | \ ; RUN: llc -march=ppc32 -mtriple=powerpc-apple-darwin8 -disable-fp-elim \ -; RUN: -o %t2 -f +; RUN: -o %t2 ; RUN: grep {stw r31, 20(r1)} %t2 ; RUN: grep {stwu r1, -16448(r1)} %t2 ; RUN: grep {addi r1, r1, 16448} %t2 ; RUN: grep {lwz r31, 20(r1)} %t2 ; RUN: llvm-as < %s | \ -; RUN: llc -march=ppc64 -mtriple=powerpc-apple-darwin8 -o %t3 -f +; RUN: llc -march=ppc64 -mtriple=powerpc-apple-darwin8 -o %t3 ; RUN: not grep {std r31, 40(r1)} %t3 ; RUN: grep {stdu r1, -16496(r1)} %t3 ; RUN: grep {addi r1, r1, 16496} %t3 ; RUN: not grep {ld r31, 40(r1)} %t3 ; RUN: llvm-as < %s | \ ; RUN: llc -march=ppc64 -mtriple=powerpc-apple-darwin8 -disable-fp-elim \ -; RUN: -o %t4 -f +; RUN: -o %t4 ; RUN: grep {std r31, 40(r1)} %t4 ; RUN: grep {stdu r1, -16496(r1)} %t4 ; RUN: grep {addi r1, r1, 16496} %t4 diff --git a/libclamav/c++/llvm/test/CodeGen/PowerPC/addc.ll b/libclamav/c++/llvm/test/CodeGen/PowerPC/addc.ll index 406053bee..3e6fe2722 100644 --- a/libclamav/c++/llvm/test/CodeGen/PowerPC/addc.ll +++ b/libclamav/c++/llvm/test/CodeGen/PowerPC/addc.ll @@ -1,5 +1,5 @@ ; All of these should be codegen'd without loading immediates -; RUN: llvm-as < %s | llc -march=ppc32 -o %t -f +; RUN: llvm-as < %s | llc -march=ppc32 -o %t ; RUN: grep addc %t | count 1 ; RUN: grep adde %t | count 1 ; RUN: grep addze %t | count 1 diff --git a/libclamav/c++/llvm/test/CodeGen/PowerPC/and_add.ll b/libclamav/c++/llvm/test/CodeGen/PowerPC/and_add.ll index f103e7c0d..b034841cc 100644 --- a/libclamav/c++/llvm/test/CodeGen/PowerPC/and_add.ll +++ b/libclamav/c++/llvm/test/CodeGen/PowerPC/and_add.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=ppc32 -o %t -f +; RUN: llvm-as < %s | llc -march=ppc32 -o %t ; RUN: grep slwi %t ; RUN: not grep addi %t ; RUN: not grep rlwinm %t diff --git a/libclamav/c++/llvm/test/CodeGen/PowerPC/mulhs.ll b/libclamav/c++/llvm/test/CodeGen/PowerPC/mulhs.ll index 3b0daad22..e6e7b5cf8 100644 --- a/libclamav/c++/llvm/test/CodeGen/PowerPC/mulhs.ll +++ b/libclamav/c++/llvm/test/CodeGen/PowerPC/mulhs.ll @@ -1,5 +1,5 @@ ; All of these ands and shifts should be folded into rlwimi's -; RUN: llvm-as < %s | llc -march=ppc32 -o %t -f +; RUN: llvm-as < %s | llc -march=ppc32 -o %t ; RUN: not grep mulhwu %t ; RUN: not grep srawi %t ; RUN: not grep add %t diff --git a/libclamav/c++/llvm/test/CodeGen/PowerPC/rlwimi2.ll b/libclamav/c++/llvm/test/CodeGen/PowerPC/rlwimi2.ll index 33eaacf8b..3cb2e7be3 100644 --- a/libclamav/c++/llvm/test/CodeGen/PowerPC/rlwimi2.ll +++ b/libclamav/c++/llvm/test/CodeGen/PowerPC/rlwimi2.ll @@ -1,5 +1,5 @@ ; All of these ands and shifts should be folded into rlwimi's -; RUN: llvm-as < %s | llc -march=ppc32 -o %t -f +; RUN: llvm-as < %s | llc -march=ppc32 -o %t ; RUN: grep rlwimi %t | count 3 ; RUN: grep srwi %t | count 1 ; RUN: not grep slwi %t diff --git a/libclamav/c++/llvm/test/CodeGen/PowerPC/rlwinm.ll b/libclamav/c++/llvm/test/CodeGen/PowerPC/rlwinm.ll index 9d34865be..d92b77c14 100644 --- a/libclamav/c++/llvm/test/CodeGen/PowerPC/rlwinm.ll +++ b/libclamav/c++/llvm/test/CodeGen/PowerPC/rlwinm.ll @@ -1,5 +1,5 @@ ; All of these ands and shifts should be folded into rlwimi's -; RUN: llvm-as < %s | llc -march=ppc32 -o %t -f +; RUN: llvm-as < %s | llc -march=ppc32 -o %t ; RUN: not grep and %t ; RUN: not grep srawi %t ; RUN: not grep srwi %t diff --git a/libclamav/c++/llvm/test/CodeGen/PowerPC/rlwinm2.ll b/libclamav/c++/llvm/test/CodeGen/PowerPC/rlwinm2.ll index 06ceaa2a9..7ddea4e96 100644 --- a/libclamav/c++/llvm/test/CodeGen/PowerPC/rlwinm2.ll +++ b/libclamav/c++/llvm/test/CodeGen/PowerPC/rlwinm2.ll @@ -1,5 +1,5 @@ ; All of these ands and shifts should be folded into rlw[i]nm instructions -; RUN: llvm-as < %s | llc -march=ppc32 -o %t -f +; RUN: llvm-as < %s | llc -march=ppc32 -o %t ; RUN: not grep and %t ; RUN: not grep srawi %t ; RUN: not grep srwi %t diff --git a/libclamav/c++/llvm/test/CodeGen/PowerPC/stfiwx.ll b/libclamav/c++/llvm/test/CodeGen/PowerPC/stfiwx.ll index c4afb6353..765c326ba 100644 --- a/libclamav/c++/llvm/test/CodeGen/PowerPC/stfiwx.ll +++ b/libclamav/c++/llvm/test/CodeGen/PowerPC/stfiwx.ll @@ -1,10 +1,10 @@ ; RUN: llvm-as < %s | \ -; RUN: llc -march=ppc32 -mtriple=powerpc-apple-darwin8 -mattr=stfiwx -o %t1 -f +; RUN: llc -march=ppc32 -mtriple=powerpc-apple-darwin8 -mattr=stfiwx -o %t1 ; RUN: grep stfiwx %t1 ; RUN: not grep r1 %t1 ; RUN: llvm-as < %s | \ ; RUN: llc -march=ppc32 -mtriple=powerpc-apple-darwin8 -mattr=-stfiwx \ -; RUN: -o %t2 -f +; RUN: -o %t2 ; RUN: not grep stfiwx %t2 ; RUN: grep r1 %t2 diff --git a/libclamav/c++/llvm/test/CodeGen/PowerPC/subc.ll b/libclamav/c++/llvm/test/CodeGen/PowerPC/subc.ll index 4ac95961f..17220743c 100644 --- a/libclamav/c++/llvm/test/CodeGen/PowerPC/subc.ll +++ b/libclamav/c++/llvm/test/CodeGen/PowerPC/subc.ll @@ -1,5 +1,5 @@ ; All of these should be codegen'd without loading immediates -; RUN: llvm-as < %s | llc -march=ppc32 -o %t -f +; RUN: llvm-as < %s | llc -march=ppc32 -o %t ; RUN: grep subfc %t | count 1 ; RUN: grep subfe %t | count 1 ; RUN: grep subfze %t | count 1 diff --git a/libclamav/c++/llvm/test/CodeGen/PowerPC/vec_br_cmp.ll b/libclamav/c++/llvm/test/CodeGen/PowerPC/vec_br_cmp.ll index 6d799676b..8cbab5cf0 100644 --- a/libclamav/c++/llvm/test/CodeGen/PowerPC/vec_br_cmp.ll +++ b/libclamav/c++/llvm/test/CodeGen/PowerPC/vec_br_cmp.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=ppc32 -mcpu=g5 -o %t -f +; RUN: llvm-as < %s | llc -march=ppc32 -mcpu=g5 -o %t ; RUN: grep vcmpeqfp. %t ; RUN: not grep mfcr %t diff --git a/libclamav/c++/llvm/test/CodeGen/PowerPC/vec_splat.ll b/libclamav/c++/llvm/test/CodeGen/PowerPC/vec_splat.ll index 7b7e4fe33..7f466bf8e 100644 --- a/libclamav/c++/llvm/test/CodeGen/PowerPC/vec_splat.ll +++ b/libclamav/c++/llvm/test/CodeGen/PowerPC/vec_splat.ll @@ -1,7 +1,7 @@ ; Test that vectors are scalarized/lowered correctly. ; RUN: llvm-as < %s | llc -march=ppc32 -mcpu=g3 | \ ; RUN: grep stfs | count 4 -; RUN: llvm-as < %s | llc -march=ppc32 -mcpu=g5 -o %t -f +; RUN: llvm-as < %s | llc -march=ppc32 -mcpu=g5 -o %t ; RUN: grep vspltw %t | count 2 ; RUN: grep vsplti %t | count 3 ; RUN: grep vsplth %t | count 1 diff --git a/libclamav/c++/llvm/test/CodeGen/PowerPC/vec_vrsave.ll b/libclamav/c++/llvm/test/CodeGen/PowerPC/vec_vrsave.ll index 06769f6bf..7d5fadbc5 100644 --- a/libclamav/c++/llvm/test/CodeGen/PowerPC/vec_vrsave.ll +++ b/libclamav/c++/llvm/test/CodeGen/PowerPC/vec_vrsave.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=ppc32 -mcpu=g5 -o %t -f +; RUN: llvm-as < %s | llc -march=ppc32 -mcpu=g5 -o %t ; RUN: grep vrlw %t ; RUN: not grep spr %t ; RUN: not grep vrsave %t diff --git a/libclamav/c++/llvm/test/CodeGen/Thumb/ldr_ext.ll b/libclamav/c++/llvm/test/CodeGen/Thumb/ldr_ext.ll index f8b9d150e..73b97f20d 100644 --- a/libclamav/c++/llvm/test/CodeGen/Thumb/ldr_ext.ll +++ b/libclamav/c++/llvm/test/CodeGen/Thumb/ldr_ext.ll @@ -1,34 +1,56 @@ -; RUN: llvm-as < %s | llc -march=thumb | FileCheck %s +; RUN: llvm-as < %s | llc -march=thumb | FileCheck %s -check-prefix=V5 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+v6 | FileCheck %s -check-prefix=V6 -define i32 @test1(i8* %v.pntr.s0.u1) { -; CHECK: test1: -; CHECK: ldrb - %tmp.u = load i8* %v.pntr.s0.u1 +; rdar://7176514 + +define i32 @test1(i8* %t1) nounwind { +; V5: ldrb + +; V6: ldrb + %tmp.u = load i8* %t1 %tmp1.s = zext i8 %tmp.u to i32 ret i32 %tmp1.s } -define i32 @test2(i16* %v.pntr.s0.u1) { -; CHECK: test2: -; CHECK: ldrh - %tmp.u = load i16* %v.pntr.s0.u1 +define i32 @test2(i16* %t1) nounwind { +; V5: ldrh + +; V6: ldrh + %tmp.u = load i16* %t1 %tmp1.s = zext i16 %tmp.u to i32 ret i32 %tmp1.s } -define i32 @test3(i8* %v.pntr.s1.u0) { -; CHECK: test3: -; CHECK: ldrb -; CHECK: sxtb - %tmp.s = load i8* %v.pntr.s1.u0 +define i32 @test3(i8* %t0) nounwind { +; V5: ldrb +; V5: lsls +; V5: asrs + +; V6: ldrb +; V6: sxtb + %tmp.s = load i8* %t0 %tmp1.s = sext i8 %tmp.s to i32 ret i32 %tmp1.s } -define i32 @test4() { -; CHECK: test4: -; CHECK: movs -; CHECK: ldrsh +define i32 @test4(i16* %t0) nounwind { +; V5: ldrh +; V5: lsls +; V5: asrs + +; V6: ldrh +; V6: sxth + %tmp.s = load i16* %t0 + %tmp1.s = sext i16 %tmp.s to i32 + ret i32 %tmp1.s +} + +define i32 @test5() nounwind { +; V5: movs r0, #0 +; V5: ldrsh + +; V6: movs r0, #0 +; V6: ldrsh %tmp.s = load i16* null %tmp1.s = sext i16 %tmp.s to i32 ret i32 %tmp1.s diff --git a/libclamav/c++/llvm/test/CodeGen/Thumb2/thumb2-call.ll b/libclamav/c++/llvm/test/CodeGen/Thumb2/thumb2-call.ll index b70c2a945..5265ea6b5 100644 --- a/libclamav/c++/llvm/test/CodeGen/Thumb2/thumb2-call.ll +++ b/libclamav/c++/llvm/test/CodeGen/Thumb2/thumb2-call.ll @@ -7,7 +7,7 @@ declare void @g(i32, i32, i32, i32) define void @f() { ; DARWIN: f: -; DARWIN: blx L_g$stub +; DARWIN: blx _g ; LINUX: f: ; LINUX: bl g diff --git a/libclamav/c++/llvm/test/CodeGen/Thumb2/thumb2-mov.ll b/libclamav/c++/llvm/test/CodeGen/Thumb2/thumb2-mov.ll index 0c4c59689..a44f815f4 100644 --- a/libclamav/c++/llvm/test/CodeGen/Thumb2/thumb2-mov.ll +++ b/libclamav/c++/llvm/test/CodeGen/Thumb2/thumb2-mov.ll @@ -1,127 +1,147 @@ -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep #11206827 -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep mov | grep movt -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep mov | grep movt -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep mov | grep movt -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep mov | grep movt -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep #2868947712 -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep mov | grep movt -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep mov | grep movt -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep mov | grep movt -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep mov | grep movt -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep #2880154539 -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep mov | grep movt -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep mov | grep movt -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep mov | grep movt -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep mov | grep movt -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep #251658240 -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep #3948544 -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep mov | grep movt -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep #258 -; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep #4026531840 +; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | FileCheck %s ; Test # ; var 2.1 - 0x00ab00ab define i32 @t2_const_var2_1_ok_1(i32 %lhs) { +;CHECK: t2_const_var2_1_ok_1: +;CHECK: #11206827 %ret = add i32 %lhs, 11206827 ; 0x00ab00ab ret i32 %ret } define i32 @t2_const_var2_1_fail_1(i32 %lhs) { +;CHECK: t2_const_var2_1_fail_1: +;CHECK: movt %ret = add i32 %lhs, 11206843 ; 0x00ab00bb ret i32 %ret } define i32 @t2_const_var2_1_fail_2(i32 %lhs) { +;CHECK: t2_const_var2_1_fail_2: +;CHECK: movt %ret = add i32 %lhs, 27984043 ; 0x01ab00ab ret i32 %ret } define i32 @t2_const_var2_1_fail_3(i32 %lhs) { +;CHECK: t2_const_var2_1_fail_3: +;CHECK: movt %ret = add i32 %lhs, 27984299 ; 0x01ab01ab ret i32 %ret } define i32 @t2_const_var2_1_fail_4(i32 %lhs) { +;CHECK: t2_const_var2_1_fail_4: +;CHECK: movt %ret = add i32 %lhs, 28027649 ; 0x01abab01 ret i32 %ret } ; var 2.2 - 0xab00ab00 define i32 @t2_const_var2_2_ok_1(i32 %lhs) { +;CHECK: t2_const_var2_2_ok_1: +;CHECK: #2868947712 %ret = add i32 %lhs, 2868947712 ; 0xab00ab00 ret i32 %ret } define i32 @t2_const_var2_2_fail_1(i32 %lhs) { +;CHECK: t2_const_var2_2_fail_1: +;CHECK: movt %ret = add i32 %lhs, 2868951552 ; 0xab00ba00 ret i32 %ret } define i32 @t2_const_var2_2_fail_2(i32 %lhs) { +;CHECK: t2_const_var2_2_fail_2: +;CHECK: movt %ret = add i32 %lhs, 2868947728 ; 0xab00ab10 ret i32 %ret } define i32 @t2_const_var2_2_fail_3(i32 %lhs) { +;CHECK: t2_const_var2_2_fail_3: +;CHECK: movt %ret = add i32 %lhs, 2869996304 ; 0xab10ab10 ret i32 %ret } define i32 @t2_const_var2_2_fail_4(i32 %lhs) { +;CHECK: t2_const_var2_2_fail_4: +;CHECK: movt %ret = add i32 %lhs, 279685904 ; 0x10abab10 ret i32 %ret } ; var 2.3 - 0xabababab define i32 @t2_const_var2_3_ok_1(i32 %lhs) { +;CHECK: t2_const_var2_3_ok_1: +;CHECK: #2880154539 %ret = add i32 %lhs, 2880154539 ; 0xabababab ret i32 %ret } define i32 @t2_const_var2_3_fail_1(i32 %lhs) { +;CHECK: t2_const_var2_3_fail_1: +;CHECK: movt %ret = add i32 %lhs, 2880154554 ; 0xabababba ret i32 %ret } define i32 @t2_const_var2_3_fail_2(i32 %lhs) { +;CHECK: t2_const_var2_3_fail_2: +;CHECK: movt %ret = add i32 %lhs, 2880158379 ; 0xababbaab ret i32 %ret } define i32 @t2_const_var2_3_fail_3(i32 %lhs) { +;CHECK: t2_const_var2_3_fail_3: +;CHECK: movt %ret = add i32 %lhs, 2881137579 ; 0xabbaabab ret i32 %ret } define i32 @t2_const_var2_3_fail_4(i32 %lhs) { +;CHECK: t2_const_var2_3_fail_4: +;CHECK: movt %ret = add i32 %lhs, 3131812779 ; 0xbaababab ret i32 %ret } ; var 3 - 0x0F000000 define i32 @t2_const_var3_1_ok_1(i32 %lhs) { +;CHECK: t2_const_var3_1_ok_1: +;CHECK: #251658240 %ret = add i32 %lhs, 251658240 ; 0x0F000000 ret i32 %ret } define i32 @t2_const_var3_2_ok_1(i32 %lhs) { +;CHECK: t2_const_var3_2_ok_1: +;CHECK: #3948544 %ret = add i32 %lhs, 3948544 ; 0b00000000001111000100000000000000 ret i32 %ret } define i32 @t2_const_var3_2_fail_1(i32 %lhs) { +;CHECK: t2_const_var3_2_fail_1: +;CHECK: movt %ret = add i32 %lhs, 3940352 ; 0b00000000001111000010000000000000 ret i32 %ret } define i32 @t2_const_var3_3_ok_1(i32 %lhs) { +;CHECK: t2_const_var3_3_ok_1: +;CHECK: #258 %ret = add i32 %lhs, 258 ; 0b00000000000000000000000100000010 ret i32 %ret } define i32 @t2_const_var3_4_ok_1(i32 %lhs) { +;CHECK: t2_const_var3_4_ok_1: +;CHECK: #4026531840 %ret = add i32 %lhs, 4026531840 ; 0xF0000000 ret i32 %ret } - diff --git a/libclamav/c++/llvm/test/CodeGen/Thumb2/thumb2-spill-q.ll b/libclamav/c++/llvm/test/CodeGen/Thumb2/thumb2-spill-q.ll new file mode 100644 index 000000000..3c8e820ed --- /dev/null +++ b/libclamav/c++/llvm/test/CodeGen/Thumb2/thumb2-spill-q.ll @@ -0,0 +1,57 @@ +; RUN: llvm-as < %s | llc -mtriple=thumbv7-elf -mattr=+neon | FileCheck %s +; PR4789 + +%bar = type { float, float, float } +%baz = type { i32, [16 x %bar], [16 x float], [16 x i32], i8 } +%foo = type { <4 x float> } +%quux = type { i32 (...)**, %baz*, i32 } +%quuz = type { %quux, i32, %bar, [128 x i8], [16 x %foo], %foo, %foo, %foo } + +declare <4 x float> @llvm.arm.neon.vld1.v4f32(i8*) nounwind readonly + +define arm_apcscc void @aaa(%quuz* %this, i8* %block) { +; CHECK: aaa: +; CHECK: vstmia sp +; CHECK: vldmia sp +entry: + %0 = call <4 x float> @llvm.arm.neon.vld1.v4f32(i8* undef) nounwind ; <<4 x float>> [#uses=1] + store float 6.300000e+01, float* undef, align 4 + %1 = call <4 x float> @llvm.arm.neon.vld1.v4f32(i8* undef) nounwind ; <<4 x float>> [#uses=1] + store float 0.000000e+00, float* undef, align 4 + %2 = call <4 x float> @llvm.arm.neon.vld1.v4f32(i8* undef) nounwind ; <<4 x float>> [#uses=1] + %val173 = load <4 x float>* undef ; <<4 x float>> [#uses=1] + br label %bb4 + +bb4: ; preds = %bb193, %entry + %besterror.0.2264 = phi <4 x float> [ undef, %entry ], [ %besterror.0.0, %bb193 ] ; <<4 x float>> [#uses=2] + %part0.0.0261 = phi <4 x float> [ zeroinitializer, %entry ], [ %23, %bb193 ] ; <<4 x float>> [#uses=2] + %3 = fmul <4 x float> zeroinitializer, %0 ; <<4 x float>> [#uses=2] + %4 = fadd <4 x float> %3, %part0.0.0261 ; <<4 x float>> [#uses=1] + %5 = shufflevector <4 x float> %3, <4 x float> undef, <2 x i32> ; <<2 x float>> [#uses=1] + %6 = shufflevector <2 x float> %5, <2 x float> undef, <4 x i32> ; <<4 x float>> [#uses=1] + %7 = fmul <4 x float> %1, undef ; <<4 x float>> [#uses=1] + %8 = fadd <4 x float> %7, ; <<4 x float>> [#uses=1] + %9 = fptosi <4 x float> %8 to <4 x i32> ; <<4 x i32>> [#uses=1] + %10 = sitofp <4 x i32> %9 to <4 x float> ; <<4 x float>> [#uses=1] + %11 = fmul <4 x float> %10, %2 ; <<4 x float>> [#uses=1] + %12 = fmul <4 x float> undef, %6 ; <<4 x float>> [#uses=1] + %13 = fmul <4 x float> %11, %4 ; <<4 x float>> [#uses=1] + %14 = fsub <4 x float> %12, %13 ; <<4 x float>> [#uses=1] + %15 = fsub <4 x float> %14, undef ; <<4 x float>> [#uses=1] + %16 = fmul <4 x float> %15, ; <<4 x float>> [#uses=1] + %17 = fadd <4 x float> %16, undef ; <<4 x float>> [#uses=1] + %18 = fmul <4 x float> %17, %val173 ; <<4 x float>> [#uses=1] + %19 = shufflevector <4 x float> %18, <4 x float> undef, <2 x i32> ; <<2 x float>> [#uses=1] + %20 = shufflevector <2 x float> %19, <2 x float> undef, <4 x i32> zeroinitializer ; <<4 x float>> [#uses=1] + %21 = fadd <4 x float> zeroinitializer, %20 ; <<4 x float>> [#uses=2] + %22 = fcmp ogt <4 x float> %besterror.0.2264, %21 ; <<4 x i1>> [#uses=0] + br i1 undef, label %bb193, label %bb186 + +bb186: ; preds = %bb4 + br label %bb193 + +bb193: ; preds = %bb186, %bb4 + %besterror.0.0 = phi <4 x float> [ %21, %bb186 ], [ %besterror.0.2264, %bb4 ] ; <<4 x float>> [#uses=1] + %23 = fadd <4 x float> %part0.0.0261, zeroinitializer ; <<4 x float>> [#uses=1] + br label %bb4 +} diff --git a/libclamav/c++/llvm/test/CodeGen/X86/2006-10-19-SwitchUnnecessaryBranching.ll b/libclamav/c++/llvm/test/CodeGen/X86/2006-10-19-SwitchUnnecessaryBranching.ll index 1ff687a1b..8ec032a9c 100644 --- a/libclamav/c++/llvm/test/CodeGen/X86/2006-10-19-SwitchUnnecessaryBranching.ll +++ b/libclamav/c++/llvm/test/CodeGen/X86/2006-10-19-SwitchUnnecessaryBranching.ll @@ -1,11 +1,14 @@ -; RUN: llvm-as < %s | llc -march=x86 -asm-verbose | %prcontext je 1 | \ -; RUN: grep BB1_1: +; RUN: llvm-as < %s | llc -march=x86 -asm-verbose | FileCheck %s @str = internal constant [14 x i8] c"Hello world!\0A\00" ; <[14 x i8]*> [#uses=1] @str.upgrd.1 = internal constant [13 x i8] c"Blah world!\0A\00" ; <[13 x i8]*> [#uses=1] -define i32 @main(i32 %argc, i8** %argv) { +define i32 @test(i32 %argc, i8** %argv) nounwind { entry: +; CHECK: cmpl $2 +; CHECK-NEXT: je +; CHECK-NEXT: LBB1_1 + switch i32 %argc, label %UnifiedReturnBlock [ i32 1, label %bb i32 2, label %bb2 diff --git a/libclamav/c++/llvm/test/CodeGen/X86/2007-01-08-InstrSched.ll b/libclamav/c++/llvm/test/CodeGen/X86/2007-01-08-InstrSched.ll index 3b365f35c..012e5931f 100644 --- a/libclamav/c++/llvm/test/CodeGen/X86/2007-01-08-InstrSched.ll +++ b/libclamav/c++/llvm/test/CodeGen/X86/2007-01-08-InstrSched.ll @@ -1,8 +1,7 @@ ; PR1075 -; RUN: llvm-as < %s | llc -mtriple=x86_64-apple-darwin | \ -; RUN: %prcontext {mulss LCPI1_3} 1 | grep mulss | count 1 +; RUN: llvm-as < %s | llc -mtriple=x86_64-apple-darwin | FileCheck %s -define float @foo(float %x) { +define float @foo(float %x) nounwind { %tmp1 = fmul float %x, 3.000000e+00 %tmp3 = fmul float %x, 5.000000e+00 %tmp5 = fmul float %x, 7.000000e+00 @@ -11,4 +10,10 @@ define float @foo(float %x) { %tmp12 = fadd float %tmp10, %tmp5 %tmp14 = fadd float %tmp12, %tmp7 ret float %tmp14 + +; CHECK: mulss LCPI1_2(%rip) +; CHECK-NEXT: addss +; CHECK-NEXT: mulss LCPI1_3(%rip) +; CHECK-NEXT: addss +; CHECK-NEXT: ret } diff --git a/libclamav/c++/llvm/test/CodeGen/X86/2008-07-11-SpillerBug.ll b/libclamav/c++/llvm/test/CodeGen/X86/2008-07-11-SpillerBug.ll index 1d9463886..d7a4892a5 100644 --- a/libclamav/c++/llvm/test/CodeGen/X86/2008-07-11-SpillerBug.ll +++ b/libclamav/c++/llvm/test/CodeGen/X86/2008-07-11-SpillerBug.ll @@ -1,7 +1,11 @@ -; RUN: llvm-as < %s | llc -march=x86 -relocation-model=static -disable-fp-elim |\ -; RUN: %prcontext 65534 1 | grep movl | count 1 +; RUN: llvm-as < %s | llc -march=x86 -relocation-model=static -disable-fp-elim | FileCheck %s ; PR2536 + +; CHECK: movw %ax +; CHECK-NEXT: andl $65534, % +; CHECK-NEXT: movl $17 + @g_5 = external global i16 ; [#uses=2] @g_107 = external global i16 ; [#uses=1] @g_229 = external global i32 ; [#uses=1] diff --git a/libclamav/c++/llvm/test/CodeGen/X86/2008-12-19-EarlyClobberBug.ll b/libclamav/c++/llvm/test/CodeGen/X86/2008-12-19-EarlyClobberBug.ll index c7fdfb269..ad1615b13 100644 --- a/libclamav/c++/llvm/test/CodeGen/X86/2008-12-19-EarlyClobberBug.ll +++ b/libclamav/c++/llvm/test/CodeGen/X86/2008-12-19-EarlyClobberBug.ll @@ -1,7 +1,12 @@ -; RUN: llvm-as < %s | llc -mtriple=i386-apple-darwin | %prcontext End 2 | grep mov +; RUN: llvm-as < %s | llc -mtriple=i386-apple-darwin | FileCheck %s ; PR3149 ; Make sure the copy after inline asm is not coalesced away. +; CHECK: ## InlineAsm End +; CHECK-NEXT: BB1_2: +; CHECK-NEXT: movl %esi, %eax + + @"\01LC" = internal constant [7 x i8] c"n0=%d\0A\00" ; <[7 x i8]*> [#uses=1] @llvm.used = appending global [1 x i8*] [ i8* bitcast (i32 (i64, i64)* @umoddi3 to i8*) ], section "llvm.metadata" ; <[1 x i8*]*> [#uses=0] diff --git a/libclamav/c++/llvm/test/CodeGen/X86/2009-03-25-TestBug.ll b/libclamav/c++/llvm/test/CodeGen/X86/2009-03-25-TestBug.ll index 2c330db71..9b22d12ff 100644 --- a/libclamav/c++/llvm/test/CodeGen/X86/2009-03-25-TestBug.ll +++ b/libclamav/c++/llvm/test/CodeGen/X86/2009-03-25-TestBug.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=x86 -o %t -f +; RUN: llvm-as < %s | llc -march=x86 -o %t ; RUN: not grep and %t ; RUN: not grep shr %t ; rdar://6661955 diff --git a/libclamav/c++/llvm/test/CodeGen/X86/2009-06-03-Win64SpillXMM.ll b/libclamav/c++/llvm/test/CodeGen/X86/2009-06-03-Win64SpillXMM.ll index 7dfb65a23..a0b13f754 100644 --- a/libclamav/c++/llvm/test/CodeGen/X86/2009-06-03-Win64SpillXMM.ll +++ b/libclamav/c++/llvm/test/CodeGen/X86/2009-06-03-Win64SpillXMM.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -o %t1 -f +; RUN: llvm-as < %s | llc -o %t1 ; RUN: grep "subq.*\\\$72, \\\%rsp" %t1 ; RUN: grep "movaps \\\%xmm8, 32\\\(\\\%rsp\\\)" %t1 ; RUN: grep "movaps \\\%xmm7, 48\\\(\\\%rsp\\\)" %t1 diff --git a/libclamav/c++/llvm/test/CodeGen/X86/2009-08-23-linkerprivate.ll b/libclamav/c++/llvm/test/CodeGen/X86/2009-08-23-linkerprivate.ll new file mode 100644 index 000000000..615c9633d --- /dev/null +++ b/libclamav/c++/llvm/test/CodeGen/X86/2009-08-23-linkerprivate.ll @@ -0,0 +1,8 @@ +; RUN: llvm-as < %s | llc -march=x86 -mtriple=i686-apple-darwin | FileCheck %s + +; ModuleID = '/Volumes/MacOS9/tests/WebKit/JavaScriptCore/profiler/ProfilerServer.mm' + +@"\01l_objc_msgSend_fixup_alloc" = linker_private hidden global i32 0, section "__DATA, __objc_msgrefs, coalesced", align 16 ; [#uses=0] + +; CHECK: .globl l_objc_msgSend_fixup_alloc +; CHECK: .weak_definition l_objc_msgSend_fixup_alloc diff --git a/libclamav/c++/llvm/test/CodeGen/X86/abi-isel.ll b/libclamav/c++/llvm/test/CodeGen/X86/abi-isel.ll index acfaf9c80..3f1d0b69a 100644 --- a/libclamav/c++/llvm/test/CodeGen/X86/abi-isel.ll +++ b/libclamav/c++/llvm/test/CodeGen/X86/abi-isel.ll @@ -1,169 +1,16 @@ -; RUN: llvm-as < %s | llc -mtriple=i686-unknown-linux-gnu -march=x86 -relocation-model=static -code-model=small > %t -; RUN: grep leal %t | count 33 -; RUN: grep movl %t | count 239 -; RUN: grep addl %t | count 20 -; RUN: grep subl %t | count 14 -; RUN: not grep leaq %t -; RUN: not grep movq %t -; RUN: not grep addq %t -; RUN: not grep subq %t -; RUN: not grep movabs %t -; RUN: not grep largecomm %t -; RUN: not grep _GLOBAL_OFFSET_TABLE_ %t -; RUN: not grep @GOT %t -; RUN: not grep @GOTOFF %t -; RUN: not grep @GOTPCREL %t -; RUN: not grep @GOTPLT %t -; RUN: not grep @PLT %t -; RUN: not grep @PLTOFF %t -; RUN: grep {call \\\*} %t | count 10 -; RUN: not grep %rip %t -; RUN: llvm-as < %s | llc -mtriple=i686-unknown-linux-gnu -march=x86 -relocation-model=pic -code-model=small > %t -; RUN: grep leal %t | count 43 -; RUN: grep movl %t | count 377 -; RUN: grep addl %t | count 179 -; RUN: grep subl %t | count 6 -; RUN: not grep leaq %t -; RUN: not grep movq %t -; RUN: not grep addq %t -; RUN: not grep subq %t -; RUN: not grep movabs %t -; RUN: not grep largecomm %t -; RUN: grep _GLOBAL_OFFSET_TABLE_ %t | count 148 -; RUN: grep @GOT %t | count 207 -; RUN: grep @GOTOFF %t | count 58 -; RUN: not grep @GOTPCREL %t -; RUN: not grep @GOTPLT %t -; RUN: grep @PLT %t | count 20 -; RUN: not grep @PLTOFF %t -; RUN: grep {call \\\*} %t | count 10 -; RUN: not grep {%rip} %t +; RUN: llvm-as < %s | llc -asm-verbose=0 -mtriple=i686-unknown-linux-gnu -march=x86 -relocation-model=static -code-model=small | FileCheck %s -check-prefix=LINUX-32-STATIC +; RUN: llvm-as < %s | llc -asm-verbose=0 -mtriple=i686-unknown-linux-gnu -march=x86 -relocation-model=static -code-model=small | FileCheck %s -check-prefix=LINUX-32-PIC -; RUN: llvm-as < %s | llc -mtriple=x86_64-unknown-linux-gnu -march=x86-64 -relocation-model=static -code-model=small | FileCheck %s -check-prefix=LINUX-64-STATIC +; RUN: llvm-as < %s | llc -asm-verbose=0 -mtriple=x86_64-unknown-linux-gnu -march=x86-64 -relocation-model=static -code-model=small | FileCheck %s -check-prefix=LINUX-64-STATIC +; RUN: llvm-as < %s | llc -asm-verbose=0 -mtriple=x86_64-unknown-linux-gnu -march=x86-64 -relocation-model=pic -code-model=small | FileCheck %s -check-prefix=LINUX-64-PIC -; RUN: llvm-as < %s | llc -mtriple=x86_64-unknown-linux-gnu -march=x86-64 -relocation-model=pic -code-model=small > %t -; RUN: not grep leal %t -; RUN: grep movl %t | count 98 -; RUN: not grep addl %t -; RUN: not grep subl %t -; RUN: grep leaq %t | count 59 -; RUN: grep movq %t | count 195 -; RUN: grep addq %t | count 36 -; RUN: grep subq %t | count 11 -; RUN: not grep movabs %t -; RUN: not grep largecomm %t -; RUN: not grep _GLOBAL_OFFSET_TABLE_ %t -; RUN: grep @GOT %t | count 149 -; RUN: not grep @GOTOFF %t -; RUN: grep @GOTPCREL %t | count 149 -; RUN: not grep @GOTPLT %t -; RUN: grep @PLT %t | count 20 -; RUN: not grep @PLTOFF %t -; RUN: grep {call \\\*} %t | count 10 -; RUN: grep {%rip} %t | count 207 +; RUN: llvm-as < %s | llc -asm-verbose=0 -mtriple=i686-apple-darwin -march=x86 -relocation-model=static -code-model=small | FileCheck %s -check-prefix=DARWIN-32-STATIC +; RUN: llvm-as < %s | llc -asm-verbose=0 -mtriple=i686-apple-darwin -march=x86 -relocation-model=dynamic-no-pic -code-model=small | FileCheck %s -check-prefix=DARWIN-32-DYNAMIC +; RUN: llvm-as < %s | llc -asm-verbose=0 -mtriple=i686-apple-darwin -march=x86 -relocation-model=pic -code-model=small | FileCheck %s -check-prefix=DARWIN-32-PIC - - -; RUN: llvm-as < %s | llc -mtriple=i686-apple-darwin -march=x86 -relocation-model=static -code-model=small > %t -; RUN: grep leal %t | count 33 -; RUN: grep movl %t | count 239 -; RUN: grep addl %t | count 20 -; RUN: grep subl %t | count 14 -; RUN: not grep leaq %t -; RUN: not grep movq %t -; RUN: not grep addq %t -; RUN: not grep subq %t -; RUN: not grep movabs %t -; RUN: not grep largecomm %t -; RUN: not grep _GLOBAL_OFFSET_TABLE_ %t -; RUN: not grep @GOT %t -; RUN: not grep @GOTOFF %t -; RUN: not grep @GOTPCREL %t -; RUN: not grep @GOTPLT %t -; RUN: not grep @PLT %t -; RUN: not grep @PLTOFF %t -; RUN: grep {call \\\*} %t | count 10 -; RUN: not grep %rip %t -; RUN: llvm-as < %s | llc -mtriple=i686-apple-darwin -march=x86 -relocation-model=dynamic-no-pic -code-model=small > %t -; RUN: grep leal %t | count 31 -; RUN: grep movl %t | count 312 -; RUN: grep addl %t | count 32 -; RUN: grep subl %t | count 14 -; RUN: not grep leaq %t -; RUN: not grep movq %t -; RUN: not grep addq %t -; RUN: not grep subq %t -; RUN: not grep movabs %t -; RUN: not grep largecomm %t -; RUN: not grep _GLOBAL_OFFSET_TABLE_ %t -; RUN: not grep @GOT %t -; RUN: not grep @GOTOFF %t -; RUN: not grep @GOTPCREL %t -; RUN: not grep @GOTPLT %t -; RUN: not grep @PLT %t -; RUN: not grep @PLTOFF %t -; RUN: grep {call \\\*} %t | count 10 -; RUN: not grep {%rip} %t -; RUN: llvm-as < %s | llc -mtriple=i686-apple-darwin -march=x86 -relocation-model=pic -code-model=small > %t -; RUN: grep leal %t | count 57 -; RUN: grep movl %t | count 292 -; RUN: grep addl %t | count 32 -; RUN: grep subl %t | count 14 -; RUN: not grep leaq %t -; RUN: not grep movq %t -; RUN: not grep addq %t -; RUN: not grep subq %t -; RUN: not grep movabs %t -; RUN: not grep largecomm %t -; RUN: not grep _GLOBAL_OFFSET_TABLE_ %t -; RUN: not grep @GOT %t -; RUN: not grep @GOTOFF %t -; RUN: not grep @GOTPCREL %t -; RUN: not grep @GOTPLT %t -; RUN: not grep @PLT %t -; RUN: not grep @PLTOFF %t -; RUN: grep {call \\\*} %t | count 10 -; RUN: not grep {%rip} %t -; RUN: llvm-as < %s | llc -mtriple=x86_64-apple-darwin -march=x86-64 -relocation-model=dynamic-no-pic -code-model=small > %t -; RUN: not grep leal %t -; RUN: grep movl %t | count 95 -; RUN: not grep addl %t -; RUN: not grep subl %t -; RUN: grep leaq %t | count 89 -; RUN: grep movq %t | count 142 -; RUN: grep addq %t | count 30 -; RUN: grep subq %t | count 12 -; RUN: not grep movabs %t -; RUN: not grep largecomm %t -; RUN: not grep _GLOBAL_OFFSET_TABLE_ %t -; RUN: grep @GOT %t | count 92 -; RUN: not grep @GOTOFF %t -; RUN: grep @GOTPCREL %t | count 92 -; RUN: not grep @GOTPLT %t -; RUN: not grep @PLT %t -; RUN: not grep @PLTOFF %t -; RUN: grep {call \\\*} %t | count 10 -; RUN: grep {%rip} %t | count 208 -; RUN: llvm-as < %s | llc -mtriple=x86_64-apple-darwin -march=x86-64 -relocation-model=pic -code-model=small > %t -; RUN: not grep leal %t -; RUN: grep movl %t | count 95 -; RUN: not grep addl %t -; RUN: not grep subl %t -; RUN: grep leaq %t | count 89 -; RUN: grep movq %t | count 142 -; RUN: grep addq %t | count 30 -; RUN: grep subq %t | count 12 -; RUN: not grep movabs %t -; RUN: not grep largecomm %t -; RUN: not grep _GLOBAL_OFFSET_TABLE_ %t -; RUN: grep @GOT %t | count 92 -; RUN: not grep @GOTOFF %t -; RUN: grep @GOTPCREL %t | count 92 -; RUN: not grep @GOTPLT %t -; RUN: not grep @PLT %t -; RUN: not grep @PLTOFF %t -; RUN: grep {call \\\*} %t | count 10 -; RUN: grep {%rip} %t | count 208 +; RUN: llvm-as < %s | llc -asm-verbose=0 -mtriple=x86_64-apple-darwin -march=x86-64 -relocation-model=static -code-model=small | FileCheck %s -check-prefix=DARWIN-64-STATIC +; RUN: llvm-as < %s | llc -asm-verbose=0 -mtriple=x86_64-apple-darwin -march=x86-64 -relocation-model=dynamic-no-pic -code-model=small | FileCheck %s -check-prefix=DARWIN-64-DYNAMIC +; RUN: llvm-as < %s | llc -asm-verbose=0 -mtriple=x86_64-apple-darwin -march=x86-64 -relocation-model=pic -code-model=small | FileCheck %s -check-prefix=DARWIN-64-PIC @src = external global [131072 x i32] @dst = external global [131072 x i32] @@ -194,6 +41,66 @@ entry: ; LINUX-64-STATIC: movl src(%rip), %eax ; LINUX-64-STATIC: movl %eax, dst ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: foo00: +; LINUX-32-STATIC: movl src, %eax +; LINUX-32-STATIC-NEXT: movl %eax, dst +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: foo00: +; LINUX-32-PIC: movl src, %eax +; LINUX-32-PIC-NEXT: movl %eax, dst +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: foo00: +; LINUX-64-PIC: movq src@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: movl (%rax), %eax +; LINUX-64-PIC-NEXT: movq dst@GOTPCREL(%rip), %rcx +; LINUX-64-PIC-NEXT: movl %eax, (%rcx) +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _foo00: +; DARWIN-32-STATIC: movl _src, %eax +; DARWIN-32-STATIC-NEXT: movl %eax, _dst +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _foo00: +; DARWIN-32-DYNAMIC: movl L_src$non_lazy_ptr, %eax +; DARWIN-32-DYNAMIC-NEXT: movl (%eax), %eax +; DARWIN-32-DYNAMIC-NEXT: movl L_dst$non_lazy_ptr, %ecx +; DARWIN-32-DYNAMIC-NEXT: movl %eax, (%ecx) +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _foo00: +; DARWIN-32-PIC: call "L1$pb" +; DARWIN-32-PIC-NEXT: "L1$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl L_src$non_lazy_ptr-"L1$pb"(%eax), %ecx +; DARWIN-32-PIC-NEXT: movl (%ecx), %ecx +; DARWIN-32-PIC-NEXT: movl L_dst$non_lazy_ptr-"L1$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: movl %ecx, (%eax) +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _foo00: +; DARWIN-64-STATIC: movq _src@GOTPCREL(%rip), %rax +; DARWIN-64-STATIC-NEXT: movl (%rax), %eax +; DARWIN-64-STATIC-NEXT: movq _dst@GOTPCREL(%rip), %rcx +; DARWIN-64-STATIC-NEXT: movl %eax, (%rcx) +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _foo00: +; DARWIN-64-DYNAMIC: movq _src@GOTPCREL(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: movl (%rax), %eax +; DARWIN-64-DYNAMIC-NEXT: movq _dst@GOTPCREL(%rip), %rcx +; DARWIN-64-DYNAMIC-NEXT: movl %eax, (%rcx) +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _foo00: +; DARWIN-64-PIC: movq _src@GOTPCREL(%rip), %rax +; DARWIN-64-PIC-NEXT: movl (%rax), %eax +; DARWIN-64-PIC-NEXT: movq _dst@GOTPCREL(%rip), %rcx +; DARWIN-64-PIC-NEXT: movl %eax, (%rcx) +; DARWIN-64-PIC-NEXT: ret } define void @fxo00() nounwind { @@ -206,6 +113,66 @@ entry: ; LINUX-64-STATIC: movl xsrc(%rip), %eax ; LINUX-64-STATIC: movl %eax, xdst ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: fxo00: +; LINUX-32-STATIC: movl xsrc, %eax +; LINUX-32-STATIC-NEXT: movl %eax, xdst +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: fxo00: +; LINUX-32-PIC: movl xsrc, %eax +; LINUX-32-PIC-NEXT: movl %eax, xdst +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: fxo00: +; LINUX-64-PIC: movq xsrc@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: movl (%rax), %eax +; LINUX-64-PIC-NEXT: movq xdst@GOTPCREL(%rip), %rcx +; LINUX-64-PIC-NEXT: movl %eax, (%rcx) +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _fxo00: +; DARWIN-32-STATIC: movl _xsrc, %eax +; DARWIN-32-STATIC-NEXT: movl %eax, _xdst +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _fxo00: +; DARWIN-32-DYNAMIC: movl L_xsrc$non_lazy_ptr, %eax +; DARWIN-32-DYNAMIC-NEXT: movl (%eax), %eax +; DARWIN-32-DYNAMIC-NEXT: movl L_xdst$non_lazy_ptr, %ecx +; DARWIN-32-DYNAMIC-NEXT: movl %eax, (%ecx) +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _fxo00: +; DARWIN-32-PIC: call "L2$pb" +; DARWIN-32-PIC-NEXT: "L2$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl L_xsrc$non_lazy_ptr-"L2$pb"(%eax), %ecx +; DARWIN-32-PIC-NEXT: movl (%ecx), %ecx +; DARWIN-32-PIC-NEXT: movl L_xdst$non_lazy_ptr-"L2$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: movl %ecx, (%eax) +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _fxo00: +; DARWIN-64-STATIC: movq _xsrc@GOTPCREL(%rip), %rax +; DARWIN-64-STATIC-NEXT: movl (%rax), %eax +; DARWIN-64-STATIC-NEXT: movq _xdst@GOTPCREL(%rip), %rcx +; DARWIN-64-STATIC-NEXT: movl %eax, (%rcx) +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _fxo00: +; DARWIN-64-DYNAMIC: movq _xsrc@GOTPCREL(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: movl (%rax), %eax +; DARWIN-64-DYNAMIC-NEXT: movq _xdst@GOTPCREL(%rip), %rcx +; DARWIN-64-DYNAMIC-NEXT: movl %eax, (%rcx) +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _fxo00: +; DARWIN-64-PIC: movq _xsrc@GOTPCREL(%rip), %rax +; DARWIN-64-PIC-NEXT: movl (%rax), %eax +; DARWIN-64-PIC-NEXT: movq _xdst@GOTPCREL(%rip), %rcx +; DARWIN-64-PIC-NEXT: movl %eax, (%rcx) +; DARWIN-64-PIC-NEXT: ret } define void @foo01() nounwind { @@ -215,6 +182,57 @@ entry: ; LINUX-64-STATIC: foo01: ; LINUX-64-STATIC: movq $dst, ptr ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: foo01: +; LINUX-32-STATIC: movl $dst, ptr +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: foo01: +; LINUX-32-PIC: movl $dst, ptr +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: foo01: +; LINUX-64-PIC: movq dst@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: movq ptr@GOTPCREL(%rip), %rcx +; LINUX-64-PIC-NEXT: movq %rax, (%rcx) +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _foo01: +; DARWIN-32-STATIC: movl $_dst, _ptr +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _foo01: +; DARWIN-32-DYNAMIC: movl L_dst$non_lazy_ptr, %eax +; DARWIN-32-DYNAMIC-NEXT: movl L_ptr$non_lazy_ptr, %ecx +; DARWIN-32-DYNAMIC-NEXT: movl %eax, (%ecx) +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _foo01: +; DARWIN-32-PIC: call "L3$pb" +; DARWIN-32-PIC-NEXT: "L3$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl L_dst$non_lazy_ptr-"L3$pb"(%eax), %ecx +; DARWIN-32-PIC-NEXT: movl L_ptr$non_lazy_ptr-"L3$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: movl %ecx, (%eax) +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _foo01: +; DARWIN-64-STATIC: movq _dst@GOTPCREL(%rip), %rax +; DARWIN-64-STATIC-NEXT: movq _ptr@GOTPCREL(%rip), %rcx +; DARWIN-64-STATIC-NEXT: movq %rax, (%rcx) +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _foo01: +; DARWIN-64-DYNAMIC: movq _dst@GOTPCREL(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: movq _ptr@GOTPCREL(%rip), %rcx +; DARWIN-64-DYNAMIC-NEXT: movq %rax, (%rcx) +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _foo01: +; DARWIN-64-PIC: movq _dst@GOTPCREL(%rip), %rax +; DARWIN-64-PIC-NEXT: movq _ptr@GOTPCREL(%rip), %rcx +; DARWIN-64-PIC-NEXT: movq %rax, (%rcx) +; DARWIN-64-PIC-NEXT: ret } define void @fxo01() nounwind { @@ -224,6 +242,57 @@ entry: ; LINUX-64-STATIC: fxo01: ; LINUX-64-STATIC: movq $xdst, ptr ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: fxo01: +; LINUX-32-STATIC: movl $xdst, ptr +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: fxo01: +; LINUX-32-PIC: movl $xdst, ptr +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: fxo01: +; LINUX-64-PIC: movq xdst@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: movq ptr@GOTPCREL(%rip), %rcx +; LINUX-64-PIC-NEXT: movq %rax, (%rcx) +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _fxo01: +; DARWIN-32-STATIC: movl $_xdst, _ptr +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _fxo01: +; DARWIN-32-DYNAMIC: movl L_xdst$non_lazy_ptr, %eax +; DARWIN-32-DYNAMIC-NEXT: movl L_ptr$non_lazy_ptr, %ecx +; DARWIN-32-DYNAMIC-NEXT: movl %eax, (%ecx) +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _fxo01: +; DARWIN-32-PIC: call "L4$pb" +; DARWIN-32-PIC-NEXT: "L4$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl L_xdst$non_lazy_ptr-"L4$pb"(%eax), %ecx +; DARWIN-32-PIC-NEXT: movl L_ptr$non_lazy_ptr-"L4$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: movl %ecx, (%eax) +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _fxo01: +; DARWIN-64-STATIC: movq _xdst@GOTPCREL(%rip), %rax +; DARWIN-64-STATIC-NEXT: movq _ptr@GOTPCREL(%rip), %rcx +; DARWIN-64-STATIC-NEXT: movq %rax, (%rcx) +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _fxo01: +; DARWIN-64-DYNAMIC: movq _xdst@GOTPCREL(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: movq _ptr@GOTPCREL(%rip), %rcx +; DARWIN-64-DYNAMIC-NEXT: movq %rax, (%rcx) +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _fxo01: +; DARWIN-64-PIC: movq _xdst@GOTPCREL(%rip), %rax +; DARWIN-64-PIC-NEXT: movq _ptr@GOTPCREL(%rip), %rcx +; DARWIN-64-PIC-NEXT: movq %rax, (%rcx) +; DARWIN-64-PIC-NEXT: ret } define void @foo02() nounwind { @@ -237,6 +306,75 @@ entry: ; LINUX-64-STATIC: movq ptr(%rip), % ; LINUX-64-STATIC: movl ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: foo02: +; LINUX-32-STATIC: movl src, %eax +; LINUX-32-STATIC-NEXT: movl ptr, %ecx +; LINUX-32-STATIC-NEXT: movl %eax, (%ecx) +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: foo02: +; LINUX-32-PIC: movl src, %eax +; LINUX-32-PIC-NEXT: movl ptr, %ecx +; LINUX-32-PIC-NEXT: movl %eax, (%ecx) +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: foo02: +; LINUX-64-PIC: movq src@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: movl (%rax), %eax +; LINUX-64-PIC-NEXT: movq ptr@GOTPCREL(%rip), %rcx +; LINUX-64-PIC-NEXT: movq (%rcx), %rcx +; LINUX-64-PIC-NEXT: movl %eax, (%rcx) +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _foo02: +; DARWIN-32-STATIC: movl _src, %eax +; DARWIN-32-STATIC-NEXT: movl _ptr, %ecx +; DARWIN-32-STATIC-NEXT: movl %eax, (%ecx) +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _foo02: +; DARWIN-32-DYNAMIC: movl L_src$non_lazy_ptr, %eax +; DARWIN-32-DYNAMIC-NEXT: movl (%eax), %eax +; DARWIN-32-DYNAMIC-NEXT: movl L_ptr$non_lazy_ptr, %ecx +; DARWIN-32-DYNAMIC-NEXT: movl (%ecx), %ecx +; DARWIN-32-DYNAMIC-NEXT: movl %eax, (%ecx) +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _foo02: +; DARWIN-32-PIC: call "L5$pb" +; DARWIN-32-PIC-NEXT: "L5$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl L_src$non_lazy_ptr-"L5$pb"(%eax), %ecx +; DARWIN-32-PIC-NEXT: movl (%ecx), %ecx +; DARWIN-32-PIC-NEXT: movl L_ptr$non_lazy_ptr-"L5$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: movl (%eax), %eax +; DARWIN-32-PIC-NEXT: movl %ecx, (%eax) +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _foo02: +; DARWIN-64-STATIC: movq _src@GOTPCREL(%rip), %rax +; DARWIN-64-STATIC-NEXT: movl (%rax), %eax +; DARWIN-64-STATIC-NEXT: movq _ptr@GOTPCREL(%rip), %rcx +; DARWIN-64-STATIC-NEXT: movq (%rcx), %rcx +; DARWIN-64-STATIC-NEXT: movl %eax, (%rcx) +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _foo02: +; DARWIN-64-DYNAMIC: movq _src@GOTPCREL(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: movl (%rax), %eax +; DARWIN-64-DYNAMIC-NEXT: movq _ptr@GOTPCREL(%rip), %rcx +; DARWIN-64-DYNAMIC-NEXT: movq (%rcx), %rcx +; DARWIN-64-DYNAMIC-NEXT: movl %eax, (%rcx) +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _foo02: +; DARWIN-64-PIC: movq _src@GOTPCREL(%rip), %rax +; DARWIN-64-PIC-NEXT: movl (%rax), %eax +; DARWIN-64-PIC-NEXT: movq _ptr@GOTPCREL(%rip), %rcx +; DARWIN-64-PIC-NEXT: movq (%rcx), %rcx +; DARWIN-64-PIC-NEXT: movl %eax, (%rcx) +; DARWIN-64-PIC-NEXT: ret } define void @fxo02() nounwind { @@ -249,7 +387,76 @@ entry: ; LINUX-64-STATIC: movq ptr(%rip), % ; LINUX-64-STATIC: movl ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: fxo02: +; LINUX-32-STATIC: movl xsrc, %eax +; LINUX-32-STATIC-NEXT: movl ptr, %ecx +; LINUX-32-STATIC-NEXT: movl %eax, (%ecx) +; LINUX-32-STATIC-NEXT: ret ret void + +; LINUX-32-PIC: fxo02: +; LINUX-32-PIC: movl xsrc, %eax +; LINUX-32-PIC-NEXT: movl ptr, %ecx +; LINUX-32-PIC-NEXT: movl %eax, (%ecx) +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: fxo02: +; LINUX-64-PIC: movq xsrc@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: movl (%rax), %eax +; LINUX-64-PIC-NEXT: movq ptr@GOTPCREL(%rip), %rcx +; LINUX-64-PIC-NEXT: movq (%rcx), %rcx +; LINUX-64-PIC-NEXT: movl %eax, (%rcx) +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _fxo02: +; DARWIN-32-STATIC: movl _xsrc, %eax +; DARWIN-32-STATIC-NEXT: movl _ptr, %ecx +; DARWIN-32-STATIC-NEXT: movl %eax, (%ecx) +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _fxo02: +; DARWIN-32-DYNAMIC: movl L_xsrc$non_lazy_ptr, %eax +; DARWIN-32-DYNAMIC-NEXT: movl (%eax), %eax +; DARWIN-32-DYNAMIC-NEXT: movl L_ptr$non_lazy_ptr, %ecx +; DARWIN-32-DYNAMIC-NEXT: movl (%ecx), %ecx +; DARWIN-32-DYNAMIC-NEXT: movl %eax, (%ecx) +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _fxo02: +; DARWIN-32-PIC: call "L6$pb" +; DARWIN-32-PIC-NEXT: "L6$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl L_xsrc$non_lazy_ptr-"L6$pb"(%eax), %ecx +; DARWIN-32-PIC-NEXT: movl (%ecx), %ecx +; DARWIN-32-PIC-NEXT: movl L_ptr$non_lazy_ptr-"L6$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: movl (%eax), %eax +; DARWIN-32-PIC-NEXT: movl %ecx, (%eax) +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _fxo02: +; DARWIN-64-STATIC: movq _xsrc@GOTPCREL(%rip), %rax +; DARWIN-64-STATIC-NEXT: movl (%rax), %eax +; DARWIN-64-STATIC-NEXT: movq _ptr@GOTPCREL(%rip), %rcx +; DARWIN-64-STATIC-NEXT: movq (%rcx), %rcx +; DARWIN-64-STATIC-NEXT: movl %eax, (%rcx) +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _fxo02: +; DARWIN-64-DYNAMIC: movq _xsrc@GOTPCREL(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: movl (%rax), %eax +; DARWIN-64-DYNAMIC-NEXT: movq _ptr@GOTPCREL(%rip), %rcx +; DARWIN-64-DYNAMIC-NEXT: movq (%rcx), %rcx +; DARWIN-64-DYNAMIC-NEXT: movl %eax, (%rcx) +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _fxo02: +; DARWIN-64-PIC: movq _xsrc@GOTPCREL(%rip), %rax +; DARWIN-64-PIC-NEXT: movl (%rax), %eax +; DARWIN-64-PIC-NEXT: movq _ptr@GOTPCREL(%rip), %rcx +; DARWIN-64-PIC-NEXT: movq (%rcx), %rcx +; DARWIN-64-PIC-NEXT: movl %eax, (%rcx) +; DARWIN-64-PIC-NEXT: ret } define void @foo03() nounwind { @@ -261,6 +468,56 @@ entry: ; LINUX-64-STATIC: movl dsrc(%rip), %eax ; LINUX-64-STATIC: movl %eax, ddst ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: foo03: +; LINUX-32-STATIC: movl dsrc, %eax +; LINUX-32-STATIC-NEXT: movl %eax, ddst +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: foo03: +; LINUX-32-PIC: movl dsrc, %eax +; LINUX-32-PIC-NEXT: movl %eax, ddst +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: foo03: +; LINUX-64-PIC: movq dsrc@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: movl (%rax), %eax +; LINUX-64-PIC-NEXT: movq ddst@GOTPCREL(%rip), %rcx +; LINUX-64-PIC-NEXT: movl %eax, (%rcx) +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _foo03: +; DARWIN-32-STATIC: movl _dsrc, %eax +; DARWIN-32-STATIC-NEXT: movl %eax, _ddst +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _foo03: +; DARWIN-32-DYNAMIC: movl _dsrc, %eax +; DARWIN-32-DYNAMIC-NEXT: movl %eax, _ddst +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _foo03: +; DARWIN-32-PIC: call "L7$pb" +; DARWIN-32-PIC-NEXT: "L7$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl _dsrc-"L7$pb"(%eax), %ecx +; DARWIN-32-PIC-NEXT: movl %ecx, _ddst-"L7$pb"(%eax) +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _foo03: +; DARWIN-64-STATIC: movl _dsrc(%rip), %eax +; DARWIN-64-STATIC-NEXT: movl %eax, _ddst(%rip) +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _foo03: +; DARWIN-64-DYNAMIC: movl _dsrc(%rip), %eax +; DARWIN-64-DYNAMIC-NEXT: movl %eax, _ddst(%rip) +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _foo03: +; DARWIN-64-PIC: movl _dsrc(%rip), %eax +; DARWIN-64-PIC-NEXT: movl %eax, _ddst(%rip) +; DARWIN-64-PIC-NEXT: ret } define void @foo04() nounwind { @@ -270,6 +527,51 @@ entry: ; LINUX-64-STATIC: foo04: ; LINUX-64-STATIC: movq $ddst, dptr ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: foo04: +; LINUX-32-STATIC: movl $ddst, dptr +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: foo04: +; LINUX-32-PIC: movl $ddst, dptr +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: foo04: +; LINUX-64-PIC: movq ddst@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: movq dptr@GOTPCREL(%rip), %rcx +; LINUX-64-PIC-NEXT: movq %rax, (%rcx) +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _foo04: +; DARWIN-32-STATIC: movl $_ddst, _dptr +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _foo04: +; DARWIN-32-DYNAMIC: movl $_ddst, _dptr +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _foo04: +; DARWIN-32-PIC: call "L8$pb" +; DARWIN-32-PIC-NEXT: "L8$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: leal _ddst-"L8$pb"(%eax), %ecx +; DARWIN-32-PIC-NEXT: movl %ecx, _dptr-"L8$pb"(%eax) +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _foo04: +; DARWIN-64-STATIC: leaq _ddst(%rip), %rax +; DARWIN-64-STATIC-NEXT: movq %rax, _dptr(%rip) +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _foo04: +; DARWIN-64-DYNAMIC: leaq _ddst(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: movq %rax, _dptr(%rip) +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _foo04: +; DARWIN-64-PIC: leaq _ddst(%rip), %rax +; DARWIN-64-PIC-NEXT: movq %rax, _dptr(%rip) +; DARWIN-64-PIC-NEXT: ret } define void @foo05() nounwind { @@ -283,6 +585,65 @@ entry: ; LINUX-64-STATIC: movq dptr(%rip), % ; LINUX-64-STATIC: movl ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: foo05: +; LINUX-32-STATIC: movl dsrc, %eax +; LINUX-32-STATIC-NEXT: movl dptr, %ecx +; LINUX-32-STATIC-NEXT: movl %eax, (%ecx) +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: foo05: +; LINUX-32-PIC: movl dsrc, %eax +; LINUX-32-PIC-NEXT: movl dptr, %ecx +; LINUX-32-PIC-NEXT: movl %eax, (%ecx) +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: foo05: +; LINUX-64-PIC: movq dsrc@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: movl (%rax), %eax +; LINUX-64-PIC-NEXT: movq dptr@GOTPCREL(%rip), %rcx +; LINUX-64-PIC-NEXT: movq (%rcx), %rcx +; LINUX-64-PIC-NEXT: movl %eax, (%rcx) +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _foo05: +; DARWIN-32-STATIC: movl _dsrc, %eax +; DARWIN-32-STATIC-NEXT: movl _dptr, %ecx +; DARWIN-32-STATIC-NEXT: movl %eax, (%ecx) +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _foo05: +; DARWIN-32-DYNAMIC: movl _dsrc, %eax +; DARWIN-32-DYNAMIC-NEXT: movl _dptr, %ecx +; DARWIN-32-DYNAMIC-NEXT: movl %eax, (%ecx) +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _foo05: +; DARWIN-32-PIC: call "L9$pb" +; DARWIN-32-PIC-NEXT: "L9$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl _dsrc-"L9$pb"(%eax), %ecx +; DARWIN-32-PIC-NEXT: movl _dptr-"L9$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: movl %ecx, (%eax) +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _foo05: +; DARWIN-64-STATIC: movl _dsrc(%rip), %eax +; DARWIN-64-STATIC-NEXT: movq _dptr(%rip), %rcx +; DARWIN-64-STATIC-NEXT: movl %eax, (%rcx) +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _foo05: +; DARWIN-64-DYNAMIC: movl _dsrc(%rip), %eax +; DARWIN-64-DYNAMIC-NEXT: movq _dptr(%rip), %rcx +; DARWIN-64-DYNAMIC-NEXT: movl %eax, (%rcx) +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _foo05: +; DARWIN-64-PIC: movl _dsrc(%rip), %eax +; DARWIN-64-PIC-NEXT: movq _dptr(%rip), %rcx +; DARWIN-64-PIC-NEXT: movl %eax, (%rcx) +; DARWIN-64-PIC-NEXT: ret } define void @foo06() nounwind { @@ -294,6 +655,54 @@ entry: ; LINUX-64-STATIC: movl lsrc(%rip), %eax ; LINUX-64-STATIC: movl %eax, ldst(%rip) ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: foo06: +; LINUX-32-STATIC: movl lsrc, %eax +; LINUX-32-STATIC-NEXT: movl %eax, ldst +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: foo06: +; LINUX-32-PIC: movl lsrc, %eax +; LINUX-32-PIC-NEXT: movl %eax, ldst +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: foo06: +; LINUX-64-PIC: movl lsrc(%rip), %eax +; LINUX-64-PIC-NEXT: movl %eax, ldst(%rip) +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _foo06: +; DARWIN-32-STATIC: movl _lsrc, %eax +; DARWIN-32-STATIC-NEXT: movl %eax, _ldst +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _foo06: +; DARWIN-32-DYNAMIC: movl _lsrc, %eax +; DARWIN-32-DYNAMIC-NEXT: movl %eax, _ldst +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _foo06: +; DARWIN-32-PIC: call "L10$pb" +; DARWIN-32-PIC-NEXT: "L10$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl _lsrc-"L10$pb"(%eax), %ecx +; DARWIN-32-PIC-NEXT: movl %ecx, _ldst-"L10$pb"(%eax) +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _foo06: +; DARWIN-64-STATIC: movl _lsrc(%rip), %eax +; DARWIN-64-STATIC-NEXT: movl %eax, _ldst(%rip) +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _foo06: +; DARWIN-64-DYNAMIC: movl _lsrc(%rip), %eax +; DARWIN-64-DYNAMIC-NEXT: movl %eax, _ldst(%rip) +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _foo06: +; DARWIN-64-PIC: movl _lsrc(%rip), %eax +; DARWIN-64-PIC-NEXT: movl %eax, _ldst(%rip) +; DARWIN-64-PIC-NEXT: ret } define void @foo07() nounwind { @@ -303,6 +712,50 @@ entry: ; LINUX-64-STATIC: foo07: ; LINUX-64-STATIC: movq $ldst, lptr ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: foo07: +; LINUX-32-STATIC: movl $ldst, lptr +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: foo07: +; LINUX-32-PIC: movl $ldst, lptr +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: foo07: +; LINUX-64-PIC: leaq ldst(%rip), %rax +; LINUX-64-PIC-NEXT: movq %rax, lptr(%rip) +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _foo07: +; DARWIN-32-STATIC: movl $_ldst, _lptr +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _foo07: +; DARWIN-32-DYNAMIC: movl $_ldst, _lptr +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _foo07: +; DARWIN-32-PIC: call "L11$pb" +; DARWIN-32-PIC-NEXT: "L11$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: leal _ldst-"L11$pb"(%eax), %ecx +; DARWIN-32-PIC-NEXT: movl %ecx, _lptr-"L11$pb"(%eax) +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _foo07: +; DARWIN-64-STATIC: leaq _ldst(%rip), %rax +; DARWIN-64-STATIC-NEXT: movq %rax, _lptr(%rip) +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _foo07: +; DARWIN-64-DYNAMIC: leaq _ldst(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: movq %rax, _lptr(%rip) +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _foo07: +; DARWIN-64-PIC: leaq _ldst(%rip), %rax +; DARWIN-64-PIC-NEXT: movq %rax, _lptr(%rip) +; DARWIN-64-PIC-NEXT: ret } define void @foo08() nounwind { @@ -316,6 +769,63 @@ entry: ; LINUX-64-STATIC: movq lptr(%rip), % ; LINUX-64-STATIC: movl ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: foo08: +; LINUX-32-STATIC: movl lsrc, %eax +; LINUX-32-STATIC-NEXT: movl lptr, %ecx +; LINUX-32-STATIC-NEXT: movl %eax, (%ecx) +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: foo08: +; LINUX-32-PIC: movl lsrc, %eax +; LINUX-32-PIC-NEXT: movl lptr, %ecx +; LINUX-32-PIC-NEXT: movl %eax, (%ecx) +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: foo08: +; LINUX-64-PIC: movl lsrc(%rip), %eax +; LINUX-64-PIC-NEXT: movq lptr(%rip), %rcx +; LINUX-64-PIC-NEXT: movl %eax, (%rcx) +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _foo08: +; DARWIN-32-STATIC: movl _lsrc, %eax +; DARWIN-32-STATIC-NEXT: movl _lptr, %ecx +; DARWIN-32-STATIC-NEXT: movl %eax, (%ecx) +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _foo08: +; DARWIN-32-DYNAMIC: movl _lsrc, %eax +; DARWIN-32-DYNAMIC-NEXT: movl _lptr, %ecx +; DARWIN-32-DYNAMIC-NEXT: movl %eax, (%ecx) +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _foo08: +; DARWIN-32-PIC: call "L12$pb" +; DARWIN-32-PIC-NEXT: "L12$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl _lsrc-"L12$pb"(%eax), %ecx +; DARWIN-32-PIC-NEXT: movl _lptr-"L12$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: movl %ecx, (%eax) +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _foo08: +; DARWIN-64-STATIC: movl _lsrc(%rip), %eax +; DARWIN-64-STATIC-NEXT: movq _lptr(%rip), %rcx +; DARWIN-64-STATIC-NEXT: movl %eax, (%rcx) +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _foo08: +; DARWIN-64-DYNAMIC: movl _lsrc(%rip), %eax +; DARWIN-64-DYNAMIC-NEXT: movq _lptr(%rip), %rcx +; DARWIN-64-DYNAMIC-NEXT: movl %eax, (%rcx) +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _foo08: +; DARWIN-64-PIC: movl _lsrc(%rip), %eax +; DARWIN-64-PIC-NEXT: movq _lptr(%rip), %rcx +; DARWIN-64-PIC-NEXT: movl %eax, (%rcx) +; DARWIN-64-PIC-NEXT: ret } define void @qux00() nounwind { @@ -327,6 +837,66 @@ entry: ; LINUX-64-STATIC: movl src+64(%rip), %eax ; LINUX-64-STATIC: movl %eax, dst+64(%rip) ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: qux00: +; LINUX-32-STATIC: movl src+64, %eax +; LINUX-32-STATIC-NEXT: movl %eax, dst+64 +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: qux00: +; LINUX-32-PIC: movl src+64, %eax +; LINUX-32-PIC-NEXT: movl %eax, dst+64 +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: qux00: +; LINUX-64-PIC: movq src@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: movl 64(%rax), %eax +; LINUX-64-PIC-NEXT: movq dst@GOTPCREL(%rip), %rcx +; LINUX-64-PIC-NEXT: movl %eax, 64(%rcx) +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _qux00: +; DARWIN-32-STATIC: movl _src+64, %eax +; DARWIN-32-STATIC-NEXT: movl %eax, _dst+64 +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _qux00: +; DARWIN-32-DYNAMIC: movl L_src$non_lazy_ptr, %eax +; DARWIN-32-DYNAMIC-NEXT: movl 64(%eax), %eax +; DARWIN-32-DYNAMIC-NEXT: movl L_dst$non_lazy_ptr, %ecx +; DARWIN-32-DYNAMIC-NEXT: movl %eax, 64(%ecx) +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _qux00: +; DARWIN-32-PIC: call "L13$pb" +; DARWIN-32-PIC-NEXT: "L13$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl L_src$non_lazy_ptr-"L13$pb"(%eax), %ecx +; DARWIN-32-PIC-NEXT: movl 64(%ecx), %ecx +; DARWIN-32-PIC-NEXT: movl L_dst$non_lazy_ptr-"L13$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: movl %ecx, 64(%eax) +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _qux00: +; DARWIN-64-STATIC: movq _src@GOTPCREL(%rip), %rax +; DARWIN-64-STATIC-NEXT: movl 64(%rax), %eax +; DARWIN-64-STATIC-NEXT: movq _dst@GOTPCREL(%rip), %rcx +; DARWIN-64-STATIC-NEXT: movl %eax, 64(%rcx) +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _qux00: +; DARWIN-64-DYNAMIC: movq _src@GOTPCREL(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: movl 64(%rax), %eax +; DARWIN-64-DYNAMIC-NEXT: movq _dst@GOTPCREL(%rip), %rcx +; DARWIN-64-DYNAMIC-NEXT: movl %eax, 64(%rcx) +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _qux00: +; DARWIN-64-PIC: movq _src@GOTPCREL(%rip), %rax +; DARWIN-64-PIC-NEXT: movl 64(%rax), %eax +; DARWIN-64-PIC-NEXT: movq _dst@GOTPCREL(%rip), %rcx +; DARWIN-64-PIC-NEXT: movl %eax, 64(%rcx) +; DARWIN-64-PIC-NEXT: ret } define void @qxx00() nounwind { @@ -338,6 +908,66 @@ entry: ; LINUX-64-STATIC: movl xsrc+64(%rip), %eax ; LINUX-64-STATIC: movl %eax, xdst+64(%rip) ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: qxx00: +; LINUX-32-STATIC: movl xsrc+64, %eax +; LINUX-32-STATIC-NEXT: movl %eax, xdst+64 +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: qxx00: +; LINUX-32-PIC: movl xsrc+64, %eax +; LINUX-32-PIC-NEXT: movl %eax, xdst+64 +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: qxx00: +; LINUX-64-PIC: movq xsrc@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: movl 64(%rax), %eax +; LINUX-64-PIC-NEXT: movq xdst@GOTPCREL(%rip), %rcx +; LINUX-64-PIC-NEXT: movl %eax, 64(%rcx) +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _qxx00: +; DARWIN-32-STATIC: movl _xsrc+64, %eax +; DARWIN-32-STATIC-NEXT: movl %eax, _xdst+64 +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _qxx00: +; DARWIN-32-DYNAMIC: movl L_xsrc$non_lazy_ptr, %eax +; DARWIN-32-DYNAMIC-NEXT: movl 64(%eax), %eax +; DARWIN-32-DYNAMIC-NEXT: movl L_xdst$non_lazy_ptr, %ecx +; DARWIN-32-DYNAMIC-NEXT: movl %eax, 64(%ecx) +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _qxx00: +; DARWIN-32-PIC: call "L14$pb" +; DARWIN-32-PIC-NEXT: "L14$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl L_xsrc$non_lazy_ptr-"L14$pb"(%eax), %ecx +; DARWIN-32-PIC-NEXT: movl 64(%ecx), %ecx +; DARWIN-32-PIC-NEXT: movl L_xdst$non_lazy_ptr-"L14$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: movl %ecx, 64(%eax) +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _qxx00: +; DARWIN-64-STATIC: movq _xsrc@GOTPCREL(%rip), %rax +; DARWIN-64-STATIC-NEXT: movl 64(%rax), %eax +; DARWIN-64-STATIC-NEXT: movq _xdst@GOTPCREL(%rip), %rcx +; DARWIN-64-STATIC-NEXT: movl %eax, 64(%rcx) +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _qxx00: +; DARWIN-64-DYNAMIC: movq _xsrc@GOTPCREL(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: movl 64(%rax), %eax +; DARWIN-64-DYNAMIC-NEXT: movq _xdst@GOTPCREL(%rip), %rcx +; DARWIN-64-DYNAMIC-NEXT: movl %eax, 64(%rcx) +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _qxx00: +; DARWIN-64-PIC: movq _xsrc@GOTPCREL(%rip), %rax +; DARWIN-64-PIC-NEXT: movl 64(%rax), %eax +; DARWIN-64-PIC-NEXT: movq _xdst@GOTPCREL(%rip), %rcx +; DARWIN-64-PIC-NEXT: movl %eax, 64(%rcx) +; DARWIN-64-PIC-NEXT: ret } define void @qux01() nounwind { @@ -347,6 +977,63 @@ entry: ; LINUX-64-STATIC: qux01: ; LINUX-64-STATIC: movq $dst+64, ptr ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: qux01: +; LINUX-32-STATIC: movl $dst+64, ptr +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: qux01: +; LINUX-32-PIC: movl $dst+64, ptr +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: qux01: +; LINUX-64-PIC: movq dst@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: addq $64, %rax +; LINUX-64-PIC-NEXT: movq ptr@GOTPCREL(%rip), %rcx +; LINUX-64-PIC-NEXT: movq %rax, (%rcx) +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _qux01: +; DARWIN-32-STATIC: movl $_dst+64, _ptr +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _qux01: +; DARWIN-32-DYNAMIC: movl L_dst$non_lazy_ptr, %eax +; DARWIN-32-DYNAMIC-NEXT: addl $64, %eax +; DARWIN-32-DYNAMIC-NEXT: movl L_ptr$non_lazy_ptr, %ecx +; DARWIN-32-DYNAMIC-NEXT: movl %eax, (%ecx) +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _qux01: +; DARWIN-32-PIC: call "L15$pb" +; DARWIN-32-PIC-NEXT: "L15$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl L_dst$non_lazy_ptr-"L15$pb"(%eax), %ecx +; DARWIN-32-PIC-NEXT: addl $64, %ecx +; DARWIN-32-PIC-NEXT: movl L_ptr$non_lazy_ptr-"L15$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: movl %ecx, (%eax) +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _qux01: +; DARWIN-64-STATIC: movq _dst@GOTPCREL(%rip), %rax +; DARWIN-64-STATIC-NEXT: addq $64, %rax +; DARWIN-64-STATIC-NEXT: movq _ptr@GOTPCREL(%rip), %rcx +; DARWIN-64-STATIC-NEXT: movq %rax, (%rcx) +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _qux01: +; DARWIN-64-DYNAMIC: movq _dst@GOTPCREL(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: addq $64, %rax +; DARWIN-64-DYNAMIC-NEXT: movq _ptr@GOTPCREL(%rip), %rcx +; DARWIN-64-DYNAMIC-NEXT: movq %rax, (%rcx) +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _qux01: +; DARWIN-64-PIC: movq _dst@GOTPCREL(%rip), %rax +; DARWIN-64-PIC-NEXT: addq $64, %rax +; DARWIN-64-PIC-NEXT: movq _ptr@GOTPCREL(%rip), %rcx +; DARWIN-64-PIC-NEXT: movq %rax, (%rcx) +; DARWIN-64-PIC-NEXT: ret } define void @qxx01() nounwind { @@ -356,6 +1043,63 @@ entry: ; LINUX-64-STATIC: qxx01: ; LINUX-64-STATIC: movq $xdst+64, ptr ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: qxx01: +; LINUX-32-STATIC: movl $xdst+64, ptr +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: qxx01: +; LINUX-32-PIC: movl $xdst+64, ptr +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: qxx01: +; LINUX-64-PIC: movq xdst@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: addq $64, %rax +; LINUX-64-PIC-NEXT: movq ptr@GOTPCREL(%rip), %rcx +; LINUX-64-PIC-NEXT: movq %rax, (%rcx) +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _qxx01: +; DARWIN-32-STATIC: movl $_xdst+64, _ptr +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _qxx01: +; DARWIN-32-DYNAMIC: movl L_xdst$non_lazy_ptr, %eax +; DARWIN-32-DYNAMIC-NEXT: addl $64, %eax +; DARWIN-32-DYNAMIC-NEXT: movl L_ptr$non_lazy_ptr, %ecx +; DARWIN-32-DYNAMIC-NEXT: movl %eax, (%ecx) +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _qxx01: +; DARWIN-32-PIC: call "L16$pb" +; DARWIN-32-PIC-NEXT: "L16$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl L_xdst$non_lazy_ptr-"L16$pb"(%eax), %ecx +; DARWIN-32-PIC-NEXT: addl $64, %ecx +; DARWIN-32-PIC-NEXT: movl L_ptr$non_lazy_ptr-"L16$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: movl %ecx, (%eax) +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _qxx01: +; DARWIN-64-STATIC: movq _xdst@GOTPCREL(%rip), %rax +; DARWIN-64-STATIC-NEXT: addq $64, %rax +; DARWIN-64-STATIC-NEXT: movq _ptr@GOTPCREL(%rip), %rcx +; DARWIN-64-STATIC-NEXT: movq %rax, (%rcx) +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _qxx01: +; DARWIN-64-DYNAMIC: movq _xdst@GOTPCREL(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: addq $64, %rax +; DARWIN-64-DYNAMIC-NEXT: movq _ptr@GOTPCREL(%rip), %rcx +; DARWIN-64-DYNAMIC-NEXT: movq %rax, (%rcx) +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _qxx01: +; DARWIN-64-PIC: movq _xdst@GOTPCREL(%rip), %rax +; DARWIN-64-PIC-NEXT: addq $64, %rax +; DARWIN-64-PIC-NEXT: movq _ptr@GOTPCREL(%rip), %rcx +; DARWIN-64-PIC-NEXT: movq %rax, (%rcx) +; DARWIN-64-PIC-NEXT: ret } define void @qux02() nounwind { @@ -369,7 +1113,76 @@ entry: ; LINUX-64-STATIC: movq ptr(%rip), %rcx ; LINUX-64-STATIC: movl %eax, 64(%rcx) ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: qux02: +; LINUX-32-STATIC: movl src+64, %eax +; LINUX-32-STATIC-NEXT: movl ptr, %ecx +; LINUX-32-STATIC-NEXT: movl %eax, 64(%ecx) +; LINUX-32-STATIC-NEXT: ret ret void + +; LINUX-32-PIC: qux02: +; LINUX-32-PIC: movl src+64, %eax +; LINUX-32-PIC-NEXT: movl ptr, %ecx +; LINUX-32-PIC-NEXT: movl %eax, 64(%ecx) +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: qux02: +; LINUX-64-PIC: movq src@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: movl 64(%rax), %eax +; LINUX-64-PIC-NEXT: movq ptr@GOTPCREL(%rip), %rcx +; LINUX-64-PIC-NEXT: movq (%rcx), %rcx +; LINUX-64-PIC-NEXT: movl %eax, 64(%rcx) +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _qux02: +; DARWIN-32-STATIC: movl _src+64, %eax +; DARWIN-32-STATIC-NEXT: movl _ptr, %ecx +; DARWIN-32-STATIC-NEXT: movl %eax, 64(%ecx) +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _qux02: +; DARWIN-32-DYNAMIC: movl L_src$non_lazy_ptr, %eax +; DARWIN-32-DYNAMIC-NEXT: movl 64(%eax), %eax +; DARWIN-32-DYNAMIC-NEXT: movl L_ptr$non_lazy_ptr, %ecx +; DARWIN-32-DYNAMIC-NEXT: movl (%ecx), %ecx +; DARWIN-32-DYNAMIC-NEXT: movl %eax, 64(%ecx) +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _qux02: +; DARWIN-32-PIC: call "L17$pb" +; DARWIN-32-PIC-NEXT: "L17$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl L_src$non_lazy_ptr-"L17$pb"(%eax), %ecx +; DARWIN-32-PIC-NEXT: movl 64(%ecx), %ecx +; DARWIN-32-PIC-NEXT: movl L_ptr$non_lazy_ptr-"L17$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: movl (%eax), %eax +; DARWIN-32-PIC-NEXT: movl %ecx, 64(%eax) +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _qux02: +; DARWIN-64-STATIC: movq _src@GOTPCREL(%rip), %rax +; DARWIN-64-STATIC-NEXT: movl 64(%rax), %eax +; DARWIN-64-STATIC-NEXT: movq _ptr@GOTPCREL(%rip), %rcx +; DARWIN-64-STATIC-NEXT: movq (%rcx), %rcx +; DARWIN-64-STATIC-NEXT: movl %eax, 64(%rcx) +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _qux02: +; DARWIN-64-DYNAMIC: movq _src@GOTPCREL(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: movl 64(%rax), %eax +; DARWIN-64-DYNAMIC-NEXT: movq _ptr@GOTPCREL(%rip), %rcx +; DARWIN-64-DYNAMIC-NEXT: movq (%rcx), %rcx +; DARWIN-64-DYNAMIC-NEXT: movl %eax, 64(%rcx) +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _qux02: +; DARWIN-64-PIC: movq _src@GOTPCREL(%rip), %rax +; DARWIN-64-PIC-NEXT: movl 64(%rax), %eax +; DARWIN-64-PIC-NEXT: movq _ptr@GOTPCREL(%rip), %rcx +; DARWIN-64-PIC-NEXT: movq (%rcx), %rcx +; DARWIN-64-PIC-NEXT: movl %eax, 64(%rcx) +; DARWIN-64-PIC-NEXT: ret } define void @qxx02() nounwind { @@ -383,7 +1196,76 @@ entry: ; LINUX-64-STATIC: movq ptr(%rip), %rcx ; LINUX-64-STATIC: movl %eax, 64(%rcx) ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: qxx02: +; LINUX-32-STATIC: movl xsrc+64, %eax +; LINUX-32-STATIC-NEXT: movl ptr, %ecx +; LINUX-32-STATIC-NEXT: movl %eax, 64(%ecx) +; LINUX-32-STATIC-NEXT: ret ret void + +; LINUX-32-PIC: qxx02: +; LINUX-32-PIC: movl xsrc+64, %eax +; LINUX-32-PIC-NEXT: movl ptr, %ecx +; LINUX-32-PIC-NEXT: movl %eax, 64(%ecx) +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: qxx02: +; LINUX-64-PIC: movq xsrc@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: movl 64(%rax), %eax +; LINUX-64-PIC-NEXT: movq ptr@GOTPCREL(%rip), %rcx +; LINUX-64-PIC-NEXT: movq (%rcx), %rcx +; LINUX-64-PIC-NEXT: movl %eax, 64(%rcx) +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _qxx02: +; DARWIN-32-STATIC: movl _xsrc+64, %eax +; DARWIN-32-STATIC-NEXT: movl _ptr, %ecx +; DARWIN-32-STATIC-NEXT: movl %eax, 64(%ecx) +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _qxx02: +; DARWIN-32-DYNAMIC: movl L_xsrc$non_lazy_ptr, %eax +; DARWIN-32-DYNAMIC-NEXT: movl 64(%eax), %eax +; DARWIN-32-DYNAMIC-NEXT: movl L_ptr$non_lazy_ptr, %ecx +; DARWIN-32-DYNAMIC-NEXT: movl (%ecx), %ecx +; DARWIN-32-DYNAMIC-NEXT: movl %eax, 64(%ecx) +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _qxx02: +; DARWIN-32-PIC: call "L18$pb" +; DARWIN-32-PIC-NEXT: "L18$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl L_xsrc$non_lazy_ptr-"L18$pb"(%eax), %ecx +; DARWIN-32-PIC-NEXT: movl 64(%ecx), %ecx +; DARWIN-32-PIC-NEXT: movl L_ptr$non_lazy_ptr-"L18$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: movl (%eax), %eax +; DARWIN-32-PIC-NEXT: movl %ecx, 64(%eax) +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _qxx02: +; DARWIN-64-STATIC: movq _xsrc@GOTPCREL(%rip), %rax +; DARWIN-64-STATIC-NEXT: movl 64(%rax), %eax +; DARWIN-64-STATIC-NEXT: movq _ptr@GOTPCREL(%rip), %rcx +; DARWIN-64-STATIC-NEXT: movq (%rcx), %rcx +; DARWIN-64-STATIC-NEXT: movl %eax, 64(%rcx) +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _qxx02: +; DARWIN-64-DYNAMIC: movq _xsrc@GOTPCREL(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: movl 64(%rax), %eax +; DARWIN-64-DYNAMIC-NEXT: movq _ptr@GOTPCREL(%rip), %rcx +; DARWIN-64-DYNAMIC-NEXT: movq (%rcx), %rcx +; DARWIN-64-DYNAMIC-NEXT: movl %eax, 64(%rcx) +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _qxx02: +; DARWIN-64-PIC: movq _xsrc@GOTPCREL(%rip), %rax +; DARWIN-64-PIC-NEXT: movl 64(%rax), %eax +; DARWIN-64-PIC-NEXT: movq _ptr@GOTPCREL(%rip), %rcx +; DARWIN-64-PIC-NEXT: movq (%rcx), %rcx +; DARWIN-64-PIC-NEXT: movl %eax, 64(%rcx) +; DARWIN-64-PIC-NEXT: ret } define void @qux03() nounwind { @@ -395,6 +1277,56 @@ entry: ; LINUX-64-STATIC: movl dsrc+64(%rip), %eax ; LINUX-64-STATIC: movl %eax, ddst+64(%rip) ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: qux03: +; LINUX-32-STATIC: movl dsrc+64, %eax +; LINUX-32-STATIC-NEXT: movl %eax, ddst+64 +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: qux03: +; LINUX-32-PIC: movl dsrc+64, %eax +; LINUX-32-PIC-NEXT: movl %eax, ddst+64 +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: qux03: +; LINUX-64-PIC: movq dsrc@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: movl 64(%rax), %eax +; LINUX-64-PIC-NEXT: movq ddst@GOTPCREL(%rip), %rcx +; LINUX-64-PIC-NEXT: movl %eax, 64(%rcx) +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _qux03: +; DARWIN-32-STATIC: movl _dsrc+64, %eax +; DARWIN-32-STATIC-NEXT: movl %eax, _ddst+64 +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _qux03: +; DARWIN-32-DYNAMIC: movl _dsrc+64, %eax +; DARWIN-32-DYNAMIC-NEXT: movl %eax, _ddst+64 +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _qux03: +; DARWIN-32-PIC: call "L19$pb" +; DARWIN-32-PIC-NEXT: "L19$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl _dsrc+64-"L19$pb"(%eax), %ecx +; DARWIN-32-PIC-NEXT: movl %ecx, _ddst+64-"L19$pb"(%eax) +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _qux03: +; DARWIN-64-STATIC: movl _dsrc+64(%rip), %eax +; DARWIN-64-STATIC-NEXT: movl %eax, _ddst+64(%rip) +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _qux03: +; DARWIN-64-DYNAMIC: movl _dsrc+64(%rip), %eax +; DARWIN-64-DYNAMIC-NEXT: movl %eax, _ddst+64(%rip) +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _qux03: +; DARWIN-64-PIC: movl _dsrc+64(%rip), %eax +; DARWIN-64-PIC-NEXT: movl %eax, _ddst+64(%rip) +; DARWIN-64-PIC-NEXT: ret } define void @qux04() nounwind { @@ -404,6 +1336,52 @@ entry: ; LINUX-64-STATIC: qux04: ; LINUX-64-STATIC: movq $ddst+64, dptr(%rip) ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: qux04: +; LINUX-32-STATIC: movl $ddst+64, dptr +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: qux04: +; LINUX-32-PIC: movl $ddst+64, dptr +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: qux04: +; LINUX-64-PIC: movq ddst@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: addq $64, %rax +; LINUX-64-PIC-NEXT: movq dptr@GOTPCREL(%rip), %rcx +; LINUX-64-PIC-NEXT: movq %rax, (%rcx) +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _qux04: +; DARWIN-32-STATIC: movl $_ddst+64, _dptr +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _qux04: +; DARWIN-32-DYNAMIC: movl $_ddst+64, _dptr +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _qux04: +; DARWIN-32-PIC: call "L20$pb" +; DARWIN-32-PIC-NEXT: "L20$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: leal _ddst+64-"L20$pb"(%eax), %ecx +; DARWIN-32-PIC-NEXT: movl %ecx, _dptr-"L20$pb"(%eax) +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _qux04: +; DARWIN-64-STATIC: leaq _ddst+64(%rip), %rax +; DARWIN-64-STATIC-NEXT: movq %rax, _dptr(%rip) +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _qux04: +; DARWIN-64-DYNAMIC: leaq _ddst+64(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: movq %rax, _dptr(%rip) +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _qux04: +; DARWIN-64-PIC: leaq _ddst+64(%rip), %rax +; DARWIN-64-PIC-NEXT: movq %rax, _dptr(%rip) +; DARWIN-64-PIC-NEXT: ret } define void @qux05() nounwind { @@ -417,7 +1395,66 @@ entry: ; LINUX-64-STATIC: movq dptr(%rip), %rcx ; LINUX-64-STATIC: movl %eax, 64(%rcx) ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: qux05: +; LINUX-32-STATIC: movl dsrc+64, %eax +; LINUX-32-STATIC-NEXT: movl dptr, %ecx +; LINUX-32-STATIC-NEXT: movl %eax, 64(%ecx) +; LINUX-32-STATIC-NEXT: ret ret void + +; LINUX-32-PIC: qux05: +; LINUX-32-PIC: movl dsrc+64, %eax +; LINUX-32-PIC-NEXT: movl dptr, %ecx +; LINUX-32-PIC-NEXT: movl %eax, 64(%ecx) +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: qux05: +; LINUX-64-PIC: movq dsrc@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: movl 64(%rax), %eax +; LINUX-64-PIC-NEXT: movq dptr@GOTPCREL(%rip), %rcx +; LINUX-64-PIC-NEXT: movq (%rcx), %rcx +; LINUX-64-PIC-NEXT: movl %eax, 64(%rcx) +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _qux05: +; DARWIN-32-STATIC: movl _dsrc+64, %eax +; DARWIN-32-STATIC-NEXT: movl _dptr, %ecx +; DARWIN-32-STATIC-NEXT: movl %eax, 64(%ecx) +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _qux05: +; DARWIN-32-DYNAMIC: movl _dsrc+64, %eax +; DARWIN-32-DYNAMIC-NEXT: movl _dptr, %ecx +; DARWIN-32-DYNAMIC-NEXT: movl %eax, 64(%ecx) +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _qux05: +; DARWIN-32-PIC: call "L21$pb" +; DARWIN-32-PIC-NEXT: "L21$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl _dsrc+64-"L21$pb"(%eax), %ecx +; DARWIN-32-PIC-NEXT: movl _dptr-"L21$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: movl %ecx, 64(%eax) +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _qux05: +; DARWIN-64-STATIC: movl _dsrc+64(%rip), %eax +; DARWIN-64-STATIC-NEXT: movq _dptr(%rip), %rcx +; DARWIN-64-STATIC-NEXT: movl %eax, 64(%rcx) +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _qux05: +; DARWIN-64-DYNAMIC: movl _dsrc+64(%rip), %eax +; DARWIN-64-DYNAMIC-NEXT: movq _dptr(%rip), %rcx +; DARWIN-64-DYNAMIC-NEXT: movl %eax, 64(%rcx) +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _qux05: +; DARWIN-64-PIC: movl _dsrc+64(%rip), %eax +; DARWIN-64-PIC-NEXT: movq _dptr(%rip), %rcx +; DARWIN-64-PIC-NEXT: movl %eax, 64(%rcx) +; DARWIN-64-PIC-NEXT: ret } define void @qux06() nounwind { @@ -429,6 +1466,54 @@ entry: ; LINUX-64-STATIC: movl lsrc+64(%rip), %eax ; LINUX-64-STATIC: movl %eax, ldst+64 ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: qux06: +; LINUX-32-STATIC: movl lsrc+64, %eax +; LINUX-32-STATIC-NEXT: movl %eax, ldst+64 +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: qux06: +; LINUX-32-PIC: movl lsrc+64, %eax +; LINUX-32-PIC-NEXT: movl %eax, ldst+64 +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: qux06: +; LINUX-64-PIC: movl lsrc+64(%rip), %eax +; LINUX-64-PIC-NEXT: movl %eax, ldst+64(%rip) +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _qux06: +; DARWIN-32-STATIC: movl _lsrc+64, %eax +; DARWIN-32-STATIC-NEXT: movl %eax, _ldst+64 +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _qux06: +; DARWIN-32-DYNAMIC: movl _lsrc+64, %eax +; DARWIN-32-DYNAMIC-NEXT: movl %eax, _ldst+64 +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _qux06: +; DARWIN-32-PIC: call "L22$pb" +; DARWIN-32-PIC-NEXT: "L22$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl _lsrc+64-"L22$pb"(%eax), %ecx +; DARWIN-32-PIC-NEXT: movl %ecx, _ldst+64-"L22$pb"(%eax) +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _qux06: +; DARWIN-64-STATIC: movl _lsrc+64(%rip), %eax +; DARWIN-64-STATIC-NEXT: movl %eax, _ldst+64(%rip) +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _qux06: +; DARWIN-64-DYNAMIC: movl _lsrc+64(%rip), %eax +; DARWIN-64-DYNAMIC-NEXT: movl %eax, _ldst+64(%rip) +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _qux06: +; DARWIN-64-PIC: movl _lsrc+64(%rip), %eax +; DARWIN-64-PIC-NEXT: movl %eax, _ldst+64(%rip) +; DARWIN-64-PIC-NEXT: ret } define void @qux07() nounwind { @@ -438,6 +1523,50 @@ entry: ; LINUX-64-STATIC: qux07: ; LINUX-64-STATIC: movq $ldst+64, lptr ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: qux07: +; LINUX-32-STATIC: movl $ldst+64, lptr +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: qux07: +; LINUX-32-PIC: movl $ldst+64, lptr +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: qux07: +; LINUX-64-PIC: leaq ldst+64(%rip), %rax +; LINUX-64-PIC-NEXT: movq %rax, lptr(%rip) +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _qux07: +; DARWIN-32-STATIC: movl $_ldst+64, _lptr +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _qux07: +; DARWIN-32-DYNAMIC: movl $_ldst+64, _lptr +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _qux07: +; DARWIN-32-PIC: call "L23$pb" +; DARWIN-32-PIC-NEXT: "L23$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: leal _ldst+64-"L23$pb"(%eax), %ecx +; DARWIN-32-PIC-NEXT: movl %ecx, _lptr-"L23$pb"(%eax) +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _qux07: +; DARWIN-64-STATIC: leaq _ldst+64(%rip), %rax +; DARWIN-64-STATIC-NEXT: movq %rax, _lptr(%rip) +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _qux07: +; DARWIN-64-DYNAMIC: leaq _ldst+64(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: movq %rax, _lptr(%rip) +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _qux07: +; DARWIN-64-PIC: leaq _ldst+64(%rip), %rax +; DARWIN-64-PIC-NEXT: movq %rax, _lptr(%rip) +; DARWIN-64-PIC-NEXT: ret } define void @qux08() nounwind { @@ -451,7 +1580,64 @@ entry: ; LINUX-64-STATIC: movq lptr(%rip), %rcx ; LINUX-64-STATIC: movl %eax, 64(%rcx) ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: qux08: +; LINUX-32-STATIC: movl lsrc+64, %eax +; LINUX-32-STATIC-NEXT: movl lptr, %ecx +; LINUX-32-STATIC-NEXT: movl %eax, 64(%ecx) +; LINUX-32-STATIC-NEXT: ret ret void + +; LINUX-32-PIC: qux08: +; LINUX-32-PIC: movl lsrc+64, %eax +; LINUX-32-PIC-NEXT: movl lptr, %ecx +; LINUX-32-PIC-NEXT: movl %eax, 64(%ecx) +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: qux08: +; LINUX-64-PIC: movl lsrc+64(%rip), %eax +; LINUX-64-PIC-NEXT: movq lptr(%rip), %rcx +; LINUX-64-PIC-NEXT: movl %eax, 64(%rcx) +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _qux08: +; DARWIN-32-STATIC: movl _lsrc+64, %eax +; DARWIN-32-STATIC-NEXT: movl _lptr, %ecx +; DARWIN-32-STATIC-NEXT: movl %eax, 64(%ecx) +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _qux08: +; DARWIN-32-DYNAMIC: movl _lsrc+64, %eax +; DARWIN-32-DYNAMIC-NEXT: movl _lptr, %ecx +; DARWIN-32-DYNAMIC-NEXT: movl %eax, 64(%ecx) +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _qux08: +; DARWIN-32-PIC: call "L24$pb" +; DARWIN-32-PIC-NEXT: "L24$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl _lsrc+64-"L24$pb"(%eax), %ecx +; DARWIN-32-PIC-NEXT: movl _lptr-"L24$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: movl %ecx, 64(%eax) +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _qux08: +; DARWIN-64-STATIC: movl _lsrc+64(%rip), %eax +; DARWIN-64-STATIC-NEXT: movq _lptr(%rip), %rcx +; DARWIN-64-STATIC-NEXT: movl %eax, 64(%rcx) +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _qux08: +; DARWIN-64-DYNAMIC: movl _lsrc+64(%rip), %eax +; DARWIN-64-DYNAMIC-NEXT: movq _lptr(%rip), %rcx +; DARWIN-64-DYNAMIC-NEXT: movl %eax, 64(%rcx) +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _qux08: +; DARWIN-64-PIC: movl _lsrc+64(%rip), %eax +; DARWIN-64-PIC-NEXT: movq _lptr(%rip), %rcx +; DARWIN-64-PIC-NEXT: movl %eax, 64(%rcx) +; DARWIN-64-PIC-NEXT: ret } define void @ind00(i64 %i) nounwind { @@ -465,6 +1651,71 @@ entry: ; LINUX-64-STATIC: movl src(,%rdi,4), %eax ; LINUX-64-STATIC: movl %eax, dst(,%rdi,4) ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: ind00: +; LINUX-32-STATIC: movl 4(%esp), %eax +; LINUX-32-STATIC-NEXT: movl src(,%eax,4), %ecx +; LINUX-32-STATIC-NEXT: movl %ecx, dst(,%eax,4) +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: ind00: +; LINUX-32-PIC: movl 4(%esp), %eax +; LINUX-32-PIC-NEXT: movl src(,%eax,4), %ecx +; LINUX-32-PIC-NEXT: movl %ecx, dst(,%eax,4) +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: ind00: +; LINUX-64-PIC: movq src@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: movl (%rax,%rdi,4), %eax +; LINUX-64-PIC-NEXT: movq dst@GOTPCREL(%rip), %rcx +; LINUX-64-PIC-NEXT: movl %eax, (%rcx,%rdi,4) +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _ind00: +; DARWIN-32-STATIC: movl 4(%esp), %eax +; DARWIN-32-STATIC-NEXT: movl _src(,%eax,4), %ecx +; DARWIN-32-STATIC-NEXT: movl %ecx, _dst(,%eax,4) +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _ind00: +; DARWIN-32-DYNAMIC: movl 4(%esp), %eax +; DARWIN-32-DYNAMIC-NEXT: movl L_src$non_lazy_ptr, %ecx +; DARWIN-32-DYNAMIC-NEXT: movl (%ecx,%eax,4), %ecx +; DARWIN-32-DYNAMIC-NEXT: movl L_dst$non_lazy_ptr, %edx +; DARWIN-32-DYNAMIC-NEXT: movl %ecx, (%edx,%eax,4) +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _ind00: +; DARWIN-32-PIC: call "L25$pb" +; DARWIN-32-PIC-NEXT: "L25$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl 4(%esp), %ecx +; DARWIN-32-PIC-NEXT: movl L_src$non_lazy_ptr-"L25$pb"(%eax), %edx +; DARWIN-32-PIC-NEXT: movl (%edx,%ecx,4), %edx +; DARWIN-32-PIC-NEXT: movl L_dst$non_lazy_ptr-"L25$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: movl %edx, (%eax,%ecx,4) +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _ind00: +; DARWIN-64-STATIC: movq _src@GOTPCREL(%rip), %rax +; DARWIN-64-STATIC-NEXT: movl (%rax,%rdi,4), %eax +; DARWIN-64-STATIC-NEXT: movq _dst@GOTPCREL(%rip), %rcx +; DARWIN-64-STATIC-NEXT: movl %eax, (%rcx,%rdi,4) +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _ind00: +; DARWIN-64-DYNAMIC: movq _src@GOTPCREL(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: movl (%rax,%rdi,4), %eax +; DARWIN-64-DYNAMIC-NEXT: movq _dst@GOTPCREL(%rip), %rcx +; DARWIN-64-DYNAMIC-NEXT: movl %eax, (%rcx,%rdi,4) +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _ind00: +; DARWIN-64-PIC: movq _src@GOTPCREL(%rip), %rax +; DARWIN-64-PIC-NEXT: movl (%rax,%rdi,4), %eax +; DARWIN-64-PIC-NEXT: movq _dst@GOTPCREL(%rip), %rcx +; DARWIN-64-PIC-NEXT: movl %eax, (%rcx,%rdi,4) +; DARWIN-64-PIC-NEXT: ret } define void @ixd00(i64 %i) nounwind { @@ -478,6 +1729,71 @@ entry: ; LINUX-64-STATIC: movl xsrc(,%rdi,4), %eax ; LINUX-64-STATIC: movl %eax, xdst(,%rdi,4) ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: ixd00: +; LINUX-32-STATIC: movl 4(%esp), %eax +; LINUX-32-STATIC-NEXT: movl xsrc(,%eax,4), %ecx +; LINUX-32-STATIC-NEXT: movl %ecx, xdst(,%eax,4) +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: ixd00: +; LINUX-32-PIC: movl 4(%esp), %eax +; LINUX-32-PIC-NEXT: movl xsrc(,%eax,4), %ecx +; LINUX-32-PIC-NEXT: movl %ecx, xdst(,%eax,4) +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: ixd00: +; LINUX-64-PIC: movq xsrc@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: movl (%rax,%rdi,4), %eax +; LINUX-64-PIC-NEXT: movq xdst@GOTPCREL(%rip), %rcx +; LINUX-64-PIC-NEXT: movl %eax, (%rcx,%rdi,4) +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _ixd00: +; DARWIN-32-STATIC: movl 4(%esp), %eax +; DARWIN-32-STATIC-NEXT: movl _xsrc(,%eax,4), %ecx +; DARWIN-32-STATIC-NEXT: movl %ecx, _xdst(,%eax,4) +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _ixd00: +; DARWIN-32-DYNAMIC: movl 4(%esp), %eax +; DARWIN-32-DYNAMIC-NEXT: movl L_xsrc$non_lazy_ptr, %ecx +; DARWIN-32-DYNAMIC-NEXT: movl (%ecx,%eax,4), %ecx +; DARWIN-32-DYNAMIC-NEXT: movl L_xdst$non_lazy_ptr, %edx +; DARWIN-32-DYNAMIC-NEXT: movl %ecx, (%edx,%eax,4) +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _ixd00: +; DARWIN-32-PIC: call "L26$pb" +; DARWIN-32-PIC-NEXT: "L26$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl 4(%esp), %ecx +; DARWIN-32-PIC-NEXT: movl L_xsrc$non_lazy_ptr-"L26$pb"(%eax), %edx +; DARWIN-32-PIC-NEXT: movl (%edx,%ecx,4), %edx +; DARWIN-32-PIC-NEXT: movl L_xdst$non_lazy_ptr-"L26$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: movl %edx, (%eax,%ecx,4) +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _ixd00: +; DARWIN-64-STATIC: movq _xsrc@GOTPCREL(%rip), %rax +; DARWIN-64-STATIC-NEXT: movl (%rax,%rdi,4), %eax +; DARWIN-64-STATIC-NEXT: movq _xdst@GOTPCREL(%rip), %rcx +; DARWIN-64-STATIC-NEXT: movl %eax, (%rcx,%rdi,4) +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _ixd00: +; DARWIN-64-DYNAMIC: movq _xsrc@GOTPCREL(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: movl (%rax,%rdi,4), %eax +; DARWIN-64-DYNAMIC-NEXT: movq _xdst@GOTPCREL(%rip), %rcx +; DARWIN-64-DYNAMIC-NEXT: movl %eax, (%rcx,%rdi,4) +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _ixd00: +; DARWIN-64-PIC: movq _xsrc@GOTPCREL(%rip), %rax +; DARWIN-64-PIC-NEXT: movl (%rax,%rdi,4), %eax +; DARWIN-64-PIC-NEXT: movq _xdst@GOTPCREL(%rip), %rcx +; DARWIN-64-PIC-NEXT: movl %eax, (%rcx,%rdi,4) +; DARWIN-64-PIC-NEXT: ret } define void @ind01(i64 %i) nounwind { @@ -489,6 +1805,71 @@ entry: ; LINUX-64-STATIC: leaq dst(,%rdi,4), %rax ; LINUX-64-STATIC: movq %rax, ptr ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: ind01: +; LINUX-32-STATIC: movl 4(%esp), %eax +; LINUX-32-STATIC-NEXT: leal dst(,%eax,4), %eax +; LINUX-32-STATIC-NEXT: movl %eax, ptr +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: ind01: +; LINUX-32-PIC: movl 4(%esp), %eax +; LINUX-32-PIC-NEXT: leal dst(,%eax,4), %eax +; LINUX-32-PIC-NEXT: movl %eax, ptr +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: ind01: +; LINUX-64-PIC: shlq $2, %rdi +; LINUX-64-PIC-NEXT: addq dst@GOTPCREL(%rip), %rdi +; LINUX-64-PIC-NEXT: movq ptr@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: movq %rdi, (%rax) +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _ind01: +; DARWIN-32-STATIC: movl 4(%esp), %eax +; DARWIN-32-STATIC-NEXT: leal _dst(,%eax,4), %eax +; DARWIN-32-STATIC-NEXT: movl %eax, _ptr +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _ind01: +; DARWIN-32-DYNAMIC: movl 4(%esp), %eax +; DARWIN-32-DYNAMIC-NEXT: shll $2, %eax +; DARWIN-32-DYNAMIC-NEXT: addl L_dst$non_lazy_ptr, %eax +; DARWIN-32-DYNAMIC-NEXT: movl L_ptr$non_lazy_ptr, %ecx +; DARWIN-32-DYNAMIC-NEXT: movl %eax, (%ecx) +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _ind01: +; DARWIN-32-PIC: call "L27$pb" +; DARWIN-32-PIC-NEXT: "L27$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl 4(%esp), %ecx +; DARWIN-32-PIC-NEXT: shll $2, %ecx +; DARWIN-32-PIC-NEXT: addl L_dst$non_lazy_ptr-"L27$pb"(%eax), %ecx +; DARWIN-32-PIC-NEXT: movl L_ptr$non_lazy_ptr-"L27$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: movl %ecx, (%eax) +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _ind01: +; DARWIN-64-STATIC: shlq $2, %rdi +; DARWIN-64-STATIC-NEXT: addq _dst@GOTPCREL(%rip), %rdi +; DARWIN-64-STATIC-NEXT: movq _ptr@GOTPCREL(%rip), %rax +; DARWIN-64-STATIC-NEXT: movq %rdi, (%rax) +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _ind01: +; DARWIN-64-DYNAMIC: shlq $2, %rdi +; DARWIN-64-DYNAMIC-NEXT: addq _dst@GOTPCREL(%rip), %rdi +; DARWIN-64-DYNAMIC-NEXT: movq _ptr@GOTPCREL(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: movq %rdi, (%rax) +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _ind01: +; DARWIN-64-PIC: shlq $2, %rdi +; DARWIN-64-PIC-NEXT: addq _dst@GOTPCREL(%rip), %rdi +; DARWIN-64-PIC-NEXT: movq _ptr@GOTPCREL(%rip), %rax +; DARWIN-64-PIC-NEXT: movq %rdi, (%rax) +; DARWIN-64-PIC-NEXT: ret } define void @ixd01(i64 %i) nounwind { @@ -500,6 +1881,71 @@ entry: ; LINUX-64-STATIC: leaq xdst(,%rdi,4), %rax ; LINUX-64-STATIC: movq %rax, ptr ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: ixd01: +; LINUX-32-STATIC: movl 4(%esp), %eax +; LINUX-32-STATIC-NEXT: leal xdst(,%eax,4), %eax +; LINUX-32-STATIC-NEXT: movl %eax, ptr +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: ixd01: +; LINUX-32-PIC: movl 4(%esp), %eax +; LINUX-32-PIC-NEXT: leal xdst(,%eax,4), %eax +; LINUX-32-PIC-NEXT: movl %eax, ptr +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: ixd01: +; LINUX-64-PIC: shlq $2, %rdi +; LINUX-64-PIC-NEXT: addq xdst@GOTPCREL(%rip), %rdi +; LINUX-64-PIC-NEXT: movq ptr@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: movq %rdi, (%rax) +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _ixd01: +; DARWIN-32-STATIC: movl 4(%esp), %eax +; DARWIN-32-STATIC-NEXT: leal _xdst(,%eax,4), %eax +; DARWIN-32-STATIC-NEXT: movl %eax, _ptr +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _ixd01: +; DARWIN-32-DYNAMIC: movl 4(%esp), %eax +; DARWIN-32-DYNAMIC-NEXT: shll $2, %eax +; DARWIN-32-DYNAMIC-NEXT: addl L_xdst$non_lazy_ptr, %eax +; DARWIN-32-DYNAMIC-NEXT: movl L_ptr$non_lazy_ptr, %ecx +; DARWIN-32-DYNAMIC-NEXT: movl %eax, (%ecx) +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _ixd01: +; DARWIN-32-PIC: call "L28$pb" +; DARWIN-32-PIC-NEXT: "L28$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl 4(%esp), %ecx +; DARWIN-32-PIC-NEXT: shll $2, %ecx +; DARWIN-32-PIC-NEXT: addl L_xdst$non_lazy_ptr-"L28$pb"(%eax), %ecx +; DARWIN-32-PIC-NEXT: movl L_ptr$non_lazy_ptr-"L28$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: movl %ecx, (%eax) +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _ixd01: +; DARWIN-64-STATIC: shlq $2, %rdi +; DARWIN-64-STATIC-NEXT: addq _xdst@GOTPCREL(%rip), %rdi +; DARWIN-64-STATIC-NEXT: movq _ptr@GOTPCREL(%rip), %rax +; DARWIN-64-STATIC-NEXT: movq %rdi, (%rax) +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _ixd01: +; DARWIN-64-DYNAMIC: shlq $2, %rdi +; DARWIN-64-DYNAMIC-NEXT: addq _xdst@GOTPCREL(%rip), %rdi +; DARWIN-64-DYNAMIC-NEXT: movq _ptr@GOTPCREL(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: movq %rdi, (%rax) +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _ixd01: +; DARWIN-64-PIC: shlq $2, %rdi +; DARWIN-64-PIC-NEXT: addq _xdst@GOTPCREL(%rip), %rdi +; DARWIN-64-PIC-NEXT: movq _ptr@GOTPCREL(%rip), %rax +; DARWIN-64-PIC-NEXT: movq %rdi, (%rax) +; DARWIN-64-PIC-NEXT: ret } define void @ind02(i64 %i) nounwind { @@ -515,6 +1961,80 @@ entry: ; LINUX-64-STATIC: movq ptr(%rip), %rcx ; LINUX-64-STATIC: movl %eax, (%rcx,%rdi,4) ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: ind02: +; LINUX-32-STATIC: movl 4(%esp), %eax +; LINUX-32-STATIC-NEXT: movl src(,%eax,4), %ecx +; LINUX-32-STATIC-NEXT: movl ptr, %edx +; LINUX-32-STATIC-NEXT: movl %ecx, (%edx,%eax,4) +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: ind02: +; LINUX-32-PIC: movl 4(%esp), %eax +; LINUX-32-PIC-NEXT: movl src(,%eax,4), %ecx +; LINUX-32-PIC-NEXT: movl ptr, %edx +; LINUX-32-PIC-NEXT: movl %ecx, (%edx,%eax,4) +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: ind02: +; LINUX-64-PIC: movq src@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: movl (%rax,%rdi,4), %eax +; LINUX-64-PIC-NEXT: movq ptr@GOTPCREL(%rip), %rcx +; LINUX-64-PIC-NEXT: movq (%rcx), %rcx +; LINUX-64-PIC-NEXT: movl %eax, (%rcx,%rdi,4) +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _ind02: +; DARWIN-32-STATIC: movl 4(%esp), %eax +; DARWIN-32-STATIC-NEXT: movl _src(,%eax,4), %ecx +; DARWIN-32-STATIC-NEXT: movl _ptr, %edx +; DARWIN-32-STATIC-NEXT: movl %ecx, (%edx,%eax,4) +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _ind02: +; DARWIN-32-DYNAMIC: movl 4(%esp), %eax +; DARWIN-32-DYNAMIC-NEXT: movl L_src$non_lazy_ptr, %ecx +; DARWIN-32-DYNAMIC-NEXT: movl (%ecx,%eax,4), %ecx +; DARWIN-32-DYNAMIC-NEXT: movl L_ptr$non_lazy_ptr, %edx +; DARWIN-32-DYNAMIC-NEXT: movl (%edx), %edx +; DARWIN-32-DYNAMIC-NEXT: movl %ecx, (%edx,%eax,4) +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _ind02: +; DARWIN-32-PIC: call "L29$pb" +; DARWIN-32-PIC-NEXT: "L29$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl 4(%esp), %ecx +; DARWIN-32-PIC-NEXT: movl L_src$non_lazy_ptr-"L29$pb"(%eax), %edx +; DARWIN-32-PIC-NEXT: movl (%edx,%ecx,4), %edx +; DARWIN-32-PIC-NEXT: movl L_ptr$non_lazy_ptr-"L29$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: movl (%eax), %eax +; DARWIN-32-PIC-NEXT: movl %edx, (%eax,%ecx,4) +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _ind02: +; DARWIN-64-STATIC: movq _src@GOTPCREL(%rip), %rax +; DARWIN-64-STATIC-NEXT: movl (%rax,%rdi,4), %eax +; DARWIN-64-STATIC-NEXT: movq _ptr@GOTPCREL(%rip), %rcx +; DARWIN-64-STATIC-NEXT: movq (%rcx), %rcx +; DARWIN-64-STATIC-NEXT: movl %eax, (%rcx,%rdi,4) +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _ind02: +; DARWIN-64-DYNAMIC: movq _src@GOTPCREL(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: movl (%rax,%rdi,4), %eax +; DARWIN-64-DYNAMIC-NEXT: movq _ptr@GOTPCREL(%rip), %rcx +; DARWIN-64-DYNAMIC-NEXT: movq (%rcx), %rcx +; DARWIN-64-DYNAMIC-NEXT: movl %eax, (%rcx,%rdi,4) +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _ind02: +; DARWIN-64-PIC: movq _src@GOTPCREL(%rip), %rax +; DARWIN-64-PIC-NEXT: movl (%rax,%rdi,4), %eax +; DARWIN-64-PIC-NEXT: movq _ptr@GOTPCREL(%rip), %rcx +; DARWIN-64-PIC-NEXT: movq (%rcx), %rcx +; DARWIN-64-PIC-NEXT: movl %eax, (%rcx,%rdi,4) +; DARWIN-64-PIC-NEXT: ret } define void @ixd02(i64 %i) nounwind { @@ -530,6 +2050,80 @@ entry: ; LINUX-64-STATIC: movq ptr(%rip), %rcx ; LINUX-64-STATIC: movl %eax, (%rcx,%rdi,4) ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: ixd02: +; LINUX-32-STATIC: movl 4(%esp), %eax +; LINUX-32-STATIC-NEXT: movl xsrc(,%eax,4), %ecx +; LINUX-32-STATIC-NEXT: movl ptr, %edx +; LINUX-32-STATIC-NEXT: movl %ecx, (%edx,%eax,4) +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: ixd02: +; LINUX-32-PIC: movl 4(%esp), %eax +; LINUX-32-PIC-NEXT: movl xsrc(,%eax,4), %ecx +; LINUX-32-PIC-NEXT: movl ptr, %edx +; LINUX-32-PIC-NEXT: movl %ecx, (%edx,%eax,4) +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: ixd02: +; LINUX-64-PIC: movq xsrc@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: movl (%rax,%rdi,4), %eax +; LINUX-64-PIC-NEXT: movq ptr@GOTPCREL(%rip), %rcx +; LINUX-64-PIC-NEXT: movq (%rcx), %rcx +; LINUX-64-PIC-NEXT: movl %eax, (%rcx,%rdi,4) +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _ixd02: +; DARWIN-32-STATIC: movl 4(%esp), %eax +; DARWIN-32-STATIC-NEXT: movl _xsrc(,%eax,4), %ecx +; DARWIN-32-STATIC-NEXT: movl _ptr, %edx +; DARWIN-32-STATIC-NEXT: movl %ecx, (%edx,%eax,4) +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _ixd02: +; DARWIN-32-DYNAMIC: movl 4(%esp), %eax +; DARWIN-32-DYNAMIC-NEXT: movl L_xsrc$non_lazy_ptr, %ecx +; DARWIN-32-DYNAMIC-NEXT: movl (%ecx,%eax,4), %ecx +; DARWIN-32-DYNAMIC-NEXT: movl L_ptr$non_lazy_ptr, %edx +; DARWIN-32-DYNAMIC-NEXT: movl (%edx), %edx +; DARWIN-32-DYNAMIC-NEXT: movl %ecx, (%edx,%eax,4) +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _ixd02: +; DARWIN-32-PIC: call "L30$pb" +; DARWIN-32-PIC-NEXT: "L30$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl 4(%esp), %ecx +; DARWIN-32-PIC-NEXT: movl L_xsrc$non_lazy_ptr-"L30$pb"(%eax), %edx +; DARWIN-32-PIC-NEXT: movl (%edx,%ecx,4), %edx +; DARWIN-32-PIC-NEXT: movl L_ptr$non_lazy_ptr-"L30$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: movl (%eax), %eax +; DARWIN-32-PIC-NEXT: movl %edx, (%eax,%ecx,4) +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _ixd02: +; DARWIN-64-STATIC: movq _xsrc@GOTPCREL(%rip), %rax +; DARWIN-64-STATIC-NEXT: movl (%rax,%rdi,4), %eax +; DARWIN-64-STATIC-NEXT: movq _ptr@GOTPCREL(%rip), %rcx +; DARWIN-64-STATIC-NEXT: movq (%rcx), %rcx +; DARWIN-64-STATIC-NEXT: movl %eax, (%rcx,%rdi,4) +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _ixd02: +; DARWIN-64-DYNAMIC: movq _xsrc@GOTPCREL(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: movl (%rax,%rdi,4), %eax +; DARWIN-64-DYNAMIC-NEXT: movq _ptr@GOTPCREL(%rip), %rcx +; DARWIN-64-DYNAMIC-NEXT: movq (%rcx), %rcx +; DARWIN-64-DYNAMIC-NEXT: movl %eax, (%rcx,%rdi,4) +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _ixd02: +; DARWIN-64-PIC: movq _xsrc@GOTPCREL(%rip), %rax +; DARWIN-64-PIC-NEXT: movl (%rax,%rdi,4), %eax +; DARWIN-64-PIC-NEXT: movq _ptr@GOTPCREL(%rip), %rcx +; DARWIN-64-PIC-NEXT: movq (%rcx), %rcx +; DARWIN-64-PIC-NEXT: movl %eax, (%rcx,%rdi,4) +; DARWIN-64-PIC-NEXT: ret } define void @ind03(i64 %i) nounwind { @@ -543,6 +2137,67 @@ entry: ; LINUX-64-STATIC: movl dsrc(,%rdi,4), %eax ; LINUX-64-STATIC: movl %eax, ddst(,%rdi,4) ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: ind03: +; LINUX-32-STATIC: movl 4(%esp), %eax +; LINUX-32-STATIC-NEXT: movl dsrc(,%eax,4), %ecx +; LINUX-32-STATIC-NEXT: movl %ecx, ddst(,%eax,4) +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: ind03: +; LINUX-32-PIC: movl 4(%esp), %eax +; LINUX-32-PIC-NEXT: movl dsrc(,%eax,4), %ecx +; LINUX-32-PIC-NEXT: movl %ecx, ddst(,%eax,4) +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: ind03: +; LINUX-64-PIC: movq dsrc@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: movl (%rax,%rdi,4), %eax +; LINUX-64-PIC-NEXT: movq ddst@GOTPCREL(%rip), %rcx +; LINUX-64-PIC-NEXT: movl %eax, (%rcx,%rdi,4) +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _ind03: +; DARWIN-32-STATIC: movl 4(%esp), %eax +; DARWIN-32-STATIC-NEXT: movl _dsrc(,%eax,4), %ecx +; DARWIN-32-STATIC-NEXT: movl %ecx, _ddst(,%eax,4) +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _ind03: +; DARWIN-32-DYNAMIC: movl 4(%esp), %eax +; DARWIN-32-DYNAMIC-NEXT: movl _dsrc(,%eax,4), %ecx +; DARWIN-32-DYNAMIC-NEXT: movl %ecx, _ddst(,%eax,4) +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _ind03: +; DARWIN-32-PIC: call "L31$pb" +; DARWIN-32-PIC-NEXT: "L31$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl 4(%esp), %ecx +; DARWIN-32-PIC-NEXT: movl _dsrc-"L31$pb"(%eax,%ecx,4), %edx +; DARWIN-32-PIC-NEXT: movl %edx, _ddst-"L31$pb"(%eax,%ecx,4) +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _ind03: +; DARWIN-64-STATIC: leaq _dsrc(%rip), %rax +; DARWIN-64-STATIC-NEXT: movl (%rax,%rdi,4), %eax +; DARWIN-64-STATIC-NEXT: leaq _ddst(%rip), %rcx +; DARWIN-64-STATIC-NEXT: movl %eax, (%rcx,%rdi,4) +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _ind03: +; DARWIN-64-DYNAMIC: leaq _dsrc(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: movl (%rax,%rdi,4), %eax +; DARWIN-64-DYNAMIC-NEXT: leaq _ddst(%rip), %rcx +; DARWIN-64-DYNAMIC-NEXT: movl %eax, (%rcx,%rdi,4) +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _ind03: +; DARWIN-64-PIC: leaq _dsrc(%rip), %rax +; DARWIN-64-PIC-NEXT: movl (%rax,%rdi,4), %eax +; DARWIN-64-PIC-NEXT: leaq _ddst(%rip), %rcx +; DARWIN-64-PIC-NEXT: movl %eax, (%rcx,%rdi,4) +; DARWIN-64-PIC-NEXT: ret } define void @ind04(i64 %i) nounwind { @@ -554,6 +2209,64 @@ entry: ; LINUX-64-STATIC: leaq ddst(,%rdi,4), %rax ; LINUX-64-STATIC: movq %rax, dptr ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: ind04: +; LINUX-32-STATIC: movl 4(%esp), %eax +; LINUX-32-STATIC-NEXT: leal ddst(,%eax,4), %eax +; LINUX-32-STATIC-NEXT: movl %eax, dptr +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: ind04: +; LINUX-32-PIC: movl 4(%esp), %eax +; LINUX-32-PIC-NEXT: leal ddst(,%eax,4), %eax +; LINUX-32-PIC-NEXT: movl %eax, dptr +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: ind04: +; LINUX-64-PIC: shlq $2, %rdi +; LINUX-64-PIC-NEXT: addq ddst@GOTPCREL(%rip), %rdi +; LINUX-64-PIC-NEXT: movq dptr@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: movq %rdi, (%rax) +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _ind04: +; DARWIN-32-STATIC: movl 4(%esp), %eax +; DARWIN-32-STATIC-NEXT: leal _ddst(,%eax,4), %eax +; DARWIN-32-STATIC-NEXT: movl %eax, _dptr +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _ind04: +; DARWIN-32-DYNAMIC: movl 4(%esp), %eax +; DARWIN-32-DYNAMIC-NEXT: leal _ddst(,%eax,4), %eax +; DARWIN-32-DYNAMIC-NEXT: movl %eax, _dptr +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _ind04: +; DARWIN-32-PIC: call "L32$pb" +; DARWIN-32-PIC-NEXT: "L32$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl 4(%esp), %ecx +; DARWIN-32-PIC-NEXT: leal _ddst-"L32$pb"(%eax,%ecx,4), %ecx +; DARWIN-32-PIC-NEXT: movl %ecx, _dptr-"L32$pb"(%eax) +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _ind04: +; DARWIN-64-STATIC: leaq _ddst(%rip), %rax +; DARWIN-64-STATIC-NEXT: leaq (%rax,%rdi,4), %rax +; DARWIN-64-STATIC-NEXT: movq %rax, _dptr(%rip) +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _ind04: +; DARWIN-64-DYNAMIC: leaq _ddst(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: leaq (%rax,%rdi,4), %rax +; DARWIN-64-DYNAMIC-NEXT: movq %rax, _dptr(%rip) +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _ind04: +; DARWIN-64-PIC: leaq _ddst(%rip), %rax +; DARWIN-64-PIC-NEXT: leaq (%rax,%rdi,4), %rax +; DARWIN-64-PIC-NEXT: movq %rax, _dptr(%rip) +; DARWIN-64-PIC-NEXT: ret } define void @ind05(i64 %i) nounwind { @@ -569,6 +2282,73 @@ entry: ; LINUX-64-STATIC: movq dptr(%rip), %rcx ; LINUX-64-STATIC: movl %eax, (%rcx,%rdi,4) ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: ind05: +; LINUX-32-STATIC: movl 4(%esp), %eax +; LINUX-32-STATIC-NEXT: movl dsrc(,%eax,4), %ecx +; LINUX-32-STATIC-NEXT: movl dptr, %edx +; LINUX-32-STATIC-NEXT: movl %ecx, (%edx,%eax,4) +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: ind05: +; LINUX-32-PIC: movl 4(%esp), %eax +; LINUX-32-PIC-NEXT: movl dsrc(,%eax,4), %ecx +; LINUX-32-PIC-NEXT: movl dptr, %edx +; LINUX-32-PIC-NEXT: movl %ecx, (%edx,%eax,4) +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: ind05: +; LINUX-64-PIC: movq dsrc@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: movl (%rax,%rdi,4), %eax +; LINUX-64-PIC-NEXT: movq dptr@GOTPCREL(%rip), %rcx +; LINUX-64-PIC-NEXT: movq (%rcx), %rcx +; LINUX-64-PIC-NEXT: movl %eax, (%rcx,%rdi,4) +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _ind05: +; DARWIN-32-STATIC: movl 4(%esp), %eax +; DARWIN-32-STATIC-NEXT: movl _dsrc(,%eax,4), %ecx +; DARWIN-32-STATIC-NEXT: movl _dptr, %edx +; DARWIN-32-STATIC-NEXT: movl %ecx, (%edx,%eax,4) +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _ind05: +; DARWIN-32-DYNAMIC: movl 4(%esp), %eax +; DARWIN-32-DYNAMIC-NEXT: movl _dsrc(,%eax,4), %ecx +; DARWIN-32-DYNAMIC-NEXT: movl _dptr, %edx +; DARWIN-32-DYNAMIC-NEXT: movl %ecx, (%edx,%eax,4) +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _ind05: +; DARWIN-32-PIC: call "L33$pb" +; DARWIN-32-PIC-NEXT: "L33$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl 4(%esp), %ecx +; DARWIN-32-PIC-NEXT: movl _dsrc-"L33$pb"(%eax,%ecx,4), %edx +; DARWIN-32-PIC-NEXT: movl _dptr-"L33$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: movl %edx, (%eax,%ecx,4) +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _ind05: +; DARWIN-64-STATIC: leaq _dsrc(%rip), %rax +; DARWIN-64-STATIC-NEXT: movl (%rax,%rdi,4), %eax +; DARWIN-64-STATIC-NEXT: movq _dptr(%rip), %rcx +; DARWIN-64-STATIC-NEXT: movl %eax, (%rcx,%rdi,4) +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _ind05: +; DARWIN-64-DYNAMIC: leaq _dsrc(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: movl (%rax,%rdi,4), %eax +; DARWIN-64-DYNAMIC-NEXT: movq _dptr(%rip), %rcx +; DARWIN-64-DYNAMIC-NEXT: movl %eax, (%rcx,%rdi,4) +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _ind05: +; DARWIN-64-PIC: leaq _dsrc(%rip), %rax +; DARWIN-64-PIC-NEXT: movl (%rax,%rdi,4), %eax +; DARWIN-64-PIC-NEXT: movq _dptr(%rip), %rcx +; DARWIN-64-PIC-NEXT: movl %eax, (%rcx,%rdi,4) +; DARWIN-64-PIC-NEXT: ret } define void @ind06(i64 %i) nounwind { @@ -582,6 +2362,67 @@ entry: ; LINUX-64-STATIC: movl lsrc(,%rdi,4), %eax ; LINUX-64-STATIC: movl %eax, ldst(,%rdi,4) ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: ind06: +; LINUX-32-STATIC: movl 4(%esp), %eax +; LINUX-32-STATIC-NEXT: movl lsrc(,%eax,4), %ecx +; LINUX-32-STATIC-NEXT: movl %ecx, ldst(,%eax,4) +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: ind06: +; LINUX-32-PIC: movl 4(%esp), %eax +; LINUX-32-PIC-NEXT: movl lsrc(,%eax,4), %ecx +; LINUX-32-PIC-NEXT: movl %ecx, ldst(,%eax,4) +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: ind06: +; LINUX-64-PIC: leaq lsrc(%rip), %rax +; LINUX-64-PIC-NEXT: movl (%rax,%rdi,4), %eax +; LINUX-64-PIC-NEXT: leaq ldst(%rip), %rcx +; LINUX-64-PIC-NEXT: movl %eax, (%rcx,%rdi,4) +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _ind06: +; DARWIN-32-STATIC: movl 4(%esp), %eax +; DARWIN-32-STATIC-NEXT: movl _lsrc(,%eax,4), %ecx +; DARWIN-32-STATIC-NEXT: movl %ecx, _ldst(,%eax,4) +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _ind06: +; DARWIN-32-DYNAMIC: movl 4(%esp), %eax +; DARWIN-32-DYNAMIC-NEXT: movl _lsrc(,%eax,4), %ecx +; DARWIN-32-DYNAMIC-NEXT: movl %ecx, _ldst(,%eax,4) +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _ind06: +; DARWIN-32-PIC: call "L34$pb" +; DARWIN-32-PIC-NEXT: "L34$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl 4(%esp), %ecx +; DARWIN-32-PIC-NEXT: movl _lsrc-"L34$pb"(%eax,%ecx,4), %edx +; DARWIN-32-PIC-NEXT: movl %edx, _ldst-"L34$pb"(%eax,%ecx,4) +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _ind06: +; DARWIN-64-STATIC: leaq _lsrc(%rip), %rax +; DARWIN-64-STATIC-NEXT: movl (%rax,%rdi,4), %eax +; DARWIN-64-STATIC-NEXT: leaq _ldst(%rip), %rcx +; DARWIN-64-STATIC-NEXT: movl %eax, (%rcx,%rdi,4) +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _ind06: +; DARWIN-64-DYNAMIC: leaq _lsrc(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: movl (%rax,%rdi,4), %eax +; DARWIN-64-DYNAMIC-NEXT: leaq _ldst(%rip), %rcx +; DARWIN-64-DYNAMIC-NEXT: movl %eax, (%rcx,%rdi,4) +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _ind06: +; DARWIN-64-PIC: leaq _lsrc(%rip), %rax +; DARWIN-64-PIC-NEXT: movl (%rax,%rdi,4), %eax +; DARWIN-64-PIC-NEXT: leaq _ldst(%rip), %rcx +; DARWIN-64-PIC-NEXT: movl %eax, (%rcx,%rdi,4) +; DARWIN-64-PIC-NEXT: ret } define void @ind07(i64 %i) nounwind { @@ -593,6 +2434,63 @@ entry: ; LINUX-64-STATIC: leaq ldst(,%rdi,4), %rax ; LINUX-64-STATIC: movq %rax, lptr ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: ind07: +; LINUX-32-STATIC: movl 4(%esp), %eax +; LINUX-32-STATIC-NEXT: leal ldst(,%eax,4), %eax +; LINUX-32-STATIC-NEXT: movl %eax, lptr +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: ind07: +; LINUX-32-PIC: movl 4(%esp), %eax +; LINUX-32-PIC-NEXT: leal ldst(,%eax,4), %eax +; LINUX-32-PIC-NEXT: movl %eax, lptr +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: ind07: +; LINUX-64-PIC: leaq ldst(%rip), %rax +; LINUX-64-PIC-NEXT: leaq (%rax,%rdi,4), %rax +; LINUX-64-PIC-NEXT: movq %rax, lptr(%rip) +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _ind07: +; DARWIN-32-STATIC: movl 4(%esp), %eax +; DARWIN-32-STATIC-NEXT: leal _ldst(,%eax,4), %eax +; DARWIN-32-STATIC-NEXT: movl %eax, _lptr +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _ind07: +; DARWIN-32-DYNAMIC: movl 4(%esp), %eax +; DARWIN-32-DYNAMIC-NEXT: leal _ldst(,%eax,4), %eax +; DARWIN-32-DYNAMIC-NEXT: movl %eax, _lptr +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _ind07: +; DARWIN-32-PIC: call "L35$pb" +; DARWIN-32-PIC-NEXT: "L35$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl 4(%esp), %ecx +; DARWIN-32-PIC-NEXT: leal _ldst-"L35$pb"(%eax,%ecx,4), %ecx +; DARWIN-32-PIC-NEXT: movl %ecx, _lptr-"L35$pb"(%eax) +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _ind07: +; DARWIN-64-STATIC: leaq _ldst(%rip), %rax +; DARWIN-64-STATIC-NEXT: leaq (%rax,%rdi,4), %rax +; DARWIN-64-STATIC-NEXT: movq %rax, _lptr(%rip) +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _ind07: +; DARWIN-64-DYNAMIC: leaq _ldst(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: leaq (%rax,%rdi,4), %rax +; DARWIN-64-DYNAMIC-NEXT: movq %rax, _lptr(%rip) +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _ind07: +; DARWIN-64-PIC: leaq _ldst(%rip), %rax +; DARWIN-64-PIC-NEXT: leaq (%rax,%rdi,4), %rax +; DARWIN-64-PIC-NEXT: movq %rax, _lptr(%rip) +; DARWIN-64-PIC-NEXT: ret } define void @ind08(i64 %i) nounwind { @@ -608,6 +2506,72 @@ entry: ; LINUX-64-STATIC: movq lptr(%rip), %rcx ; LINUX-64-STATIC: movl %eax, (%rcx,%rdi,4) ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: ind08: +; LINUX-32-STATIC: movl 4(%esp), %eax +; LINUX-32-STATIC-NEXT: movl lsrc(,%eax,4), %ecx +; LINUX-32-STATIC-NEXT: movl lptr, %edx +; LINUX-32-STATIC-NEXT: movl %ecx, (%edx,%eax,4) +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: ind08: +; LINUX-32-PIC: movl 4(%esp), %eax +; LINUX-32-PIC-NEXT: movl lsrc(,%eax,4), %ecx +; LINUX-32-PIC-NEXT: movl lptr, %edx +; LINUX-32-PIC-NEXT: movl %ecx, (%edx,%eax,4) +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: ind08: +; LINUX-64-PIC: leaq lsrc(%rip), %rax +; LINUX-64-PIC-NEXT: movl (%rax,%rdi,4), %eax +; LINUX-64-PIC-NEXT: movq lptr(%rip), %rcx +; LINUX-64-PIC-NEXT: movl %eax, (%rcx,%rdi,4) +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _ind08: +; DARWIN-32-STATIC: movl 4(%esp), %eax +; DARWIN-32-STATIC-NEXT: movl _lsrc(,%eax,4), %ecx +; DARWIN-32-STATIC-NEXT: movl _lptr, %edx +; DARWIN-32-STATIC-NEXT: movl %ecx, (%edx,%eax,4) +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _ind08: +; DARWIN-32-DYNAMIC: movl 4(%esp), %eax +; DARWIN-32-DYNAMIC-NEXT: movl _lsrc(,%eax,4), %ecx +; DARWIN-32-DYNAMIC-NEXT: movl _lptr, %edx +; DARWIN-32-DYNAMIC-NEXT: movl %ecx, (%edx,%eax,4) +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _ind08: +; DARWIN-32-PIC: call "L36$pb" +; DARWIN-32-PIC-NEXT: "L36$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl 4(%esp), %ecx +; DARWIN-32-PIC-NEXT: movl _lsrc-"L36$pb"(%eax,%ecx,4), %edx +; DARWIN-32-PIC-NEXT: movl _lptr-"L36$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: movl %edx, (%eax,%ecx,4) +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _ind08: +; DARWIN-64-STATIC: leaq _lsrc(%rip), %rax +; DARWIN-64-STATIC-NEXT: movl (%rax,%rdi,4), %eax +; DARWIN-64-STATIC-NEXT: movq _lptr(%rip), %rcx +; DARWIN-64-STATIC-NEXT: movl %eax, (%rcx,%rdi,4) +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _ind08: +; DARWIN-64-DYNAMIC: leaq _lsrc(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: movl (%rax,%rdi,4), %eax +; DARWIN-64-DYNAMIC-NEXT: movq _lptr(%rip), %rcx +; DARWIN-64-DYNAMIC-NEXT: movl %eax, (%rcx,%rdi,4) +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _ind08: +; DARWIN-64-PIC: leaq _lsrc(%rip), %rax +; DARWIN-64-PIC-NEXT: movl (%rax,%rdi,4), %eax +; DARWIN-64-PIC-NEXT: movq _lptr(%rip), %rcx +; DARWIN-64-PIC-NEXT: movl %eax, (%rcx,%rdi,4) +; DARWIN-64-PIC-NEXT: ret } define void @off00(i64 %i) nounwind { @@ -622,6 +2586,71 @@ entry: ; LINUX-64-STATIC: movl src+64(,%rdi,4), %eax ; LINUX-64-STATIC: movl %eax, dst+64(,%rdi,4) ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: off00: +; LINUX-32-STATIC: movl 4(%esp), %eax +; LINUX-32-STATIC-NEXT: movl src+64(,%eax,4), %ecx +; LINUX-32-STATIC-NEXT: movl %ecx, dst+64(,%eax,4) +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: off00: +; LINUX-32-PIC: movl 4(%esp), %eax +; LINUX-32-PIC-NEXT: movl src+64(,%eax,4), %ecx +; LINUX-32-PIC-NEXT: movl %ecx, dst+64(,%eax,4) +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: off00: +; LINUX-64-PIC: movq src@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: movl 64(%rax,%rdi,4), %eax +; LINUX-64-PIC-NEXT: movq dst@GOTPCREL(%rip), %rcx +; LINUX-64-PIC-NEXT: movl %eax, 64(%rcx,%rdi,4) +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _off00: +; DARWIN-32-STATIC: movl 4(%esp), %eax +; DARWIN-32-STATIC-NEXT: movl _src+64(,%eax,4), %ecx +; DARWIN-32-STATIC-NEXT: movl %ecx, _dst+64(,%eax,4) +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _off00: +; DARWIN-32-DYNAMIC: movl 4(%esp), %eax +; DARWIN-32-DYNAMIC-NEXT: movl L_src$non_lazy_ptr, %ecx +; DARWIN-32-DYNAMIC-NEXT: movl 64(%ecx,%eax,4), %ecx +; DARWIN-32-DYNAMIC-NEXT: movl L_dst$non_lazy_ptr, %edx +; DARWIN-32-DYNAMIC-NEXT: movl %ecx, 64(%edx,%eax,4) +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _off00: +; DARWIN-32-PIC: call "L37$pb" +; DARWIN-32-PIC-NEXT: "L37$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl 4(%esp), %ecx +; DARWIN-32-PIC-NEXT: movl L_src$non_lazy_ptr-"L37$pb"(%eax), %edx +; DARWIN-32-PIC-NEXT: movl 64(%edx,%ecx,4), %edx +; DARWIN-32-PIC-NEXT: movl L_dst$non_lazy_ptr-"L37$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: movl %edx, 64(%eax,%ecx,4) +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _off00: +; DARWIN-64-STATIC: movq _src@GOTPCREL(%rip), %rax +; DARWIN-64-STATIC-NEXT: movl 64(%rax,%rdi,4), %eax +; DARWIN-64-STATIC-NEXT: movq _dst@GOTPCREL(%rip), %rcx +; DARWIN-64-STATIC-NEXT: movl %eax, 64(%rcx,%rdi,4) +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _off00: +; DARWIN-64-DYNAMIC: movq _src@GOTPCREL(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: movl 64(%rax,%rdi,4), %eax +; DARWIN-64-DYNAMIC-NEXT: movq _dst@GOTPCREL(%rip), %rcx +; DARWIN-64-DYNAMIC-NEXT: movl %eax, 64(%rcx,%rdi,4) +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _off00: +; DARWIN-64-PIC: movq _src@GOTPCREL(%rip), %rax +; DARWIN-64-PIC-NEXT: movl 64(%rax,%rdi,4), %eax +; DARWIN-64-PIC-NEXT: movq _dst@GOTPCREL(%rip), %rcx +; DARWIN-64-PIC-NEXT: movl %eax, 64(%rcx,%rdi,4) +; DARWIN-64-PIC-NEXT: ret } define void @oxf00(i64 %i) nounwind { @@ -636,6 +2665,71 @@ entry: ; LINUX-64-STATIC: movl xsrc+64(,%rdi,4), %eax ; LINUX-64-STATIC: movl %eax, xdst+64(,%rdi,4) ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: oxf00: +; LINUX-32-STATIC: movl 4(%esp), %eax +; LINUX-32-STATIC-NEXT: movl xsrc+64(,%eax,4), %ecx +; LINUX-32-STATIC-NEXT: movl %ecx, xdst+64(,%eax,4) +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: oxf00: +; LINUX-32-PIC: movl 4(%esp), %eax +; LINUX-32-PIC-NEXT: movl xsrc+64(,%eax,4), %ecx +; LINUX-32-PIC-NEXT: movl %ecx, xdst+64(,%eax,4) +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: oxf00: +; LINUX-64-PIC: movq xsrc@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: movl 64(%rax,%rdi,4), %eax +; LINUX-64-PIC-NEXT: movq xdst@GOTPCREL(%rip), %rcx +; LINUX-64-PIC-NEXT: movl %eax, 64(%rcx,%rdi,4) +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _oxf00: +; DARWIN-32-STATIC: movl 4(%esp), %eax +; DARWIN-32-STATIC-NEXT: movl _xsrc+64(,%eax,4), %ecx +; DARWIN-32-STATIC-NEXT: movl %ecx, _xdst+64(,%eax,4) +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _oxf00: +; DARWIN-32-DYNAMIC: movl 4(%esp), %eax +; DARWIN-32-DYNAMIC-NEXT: movl L_xsrc$non_lazy_ptr, %ecx +; DARWIN-32-DYNAMIC-NEXT: movl 64(%ecx,%eax,4), %ecx +; DARWIN-32-DYNAMIC-NEXT: movl L_xdst$non_lazy_ptr, %edx +; DARWIN-32-DYNAMIC-NEXT: movl %ecx, 64(%edx,%eax,4) +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _oxf00: +; DARWIN-32-PIC: call "L38$pb" +; DARWIN-32-PIC-NEXT: "L38$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl 4(%esp), %ecx +; DARWIN-32-PIC-NEXT: movl L_xsrc$non_lazy_ptr-"L38$pb"(%eax), %edx +; DARWIN-32-PIC-NEXT: movl 64(%edx,%ecx,4), %edx +; DARWIN-32-PIC-NEXT: movl L_xdst$non_lazy_ptr-"L38$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: movl %edx, 64(%eax,%ecx,4) +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _oxf00: +; DARWIN-64-STATIC: movq _xsrc@GOTPCREL(%rip), %rax +; DARWIN-64-STATIC-NEXT: movl 64(%rax,%rdi,4), %eax +; DARWIN-64-STATIC-NEXT: movq _xdst@GOTPCREL(%rip), %rcx +; DARWIN-64-STATIC-NEXT: movl %eax, 64(%rcx,%rdi,4) +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _oxf00: +; DARWIN-64-DYNAMIC: movq _xsrc@GOTPCREL(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: movl 64(%rax,%rdi,4), %eax +; DARWIN-64-DYNAMIC-NEXT: movq _xdst@GOTPCREL(%rip), %rcx +; DARWIN-64-DYNAMIC-NEXT: movl %eax, 64(%rcx,%rdi,4) +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _oxf00: +; DARWIN-64-PIC: movq _xsrc@GOTPCREL(%rip), %rax +; DARWIN-64-PIC-NEXT: movl 64(%rax,%rdi,4), %eax +; DARWIN-64-PIC-NEXT: movq _xdst@GOTPCREL(%rip), %rcx +; DARWIN-64-PIC-NEXT: movl %eax, 64(%rcx,%rdi,4) +; DARWIN-64-PIC-NEXT: ret } define void @off01(i64 %i) nounwind { @@ -648,6 +2742,71 @@ entry: ; LINUX-64-STATIC: leaq dst+64(,%rdi,4), %rax ; LINUX-64-STATIC: movq %rax, ptr ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: off01: +; LINUX-32-STATIC: movl 4(%esp), %eax +; LINUX-32-STATIC-NEXT: leal dst+64(,%eax,4), %eax +; LINUX-32-STATIC-NEXT: movl %eax, ptr +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: off01: +; LINUX-32-PIC: movl 4(%esp), %eax +; LINUX-32-PIC-NEXT: leal dst+64(,%eax,4), %eax +; LINUX-32-PIC-NEXT: movl %eax, ptr +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: off01: +; LINUX-64-PIC: movq dst@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: leaq 64(%rax,%rdi,4), %rax +; LINUX-64-PIC-NEXT: movq ptr@GOTPCREL(%rip), %rcx +; LINUX-64-PIC-NEXT: movq %rax, (%rcx) +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _off01: +; DARWIN-32-STATIC: movl 4(%esp), %eax +; DARWIN-32-STATIC-NEXT: leal _dst+64(,%eax,4), %eax +; DARWIN-32-STATIC-NEXT: movl %eax, _ptr +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _off01: +; DARWIN-32-DYNAMIC: movl 4(%esp), %eax +; DARWIN-32-DYNAMIC-NEXT: movl L_dst$non_lazy_ptr, %ecx +; DARWIN-32-DYNAMIC-NEXT: leal 64(%ecx,%eax,4), %eax +; DARWIN-32-DYNAMIC-NEXT: movl L_ptr$non_lazy_ptr, %ecx +; DARWIN-32-DYNAMIC-NEXT: movl %eax, (%ecx) +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _off01: +; DARWIN-32-PIC: call "L39$pb" +; DARWIN-32-PIC-NEXT: "L39$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl 4(%esp), %ecx +; DARWIN-32-PIC-NEXT: movl L_dst$non_lazy_ptr-"L39$pb"(%eax), %edx +; DARWIN-32-PIC-NEXT: leal 64(%edx,%ecx,4), %ecx +; DARWIN-32-PIC-NEXT: movl L_ptr$non_lazy_ptr-"L39$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: movl %ecx, (%eax) +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _off01: +; DARWIN-64-STATIC: movq _dst@GOTPCREL(%rip), %rax +; DARWIN-64-STATIC-NEXT: leaq 64(%rax,%rdi,4), %rax +; DARWIN-64-STATIC-NEXT: movq _ptr@GOTPCREL(%rip), %rcx +; DARWIN-64-STATIC-NEXT: movq %rax, (%rcx) +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _off01: +; DARWIN-64-DYNAMIC: movq _dst@GOTPCREL(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: leaq 64(%rax,%rdi,4), %rax +; DARWIN-64-DYNAMIC-NEXT: movq _ptr@GOTPCREL(%rip), %rcx +; DARWIN-64-DYNAMIC-NEXT: movq %rax, (%rcx) +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _off01: +; DARWIN-64-PIC: movq _dst@GOTPCREL(%rip), %rax +; DARWIN-64-PIC-NEXT: leaq 64(%rax,%rdi,4), %rax +; DARWIN-64-PIC-NEXT: movq _ptr@GOTPCREL(%rip), %rcx +; DARWIN-64-PIC-NEXT: movq %rax, (%rcx) +; DARWIN-64-PIC-NEXT: ret } define void @oxf01(i64 %i) nounwind { @@ -660,6 +2819,71 @@ entry: ; LINUX-64-STATIC: leaq xdst+64(,%rdi,4), %rax ; LINUX-64-STATIC: movq %rax, ptr ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: oxf01: +; LINUX-32-STATIC: movl 4(%esp), %eax +; LINUX-32-STATIC-NEXT: leal xdst+64(,%eax,4), %eax +; LINUX-32-STATIC-NEXT: movl %eax, ptr +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: oxf01: +; LINUX-32-PIC: movl 4(%esp), %eax +; LINUX-32-PIC-NEXT: leal xdst+64(,%eax,4), %eax +; LINUX-32-PIC-NEXT: movl %eax, ptr +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: oxf01: +; LINUX-64-PIC: movq xdst@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: leaq 64(%rax,%rdi,4), %rax +; LINUX-64-PIC-NEXT: movq ptr@GOTPCREL(%rip), %rcx +; LINUX-64-PIC-NEXT: movq %rax, (%rcx) +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _oxf01: +; DARWIN-32-STATIC: movl 4(%esp), %eax +; DARWIN-32-STATIC-NEXT: leal _xdst+64(,%eax,4), %eax +; DARWIN-32-STATIC-NEXT: movl %eax, _ptr +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _oxf01: +; DARWIN-32-DYNAMIC: movl 4(%esp), %eax +; DARWIN-32-DYNAMIC-NEXT: movl L_xdst$non_lazy_ptr, %ecx +; DARWIN-32-DYNAMIC-NEXT: leal 64(%ecx,%eax,4), %eax +; DARWIN-32-DYNAMIC-NEXT: movl L_ptr$non_lazy_ptr, %ecx +; DARWIN-32-DYNAMIC-NEXT: movl %eax, (%ecx) +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _oxf01: +; DARWIN-32-PIC: call "L40$pb" +; DARWIN-32-PIC-NEXT: "L40$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl 4(%esp), %ecx +; DARWIN-32-PIC-NEXT: movl L_xdst$non_lazy_ptr-"L40$pb"(%eax), %edx +; DARWIN-32-PIC-NEXT: leal 64(%edx,%ecx,4), %ecx +; DARWIN-32-PIC-NEXT: movl L_ptr$non_lazy_ptr-"L40$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: movl %ecx, (%eax) +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _oxf01: +; DARWIN-64-STATIC: movq _xdst@GOTPCREL(%rip), %rax +; DARWIN-64-STATIC-NEXT: leaq 64(%rax,%rdi,4), %rax +; DARWIN-64-STATIC-NEXT: movq _ptr@GOTPCREL(%rip), %rcx +; DARWIN-64-STATIC-NEXT: movq %rax, (%rcx) +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _oxf01: +; DARWIN-64-DYNAMIC: movq _xdst@GOTPCREL(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: leaq 64(%rax,%rdi,4), %rax +; DARWIN-64-DYNAMIC-NEXT: movq _ptr@GOTPCREL(%rip), %rcx +; DARWIN-64-DYNAMIC-NEXT: movq %rax, (%rcx) +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _oxf01: +; DARWIN-64-PIC: movq _xdst@GOTPCREL(%rip), %rax +; DARWIN-64-PIC-NEXT: leaq 64(%rax,%rdi,4), %rax +; DARWIN-64-PIC-NEXT: movq _ptr@GOTPCREL(%rip), %rcx +; DARWIN-64-PIC-NEXT: movq %rax, (%rcx) +; DARWIN-64-PIC-NEXT: ret } define void @off02(i64 %i) nounwind { @@ -676,6 +2900,80 @@ entry: ; LINUX-64-STATIC: movq ptr(%rip), %rcx ; LINUX-64-STATIC: movl %eax, 64(%rcx,%rdi,4) ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: off02: +; LINUX-32-STATIC: movl 4(%esp), %eax +; LINUX-32-STATIC-NEXT: movl src+64(,%eax,4), %ecx +; LINUX-32-STATIC-NEXT: movl ptr, %edx +; LINUX-32-STATIC-NEXT: movl %ecx, 64(%edx,%eax,4) +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: off02: +; LINUX-32-PIC: movl 4(%esp), %eax +; LINUX-32-PIC-NEXT: movl src+64(,%eax,4), %ecx +; LINUX-32-PIC-NEXT: movl ptr, %edx +; LINUX-32-PIC-NEXT: movl %ecx, 64(%edx,%eax,4) +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: off02: +; LINUX-64-PIC: movq src@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: movl 64(%rax,%rdi,4), %eax +; LINUX-64-PIC-NEXT: movq ptr@GOTPCREL(%rip), %rcx +; LINUX-64-PIC-NEXT: movq (%rcx), %rcx +; LINUX-64-PIC-NEXT: movl %eax, 64(%rcx,%rdi,4) +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _off02: +; DARWIN-32-STATIC: movl 4(%esp), %eax +; DARWIN-32-STATIC-NEXT: movl _src+64(,%eax,4), %ecx +; DARWIN-32-STATIC-NEXT: movl _ptr, %edx +; DARWIN-32-STATIC-NEXT: movl %ecx, 64(%edx,%eax,4) +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _off02: +; DARWIN-32-DYNAMIC: movl 4(%esp), %eax +; DARWIN-32-DYNAMIC-NEXT: movl L_src$non_lazy_ptr, %ecx +; DARWIN-32-DYNAMIC-NEXT: movl 64(%ecx,%eax,4), %ecx +; DARWIN-32-DYNAMIC-NEXT: movl L_ptr$non_lazy_ptr, %edx +; DARWIN-32-DYNAMIC-NEXT: movl (%edx), %edx +; DARWIN-32-DYNAMIC-NEXT: movl %ecx, 64(%edx,%eax,4) +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _off02: +; DARWIN-32-PIC: call "L41$pb" +; DARWIN-32-PIC-NEXT: "L41$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl 4(%esp), %ecx +; DARWIN-32-PIC-NEXT: movl L_src$non_lazy_ptr-"L41$pb"(%eax), %edx +; DARWIN-32-PIC-NEXT: movl 64(%edx,%ecx,4), %edx +; DARWIN-32-PIC-NEXT: movl L_ptr$non_lazy_ptr-"L41$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: movl (%eax), %eax +; DARWIN-32-PIC-NEXT: movl %edx, 64(%eax,%ecx,4) +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _off02: +; DARWIN-64-STATIC: movq _src@GOTPCREL(%rip), %rax +; DARWIN-64-STATIC-NEXT: movl 64(%rax,%rdi,4), %eax +; DARWIN-64-STATIC-NEXT: movq _ptr@GOTPCREL(%rip), %rcx +; DARWIN-64-STATIC-NEXT: movq (%rcx), %rcx +; DARWIN-64-STATIC-NEXT: movl %eax, 64(%rcx,%rdi,4) +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _off02: +; DARWIN-64-DYNAMIC: movq _src@GOTPCREL(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: movl 64(%rax,%rdi,4), %eax +; DARWIN-64-DYNAMIC-NEXT: movq _ptr@GOTPCREL(%rip), %rcx +; DARWIN-64-DYNAMIC-NEXT: movq (%rcx), %rcx +; DARWIN-64-DYNAMIC-NEXT: movl %eax, 64(%rcx,%rdi,4) +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _off02: +; DARWIN-64-PIC: movq _src@GOTPCREL(%rip), %rax +; DARWIN-64-PIC-NEXT: movl 64(%rax,%rdi,4), %eax +; DARWIN-64-PIC-NEXT: movq _ptr@GOTPCREL(%rip), %rcx +; DARWIN-64-PIC-NEXT: movq (%rcx), %rcx +; DARWIN-64-PIC-NEXT: movl %eax, 64(%rcx,%rdi,4) +; DARWIN-64-PIC-NEXT: ret } define void @oxf02(i64 %i) nounwind { @@ -692,6 +2990,80 @@ entry: ; LINUX-64-STATIC: movq ptr(%rip), %rcx ; LINUX-64-STATIC: movl %eax, 64(%rcx,%rdi,4) ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: oxf02: +; LINUX-32-STATIC: movl 4(%esp), %eax +; LINUX-32-STATIC-NEXT: movl xsrc+64(,%eax,4), %ecx +; LINUX-32-STATIC-NEXT: movl ptr, %edx +; LINUX-32-STATIC-NEXT: movl %ecx, 64(%edx,%eax,4) +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: oxf02: +; LINUX-32-PIC: movl 4(%esp), %eax +; LINUX-32-PIC-NEXT: movl xsrc+64(,%eax,4), %ecx +; LINUX-32-PIC-NEXT: movl ptr, %edx +; LINUX-32-PIC-NEXT: movl %ecx, 64(%edx,%eax,4) +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: oxf02: +; LINUX-64-PIC: movq xsrc@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: movl 64(%rax,%rdi,4), %eax +; LINUX-64-PIC-NEXT: movq ptr@GOTPCREL(%rip), %rcx +; LINUX-64-PIC-NEXT: movq (%rcx), %rcx +; LINUX-64-PIC-NEXT: movl %eax, 64(%rcx,%rdi,4) +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _oxf02: +; DARWIN-32-STATIC: movl 4(%esp), %eax +; DARWIN-32-STATIC-NEXT: movl _xsrc+64(,%eax,4), %ecx +; DARWIN-32-STATIC-NEXT: movl _ptr, %edx +; DARWIN-32-STATIC-NEXT: movl %ecx, 64(%edx,%eax,4) +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _oxf02: +; DARWIN-32-DYNAMIC: movl 4(%esp), %eax +; DARWIN-32-DYNAMIC-NEXT: movl L_xsrc$non_lazy_ptr, %ecx +; DARWIN-32-DYNAMIC-NEXT: movl 64(%ecx,%eax,4), %ecx +; DARWIN-32-DYNAMIC-NEXT: movl L_ptr$non_lazy_ptr, %edx +; DARWIN-32-DYNAMIC-NEXT: movl (%edx), %edx +; DARWIN-32-DYNAMIC-NEXT: movl %ecx, 64(%edx,%eax,4) +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _oxf02: +; DARWIN-32-PIC: call "L42$pb" +; DARWIN-32-PIC-NEXT: "L42$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl 4(%esp), %ecx +; DARWIN-32-PIC-NEXT: movl L_xsrc$non_lazy_ptr-"L42$pb"(%eax), %edx +; DARWIN-32-PIC-NEXT: movl 64(%edx,%ecx,4), %edx +; DARWIN-32-PIC-NEXT: movl L_ptr$non_lazy_ptr-"L42$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: movl (%eax), %eax +; DARWIN-32-PIC-NEXT: movl %edx, 64(%eax,%ecx,4) +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _oxf02: +; DARWIN-64-STATIC: movq _xsrc@GOTPCREL(%rip), %rax +; DARWIN-64-STATIC-NEXT: movl 64(%rax,%rdi,4), %eax +; DARWIN-64-STATIC-NEXT: movq _ptr@GOTPCREL(%rip), %rcx +; DARWIN-64-STATIC-NEXT: movq (%rcx), %rcx +; DARWIN-64-STATIC-NEXT: movl %eax, 64(%rcx,%rdi,4) +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _oxf02: +; DARWIN-64-DYNAMIC: movq _xsrc@GOTPCREL(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: movl 64(%rax,%rdi,4), %eax +; DARWIN-64-DYNAMIC-NEXT: movq _ptr@GOTPCREL(%rip), %rcx +; DARWIN-64-DYNAMIC-NEXT: movq (%rcx), %rcx +; DARWIN-64-DYNAMIC-NEXT: movl %eax, 64(%rcx,%rdi,4) +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _oxf02: +; DARWIN-64-PIC: movq _xsrc@GOTPCREL(%rip), %rax +; DARWIN-64-PIC-NEXT: movl 64(%rax,%rdi,4), %eax +; DARWIN-64-PIC-NEXT: movq _ptr@GOTPCREL(%rip), %rcx +; DARWIN-64-PIC-NEXT: movq (%rcx), %rcx +; DARWIN-64-PIC-NEXT: movl %eax, 64(%rcx,%rdi,4) +; DARWIN-64-PIC-NEXT: ret } define void @off03(i64 %i) nounwind { @@ -706,6 +3078,67 @@ entry: ; LINUX-64-STATIC: movl dsrc+64(,%rdi,4), %eax ; LINUX-64-STATIC: movl %eax, ddst+64(,%rdi,4) ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: off03: +; LINUX-32-STATIC: movl 4(%esp), %eax +; LINUX-32-STATIC-NEXT: movl dsrc+64(,%eax,4), %ecx +; LINUX-32-STATIC-NEXT: movl %ecx, ddst+64(,%eax,4) +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: off03: +; LINUX-32-PIC: movl 4(%esp), %eax +; LINUX-32-PIC-NEXT: movl dsrc+64(,%eax,4), %ecx +; LINUX-32-PIC-NEXT: movl %ecx, ddst+64(,%eax,4) +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: off03: +; LINUX-64-PIC: movq dsrc@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: movl 64(%rax,%rdi,4), %eax +; LINUX-64-PIC-NEXT: movq ddst@GOTPCREL(%rip), %rcx +; LINUX-64-PIC-NEXT: movl %eax, 64(%rcx,%rdi,4) +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _off03: +; DARWIN-32-STATIC: movl 4(%esp), %eax +; DARWIN-32-STATIC-NEXT: movl _dsrc+64(,%eax,4), %ecx +; DARWIN-32-STATIC-NEXT: movl %ecx, _ddst+64(,%eax,4) +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _off03: +; DARWIN-32-DYNAMIC: movl 4(%esp), %eax +; DARWIN-32-DYNAMIC-NEXT: movl _dsrc+64(,%eax,4), %ecx +; DARWIN-32-DYNAMIC-NEXT: movl %ecx, _ddst+64(,%eax,4) +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _off03: +; DARWIN-32-PIC: call "L43$pb" +; DARWIN-32-PIC-NEXT: "L43$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl 4(%esp), %ecx +; DARWIN-32-PIC-NEXT: movl _dsrc+64-"L43$pb"(%eax,%ecx,4), %edx +; DARWIN-32-PIC-NEXT: movl %edx, _ddst+64-"L43$pb"(%eax,%ecx,4) +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _off03: +; DARWIN-64-STATIC: leaq _dsrc(%rip), %rax +; DARWIN-64-STATIC-NEXT: movl 64(%rax,%rdi,4), %eax +; DARWIN-64-STATIC-NEXT: leaq _ddst(%rip), %rcx +; DARWIN-64-STATIC-NEXT: movl %eax, 64(%rcx,%rdi,4) +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _off03: +; DARWIN-64-DYNAMIC: leaq _dsrc(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: movl 64(%rax,%rdi,4), %eax +; DARWIN-64-DYNAMIC-NEXT: leaq _ddst(%rip), %rcx +; DARWIN-64-DYNAMIC-NEXT: movl %eax, 64(%rcx,%rdi,4) +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _off03: +; DARWIN-64-PIC: leaq _dsrc(%rip), %rax +; DARWIN-64-PIC-NEXT: movl 64(%rax,%rdi,4), %eax +; DARWIN-64-PIC-NEXT: leaq _ddst(%rip), %rcx +; DARWIN-64-PIC-NEXT: movl %eax, 64(%rcx,%rdi,4) +; DARWIN-64-PIC-NEXT: ret } define void @off04(i64 %i) nounwind { @@ -718,6 +3151,64 @@ entry: ; LINUX-64-STATIC: leaq ddst+64(,%rdi,4), %rax ; LINUX-64-STATIC: movq %rax, dptr ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: off04: +; LINUX-32-STATIC: movl 4(%esp), %eax +; LINUX-32-STATIC-NEXT: leal ddst+64(,%eax,4), %eax +; LINUX-32-STATIC-NEXT: movl %eax, dptr +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: off04: +; LINUX-32-PIC: movl 4(%esp), %eax +; LINUX-32-PIC-NEXT: leal ddst+64(,%eax,4), %eax +; LINUX-32-PIC-NEXT: movl %eax, dptr +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: off04: +; LINUX-64-PIC: movq ddst@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: leaq 64(%rax,%rdi,4), %rax +; LINUX-64-PIC-NEXT: movq dptr@GOTPCREL(%rip), %rcx +; LINUX-64-PIC-NEXT: movq %rax, (%rcx) +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _off04: +; DARWIN-32-STATIC: movl 4(%esp), %eax +; DARWIN-32-STATIC-NEXT: leal _ddst+64(,%eax,4), %eax +; DARWIN-32-STATIC-NEXT: movl %eax, _dptr +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _off04: +; DARWIN-32-DYNAMIC: movl 4(%esp), %eax +; DARWIN-32-DYNAMIC-NEXT: leal _ddst+64(,%eax,4), %eax +; DARWIN-32-DYNAMIC-NEXT: movl %eax, _dptr +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _off04: +; DARWIN-32-PIC: call "L44$pb" +; DARWIN-32-PIC-NEXT: "L44$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl 4(%esp), %ecx +; DARWIN-32-PIC-NEXT: leal _ddst+64-"L44$pb"(%eax,%ecx,4), %ecx +; DARWIN-32-PIC-NEXT: movl %ecx, _dptr-"L44$pb"(%eax) +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _off04: +; DARWIN-64-STATIC: leaq _ddst(%rip), %rax +; DARWIN-64-STATIC-NEXT: leaq 64(%rax,%rdi,4), %rax +; DARWIN-64-STATIC-NEXT: movq %rax, _dptr(%rip) +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _off04: +; DARWIN-64-DYNAMIC: leaq _ddst(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: leaq 64(%rax,%rdi,4), %rax +; DARWIN-64-DYNAMIC-NEXT: movq %rax, _dptr(%rip) +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _off04: +; DARWIN-64-PIC: leaq _ddst(%rip), %rax +; DARWIN-64-PIC-NEXT: leaq 64(%rax,%rdi,4), %rax +; DARWIN-64-PIC-NEXT: movq %rax, _dptr(%rip) +; DARWIN-64-PIC-NEXT: ret } define void @off05(i64 %i) nounwind { @@ -734,6 +3225,73 @@ entry: ; LINUX-64-STATIC: movq dptr(%rip), %rcx ; LINUX-64-STATIC: movl %eax, 64(%rcx,%rdi,4) ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: off05: +; LINUX-32-STATIC: movl 4(%esp), %eax +; LINUX-32-STATIC-NEXT: movl dsrc+64(,%eax,4), %ecx +; LINUX-32-STATIC-NEXT: movl dptr, %edx +; LINUX-32-STATIC-NEXT: movl %ecx, 64(%edx,%eax,4) +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: off05: +; LINUX-32-PIC: movl 4(%esp), %eax +; LINUX-32-PIC-NEXT: movl dsrc+64(,%eax,4), %ecx +; LINUX-32-PIC-NEXT: movl dptr, %edx +; LINUX-32-PIC-NEXT: movl %ecx, 64(%edx,%eax,4) +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: off05: +; LINUX-64-PIC: movq dsrc@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: movl 64(%rax,%rdi,4), %eax +; LINUX-64-PIC-NEXT: movq dptr@GOTPCREL(%rip), %rcx +; LINUX-64-PIC-NEXT: movq (%rcx), %rcx +; LINUX-64-PIC-NEXT: movl %eax, 64(%rcx,%rdi,4) +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _off05: +; DARWIN-32-STATIC: movl 4(%esp), %eax +; DARWIN-32-STATIC-NEXT: movl _dsrc+64(,%eax,4), %ecx +; DARWIN-32-STATIC-NEXT: movl _dptr, %edx +; DARWIN-32-STATIC-NEXT: movl %ecx, 64(%edx,%eax,4) +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _off05: +; DARWIN-32-DYNAMIC: movl 4(%esp), %eax +; DARWIN-32-DYNAMIC-NEXT: movl _dsrc+64(,%eax,4), %ecx +; DARWIN-32-DYNAMIC-NEXT: movl _dptr, %edx +; DARWIN-32-DYNAMIC-NEXT: movl %ecx, 64(%edx,%eax,4) +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _off05: +; DARWIN-32-PIC: call "L45$pb" +; DARWIN-32-PIC-NEXT: "L45$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl 4(%esp), %ecx +; DARWIN-32-PIC-NEXT: movl _dsrc+64-"L45$pb"(%eax,%ecx,4), %edx +; DARWIN-32-PIC-NEXT: movl _dptr-"L45$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: movl %edx, 64(%eax,%ecx,4) +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _off05: +; DARWIN-64-STATIC: leaq _dsrc(%rip), %rax +; DARWIN-64-STATIC-NEXT: movl 64(%rax,%rdi,4), %eax +; DARWIN-64-STATIC-NEXT: movq _dptr(%rip), %rcx +; DARWIN-64-STATIC-NEXT: movl %eax, 64(%rcx,%rdi,4) +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _off05: +; DARWIN-64-DYNAMIC: leaq _dsrc(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: movl 64(%rax,%rdi,4), %eax +; DARWIN-64-DYNAMIC-NEXT: movq _dptr(%rip), %rcx +; DARWIN-64-DYNAMIC-NEXT: movl %eax, 64(%rcx,%rdi,4) +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _off05: +; DARWIN-64-PIC: leaq _dsrc(%rip), %rax +; DARWIN-64-PIC-NEXT: movl 64(%rax,%rdi,4), %eax +; DARWIN-64-PIC-NEXT: movq _dptr(%rip), %rcx +; DARWIN-64-PIC-NEXT: movl %eax, 64(%rcx,%rdi,4) +; DARWIN-64-PIC-NEXT: ret } define void @off06(i64 %i) nounwind { @@ -748,6 +3306,67 @@ entry: ; LINUX-64-STATIC: movl lsrc+64(,%rdi,4), %eax ; LINUX-64-STATIC: movl %eax, ldst+64(,%rdi,4) ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: off06: +; LINUX-32-STATIC: movl 4(%esp), %eax +; LINUX-32-STATIC-NEXT: movl lsrc+64(,%eax,4), %ecx +; LINUX-32-STATIC-NEXT: movl %ecx, ldst+64(,%eax,4) +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: off06: +; LINUX-32-PIC: movl 4(%esp), %eax +; LINUX-32-PIC-NEXT: movl lsrc+64(,%eax,4), %ecx +; LINUX-32-PIC-NEXT: movl %ecx, ldst+64(,%eax,4) +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: off06: +; LINUX-64-PIC: leaq lsrc(%rip), %rax +; LINUX-64-PIC-NEXT: movl 64(%rax,%rdi,4), %eax +; LINUX-64-PIC-NEXT: leaq ldst(%rip), %rcx +; LINUX-64-PIC-NEXT: movl %eax, 64(%rcx,%rdi,4) +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _off06: +; DARWIN-32-STATIC: movl 4(%esp), %eax +; DARWIN-32-STATIC-NEXT: movl _lsrc+64(,%eax,4), %ecx +; DARWIN-32-STATIC-NEXT: movl %ecx, _ldst+64(,%eax,4) +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _off06: +; DARWIN-32-DYNAMIC: movl 4(%esp), %eax +; DARWIN-32-DYNAMIC-NEXT: movl _lsrc+64(,%eax,4), %ecx +; DARWIN-32-DYNAMIC-NEXT: movl %ecx, _ldst+64(,%eax,4) +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _off06: +; DARWIN-32-PIC: call "L46$pb" +; DARWIN-32-PIC-NEXT: "L46$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl 4(%esp), %ecx +; DARWIN-32-PIC-NEXT: movl _lsrc+64-"L46$pb"(%eax,%ecx,4), %edx +; DARWIN-32-PIC-NEXT: movl %edx, _ldst+64-"L46$pb"(%eax,%ecx,4) +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _off06: +; DARWIN-64-STATIC: leaq _lsrc(%rip), %rax +; DARWIN-64-STATIC-NEXT: movl 64(%rax,%rdi,4), %eax +; DARWIN-64-STATIC-NEXT: leaq _ldst(%rip), %rcx +; DARWIN-64-STATIC-NEXT: movl %eax, 64(%rcx,%rdi,4) +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _off06: +; DARWIN-64-DYNAMIC: leaq _lsrc(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: movl 64(%rax,%rdi,4), %eax +; DARWIN-64-DYNAMIC-NEXT: leaq _ldst(%rip), %rcx +; DARWIN-64-DYNAMIC-NEXT: movl %eax, 64(%rcx,%rdi,4) +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _off06: +; DARWIN-64-PIC: leaq _lsrc(%rip), %rax +; DARWIN-64-PIC-NEXT: movl 64(%rax,%rdi,4), %eax +; DARWIN-64-PIC-NEXT: leaq _ldst(%rip), %rcx +; DARWIN-64-PIC-NEXT: movl %eax, 64(%rcx,%rdi,4) +; DARWIN-64-PIC-NEXT: ret } define void @off07(i64 %i) nounwind { @@ -760,6 +3379,63 @@ entry: ; LINUX-64-STATIC: leaq ldst+64(,%rdi,4), %rax ; LINUX-64-STATIC: movq %rax, lptr ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: off07: +; LINUX-32-STATIC: movl 4(%esp), %eax +; LINUX-32-STATIC-NEXT: leal ldst+64(,%eax,4), %eax +; LINUX-32-STATIC-NEXT: movl %eax, lptr +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: off07: +; LINUX-32-PIC: movl 4(%esp), %eax +; LINUX-32-PIC-NEXT: leal ldst+64(,%eax,4), %eax +; LINUX-32-PIC-NEXT: movl %eax, lptr +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: off07: +; LINUX-64-PIC: leaq ldst(%rip), %rax +; LINUX-64-PIC-NEXT: leaq 64(%rax,%rdi,4), %rax +; LINUX-64-PIC-NEXT: movq %rax, lptr(%rip) +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _off07: +; DARWIN-32-STATIC: movl 4(%esp), %eax +; DARWIN-32-STATIC-NEXT: leal _ldst+64(,%eax,4), %eax +; DARWIN-32-STATIC-NEXT: movl %eax, _lptr +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _off07: +; DARWIN-32-DYNAMIC: movl 4(%esp), %eax +; DARWIN-32-DYNAMIC-NEXT: leal _ldst+64(,%eax,4), %eax +; DARWIN-32-DYNAMIC-NEXT: movl %eax, _lptr +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _off07: +; DARWIN-32-PIC: call "L47$pb" +; DARWIN-32-PIC-NEXT: "L47$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl 4(%esp), %ecx +; DARWIN-32-PIC-NEXT: leal _ldst+64-"L47$pb"(%eax,%ecx,4), %ecx +; DARWIN-32-PIC-NEXT: movl %ecx, _lptr-"L47$pb"(%eax) +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _off07: +; DARWIN-64-STATIC: leaq _ldst(%rip), %rax +; DARWIN-64-STATIC-NEXT: leaq 64(%rax,%rdi,4), %rax +; DARWIN-64-STATIC-NEXT: movq %rax, _lptr(%rip) +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _off07: +; DARWIN-64-DYNAMIC: leaq _ldst(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: leaq 64(%rax,%rdi,4), %rax +; DARWIN-64-DYNAMIC-NEXT: movq %rax, _lptr(%rip) +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _off07: +; DARWIN-64-PIC: leaq _ldst(%rip), %rax +; DARWIN-64-PIC-NEXT: leaq 64(%rax,%rdi,4), %rax +; DARWIN-64-PIC-NEXT: movq %rax, _lptr(%rip) +; DARWIN-64-PIC-NEXT: ret } define void @off08(i64 %i) nounwind { @@ -776,6 +3452,72 @@ entry: ; LINUX-64-STATIC: movq lptr(%rip), %rcx ; LINUX-64-STATIC: movl %eax, 64(%rcx,%rdi,4) ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: off08: +; LINUX-32-STATIC: movl 4(%esp), %eax +; LINUX-32-STATIC-NEXT: movl lsrc+64(,%eax,4), %ecx +; LINUX-32-STATIC-NEXT: movl lptr, %edx +; LINUX-32-STATIC-NEXT: movl %ecx, 64(%edx,%eax,4) +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: off08: +; LINUX-32-PIC: movl 4(%esp), %eax +; LINUX-32-PIC-NEXT: movl lsrc+64(,%eax,4), %ecx +; LINUX-32-PIC-NEXT: movl lptr, %edx +; LINUX-32-PIC-NEXT: movl %ecx, 64(%edx,%eax,4) +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: off08: +; LINUX-64-PIC: leaq lsrc(%rip), %rax +; LINUX-64-PIC-NEXT: movl 64(%rax,%rdi,4), %eax +; LINUX-64-PIC-NEXT: movq lptr(%rip), %rcx +; LINUX-64-PIC-NEXT: movl %eax, 64(%rcx,%rdi,4) +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _off08: +; DARWIN-32-STATIC: movl 4(%esp), %eax +; DARWIN-32-STATIC-NEXT: movl _lsrc+64(,%eax,4), %ecx +; DARWIN-32-STATIC-NEXT: movl _lptr, %edx +; DARWIN-32-STATIC-NEXT: movl %ecx, 64(%edx,%eax,4) +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _off08: +; DARWIN-32-DYNAMIC: movl 4(%esp), %eax +; DARWIN-32-DYNAMIC-NEXT: movl _lsrc+64(,%eax,4), %ecx +; DARWIN-32-DYNAMIC-NEXT: movl _lptr, %edx +; DARWIN-32-DYNAMIC-NEXT: movl %ecx, 64(%edx,%eax,4) +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _off08: +; DARWIN-32-PIC: call "L48$pb" +; DARWIN-32-PIC-NEXT: "L48$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl 4(%esp), %ecx +; DARWIN-32-PIC-NEXT: movl _lsrc+64-"L48$pb"(%eax,%ecx,4), %edx +; DARWIN-32-PIC-NEXT: movl _lptr-"L48$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: movl %edx, 64(%eax,%ecx,4) +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _off08: +; DARWIN-64-STATIC: leaq _lsrc(%rip), %rax +; DARWIN-64-STATIC-NEXT: movl 64(%rax,%rdi,4), %eax +; DARWIN-64-STATIC-NEXT: movq _lptr(%rip), %rcx +; DARWIN-64-STATIC-NEXT: movl %eax, 64(%rcx,%rdi,4) +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _off08: +; DARWIN-64-DYNAMIC: leaq _lsrc(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: movl 64(%rax,%rdi,4), %eax +; DARWIN-64-DYNAMIC-NEXT: movq _lptr(%rip), %rcx +; DARWIN-64-DYNAMIC-NEXT: movl %eax, 64(%rcx,%rdi,4) +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _off08: +; DARWIN-64-PIC: leaq _lsrc(%rip), %rax +; DARWIN-64-PIC-NEXT: movl 64(%rax,%rdi,4), %eax +; DARWIN-64-PIC-NEXT: movq _lptr(%rip), %rcx +; DARWIN-64-PIC-NEXT: movl %eax, 64(%rcx,%rdi,4) +; DARWIN-64-PIC-NEXT: ret } define void @moo00(i64 %i) nounwind { @@ -787,6 +3529,66 @@ entry: ; LINUX-64-STATIC: movl src+262144(%rip), %eax ; LINUX-64-STATIC: movl %eax, dst+262144(%rip) ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: moo00: +; LINUX-32-STATIC: movl src+262144, %eax +; LINUX-32-STATIC-NEXT: movl %eax, dst+262144 +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: moo00: +; LINUX-32-PIC: movl src+262144, %eax +; LINUX-32-PIC-NEXT: movl %eax, dst+262144 +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: moo00: +; LINUX-64-PIC: movq src@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: movl 262144(%rax), %eax +; LINUX-64-PIC-NEXT: movq dst@GOTPCREL(%rip), %rcx +; LINUX-64-PIC-NEXT: movl %eax, 262144(%rcx) +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _moo00: +; DARWIN-32-STATIC: movl _src+262144, %eax +; DARWIN-32-STATIC-NEXT: movl %eax, _dst+262144 +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _moo00: +; DARWIN-32-DYNAMIC: movl L_src$non_lazy_ptr, %eax +; DARWIN-32-DYNAMIC-NEXT: movl 262144(%eax), %eax +; DARWIN-32-DYNAMIC-NEXT: movl L_dst$non_lazy_ptr, %ecx +; DARWIN-32-DYNAMIC-NEXT: movl %eax, 262144(%ecx) +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _moo00: +; DARWIN-32-PIC: call "L49$pb" +; DARWIN-32-PIC-NEXT: "L49$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl L_src$non_lazy_ptr-"L49$pb"(%eax), %ecx +; DARWIN-32-PIC-NEXT: movl 262144(%ecx), %ecx +; DARWIN-32-PIC-NEXT: movl L_dst$non_lazy_ptr-"L49$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: movl %ecx, 262144(%eax) +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _moo00: +; DARWIN-64-STATIC: movq _src@GOTPCREL(%rip), %rax +; DARWIN-64-STATIC-NEXT: movl 262144(%rax), %eax +; DARWIN-64-STATIC-NEXT: movq _dst@GOTPCREL(%rip), %rcx +; DARWIN-64-STATIC-NEXT: movl %eax, 262144(%rcx) +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _moo00: +; DARWIN-64-DYNAMIC: movq _src@GOTPCREL(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: movl 262144(%rax), %eax +; DARWIN-64-DYNAMIC-NEXT: movq _dst@GOTPCREL(%rip), %rcx +; DARWIN-64-DYNAMIC-NEXT: movl %eax, 262144(%rcx) +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _moo00: +; DARWIN-64-PIC: movq _src@GOTPCREL(%rip), %rax +; DARWIN-64-PIC-NEXT: movl 262144(%rax), %eax +; DARWIN-64-PIC-NEXT: movq _dst@GOTPCREL(%rip), %rcx +; DARWIN-64-PIC-NEXT: movl %eax, 262144(%rcx) +; DARWIN-64-PIC-NEXT: ret } define void @moo01(i64 %i) nounwind { @@ -796,6 +3598,63 @@ entry: ; LINUX-64-STATIC: moo01: ; LINUX-64-STATIC: movq $dst+262144, ptr(%rip) ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: moo01: +; LINUX-32-STATIC: movl $dst+262144, ptr +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: moo01: +; LINUX-32-PIC: movl $dst+262144, ptr +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: moo01: +; LINUX-64-PIC: movl $262144, %eax +; LINUX-64-PIC-NEXT: addq dst@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: movq ptr@GOTPCREL(%rip), %rcx +; LINUX-64-PIC-NEXT: movq %rax, (%rcx) +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _moo01: +; DARWIN-32-STATIC: movl $_dst+262144, _ptr +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _moo01: +; DARWIN-32-DYNAMIC: movl $262144, %eax +; DARWIN-32-DYNAMIC-NEXT: addl L_dst$non_lazy_ptr, %eax +; DARWIN-32-DYNAMIC-NEXT: movl L_ptr$non_lazy_ptr, %ecx +; DARWIN-32-DYNAMIC-NEXT: movl %eax, (%ecx) +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _moo01: +; DARWIN-32-PIC: call "L50$pb" +; DARWIN-32-PIC-NEXT: "L50$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl $262144, %ecx +; DARWIN-32-PIC-NEXT: addl L_dst$non_lazy_ptr-"L50$pb"(%eax), %ecx +; DARWIN-32-PIC-NEXT: movl L_ptr$non_lazy_ptr-"L50$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: movl %ecx, (%eax) +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _moo01: +; DARWIN-64-STATIC: movl $262144, %eax +; DARWIN-64-STATIC-NEXT: addq _dst@GOTPCREL(%rip), %rax +; DARWIN-64-STATIC-NEXT: movq _ptr@GOTPCREL(%rip), %rcx +; DARWIN-64-STATIC-NEXT: movq %rax, (%rcx) +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _moo01: +; DARWIN-64-DYNAMIC: movl $262144, %eax +; DARWIN-64-DYNAMIC-NEXT: addq _dst@GOTPCREL(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: movq _ptr@GOTPCREL(%rip), %rcx +; DARWIN-64-DYNAMIC-NEXT: movq %rax, (%rcx) +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _moo01: +; DARWIN-64-PIC: movl $262144, %eax +; DARWIN-64-PIC-NEXT: addq _dst@GOTPCREL(%rip), %rax +; DARWIN-64-PIC-NEXT: movq _ptr@GOTPCREL(%rip), %rcx +; DARWIN-64-PIC-NEXT: movq %rax, (%rcx) +; DARWIN-64-PIC-NEXT: ret } define void @moo02(i64 %i) nounwind { @@ -810,6 +3669,75 @@ entry: ; LINUX-64-STATIC: movq ptr(%rip), %rcx ; LINUX-64-STATIC: movl %eax, 262144(%rcx) ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: moo02: +; LINUX-32-STATIC: movl src+262144, %eax +; LINUX-32-STATIC-NEXT: movl ptr, %ecx +; LINUX-32-STATIC-NEXT: movl %eax, 262144(%ecx) +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: moo02: +; LINUX-32-PIC: movl src+262144, %eax +; LINUX-32-PIC-NEXT: movl ptr, %ecx +; LINUX-32-PIC-NEXT: movl %eax, 262144(%ecx) +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: moo02: +; LINUX-64-PIC: movq src@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: movl 262144(%rax), %eax +; LINUX-64-PIC-NEXT: movq ptr@GOTPCREL(%rip), %rcx +; LINUX-64-PIC-NEXT: movq (%rcx), %rcx +; LINUX-64-PIC-NEXT: movl %eax, 262144(%rcx) +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _moo02: +; DARWIN-32-STATIC: movl _src+262144, %eax +; DARWIN-32-STATIC-NEXT: movl _ptr, %ecx +; DARWIN-32-STATIC-NEXT: movl %eax, 262144(%ecx) +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _moo02: +; DARWIN-32-DYNAMIC: movl L_src$non_lazy_ptr, %eax +; DARWIN-32-DYNAMIC-NEXT: movl 262144(%eax), %eax +; DARWIN-32-DYNAMIC-NEXT: movl L_ptr$non_lazy_ptr, %ecx +; DARWIN-32-DYNAMIC-NEXT: movl (%ecx), %ecx +; DARWIN-32-DYNAMIC-NEXT: movl %eax, 262144(%ecx) +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _moo02: +; DARWIN-32-PIC: call "L51$pb" +; DARWIN-32-PIC-NEXT: "L51$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl L_src$non_lazy_ptr-"L51$pb"(%eax), %ecx +; DARWIN-32-PIC-NEXT: movl 262144(%ecx), %ecx +; DARWIN-32-PIC-NEXT: movl L_ptr$non_lazy_ptr-"L51$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: movl (%eax), %eax +; DARWIN-32-PIC-NEXT: movl %ecx, 262144(%eax) +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _moo02: +; DARWIN-64-STATIC: movq _src@GOTPCREL(%rip), %rax +; DARWIN-64-STATIC-NEXT: movl 262144(%rax), %eax +; DARWIN-64-STATIC-NEXT: movq _ptr@GOTPCREL(%rip), %rcx +; DARWIN-64-STATIC-NEXT: movq (%rcx), %rcx +; DARWIN-64-STATIC-NEXT: movl %eax, 262144(%rcx) +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _moo02: +; DARWIN-64-DYNAMIC: movq _src@GOTPCREL(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: movl 262144(%rax), %eax +; DARWIN-64-DYNAMIC-NEXT: movq _ptr@GOTPCREL(%rip), %rcx +; DARWIN-64-DYNAMIC-NEXT: movq (%rcx), %rcx +; DARWIN-64-DYNAMIC-NEXT: movl %eax, 262144(%rcx) +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _moo02: +; DARWIN-64-PIC: movq _src@GOTPCREL(%rip), %rax +; DARWIN-64-PIC-NEXT: movl 262144(%rax), %eax +; DARWIN-64-PIC-NEXT: movq _ptr@GOTPCREL(%rip), %rcx +; DARWIN-64-PIC-NEXT: movq (%rcx), %rcx +; DARWIN-64-PIC-NEXT: movl %eax, 262144(%rcx) +; DARWIN-64-PIC-NEXT: ret } define void @moo03(i64 %i) nounwind { @@ -821,6 +3749,56 @@ entry: ; LINUX-64-STATIC: movl dsrc+262144(%rip), %eax ; LINUX-64-STATIC: movl %eax, ddst+262144(%rip) ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: moo03: +; LINUX-32-STATIC: movl dsrc+262144, %eax +; LINUX-32-STATIC-NEXT: movl %eax, ddst+262144 +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: moo03: +; LINUX-32-PIC: movl dsrc+262144, %eax +; LINUX-32-PIC-NEXT: movl %eax, ddst+262144 +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: moo03: +; LINUX-64-PIC: movq dsrc@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: movl 262144(%rax), %eax +; LINUX-64-PIC-NEXT: movq ddst@GOTPCREL(%rip), %rcx +; LINUX-64-PIC-NEXT: movl %eax, 262144(%rcx) +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _moo03: +; DARWIN-32-STATIC: movl _dsrc+262144, %eax +; DARWIN-32-STATIC-NEXT: movl %eax, _ddst+262144 +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _moo03: +; DARWIN-32-DYNAMIC: movl _dsrc+262144, %eax +; DARWIN-32-DYNAMIC-NEXT: movl %eax, _ddst+262144 +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _moo03: +; DARWIN-32-PIC: call "L52$pb" +; DARWIN-32-PIC-NEXT: "L52$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl _dsrc+262144-"L52$pb"(%eax), %ecx +; DARWIN-32-PIC-NEXT: movl %ecx, _ddst+262144-"L52$pb"(%eax) +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _moo03: +; DARWIN-64-STATIC: movl _dsrc+262144(%rip), %eax +; DARWIN-64-STATIC-NEXT: movl %eax, _ddst+262144(%rip) +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _moo03: +; DARWIN-64-DYNAMIC: movl _dsrc+262144(%rip), %eax +; DARWIN-64-DYNAMIC-NEXT: movl %eax, _ddst+262144(%rip) +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _moo03: +; DARWIN-64-PIC: movl _dsrc+262144(%rip), %eax +; DARWIN-64-PIC-NEXT: movl %eax, _ddst+262144(%rip) +; DARWIN-64-PIC-NEXT: ret } define void @moo04(i64 %i) nounwind { @@ -830,6 +3808,52 @@ entry: ; LINUX-64-STATIC: moo04: ; LINUX-64-STATIC: movq $ddst+262144, dptr ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: moo04: +; LINUX-32-STATIC: movl $ddst+262144, dptr +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: moo04: +; LINUX-32-PIC: movl $ddst+262144, dptr +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: moo04: +; LINUX-64-PIC: movl $262144, %eax +; LINUX-64-PIC-NEXT: addq ddst@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: movq dptr@GOTPCREL(%rip), %rcx +; LINUX-64-PIC-NEXT: movq %rax, (%rcx) +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _moo04: +; DARWIN-32-STATIC: movl $_ddst+262144, _dptr +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _moo04: +; DARWIN-32-DYNAMIC: movl $_ddst+262144, _dptr +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _moo04: +; DARWIN-32-PIC: call "L53$pb" +; DARWIN-32-PIC-NEXT: "L53$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: leal _ddst+262144-"L53$pb"(%eax), %ecx +; DARWIN-32-PIC-NEXT: movl %ecx, _dptr-"L53$pb"(%eax) +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _moo04: +; DARWIN-64-STATIC: leaq _ddst+262144(%rip), %rax +; DARWIN-64-STATIC-NEXT: movq %rax, _dptr(%rip) +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _moo04: +; DARWIN-64-DYNAMIC: leaq _ddst+262144(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: movq %rax, _dptr(%rip) +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _moo04: +; DARWIN-64-PIC: leaq _ddst+262144(%rip), %rax +; DARWIN-64-PIC-NEXT: movq %rax, _dptr(%rip) +; DARWIN-64-PIC-NEXT: ret } define void @moo05(i64 %i) nounwind { @@ -844,6 +3868,65 @@ entry: ; LINUX-64-STATIC: movq dptr(%rip), %rcx ; LINUX-64-STATIC: movl %eax, 262144(%rcx) ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: moo05: +; LINUX-32-STATIC: movl dsrc+262144, %eax +; LINUX-32-STATIC-NEXT: movl dptr, %ecx +; LINUX-32-STATIC-NEXT: movl %eax, 262144(%ecx) +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: moo05: +; LINUX-32-PIC: movl dsrc+262144, %eax +; LINUX-32-PIC-NEXT: movl dptr, %ecx +; LINUX-32-PIC-NEXT: movl %eax, 262144(%ecx) +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: moo05: +; LINUX-64-PIC: movq dsrc@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: movl 262144(%rax), %eax +; LINUX-64-PIC-NEXT: movq dptr@GOTPCREL(%rip), %rcx +; LINUX-64-PIC-NEXT: movq (%rcx), %rcx +; LINUX-64-PIC-NEXT: movl %eax, 262144(%rcx) +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _moo05: +; DARWIN-32-STATIC: movl _dsrc+262144, %eax +; DARWIN-32-STATIC-NEXT: movl _dptr, %ecx +; DARWIN-32-STATIC-NEXT: movl %eax, 262144(%ecx) +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _moo05: +; DARWIN-32-DYNAMIC: movl _dsrc+262144, %eax +; DARWIN-32-DYNAMIC-NEXT: movl _dptr, %ecx +; DARWIN-32-DYNAMIC-NEXT: movl %eax, 262144(%ecx) +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _moo05: +; DARWIN-32-PIC: call "L54$pb" +; DARWIN-32-PIC-NEXT: "L54$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl _dsrc+262144-"L54$pb"(%eax), %ecx +; DARWIN-32-PIC-NEXT: movl _dptr-"L54$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: movl %ecx, 262144(%eax) +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _moo05: +; DARWIN-64-STATIC: movl _dsrc+262144(%rip), %eax +; DARWIN-64-STATIC-NEXT: movq _dptr(%rip), %rcx +; DARWIN-64-STATIC-NEXT: movl %eax, 262144(%rcx) +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _moo05: +; DARWIN-64-DYNAMIC: movl _dsrc+262144(%rip), %eax +; DARWIN-64-DYNAMIC-NEXT: movq _dptr(%rip), %rcx +; DARWIN-64-DYNAMIC-NEXT: movl %eax, 262144(%rcx) +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _moo05: +; DARWIN-64-PIC: movl _dsrc+262144(%rip), %eax +; DARWIN-64-PIC-NEXT: movq _dptr(%rip), %rcx +; DARWIN-64-PIC-NEXT: movl %eax, 262144(%rcx) +; DARWIN-64-PIC-NEXT: ret } define void @moo06(i64 %i) nounwind { @@ -855,6 +3938,54 @@ entry: ; LINUX-64-STATIC: movl lsrc+262144(%rip), %eax ; LINUX-64-STATIC: movl %eax, ldst+262144(%rip) ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: moo06: +; LINUX-32-STATIC: movl lsrc+262144, %eax +; LINUX-32-STATIC-NEXT: movl %eax, ldst+262144 +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: moo06: +; LINUX-32-PIC: movl lsrc+262144, %eax +; LINUX-32-PIC-NEXT: movl %eax, ldst+262144 +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: moo06: +; LINUX-64-PIC: movl lsrc+262144(%rip), %eax +; LINUX-64-PIC-NEXT: movl %eax, ldst+262144(%rip) +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _moo06: +; DARWIN-32-STATIC: movl _lsrc+262144, %eax +; DARWIN-32-STATIC-NEXT: movl %eax, _ldst+262144 +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _moo06: +; DARWIN-32-DYNAMIC: movl _lsrc+262144, %eax +; DARWIN-32-DYNAMIC-NEXT: movl %eax, _ldst+262144 +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _moo06: +; DARWIN-32-PIC: call "L55$pb" +; DARWIN-32-PIC-NEXT: "L55$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl _lsrc+262144-"L55$pb"(%eax), %ecx +; DARWIN-32-PIC-NEXT: movl %ecx, _ldst+262144-"L55$pb"(%eax) +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _moo06: +; DARWIN-64-STATIC: movl _lsrc+262144(%rip), %eax +; DARWIN-64-STATIC-NEXT: movl %eax, _ldst+262144(%rip) +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _moo06: +; DARWIN-64-DYNAMIC: movl _lsrc+262144(%rip), %eax +; DARWIN-64-DYNAMIC-NEXT: movl %eax, _ldst+262144(%rip) +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _moo06: +; DARWIN-64-PIC: movl _lsrc+262144(%rip), %eax +; DARWIN-64-PIC-NEXT: movl %eax, _ldst+262144(%rip) +; DARWIN-64-PIC-NEXT: ret } define void @moo07(i64 %i) nounwind { @@ -864,6 +3995,50 @@ entry: ; LINUX-64-STATIC: moo07: ; LINUX-64-STATIC: movq $ldst+262144, lptr ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: moo07: +; LINUX-32-STATIC: movl $ldst+262144, lptr +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: moo07: +; LINUX-32-PIC: movl $ldst+262144, lptr +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: moo07: +; LINUX-64-PIC: leaq ldst+262144(%rip), %rax +; LINUX-64-PIC-NEXT: movq %rax, lptr(%rip) +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _moo07: +; DARWIN-32-STATIC: movl $_ldst+262144, _lptr +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _moo07: +; DARWIN-32-DYNAMIC: movl $_ldst+262144, _lptr +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _moo07: +; DARWIN-32-PIC: call "L56$pb" +; DARWIN-32-PIC-NEXT: "L56$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: leal _ldst+262144-"L56$pb"(%eax), %ecx +; DARWIN-32-PIC-NEXT: movl %ecx, _lptr-"L56$pb"(%eax) +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _moo07: +; DARWIN-64-STATIC: leaq _ldst+262144(%rip), %rax +; DARWIN-64-STATIC-NEXT: movq %rax, _lptr(%rip) +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _moo07: +; DARWIN-64-DYNAMIC: leaq _ldst+262144(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: movq %rax, _lptr(%rip) +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _moo07: +; DARWIN-64-PIC: leaq _ldst+262144(%rip), %rax +; DARWIN-64-PIC-NEXT: movq %rax, _lptr(%rip) +; DARWIN-64-PIC-NEXT: ret } define void @moo08(i64 %i) nounwind { @@ -878,6 +4053,63 @@ entry: ; LINUX-64-STATIC: movq lptr(%rip), %rcx ; LINUX-64-STATIC: movl %eax, 262144(%rcx) ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: moo08: +; LINUX-32-STATIC: movl lsrc+262144, %eax +; LINUX-32-STATIC-NEXT: movl lptr, %ecx +; LINUX-32-STATIC-NEXT: movl %eax, 262144(%ecx) +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: moo08: +; LINUX-32-PIC: movl lsrc+262144, %eax +; LINUX-32-PIC-NEXT: movl lptr, %ecx +; LINUX-32-PIC-NEXT: movl %eax, 262144(%ecx) +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: moo08: +; LINUX-64-PIC: movl lsrc+262144(%rip), %eax +; LINUX-64-PIC-NEXT: movq lptr(%rip), %rcx +; LINUX-64-PIC-NEXT: movl %eax, 262144(%rcx) +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _moo08: +; DARWIN-32-STATIC: movl _lsrc+262144, %eax +; DARWIN-32-STATIC-NEXT: movl _lptr, %ecx +; DARWIN-32-STATIC-NEXT: movl %eax, 262144(%ecx) +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _moo08: +; DARWIN-32-DYNAMIC: movl _lsrc+262144, %eax +; DARWIN-32-DYNAMIC-NEXT: movl _lptr, %ecx +; DARWIN-32-DYNAMIC-NEXT: movl %eax, 262144(%ecx) +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _moo08: +; DARWIN-32-PIC: call "L57$pb" +; DARWIN-32-PIC-NEXT: "L57$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl _lsrc+262144-"L57$pb"(%eax), %ecx +; DARWIN-32-PIC-NEXT: movl _lptr-"L57$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: movl %ecx, 262144(%eax) +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _moo08: +; DARWIN-64-STATIC: movl _lsrc+262144(%rip), %eax +; DARWIN-64-STATIC-NEXT: movq _lptr(%rip), %rcx +; DARWIN-64-STATIC-NEXT: movl %eax, 262144(%rcx) +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _moo08: +; DARWIN-64-DYNAMIC: movl _lsrc+262144(%rip), %eax +; DARWIN-64-DYNAMIC-NEXT: movq _lptr(%rip), %rcx +; DARWIN-64-DYNAMIC-NEXT: movl %eax, 262144(%rcx) +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _moo08: +; DARWIN-64-PIC: movl _lsrc+262144(%rip), %eax +; DARWIN-64-PIC-NEXT: movq _lptr(%rip), %rcx +; DARWIN-64-PIC-NEXT: movl %eax, 262144(%rcx) +; DARWIN-64-PIC-NEXT: ret } define void @big00(i64 %i) nounwind { @@ -892,6 +4124,71 @@ entry: ; LINUX-64-STATIC: movl src+262144(,%rdi,4), %eax ; LINUX-64-STATIC: movl %eax, dst+262144(,%rdi,4) ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: big00: +; LINUX-32-STATIC: movl 4(%esp), %eax +; LINUX-32-STATIC-NEXT: movl src+262144(,%eax,4), %ecx +; LINUX-32-STATIC-NEXT: movl %ecx, dst+262144(,%eax,4) +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: big00: +; LINUX-32-PIC: movl 4(%esp), %eax +; LINUX-32-PIC-NEXT: movl src+262144(,%eax,4), %ecx +; LINUX-32-PIC-NEXT: movl %ecx, dst+262144(,%eax,4) +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: big00: +; LINUX-64-PIC: movq src@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: movl 262144(%rax,%rdi,4), %eax +; LINUX-64-PIC-NEXT: movq dst@GOTPCREL(%rip), %rcx +; LINUX-64-PIC-NEXT: movl %eax, 262144(%rcx,%rdi,4) +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _big00: +; DARWIN-32-STATIC: movl 4(%esp), %eax +; DARWIN-32-STATIC-NEXT: movl _src+262144(,%eax,4), %ecx +; DARWIN-32-STATIC-NEXT: movl %ecx, _dst+262144(,%eax,4) +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _big00: +; DARWIN-32-DYNAMIC: movl 4(%esp), %eax +; DARWIN-32-DYNAMIC-NEXT: movl L_src$non_lazy_ptr, %ecx +; DARWIN-32-DYNAMIC-NEXT: movl 262144(%ecx,%eax,4), %ecx +; DARWIN-32-DYNAMIC-NEXT: movl L_dst$non_lazy_ptr, %edx +; DARWIN-32-DYNAMIC-NEXT: movl %ecx, 262144(%edx,%eax,4) +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _big00: +; DARWIN-32-PIC: call "L58$pb" +; DARWIN-32-PIC-NEXT: "L58$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl 4(%esp), %ecx +; DARWIN-32-PIC-NEXT: movl L_src$non_lazy_ptr-"L58$pb"(%eax), %edx +; DARWIN-32-PIC-NEXT: movl 262144(%edx,%ecx,4), %edx +; DARWIN-32-PIC-NEXT: movl L_dst$non_lazy_ptr-"L58$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: movl %edx, 262144(%eax,%ecx,4) +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _big00: +; DARWIN-64-STATIC: movq _src@GOTPCREL(%rip), %rax +; DARWIN-64-STATIC-NEXT: movl 262144(%rax,%rdi,4), %eax +; DARWIN-64-STATIC-NEXT: movq _dst@GOTPCREL(%rip), %rcx +; DARWIN-64-STATIC-NEXT: movl %eax, 262144(%rcx,%rdi,4) +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _big00: +; DARWIN-64-DYNAMIC: movq _src@GOTPCREL(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: movl 262144(%rax,%rdi,4), %eax +; DARWIN-64-DYNAMIC-NEXT: movq _dst@GOTPCREL(%rip), %rcx +; DARWIN-64-DYNAMIC-NEXT: movl %eax, 262144(%rcx,%rdi,4) +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _big00: +; DARWIN-64-PIC: movq _src@GOTPCREL(%rip), %rax +; DARWIN-64-PIC-NEXT: movl 262144(%rax,%rdi,4), %eax +; DARWIN-64-PIC-NEXT: movq _dst@GOTPCREL(%rip), %rcx +; DARWIN-64-PIC-NEXT: movl %eax, 262144(%rcx,%rdi,4) +; DARWIN-64-PIC-NEXT: ret } define void @big01(i64 %i) nounwind { @@ -904,6 +4201,71 @@ entry: ; LINUX-64-STATIC: leaq dst+262144(,%rdi,4), %rax ; LINUX-64-STATIC: movq %rax, ptr(%rip) ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: big01: +; LINUX-32-STATIC: movl 4(%esp), %eax +; LINUX-32-STATIC-NEXT: leal dst+262144(,%eax,4), %eax +; LINUX-32-STATIC-NEXT: movl %eax, ptr +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: big01: +; LINUX-32-PIC: movl 4(%esp), %eax +; LINUX-32-PIC-NEXT: leal dst+262144(,%eax,4), %eax +; LINUX-32-PIC-NEXT: movl %eax, ptr +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: big01: +; LINUX-64-PIC: movq dst@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: leaq 262144(%rax,%rdi,4), %rax +; LINUX-64-PIC-NEXT: movq ptr@GOTPCREL(%rip), %rcx +; LINUX-64-PIC-NEXT: movq %rax, (%rcx) +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _big01: +; DARWIN-32-STATIC: movl 4(%esp), %eax +; DARWIN-32-STATIC-NEXT: leal _dst+262144(,%eax,4), %eax +; DARWIN-32-STATIC-NEXT: movl %eax, _ptr +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _big01: +; DARWIN-32-DYNAMIC: movl 4(%esp), %eax +; DARWIN-32-DYNAMIC-NEXT: movl L_dst$non_lazy_ptr, %ecx +; DARWIN-32-DYNAMIC-NEXT: leal 262144(%ecx,%eax,4), %eax +; DARWIN-32-DYNAMIC-NEXT: movl L_ptr$non_lazy_ptr, %ecx +; DARWIN-32-DYNAMIC-NEXT: movl %eax, (%ecx) +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _big01: +; DARWIN-32-PIC: call "L59$pb" +; DARWIN-32-PIC-NEXT: "L59$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl 4(%esp), %ecx +; DARWIN-32-PIC-NEXT: movl L_dst$non_lazy_ptr-"L59$pb"(%eax), %edx +; DARWIN-32-PIC-NEXT: leal 262144(%edx,%ecx,4), %ecx +; DARWIN-32-PIC-NEXT: movl L_ptr$non_lazy_ptr-"L59$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: movl %ecx, (%eax) +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _big01: +; DARWIN-64-STATIC: movq _dst@GOTPCREL(%rip), %rax +; DARWIN-64-STATIC-NEXT: leaq 262144(%rax,%rdi,4), %rax +; DARWIN-64-STATIC-NEXT: movq _ptr@GOTPCREL(%rip), %rcx +; DARWIN-64-STATIC-NEXT: movq %rax, (%rcx) +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _big01: +; DARWIN-64-DYNAMIC: movq _dst@GOTPCREL(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: leaq 262144(%rax,%rdi,4), %rax +; DARWIN-64-DYNAMIC-NEXT: movq _ptr@GOTPCREL(%rip), %rcx +; DARWIN-64-DYNAMIC-NEXT: movq %rax, (%rcx) +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _big01: +; DARWIN-64-PIC: movq _dst@GOTPCREL(%rip), %rax +; DARWIN-64-PIC-NEXT: leaq 262144(%rax,%rdi,4), %rax +; DARWIN-64-PIC-NEXT: movq _ptr@GOTPCREL(%rip), %rcx +; DARWIN-64-PIC-NEXT: movq %rax, (%rcx) +; DARWIN-64-PIC-NEXT: ret } define void @big02(i64 %i) nounwind { @@ -920,6 +4282,80 @@ entry: ; LINUX-64-STATIC: movq ptr(%rip), %rcx ; LINUX-64-STATIC: movl %eax, 262144(%rcx,%rdi,4) ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: big02: +; LINUX-32-STATIC: movl 4(%esp), %eax +; LINUX-32-STATIC-NEXT: movl src+262144(,%eax,4), %ecx +; LINUX-32-STATIC-NEXT: movl ptr, %edx +; LINUX-32-STATIC-NEXT: movl %ecx, 262144(%edx,%eax,4) +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: big02: +; LINUX-32-PIC: movl 4(%esp), %eax +; LINUX-32-PIC-NEXT: movl src+262144(,%eax,4), %ecx +; LINUX-32-PIC-NEXT: movl ptr, %edx +; LINUX-32-PIC-NEXT: movl %ecx, 262144(%edx,%eax,4) +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: big02: +; LINUX-64-PIC: movq src@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: movl 262144(%rax,%rdi,4), %eax +; LINUX-64-PIC-NEXT: movq ptr@GOTPCREL(%rip), %rcx +; LINUX-64-PIC-NEXT: movq (%rcx), %rcx +; LINUX-64-PIC-NEXT: movl %eax, 262144(%rcx,%rdi,4) +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _big02: +; DARWIN-32-STATIC: movl 4(%esp), %eax +; DARWIN-32-STATIC-NEXT: movl _src+262144(,%eax,4), %ecx +; DARWIN-32-STATIC-NEXT: movl _ptr, %edx +; DARWIN-32-STATIC-NEXT: movl %ecx, 262144(%edx,%eax,4) +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _big02: +; DARWIN-32-DYNAMIC: movl 4(%esp), %eax +; DARWIN-32-DYNAMIC-NEXT: movl L_src$non_lazy_ptr, %ecx +; DARWIN-32-DYNAMIC-NEXT: movl 262144(%ecx,%eax,4), %ecx +; DARWIN-32-DYNAMIC-NEXT: movl L_ptr$non_lazy_ptr, %edx +; DARWIN-32-DYNAMIC-NEXT: movl (%edx), %edx +; DARWIN-32-DYNAMIC-NEXT: movl %ecx, 262144(%edx,%eax,4) +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _big02: +; DARWIN-32-PIC: call "L60$pb" +; DARWIN-32-PIC-NEXT: "L60$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl 4(%esp), %ecx +; DARWIN-32-PIC-NEXT: movl L_src$non_lazy_ptr-"L60$pb"(%eax), %edx +; DARWIN-32-PIC-NEXT: movl 262144(%edx,%ecx,4), %edx +; DARWIN-32-PIC-NEXT: movl L_ptr$non_lazy_ptr-"L60$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: movl (%eax), %eax +; DARWIN-32-PIC-NEXT: movl %edx, 262144(%eax,%ecx,4) +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _big02: +; DARWIN-64-STATIC: movq _src@GOTPCREL(%rip), %rax +; DARWIN-64-STATIC-NEXT: movl 262144(%rax,%rdi,4), %eax +; DARWIN-64-STATIC-NEXT: movq _ptr@GOTPCREL(%rip), %rcx +; DARWIN-64-STATIC-NEXT: movq (%rcx), %rcx +; DARWIN-64-STATIC-NEXT: movl %eax, 262144(%rcx,%rdi,4) +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _big02: +; DARWIN-64-DYNAMIC: movq _src@GOTPCREL(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: movl 262144(%rax,%rdi,4), %eax +; DARWIN-64-DYNAMIC-NEXT: movq _ptr@GOTPCREL(%rip), %rcx +; DARWIN-64-DYNAMIC-NEXT: movq (%rcx), %rcx +; DARWIN-64-DYNAMIC-NEXT: movl %eax, 262144(%rcx,%rdi,4) +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _big02: +; DARWIN-64-PIC: movq _src@GOTPCREL(%rip), %rax +; DARWIN-64-PIC-NEXT: movl 262144(%rax,%rdi,4), %eax +; DARWIN-64-PIC-NEXT: movq _ptr@GOTPCREL(%rip), %rcx +; DARWIN-64-PIC-NEXT: movq (%rcx), %rcx +; DARWIN-64-PIC-NEXT: movl %eax, 262144(%rcx,%rdi,4) +; DARWIN-64-PIC-NEXT: ret } define void @big03(i64 %i) nounwind { @@ -934,6 +4370,67 @@ entry: ; LINUX-64-STATIC: movl dsrc+262144(,%rdi,4), %eax ; LINUX-64-STATIC: movl %eax, ddst+262144(,%rdi,4) ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: big03: +; LINUX-32-STATIC: movl 4(%esp), %eax +; LINUX-32-STATIC-NEXT: movl dsrc+262144(,%eax,4), %ecx +; LINUX-32-STATIC-NEXT: movl %ecx, ddst+262144(,%eax,4) +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: big03: +; LINUX-32-PIC: movl 4(%esp), %eax +; LINUX-32-PIC-NEXT: movl dsrc+262144(,%eax,4), %ecx +; LINUX-32-PIC-NEXT: movl %ecx, ddst+262144(,%eax,4) +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: big03: +; LINUX-64-PIC: movq dsrc@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: movl 262144(%rax,%rdi,4), %eax +; LINUX-64-PIC-NEXT: movq ddst@GOTPCREL(%rip), %rcx +; LINUX-64-PIC-NEXT: movl %eax, 262144(%rcx,%rdi,4) +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _big03: +; DARWIN-32-STATIC: movl 4(%esp), %eax +; DARWIN-32-STATIC-NEXT: movl _dsrc+262144(,%eax,4), %ecx +; DARWIN-32-STATIC-NEXT: movl %ecx, _ddst+262144(,%eax,4) +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _big03: +; DARWIN-32-DYNAMIC: movl 4(%esp), %eax +; DARWIN-32-DYNAMIC-NEXT: movl _dsrc+262144(,%eax,4), %ecx +; DARWIN-32-DYNAMIC-NEXT: movl %ecx, _ddst+262144(,%eax,4) +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _big03: +; DARWIN-32-PIC: call "L61$pb" +; DARWIN-32-PIC-NEXT: "L61$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl 4(%esp), %ecx +; DARWIN-32-PIC-NEXT: movl _dsrc+262144-"L61$pb"(%eax,%ecx,4), %edx +; DARWIN-32-PIC-NEXT: movl %edx, _ddst+262144-"L61$pb"(%eax,%ecx,4) +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _big03: +; DARWIN-64-STATIC: leaq _dsrc(%rip), %rax +; DARWIN-64-STATIC-NEXT: movl 262144(%rax,%rdi,4), %eax +; DARWIN-64-STATIC-NEXT: leaq _ddst(%rip), %rcx +; DARWIN-64-STATIC-NEXT: movl %eax, 262144(%rcx,%rdi,4) +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _big03: +; DARWIN-64-DYNAMIC: leaq _dsrc(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: movl 262144(%rax,%rdi,4), %eax +; DARWIN-64-DYNAMIC-NEXT: leaq _ddst(%rip), %rcx +; DARWIN-64-DYNAMIC-NEXT: movl %eax, 262144(%rcx,%rdi,4) +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _big03: +; DARWIN-64-PIC: leaq _dsrc(%rip), %rax +; DARWIN-64-PIC-NEXT: movl 262144(%rax,%rdi,4), %eax +; DARWIN-64-PIC-NEXT: leaq _ddst(%rip), %rcx +; DARWIN-64-PIC-NEXT: movl %eax, 262144(%rcx,%rdi,4) +; DARWIN-64-PIC-NEXT: ret } define void @big04(i64 %i) nounwind { @@ -946,6 +4443,64 @@ entry: ; LINUX-64-STATIC: leaq ddst+262144(,%rdi,4), %rax ; LINUX-64-STATIC: movq %rax, dptr ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: big04: +; LINUX-32-STATIC: movl 4(%esp), %eax +; LINUX-32-STATIC-NEXT: leal ddst+262144(,%eax,4), %eax +; LINUX-32-STATIC-NEXT: movl %eax, dptr +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: big04: +; LINUX-32-PIC: movl 4(%esp), %eax +; LINUX-32-PIC-NEXT: leal ddst+262144(,%eax,4), %eax +; LINUX-32-PIC-NEXT: movl %eax, dptr +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: big04: +; LINUX-64-PIC: movq ddst@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: leaq 262144(%rax,%rdi,4), %rax +; LINUX-64-PIC-NEXT: movq dptr@GOTPCREL(%rip), %rcx +; LINUX-64-PIC-NEXT: movq %rax, (%rcx) +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _big04: +; DARWIN-32-STATIC: movl 4(%esp), %eax +; DARWIN-32-STATIC-NEXT: leal _ddst+262144(,%eax,4), %eax +; DARWIN-32-STATIC-NEXT: movl %eax, _dptr +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _big04: +; DARWIN-32-DYNAMIC: movl 4(%esp), %eax +; DARWIN-32-DYNAMIC-NEXT: leal _ddst+262144(,%eax,4), %eax +; DARWIN-32-DYNAMIC-NEXT: movl %eax, _dptr +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _big04: +; DARWIN-32-PIC: call "L62$pb" +; DARWIN-32-PIC-NEXT: "L62$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl 4(%esp), %ecx +; DARWIN-32-PIC-NEXT: leal _ddst+262144-"L62$pb"(%eax,%ecx,4), %ecx +; DARWIN-32-PIC-NEXT: movl %ecx, _dptr-"L62$pb"(%eax) +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _big04: +; DARWIN-64-STATIC: leaq _ddst(%rip), %rax +; DARWIN-64-STATIC-NEXT: leaq 262144(%rax,%rdi,4), %rax +; DARWIN-64-STATIC-NEXT: movq %rax, _dptr(%rip) +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _big04: +; DARWIN-64-DYNAMIC: leaq _ddst(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: leaq 262144(%rax,%rdi,4), %rax +; DARWIN-64-DYNAMIC-NEXT: movq %rax, _dptr(%rip) +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _big04: +; DARWIN-64-PIC: leaq _ddst(%rip), %rax +; DARWIN-64-PIC-NEXT: leaq 262144(%rax,%rdi,4), %rax +; DARWIN-64-PIC-NEXT: movq %rax, _dptr(%rip) +; DARWIN-64-PIC-NEXT: ret } define void @big05(i64 %i) nounwind { @@ -962,6 +4517,73 @@ entry: ; LINUX-64-STATIC: movq dptr(%rip), %rcx ; LINUX-64-STATIC: movl %eax, 262144(%rcx,%rdi,4) ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: big05: +; LINUX-32-STATIC: movl 4(%esp), %eax +; LINUX-32-STATIC-NEXT: movl dsrc+262144(,%eax,4), %ecx +; LINUX-32-STATIC-NEXT: movl dptr, %edx +; LINUX-32-STATIC-NEXT: movl %ecx, 262144(%edx,%eax,4) +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: big05: +; LINUX-32-PIC: movl 4(%esp), %eax +; LINUX-32-PIC-NEXT: movl dsrc+262144(,%eax,4), %ecx +; LINUX-32-PIC-NEXT: movl dptr, %edx +; LINUX-32-PIC-NEXT: movl %ecx, 262144(%edx,%eax,4) +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: big05: +; LINUX-64-PIC: movq dsrc@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: movl 262144(%rax,%rdi,4), %eax +; LINUX-64-PIC-NEXT: movq dptr@GOTPCREL(%rip), %rcx +; LINUX-64-PIC-NEXT: movq (%rcx), %rcx +; LINUX-64-PIC-NEXT: movl %eax, 262144(%rcx,%rdi,4) +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _big05: +; DARWIN-32-STATIC: movl 4(%esp), %eax +; DARWIN-32-STATIC-NEXT: movl _dsrc+262144(,%eax,4), %ecx +; DARWIN-32-STATIC-NEXT: movl _dptr, %edx +; DARWIN-32-STATIC-NEXT: movl %ecx, 262144(%edx,%eax,4) +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _big05: +; DARWIN-32-DYNAMIC: movl 4(%esp), %eax +; DARWIN-32-DYNAMIC-NEXT: movl _dsrc+262144(,%eax,4), %ecx +; DARWIN-32-DYNAMIC-NEXT: movl _dptr, %edx +; DARWIN-32-DYNAMIC-NEXT: movl %ecx, 262144(%edx,%eax,4) +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _big05: +; DARWIN-32-PIC: call "L63$pb" +; DARWIN-32-PIC-NEXT: "L63$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl 4(%esp), %ecx +; DARWIN-32-PIC-NEXT: movl _dsrc+262144-"L63$pb"(%eax,%ecx,4), %edx +; DARWIN-32-PIC-NEXT: movl _dptr-"L63$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: movl %edx, 262144(%eax,%ecx,4) +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _big05: +; DARWIN-64-STATIC: leaq _dsrc(%rip), %rax +; DARWIN-64-STATIC-NEXT: movl 262144(%rax,%rdi,4), %eax +; DARWIN-64-STATIC-NEXT: movq _dptr(%rip), %rcx +; DARWIN-64-STATIC-NEXT: movl %eax, 262144(%rcx,%rdi,4) +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _big05: +; DARWIN-64-DYNAMIC: leaq _dsrc(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: movl 262144(%rax,%rdi,4), %eax +; DARWIN-64-DYNAMIC-NEXT: movq _dptr(%rip), %rcx +; DARWIN-64-DYNAMIC-NEXT: movl %eax, 262144(%rcx,%rdi,4) +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _big05: +; DARWIN-64-PIC: leaq _dsrc(%rip), %rax +; DARWIN-64-PIC-NEXT: movl 262144(%rax,%rdi,4), %eax +; DARWIN-64-PIC-NEXT: movq _dptr(%rip), %rcx +; DARWIN-64-PIC-NEXT: movl %eax, 262144(%rcx,%rdi,4) +; DARWIN-64-PIC-NEXT: ret } define void @big06(i64 %i) nounwind { @@ -976,6 +4598,67 @@ entry: ; LINUX-64-STATIC: movl lsrc+262144(,%rdi,4), %eax ; LINUX-64-STATIC: movl %eax, ldst+262144(,%rdi,4) ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: big06: +; LINUX-32-STATIC: movl 4(%esp), %eax +; LINUX-32-STATIC-NEXT: movl lsrc+262144(,%eax,4), %ecx +; LINUX-32-STATIC-NEXT: movl %ecx, ldst+262144(,%eax,4) +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: big06: +; LINUX-32-PIC: movl 4(%esp), %eax +; LINUX-32-PIC-NEXT: movl lsrc+262144(,%eax,4), %ecx +; LINUX-32-PIC-NEXT: movl %ecx, ldst+262144(,%eax,4) +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: big06: +; LINUX-64-PIC: leaq lsrc(%rip), %rax +; LINUX-64-PIC-NEXT: movl 262144(%rax,%rdi,4), %eax +; LINUX-64-PIC-NEXT: leaq ldst(%rip), %rcx +; LINUX-64-PIC-NEXT: movl %eax, 262144(%rcx,%rdi,4) +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _big06: +; DARWIN-32-STATIC: movl 4(%esp), %eax +; DARWIN-32-STATIC-NEXT: movl _lsrc+262144(,%eax,4), %ecx +; DARWIN-32-STATIC-NEXT: movl %ecx, _ldst+262144(,%eax,4) +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _big06: +; DARWIN-32-DYNAMIC: movl 4(%esp), %eax +; DARWIN-32-DYNAMIC-NEXT: movl _lsrc+262144(,%eax,4), %ecx +; DARWIN-32-DYNAMIC-NEXT: movl %ecx, _ldst+262144(,%eax,4) +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _big06: +; DARWIN-32-PIC: call "L64$pb" +; DARWIN-32-PIC-NEXT: "L64$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl 4(%esp), %ecx +; DARWIN-32-PIC-NEXT: movl _lsrc+262144-"L64$pb"(%eax,%ecx,4), %edx +; DARWIN-32-PIC-NEXT: movl %edx, _ldst+262144-"L64$pb"(%eax,%ecx,4) +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _big06: +; DARWIN-64-STATIC: leaq _lsrc(%rip), %rax +; DARWIN-64-STATIC-NEXT: movl 262144(%rax,%rdi,4), %eax +; DARWIN-64-STATIC-NEXT: leaq _ldst(%rip), %rcx +; DARWIN-64-STATIC-NEXT: movl %eax, 262144(%rcx,%rdi,4) +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _big06: +; DARWIN-64-DYNAMIC: leaq _lsrc(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: movl 262144(%rax,%rdi,4), %eax +; DARWIN-64-DYNAMIC-NEXT: leaq _ldst(%rip), %rcx +; DARWIN-64-DYNAMIC-NEXT: movl %eax, 262144(%rcx,%rdi,4) +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _big06: +; DARWIN-64-PIC: leaq _lsrc(%rip), %rax +; DARWIN-64-PIC-NEXT: movl 262144(%rax,%rdi,4), %eax +; DARWIN-64-PIC-NEXT: leaq _ldst(%rip), %rcx +; DARWIN-64-PIC-NEXT: movl %eax, 262144(%rcx,%rdi,4) +; DARWIN-64-PIC-NEXT: ret } define void @big07(i64 %i) nounwind { @@ -988,6 +4671,63 @@ entry: ; LINUX-64-STATIC: leaq ldst+262144(,%rdi,4), %rax ; LINUX-64-STATIC: movq %rax, lptr ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: big07: +; LINUX-32-STATIC: movl 4(%esp), %eax +; LINUX-32-STATIC-NEXT: leal ldst+262144(,%eax,4), %eax +; LINUX-32-STATIC-NEXT: movl %eax, lptr +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: big07: +; LINUX-32-PIC: movl 4(%esp), %eax +; LINUX-32-PIC-NEXT: leal ldst+262144(,%eax,4), %eax +; LINUX-32-PIC-NEXT: movl %eax, lptr +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: big07: +; LINUX-64-PIC: leaq ldst(%rip), %rax +; LINUX-64-PIC-NEXT: leaq 262144(%rax,%rdi,4), %rax +; LINUX-64-PIC-NEXT: movq %rax, lptr(%rip) +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _big07: +; DARWIN-32-STATIC: movl 4(%esp), %eax +; DARWIN-32-STATIC-NEXT: leal _ldst+262144(,%eax,4), %eax +; DARWIN-32-STATIC-NEXT: movl %eax, _lptr +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _big07: +; DARWIN-32-DYNAMIC: movl 4(%esp), %eax +; DARWIN-32-DYNAMIC-NEXT: leal _ldst+262144(,%eax,4), %eax +; DARWIN-32-DYNAMIC-NEXT: movl %eax, _lptr +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _big07: +; DARWIN-32-PIC: call "L65$pb" +; DARWIN-32-PIC-NEXT: "L65$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl 4(%esp), %ecx +; DARWIN-32-PIC-NEXT: leal _ldst+262144-"L65$pb"(%eax,%ecx,4), %ecx +; DARWIN-32-PIC-NEXT: movl %ecx, _lptr-"L65$pb"(%eax) +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _big07: +; DARWIN-64-STATIC: leaq _ldst(%rip), %rax +; DARWIN-64-STATIC-NEXT: leaq 262144(%rax,%rdi,4), %rax +; DARWIN-64-STATIC-NEXT: movq %rax, _lptr(%rip) +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _big07: +; DARWIN-64-DYNAMIC: leaq _ldst(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: leaq 262144(%rax,%rdi,4), %rax +; DARWIN-64-DYNAMIC-NEXT: movq %rax, _lptr(%rip) +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _big07: +; DARWIN-64-PIC: leaq _ldst(%rip), %rax +; DARWIN-64-PIC-NEXT: leaq 262144(%rax,%rdi,4), %rax +; DARWIN-64-PIC-NEXT: movq %rax, _lptr(%rip) +; DARWIN-64-PIC-NEXT: ret } define void @big08(i64 %i) nounwind { @@ -1004,6 +4744,72 @@ entry: ; LINUX-64-STATIC: movq lptr(%rip), %rcx ; LINUX-64-STATIC: movl %eax, 262144(%rcx,%rdi,4) ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: big08: +; LINUX-32-STATIC: movl 4(%esp), %eax +; LINUX-32-STATIC-NEXT: movl lsrc+262144(,%eax,4), %ecx +; LINUX-32-STATIC-NEXT: movl lptr, %edx +; LINUX-32-STATIC-NEXT: movl %ecx, 262144(%edx,%eax,4) +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: big08: +; LINUX-32-PIC: movl 4(%esp), %eax +; LINUX-32-PIC-NEXT: movl lsrc+262144(,%eax,4), %ecx +; LINUX-32-PIC-NEXT: movl lptr, %edx +; LINUX-32-PIC-NEXT: movl %ecx, 262144(%edx,%eax,4) +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: big08: +; LINUX-64-PIC: leaq lsrc(%rip), %rax +; LINUX-64-PIC-NEXT: movl 262144(%rax,%rdi,4), %eax +; LINUX-64-PIC-NEXT: movq lptr(%rip), %rcx +; LINUX-64-PIC-NEXT: movl %eax, 262144(%rcx,%rdi,4) +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _big08: +; DARWIN-32-STATIC: movl 4(%esp), %eax +; DARWIN-32-STATIC-NEXT: movl _lsrc+262144(,%eax,4), %ecx +; DARWIN-32-STATIC-NEXT: movl _lptr, %edx +; DARWIN-32-STATIC-NEXT: movl %ecx, 262144(%edx,%eax,4) +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _big08: +; DARWIN-32-DYNAMIC: movl 4(%esp), %eax +; DARWIN-32-DYNAMIC-NEXT: movl _lsrc+262144(,%eax,4), %ecx +; DARWIN-32-DYNAMIC-NEXT: movl _lptr, %edx +; DARWIN-32-DYNAMIC-NEXT: movl %ecx, 262144(%edx,%eax,4) +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _big08: +; DARWIN-32-PIC: call "L66$pb" +; DARWIN-32-PIC-NEXT: "L66$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl 4(%esp), %ecx +; DARWIN-32-PIC-NEXT: movl _lsrc+262144-"L66$pb"(%eax,%ecx,4), %edx +; DARWIN-32-PIC-NEXT: movl _lptr-"L66$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: movl %edx, 262144(%eax,%ecx,4) +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _big08: +; DARWIN-64-STATIC: leaq _lsrc(%rip), %rax +; DARWIN-64-STATIC-NEXT: movl 262144(%rax,%rdi,4), %eax +; DARWIN-64-STATIC-NEXT: movq _lptr(%rip), %rcx +; DARWIN-64-STATIC-NEXT: movl %eax, 262144(%rcx,%rdi,4) +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _big08: +; DARWIN-64-DYNAMIC: leaq _lsrc(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: movl 262144(%rax,%rdi,4), %eax +; DARWIN-64-DYNAMIC-NEXT: movq _lptr(%rip), %rcx +; DARWIN-64-DYNAMIC-NEXT: movl %eax, 262144(%rcx,%rdi,4) +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _big08: +; DARWIN-64-PIC: leaq _lsrc(%rip), %rax +; DARWIN-64-PIC-NEXT: movl 262144(%rax,%rdi,4), %eax +; DARWIN-64-PIC-NEXT: movq _lptr(%rip), %rcx +; DARWIN-64-PIC-NEXT: movl %eax, 262144(%rcx,%rdi,4) +; DARWIN-64-PIC-NEXT: ret } define i8* @bar00() nounwind { @@ -1012,6 +4818,45 @@ entry: ; LINUX-64-STATIC: bar00: ; LINUX-64-STATIC: movl $src, %eax ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: bar00: +; LINUX-32-STATIC: movl $src, %eax +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: bar00: +; LINUX-32-PIC: movl $src, %eax +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: bar00: +; LINUX-64-PIC: movq src@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _bar00: +; DARWIN-32-STATIC: movl $_src, %eax +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _bar00: +; DARWIN-32-DYNAMIC: movl L_src$non_lazy_ptr, %eax +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _bar00: +; DARWIN-32-PIC: call "L67$pb" +; DARWIN-32-PIC-NEXT: "L67$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl L_src$non_lazy_ptr-"L67$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _bar00: +; DARWIN-64-STATIC: movq _src@GOTPCREL(%rip), %rax +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _bar00: +; DARWIN-64-DYNAMIC: movq _src@GOTPCREL(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _bar00: +; DARWIN-64-PIC: movq _src@GOTPCREL(%rip), %rax +; DARWIN-64-PIC-NEXT: ret } define i8* @bxr00() nounwind { @@ -1020,6 +4865,45 @@ entry: ; LINUX-64-STATIC: bxr00: ; LINUX-64-STATIC: movl $xsrc, %eax ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: bxr00: +; LINUX-32-STATIC: movl $xsrc, %eax +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: bxr00: +; LINUX-32-PIC: movl $xsrc, %eax +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: bxr00: +; LINUX-64-PIC: movq xsrc@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _bxr00: +; DARWIN-32-STATIC: movl $_xsrc, %eax +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _bxr00: +; DARWIN-32-DYNAMIC: movl L_xsrc$non_lazy_ptr, %eax +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _bxr00: +; DARWIN-32-PIC: call "L68$pb" +; DARWIN-32-PIC-NEXT: "L68$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl L_xsrc$non_lazy_ptr-"L68$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _bxr00: +; DARWIN-64-STATIC: movq _xsrc@GOTPCREL(%rip), %rax +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _bxr00: +; DARWIN-64-DYNAMIC: movq _xsrc@GOTPCREL(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _bxr00: +; DARWIN-64-PIC: movq _xsrc@GOTPCREL(%rip), %rax +; DARWIN-64-PIC-NEXT: ret } define i8* @bar01() nounwind { @@ -1028,6 +4912,45 @@ entry: ; LINUX-64-STATIC: bar01: ; LINUX-64-STATIC: movl $dst, %eax ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: bar01: +; LINUX-32-STATIC: movl $dst, %eax +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: bar01: +; LINUX-32-PIC: movl $dst, %eax +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: bar01: +; LINUX-64-PIC: movq dst@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _bar01: +; DARWIN-32-STATIC: movl $_dst, %eax +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _bar01: +; DARWIN-32-DYNAMIC: movl L_dst$non_lazy_ptr, %eax +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _bar01: +; DARWIN-32-PIC: call "L69$pb" +; DARWIN-32-PIC-NEXT: "L69$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl L_dst$non_lazy_ptr-"L69$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _bar01: +; DARWIN-64-STATIC: movq _dst@GOTPCREL(%rip), %rax +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _bar01: +; DARWIN-64-DYNAMIC: movq _dst@GOTPCREL(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _bar01: +; DARWIN-64-PIC: movq _dst@GOTPCREL(%rip), %rax +; DARWIN-64-PIC-NEXT: ret } define i8* @bxr01() nounwind { @@ -1036,6 +4959,45 @@ entry: ; LINUX-64-STATIC: bxr01: ; LINUX-64-STATIC: movl $xdst, %eax ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: bxr01: +; LINUX-32-STATIC: movl $xdst, %eax +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: bxr01: +; LINUX-32-PIC: movl $xdst, %eax +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: bxr01: +; LINUX-64-PIC: movq xdst@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _bxr01: +; DARWIN-32-STATIC: movl $_xdst, %eax +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _bxr01: +; DARWIN-32-DYNAMIC: movl L_xdst$non_lazy_ptr, %eax +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _bxr01: +; DARWIN-32-PIC: call "L70$pb" +; DARWIN-32-PIC-NEXT: "L70$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl L_xdst$non_lazy_ptr-"L70$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _bxr01: +; DARWIN-64-STATIC: movq _xdst@GOTPCREL(%rip), %rax +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _bxr01: +; DARWIN-64-DYNAMIC: movq _xdst@GOTPCREL(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _bxr01: +; DARWIN-64-PIC: movq _xdst@GOTPCREL(%rip), %rax +; DARWIN-64-PIC-NEXT: ret } define i8* @bar02() nounwind { @@ -1044,6 +5006,45 @@ entry: ; LINUX-64-STATIC: bar02: ; LINUX-64-STATIC: movl $ptr, %eax ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: bar02: +; LINUX-32-STATIC: movl $ptr, %eax +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: bar02: +; LINUX-32-PIC: movl $ptr, %eax +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: bar02: +; LINUX-64-PIC: movq ptr@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _bar02: +; DARWIN-32-STATIC: movl $_ptr, %eax +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _bar02: +; DARWIN-32-DYNAMIC: movl L_ptr$non_lazy_ptr, %eax +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _bar02: +; DARWIN-32-PIC: call "L71$pb" +; DARWIN-32-PIC-NEXT: "L71$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl L_ptr$non_lazy_ptr-"L71$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _bar02: +; DARWIN-64-STATIC: movq _ptr@GOTPCREL(%rip), %rax +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _bar02: +; DARWIN-64-DYNAMIC: movq _ptr@GOTPCREL(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _bar02: +; DARWIN-64-PIC: movq _ptr@GOTPCREL(%rip), %rax +; DARWIN-64-PIC-NEXT: ret } define i8* @bar03() nounwind { @@ -1052,6 +5053,45 @@ entry: ; LINUX-64-STATIC: bar03: ; LINUX-64-STATIC: movl $dsrc, %eax ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: bar03: +; LINUX-32-STATIC: movl $dsrc, %eax +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: bar03: +; LINUX-32-PIC: movl $dsrc, %eax +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: bar03: +; LINUX-64-PIC: movq dsrc@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _bar03: +; DARWIN-32-STATIC: movl $_dsrc, %eax +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _bar03: +; DARWIN-32-DYNAMIC: movl $_dsrc, %eax +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _bar03: +; DARWIN-32-PIC: call "L72$pb" +; DARWIN-32-PIC-NEXT: "L72$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: leal _dsrc-"L72$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _bar03: +; DARWIN-64-STATIC: leaq _dsrc(%rip), %rax +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _bar03: +; DARWIN-64-DYNAMIC: leaq _dsrc(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _bar03: +; DARWIN-64-PIC: leaq _dsrc(%rip), %rax +; DARWIN-64-PIC-NEXT: ret } define i8* @bar04() nounwind { @@ -1060,6 +5100,45 @@ entry: ; LINUX-64-STATIC: bar04: ; LINUX-64-STATIC: movl $ddst, %eax ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: bar04: +; LINUX-32-STATIC: movl $ddst, %eax +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: bar04: +; LINUX-32-PIC: movl $ddst, %eax +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: bar04: +; LINUX-64-PIC: movq ddst@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _bar04: +; DARWIN-32-STATIC: movl $_ddst, %eax +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _bar04: +; DARWIN-32-DYNAMIC: movl $_ddst, %eax +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _bar04: +; DARWIN-32-PIC: call "L73$pb" +; DARWIN-32-PIC-NEXT: "L73$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: leal _ddst-"L73$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _bar04: +; DARWIN-64-STATIC: leaq _ddst(%rip), %rax +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _bar04: +; DARWIN-64-DYNAMIC: leaq _ddst(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _bar04: +; DARWIN-64-PIC: leaq _ddst(%rip), %rax +; DARWIN-64-PIC-NEXT: ret } define i8* @bar05() nounwind { @@ -1068,6 +5147,45 @@ entry: ; LINUX-64-STATIC: bar05: ; LINUX-64-STATIC: movl $dptr, %eax ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: bar05: +; LINUX-32-STATIC: movl $dptr, %eax +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: bar05: +; LINUX-32-PIC: movl $dptr, %eax +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: bar05: +; LINUX-64-PIC: movq dptr@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _bar05: +; DARWIN-32-STATIC: movl $_dptr, %eax +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _bar05: +; DARWIN-32-DYNAMIC: movl $_dptr, %eax +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _bar05: +; DARWIN-32-PIC: call "L74$pb" +; DARWIN-32-PIC-NEXT: "L74$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: leal _dptr-"L74$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _bar05: +; DARWIN-64-STATIC: leaq _dptr(%rip), %rax +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _bar05: +; DARWIN-64-DYNAMIC: leaq _dptr(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _bar05: +; DARWIN-64-PIC: leaq _dptr(%rip), %rax +; DARWIN-64-PIC-NEXT: ret } define i8* @bar06() nounwind { @@ -1076,6 +5194,45 @@ entry: ; LINUX-64-STATIC: bar06: ; LINUX-64-STATIC: movl $lsrc, %eax ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: bar06: +; LINUX-32-STATIC: movl $lsrc, %eax +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: bar06: +; LINUX-32-PIC: movl $lsrc, %eax +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: bar06: +; LINUX-64-PIC: leaq lsrc(%rip), %rax +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _bar06: +; DARWIN-32-STATIC: movl $_lsrc, %eax +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _bar06: +; DARWIN-32-DYNAMIC: movl $_lsrc, %eax +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _bar06: +; DARWIN-32-PIC: call "L75$pb" +; DARWIN-32-PIC-NEXT: "L75$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: leal _lsrc-"L75$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _bar06: +; DARWIN-64-STATIC: leaq _lsrc(%rip), %rax +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _bar06: +; DARWIN-64-DYNAMIC: leaq _lsrc(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _bar06: +; DARWIN-64-PIC: leaq _lsrc(%rip), %rax +; DARWIN-64-PIC-NEXT: ret } define i8* @bar07() nounwind { @@ -1084,6 +5241,45 @@ entry: ; LINUX-64-STATIC: bar07: ; LINUX-64-STATIC: movl $ldst, %eax ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: bar07: +; LINUX-32-STATIC: movl $ldst, %eax +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: bar07: +; LINUX-32-PIC: movl $ldst, %eax +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: bar07: +; LINUX-64-PIC: leaq ldst(%rip), %rax +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _bar07: +; DARWIN-32-STATIC: movl $_ldst, %eax +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _bar07: +; DARWIN-32-DYNAMIC: movl $_ldst, %eax +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _bar07: +; DARWIN-32-PIC: call "L76$pb" +; DARWIN-32-PIC-NEXT: "L76$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: leal _ldst-"L76$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _bar07: +; DARWIN-64-STATIC: leaq _ldst(%rip), %rax +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _bar07: +; DARWIN-64-DYNAMIC: leaq _ldst(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _bar07: +; DARWIN-64-PIC: leaq _ldst(%rip), %rax +; DARWIN-64-PIC-NEXT: ret } define i8* @bar08() nounwind { @@ -1092,6 +5288,45 @@ entry: ; LINUX-64-STATIC: bar08: ; LINUX-64-STATIC: movl $lptr, %eax ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: bar08: +; LINUX-32-STATIC: movl $lptr, %eax +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: bar08: +; LINUX-32-PIC: movl $lptr, %eax +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: bar08: +; LINUX-64-PIC: leaq lptr(%rip), %rax +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _bar08: +; DARWIN-32-STATIC: movl $_lptr, %eax +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _bar08: +; DARWIN-32-DYNAMIC: movl $_lptr, %eax +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _bar08: +; DARWIN-32-PIC: call "L77$pb" +; DARWIN-32-PIC-NEXT: "L77$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: leal _lptr-"L77$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _bar08: +; DARWIN-64-STATIC: leaq _lptr(%rip), %rax +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _bar08: +; DARWIN-64-DYNAMIC: leaq _lptr(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _bar08: +; DARWIN-64-PIC: leaq _lptr(%rip), %rax +; DARWIN-64-PIC-NEXT: ret } define i8* @har00() nounwind { @@ -1100,6 +5335,45 @@ entry: ; LINUX-64-STATIC: har00: ; LINUX-64-STATIC: movl $src, %eax ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: har00: +; LINUX-32-STATIC: movl $src, %eax +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: har00: +; LINUX-32-PIC: movl $src, %eax +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: har00: +; LINUX-64-PIC: movq src@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _har00: +; DARWIN-32-STATIC: movl $_src, %eax +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _har00: +; DARWIN-32-DYNAMIC: movl L_src$non_lazy_ptr, %eax +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _har00: +; DARWIN-32-PIC: call "L78$pb" +; DARWIN-32-PIC-NEXT: "L78$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl L_src$non_lazy_ptr-"L78$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _har00: +; DARWIN-64-STATIC: movq _src@GOTPCREL(%rip), %rax +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _har00: +; DARWIN-64-DYNAMIC: movq _src@GOTPCREL(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _har00: +; DARWIN-64-PIC: movq _src@GOTPCREL(%rip), %rax +; DARWIN-64-PIC-NEXT: ret } define i8* @hxr00() nounwind { @@ -1108,6 +5382,45 @@ entry: ; LINUX-64-STATIC: hxr00: ; LINUX-64-STATIC: movl $xsrc, %eax ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: hxr00: +; LINUX-32-STATIC: movl $xsrc, %eax +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: hxr00: +; LINUX-32-PIC: movl $xsrc, %eax +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: hxr00: +; LINUX-64-PIC: movq xsrc@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _hxr00: +; DARWIN-32-STATIC: movl $_xsrc, %eax +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _hxr00: +; DARWIN-32-DYNAMIC: movl L_xsrc$non_lazy_ptr, %eax +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _hxr00: +; DARWIN-32-PIC: call "L79$pb" +; DARWIN-32-PIC-NEXT: "L79$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl L_xsrc$non_lazy_ptr-"L79$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _hxr00: +; DARWIN-64-STATIC: movq _xsrc@GOTPCREL(%rip), %rax +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _hxr00: +; DARWIN-64-DYNAMIC: movq _xsrc@GOTPCREL(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _hxr00: +; DARWIN-64-PIC: movq _xsrc@GOTPCREL(%rip), %rax +; DARWIN-64-PIC-NEXT: ret } define i8* @har01() nounwind { @@ -1116,6 +5429,45 @@ entry: ; LINUX-64-STATIC: har01: ; LINUX-64-STATIC: movl $dst, %eax ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: har01: +; LINUX-32-STATIC: movl $dst, %eax +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: har01: +; LINUX-32-PIC: movl $dst, %eax +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: har01: +; LINUX-64-PIC: movq dst@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _har01: +; DARWIN-32-STATIC: movl $_dst, %eax +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _har01: +; DARWIN-32-DYNAMIC: movl L_dst$non_lazy_ptr, %eax +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _har01: +; DARWIN-32-PIC: call "L80$pb" +; DARWIN-32-PIC-NEXT: "L80$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl L_dst$non_lazy_ptr-"L80$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _har01: +; DARWIN-64-STATIC: movq _dst@GOTPCREL(%rip), %rax +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _har01: +; DARWIN-64-DYNAMIC: movq _dst@GOTPCREL(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _har01: +; DARWIN-64-PIC: movq _dst@GOTPCREL(%rip), %rax +; DARWIN-64-PIC-NEXT: ret } define i8* @hxr01() nounwind { @@ -1124,6 +5476,45 @@ entry: ; LINUX-64-STATIC: hxr01: ; LINUX-64-STATIC: movl $xdst, %eax ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: hxr01: +; LINUX-32-STATIC: movl $xdst, %eax +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: hxr01: +; LINUX-32-PIC: movl $xdst, %eax +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: hxr01: +; LINUX-64-PIC: movq xdst@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _hxr01: +; DARWIN-32-STATIC: movl $_xdst, %eax +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _hxr01: +; DARWIN-32-DYNAMIC: movl L_xdst$non_lazy_ptr, %eax +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _hxr01: +; DARWIN-32-PIC: call "L81$pb" +; DARWIN-32-PIC-NEXT: "L81$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl L_xdst$non_lazy_ptr-"L81$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _hxr01: +; DARWIN-64-STATIC: movq _xdst@GOTPCREL(%rip), %rax +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _hxr01: +; DARWIN-64-DYNAMIC: movq _xdst@GOTPCREL(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _hxr01: +; DARWIN-64-PIC: movq _xdst@GOTPCREL(%rip), %rax +; DARWIN-64-PIC-NEXT: ret } define i8* @har02() nounwind { @@ -1134,6 +5525,51 @@ entry: ; LINUX-64-STATIC: har02: ; LINUX-64-STATIC: movq ptr(%rip), %rax ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: har02: +; LINUX-32-STATIC: movl ptr, %eax +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: har02: +; LINUX-32-PIC: movl ptr, %eax +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: har02: +; LINUX-64-PIC: movq ptr@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: movq (%rax), %rax +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _har02: +; DARWIN-32-STATIC: movl _ptr, %eax +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _har02: +; DARWIN-32-DYNAMIC: movl L_ptr$non_lazy_ptr, %eax +; DARWIN-32-DYNAMIC-NEXT: movl (%eax), %eax +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _har02: +; DARWIN-32-PIC: call "L82$pb" +; DARWIN-32-PIC-NEXT: "L82$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl L_ptr$non_lazy_ptr-"L82$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: movl (%eax), %eax +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _har02: +; DARWIN-64-STATIC: movq _ptr@GOTPCREL(%rip), %rax +; DARWIN-64-STATIC-NEXT: movq (%rax), %rax +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _har02: +; DARWIN-64-DYNAMIC: movq _ptr@GOTPCREL(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: movq (%rax), %rax +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _har02: +; DARWIN-64-PIC: movq _ptr@GOTPCREL(%rip), %rax +; DARWIN-64-PIC-NEXT: movq (%rax), %rax +; DARWIN-64-PIC-NEXT: ret } define i8* @har03() nounwind { @@ -1142,6 +5578,45 @@ entry: ; LINUX-64-STATIC: har03: ; LINUX-64-STATIC: movl $dsrc, %eax ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: har03: +; LINUX-32-STATIC: movl $dsrc, %eax +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: har03: +; LINUX-32-PIC: movl $dsrc, %eax +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: har03: +; LINUX-64-PIC: movq dsrc@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _har03: +; DARWIN-32-STATIC: movl $_dsrc, %eax +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _har03: +; DARWIN-32-DYNAMIC: movl $_dsrc, %eax +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _har03: +; DARWIN-32-PIC: call "L83$pb" +; DARWIN-32-PIC-NEXT: "L83$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: leal _dsrc-"L83$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _har03: +; DARWIN-64-STATIC: leaq _dsrc(%rip), %rax +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _har03: +; DARWIN-64-DYNAMIC: leaq _dsrc(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _har03: +; DARWIN-64-PIC: leaq _dsrc(%rip), %rax +; DARWIN-64-PIC-NEXT: ret } define i8* @har04() nounwind { @@ -1150,6 +5625,45 @@ entry: ; LINUX-64-STATIC: har04: ; LINUX-64-STATIC: movl $ddst, %eax ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: har04: +; LINUX-32-STATIC: movl $ddst, %eax +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: har04: +; LINUX-32-PIC: movl $ddst, %eax +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: har04: +; LINUX-64-PIC: movq ddst@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _har04: +; DARWIN-32-STATIC: movl $_ddst, %eax +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _har04: +; DARWIN-32-DYNAMIC: movl $_ddst, %eax +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _har04: +; DARWIN-32-PIC: call "L84$pb" +; DARWIN-32-PIC-NEXT: "L84$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: leal _ddst-"L84$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _har04: +; DARWIN-64-STATIC: leaq _ddst(%rip), %rax +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _har04: +; DARWIN-64-DYNAMIC: leaq _ddst(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _har04: +; DARWIN-64-PIC: leaq _ddst(%rip), %rax +; DARWIN-64-PIC-NEXT: ret } define i8* @har05() nounwind { @@ -1160,6 +5674,46 @@ entry: ; LINUX-64-STATIC: har05: ; LINUX-64-STATIC: movq dptr(%rip), %rax ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: har05: +; LINUX-32-STATIC: movl dptr, %eax +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: har05: +; LINUX-32-PIC: movl dptr, %eax +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: har05: +; LINUX-64-PIC: movq dptr@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: movq (%rax), %rax +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _har05: +; DARWIN-32-STATIC: movl _dptr, %eax +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _har05: +; DARWIN-32-DYNAMIC: movl _dptr, %eax +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _har05: +; DARWIN-32-PIC: call "L85$pb" +; DARWIN-32-PIC-NEXT: "L85$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl _dptr-"L85$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _har05: +; DARWIN-64-STATIC: movq _dptr(%rip), %rax +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _har05: +; DARWIN-64-DYNAMIC: movq _dptr(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _har05: +; DARWIN-64-PIC: movq _dptr(%rip), %rax +; DARWIN-64-PIC-NEXT: ret } define i8* @har06() nounwind { @@ -1168,6 +5722,45 @@ entry: ; LINUX-64-STATIC: har06: ; LINUX-64-STATIC: movl $lsrc, %eax ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: har06: +; LINUX-32-STATIC: movl $lsrc, %eax +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: har06: +; LINUX-32-PIC: movl $lsrc, %eax +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: har06: +; LINUX-64-PIC: leaq lsrc(%rip), %rax +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _har06: +; DARWIN-32-STATIC: movl $_lsrc, %eax +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _har06: +; DARWIN-32-DYNAMIC: movl $_lsrc, %eax +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _har06: +; DARWIN-32-PIC: call "L86$pb" +; DARWIN-32-PIC-NEXT: "L86$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: leal _lsrc-"L86$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _har06: +; DARWIN-64-STATIC: leaq _lsrc(%rip), %rax +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _har06: +; DARWIN-64-DYNAMIC: leaq _lsrc(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _har06: +; DARWIN-64-PIC: leaq _lsrc(%rip), %rax +; DARWIN-64-PIC-NEXT: ret } define i8* @har07() nounwind { @@ -1176,6 +5769,45 @@ entry: ; LINUX-64-STATIC: har07: ; LINUX-64-STATIC: movl $ldst, %eax ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: har07: +; LINUX-32-STATIC: movl $ldst, %eax +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: har07: +; LINUX-32-PIC: movl $ldst, %eax +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: har07: +; LINUX-64-PIC: leaq ldst(%rip), %rax +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _har07: +; DARWIN-32-STATIC: movl $_ldst, %eax +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _har07: +; DARWIN-32-DYNAMIC: movl $_ldst, %eax +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _har07: +; DARWIN-32-PIC: call "L87$pb" +; DARWIN-32-PIC-NEXT: "L87$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: leal _ldst-"L87$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _har07: +; DARWIN-64-STATIC: leaq _ldst(%rip), %rax +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _har07: +; DARWIN-64-DYNAMIC: leaq _ldst(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _har07: +; DARWIN-64-PIC: leaq _ldst(%rip), %rax +; DARWIN-64-PIC-NEXT: ret } define i8* @har08() nounwind { @@ -1186,6 +5818,45 @@ entry: ; LINUX-64-STATIC: har08: ; LINUX-64-STATIC: movq lptr(%rip), %rax ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: har08: +; LINUX-32-STATIC: movl lptr, %eax +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: har08: +; LINUX-32-PIC: movl lptr, %eax +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: har08: +; LINUX-64-PIC: movq lptr(%rip), %rax +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _har08: +; DARWIN-32-STATIC: movl _lptr, %eax +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _har08: +; DARWIN-32-DYNAMIC: movl _lptr, %eax +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _har08: +; DARWIN-32-PIC: call "L88$pb" +; DARWIN-32-PIC-NEXT: "L88$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl _lptr-"L88$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _har08: +; DARWIN-64-STATIC: movq _lptr(%rip), %rax +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _har08: +; DARWIN-64-DYNAMIC: movq _lptr(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _har08: +; DARWIN-64-PIC: movq _lptr(%rip), %rax +; DARWIN-64-PIC-NEXT: ret } define i8* @bat00() nounwind { @@ -1194,6 +5865,51 @@ entry: ; LINUX-64-STATIC: bat00: ; LINUX-64-STATIC: movl $src+64, %eax ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: bat00: +; LINUX-32-STATIC: movl $src+64, %eax +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: bat00: +; LINUX-32-PIC: movl $src+64, %eax +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: bat00: +; LINUX-64-PIC: movq src@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: addq $64, %rax +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _bat00: +; DARWIN-32-STATIC: movl $_src+64, %eax +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _bat00: +; DARWIN-32-DYNAMIC: movl L_src$non_lazy_ptr, %eax +; DARWIN-32-DYNAMIC-NEXT: addl $64, %eax +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _bat00: +; DARWIN-32-PIC: call "L89$pb" +; DARWIN-32-PIC-NEXT: "L89$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl L_src$non_lazy_ptr-"L89$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: addl $64, %eax +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _bat00: +; DARWIN-64-STATIC: movq _src@GOTPCREL(%rip), %rax +; DARWIN-64-STATIC-NEXT: addq $64, %rax +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _bat00: +; DARWIN-64-DYNAMIC: movq _src@GOTPCREL(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: addq $64, %rax +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _bat00: +; DARWIN-64-PIC: movq _src@GOTPCREL(%rip), %rax +; DARWIN-64-PIC-NEXT: addq $64, %rax +; DARWIN-64-PIC-NEXT: ret } define i8* @bxt00() nounwind { @@ -1202,6 +5918,51 @@ entry: ; LINUX-64-STATIC: bxt00: ; LINUX-64-STATIC: movl $xsrc+64, %eax ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: bxt00: +; LINUX-32-STATIC: movl $xsrc+64, %eax +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: bxt00: +; LINUX-32-PIC: movl $xsrc+64, %eax +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: bxt00: +; LINUX-64-PIC: movq xsrc@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: addq $64, %rax +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _bxt00: +; DARWIN-32-STATIC: movl $_xsrc+64, %eax +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _bxt00: +; DARWIN-32-DYNAMIC: movl L_xsrc$non_lazy_ptr, %eax +; DARWIN-32-DYNAMIC-NEXT: addl $64, %eax +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _bxt00: +; DARWIN-32-PIC: call "L90$pb" +; DARWIN-32-PIC-NEXT: "L90$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl L_xsrc$non_lazy_ptr-"L90$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: addl $64, %eax +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _bxt00: +; DARWIN-64-STATIC: movq _xsrc@GOTPCREL(%rip), %rax +; DARWIN-64-STATIC-NEXT: addq $64, %rax +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _bxt00: +; DARWIN-64-DYNAMIC: movq _xsrc@GOTPCREL(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: addq $64, %rax +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _bxt00: +; DARWIN-64-PIC: movq _xsrc@GOTPCREL(%rip), %rax +; DARWIN-64-PIC-NEXT: addq $64, %rax +; DARWIN-64-PIC-NEXT: ret } define i8* @bat01() nounwind { @@ -1210,6 +5971,51 @@ entry: ; LINUX-64-STATIC: bat01: ; LINUX-64-STATIC: movl $dst+64, %eax ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: bat01: +; LINUX-32-STATIC: movl $dst+64, %eax +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: bat01: +; LINUX-32-PIC: movl $dst+64, %eax +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: bat01: +; LINUX-64-PIC: movq dst@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: addq $64, %rax +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _bat01: +; DARWIN-32-STATIC: movl $_dst+64, %eax +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _bat01: +; DARWIN-32-DYNAMIC: movl L_dst$non_lazy_ptr, %eax +; DARWIN-32-DYNAMIC-NEXT: addl $64, %eax +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _bat01: +; DARWIN-32-PIC: call "L91$pb" +; DARWIN-32-PIC-NEXT: "L91$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl L_dst$non_lazy_ptr-"L91$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: addl $64, %eax +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _bat01: +; DARWIN-64-STATIC: movq _dst@GOTPCREL(%rip), %rax +; DARWIN-64-STATIC-NEXT: addq $64, %rax +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _bat01: +; DARWIN-64-DYNAMIC: movq _dst@GOTPCREL(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: addq $64, %rax +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _bat01: +; DARWIN-64-PIC: movq _dst@GOTPCREL(%rip), %rax +; DARWIN-64-PIC-NEXT: addq $64, %rax +; DARWIN-64-PIC-NEXT: ret } define i8* @bxt01() nounwind { @@ -1218,6 +6024,51 @@ entry: ; LINUX-64-STATIC: bxt01: ; LINUX-64-STATIC: movl $xdst+64, %eax ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: bxt01: +; LINUX-32-STATIC: movl $xdst+64, %eax +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: bxt01: +; LINUX-32-PIC: movl $xdst+64, %eax +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: bxt01: +; LINUX-64-PIC: movq xdst@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: addq $64, %rax +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _bxt01: +; DARWIN-32-STATIC: movl $_xdst+64, %eax +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _bxt01: +; DARWIN-32-DYNAMIC: movl L_xdst$non_lazy_ptr, %eax +; DARWIN-32-DYNAMIC-NEXT: addl $64, %eax +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _bxt01: +; DARWIN-32-PIC: call "L92$pb" +; DARWIN-32-PIC-NEXT: "L92$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl L_xdst$non_lazy_ptr-"L92$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: addl $64, %eax +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _bxt01: +; DARWIN-64-STATIC: movq _xdst@GOTPCREL(%rip), %rax +; DARWIN-64-STATIC-NEXT: addq $64, %rax +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _bxt01: +; DARWIN-64-DYNAMIC: movq _xdst@GOTPCREL(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: addq $64, %rax +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _bxt01: +; DARWIN-64-PIC: movq _xdst@GOTPCREL(%rip), %rax +; DARWIN-64-PIC-NEXT: addq $64, %rax +; DARWIN-64-PIC-NEXT: ret } define i8* @bat02() nounwind { @@ -1230,6 +6081,60 @@ entry: ; LINUX-64-STATIC: movq ptr(%rip), %rax ; LINUX-64-STATIC: addq $64, %rax ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: bat02: +; LINUX-32-STATIC: movl ptr, %eax +; LINUX-32-STATIC-NEXT: addl $64, %eax +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: bat02: +; LINUX-32-PIC: movl ptr, %eax +; LINUX-32-PIC-NEXT: addl $64, %eax +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: bat02: +; LINUX-64-PIC: movq ptr@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: movq (%rax), %rax +; LINUX-64-PIC-NEXT: addq $64, %rax +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _bat02: +; DARWIN-32-STATIC: movl _ptr, %eax +; DARWIN-32-STATIC-NEXT: addl $64, %eax +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _bat02: +; DARWIN-32-DYNAMIC: movl L_ptr$non_lazy_ptr, %eax +; DARWIN-32-DYNAMIC-NEXT: movl (%eax), %eax +; DARWIN-32-DYNAMIC-NEXT: addl $64, %eax +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _bat02: +; DARWIN-32-PIC: call "L93$pb" +; DARWIN-32-PIC-NEXT: "L93$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl L_ptr$non_lazy_ptr-"L93$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: movl (%eax), %eax +; DARWIN-32-PIC-NEXT: addl $64, %eax +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _bat02: +; DARWIN-64-STATIC: movq _ptr@GOTPCREL(%rip), %rax +; DARWIN-64-STATIC-NEXT: movq (%rax), %rax +; DARWIN-64-STATIC-NEXT: addq $64, %rax +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _bat02: +; DARWIN-64-DYNAMIC: movq _ptr@GOTPCREL(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: movq (%rax), %rax +; DARWIN-64-DYNAMIC-NEXT: addq $64, %rax +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _bat02: +; DARWIN-64-PIC: movq _ptr@GOTPCREL(%rip), %rax +; DARWIN-64-PIC-NEXT: movq (%rax), %rax +; DARWIN-64-PIC-NEXT: addq $64, %rax +; DARWIN-64-PIC-NEXT: ret } define i8* @bat03() nounwind { @@ -1238,6 +6143,46 @@ entry: ; LINUX-64-STATIC: bat03: ; LINUX-64-STATIC: movl $dsrc+64, %eax ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: bat03: +; LINUX-32-STATIC: movl $dsrc+64, %eax +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: bat03: +; LINUX-32-PIC: movl $dsrc+64, %eax +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: bat03: +; LINUX-64-PIC: movq dsrc@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: addq $64, %rax +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _bat03: +; DARWIN-32-STATIC: movl $_dsrc+64, %eax +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _bat03: +; DARWIN-32-DYNAMIC: movl $_dsrc+64, %eax +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _bat03: +; DARWIN-32-PIC: call "L94$pb" +; DARWIN-32-PIC-NEXT: "L94$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: leal _dsrc+64-"L94$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _bat03: +; DARWIN-64-STATIC: leaq _dsrc+64(%rip), %rax +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _bat03: +; DARWIN-64-DYNAMIC: leaq _dsrc+64(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _bat03: +; DARWIN-64-PIC: leaq _dsrc+64(%rip), %rax +; DARWIN-64-PIC-NEXT: ret } define i8* @bat04() nounwind { @@ -1246,6 +6191,46 @@ entry: ; LINUX-64-STATIC: bat04: ; LINUX-64-STATIC: movl $ddst+64, %eax ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: bat04: +; LINUX-32-STATIC: movl $ddst+64, %eax +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: bat04: +; LINUX-32-PIC: movl $ddst+64, %eax +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: bat04: +; LINUX-64-PIC: movq ddst@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: addq $64, %rax +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _bat04: +; DARWIN-32-STATIC: movl $_ddst+64, %eax +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _bat04: +; DARWIN-32-DYNAMIC: movl $_ddst+64, %eax +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _bat04: +; DARWIN-32-PIC: call "L95$pb" +; DARWIN-32-PIC-NEXT: "L95$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: leal _ddst+64-"L95$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _bat04: +; DARWIN-64-STATIC: leaq _ddst+64(%rip), %rax +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _bat04: +; DARWIN-64-DYNAMIC: leaq _ddst+64(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _bat04: +; DARWIN-64-PIC: leaq _ddst+64(%rip), %rax +; DARWIN-64-PIC-NEXT: ret } define i8* @bat05() nounwind { @@ -1258,6 +6243,55 @@ entry: ; LINUX-64-STATIC: movq dptr(%rip), %rax ; LINUX-64-STATIC: addq $64, %rax ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: bat05: +; LINUX-32-STATIC: movl dptr, %eax +; LINUX-32-STATIC-NEXT: addl $64, %eax +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: bat05: +; LINUX-32-PIC: movl dptr, %eax +; LINUX-32-PIC-NEXT: addl $64, %eax +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: bat05: +; LINUX-64-PIC: movq dptr@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: movq (%rax), %rax +; LINUX-64-PIC-NEXT: addq $64, %rax +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _bat05: +; DARWIN-32-STATIC: movl _dptr, %eax +; DARWIN-32-STATIC-NEXT: addl $64, %eax +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _bat05: +; DARWIN-32-DYNAMIC: movl _dptr, %eax +; DARWIN-32-DYNAMIC-NEXT: addl $64, %eax +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _bat05: +; DARWIN-32-PIC: call "L96$pb" +; DARWIN-32-PIC-NEXT: "L96$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl _dptr-"L96$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: addl $64, %eax +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _bat05: +; DARWIN-64-STATIC: movq _dptr(%rip), %rax +; DARWIN-64-STATIC-NEXT: addq $64, %rax +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _bat05: +; DARWIN-64-DYNAMIC: movq _dptr(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: addq $64, %rax +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _bat05: +; DARWIN-64-PIC: movq _dptr(%rip), %rax +; DARWIN-64-PIC-NEXT: addq $64, %rax +; DARWIN-64-PIC-NEXT: ret } define i8* @bat06() nounwind { @@ -1266,6 +6300,45 @@ entry: ; LINUX-64-STATIC: bat06: ; LINUX-64-STATIC: movl $lsrc+64, %eax ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: bat06: +; LINUX-32-STATIC: movl $lsrc+64, %eax +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: bat06: +; LINUX-32-PIC: movl $lsrc+64, %eax +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: bat06: +; LINUX-64-PIC: leaq lsrc+64(%rip), %rax +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _bat06: +; DARWIN-32-STATIC: movl $_lsrc+64, %eax +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _bat06: +; DARWIN-32-DYNAMIC: movl $_lsrc+64, %eax +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _bat06: +; DARWIN-32-PIC: call "L97$pb" +; DARWIN-32-PIC-NEXT: "L97$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: leal _lsrc+64-"L97$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _bat06: +; DARWIN-64-STATIC: leaq _lsrc+64(%rip), %rax +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _bat06: +; DARWIN-64-DYNAMIC: leaq _lsrc+64(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _bat06: +; DARWIN-64-PIC: leaq _lsrc+64(%rip), %rax +; DARWIN-64-PIC-NEXT: ret } define i8* @bat07() nounwind { @@ -1274,6 +6347,45 @@ entry: ; LINUX-64-STATIC: bat07: ; LINUX-64-STATIC: movl $ldst+64, %eax ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: bat07: +; LINUX-32-STATIC: movl $ldst+64, %eax +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: bat07: +; LINUX-32-PIC: movl $ldst+64, %eax +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: bat07: +; LINUX-64-PIC: leaq ldst+64(%rip), %rax +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _bat07: +; DARWIN-32-STATIC: movl $_ldst+64, %eax +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _bat07: +; DARWIN-32-DYNAMIC: movl $_ldst+64, %eax +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _bat07: +; DARWIN-32-PIC: call "L98$pb" +; DARWIN-32-PIC-NEXT: "L98$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: leal _ldst+64-"L98$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _bat07: +; DARWIN-64-STATIC: leaq _ldst+64(%rip), %rax +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _bat07: +; DARWIN-64-DYNAMIC: leaq _ldst+64(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _bat07: +; DARWIN-64-PIC: leaq _ldst+64(%rip), %rax +; DARWIN-64-PIC-NEXT: ret } define i8* @bat08() nounwind { @@ -1286,6 +6398,54 @@ entry: ; LINUX-64-STATIC: movq lptr(%rip), %rax ; LINUX-64-STATIC: addq $64, %rax ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: bat08: +; LINUX-32-STATIC: movl lptr, %eax +; LINUX-32-STATIC-NEXT: addl $64, %eax +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: bat08: +; LINUX-32-PIC: movl lptr, %eax +; LINUX-32-PIC-NEXT: addl $64, %eax +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: bat08: +; LINUX-64-PIC: movq lptr(%rip), %rax +; LINUX-64-PIC-NEXT: addq $64, %rax +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _bat08: +; DARWIN-32-STATIC: movl _lptr, %eax +; DARWIN-32-STATIC-NEXT: addl $64, %eax +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _bat08: +; DARWIN-32-DYNAMIC: movl _lptr, %eax +; DARWIN-32-DYNAMIC-NEXT: addl $64, %eax +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _bat08: +; DARWIN-32-PIC: call "L99$pb" +; DARWIN-32-PIC-NEXT: "L99$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl _lptr-"L99$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: addl $64, %eax +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _bat08: +; DARWIN-64-STATIC: movq _lptr(%rip), %rax +; DARWIN-64-STATIC-NEXT: addq $64, %rax +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _bat08: +; DARWIN-64-DYNAMIC: movq _lptr(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: addq $64, %rax +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _bat08: +; DARWIN-64-PIC: movq _lptr(%rip), %rax +; DARWIN-64-PIC-NEXT: addq $64, %rax +; DARWIN-64-PIC-NEXT: ret } define i8* @bam00() nounwind { @@ -1294,6 +6454,51 @@ entry: ; LINUX-64-STATIC: bam00: ; LINUX-64-STATIC: movl $src+262144, %eax ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: bam00: +; LINUX-32-STATIC: movl $src+262144, %eax +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: bam00: +; LINUX-32-PIC: movl $src+262144, %eax +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: bam00: +; LINUX-64-PIC: movl $262144, %eax +; LINUX-64-PIC-NEXT: addq src@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _bam00: +; DARWIN-32-STATIC: movl $_src+262144, %eax +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _bam00: +; DARWIN-32-DYNAMIC: movl $262144, %eax +; DARWIN-32-DYNAMIC-NEXT: addl L_src$non_lazy_ptr, %eax +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _bam00: +; DARWIN-32-PIC: call "L100$pb" +; DARWIN-32-PIC-NEXT: "L100$pb": +; DARWIN-32-PIC-NEXT: popl %ecx +; DARWIN-32-PIC-NEXT: movl $262144, %eax +; DARWIN-32-PIC-NEXT: addl L_src$non_lazy_ptr-"L100$pb"(%ecx), %eax +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _bam00: +; DARWIN-64-STATIC: movl $262144, %eax +; DARWIN-64-STATIC-NEXT: addq _src@GOTPCREL(%rip), %rax +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _bam00: +; DARWIN-64-DYNAMIC: movl $262144, %eax +; DARWIN-64-DYNAMIC-NEXT: addq _src@GOTPCREL(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _bam00: +; DARWIN-64-PIC: movl $262144, %eax +; DARWIN-64-PIC-NEXT: addq _src@GOTPCREL(%rip), %rax +; DARWIN-64-PIC-NEXT: ret } define i8* @bam01() nounwind { @@ -1302,6 +6507,51 @@ entry: ; LINUX-64-STATIC: bam01: ; LINUX-64-STATIC: movl $dst+262144, %eax ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: bam01: +; LINUX-32-STATIC: movl $dst+262144, %eax +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: bam01: +; LINUX-32-PIC: movl $dst+262144, %eax +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: bam01: +; LINUX-64-PIC: movl $262144, %eax +; LINUX-64-PIC-NEXT: addq dst@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _bam01: +; DARWIN-32-STATIC: movl $_dst+262144, %eax +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _bam01: +; DARWIN-32-DYNAMIC: movl $262144, %eax +; DARWIN-32-DYNAMIC-NEXT: addl L_dst$non_lazy_ptr, %eax +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _bam01: +; DARWIN-32-PIC: call "L101$pb" +; DARWIN-32-PIC-NEXT: "L101$pb": +; DARWIN-32-PIC-NEXT: popl %ecx +; DARWIN-32-PIC-NEXT: movl $262144, %eax +; DARWIN-32-PIC-NEXT: addl L_dst$non_lazy_ptr-"L101$pb"(%ecx), %eax +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _bam01: +; DARWIN-64-STATIC: movl $262144, %eax +; DARWIN-64-STATIC-NEXT: addq _dst@GOTPCREL(%rip), %rax +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _bam01: +; DARWIN-64-DYNAMIC: movl $262144, %eax +; DARWIN-64-DYNAMIC-NEXT: addq _dst@GOTPCREL(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _bam01: +; DARWIN-64-PIC: movl $262144, %eax +; DARWIN-64-PIC-NEXT: addq _dst@GOTPCREL(%rip), %rax +; DARWIN-64-PIC-NEXT: ret } define i8* @bxm01() nounwind { @@ -1310,6 +6560,51 @@ entry: ; LINUX-64-STATIC: bxm01: ; LINUX-64-STATIC: movl $xdst+262144, %eax ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: bxm01: +; LINUX-32-STATIC: movl $xdst+262144, %eax +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: bxm01: +; LINUX-32-PIC: movl $xdst+262144, %eax +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: bxm01: +; LINUX-64-PIC: movl $262144, %eax +; LINUX-64-PIC-NEXT: addq xdst@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _bxm01: +; DARWIN-32-STATIC: movl $_xdst+262144, %eax +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _bxm01: +; DARWIN-32-DYNAMIC: movl $262144, %eax +; DARWIN-32-DYNAMIC-NEXT: addl L_xdst$non_lazy_ptr, %eax +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _bxm01: +; DARWIN-32-PIC: call "L102$pb" +; DARWIN-32-PIC-NEXT: "L102$pb": +; DARWIN-32-PIC-NEXT: popl %ecx +; DARWIN-32-PIC-NEXT: movl $262144, %eax +; DARWIN-32-PIC-NEXT: addl L_xdst$non_lazy_ptr-"L102$pb"(%ecx), %eax +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _bxm01: +; DARWIN-64-STATIC: movl $262144, %eax +; DARWIN-64-STATIC-NEXT: addq _xdst@GOTPCREL(%rip), %rax +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _bxm01: +; DARWIN-64-DYNAMIC: movl $262144, %eax +; DARWIN-64-DYNAMIC-NEXT: addq _xdst@GOTPCREL(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _bxm01: +; DARWIN-64-PIC: movl $262144, %eax +; DARWIN-64-PIC-NEXT: addq _xdst@GOTPCREL(%rip), %rax +; DARWIN-64-PIC-NEXT: ret } define i8* @bam02() nounwind { @@ -1322,6 +6617,60 @@ entry: ; LINUX-64-STATIC: movl $262144, %eax ; LINUX-64-STATIC: addq ptr(%rip), %rax ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: bam02: +; LINUX-32-STATIC: movl $262144, %eax +; LINUX-32-STATIC-NEXT: addl ptr, %eax +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: bam02: +; LINUX-32-PIC: movl $262144, %eax +; LINUX-32-PIC-NEXT: addl ptr, %eax +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: bam02: +; LINUX-64-PIC: movq ptr@GOTPCREL(%rip), %rcx +; LINUX-64-PIC-NEXT: movl $262144, %eax +; LINUX-64-PIC-NEXT: addq (%rcx), %rax +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _bam02: +; DARWIN-32-STATIC: movl $262144, %eax +; DARWIN-32-STATIC-NEXT: addl _ptr, %eax +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _bam02: +; DARWIN-32-DYNAMIC: movl L_ptr$non_lazy_ptr, %ecx +; DARWIN-32-DYNAMIC-NEXT: movl $262144, %eax +; DARWIN-32-DYNAMIC-NEXT: addl (%ecx), %eax +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _bam02: +; DARWIN-32-PIC: call "L103$pb" +; DARWIN-32-PIC-NEXT: "L103$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl L_ptr$non_lazy_ptr-"L103$pb"(%eax), %ecx +; DARWIN-32-PIC-NEXT: movl $262144, %eax +; DARWIN-32-PIC-NEXT: addl (%ecx), %eax +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _bam02: +; DARWIN-64-STATIC: movq _ptr@GOTPCREL(%rip), %rcx +; DARWIN-64-STATIC-NEXT: movl $262144, %eax +; DARWIN-64-STATIC-NEXT: addq (%rcx), %rax +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _bam02: +; DARWIN-64-DYNAMIC: movq _ptr@GOTPCREL(%rip), %rcx +; DARWIN-64-DYNAMIC-NEXT: movl $262144, %eax +; DARWIN-64-DYNAMIC-NEXT: addq (%rcx), %rax +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _bam02: +; DARWIN-64-PIC: movq _ptr@GOTPCREL(%rip), %rcx +; DARWIN-64-PIC-NEXT: movl $262144, %eax +; DARWIN-64-PIC-NEXT: addq (%rcx), %rax +; DARWIN-64-PIC-NEXT: ret } define i8* @bam03() nounwind { @@ -1330,6 +6679,46 @@ entry: ; LINUX-64-STATIC: bam03: ; LINUX-64-STATIC: movl $dsrc+262144, %eax ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: bam03: +; LINUX-32-STATIC: movl $dsrc+262144, %eax +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: bam03: +; LINUX-32-PIC: movl $dsrc+262144, %eax +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: bam03: +; LINUX-64-PIC: movl $262144, %eax +; LINUX-64-PIC-NEXT: addq dsrc@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _bam03: +; DARWIN-32-STATIC: movl $_dsrc+262144, %eax +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _bam03: +; DARWIN-32-DYNAMIC: movl $_dsrc+262144, %eax +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _bam03: +; DARWIN-32-PIC: call "L104$pb" +; DARWIN-32-PIC-NEXT: "L104$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: leal _dsrc+262144-"L104$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _bam03: +; DARWIN-64-STATIC: leaq _dsrc+262144(%rip), %rax +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _bam03: +; DARWIN-64-DYNAMIC: leaq _dsrc+262144(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _bam03: +; DARWIN-64-PIC: leaq _dsrc+262144(%rip), %rax +; DARWIN-64-PIC-NEXT: ret } define i8* @bam04() nounwind { @@ -1338,6 +6727,46 @@ entry: ; LINUX-64-STATIC: bam04: ; LINUX-64-STATIC: movl $ddst+262144, %eax ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: bam04: +; LINUX-32-STATIC: movl $ddst+262144, %eax +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: bam04: +; LINUX-32-PIC: movl $ddst+262144, %eax +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: bam04: +; LINUX-64-PIC: movl $262144, %eax +; LINUX-64-PIC-NEXT: addq ddst@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _bam04: +; DARWIN-32-STATIC: movl $_ddst+262144, %eax +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _bam04: +; DARWIN-32-DYNAMIC: movl $_ddst+262144, %eax +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _bam04: +; DARWIN-32-PIC: call "L105$pb" +; DARWIN-32-PIC-NEXT: "L105$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: leal _ddst+262144-"L105$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _bam04: +; DARWIN-64-STATIC: leaq _ddst+262144(%rip), %rax +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _bam04: +; DARWIN-64-DYNAMIC: leaq _ddst+262144(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _bam04: +; DARWIN-64-PIC: leaq _ddst+262144(%rip), %rax +; DARWIN-64-PIC-NEXT: ret } define i8* @bam05() nounwind { @@ -1350,6 +6779,55 @@ entry: ; LINUX-64-STATIC: movl $262144, %eax ; LINUX-64-STATIC: addq dptr(%rip), %rax ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: bam05: +; LINUX-32-STATIC: movl $262144, %eax +; LINUX-32-STATIC-NEXT: addl dptr, %eax +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: bam05: +; LINUX-32-PIC: movl $262144, %eax +; LINUX-32-PIC-NEXT: addl dptr, %eax +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: bam05: +; LINUX-64-PIC: movq dptr@GOTPCREL(%rip), %rcx +; LINUX-64-PIC-NEXT: movl $262144, %eax +; LINUX-64-PIC-NEXT: addq (%rcx), %rax +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _bam05: +; DARWIN-32-STATIC: movl $262144, %eax +; DARWIN-32-STATIC-NEXT: addl _dptr, %eax +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _bam05: +; DARWIN-32-DYNAMIC: movl $262144, %eax +; DARWIN-32-DYNAMIC-NEXT: addl _dptr, %eax +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _bam05: +; DARWIN-32-PIC: call "L106$pb" +; DARWIN-32-PIC-NEXT: "L106$pb": +; DARWIN-32-PIC-NEXT: popl %ecx +; DARWIN-32-PIC-NEXT: movl $262144, %eax +; DARWIN-32-PIC-NEXT: addl _dptr-"L106$pb"(%ecx), %eax +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _bam05: +; DARWIN-64-STATIC: movl $262144, %eax +; DARWIN-64-STATIC-NEXT: addq _dptr(%rip), %rax +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _bam05: +; DARWIN-64-DYNAMIC: movl $262144, %eax +; DARWIN-64-DYNAMIC-NEXT: addq _dptr(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _bam05: +; DARWIN-64-PIC: movl $262144, %eax +; DARWIN-64-PIC-NEXT: addq _dptr(%rip), %rax +; DARWIN-64-PIC-NEXT: ret } define i8* @bam06() nounwind { @@ -1358,6 +6836,45 @@ entry: ; LINUX-64-STATIC: bam06: ; LINUX-64-STATIC: movl $lsrc+262144, %eax ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: bam06: +; LINUX-32-STATIC: movl $lsrc+262144, %eax +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: bam06: +; LINUX-32-PIC: movl $lsrc+262144, %eax +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: bam06: +; LINUX-64-PIC: leaq lsrc+262144(%rip), %rax +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _bam06: +; DARWIN-32-STATIC: movl $_lsrc+262144, %eax +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _bam06: +; DARWIN-32-DYNAMIC: movl $_lsrc+262144, %eax +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _bam06: +; DARWIN-32-PIC: call "L107$pb" +; DARWIN-32-PIC-NEXT: "L107$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: leal _lsrc+262144-"L107$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _bam06: +; DARWIN-64-STATIC: leaq _lsrc+262144(%rip), %rax +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _bam06: +; DARWIN-64-DYNAMIC: leaq _lsrc+262144(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _bam06: +; DARWIN-64-PIC: leaq _lsrc+262144(%rip), %rax +; DARWIN-64-PIC-NEXT: ret } define i8* @bam07() nounwind { @@ -1366,6 +6883,45 @@ entry: ; LINUX-64-STATIC: bam07: ; LINUX-64-STATIC: movl $ldst+262144, %eax ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: bam07: +; LINUX-32-STATIC: movl $ldst+262144, %eax +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: bam07: +; LINUX-32-PIC: movl $ldst+262144, %eax +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: bam07: +; LINUX-64-PIC: leaq ldst+262144(%rip), %rax +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _bam07: +; DARWIN-32-STATIC: movl $_ldst+262144, %eax +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _bam07: +; DARWIN-32-DYNAMIC: movl $_ldst+262144, %eax +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _bam07: +; DARWIN-32-PIC: call "L108$pb" +; DARWIN-32-PIC-NEXT: "L108$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: leal _ldst+262144-"L108$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _bam07: +; DARWIN-64-STATIC: leaq _ldst+262144(%rip), %rax +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _bam07: +; DARWIN-64-DYNAMIC: leaq _ldst+262144(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _bam07: +; DARWIN-64-PIC: leaq _ldst+262144(%rip), %rax +; DARWIN-64-PIC-NEXT: ret } define i8* @bam08() nounwind { @@ -1378,6 +6934,54 @@ entry: ; LINUX-64-STATIC: movl $262144, %eax ; LINUX-64-STATIC: addq lptr(%rip), %rax ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: bam08: +; LINUX-32-STATIC: movl $262144, %eax +; LINUX-32-STATIC-NEXT: addl lptr, %eax +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: bam08: +; LINUX-32-PIC: movl $262144, %eax +; LINUX-32-PIC-NEXT: addl lptr, %eax +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: bam08: +; LINUX-64-PIC: movl $262144, %eax +; LINUX-64-PIC-NEXT: addq lptr(%rip), %rax +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _bam08: +; DARWIN-32-STATIC: movl $262144, %eax +; DARWIN-32-STATIC-NEXT: addl _lptr, %eax +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _bam08: +; DARWIN-32-DYNAMIC: movl $262144, %eax +; DARWIN-32-DYNAMIC-NEXT: addl _lptr, %eax +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _bam08: +; DARWIN-32-PIC: call "L109$pb" +; DARWIN-32-PIC-NEXT: "L109$pb": +; DARWIN-32-PIC-NEXT: popl %ecx +; DARWIN-32-PIC-NEXT: movl $262144, %eax +; DARWIN-32-PIC-NEXT: addl _lptr-"L109$pb"(%ecx), %eax +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _bam08: +; DARWIN-64-STATIC: movl $262144, %eax +; DARWIN-64-STATIC-NEXT: addq _lptr(%rip), %rax +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _bam08: +; DARWIN-64-DYNAMIC: movl $262144, %eax +; DARWIN-64-DYNAMIC-NEXT: addq _lptr(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _bam08: +; DARWIN-64-PIC: movl $262144, %eax +; DARWIN-64-PIC-NEXT: addq _lptr(%rip), %rax +; DARWIN-64-PIC-NEXT: ret } define i8* @cat00(i64 %i) nounwind { @@ -1389,6 +6993,56 @@ entry: ; LINUX-64-STATIC: cat00: ; LINUX-64-STATIC: leaq src+64(,%rdi,4), %rax ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: cat00: +; LINUX-32-STATIC: movl 4(%esp), %eax +; LINUX-32-STATIC-NEXT: leal src+64(,%eax,4), %eax +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: cat00: +; LINUX-32-PIC: movl 4(%esp), %eax +; LINUX-32-PIC-NEXT: leal src+64(,%eax,4), %eax +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: cat00: +; LINUX-64-PIC: movq src@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: leaq 64(%rax,%rdi,4), %rax +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _cat00: +; DARWIN-32-STATIC: movl 4(%esp), %eax +; DARWIN-32-STATIC-NEXT: leal _src+64(,%eax,4), %eax +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _cat00: +; DARWIN-32-DYNAMIC: movl 4(%esp), %eax +; DARWIN-32-DYNAMIC-NEXT: movl L_src$non_lazy_ptr, %ecx +; DARWIN-32-DYNAMIC-NEXT: leal 64(%ecx,%eax,4), %eax +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _cat00: +; DARWIN-32-PIC: call "L110$pb" +; DARWIN-32-PIC-NEXT: "L110$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl 4(%esp), %ecx +; DARWIN-32-PIC-NEXT: movl L_src$non_lazy_ptr-"L110$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: leal 64(%eax,%ecx,4), %eax +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _cat00: +; DARWIN-64-STATIC: movq _src@GOTPCREL(%rip), %rax +; DARWIN-64-STATIC-NEXT: leaq 64(%rax,%rdi,4), %rax +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _cat00: +; DARWIN-64-DYNAMIC: movq _src@GOTPCREL(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: leaq 64(%rax,%rdi,4), %rax +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _cat00: +; DARWIN-64-PIC: movq _src@GOTPCREL(%rip), %rax +; DARWIN-64-PIC-NEXT: leaq 64(%rax,%rdi,4), %rax +; DARWIN-64-PIC-NEXT: ret } define i8* @cxt00(i64 %i) nounwind { @@ -1400,6 +7054,56 @@ entry: ; LINUX-64-STATIC: cxt00: ; LINUX-64-STATIC: leaq xsrc+64(,%rdi,4), %rax ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: cxt00: +; LINUX-32-STATIC: movl 4(%esp), %eax +; LINUX-32-STATIC-NEXT: leal xsrc+64(,%eax,4), %eax +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: cxt00: +; LINUX-32-PIC: movl 4(%esp), %eax +; LINUX-32-PIC-NEXT: leal xsrc+64(,%eax,4), %eax +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: cxt00: +; LINUX-64-PIC: movq xsrc@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: leaq 64(%rax,%rdi,4), %rax +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _cxt00: +; DARWIN-32-STATIC: movl 4(%esp), %eax +; DARWIN-32-STATIC-NEXT: leal _xsrc+64(,%eax,4), %eax +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _cxt00: +; DARWIN-32-DYNAMIC: movl 4(%esp), %eax +; DARWIN-32-DYNAMIC-NEXT: movl L_xsrc$non_lazy_ptr, %ecx +; DARWIN-32-DYNAMIC-NEXT: leal 64(%ecx,%eax,4), %eax +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _cxt00: +; DARWIN-32-PIC: call "L111$pb" +; DARWIN-32-PIC-NEXT: "L111$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl 4(%esp), %ecx +; DARWIN-32-PIC-NEXT: movl L_xsrc$non_lazy_ptr-"L111$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: leal 64(%eax,%ecx,4), %eax +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _cxt00: +; DARWIN-64-STATIC: movq _xsrc@GOTPCREL(%rip), %rax +; DARWIN-64-STATIC-NEXT: leaq 64(%rax,%rdi,4), %rax +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _cxt00: +; DARWIN-64-DYNAMIC: movq _xsrc@GOTPCREL(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: leaq 64(%rax,%rdi,4), %rax +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _cxt00: +; DARWIN-64-PIC: movq _xsrc@GOTPCREL(%rip), %rax +; DARWIN-64-PIC-NEXT: leaq 64(%rax,%rdi,4), %rax +; DARWIN-64-PIC-NEXT: ret } define i8* @cat01(i64 %i) nounwind { @@ -1411,6 +7115,56 @@ entry: ; LINUX-64-STATIC: cat01: ; LINUX-64-STATIC: leaq dst+64(,%rdi,4), %rax ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: cat01: +; LINUX-32-STATIC: movl 4(%esp), %eax +; LINUX-32-STATIC-NEXT: leal dst+64(,%eax,4), %eax +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: cat01: +; LINUX-32-PIC: movl 4(%esp), %eax +; LINUX-32-PIC-NEXT: leal dst+64(,%eax,4), %eax +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: cat01: +; LINUX-64-PIC: movq dst@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: leaq 64(%rax,%rdi,4), %rax +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _cat01: +; DARWIN-32-STATIC: movl 4(%esp), %eax +; DARWIN-32-STATIC-NEXT: leal _dst+64(,%eax,4), %eax +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _cat01: +; DARWIN-32-DYNAMIC: movl 4(%esp), %eax +; DARWIN-32-DYNAMIC-NEXT: movl L_dst$non_lazy_ptr, %ecx +; DARWIN-32-DYNAMIC-NEXT: leal 64(%ecx,%eax,4), %eax +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _cat01: +; DARWIN-32-PIC: call "L112$pb" +; DARWIN-32-PIC-NEXT: "L112$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl 4(%esp), %ecx +; DARWIN-32-PIC-NEXT: movl L_dst$non_lazy_ptr-"L112$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: leal 64(%eax,%ecx,4), %eax +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _cat01: +; DARWIN-64-STATIC: movq _dst@GOTPCREL(%rip), %rax +; DARWIN-64-STATIC-NEXT: leaq 64(%rax,%rdi,4), %rax +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _cat01: +; DARWIN-64-DYNAMIC: movq _dst@GOTPCREL(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: leaq 64(%rax,%rdi,4), %rax +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _cat01: +; DARWIN-64-PIC: movq _dst@GOTPCREL(%rip), %rax +; DARWIN-64-PIC-NEXT: leaq 64(%rax,%rdi,4), %rax +; DARWIN-64-PIC-NEXT: ret } define i8* @cxt01(i64 %i) nounwind { @@ -1422,6 +7176,56 @@ entry: ; LINUX-64-STATIC: cxt01: ; LINUX-64-STATIC: leaq xdst+64(,%rdi,4), %rax ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: cxt01: +; LINUX-32-STATIC: movl 4(%esp), %eax +; LINUX-32-STATIC-NEXT: leal xdst+64(,%eax,4), %eax +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: cxt01: +; LINUX-32-PIC: movl 4(%esp), %eax +; LINUX-32-PIC-NEXT: leal xdst+64(,%eax,4), %eax +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: cxt01: +; LINUX-64-PIC: movq xdst@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: leaq 64(%rax,%rdi,4), %rax +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _cxt01: +; DARWIN-32-STATIC: movl 4(%esp), %eax +; DARWIN-32-STATIC-NEXT: leal _xdst+64(,%eax,4), %eax +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _cxt01: +; DARWIN-32-DYNAMIC: movl 4(%esp), %eax +; DARWIN-32-DYNAMIC-NEXT: movl L_xdst$non_lazy_ptr, %ecx +; DARWIN-32-DYNAMIC-NEXT: leal 64(%ecx,%eax,4), %eax +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _cxt01: +; DARWIN-32-PIC: call "L113$pb" +; DARWIN-32-PIC-NEXT: "L113$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl 4(%esp), %ecx +; DARWIN-32-PIC-NEXT: movl L_xdst$non_lazy_ptr-"L113$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: leal 64(%eax,%ecx,4), %eax +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _cxt01: +; DARWIN-64-STATIC: movq _xdst@GOTPCREL(%rip), %rax +; DARWIN-64-STATIC-NEXT: leaq 64(%rax,%rdi,4), %rax +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _cxt01: +; DARWIN-64-DYNAMIC: movq _xdst@GOTPCREL(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: leaq 64(%rax,%rdi,4), %rax +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _cxt01: +; DARWIN-64-PIC: movq _xdst@GOTPCREL(%rip), %rax +; DARWIN-64-PIC-NEXT: leaq 64(%rax,%rdi,4), %rax +; DARWIN-64-PIC-NEXT: ret } define i8* @cat02(i64 %i) nounwind { @@ -1435,6 +7239,65 @@ entry: ; LINUX-64-STATIC: movq ptr(%rip), %rax ; LINUX-64-STATIC: leaq 64(%rax,%rdi,4), %rax ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: cat02: +; LINUX-32-STATIC: movl 4(%esp), %eax +; LINUX-32-STATIC-NEXT: movl ptr, %ecx +; LINUX-32-STATIC-NEXT: leal 64(%ecx,%eax,4), %eax +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: cat02: +; LINUX-32-PIC: movl 4(%esp), %eax +; LINUX-32-PIC-NEXT: movl ptr, %ecx +; LINUX-32-PIC-NEXT: leal 64(%ecx,%eax,4), %eax +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: cat02: +; LINUX-64-PIC: movq ptr@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: movq (%rax), %rax +; LINUX-64-PIC-NEXT: leaq 64(%rax,%rdi,4), %rax +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _cat02: +; DARWIN-32-STATIC: movl 4(%esp), %eax +; DARWIN-32-STATIC-NEXT: movl _ptr, %ecx +; DARWIN-32-STATIC-NEXT: leal 64(%ecx,%eax,4), %eax +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _cat02: +; DARWIN-32-DYNAMIC: movl L_ptr$non_lazy_ptr, %eax +; DARWIN-32-DYNAMIC-NEXT: movl (%eax), %eax +; DARWIN-32-DYNAMIC-NEXT: movl 4(%esp), %ecx +; DARWIN-32-DYNAMIC-NEXT: leal 64(%eax,%ecx,4), %eax +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _cat02: +; DARWIN-32-PIC: call "L114$pb" +; DARWIN-32-PIC-NEXT: "L114$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl L_ptr$non_lazy_ptr-"L114$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: movl (%eax), %eax +; DARWIN-32-PIC-NEXT: movl 4(%esp), %ecx +; DARWIN-32-PIC-NEXT: leal 64(%eax,%ecx,4), %eax +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _cat02: +; DARWIN-64-STATIC: movq _ptr@GOTPCREL(%rip), %rax +; DARWIN-64-STATIC-NEXT: movq (%rax), %rax +; DARWIN-64-STATIC-NEXT: leaq 64(%rax,%rdi,4), %rax +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _cat02: +; DARWIN-64-DYNAMIC: movq _ptr@GOTPCREL(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: movq (%rax), %rax +; DARWIN-64-DYNAMIC-NEXT: leaq 64(%rax,%rdi,4), %rax +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _cat02: +; DARWIN-64-PIC: movq _ptr@GOTPCREL(%rip), %rax +; DARWIN-64-PIC-NEXT: movq (%rax), %rax +; DARWIN-64-PIC-NEXT: leaq 64(%rax,%rdi,4), %rax +; DARWIN-64-PIC-NEXT: ret } define i8* @cat03(i64 %i) nounwind { @@ -1446,6 +7309,54 @@ entry: ; LINUX-64-STATIC: cat03: ; LINUX-64-STATIC: leaq dsrc+64(,%rdi,4), %rax ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: cat03: +; LINUX-32-STATIC: movl 4(%esp), %eax +; LINUX-32-STATIC-NEXT: leal dsrc+64(,%eax,4), %eax +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: cat03: +; LINUX-32-PIC: movl 4(%esp), %eax +; LINUX-32-PIC-NEXT: leal dsrc+64(,%eax,4), %eax +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: cat03: +; LINUX-64-PIC: movq dsrc@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: leaq 64(%rax,%rdi,4), %rax +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _cat03: +; DARWIN-32-STATIC: movl 4(%esp), %eax +; DARWIN-32-STATIC-NEXT: leal _dsrc+64(,%eax,4), %eax +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _cat03: +; DARWIN-32-DYNAMIC: movl 4(%esp), %eax +; DARWIN-32-DYNAMIC-NEXT: leal _dsrc+64(,%eax,4), %eax +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _cat03: +; DARWIN-32-PIC: call "L115$pb" +; DARWIN-32-PIC-NEXT: "L115$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl 4(%esp), %ecx +; DARWIN-32-PIC-NEXT: leal _dsrc+64-"L115$pb"(%eax,%ecx,4), %eax +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _cat03: +; DARWIN-64-STATIC: leaq _dsrc(%rip), %rax +; DARWIN-64-STATIC-NEXT: leaq 64(%rax,%rdi,4), %rax +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _cat03: +; DARWIN-64-DYNAMIC: leaq _dsrc(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: leaq 64(%rax,%rdi,4), %rax +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _cat03: +; DARWIN-64-PIC: leaq _dsrc(%rip), %rax +; DARWIN-64-PIC-NEXT: leaq 64(%rax,%rdi,4), %rax +; DARWIN-64-PIC-NEXT: ret } define i8* @cat04(i64 %i) nounwind { @@ -1457,6 +7368,54 @@ entry: ; LINUX-64-STATIC: cat04: ; LINUX-64-STATIC: leaq ddst+64(,%rdi,4), %rax ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: cat04: +; LINUX-32-STATIC: movl 4(%esp), %eax +; LINUX-32-STATIC-NEXT: leal ddst+64(,%eax,4), %eax +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: cat04: +; LINUX-32-PIC: movl 4(%esp), %eax +; LINUX-32-PIC-NEXT: leal ddst+64(,%eax,4), %eax +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: cat04: +; LINUX-64-PIC: movq ddst@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: leaq 64(%rax,%rdi,4), %rax +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _cat04: +; DARWIN-32-STATIC: movl 4(%esp), %eax +; DARWIN-32-STATIC-NEXT: leal _ddst+64(,%eax,4), %eax +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _cat04: +; DARWIN-32-DYNAMIC: movl 4(%esp), %eax +; DARWIN-32-DYNAMIC-NEXT: leal _ddst+64(,%eax,4), %eax +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _cat04: +; DARWIN-32-PIC: call "L116$pb" +; DARWIN-32-PIC-NEXT: "L116$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl 4(%esp), %ecx +; DARWIN-32-PIC-NEXT: leal _ddst+64-"L116$pb"(%eax,%ecx,4), %eax +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _cat04: +; DARWIN-64-STATIC: leaq _ddst(%rip), %rax +; DARWIN-64-STATIC-NEXT: leaq 64(%rax,%rdi,4), %rax +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _cat04: +; DARWIN-64-DYNAMIC: leaq _ddst(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: leaq 64(%rax,%rdi,4), %rax +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _cat04: +; DARWIN-64-PIC: leaq _ddst(%rip), %rax +; DARWIN-64-PIC-NEXT: leaq 64(%rax,%rdi,4), %rax +; DARWIN-64-PIC-NEXT: ret } define i8* @cat05(i64 %i) nounwind { @@ -1470,6 +7429,60 @@ entry: ; LINUX-64-STATIC: movq dptr(%rip), %rax ; LINUX-64-STATIC: leaq 64(%rax,%rdi,4), %rax ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: cat05: +; LINUX-32-STATIC: movl 4(%esp), %eax +; LINUX-32-STATIC-NEXT: movl dptr, %ecx +; LINUX-32-STATIC-NEXT: leal 64(%ecx,%eax,4), %eax +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: cat05: +; LINUX-32-PIC: movl 4(%esp), %eax +; LINUX-32-PIC-NEXT: movl dptr, %ecx +; LINUX-32-PIC-NEXT: leal 64(%ecx,%eax,4), %eax +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: cat05: +; LINUX-64-PIC: movq dptr@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: movq (%rax), %rax +; LINUX-64-PIC-NEXT: leaq 64(%rax,%rdi,4), %rax +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _cat05: +; DARWIN-32-STATIC: movl 4(%esp), %eax +; DARWIN-32-STATIC-NEXT: movl _dptr, %ecx +; DARWIN-32-STATIC-NEXT: leal 64(%ecx,%eax,4), %eax +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _cat05: +; DARWIN-32-DYNAMIC: movl 4(%esp), %eax +; DARWIN-32-DYNAMIC-NEXT: movl _dptr, %ecx +; DARWIN-32-DYNAMIC-NEXT: leal 64(%ecx,%eax,4), %eax +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _cat05: +; DARWIN-32-PIC: call "L117$pb" +; DARWIN-32-PIC-NEXT: "L117$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl 4(%esp), %ecx +; DARWIN-32-PIC-NEXT: movl _dptr-"L117$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: leal 64(%eax,%ecx,4), %eax +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _cat05: +; DARWIN-64-STATIC: movq _dptr(%rip), %rax +; DARWIN-64-STATIC-NEXT: leaq 64(%rax,%rdi,4), %rax +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _cat05: +; DARWIN-64-DYNAMIC: movq _dptr(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: leaq 64(%rax,%rdi,4), %rax +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _cat05: +; DARWIN-64-PIC: movq _dptr(%rip), %rax +; DARWIN-64-PIC-NEXT: leaq 64(%rax,%rdi,4), %rax +; DARWIN-64-PIC-NEXT: ret } define i8* @cat06(i64 %i) nounwind { @@ -1481,6 +7494,54 @@ entry: ; LINUX-64-STATIC: cat06: ; LINUX-64-STATIC: leaq lsrc+64(,%rdi,4), %rax ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: cat06: +; LINUX-32-STATIC: movl 4(%esp), %eax +; LINUX-32-STATIC-NEXT: leal lsrc+64(,%eax,4), %eax +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: cat06: +; LINUX-32-PIC: movl 4(%esp), %eax +; LINUX-32-PIC-NEXT: leal lsrc+64(,%eax,4), %eax +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: cat06: +; LINUX-64-PIC: leaq lsrc(%rip), %rax +; LINUX-64-PIC-NEXT: leaq 64(%rax,%rdi,4), %rax +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _cat06: +; DARWIN-32-STATIC: movl 4(%esp), %eax +; DARWIN-32-STATIC-NEXT: leal _lsrc+64(,%eax,4), %eax +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _cat06: +; DARWIN-32-DYNAMIC: movl 4(%esp), %eax +; DARWIN-32-DYNAMIC-NEXT: leal _lsrc+64(,%eax,4), %eax +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _cat06: +; DARWIN-32-PIC: call "L118$pb" +; DARWIN-32-PIC-NEXT: "L118$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl 4(%esp), %ecx +; DARWIN-32-PIC-NEXT: leal _lsrc+64-"L118$pb"(%eax,%ecx,4), %eax +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _cat06: +; DARWIN-64-STATIC: leaq _lsrc(%rip), %rax +; DARWIN-64-STATIC-NEXT: leaq 64(%rax,%rdi,4), %rax +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _cat06: +; DARWIN-64-DYNAMIC: leaq _lsrc(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: leaq 64(%rax,%rdi,4), %rax +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _cat06: +; DARWIN-64-PIC: leaq _lsrc(%rip), %rax +; DARWIN-64-PIC-NEXT: leaq 64(%rax,%rdi,4), %rax +; DARWIN-64-PIC-NEXT: ret } define i8* @cat07(i64 %i) nounwind { @@ -1492,6 +7553,54 @@ entry: ; LINUX-64-STATIC: cat07: ; LINUX-64-STATIC: leaq ldst+64(,%rdi,4), %rax ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: cat07: +; LINUX-32-STATIC: movl 4(%esp), %eax +; LINUX-32-STATIC-NEXT: leal ldst+64(,%eax,4), %eax +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: cat07: +; LINUX-32-PIC: movl 4(%esp), %eax +; LINUX-32-PIC-NEXT: leal ldst+64(,%eax,4), %eax +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: cat07: +; LINUX-64-PIC: leaq ldst(%rip), %rax +; LINUX-64-PIC-NEXT: leaq 64(%rax,%rdi,4), %rax +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _cat07: +; DARWIN-32-STATIC: movl 4(%esp), %eax +; DARWIN-32-STATIC-NEXT: leal _ldst+64(,%eax,4), %eax +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _cat07: +; DARWIN-32-DYNAMIC: movl 4(%esp), %eax +; DARWIN-32-DYNAMIC-NEXT: leal _ldst+64(,%eax,4), %eax +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _cat07: +; DARWIN-32-PIC: call "L119$pb" +; DARWIN-32-PIC-NEXT: "L119$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl 4(%esp), %ecx +; DARWIN-32-PIC-NEXT: leal _ldst+64-"L119$pb"(%eax,%ecx,4), %eax +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _cat07: +; DARWIN-64-STATIC: leaq _ldst(%rip), %rax +; DARWIN-64-STATIC-NEXT: leaq 64(%rax,%rdi,4), %rax +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _cat07: +; DARWIN-64-DYNAMIC: leaq _ldst(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: leaq 64(%rax,%rdi,4), %rax +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _cat07: +; DARWIN-64-PIC: leaq _ldst(%rip), %rax +; DARWIN-64-PIC-NEXT: leaq 64(%rax,%rdi,4), %rax +; DARWIN-64-PIC-NEXT: ret } define i8* @cat08(i64 %i) nounwind { @@ -1505,6 +7614,59 @@ entry: ; LINUX-64-STATIC: movq lptr(%rip), %rax ; LINUX-64-STATIC: leaq 64(%rax,%rdi,4), %rax ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: cat08: +; LINUX-32-STATIC: movl 4(%esp), %eax +; LINUX-32-STATIC-NEXT: movl lptr, %ecx +; LINUX-32-STATIC-NEXT: leal 64(%ecx,%eax,4), %eax +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: cat08: +; LINUX-32-PIC: movl 4(%esp), %eax +; LINUX-32-PIC-NEXT: movl lptr, %ecx +; LINUX-32-PIC-NEXT: leal 64(%ecx,%eax,4), %eax +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: cat08: +; LINUX-64-PIC: movq lptr(%rip), %rax +; LINUX-64-PIC-NEXT: leaq 64(%rax,%rdi,4), %rax +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _cat08: +; DARWIN-32-STATIC: movl 4(%esp), %eax +; DARWIN-32-STATIC-NEXT: movl _lptr, %ecx +; DARWIN-32-STATIC-NEXT: leal 64(%ecx,%eax,4), %eax +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _cat08: +; DARWIN-32-DYNAMIC: movl 4(%esp), %eax +; DARWIN-32-DYNAMIC-NEXT: movl _lptr, %ecx +; DARWIN-32-DYNAMIC-NEXT: leal 64(%ecx,%eax,4), %eax +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _cat08: +; DARWIN-32-PIC: call "L120$pb" +; DARWIN-32-PIC-NEXT: "L120$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl 4(%esp), %ecx +; DARWIN-32-PIC-NEXT: movl _lptr-"L120$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: leal 64(%eax,%ecx,4), %eax +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _cat08: +; DARWIN-64-STATIC: movq _lptr(%rip), %rax +; DARWIN-64-STATIC-NEXT: leaq 64(%rax,%rdi,4), %rax +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _cat08: +; DARWIN-64-DYNAMIC: movq _lptr(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: leaq 64(%rax,%rdi,4), %rax +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _cat08: +; DARWIN-64-PIC: movq _lptr(%rip), %rax +; DARWIN-64-PIC-NEXT: leaq 64(%rax,%rdi,4), %rax +; DARWIN-64-PIC-NEXT: ret } define i8* @cam00(i64 %i) nounwind { @@ -1516,6 +7678,56 @@ entry: ; LINUX-64-STATIC: cam00: ; LINUX-64-STATIC: leaq src+262144(,%rdi,4), %rax ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: cam00: +; LINUX-32-STATIC: movl 4(%esp), %eax +; LINUX-32-STATIC-NEXT: leal src+262144(,%eax,4), %eax +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: cam00: +; LINUX-32-PIC: movl 4(%esp), %eax +; LINUX-32-PIC-NEXT: leal src+262144(,%eax,4), %eax +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: cam00: +; LINUX-64-PIC: movq src@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: leaq 262144(%rax,%rdi,4), %rax +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _cam00: +; DARWIN-32-STATIC: movl 4(%esp), %eax +; DARWIN-32-STATIC-NEXT: leal _src+262144(,%eax,4), %eax +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _cam00: +; DARWIN-32-DYNAMIC: movl 4(%esp), %eax +; DARWIN-32-DYNAMIC-NEXT: movl L_src$non_lazy_ptr, %ecx +; DARWIN-32-DYNAMIC-NEXT: leal 262144(%ecx,%eax,4), %eax +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _cam00: +; DARWIN-32-PIC: call "L121$pb" +; DARWIN-32-PIC-NEXT: "L121$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl 4(%esp), %ecx +; DARWIN-32-PIC-NEXT: movl L_src$non_lazy_ptr-"L121$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: leal 262144(%eax,%ecx,4), %eax +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _cam00: +; DARWIN-64-STATIC: movq _src@GOTPCREL(%rip), %rax +; DARWIN-64-STATIC-NEXT: leaq 262144(%rax,%rdi,4), %rax +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _cam00: +; DARWIN-64-DYNAMIC: movq _src@GOTPCREL(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: leaq 262144(%rax,%rdi,4), %rax +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _cam00: +; DARWIN-64-PIC: movq _src@GOTPCREL(%rip), %rax +; DARWIN-64-PIC-NEXT: leaq 262144(%rax,%rdi,4), %rax +; DARWIN-64-PIC-NEXT: ret } define i8* @cxm00(i64 %i) nounwind { @@ -1527,6 +7739,56 @@ entry: ; LINUX-64-STATIC: cxm00: ; LINUX-64-STATIC: leaq xsrc+262144(,%rdi,4), %rax ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: cxm00: +; LINUX-32-STATIC: movl 4(%esp), %eax +; LINUX-32-STATIC-NEXT: leal xsrc+262144(,%eax,4), %eax +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: cxm00: +; LINUX-32-PIC: movl 4(%esp), %eax +; LINUX-32-PIC-NEXT: leal xsrc+262144(,%eax,4), %eax +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: cxm00: +; LINUX-64-PIC: movq xsrc@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: leaq 262144(%rax,%rdi,4), %rax +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _cxm00: +; DARWIN-32-STATIC: movl 4(%esp), %eax +; DARWIN-32-STATIC-NEXT: leal _xsrc+262144(,%eax,4), %eax +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _cxm00: +; DARWIN-32-DYNAMIC: movl 4(%esp), %eax +; DARWIN-32-DYNAMIC-NEXT: movl L_xsrc$non_lazy_ptr, %ecx +; DARWIN-32-DYNAMIC-NEXT: leal 262144(%ecx,%eax,4), %eax +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _cxm00: +; DARWIN-32-PIC: call "L122$pb" +; DARWIN-32-PIC-NEXT: "L122$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl 4(%esp), %ecx +; DARWIN-32-PIC-NEXT: movl L_xsrc$non_lazy_ptr-"L122$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: leal 262144(%eax,%ecx,4), %eax +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _cxm00: +; DARWIN-64-STATIC: movq _xsrc@GOTPCREL(%rip), %rax +; DARWIN-64-STATIC-NEXT: leaq 262144(%rax,%rdi,4), %rax +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _cxm00: +; DARWIN-64-DYNAMIC: movq _xsrc@GOTPCREL(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: leaq 262144(%rax,%rdi,4), %rax +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _cxm00: +; DARWIN-64-PIC: movq _xsrc@GOTPCREL(%rip), %rax +; DARWIN-64-PIC-NEXT: leaq 262144(%rax,%rdi,4), %rax +; DARWIN-64-PIC-NEXT: ret } define i8* @cam01(i64 %i) nounwind { @@ -1538,6 +7800,56 @@ entry: ; LINUX-64-STATIC: cam01: ; LINUX-64-STATIC: leaq dst+262144(,%rdi,4), %rax ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: cam01: +; LINUX-32-STATIC: movl 4(%esp), %eax +; LINUX-32-STATIC-NEXT: leal dst+262144(,%eax,4), %eax +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: cam01: +; LINUX-32-PIC: movl 4(%esp), %eax +; LINUX-32-PIC-NEXT: leal dst+262144(,%eax,4), %eax +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: cam01: +; LINUX-64-PIC: movq dst@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: leaq 262144(%rax,%rdi,4), %rax +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _cam01: +; DARWIN-32-STATIC: movl 4(%esp), %eax +; DARWIN-32-STATIC-NEXT: leal _dst+262144(,%eax,4), %eax +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _cam01: +; DARWIN-32-DYNAMIC: movl 4(%esp), %eax +; DARWIN-32-DYNAMIC-NEXT: movl L_dst$non_lazy_ptr, %ecx +; DARWIN-32-DYNAMIC-NEXT: leal 262144(%ecx,%eax,4), %eax +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _cam01: +; DARWIN-32-PIC: call "L123$pb" +; DARWIN-32-PIC-NEXT: "L123$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl 4(%esp), %ecx +; DARWIN-32-PIC-NEXT: movl L_dst$non_lazy_ptr-"L123$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: leal 262144(%eax,%ecx,4), %eax +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _cam01: +; DARWIN-64-STATIC: movq _dst@GOTPCREL(%rip), %rax +; DARWIN-64-STATIC-NEXT: leaq 262144(%rax,%rdi,4), %rax +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _cam01: +; DARWIN-64-DYNAMIC: movq _dst@GOTPCREL(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: leaq 262144(%rax,%rdi,4), %rax +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _cam01: +; DARWIN-64-PIC: movq _dst@GOTPCREL(%rip), %rax +; DARWIN-64-PIC-NEXT: leaq 262144(%rax,%rdi,4), %rax +; DARWIN-64-PIC-NEXT: ret } define i8* @cxm01(i64 %i) nounwind { @@ -1549,6 +7861,56 @@ entry: ; LINUX-64-STATIC: cxm01: ; LINUX-64-STATIC: leaq xdst+262144(,%rdi,4), %rax ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: cxm01: +; LINUX-32-STATIC: movl 4(%esp), %eax +; LINUX-32-STATIC-NEXT: leal xdst+262144(,%eax,4), %eax +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: cxm01: +; LINUX-32-PIC: movl 4(%esp), %eax +; LINUX-32-PIC-NEXT: leal xdst+262144(,%eax,4), %eax +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: cxm01: +; LINUX-64-PIC: movq xdst@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: leaq 262144(%rax,%rdi,4), %rax +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _cxm01: +; DARWIN-32-STATIC: movl 4(%esp), %eax +; DARWIN-32-STATIC-NEXT: leal _xdst+262144(,%eax,4), %eax +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _cxm01: +; DARWIN-32-DYNAMIC: movl 4(%esp), %eax +; DARWIN-32-DYNAMIC-NEXT: movl L_xdst$non_lazy_ptr, %ecx +; DARWIN-32-DYNAMIC-NEXT: leal 262144(%ecx,%eax,4), %eax +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _cxm01: +; DARWIN-32-PIC: call "L124$pb" +; DARWIN-32-PIC-NEXT: "L124$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl 4(%esp), %ecx +; DARWIN-32-PIC-NEXT: movl L_xdst$non_lazy_ptr-"L124$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: leal 262144(%eax,%ecx,4), %eax +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _cxm01: +; DARWIN-64-STATIC: movq _xdst@GOTPCREL(%rip), %rax +; DARWIN-64-STATIC-NEXT: leaq 262144(%rax,%rdi,4), %rax +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _cxm01: +; DARWIN-64-DYNAMIC: movq _xdst@GOTPCREL(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: leaq 262144(%rax,%rdi,4), %rax +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _cxm01: +; DARWIN-64-PIC: movq _xdst@GOTPCREL(%rip), %rax +; DARWIN-64-PIC-NEXT: leaq 262144(%rax,%rdi,4), %rax +; DARWIN-64-PIC-NEXT: ret } define i8* @cam02(i64 %i) nounwind { @@ -1562,6 +7924,65 @@ entry: ; LINUX-64-STATIC: movq ptr(%rip), %rax ; LINUX-64-STATIC: leaq 262144(%rax,%rdi,4), %rax ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: cam02: +; LINUX-32-STATIC: movl 4(%esp), %eax +; LINUX-32-STATIC-NEXT: movl ptr, %ecx +; LINUX-32-STATIC-NEXT: leal 262144(%ecx,%eax,4), %eax +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: cam02: +; LINUX-32-PIC: movl 4(%esp), %eax +; LINUX-32-PIC-NEXT: movl ptr, %ecx +; LINUX-32-PIC-NEXT: leal 262144(%ecx,%eax,4), %eax +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: cam02: +; LINUX-64-PIC: movq ptr@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: movq (%rax), %rax +; LINUX-64-PIC-NEXT: leaq 262144(%rax,%rdi,4), %rax +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _cam02: +; DARWIN-32-STATIC: movl 4(%esp), %eax +; DARWIN-32-STATIC-NEXT: movl _ptr, %ecx +; DARWIN-32-STATIC-NEXT: leal 262144(%ecx,%eax,4), %eax +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _cam02: +; DARWIN-32-DYNAMIC: movl L_ptr$non_lazy_ptr, %eax +; DARWIN-32-DYNAMIC-NEXT: movl (%eax), %eax +; DARWIN-32-DYNAMIC-NEXT: movl 4(%esp), %ecx +; DARWIN-32-DYNAMIC-NEXT: leal 262144(%eax,%ecx,4), %eax +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _cam02: +; DARWIN-32-PIC: call "L125$pb" +; DARWIN-32-PIC-NEXT: "L125$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl L_ptr$non_lazy_ptr-"L125$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: movl (%eax), %eax +; DARWIN-32-PIC-NEXT: movl 4(%esp), %ecx +; DARWIN-32-PIC-NEXT: leal 262144(%eax,%ecx,4), %eax +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _cam02: +; DARWIN-64-STATIC: movq _ptr@GOTPCREL(%rip), %rax +; DARWIN-64-STATIC-NEXT: movq (%rax), %rax +; DARWIN-64-STATIC-NEXT: leaq 262144(%rax,%rdi,4), %rax +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _cam02: +; DARWIN-64-DYNAMIC: movq _ptr@GOTPCREL(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: movq (%rax), %rax +; DARWIN-64-DYNAMIC-NEXT: leaq 262144(%rax,%rdi,4), %rax +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _cam02: +; DARWIN-64-PIC: movq _ptr@GOTPCREL(%rip), %rax +; DARWIN-64-PIC-NEXT: movq (%rax), %rax +; DARWIN-64-PIC-NEXT: leaq 262144(%rax,%rdi,4), %rax +; DARWIN-64-PIC-NEXT: ret } define i8* @cam03(i64 %i) nounwind { @@ -1573,6 +7994,54 @@ entry: ; LINUX-64-STATIC: cam03: ; LINUX-64-STATIC: leaq dsrc+262144(,%rdi,4), %rax ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: cam03: +; LINUX-32-STATIC: movl 4(%esp), %eax +; LINUX-32-STATIC-NEXT: leal dsrc+262144(,%eax,4), %eax +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: cam03: +; LINUX-32-PIC: movl 4(%esp), %eax +; LINUX-32-PIC-NEXT: leal dsrc+262144(,%eax,4), %eax +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: cam03: +; LINUX-64-PIC: movq dsrc@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: leaq 262144(%rax,%rdi,4), %rax +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _cam03: +; DARWIN-32-STATIC: movl 4(%esp), %eax +; DARWIN-32-STATIC-NEXT: leal _dsrc+262144(,%eax,4), %eax +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _cam03: +; DARWIN-32-DYNAMIC: movl 4(%esp), %eax +; DARWIN-32-DYNAMIC-NEXT: leal _dsrc+262144(,%eax,4), %eax +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _cam03: +; DARWIN-32-PIC: call "L126$pb" +; DARWIN-32-PIC-NEXT: "L126$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl 4(%esp), %ecx +; DARWIN-32-PIC-NEXT: leal _dsrc+262144-"L126$pb"(%eax,%ecx,4), %eax +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _cam03: +; DARWIN-64-STATIC: leaq _dsrc(%rip), %rax +; DARWIN-64-STATIC-NEXT: leaq 262144(%rax,%rdi,4), %rax +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _cam03: +; DARWIN-64-DYNAMIC: leaq _dsrc(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: leaq 262144(%rax,%rdi,4), %rax +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _cam03: +; DARWIN-64-PIC: leaq _dsrc(%rip), %rax +; DARWIN-64-PIC-NEXT: leaq 262144(%rax,%rdi,4), %rax +; DARWIN-64-PIC-NEXT: ret } define i8* @cam04(i64 %i) nounwind { @@ -1584,6 +8053,54 @@ entry: ; LINUX-64-STATIC: cam04: ; LINUX-64-STATIC: leaq ddst+262144(,%rdi,4), %rax ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: cam04: +; LINUX-32-STATIC: movl 4(%esp), %eax +; LINUX-32-STATIC-NEXT: leal ddst+262144(,%eax,4), %eax +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: cam04: +; LINUX-32-PIC: movl 4(%esp), %eax +; LINUX-32-PIC-NEXT: leal ddst+262144(,%eax,4), %eax +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: cam04: +; LINUX-64-PIC: movq ddst@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: leaq 262144(%rax,%rdi,4), %rax +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _cam04: +; DARWIN-32-STATIC: movl 4(%esp), %eax +; DARWIN-32-STATIC-NEXT: leal _ddst+262144(,%eax,4), %eax +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _cam04: +; DARWIN-32-DYNAMIC: movl 4(%esp), %eax +; DARWIN-32-DYNAMIC-NEXT: leal _ddst+262144(,%eax,4), %eax +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _cam04: +; DARWIN-32-PIC: call "L127$pb" +; DARWIN-32-PIC-NEXT: "L127$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl 4(%esp), %ecx +; DARWIN-32-PIC-NEXT: leal _ddst+262144-"L127$pb"(%eax,%ecx,4), %eax +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _cam04: +; DARWIN-64-STATIC: leaq _ddst(%rip), %rax +; DARWIN-64-STATIC-NEXT: leaq 262144(%rax,%rdi,4), %rax +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _cam04: +; DARWIN-64-DYNAMIC: leaq _ddst(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: leaq 262144(%rax,%rdi,4), %rax +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _cam04: +; DARWIN-64-PIC: leaq _ddst(%rip), %rax +; DARWIN-64-PIC-NEXT: leaq 262144(%rax,%rdi,4), %rax +; DARWIN-64-PIC-NEXT: ret } define i8* @cam05(i64 %i) nounwind { @@ -1597,6 +8114,60 @@ entry: ; LINUX-64-STATIC: movq dptr(%rip), %rax ; LINUX-64-STATIC: leaq 262144(%rax,%rdi,4), %rax ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: cam05: +; LINUX-32-STATIC: movl 4(%esp), %eax +; LINUX-32-STATIC-NEXT: movl dptr, %ecx +; LINUX-32-STATIC-NEXT: leal 262144(%ecx,%eax,4), %eax +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: cam05: +; LINUX-32-PIC: movl 4(%esp), %eax +; LINUX-32-PIC-NEXT: movl dptr, %ecx +; LINUX-32-PIC-NEXT: leal 262144(%ecx,%eax,4), %eax +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: cam05: +; LINUX-64-PIC: movq dptr@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: movq (%rax), %rax +; LINUX-64-PIC-NEXT: leaq 262144(%rax,%rdi,4), %rax +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _cam05: +; DARWIN-32-STATIC: movl 4(%esp), %eax +; DARWIN-32-STATIC-NEXT: movl _dptr, %ecx +; DARWIN-32-STATIC-NEXT: leal 262144(%ecx,%eax,4), %eax +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _cam05: +; DARWIN-32-DYNAMIC: movl 4(%esp), %eax +; DARWIN-32-DYNAMIC-NEXT: movl _dptr, %ecx +; DARWIN-32-DYNAMIC-NEXT: leal 262144(%ecx,%eax,4), %eax +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _cam05: +; DARWIN-32-PIC: call "L128$pb" +; DARWIN-32-PIC-NEXT: "L128$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl 4(%esp), %ecx +; DARWIN-32-PIC-NEXT: movl _dptr-"L128$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: leal 262144(%eax,%ecx,4), %eax +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _cam05: +; DARWIN-64-STATIC: movq _dptr(%rip), %rax +; DARWIN-64-STATIC-NEXT: leaq 262144(%rax,%rdi,4), %rax +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _cam05: +; DARWIN-64-DYNAMIC: movq _dptr(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: leaq 262144(%rax,%rdi,4), %rax +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _cam05: +; DARWIN-64-PIC: movq _dptr(%rip), %rax +; DARWIN-64-PIC-NEXT: leaq 262144(%rax,%rdi,4), %rax +; DARWIN-64-PIC-NEXT: ret } define i8* @cam06(i64 %i) nounwind { @@ -1608,6 +8179,54 @@ entry: ; LINUX-64-STATIC: cam06: ; LINUX-64-STATIC: leaq lsrc+262144(,%rdi,4), %rax ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: cam06: +; LINUX-32-STATIC: movl 4(%esp), %eax +; LINUX-32-STATIC-NEXT: leal lsrc+262144(,%eax,4), %eax +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: cam06: +; LINUX-32-PIC: movl 4(%esp), %eax +; LINUX-32-PIC-NEXT: leal lsrc+262144(,%eax,4), %eax +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: cam06: +; LINUX-64-PIC: leaq lsrc(%rip), %rax +; LINUX-64-PIC-NEXT: leaq 262144(%rax,%rdi,4), %rax +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _cam06: +; DARWIN-32-STATIC: movl 4(%esp), %eax +; DARWIN-32-STATIC-NEXT: leal _lsrc+262144(,%eax,4), %eax +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _cam06: +; DARWIN-32-DYNAMIC: movl 4(%esp), %eax +; DARWIN-32-DYNAMIC-NEXT: leal _lsrc+262144(,%eax,4), %eax +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _cam06: +; DARWIN-32-PIC: call "L129$pb" +; DARWIN-32-PIC-NEXT: "L129$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl 4(%esp), %ecx +; DARWIN-32-PIC-NEXT: leal _lsrc+262144-"L129$pb"(%eax,%ecx,4), %eax +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _cam06: +; DARWIN-64-STATIC: leaq _lsrc(%rip), %rax +; DARWIN-64-STATIC-NEXT: leaq 262144(%rax,%rdi,4), %rax +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _cam06: +; DARWIN-64-DYNAMIC: leaq _lsrc(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: leaq 262144(%rax,%rdi,4), %rax +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _cam06: +; DARWIN-64-PIC: leaq _lsrc(%rip), %rax +; DARWIN-64-PIC-NEXT: leaq 262144(%rax,%rdi,4), %rax +; DARWIN-64-PIC-NEXT: ret } define i8* @cam07(i64 %i) nounwind { @@ -1619,6 +8238,54 @@ entry: ; LINUX-64-STATIC: cam07: ; LINUX-64-STATIC: leaq ldst+262144(,%rdi,4), %rax ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: cam07: +; LINUX-32-STATIC: movl 4(%esp), %eax +; LINUX-32-STATIC-NEXT: leal ldst+262144(,%eax,4), %eax +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: cam07: +; LINUX-32-PIC: movl 4(%esp), %eax +; LINUX-32-PIC-NEXT: leal ldst+262144(,%eax,4), %eax +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: cam07: +; LINUX-64-PIC: leaq ldst(%rip), %rax +; LINUX-64-PIC-NEXT: leaq 262144(%rax,%rdi,4), %rax +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _cam07: +; DARWIN-32-STATIC: movl 4(%esp), %eax +; DARWIN-32-STATIC-NEXT: leal _ldst+262144(,%eax,4), %eax +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _cam07: +; DARWIN-32-DYNAMIC: movl 4(%esp), %eax +; DARWIN-32-DYNAMIC-NEXT: leal _ldst+262144(,%eax,4), %eax +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _cam07: +; DARWIN-32-PIC: call "L130$pb" +; DARWIN-32-PIC-NEXT: "L130$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl 4(%esp), %ecx +; DARWIN-32-PIC-NEXT: leal _ldst+262144-"L130$pb"(%eax,%ecx,4), %eax +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _cam07: +; DARWIN-64-STATIC: leaq _ldst(%rip), %rax +; DARWIN-64-STATIC-NEXT: leaq 262144(%rax,%rdi,4), %rax +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _cam07: +; DARWIN-64-DYNAMIC: leaq _ldst(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: leaq 262144(%rax,%rdi,4), %rax +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _cam07: +; DARWIN-64-PIC: leaq _ldst(%rip), %rax +; DARWIN-64-PIC-NEXT: leaq 262144(%rax,%rdi,4), %rax +; DARWIN-64-PIC-NEXT: ret } define i8* @cam08(i64 %i) nounwind { @@ -1632,6 +8299,59 @@ entry: ; LINUX-64-STATIC: movq lptr(%rip), %rax ; LINUX-64-STATIC: leaq 262144(%rax,%rdi,4), %rax ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: cam08: +; LINUX-32-STATIC: movl 4(%esp), %eax +; LINUX-32-STATIC-NEXT: movl lptr, %ecx +; LINUX-32-STATIC-NEXT: leal 262144(%ecx,%eax,4), %eax +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: cam08: +; LINUX-32-PIC: movl 4(%esp), %eax +; LINUX-32-PIC-NEXT: movl lptr, %ecx +; LINUX-32-PIC-NEXT: leal 262144(%ecx,%eax,4), %eax +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: cam08: +; LINUX-64-PIC: movq lptr(%rip), %rax +; LINUX-64-PIC-NEXT: leaq 262144(%rax,%rdi,4), %rax +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _cam08: +; DARWIN-32-STATIC: movl 4(%esp), %eax +; DARWIN-32-STATIC-NEXT: movl _lptr, %ecx +; DARWIN-32-STATIC-NEXT: leal 262144(%ecx,%eax,4), %eax +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _cam08: +; DARWIN-32-DYNAMIC: movl 4(%esp), %eax +; DARWIN-32-DYNAMIC-NEXT: movl _lptr, %ecx +; DARWIN-32-DYNAMIC-NEXT: leal 262144(%ecx,%eax,4), %eax +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _cam08: +; DARWIN-32-PIC: call "L131$pb" +; DARWIN-32-PIC-NEXT: "L131$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl 4(%esp), %ecx +; DARWIN-32-PIC-NEXT: movl _lptr-"L131$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: leal 262144(%eax,%ecx,4), %eax +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _cam08: +; DARWIN-64-STATIC: movq _lptr(%rip), %rax +; DARWIN-64-STATIC-NEXT: leaq 262144(%rax,%rdi,4), %rax +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _cam08: +; DARWIN-64-DYNAMIC: movq _lptr(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: leaq 262144(%rax,%rdi,4), %rax +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _cam08: +; DARWIN-64-PIC: movq _lptr(%rip), %rax +; DARWIN-64-PIC-NEXT: leaq 262144(%rax,%rdi,4), %rax +; DARWIN-64-PIC-NEXT: ret } define void @lcallee() nounwind { @@ -1653,6 +8373,114 @@ entry: ; LINUX-64-STATIC: call x ; LINUX-64-STATIC: call x ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: lcallee: +; LINUX-32-STATIC: subl $4, %esp +; LINUX-32-STATIC-NEXT: call x +; LINUX-32-STATIC-NEXT: call x +; LINUX-32-STATIC-NEXT: call x +; LINUX-32-STATIC-NEXT: call x +; LINUX-32-STATIC-NEXT: call x +; LINUX-32-STATIC-NEXT: call x +; LINUX-32-STATIC-NEXT: call x +; LINUX-32-STATIC-NEXT: addl $4, %esp +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: lcallee: +; LINUX-32-PIC: subl $4, %esp +; LINUX-32-PIC-NEXT: call x +; LINUX-32-PIC-NEXT: call x +; LINUX-32-PIC-NEXT: call x +; LINUX-32-PIC-NEXT: call x +; LINUX-32-PIC-NEXT: call x +; LINUX-32-PIC-NEXT: call x +; LINUX-32-PIC-NEXT: call x +; LINUX-32-PIC-NEXT: addl $4, %esp +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: lcallee: +; LINUX-64-PIC: subq $8, %rsp +; LINUX-64-PIC-NEXT: call x@PLT +; LINUX-64-PIC-NEXT: call x@PLT +; LINUX-64-PIC-NEXT: call x@PLT +; LINUX-64-PIC-NEXT: call x@PLT +; LINUX-64-PIC-NEXT: call x@PLT +; LINUX-64-PIC-NEXT: call x@PLT +; LINUX-64-PIC-NEXT: call x@PLT +; LINUX-64-PIC-NEXT: addq $8, %rsp +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _lcallee: +; DARWIN-32-STATIC: subl $12, %esp +; DARWIN-32-STATIC-NEXT: call _x +; DARWIN-32-STATIC-NEXT: call _x +; DARWIN-32-STATIC-NEXT: call _x +; DARWIN-32-STATIC-NEXT: call _x +; DARWIN-32-STATIC-NEXT: call _x +; DARWIN-32-STATIC-NEXT: call _x +; DARWIN-32-STATIC-NEXT: call _x +; DARWIN-32-STATIC-NEXT: addl $12, %esp +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _lcallee: +; DARWIN-32-DYNAMIC: subl $12, %esp +; DARWIN-32-DYNAMIC-NEXT: call L_x$stub +; DARWIN-32-DYNAMIC-NEXT: call L_x$stub +; DARWIN-32-DYNAMIC-NEXT: call L_x$stub +; DARWIN-32-DYNAMIC-NEXT: call L_x$stub +; DARWIN-32-DYNAMIC-NEXT: call L_x$stub +; DARWIN-32-DYNAMIC-NEXT: call L_x$stub +; DARWIN-32-DYNAMIC-NEXT: call L_x$stub +; DARWIN-32-DYNAMIC-NEXT: addl $12, %esp +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _lcallee: +; DARWIN-32-PIC: subl $12, %esp +; DARWIN-32-PIC-NEXT: call L_x$stub +; DARWIN-32-PIC-NEXT: call L_x$stub +; DARWIN-32-PIC-NEXT: call L_x$stub +; DARWIN-32-PIC-NEXT: call L_x$stub +; DARWIN-32-PIC-NEXT: call L_x$stub +; DARWIN-32-PIC-NEXT: call L_x$stub +; DARWIN-32-PIC-NEXT: call L_x$stub +; DARWIN-32-PIC-NEXT: addl $12, %esp +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _lcallee: +; DARWIN-64-STATIC: subq $8, %rsp +; DARWIN-64-STATIC-NEXT: call _x +; DARWIN-64-STATIC-NEXT: call _x +; DARWIN-64-STATIC-NEXT: call _x +; DARWIN-64-STATIC-NEXT: call _x +; DARWIN-64-STATIC-NEXT: call _x +; DARWIN-64-STATIC-NEXT: call _x +; DARWIN-64-STATIC-NEXT: call _x +; DARWIN-64-STATIC-NEXT: addq $8, %rsp +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _lcallee: +; DARWIN-64-DYNAMIC: subq $8, %rsp +; DARWIN-64-DYNAMIC-NEXT: call _x +; DARWIN-64-DYNAMIC-NEXT: call _x +; DARWIN-64-DYNAMIC-NEXT: call _x +; DARWIN-64-DYNAMIC-NEXT: call _x +; DARWIN-64-DYNAMIC-NEXT: call _x +; DARWIN-64-DYNAMIC-NEXT: call _x +; DARWIN-64-DYNAMIC-NEXT: call _x +; DARWIN-64-DYNAMIC-NEXT: addq $8, %rsp +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _lcallee: +; DARWIN-64-PIC: subq $8, %rsp +; DARWIN-64-PIC-NEXT: call _x +; DARWIN-64-PIC-NEXT: call _x +; DARWIN-64-PIC-NEXT: call _x +; DARWIN-64-PIC-NEXT: call _x +; DARWIN-64-PIC-NEXT: call _x +; DARWIN-64-PIC-NEXT: call _x +; DARWIN-64-PIC-NEXT: call _x +; DARWIN-64-PIC-NEXT: addq $8, %rsp +; DARWIN-64-PIC-NEXT: ret } declare void @x() @@ -1676,6 +8504,114 @@ entry: ; LINUX-64-STATIC: call y ; LINUX-64-STATIC: call y ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: dcallee: +; LINUX-32-STATIC: subl $4, %esp +; LINUX-32-STATIC-NEXT: call y +; LINUX-32-STATIC-NEXT: call y +; LINUX-32-STATIC-NEXT: call y +; LINUX-32-STATIC-NEXT: call y +; LINUX-32-STATIC-NEXT: call y +; LINUX-32-STATIC-NEXT: call y +; LINUX-32-STATIC-NEXT: call y +; LINUX-32-STATIC-NEXT: addl $4, %esp +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: dcallee: +; LINUX-32-PIC: subl $4, %esp +; LINUX-32-PIC-NEXT: call y +; LINUX-32-PIC-NEXT: call y +; LINUX-32-PIC-NEXT: call y +; LINUX-32-PIC-NEXT: call y +; LINUX-32-PIC-NEXT: call y +; LINUX-32-PIC-NEXT: call y +; LINUX-32-PIC-NEXT: call y +; LINUX-32-PIC-NEXT: addl $4, %esp +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: dcallee: +; LINUX-64-PIC: subq $8, %rsp +; LINUX-64-PIC-NEXT: call y@PLT +; LINUX-64-PIC-NEXT: call y@PLT +; LINUX-64-PIC-NEXT: call y@PLT +; LINUX-64-PIC-NEXT: call y@PLT +; LINUX-64-PIC-NEXT: call y@PLT +; LINUX-64-PIC-NEXT: call y@PLT +; LINUX-64-PIC-NEXT: call y@PLT +; LINUX-64-PIC-NEXT: addq $8, %rsp +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _dcallee: +; DARWIN-32-STATIC: subl $12, %esp +; DARWIN-32-STATIC-NEXT: call _y +; DARWIN-32-STATIC-NEXT: call _y +; DARWIN-32-STATIC-NEXT: call _y +; DARWIN-32-STATIC-NEXT: call _y +; DARWIN-32-STATIC-NEXT: call _y +; DARWIN-32-STATIC-NEXT: call _y +; DARWIN-32-STATIC-NEXT: call _y +; DARWIN-32-STATIC-NEXT: addl $12, %esp +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _dcallee: +; DARWIN-32-DYNAMIC: subl $12, %esp +; DARWIN-32-DYNAMIC-NEXT: call L_y$stub +; DARWIN-32-DYNAMIC-NEXT: call L_y$stub +; DARWIN-32-DYNAMIC-NEXT: call L_y$stub +; DARWIN-32-DYNAMIC-NEXT: call L_y$stub +; DARWIN-32-DYNAMIC-NEXT: call L_y$stub +; DARWIN-32-DYNAMIC-NEXT: call L_y$stub +; DARWIN-32-DYNAMIC-NEXT: call L_y$stub +; DARWIN-32-DYNAMIC-NEXT: addl $12, %esp +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _dcallee: +; DARWIN-32-PIC: subl $12, %esp +; DARWIN-32-PIC-NEXT: call L_y$stub +; DARWIN-32-PIC-NEXT: call L_y$stub +; DARWIN-32-PIC-NEXT: call L_y$stub +; DARWIN-32-PIC-NEXT: call L_y$stub +; DARWIN-32-PIC-NEXT: call L_y$stub +; DARWIN-32-PIC-NEXT: call L_y$stub +; DARWIN-32-PIC-NEXT: call L_y$stub +; DARWIN-32-PIC-NEXT: addl $12, %esp +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _dcallee: +; DARWIN-64-STATIC: subq $8, %rsp +; DARWIN-64-STATIC-NEXT: call _y +; DARWIN-64-STATIC-NEXT: call _y +; DARWIN-64-STATIC-NEXT: call _y +; DARWIN-64-STATIC-NEXT: call _y +; DARWIN-64-STATIC-NEXT: call _y +; DARWIN-64-STATIC-NEXT: call _y +; DARWIN-64-STATIC-NEXT: call _y +; DARWIN-64-STATIC-NEXT: addq $8, %rsp +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _dcallee: +; DARWIN-64-DYNAMIC: subq $8, %rsp +; DARWIN-64-DYNAMIC-NEXT: call _y +; DARWIN-64-DYNAMIC-NEXT: call _y +; DARWIN-64-DYNAMIC-NEXT: call _y +; DARWIN-64-DYNAMIC-NEXT: call _y +; DARWIN-64-DYNAMIC-NEXT: call _y +; DARWIN-64-DYNAMIC-NEXT: call _y +; DARWIN-64-DYNAMIC-NEXT: call _y +; DARWIN-64-DYNAMIC-NEXT: addq $8, %rsp +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _dcallee: +; DARWIN-64-PIC: subq $8, %rsp +; DARWIN-64-PIC-NEXT: call _y +; DARWIN-64-PIC-NEXT: call _y +; DARWIN-64-PIC-NEXT: call _y +; DARWIN-64-PIC-NEXT: call _y +; DARWIN-64-PIC-NEXT: call _y +; DARWIN-64-PIC-NEXT: call _y +; DARWIN-64-PIC-NEXT: call _y +; DARWIN-64-PIC-NEXT: addq $8, %rsp +; DARWIN-64-PIC-NEXT: ret } declare void @y() @@ -1686,6 +8622,45 @@ entry: ; LINUX-64-STATIC: address: ; LINUX-64-STATIC: movl $callee, %eax ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: address: +; LINUX-32-STATIC: movl $callee, %eax +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: address: +; LINUX-32-PIC: movl $callee, %eax +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: address: +; LINUX-64-PIC: movq callee@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _address: +; DARWIN-32-STATIC: movl $_callee, %eax +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _address: +; DARWIN-32-DYNAMIC: movl L_callee$non_lazy_ptr, %eax +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _address: +; DARWIN-32-PIC: call "L134$pb" +; DARWIN-32-PIC-NEXT: "L134$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl L_callee$non_lazy_ptr-"L134$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _address: +; DARWIN-64-STATIC: movq _callee@GOTPCREL(%rip), %rax +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _address: +; DARWIN-64-DYNAMIC: movq _callee@GOTPCREL(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _address: +; DARWIN-64-PIC: movq _callee@GOTPCREL(%rip), %rax +; DARWIN-64-PIC-NEXT: ret } declare void @callee() @@ -1696,6 +8671,45 @@ entry: ; LINUX-64-STATIC: laddress: ; LINUX-64-STATIC: movl $lcallee, %eax ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: laddress: +; LINUX-32-STATIC: movl $lcallee, %eax +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: laddress: +; LINUX-32-PIC: movl $lcallee, %eax +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: laddress: +; LINUX-64-PIC: movq lcallee@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _laddress: +; DARWIN-32-STATIC: movl $_lcallee, %eax +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _laddress: +; DARWIN-32-DYNAMIC: movl $_lcallee, %eax +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _laddress: +; DARWIN-32-PIC: call "L135$pb" +; DARWIN-32-PIC-NEXT: "L135$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: leal _lcallee-"L135$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _laddress: +; DARWIN-64-STATIC: leaq _lcallee(%rip), %rax +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _laddress: +; DARWIN-64-DYNAMIC: leaq _lcallee(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _laddress: +; DARWIN-64-PIC: leaq _lcallee(%rip), %rax +; DARWIN-64-PIC-NEXT: ret } define void ()* @daddress() nounwind { @@ -1704,6 +8718,45 @@ entry: ; LINUX-64-STATIC: daddress: ; LINUX-64-STATIC: movl $dcallee, %eax ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: daddress: +; LINUX-32-STATIC: movl $dcallee, %eax +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: daddress: +; LINUX-32-PIC: movl $dcallee, %eax +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: daddress: +; LINUX-64-PIC: leaq dcallee(%rip), %rax +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _daddress: +; DARWIN-32-STATIC: movl $_dcallee, %eax +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _daddress: +; DARWIN-32-DYNAMIC: movl $_dcallee, %eax +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _daddress: +; DARWIN-32-PIC: call "L136$pb" +; DARWIN-32-PIC-NEXT: "L136$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: leal _dcallee-"L136$pb"(%eax), %eax +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _daddress: +; DARWIN-64-STATIC: leaq _dcallee(%rip), %rax +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _daddress: +; DARWIN-64-DYNAMIC: leaq _dcallee(%rip), %rax +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _daddress: +; DARWIN-64-PIC: leaq _dcallee(%rip), %rax +; DARWIN-64-PIC-NEXT: ret } define void @caller() nounwind { @@ -1715,6 +8768,69 @@ entry: ; LINUX-64-STATIC: call callee ; LINUX-64-STATIC: call callee ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: caller: +; LINUX-32-STATIC: subl $4, %esp +; LINUX-32-STATIC-NEXT: call callee +; LINUX-32-STATIC-NEXT: call callee +; LINUX-32-STATIC-NEXT: addl $4, %esp +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: caller: +; LINUX-32-PIC: subl $4, %esp +; LINUX-32-PIC-NEXT: call callee +; LINUX-32-PIC-NEXT: call callee +; LINUX-32-PIC-NEXT: addl $4, %esp +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: caller: +; LINUX-64-PIC: subq $8, %rsp +; LINUX-64-PIC-NEXT: call callee@PLT +; LINUX-64-PIC-NEXT: call callee@PLT +; LINUX-64-PIC-NEXT: addq $8, %rsp +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _caller: +; DARWIN-32-STATIC: subl $12, %esp +; DARWIN-32-STATIC-NEXT: call _callee +; DARWIN-32-STATIC-NEXT: call _callee +; DARWIN-32-STATIC-NEXT: addl $12, %esp +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _caller: +; DARWIN-32-DYNAMIC: subl $12, %esp +; DARWIN-32-DYNAMIC-NEXT: call L_callee$stub +; DARWIN-32-DYNAMIC-NEXT: call L_callee$stub +; DARWIN-32-DYNAMIC-NEXT: addl $12, %esp +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _caller: +; DARWIN-32-PIC: subl $12, %esp +; DARWIN-32-PIC-NEXT: call L_callee$stub +; DARWIN-32-PIC-NEXT: call L_callee$stub +; DARWIN-32-PIC-NEXT: addl $12, %esp +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _caller: +; DARWIN-64-STATIC: subq $8, %rsp +; DARWIN-64-STATIC-NEXT: call _callee +; DARWIN-64-STATIC-NEXT: call _callee +; DARWIN-64-STATIC-NEXT: addq $8, %rsp +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _caller: +; DARWIN-64-DYNAMIC: subq $8, %rsp +; DARWIN-64-DYNAMIC-NEXT: call _callee +; DARWIN-64-DYNAMIC-NEXT: call _callee +; DARWIN-64-DYNAMIC-NEXT: addq $8, %rsp +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _caller: +; DARWIN-64-PIC: subq $8, %rsp +; DARWIN-64-PIC-NEXT: call _callee +; DARWIN-64-PIC-NEXT: call _callee +; DARWIN-64-PIC-NEXT: addq $8, %rsp +; DARWIN-64-PIC-NEXT: ret } define void @dcaller() nounwind { @@ -1726,6 +8842,69 @@ entry: ; LINUX-64-STATIC: call dcallee ; LINUX-64-STATIC: call dcallee ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: dcaller: +; LINUX-32-STATIC: subl $4, %esp +; LINUX-32-STATIC-NEXT: call dcallee +; LINUX-32-STATIC-NEXT: call dcallee +; LINUX-32-STATIC-NEXT: addl $4, %esp +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: dcaller: +; LINUX-32-PIC: subl $4, %esp +; LINUX-32-PIC-NEXT: call dcallee +; LINUX-32-PIC-NEXT: call dcallee +; LINUX-32-PIC-NEXT: addl $4, %esp +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: dcaller: +; LINUX-64-PIC: subq $8, %rsp +; LINUX-64-PIC-NEXT: call dcallee +; LINUX-64-PIC-NEXT: call dcallee +; LINUX-64-PIC-NEXT: addq $8, %rsp +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _dcaller: +; DARWIN-32-STATIC: subl $12, %esp +; DARWIN-32-STATIC-NEXT: call _dcallee +; DARWIN-32-STATIC-NEXT: call _dcallee +; DARWIN-32-STATIC-NEXT: addl $12, %esp +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _dcaller: +; DARWIN-32-DYNAMIC: subl $12, %esp +; DARWIN-32-DYNAMIC-NEXT: call _dcallee +; DARWIN-32-DYNAMIC-NEXT: call _dcallee +; DARWIN-32-DYNAMIC-NEXT: addl $12, %esp +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _dcaller: +; DARWIN-32-PIC: subl $12, %esp +; DARWIN-32-PIC-NEXT: call _dcallee +; DARWIN-32-PIC-NEXT: call _dcallee +; DARWIN-32-PIC-NEXT: addl $12, %esp +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _dcaller: +; DARWIN-64-STATIC: subq $8, %rsp +; DARWIN-64-STATIC-NEXT: call _dcallee +; DARWIN-64-STATIC-NEXT: call _dcallee +; DARWIN-64-STATIC-NEXT: addq $8, %rsp +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _dcaller: +; DARWIN-64-DYNAMIC: subq $8, %rsp +; DARWIN-64-DYNAMIC-NEXT: call _dcallee +; DARWIN-64-DYNAMIC-NEXT: call _dcallee +; DARWIN-64-DYNAMIC-NEXT: addq $8, %rsp +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _dcaller: +; DARWIN-64-PIC: subq $8, %rsp +; DARWIN-64-PIC-NEXT: call _dcallee +; DARWIN-64-PIC-NEXT: call _dcallee +; DARWIN-64-PIC-NEXT: addq $8, %rsp +; DARWIN-64-PIC-NEXT: ret } define void @lcaller() nounwind { @@ -1737,6 +8916,69 @@ entry: ; LINUX-64-STATIC: call lcallee ; LINUX-64-STATIC: call lcallee ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: lcaller: +; LINUX-32-STATIC: subl $4, %esp +; LINUX-32-STATIC-NEXT: call lcallee +; LINUX-32-STATIC-NEXT: call lcallee +; LINUX-32-STATIC-NEXT: addl $4, %esp +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: lcaller: +; LINUX-32-PIC: subl $4, %esp +; LINUX-32-PIC-NEXT: call lcallee +; LINUX-32-PIC-NEXT: call lcallee +; LINUX-32-PIC-NEXT: addl $4, %esp +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: lcaller: +; LINUX-64-PIC: subq $8, %rsp +; LINUX-64-PIC-NEXT: call lcallee@PLT +; LINUX-64-PIC-NEXT: call lcallee@PLT +; LINUX-64-PIC-NEXT: addq $8, %rsp +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _lcaller: +; DARWIN-32-STATIC: subl $12, %esp +; DARWIN-32-STATIC-NEXT: call _lcallee +; DARWIN-32-STATIC-NEXT: call _lcallee +; DARWIN-32-STATIC-NEXT: addl $12, %esp +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _lcaller: +; DARWIN-32-DYNAMIC: subl $12, %esp +; DARWIN-32-DYNAMIC-NEXT: call _lcallee +; DARWIN-32-DYNAMIC-NEXT: call _lcallee +; DARWIN-32-DYNAMIC-NEXT: addl $12, %esp +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _lcaller: +; DARWIN-32-PIC: subl $12, %esp +; DARWIN-32-PIC-NEXT: call _lcallee +; DARWIN-32-PIC-NEXT: call _lcallee +; DARWIN-32-PIC-NEXT: addl $12, %esp +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _lcaller: +; DARWIN-64-STATIC: subq $8, %rsp +; DARWIN-64-STATIC-NEXT: call _lcallee +; DARWIN-64-STATIC-NEXT: call _lcallee +; DARWIN-64-STATIC-NEXT: addq $8, %rsp +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _lcaller: +; DARWIN-64-DYNAMIC: subq $8, %rsp +; DARWIN-64-DYNAMIC-NEXT: call _lcallee +; DARWIN-64-DYNAMIC-NEXT: call _lcallee +; DARWIN-64-DYNAMIC-NEXT: addq $8, %rsp +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _lcaller: +; DARWIN-64-PIC: subq $8, %rsp +; DARWIN-64-PIC-NEXT: call _lcallee +; DARWIN-64-PIC-NEXT: call _lcallee +; DARWIN-64-PIC-NEXT: addq $8, %rsp +; DARWIN-64-PIC-NEXT: ret } define void @tailcaller() nounwind { @@ -1746,6 +8988,60 @@ entry: ; LINUX-64-STATIC: tailcaller: ; LINUX-64-STATIC: call callee ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: tailcaller: +; LINUX-32-STATIC: subl $4, %esp +; LINUX-32-STATIC-NEXT: call callee +; LINUX-32-STATIC-NEXT: addl $4, %esp +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: tailcaller: +; LINUX-32-PIC: subl $4, %esp +; LINUX-32-PIC-NEXT: call callee +; LINUX-32-PIC-NEXT: addl $4, %esp +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: tailcaller: +; LINUX-64-PIC: subq $8, %rsp +; LINUX-64-PIC-NEXT: call callee@PLT +; LINUX-64-PIC-NEXT: addq $8, %rsp +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _tailcaller: +; DARWIN-32-STATIC: subl $12, %esp +; DARWIN-32-STATIC-NEXT: call _callee +; DARWIN-32-STATIC-NEXT: addl $12, %esp +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _tailcaller: +; DARWIN-32-DYNAMIC: subl $12, %esp +; DARWIN-32-DYNAMIC-NEXT: call L_callee$stub +; DARWIN-32-DYNAMIC-NEXT: addl $12, %esp +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _tailcaller: +; DARWIN-32-PIC: subl $12, %esp +; DARWIN-32-PIC-NEXT: call L_callee$stub +; DARWIN-32-PIC-NEXT: addl $12, %esp +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _tailcaller: +; DARWIN-64-STATIC: subq $8, %rsp +; DARWIN-64-STATIC-NEXT: call _callee +; DARWIN-64-STATIC-NEXT: addq $8, %rsp +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _tailcaller: +; DARWIN-64-DYNAMIC: subq $8, %rsp +; DARWIN-64-DYNAMIC-NEXT: call _callee +; DARWIN-64-DYNAMIC-NEXT: addq $8, %rsp +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _tailcaller: +; DARWIN-64-PIC: subq $8, %rsp +; DARWIN-64-PIC-NEXT: call _callee +; DARWIN-64-PIC-NEXT: addq $8, %rsp +; DARWIN-64-PIC-NEXT: ret } define void @dtailcaller() nounwind { @@ -1755,6 +9051,60 @@ entry: ; LINUX-64-STATIC: dtailcaller: ; LINUX-64-STATIC: call dcallee ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: dtailcaller: +; LINUX-32-STATIC: subl $4, %esp +; LINUX-32-STATIC-NEXT: call dcallee +; LINUX-32-STATIC-NEXT: addl $4, %esp +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: dtailcaller: +; LINUX-32-PIC: subl $4, %esp +; LINUX-32-PIC-NEXT: call dcallee +; LINUX-32-PIC-NEXT: addl $4, %esp +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: dtailcaller: +; LINUX-64-PIC: subq $8, %rsp +; LINUX-64-PIC-NEXT: call dcallee +; LINUX-64-PIC-NEXT: addq $8, %rsp +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _dtailcaller: +; DARWIN-32-STATIC: subl $12, %esp +; DARWIN-32-STATIC-NEXT: call _dcallee +; DARWIN-32-STATIC-NEXT: addl $12, %esp +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _dtailcaller: +; DARWIN-32-DYNAMIC: subl $12, %esp +; DARWIN-32-DYNAMIC-NEXT: call _dcallee +; DARWIN-32-DYNAMIC-NEXT: addl $12, %esp +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _dtailcaller: +; DARWIN-32-PIC: subl $12, %esp +; DARWIN-32-PIC-NEXT: call _dcallee +; DARWIN-32-PIC-NEXT: addl $12, %esp +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _dtailcaller: +; DARWIN-64-STATIC: subq $8, %rsp +; DARWIN-64-STATIC-NEXT: call _dcallee +; DARWIN-64-STATIC-NEXT: addq $8, %rsp +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _dtailcaller: +; DARWIN-64-DYNAMIC: subq $8, %rsp +; DARWIN-64-DYNAMIC-NEXT: call _dcallee +; DARWIN-64-DYNAMIC-NEXT: addq $8, %rsp +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _dtailcaller: +; DARWIN-64-PIC: subq $8, %rsp +; DARWIN-64-PIC-NEXT: call _dcallee +; DARWIN-64-PIC-NEXT: addq $8, %rsp +; DARWIN-64-PIC-NEXT: ret } define void @ltailcaller() nounwind { @@ -1764,6 +9114,60 @@ entry: ; LINUX-64-STATIC: ltailcaller: ; LINUX-64-STATIC: call lcallee ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: ltailcaller: +; LINUX-32-STATIC: subl $4, %esp +; LINUX-32-STATIC-NEXT: call lcallee +; LINUX-32-STATIC-NEXT: addl $4, %esp +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: ltailcaller: +; LINUX-32-PIC: subl $4, %esp +; LINUX-32-PIC-NEXT: call lcallee +; LINUX-32-PIC-NEXT: addl $4, %esp +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: ltailcaller: +; LINUX-64-PIC: subq $8, %rsp +; LINUX-64-PIC-NEXT: call lcallee@PLT +; LINUX-64-PIC-NEXT: addq $8, %rsp +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _ltailcaller: +; DARWIN-32-STATIC: subl $12, %esp +; DARWIN-32-STATIC-NEXT: call _lcallee +; DARWIN-32-STATIC-NEXT: addl $12, %esp +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _ltailcaller: +; DARWIN-32-DYNAMIC: subl $12, %esp +; DARWIN-32-DYNAMIC-NEXT: call _lcallee +; DARWIN-32-DYNAMIC-NEXT: addl $12, %esp +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _ltailcaller: +; DARWIN-32-PIC: subl $12, %esp +; DARWIN-32-PIC-NEXT: call _lcallee +; DARWIN-32-PIC-NEXT: addl $12, %esp +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _ltailcaller: +; DARWIN-64-STATIC: subq $8, %rsp +; DARWIN-64-STATIC-NEXT: call _lcallee +; DARWIN-64-STATIC-NEXT: addq $8, %rsp +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _ltailcaller: +; DARWIN-64-DYNAMIC: subq $8, %rsp +; DARWIN-64-DYNAMIC-NEXT: call _lcallee +; DARWIN-64-DYNAMIC-NEXT: addq $8, %rsp +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _ltailcaller: +; DARWIN-64-PIC: subq $8, %rsp +; DARWIN-64-PIC-NEXT: call _lcallee +; DARWIN-64-PIC-NEXT: addq $8, %rsp +; DARWIN-64-PIC-NEXT: ret } define void @icaller() nounwind { @@ -1777,6 +9181,82 @@ entry: ; LINUX-64-STATIC: call *ifunc ; LINUX-64-STATIC: call *ifunc ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: icaller: +; LINUX-32-STATIC: subl $4, %esp +; LINUX-32-STATIC-NEXT: call *ifunc +; LINUX-32-STATIC-NEXT: call *ifunc +; LINUX-32-STATIC-NEXT: addl $4, %esp +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: icaller: +; LINUX-32-PIC: subl $4, %esp +; LINUX-32-PIC-NEXT: call *ifunc +; LINUX-32-PIC-NEXT: call *ifunc +; LINUX-32-PIC-NEXT: addl $4, %esp +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: icaller: +; LINUX-64-PIC: pushq %rbx +; LINUX-64-PIC-NEXT: movq ifunc@GOTPCREL(%rip), %rbx +; LINUX-64-PIC-NEXT: call *(%rbx) +; LINUX-64-PIC-NEXT: call *(%rbx) +; LINUX-64-PIC-NEXT: popq %rbx +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _icaller: +; DARWIN-32-STATIC: subl $12, %esp +; DARWIN-32-STATIC-NEXT: call *_ifunc +; DARWIN-32-STATIC-NEXT: call *_ifunc +; DARWIN-32-STATIC-NEXT: addl $12, %esp +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _icaller: +; DARWIN-32-DYNAMIC: pushl %esi +; DARWIN-32-DYNAMIC-NEXT: subl $8, %esp +; DARWIN-32-DYNAMIC-NEXT: movl L_ifunc$non_lazy_ptr, %esi +; DARWIN-32-DYNAMIC-NEXT: call *(%esi) +; DARWIN-32-DYNAMIC-NEXT: call *(%esi) +; DARWIN-32-DYNAMIC-NEXT: addl $8, %esp +; DARWIN-32-DYNAMIC-NEXT: popl %esi +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _icaller: +; DARWIN-32-PIC: pushl %esi +; DARWIN-32-PIC-NEXT: subl $8, %esp +; DARWIN-32-PIC-NEXT: call "L143$pb" +; DARWIN-32-PIC-NEXT: "L143$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl L_ifunc$non_lazy_ptr-"L143$pb"(%eax), %esi +; DARWIN-32-PIC-NEXT: call *(%esi) +; DARWIN-32-PIC-NEXT: call *(%esi) +; DARWIN-32-PIC-NEXT: addl $8, %esp +; DARWIN-32-PIC-NEXT: popl %esi +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _icaller: +; DARWIN-64-STATIC: pushq %rbx +; DARWIN-64-STATIC-NEXT: movq _ifunc@GOTPCREL(%rip), %rbx +; DARWIN-64-STATIC-NEXT: call *(%rbx) +; DARWIN-64-STATIC-NEXT: call *(%rbx) +; DARWIN-64-STATIC-NEXT: popq %rbx +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _icaller: +; DARWIN-64-DYNAMIC: pushq %rbx +; DARWIN-64-DYNAMIC-NEXT: movq _ifunc@GOTPCREL(%rip), %rbx +; DARWIN-64-DYNAMIC-NEXT: call *(%rbx) +; DARWIN-64-DYNAMIC-NEXT: call *(%rbx) +; DARWIN-64-DYNAMIC-NEXT: popq %rbx +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _icaller: +; DARWIN-64-PIC: pushq %rbx +; DARWIN-64-PIC-NEXT: movq _ifunc@GOTPCREL(%rip), %rbx +; DARWIN-64-PIC-NEXT: call *(%rbx) +; DARWIN-64-PIC-NEXT: call *(%rbx) +; DARWIN-64-PIC-NEXT: popq %rbx +; DARWIN-64-PIC-NEXT: ret } define void @dicaller() nounwind { @@ -1790,6 +9270,75 @@ entry: ; LINUX-64-STATIC: call *difunc ; LINUX-64-STATIC: call *difunc ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: dicaller: +; LINUX-32-STATIC: subl $4, %esp +; LINUX-32-STATIC-NEXT: call *difunc +; LINUX-32-STATIC-NEXT: call *difunc +; LINUX-32-STATIC-NEXT: addl $4, %esp +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: dicaller: +; LINUX-32-PIC: subl $4, %esp +; LINUX-32-PIC-NEXT: call *difunc +; LINUX-32-PIC-NEXT: call *difunc +; LINUX-32-PIC-NEXT: addl $4, %esp +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: dicaller: +; LINUX-64-PIC: pushq %rbx +; LINUX-64-PIC-NEXT: movq difunc@GOTPCREL(%rip), %rbx +; LINUX-64-PIC-NEXT: call *(%rbx) +; LINUX-64-PIC-NEXT: call *(%rbx) +; LINUX-64-PIC-NEXT: popq %rbx +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _dicaller: +; DARWIN-32-STATIC: subl $12, %esp +; DARWIN-32-STATIC-NEXT: call *_difunc +; DARWIN-32-STATIC-NEXT: call *_difunc +; DARWIN-32-STATIC-NEXT: addl $12, %esp +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _dicaller: +; DARWIN-32-DYNAMIC: subl $12, %esp +; DARWIN-32-DYNAMIC-NEXT: call *_difunc +; DARWIN-32-DYNAMIC-NEXT: call *_difunc +; DARWIN-32-DYNAMIC-NEXT: addl $12, %esp +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _dicaller: +; DARWIN-32-PIC: pushl %esi +; DARWIN-32-PIC-NEXT: subl $8, %esp +; DARWIN-32-PIC-NEXT: call "L144$pb" +; DARWIN-32-PIC-NEXT: "L144$pb": +; DARWIN-32-PIC-NEXT: popl %esi +; DARWIN-32-PIC-NEXT: call *_difunc-"L144$pb"(%esi) +; DARWIN-32-PIC-NEXT: call *_difunc-"L144$pb"(%esi) +; DARWIN-32-PIC-NEXT: addl $8, %esp +; DARWIN-32-PIC-NEXT: popl %esi +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _dicaller: +; DARWIN-64-STATIC: subq $8, %rsp +; DARWIN-64-STATIC-NEXT: call *_difunc(%rip) +; DARWIN-64-STATIC-NEXT: call *_difunc(%rip) +; DARWIN-64-STATIC-NEXT: addq $8, %rsp +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _dicaller: +; DARWIN-64-DYNAMIC: subq $8, %rsp +; DARWIN-64-DYNAMIC-NEXT: call *_difunc(%rip) +; DARWIN-64-DYNAMIC-NEXT: call *_difunc(%rip) +; DARWIN-64-DYNAMIC-NEXT: addq $8, %rsp +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _dicaller: +; DARWIN-64-PIC: subq $8, %rsp +; DARWIN-64-PIC-NEXT: call *_difunc(%rip) +; DARWIN-64-PIC-NEXT: call *_difunc(%rip) +; DARWIN-64-PIC-NEXT: addq $8, %rsp +; DARWIN-64-PIC-NEXT: ret } define void @licaller() nounwind { @@ -1803,6 +9352,74 @@ entry: ; LINUX-64-STATIC: call *lifunc ; LINUX-64-STATIC: call *lifunc ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: licaller: +; LINUX-32-STATIC: subl $4, %esp +; LINUX-32-STATIC-NEXT: call *lifunc +; LINUX-32-STATIC-NEXT: call *lifunc +; LINUX-32-STATIC-NEXT: addl $4, %esp +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: licaller: +; LINUX-32-PIC: subl $4, %esp +; LINUX-32-PIC-NEXT: call *lifunc +; LINUX-32-PIC-NEXT: call *lifunc +; LINUX-32-PIC-NEXT: addl $4, %esp +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: licaller: +; LINUX-64-PIC: subq $8, %rsp +; LINUX-64-PIC-NEXT: call *lifunc(%rip) +; LINUX-64-PIC-NEXT: call *lifunc(%rip) +; LINUX-64-PIC-NEXT: addq $8, %rsp +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _licaller: +; DARWIN-32-STATIC: subl $12, %esp +; DARWIN-32-STATIC-NEXT: call *_lifunc +; DARWIN-32-STATIC-NEXT: call *_lifunc +; DARWIN-32-STATIC-NEXT: addl $12, %esp +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _licaller: +; DARWIN-32-DYNAMIC: subl $12, %esp +; DARWIN-32-DYNAMIC-NEXT: call *_lifunc +; DARWIN-32-DYNAMIC-NEXT: call *_lifunc +; DARWIN-32-DYNAMIC-NEXT: addl $12, %esp +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _licaller: +; DARWIN-32-PIC: pushl %esi +; DARWIN-32-PIC-NEXT: subl $8, %esp +; DARWIN-32-PIC-NEXT: call "L145$pb" +; DARWIN-32-PIC-NEXT: "L145$pb": +; DARWIN-32-PIC-NEXT: popl %esi +; DARWIN-32-PIC-NEXT: call *_lifunc-"L145$pb"(%esi) +; DARWIN-32-PIC-NEXT: call *_lifunc-"L145$pb"(%esi) +; DARWIN-32-PIC-NEXT: addl $8, %esp +; DARWIN-32-PIC-NEXT: popl %esi +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _licaller: +; DARWIN-64-STATIC: subq $8, %rsp +; DARWIN-64-STATIC-NEXT: call *_lifunc(%rip) +; DARWIN-64-STATIC-NEXT: call *_lifunc(%rip) +; DARWIN-64-STATIC-NEXT: addq $8, %rsp +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _licaller: +; DARWIN-64-DYNAMIC: subq $8, %rsp +; DARWIN-64-DYNAMIC-NEXT: call *_lifunc(%rip) +; DARWIN-64-DYNAMIC-NEXT: call *_lifunc(%rip) +; DARWIN-64-DYNAMIC-NEXT: addq $8, %rsp +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _licaller: +; DARWIN-64-PIC: subq $8, %rsp +; DARWIN-64-PIC-NEXT: call *_lifunc(%rip) +; DARWIN-64-PIC-NEXT: call *_lifunc(%rip) +; DARWIN-64-PIC-NEXT: addq $8, %rsp +; DARWIN-64-PIC-NEXT: ret } define void @itailcaller() nounwind { @@ -1816,6 +9433,82 @@ entry: ; LINUX-64-STATIC: call *ifunc ; LINUX-64-STATIC: call *ifunc ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: itailcaller: +; LINUX-32-STATIC: subl $4, %esp +; LINUX-32-STATIC-NEXT: call *ifunc +; LINUX-32-STATIC-NEXT: call *ifunc +; LINUX-32-STATIC-NEXT: addl $4, %esp +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: itailcaller: +; LINUX-32-PIC: subl $4, %esp +; LINUX-32-PIC-NEXT: call *ifunc +; LINUX-32-PIC-NEXT: call *ifunc +; LINUX-32-PIC-NEXT: addl $4, %esp +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: itailcaller: +; LINUX-64-PIC: pushq %rbx +; LINUX-64-PIC-NEXT: movq ifunc@GOTPCREL(%rip), %rbx +; LINUX-64-PIC-NEXT: call *(%rbx) +; LINUX-64-PIC-NEXT: call *(%rbx) +; LINUX-64-PIC-NEXT: popq %rbx +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _itailcaller: +; DARWIN-32-STATIC: subl $12, %esp +; DARWIN-32-STATIC-NEXT: call *_ifunc +; DARWIN-32-STATIC-NEXT: call *_ifunc +; DARWIN-32-STATIC-NEXT: addl $12, %esp +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _itailcaller: +; DARWIN-32-DYNAMIC: pushl %esi +; DARWIN-32-DYNAMIC-NEXT: subl $8, %esp +; DARWIN-32-DYNAMIC-NEXT: movl L_ifunc$non_lazy_ptr, %esi +; DARWIN-32-DYNAMIC-NEXT: call *(%esi) +; DARWIN-32-DYNAMIC-NEXT: call *(%esi) +; DARWIN-32-DYNAMIC-NEXT: addl $8, %esp +; DARWIN-32-DYNAMIC-NEXT: popl %esi +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _itailcaller: +; DARWIN-32-PIC: pushl %esi +; DARWIN-32-PIC-NEXT: subl $8, %esp +; DARWIN-32-PIC-NEXT: call "L146$pb" +; DARWIN-32-PIC-NEXT: "L146$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: movl L_ifunc$non_lazy_ptr-"L146$pb"(%eax), %esi +; DARWIN-32-PIC-NEXT: call *(%esi) +; DARWIN-32-PIC-NEXT: call *(%esi) +; DARWIN-32-PIC-NEXT: addl $8, %esp +; DARWIN-32-PIC-NEXT: popl %esi +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _itailcaller: +; DARWIN-64-STATIC: pushq %rbx +; DARWIN-64-STATIC-NEXT: movq _ifunc@GOTPCREL(%rip), %rbx +; DARWIN-64-STATIC-NEXT: call *(%rbx) +; DARWIN-64-STATIC-NEXT: call *(%rbx) +; DARWIN-64-STATIC-NEXT: popq %rbx +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _itailcaller: +; DARWIN-64-DYNAMIC: pushq %rbx +; DARWIN-64-DYNAMIC-NEXT: movq _ifunc@GOTPCREL(%rip), %rbx +; DARWIN-64-DYNAMIC-NEXT: call *(%rbx) +; DARWIN-64-DYNAMIC-NEXT: call *(%rbx) +; DARWIN-64-DYNAMIC-NEXT: popq %rbx +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _itailcaller: +; DARWIN-64-PIC: pushq %rbx +; DARWIN-64-PIC-NEXT: movq _ifunc@GOTPCREL(%rip), %rbx +; DARWIN-64-PIC-NEXT: call *(%rbx) +; DARWIN-64-PIC-NEXT: call *(%rbx) +; DARWIN-64-PIC-NEXT: popq %rbx +; DARWIN-64-PIC-NEXT: ret } define void @ditailcaller() nounwind { @@ -1826,6 +9519,63 @@ entry: ; LINUX-64-STATIC: ditailcaller: ; LINUX-64-STATIC: call *difunc ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: ditailcaller: +; LINUX-32-STATIC: subl $4, %esp +; LINUX-32-STATIC-NEXT: call *difunc +; LINUX-32-STATIC-NEXT: addl $4, %esp +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: ditailcaller: +; LINUX-32-PIC: subl $4, %esp +; LINUX-32-PIC-NEXT: call *difunc +; LINUX-32-PIC-NEXT: addl $4, %esp +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: ditailcaller: +; LINUX-64-PIC: subq $8, %rsp +; LINUX-64-PIC-NEXT: movq difunc@GOTPCREL(%rip), %rax +; LINUX-64-PIC-NEXT: call *(%rax) +; LINUX-64-PIC-NEXT: addq $8, %rsp +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _ditailcaller: +; DARWIN-32-STATIC: subl $12, %esp +; DARWIN-32-STATIC-NEXT: call *_difunc +; DARWIN-32-STATIC-NEXT: addl $12, %esp +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _ditailcaller: +; DARWIN-32-DYNAMIC: subl $12, %esp +; DARWIN-32-DYNAMIC-NEXT: call *_difunc +; DARWIN-32-DYNAMIC-NEXT: addl $12, %esp +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _ditailcaller: +; DARWIN-32-PIC: subl $12, %esp +; DARWIN-32-PIC-NEXT: call "L147$pb" +; DARWIN-32-PIC-NEXT: "L147$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: call *_difunc-"L147$pb"(%eax) +; DARWIN-32-PIC-NEXT: addl $12, %esp +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _ditailcaller: +; DARWIN-64-STATIC: subq $8, %rsp +; DARWIN-64-STATIC-NEXT: call *_difunc(%rip) +; DARWIN-64-STATIC-NEXT: addq $8, %rsp +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _ditailcaller: +; DARWIN-64-DYNAMIC: subq $8, %rsp +; DARWIN-64-DYNAMIC-NEXT: call *_difunc(%rip) +; DARWIN-64-DYNAMIC-NEXT: addq $8, %rsp +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _ditailcaller: +; DARWIN-64-PIC: call *_difunc(%rip) +; DARWIN-64-PIC-NEXT: addq $8, %rsp +; DARWIN-64-PIC-NEXT: ret } define void @litailcaller() nounwind { @@ -1836,4 +9586,61 @@ entry: ; LINUX-64-STATIC: litailcaller: ; LINUX-64-STATIC: call *lifunc ; LINUX-64-STATIC: ret + +; LINUX-32-STATIC: litailcaller: +; LINUX-32-STATIC: subl $4, %esp +; LINUX-32-STATIC-NEXT: call *lifunc +; LINUX-32-STATIC-NEXT: addl $4, %esp +; LINUX-32-STATIC-NEXT: ret + +; LINUX-32-PIC: litailcaller: +; LINUX-32-PIC: subl $4, %esp +; LINUX-32-PIC-NEXT: call *lifunc +; LINUX-32-PIC-NEXT: addl $4, %esp +; LINUX-32-PIC-NEXT: ret + +; LINUX-64-PIC: litailcaller: +; LINUX-64-PIC: subq $8, %rsp +; LINUX-64-PIC-NEXT: call *lifunc(%rip) +; LINUX-64-PIC-NEXT: addq $8, %rsp +; LINUX-64-PIC-NEXT: ret + +; DARWIN-32-STATIC: _litailcaller: +; DARWIN-32-STATIC: subl $12, %esp +; DARWIN-32-STATIC-NEXT: call *_lifunc +; DARWIN-32-STATIC-NEXT: addl $12, %esp +; DARWIN-32-STATIC-NEXT: ret + +; DARWIN-32-DYNAMIC: _litailcaller: +; DARWIN-32-DYNAMIC: subl $12, %esp +; DARWIN-32-DYNAMIC-NEXT: call *_lifunc +; DARWIN-32-DYNAMIC-NEXT: addl $12, %esp +; DARWIN-32-DYNAMIC-NEXT: ret + +; DARWIN-32-PIC: _litailcaller: +; DARWIN-32-PIC: subl $12, %esp +; DARWIN-32-PIC-NEXT: call "L148$pb" +; DARWIN-32-PIC-NEXT: "L148$pb": +; DARWIN-32-PIC-NEXT: popl %eax +; DARWIN-32-PIC-NEXT: call *_lifunc-"L148$pb"(%eax) +; DARWIN-32-PIC-NEXT: addl $12, %esp +; DARWIN-32-PIC-NEXT: ret + +; DARWIN-64-STATIC: _litailcaller: +; DARWIN-64-STATIC: subq $8, %rsp +; DARWIN-64-STATIC-NEXT: call *_lifunc(%rip) +; DARWIN-64-STATIC-NEXT: addq $8, %rsp +; DARWIN-64-STATIC-NEXT: ret + +; DARWIN-64-DYNAMIC: _litailcaller: +; DARWIN-64-DYNAMIC: subq $8, %rsp +; DARWIN-64-DYNAMIC-NEXT: call *_lifunc(%rip) +; DARWIN-64-DYNAMIC-NEXT: addq $8, %rsp +; DARWIN-64-DYNAMIC-NEXT: ret + +; DARWIN-64-PIC: _litailcaller: +; DARWIN-64-PIC: subq $8, %rsp +; DARWIN-64-PIC-NEXT: call *_lifunc(%rip) +; DARWIN-64-PIC-NEXT: addq $8, %rsp +; DARWIN-64-PIC-NEXT: ret } diff --git a/libclamav/c++/llvm/test/CodeGen/X86/aliases.ll b/libclamav/c++/llvm/test/CodeGen/X86/aliases.ll index 3aadd05d0..3cfe1aa2c 100644 --- a/libclamav/c++/llvm/test/CodeGen/X86/aliases.ll +++ b/libclamav/c++/llvm/test/CodeGen/X86/aliases.ll @@ -1,5 +1,5 @@ ; RUN: llvm-as < %s | \ -; RUN: llc -mtriple=i686-pc-linux-gnu -asm-verbose=false -o %t -f +; RUN: llc -mtriple=i686-pc-linux-gnu -asm-verbose=false -o %t ; RUN: grep set %t | count 7 ; RUN: grep globl %t | count 6 ; RUN: grep weak %t | count 1 diff --git a/libclamav/c++/llvm/test/CodeGen/X86/anyext.ll b/libclamav/c++/llvm/test/CodeGen/X86/anyext.ll new file mode 100644 index 000000000..c5f03abee --- /dev/null +++ b/libclamav/c++/llvm/test/CodeGen/X86/anyext.ll @@ -0,0 +1,18 @@ +; RUN: llvm-as < %s | llc -march=x86-64 | grep movzbl | count 2 + +; Use movzbl to avoid partial-register updates. + +define i32 @foo(i32 %p, i8 zeroext %x) nounwind { + %q = trunc i32 %p to i8 + %r = udiv i8 %q, %x + %s = zext i8 %r to i32 + %t = and i32 %s, 1 + ret i32 %t +} +define i32 @bar(i32 %p, i16 zeroext %x) nounwind { + %q = trunc i32 %p to i16 + %r = udiv i16 %q, %x + %s = zext i16 %r to i32 + %t = and i32 %s, 1 + ret i32 %t +} diff --git a/libclamav/c++/llvm/test/CodeGen/X86/asm-modifier.ll b/libclamav/c++/llvm/test/CodeGen/X86/asm-modifier.ll index 8bd5509e9..10a362f36 100644 --- a/libclamav/c++/llvm/test/CodeGen/X86/asm-modifier.ll +++ b/libclamav/c++/llvm/test/CodeGen/X86/asm-modifier.ll @@ -19,3 +19,23 @@ entry: %asmtmp = tail call i16 asm "movw\09%gs:${1:a}, ${0:w}", "=r,ir,~{dirflag},~{fpsr},~{flags}"(i32 %address) nounwind ; [#uses=1] ret i16 %asmtmp } + +@n = global i32 42 ; [#uses=3] +@y = common global i32 0 ; [#uses=3] + +define void @test3() nounwind { +entry: +; CHECK: test3: +; CHECK: movl _n, %eax + call void asm sideeffect "movl ${0:a}, %eax", "ir,~{dirflag},~{fpsr},~{flags},~{eax}"(i32* @n) nounwind + ret void +} + +define void @test4() nounwind { +entry: +; CHECK: test4: +; CHECK: movl L_y$non_lazy_ptr, %ecx +; CHECK: movl (%ecx), %eax + call void asm sideeffect "movl ${0:a}, %eax", "ir,~{dirflag},~{fpsr},~{flags},~{eax}"(i32* @y) nounwind + ret void +} diff --git a/libclamav/c++/llvm/test/CodeGen/X86/atomic_op.ll b/libclamav/c++/llvm/test/CodeGen/X86/atomic_op.ll index 6871a08b2..de73ca316 100644 --- a/libclamav/c++/llvm/test/CodeGen/X86/atomic_op.ll +++ b/libclamav/c++/llvm/test/CodeGen/X86/atomic_op.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=x86 -o %t1 -f +; RUN: llvm-as < %s | llc -march=x86 -o %t1 ; RUN: grep "lock" %t1 | count 17 ; RUN: grep "xaddl" %t1 | count 4 ; RUN: grep "cmpxchgl" %t1 | count 13 diff --git a/libclamav/c++/llvm/test/CodeGen/X86/cmov-i8-eflags.ll b/libclamav/c++/llvm/test/CodeGen/X86/cmov-i8-eflags.ll new file mode 100644 index 000000000..e81ce5811 --- /dev/null +++ b/libclamav/c++/llvm/test/CodeGen/X86/cmov-i8-eflags.ll @@ -0,0 +1,55 @@ +; RUN: llvm-as < %s | llc -march=x86-64 | %prcontext {setne %al} 1 | grep test | count 2 +; PR4814 + +; CodeGen shouldn't try to do a setne after an expanded 8-bit conditional +; move without recomputing EFLAGS, because the expansion of the conditional +; move with control flow may clobber EFLAGS (e.g., with xor, to set the +; register to zero). + +; The prcontext usage above is a little awkward; the important part is that +; there's a test before the setne. + +target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128" + +@g_3 = external global i8 ; [#uses=1] +@g_96 = external global i8 ; [#uses=2] +@g_100 = external global i8 ; [#uses=2] +@_2E_str = external constant [15 x i8], align 1 ; <[15 x i8]*> [#uses=1] + +define i32 @main() nounwind { +entry: + %0 = load i8* @g_3, align 1 ; [#uses=2] + %1 = sext i8 %0 to i32 ; [#uses=1] + %.lobit.i = lshr i8 %0, 7 ; [#uses=1] + %tmp.i = zext i8 %.lobit.i to i32 ; [#uses=1] + %tmp.not.i = xor i32 %tmp.i, 1 ; [#uses=1] + %iftmp.17.0.i.i = ashr i32 %1, %tmp.not.i ; [#uses=1] + %retval56.i.i = trunc i32 %iftmp.17.0.i.i to i8 ; [#uses=1] + %2 = icmp eq i8 %retval56.i.i, 0 ; [#uses=2] + %g_96.promoted.i = load i8* @g_96 ; [#uses=3] + %3 = icmp eq i8 %g_96.promoted.i, 0 ; [#uses=2] + br i1 %3, label %func_4.exit.i, label %bb.i.i.i + +bb.i.i.i: ; preds = %entry + %4 = volatile load i8* @g_100, align 1 ; [#uses=0] + br label %func_4.exit.i + +func_4.exit.i: ; preds = %bb.i.i.i, %entry + %.not.i = xor i1 %2, true ; [#uses=1] + %brmerge.i = or i1 %3, %.not.i ; [#uses=1] + %.mux.i = select i1 %2, i8 %g_96.promoted.i, i8 0 ; [#uses=1] + br i1 %brmerge.i, label %func_1.exit, label %bb.i.i + +bb.i.i: ; preds = %func_4.exit.i + %5 = volatile load i8* @g_100, align 1 ; [#uses=0] + br label %func_1.exit + +func_1.exit: ; preds = %bb.i.i, %func_4.exit.i + %g_96.tmp.0.i = phi i8 [ %g_96.promoted.i, %bb.i.i ], [ %.mux.i, %func_4.exit.i ] ; [#uses=2] + store i8 %g_96.tmp.0.i, i8* @g_96 + %6 = zext i8 %g_96.tmp.0.i to i32 ; [#uses=1] + %7 = tail call i32 (i8*, ...)* @printf(i8* noalias getelementptr ([15 x i8]* @_2E_str, i64 0, i64 0), i32 %6) nounwind ; [#uses=0] + ret i32 0 +} + +declare i32 @printf(i8* nocapture, ...) nounwind diff --git a/libclamav/c++/llvm/test/CodeGen/X86/commute-cmov.ll b/libclamav/c++/llvm/test/CodeGen/X86/commute-cmov.ll index ac0e4ef3e..30c7347d9 100644 --- a/libclamav/c++/llvm/test/CodeGen/X86/commute-cmov.ll +++ b/libclamav/c++/llvm/test/CodeGen/X86/commute-cmov.ll @@ -1,22 +1,27 @@ -; RUN: llvm-as < %s | llc -march=x86 > %t -; RUN: grep btl %t | count 2 -; RUN: grep cmov %t | count 2 -; RUN: not grep test %t -; RUN: not grep set %t -; RUN: not grep j %t -; RUN: not grep cmovne %t -; RUN: not grep cmove %t +; RUN: llvm-as < %s | llc -march=x86 | FileCheck %s -define i32 @foo(i32 %x, i32 %n, i32 %w, i32 %v) nounwind readnone { +define i32 @test1(i32 %x, i32 %n, i32 %w, i32 %v) nounwind readnone { entry: +; CHECK: test1: +; CHECK: btl +; CHECK-NEXT: movl $12, %eax +; CHECK-NEXT: cmovae 16(%esp), %eax +; CHECK-NEXT: ret + %0 = lshr i32 %x, %n ; [#uses=1] %1 = and i32 %0, 1 ; [#uses=1] %toBool = icmp eq i32 %1, 0 ; [#uses=1] %.0 = select i1 %toBool, i32 %v, i32 12 ; [#uses=1] ret i32 %.0 } -define i32 @bar(i32 %x, i32 %n, i32 %w, i32 %v) nounwind readnone { +define i32 @test2(i32 %x, i32 %n, i32 %w, i32 %v) nounwind readnone { entry: +; CHECK: test2: +; CHECK: btl +; CHECK-NEXT: movl $12, %eax +; CHECK-NEXT: cmovb 16(%esp), %eax +; CHECK-NEXT: ret + %0 = lshr i32 %x, %n ; [#uses=1] %1 = and i32 %0, 1 ; [#uses=1] %toBool = icmp eq i32 %1, 0 ; [#uses=1] diff --git a/libclamav/c++/llvm/test/CodeGen/X86/convert-2-addr-3-addr-inc64.ll b/libclamav/c++/llvm/test/CodeGen/X86/convert-2-addr-3-addr-inc64.ll index 579e30cea..c0c1767c3 100644 --- a/libclamav/c++/llvm/test/CodeGen/X86/convert-2-addr-3-addr-inc64.ll +++ b/libclamav/c++/llvm/test/CodeGen/X86/convert-2-addr-3-addr-inc64.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=x86-64 -o %t -f -stats -info-output-file - | \ +; RUN: llvm-as < %s | llc -march=x86-64 -o %t -stats -info-output-file - | \ ; RUN: grep {asm-printer} | grep {Number of machine instrs printed} | grep 5 ; RUN: grep {leal 1(\%rsi),} %t diff --git a/libclamav/c++/llvm/test/CodeGen/X86/dagcombine-buildvector.ll b/libclamav/c++/llvm/test/CodeGen/X86/dagcombine-buildvector.ll index b96fdfc03..95e27b040 100644 --- a/libclamav/c++/llvm/test/CodeGen/X86/dagcombine-buildvector.ll +++ b/libclamav/c++/llvm/test/CodeGen/X86/dagcombine-buildvector.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=x86 -mcpu=penryn -disable-mmx -o %t -f +; RUN: llvm-as < %s | llc -march=x86 -mcpu=penryn -disable-mmx -o %t ; RUN: grep unpcklpd %t | count 1 ; RUN: grep movapd %t | count 1 ; RUN: grep movaps %t | count 1 diff --git a/libclamav/c++/llvm/test/CodeGen/X86/extract-combine.ll b/libclamav/c++/llvm/test/CodeGen/X86/extract-combine.ll index 842ec24e0..95cd8f20d 100644 --- a/libclamav/c++/llvm/test/CodeGen/X86/extract-combine.ll +++ b/libclamav/c++/llvm/test/CodeGen/X86/extract-combine.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=x86-64 -mcpu=core2 -o %t -f +; RUN: llvm-as < %s | llc -march=x86-64 -mcpu=core2 -o %t ; RUN: not grep unpcklps %t define i32 @foo() nounwind { diff --git a/libclamav/c++/llvm/test/CodeGen/X86/fast-isel.ll b/libclamav/c++/llvm/test/CodeGen/X86/fast-isel.ll index a9a016b7d..8d6ddb4db 100644 --- a/libclamav/c++/llvm/test/CodeGen/X86/fast-isel.ll +++ b/libclamav/c++/llvm/test/CodeGen/X86/fast-isel.ll @@ -64,3 +64,12 @@ define i8* @inttoptr_i32(i32 %p) nounwind { %t = inttoptr i32 %p to i8* ret i8* %t } + +define void @store_i1(i1* %p, i1 %t) nounwind { + store i1 %t, i1* %p + ret void +} +define i1 @load_i1(i1* %p) nounwind { + %t = load i1* %p + ret i1 %t +} diff --git a/libclamav/c++/llvm/test/CodeGen/X86/ins_subreg_coalesce-1.ll b/libclamav/c++/llvm/test/CodeGen/X86/ins_subreg_coalesce-1.ll index 863cda94c..a0347ea80 100644 --- a/libclamav/c++/llvm/test/CodeGen/X86/ins_subreg_coalesce-1.ll +++ b/libclamav/c++/llvm/test/CodeGen/X86/ins_subreg_coalesce-1.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=x86 | grep mov | count 2 +; RUN: llvm-as < %s | llc -march=x86 | grep mov | count 3 define fastcc i32 @sqlite3ExprResolveNames() nounwind { entry: diff --git a/libclamav/c++/llvm/test/CodeGen/X86/iv-users-in-other-loops.ll b/libclamav/c++/llvm/test/CodeGen/X86/iv-users-in-other-loops.ll index af1434ad1..f97ac4def 100644 --- a/libclamav/c++/llvm/test/CodeGen/X86/iv-users-in-other-loops.ll +++ b/libclamav/c++/llvm/test/CodeGen/X86/iv-users-in-other-loops.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=x86-64 -f -o %t +; RUN: llvm-as < %s | llc -march=x86-64 -o %t ; RUN: grep inc %t | count 1 ; RUN: grep dec %t | count 2 ; RUN: grep addq %t | count 13 diff --git a/libclamav/c++/llvm/test/CodeGen/X86/legalizedag_vec.ll b/libclamav/c++/llvm/test/CodeGen/X86/legalizedag_vec.ll index ef4b0d4d7..8d8683d9f 100644 --- a/libclamav/c++/llvm/test/CodeGen/X86/legalizedag_vec.ll +++ b/libclamav/c++/llvm/test/CodeGen/X86/legalizedag_vec.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=x86 -mattr=sse2 -disable-mmx -o %t -f +; RUN: llvm-as < %s | llc -march=x86 -mattr=sse2 -disable-mmx -o %t ; RUN: grep {call.*divdi3} %t | count 2 diff --git a/libclamav/c++/llvm/test/CodeGen/X86/mingw-alloca.ll b/libclamav/c++/llvm/test/CodeGen/X86/mingw-alloca.ll index b76178142..53d235039 100644 --- a/libclamav/c++/llvm/test/CodeGen/X86/mingw-alloca.ll +++ b/libclamav/c++/llvm/test/CodeGen/X86/mingw-alloca.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -o %t -f +; RUN: llvm-as < %s | llc -o %t ; RUN: grep __alloca %t | count 2 ; RUN: grep 4294967288 %t ; RUN: grep {pushl %eax} %t diff --git a/libclamav/c++/llvm/test/CodeGen/X86/neg_fp.ll b/libclamav/c++/llvm/test/CodeGen/X86/neg_fp.ll index 1a7ee085b..d5e7c29a0 100644 --- a/libclamav/c++/llvm/test/CodeGen/X86/neg_fp.ll +++ b/libclamav/c++/llvm/test/CodeGen/X86/neg_fp.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse41 -o %t -f +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse41 -o %t ; RUN: grep xorps %t | count 1 ; Test that when we don't -enable-unsafe-fp-math, we don't do the optimization @@ -9,4 +9,4 @@ entry: %sub = fsub float %a, %b ; [#uses=1] %neg = fsub float -0.000000e+00, %sub ; [#uses=1] ret float %neg -} \ No newline at end of file +} diff --git a/libclamav/c++/llvm/test/CodeGen/X86/pic-1.ll b/libclamav/c++/llvm/test/CodeGen/X86/pic-1.ll index 7bd59dc0f..299fa593d 100644 --- a/libclamav/c++/llvm/test/CodeGen/X86/pic-1.ll +++ b/libclamav/c++/llvm/test/CodeGen/X86/pic-1.ll @@ -1,5 +1,5 @@ ; RUN: llvm-as < %s | \ -; RUN: llc -mtriple=i686-pc-linux-gnu -relocation-model=pic -o %t -f +; RUN: llc -mtriple=i686-pc-linux-gnu -relocation-model=pic -o %t ; RUN: grep _GLOBAL_OFFSET_TABLE_ %t ; RUN: grep piclabel %t | count 3 ; RUN: grep GOT %t | count 3 diff --git a/libclamav/c++/llvm/test/CodeGen/X86/pic-2.ll b/libclamav/c++/llvm/test/CodeGen/X86/pic-2.ll index 40899b35b..de90cb7a1 100644 --- a/libclamav/c++/llvm/test/CodeGen/X86/pic-2.ll +++ b/libclamav/c++/llvm/test/CodeGen/X86/pic-2.ll @@ -1,5 +1,5 @@ ; RUN: llvm-as < %s | llc -mtriple=i686-pc-linux-gnu -relocation-model=pic \ -; RUN: -o %t -f +; RUN: -o %t ; RUN: grep _GLOBAL_OFFSET_TABLE_ %t ; RUN: grep piclabel %t | count 3 ; RUN: grep GOTOFF %t | count 4 diff --git a/libclamav/c++/llvm/test/CodeGen/X86/pic-4.ll b/libclamav/c++/llvm/test/CodeGen/X86/pic-4.ll index 49b9000f1..317c04bd1 100644 --- a/libclamav/c++/llvm/test/CodeGen/X86/pic-4.ll +++ b/libclamav/c++/llvm/test/CodeGen/X86/pic-4.ll @@ -1,5 +1,5 @@ ; RUN: llvm-as < %s | \ -; RUN: llc -mtriple=i686-pc-linux-gnu -relocation-model=pic -o %t -f +; RUN: llc -mtriple=i686-pc-linux-gnu -relocation-model=pic -o %t ; RUN: grep _GLOBAL_OFFSET_TABLE_ %t ; RUN: grep piclabel %t | count 3 ; RUN: grep PLT %t | count 1 diff --git a/libclamav/c++/llvm/test/CodeGen/X86/pic-5.ll b/libclamav/c++/llvm/test/CodeGen/X86/pic-5.ll index 3f7e16934..789e7db8b 100644 --- a/libclamav/c++/llvm/test/CodeGen/X86/pic-5.ll +++ b/libclamav/c++/llvm/test/CodeGen/X86/pic-5.ll @@ -1,5 +1,5 @@ ; RUN: llvm-as < %s | llc -mtriple=i686-pc-linux-gnu -relocation-model=pic \ -; RUN: -o %t -f +; RUN: -o %t ; RUN: grep _GLOBAL_OFFSET_TABLE_ %t ; RUN: grep piclabel %t | count 3 ; RUN: grep PLT %t | count 1 diff --git a/libclamav/c++/llvm/test/CodeGen/X86/pic-6.ll b/libclamav/c++/llvm/test/CodeGen/X86/pic-6.ll index d55da1f4c..922521d8b 100644 --- a/libclamav/c++/llvm/test/CodeGen/X86/pic-6.ll +++ b/libclamav/c++/llvm/test/CodeGen/X86/pic-6.ll @@ -1,5 +1,5 @@ ; RUN: llvm-as < %s | llc -mtriple=i686-pc-linux-gnu -relocation-model=pic \ -; RUN: -o %t -f +; RUN: -o %t ; RUN: grep _GLOBAL_OFFSET_TABLE_ %t ; RUN: grep piclabel %t | count 3 ; RUN: grep GOT %t | count 3 diff --git a/libclamav/c++/llvm/test/CodeGen/X86/pic-cpool.ll b/libclamav/c++/llvm/test/CodeGen/X86/pic-cpool.ll index a2b5d2658..6189fb2c4 100644 --- a/libclamav/c++/llvm/test/CodeGen/X86/pic-cpool.ll +++ b/libclamav/c++/llvm/test/CodeGen/X86/pic-cpool.ll @@ -1,5 +1,5 @@ ; RUN: llvm-as < %s | llc -mtriple=i686-pc-linux-gnu -relocation-model=pic \ -; RUN: -o %t -f +; RUN: -o %t ; RUN: grep _GLOBAL_OFFSET_TABLE_ %t ; RUN: grep piclabel %t | count 3 ; RUN: grep GOTOFF %t | count 1 diff --git a/libclamav/c++/llvm/test/CodeGen/X86/pic-jtbl.ll b/libclamav/c++/llvm/test/CodeGen/X86/pic-jtbl.ll index 6096592e1..81ca9dba2 100644 --- a/libclamav/c++/llvm/test/CodeGen/X86/pic-jtbl.ll +++ b/libclamav/c++/llvm/test/CodeGen/X86/pic-jtbl.ll @@ -1,5 +1,5 @@ ; RUN: llvm-as < %s | llc -mtriple=i686-pc-linux-gnu -relocation-model=pic \ -; RUN: -o %t -f +; RUN: -o %t ; RUN: grep _GLOBAL_OFFSET_TABLE_ %t ; RUN: grep piclabel %t | count 3 ; RUN: grep PLT %t | count 6 diff --git a/libclamav/c++/llvm/test/CodeGen/X86/scalar-extract.ll b/libclamav/c++/llvm/test/CodeGen/X86/scalar-extract.ll index 172c424a7..f545bb625 100644 --- a/libclamav/c++/llvm/test/CodeGen/X86/scalar-extract.ll +++ b/libclamav/c++/llvm/test/CodeGen/X86/scalar-extract.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=x86 -mattr=+mmx -o %t -f +; RUN: llvm-as < %s | llc -march=x86 -mattr=+mmx -o %t ; RUN: not grep movq %t ; Check that widening doesn't introduce a mmx register in this case when diff --git a/libclamav/c++/llvm/test/CodeGen/X86/select-i8.ll b/libclamav/c++/llvm/test/CodeGen/X86/select-i8.ll new file mode 100644 index 000000000..8b2444d59 --- /dev/null +++ b/libclamav/c++/llvm/test/CodeGen/X86/select-i8.ll @@ -0,0 +1,12 @@ +; RUN: llvm-as < %s | llc -march=x86 > %t +; RUN: not grep movz %t +; RUN: not grep cmov %t +; RUN: grep movb %t | count 2 + +; Don't try to use a 16-bit conditional move to do an 8-bit select, +; because it isn't worth it. Just use a branch instead. + +define i8 @foo(i1 inreg %c, i8 inreg %a, i8 inreg %b) { + %d = select i1 %c, i8 %a, i8 %b + ret i8 %d +} diff --git a/libclamav/c++/llvm/test/CodeGen/X86/subclass-coalesce.ll b/libclamav/c++/llvm/test/CodeGen/X86/subclass-coalesce.ll deleted file mode 100644 index 2673be7da..000000000 --- a/libclamav/c++/llvm/test/CodeGen/X86/subclass-coalesce.ll +++ /dev/null @@ -1,17 +0,0 @@ -; RUN: llvm-as < %s | llc -march=x86 -stats |& grep {Number of cross class joins performed} - -@mem.6 = external global i64 ; [#uses=1] - -define i64 @attachFunc() nounwind { -entry: - %tmp64.i = add i64 0, 72 ; [#uses=1] - %tmp68.i = load i64* @mem.6, align 8 ; [#uses=1] - %tmp70.i = icmp sgt i64 %tmp64.i, %tmp68.i ; [#uses=1] - br i1 %tmp70.i, label %bb73.i, label %bb116 - -bb73.i: ; preds = %entry - br label %bb116 - -bb116: ; preds = %bb73.i, %entry - ret i64 %tmp68.i -} diff --git a/libclamav/c++/llvm/test/CodeGen/X86/vec_clear.ll b/libclamav/c++/llvm/test/CodeGen/X86/vec_clear.ll index 514de953e..ca2e43068 100644 --- a/libclamav/c++/llvm/test/CodeGen/X86/vec_clear.ll +++ b/libclamav/c++/llvm/test/CodeGen/X86/vec_clear.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 -mtriple=i386-apple-darwin -o %t -f +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 -mtriple=i386-apple-darwin -o %t ; RUN: not grep and %t ; RUN: not grep psrldq %t ; RUN: grep xorps %t diff --git a/libclamav/c++/llvm/test/CodeGen/X86/vec_extract-sse4.ll b/libclamav/c++/llvm/test/CodeGen/X86/vec_extract-sse4.ll index d6726be1d..c1d431f1c 100644 --- a/libclamav/c++/llvm/test/CodeGen/X86/vec_extract-sse4.ll +++ b/libclamav/c++/llvm/test/CodeGen/X86/vec_extract-sse4.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse41 -o %t -f +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse41 -o %t ; RUN: grep extractps %t | count 1 ; RUN: grep pextrd %t | count 1 ; RUN: not grep pshufd %t diff --git a/libclamav/c++/llvm/test/CodeGen/X86/vec_extract.ll b/libclamav/c++/llvm/test/CodeGen/X86/vec_extract.ll index ee7567cf7..9b59e2d38 100644 --- a/libclamav/c++/llvm/test/CodeGen/X86/vec_extract.ll +++ b/libclamav/c++/llvm/test/CodeGen/X86/vec_extract.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2,-sse41 -o %t -f +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2,-sse41 -o %t ; RUN: grep movss %t | count 3 ; RUN: grep movhlps %t | count 1 ; RUN: grep pshufd %t | count 1 diff --git a/libclamav/c++/llvm/test/CodeGen/X86/vec_i64.ll b/libclamav/c++/llvm/test/CodeGen/X86/vec_i64.ll index 3939af57c..80c65be88 100644 --- a/libclamav/c++/llvm/test/CodeGen/X86/vec_i64.ll +++ b/libclamav/c++/llvm/test/CodeGen/X86/vec_i64.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 -o %t -f +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 -o %t ; RUN: grep movq %t | count 2 ; Used movq to load i64 into a v2i64 when the top i64 is 0. diff --git a/libclamav/c++/llvm/test/CodeGen/X86/vec_insert-8.ll b/libclamav/c++/llvm/test/CodeGen/X86/vec_insert-8.ll index 0f6924c66..d0d9486b5 100644 --- a/libclamav/c++/llvm/test/CodeGen/X86/vec_insert-8.ll +++ b/libclamav/c++/llvm/test/CodeGen/X86/vec_insert-8.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse41 -o %t -f +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse41 -o %t ; tests variable insert and extract of a 4 x i32 diff --git a/libclamav/c++/llvm/test/CodeGen/X86/vec_set-3.ll b/libclamav/c++/llvm/test/CodeGen/X86/vec_set-3.ll index 546ca0bcf..2bf8e50fb 100644 --- a/libclamav/c++/llvm/test/CodeGen/X86/vec_set-3.ll +++ b/libclamav/c++/llvm/test/CodeGen/X86/vec_set-3.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 -o %t -f +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 -o %t ; RUN: grep pshufd %t | count 2 define <4 x float> @test(float %a) nounwind { diff --git a/libclamav/c++/llvm/test/CodeGen/X86/vec_set-5.ll b/libclamav/c++/llvm/test/CodeGen/X86/vec_set-5.ll index d33297011..f97b41148 100644 --- a/libclamav/c++/llvm/test/CodeGen/X86/vec_set-5.ll +++ b/libclamav/c++/llvm/test/CodeGen/X86/vec_set-5.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 -o %t -f +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 -o %t ; RUN: grep movlhps %t | count 1 ; RUN: grep movq %t | count 2 diff --git a/libclamav/c++/llvm/test/CodeGen/X86/vec_set-6.ll b/libclamav/c++/llvm/test/CodeGen/X86/vec_set-6.ll index c7b6747a8..304fbe462 100644 --- a/libclamav/c++/llvm/test/CodeGen/X86/vec_set-6.ll +++ b/libclamav/c++/llvm/test/CodeGen/X86/vec_set-6.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 -o %t -f +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 -o %t ; RUN: grep movss %t | count 1 ; RUN: grep movq %t | count 1 ; RUN: grep shufps %t | count 1 diff --git a/libclamav/c++/llvm/test/CodeGen/X86/vec_shuffle-10.ll b/libclamav/c++/llvm/test/CodeGen/X86/vec_shuffle-10.ll index 297469d92..f4ffa9102 100644 --- a/libclamav/c++/llvm/test/CodeGen/X86/vec_shuffle-10.ll +++ b/libclamav/c++/llvm/test/CodeGen/X86/vec_shuffle-10.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 -o %t -f +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 -o %t ; RUN: grep unpcklps %t | count 1 ; RUN: grep pshufd %t | count 1 ; RUN: not grep {sub.*esp} %t diff --git a/libclamav/c++/llvm/test/CodeGen/X86/vec_shuffle-16.ll b/libclamav/c++/llvm/test/CodeGen/X86/vec_shuffle-16.ll index b3a5b769e..98133face 100644 --- a/libclamav/c++/llvm/test/CodeGen/X86/vec_shuffle-16.ll +++ b/libclamav/c++/llvm/test/CodeGen/X86/vec_shuffle-16.ll @@ -1,7 +1,7 @@ -; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse,-sse2 -mtriple=i386-apple-darwin -o %t -f +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse,-sse2 -mtriple=i386-apple-darwin -o %t ; RUN: grep shufps %t | count 4 ; RUN: grep movaps %t | count 2 -; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 -mtriple=i386-apple-darwin -o %t -f +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 -mtriple=i386-apple-darwin -o %t ; RUN: grep pshufd %t | count 4 ; RUN: not grep shufps %t ; RUN: not grep mov %t diff --git a/libclamav/c++/llvm/test/CodeGen/X86/vec_shuffle-22.ll b/libclamav/c++/llvm/test/CodeGen/X86/vec_shuffle-22.ll index d19f110fc..bd4ae259e 100644 --- a/libclamav/c++/llvm/test/CodeGen/X86/vec_shuffle-22.ll +++ b/libclamav/c++/llvm/test/CodeGen/X86/vec_shuffle-22.ll @@ -1,7 +1,7 @@ -; RUN: llvm-as < %s | llc -march=x86 -mcpu=pentium-m -o %t -f +; RUN: llvm-as < %s | llc -march=x86 -mcpu=pentium-m -o %t ; RUN: grep movlhps %t | count 1 ; RUN: grep pshufd %t | count 1 -; RUN: llvm-as < %s | llc -march=x86 -mcpu=core2 -o %t -f +; RUN: llvm-as < %s | llc -march=x86 -mcpu=core2 -o %t ; RUN: grep movlhps %t | count 1 ; RUN: grep movddup %t | count 1 diff --git a/libclamav/c++/llvm/test/CodeGen/X86/vec_shuffle-25.ll b/libclamav/c++/llvm/test/CodeGen/X86/vec_shuffle-25.ll index 18922aaac..ea7dddcca 100644 --- a/libclamav/c++/llvm/test/CodeGen/X86/vec_shuffle-25.ll +++ b/libclamav/c++/llvm/test/CodeGen/X86/vec_shuffle-25.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=x86 -mattr=sse41 -o %t -f +; RUN: llvm-as < %s | llc -march=x86 -mattr=sse41 -o %t ; RUN: grep unpcklps %t | count 3 ; RUN: grep unpckhps %t | count 1 diff --git a/libclamav/c++/llvm/test/CodeGen/X86/vec_shuffle-26.ll b/libclamav/c++/llvm/test/CodeGen/X86/vec_shuffle-26.ll index abd6e90b7..0a3112963 100644 --- a/libclamav/c++/llvm/test/CodeGen/X86/vec_shuffle-26.ll +++ b/libclamav/c++/llvm/test/CodeGen/X86/vec_shuffle-26.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=x86 -mattr=sse41 -o %t -f +; RUN: llvm-as < %s | llc -march=x86 -mattr=sse41 -o %t ; RUN: grep unpcklps %t | count 1 ; RUN: grep unpckhps %t | count 3 diff --git a/libclamav/c++/llvm/test/CodeGen/X86/vec_shuffle-27.ll b/libclamav/c++/llvm/test/CodeGen/X86/vec_shuffle-27.ll index 231ac0c3b..e687e833c 100644 --- a/libclamav/c++/llvm/test/CodeGen/X86/vec_shuffle-27.ll +++ b/libclamav/c++/llvm/test/CodeGen/X86/vec_shuffle-27.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=x86 -mattr=sse41 -o %t -f +; RUN: llvm-as < %s | llc -march=x86 -mattr=sse41 -o %t ; RUN: grep addps %t | count 2 ; RUN: grep mulps %t | count 2 ; RUN: grep subps %t | count 2 diff --git a/libclamav/c++/llvm/test/CodeGen/X86/vec_shuffle-28.ll b/libclamav/c++/llvm/test/CodeGen/X86/vec_shuffle-28.ll index fbd5bf556..e07ac7eae 100644 --- a/libclamav/c++/llvm/test/CodeGen/X86/vec_shuffle-28.ll +++ b/libclamav/c++/llvm/test/CodeGen/X86/vec_shuffle-28.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=x86 -mcpu=core2 -o %t -f +; RUN: llvm-as < %s | llc -march=x86 -mcpu=core2 -o %t ; RUN: grep pshufb %t | count 1 ; FIXME: this test has a superfluous punpcklqdq pre-pshufb currently. diff --git a/libclamav/c++/llvm/test/CodeGen/X86/vec_shuffle-3.ll b/libclamav/c++/llvm/test/CodeGen/X86/vec_shuffle-3.ll index 018b4cf1a..a3bca0f52 100644 --- a/libclamav/c++/llvm/test/CodeGen/X86/vec_shuffle-3.ll +++ b/libclamav/c++/llvm/test/CodeGen/X86/vec_shuffle-3.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 -o %t -f +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 -o %t ; RUN: grep movlhps %t | count 1 ; RUN: grep movhlps %t | count 1 diff --git a/libclamav/c++/llvm/test/CodeGen/X86/vec_shuffle-30.ll b/libclamav/c++/llvm/test/CodeGen/X86/vec_shuffle-30.ll index 50a3df8f0..eab4a66bd 100644 --- a/libclamav/c++/llvm/test/CodeGen/X86/vec_shuffle-30.ll +++ b/libclamav/c++/llvm/test/CodeGen/X86/vec_shuffle-30.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=x86 -mattr=sse41 -disable-mmx -o %t -f +; RUN: llvm-as < %s | llc -march=x86 -mattr=sse41 -disable-mmx -o %t ; RUN: grep pshufhw %t | grep 161 | count 1 ; RUN: grep shufps %t | count 1 ; RUN: not grep pslldq %t diff --git a/libclamav/c++/llvm/test/CodeGen/X86/vec_shuffle-31.ll b/libclamav/c++/llvm/test/CodeGen/X86/vec_shuffle-31.ll index b57ea4ece..7300ef323 100644 --- a/libclamav/c++/llvm/test/CodeGen/X86/vec_shuffle-31.ll +++ b/libclamav/c++/llvm/test/CodeGen/X86/vec_shuffle-31.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=x86 -mcpu=core2 -o %t -f +; RUN: llvm-as < %s | llc -march=x86 -mcpu=core2 -o %t ; RUN: grep pshufb %t | count 1 define <8 x i16> @shuf3(<8 x i16> %T0, <8 x i16> %T1) nounwind readnone { diff --git a/libclamav/c++/llvm/test/CodeGen/X86/vec_shuffle-35.ll b/libclamav/c++/llvm/test/CodeGen/X86/vec_shuffle-35.ll index 7be846884..83ce027e0 100644 --- a/libclamav/c++/llvm/test/CodeGen/X86/vec_shuffle-35.ll +++ b/libclamav/c++/llvm/test/CodeGen/X86/vec_shuffle-35.ll @@ -1,10 +1,10 @@ -; RUN: llvm-as < %s | llc -march=x86 -mcpu=yonah -stack-alignment=16 -o %t -f +; RUN: llvm-as < %s | llc -march=x86 -mcpu=yonah -stack-alignment=16 -o %t ; RUN: grep pextrw %t | count 13 ; RUN: grep pinsrw %t | count 14 ; RUN: grep rolw %t | count 13 ; RUN: not grep esp %t ; RUN: not grep ebp %t -; RUN: llvm-as < %s | llc -march=x86 -mcpu=core2 -stack-alignment=16 -o %t -f +; RUN: llvm-as < %s | llc -march=x86 -mcpu=core2 -stack-alignment=16 -o %t ; RUN: grep pshufb %t | count 3 define <16 x i8> @shuf1(<16 x i8> %T0) nounwind readnone { diff --git a/libclamav/c++/llvm/test/CodeGen/X86/vec_shuffle-36.ll b/libclamav/c++/llvm/test/CodeGen/X86/vec_shuffle-36.ll index 005118705..87cca739a 100644 --- a/libclamav/c++/llvm/test/CodeGen/X86/vec_shuffle-36.ll +++ b/libclamav/c++/llvm/test/CodeGen/X86/vec_shuffle-36.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=x86 -mattr=sse41 -o %t -f +; RUN: llvm-as < %s | llc -march=x86 -mattr=sse41 -o %t ; RUN: grep pshufb %t | count 1 diff --git a/libclamav/c++/llvm/test/CodeGen/X86/vec_shuffle-5.ll b/libclamav/c++/llvm/test/CodeGen/X86/vec_shuffle-5.ll index e356f2456..aa786fc3e 100644 --- a/libclamav/c++/llvm/test/CodeGen/X86/vec_shuffle-5.ll +++ b/libclamav/c++/llvm/test/CodeGen/X86/vec_shuffle-5.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 -o %t -f +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 -o %t ; RUN: grep movhlps %t | count 1 ; RUN: grep shufps %t | count 1 diff --git a/libclamav/c++/llvm/test/CodeGen/X86/vec_shuffle-6.ll b/libclamav/c++/llvm/test/CodeGen/X86/vec_shuffle-6.ll index f7c9f2daa..a98167feb 100644 --- a/libclamav/c++/llvm/test/CodeGen/X86/vec_shuffle-6.ll +++ b/libclamav/c++/llvm/test/CodeGen/X86/vec_shuffle-6.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 -o %t -f +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 -o %t ; RUN: grep movapd %t | count 1 ; RUN: grep movaps %t | count 1 ; RUN: grep movups %t | count 2 diff --git a/libclamav/c++/llvm/test/CodeGen/X86/vec_shuffle-7.ll b/libclamav/c++/llvm/test/CodeGen/X86/vec_shuffle-7.ll index fbcfac5b5..1cb89645a 100644 --- a/libclamav/c++/llvm/test/CodeGen/X86/vec_shuffle-7.ll +++ b/libclamav/c++/llvm/test/CodeGen/X86/vec_shuffle-7.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 -o %t -f +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 -o %t ; RUN: grep xorps %t | count 1 ; RUN: not grep shufps %t diff --git a/libclamav/c++/llvm/test/CodeGen/X86/vec_shuffle-9.ll b/libclamav/c++/llvm/test/CodeGen/X86/vec_shuffle-9.ll index 68577d455..1a29871fa 100644 --- a/libclamav/c++/llvm/test/CodeGen/X86/vec_shuffle-9.ll +++ b/libclamav/c++/llvm/test/CodeGen/X86/vec_shuffle-9.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 -o %t -f +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 -o %t ; RUN: grep punpck %t | count 2 ; RUN: not grep pextrw %t diff --git a/libclamav/c++/llvm/test/CodeGen/X86/vec_shuffle.ll b/libclamav/c++/llvm/test/CodeGen/X86/vec_shuffle.ll index f43aa1d4e..faad3eaae 100644 --- a/libclamav/c++/llvm/test/CodeGen/X86/vec_shuffle.ll +++ b/libclamav/c++/llvm/test/CodeGen/X86/vec_shuffle.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=x86 -mcpu=core2 -o %t -f +; RUN: llvm-as < %s | llc -march=x86 -mcpu=core2 -o %t ; RUN: grep shufp %t | count 1 ; RUN: grep movupd %t | count 1 ; RUN: grep pshufhw %t | count 1 diff --git a/libclamav/c++/llvm/test/CodeGen/X86/vec_splat-3.ll b/libclamav/c++/llvm/test/CodeGen/X86/vec_splat-3.ll index 1f1a21447..678df1147 100644 --- a/libclamav/c++/llvm/test/CodeGen/X86/vec_splat-3.ll +++ b/libclamav/c++/llvm/test/CodeGen/X86/vec_splat-3.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=x86 -mattr=sse41 -o %t -f +; RUN: llvm-as < %s | llc -march=x86 -mattr=sse41 -o %t ; RUN: grep punpcklwd %t | count 4 ; RUN: grep punpckhwd %t | count 4 ; RUN: grep "pshufd" %t | count 8 diff --git a/libclamav/c++/llvm/test/CodeGen/X86/vec_splat-4.ll b/libclamav/c++/llvm/test/CodeGen/X86/vec_splat-4.ll index 220e1cd34..f632faa04 100644 --- a/libclamav/c++/llvm/test/CodeGen/X86/vec_splat-4.ll +++ b/libclamav/c++/llvm/test/CodeGen/X86/vec_splat-4.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=x86 -mattr=sse41 -o %t -f +; RUN: llvm-as < %s | llc -march=x86 -mattr=sse41 -o %t ; RUN: grep punpcklbw %t | count 16 ; RUN: grep punpckhbw %t | count 16 ; RUN: grep "pshufd" %t | count 16 diff --git a/libclamav/c++/llvm/test/CodeGen/X86/vec_ss_load_fold.ll b/libclamav/c++/llvm/test/CodeGen/X86/vec_ss_load_fold.ll index 69900a686..9cfb1ecd9 100644 --- a/libclamav/c++/llvm/test/CodeGen/X86/vec_ss_load_fold.ll +++ b/libclamav/c++/llvm/test/CodeGen/X86/vec_ss_load_fold.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse,+sse2 -o %t -f +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse,+sse2 -o %t ; RUN: grep minss %t | grep CPI | count 2 ; RUN: grep CPI %t | not grep movss diff --git a/libclamav/c++/llvm/test/CodeGen/X86/vshift-1.ll b/libclamav/c++/llvm/test/CodeGen/X86/vshift-1.ll index d7a20e46c..66a8b4672 100644 --- a/libclamav/c++/llvm/test/CodeGen/X86/vshift-1.ll +++ b/libclamav/c++/llvm/test/CodeGen/X86/vshift-1.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 -disable-mmx -o %t -f +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 -disable-mmx -o %t ; RUN: grep psllq %t | count 2 ; RUN: grep pslld %t | count 2 ; RUN: grep psllw %t | count 2 diff --git a/libclamav/c++/llvm/test/CodeGen/X86/vshift-2.ll b/libclamav/c++/llvm/test/CodeGen/X86/vshift-2.ll index 080717442..d47a28f85 100644 --- a/libclamav/c++/llvm/test/CodeGen/X86/vshift-2.ll +++ b/libclamav/c++/llvm/test/CodeGen/X86/vshift-2.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 -disable-mmx -o %t -f +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 -disable-mmx -o %t ; RUN: grep psrlq %t | count 2 ; RUN: grep psrld %t | count 2 ; RUN: grep psrlw %t | count 2 @@ -61,4 +61,4 @@ entry: %lshr = lshr <8 x i16> %val, %7 store <8 x i16> %lshr, <8 x i16>* %dst ret void -} \ No newline at end of file +} diff --git a/libclamav/c++/llvm/test/CodeGen/X86/vshift-3.ll b/libclamav/c++/llvm/test/CodeGen/X86/vshift-3.ll index eea8ad1c7..ec087763d 100644 --- a/libclamav/c++/llvm/test/CodeGen/X86/vshift-3.ll +++ b/libclamav/c++/llvm/test/CodeGen/X86/vshift-3.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 -disable-mmx -o %t -f +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 -disable-mmx -o %t ; RUN: grep psrad %t | count 2 ; RUN: grep psraw %t | count 2 @@ -51,4 +51,4 @@ entry: %ashr = ashr <8 x i16> %val, %7 store <8 x i16> %ashr, <8 x i16>* %dst ret void -} \ No newline at end of file +} diff --git a/libclamav/c++/llvm/test/CodeGen/X86/vshift-4.ll b/libclamav/c++/llvm/test/CodeGen/X86/vshift-4.ll index 03ab95c0e..332e8515a 100644 --- a/libclamav/c++/llvm/test/CodeGen/X86/vshift-4.ll +++ b/libclamav/c++/llvm/test/CodeGen/X86/vshift-4.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 -disable-mmx -o %t -f +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 -disable-mmx -o %t ; RUN: grep psllq %t | count 1 ; RUN: grep pslld %t | count 3 ; RUN: grep psllw %t | count 2 diff --git a/libclamav/c++/llvm/test/CodeGen/X86/widen_arith-1.ll b/libclamav/c++/llvm/test/CodeGen/X86/widen_arith-1.ll index 419078174..1408cb6e1 100644 --- a/libclamav/c++/llvm/test/CodeGen/X86/widen_arith-1.ll +++ b/libclamav/c++/llvm/test/CodeGen/X86/widen_arith-1.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse42 -disable-mmx -o %t -f +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse42 -disable-mmx -o %t ; RUN: grep paddb %t | count 1 ; RUN: grep pextrb %t | count 1 ; RUN: not grep pextrw %t diff --git a/libclamav/c++/llvm/test/CodeGen/X86/widen_arith-2.ll b/libclamav/c++/llvm/test/CodeGen/X86/widen_arith-2.ll index de6cd0871..4ae57bc3a 100644 --- a/libclamav/c++/llvm/test/CodeGen/X86/widen_arith-2.ll +++ b/libclamav/c++/llvm/test/CodeGen/X86/widen_arith-2.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse42 -disable-mmx -o %t -f +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse42 -disable-mmx -o %t ; RUN: grep paddb %t | count 1 ; RUN: grep pand %t | count 1 diff --git a/libclamav/c++/llvm/test/CodeGen/X86/widen_arith-3.ll b/libclamav/c++/llvm/test/CodeGen/X86/widen_arith-3.ll index fbba4457e..a77aa3444 100644 --- a/libclamav/c++/llvm/test/CodeGen/X86/widen_arith-3.ll +++ b/libclamav/c++/llvm/test/CodeGen/X86/widen_arith-3.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse42 -disable-mmx -o %t -f +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse42 -disable-mmx -o %t ; RUN: grep paddw %t | count 1 ; RUN: grep movd %t | count 2 ; RUN: grep pextrw %t | count 1 diff --git a/libclamav/c++/llvm/test/CodeGen/X86/widen_arith-4.ll b/libclamav/c++/llvm/test/CodeGen/X86/widen_arith-4.ll index e19ab6574..8ffbba656 100644 --- a/libclamav/c++/llvm/test/CodeGen/X86/widen_arith-4.ll +++ b/libclamav/c++/llvm/test/CodeGen/X86/widen_arith-4.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse42 -disable-mmx -o %t -f +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse42 -disable-mmx -o %t ; RUN: grep psubw %t | count 1 ; RUN: grep pmullw %t | count 1 diff --git a/libclamav/c++/llvm/test/CodeGen/X86/widen_arith-5.ll b/libclamav/c++/llvm/test/CodeGen/X86/widen_arith-5.ll index 6ff099dd8..68d87a6c5 100644 --- a/libclamav/c++/llvm/test/CodeGen/X86/widen_arith-5.ll +++ b/libclamav/c++/llvm/test/CodeGen/X86/widen_arith-5.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse42 -disable-mmx -o %t -f +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse42 -disable-mmx -o %t ; RUN: grep pmulld %t | count 1 ; RUN: grep psubd %t | count 1 ; RUN: grep movaps %t | count 1 diff --git a/libclamav/c++/llvm/test/CodeGen/X86/widen_arith-6.ll b/libclamav/c++/llvm/test/CodeGen/X86/widen_arith-6.ll index 7b0bb33c0..226c39715 100644 --- a/libclamav/c++/llvm/test/CodeGen/X86/widen_arith-6.ll +++ b/libclamav/c++/llvm/test/CodeGen/X86/widen_arith-6.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse42 -disable-mmx -o %t -f +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse42 -disable-mmx -o %t ; RUN: grep mulps %t | count 1 ; RUN: grep addps %t | count 1 diff --git a/libclamav/c++/llvm/test/CodeGen/X86/widen_cast-1.ll b/libclamav/c++/llvm/test/CodeGen/X86/widen_cast-1.ll index ed8d27cde..58b1d4e03 100644 --- a/libclamav/c++/llvm/test/CodeGen/X86/widen_cast-1.ll +++ b/libclamav/c++/llvm/test/CodeGen/X86/widen_cast-1.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse42 -disable-mmx -o %t -f +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse42 -disable-mmx -o %t ; RUN: grep paddw %t | count 1 ; RUN: grep movd %t | count 1 ; RUN: grep pextrd %t | count 1 diff --git a/libclamav/c++/llvm/test/CodeGen/X86/widen_cast-2.ll b/libclamav/c++/llvm/test/CodeGen/X86/widen_cast-2.ll index 3b45ce308..d1b65adee 100644 --- a/libclamav/c++/llvm/test/CodeGen/X86/widen_cast-2.ll +++ b/libclamav/c++/llvm/test/CodeGen/X86/widen_cast-2.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse42 -disable-mmx -o %t -f +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse42 -disable-mmx -o %t ; RUN: grep pextrd %t | count 5 ; RUN: grep movd %t | count 3 diff --git a/libclamav/c++/llvm/test/CodeGen/X86/widen_cast-3.ll b/libclamav/c++/llvm/test/CodeGen/X86/widen_cast-3.ll index 33cc41f73..fb6ca5dc0 100644 --- a/libclamav/c++/llvm/test/CodeGen/X86/widen_cast-3.ll +++ b/libclamav/c++/llvm/test/CodeGen/X86/widen_cast-3.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse42 -disable-mmx -o %t -f +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse42 -disable-mmx -o %t ; RUN: grep paddd %t | count 1 ; RUN: grep pextrd %t | count 2 diff --git a/libclamav/c++/llvm/test/CodeGen/X86/widen_cast-4.ll b/libclamav/c++/llvm/test/CodeGen/X86/widen_cast-4.ll index b090cb161..0f3cddce3 100644 --- a/libclamav/c++/llvm/test/CodeGen/X86/widen_cast-4.ll +++ b/libclamav/c++/llvm/test/CodeGen/X86/widen_cast-4.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse42 -disable-mmx -o %t -f +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse42 -disable-mmx -o %t ; RUN: grep sarb %t | count 8 ; v8i8 that is widen to v16i8 then split diff --git a/libclamav/c++/llvm/test/CodeGen/X86/widen_cast-5.ll b/libclamav/c++/llvm/test/CodeGen/X86/widen_cast-5.ll index 76969429b..1c66bc1ea 100644 --- a/libclamav/c++/llvm/test/CodeGen/X86/widen_cast-5.ll +++ b/libclamav/c++/llvm/test/CodeGen/X86/widen_cast-5.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse42 -disable-mmx -o %t -f +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse42 -disable-mmx -o %t ; bitcast a i64 to v2i32 diff --git a/libclamav/c++/llvm/test/CodeGen/X86/widen_cast-6.ll b/libclamav/c++/llvm/test/CodeGen/X86/widen_cast-6.ll index 0fa1b7a76..730fc71c6 100644 --- a/libclamav/c++/llvm/test/CodeGen/X86/widen_cast-6.ll +++ b/libclamav/c++/llvm/test/CodeGen/X86/widen_cast-6.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse41 -disable-mmx -o %t -f +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse41 -disable-mmx -o %t ; RUN: grep movd %t | count 1 ; Test bit convert that requires widening in the operand. diff --git a/libclamav/c++/llvm/test/CodeGen/X86/widen_conv-1.ll b/libclamav/c++/llvm/test/CodeGen/X86/widen_conv-1.ll index a4aab7bb1..d6742449f 100644 --- a/libclamav/c++/llvm/test/CodeGen/X86/widen_conv-1.ll +++ b/libclamav/c++/llvm/test/CodeGen/X86/widen_conv-1.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse42 -disable-mmx -o %t -f +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse42 -disable-mmx -o %t ; RUN: grep pshufd %t | count 1 ; RUN: grep paddd %t | count 1 diff --git a/libclamav/c++/llvm/test/CodeGen/X86/widen_conv-2.ll b/libclamav/c++/llvm/test/CodeGen/X86/widen_conv-2.ll index 191a261cc..4f21896fe 100644 --- a/libclamav/c++/llvm/test/CodeGen/X86/widen_conv-2.ll +++ b/libclamav/c++/llvm/test/CodeGen/X86/widen_conv-2.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse42 -disable-mmx -o %t -f +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse42 -disable-mmx -o %t ; sign extension v2i32 to v2i16 diff --git a/libclamav/c++/llvm/test/CodeGen/X86/widen_conv-3.ll b/libclamav/c++/llvm/test/CodeGen/X86/widen_conv-3.ll index 154788d66..bf3df0469 100644 --- a/libclamav/c++/llvm/test/CodeGen/X86/widen_conv-3.ll +++ b/libclamav/c++/llvm/test/CodeGen/X86/widen_conv-3.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse42 -disable-mmx -o %t -f +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse42 -disable-mmx -o %t ; grep cvtsi2ss %t | count 1 ; sign to float v2i16 to v2f32 diff --git a/libclamav/c++/llvm/test/CodeGen/X86/widen_conv-4.ll b/libclamav/c++/llvm/test/CodeGen/X86/widen_conv-4.ll index 1ea5788ab..a0c45fc09 100644 --- a/libclamav/c++/llvm/test/CodeGen/X86/widen_conv-4.ll +++ b/libclamav/c++/llvm/test/CodeGen/X86/widen_conv-4.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse42 -disable-mmx -o %t -f +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse42 -disable-mmx -o %t ; unsigned to float v7i16 to v7f32 diff --git a/libclamav/c++/llvm/test/CodeGen/X86/widen_select-1.ll b/libclamav/c++/llvm/test/CodeGen/X86/widen_select-1.ll index 3d757b8a8..6efc453b9 100644 --- a/libclamav/c++/llvm/test/CodeGen/X86/widen_select-1.ll +++ b/libclamav/c++/llvm/test/CodeGen/X86/widen_select-1.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse42 -disable-mmx -o %t -f +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse42 -disable-mmx -o %t ; widening select v6i32 and then a sub diff --git a/libclamav/c++/llvm/test/CodeGen/X86/widen_shuffle-1.ll b/libclamav/c++/llvm/test/CodeGen/X86/widen_shuffle-1.ll index a676f33d6..c6ae17f66 100644 --- a/libclamav/c++/llvm/test/CodeGen/X86/widen_shuffle-1.ll +++ b/libclamav/c++/llvm/test/CodeGen/X86/widen_shuffle-1.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse42 -disable-mmx -o %t -f +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse42 -disable-mmx -o %t ; widening shuffle v3float and then a add diff --git a/libclamav/c++/llvm/test/CodeGen/X86/widen_shuffle-2.ll b/libclamav/c++/llvm/test/CodeGen/X86/widen_shuffle-2.ll index c2dfa3d27..2ce0189fb 100644 --- a/libclamav/c++/llvm/test/CodeGen/X86/widen_shuffle-2.ll +++ b/libclamav/c++/llvm/test/CodeGen/X86/widen_shuffle-2.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse42 -disable-mmx -o %t -f +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse42 -disable-mmx -o %t ; widening shuffle v3float and then a add diff --git a/libclamav/c++/llvm/test/CodeGen/X86/x86-64-mem.ll b/libclamav/c++/llvm/test/CodeGen/X86/x86-64-mem.ll index 7497362a1..3677ace09 100644 --- a/libclamav/c++/llvm/test/CodeGen/X86/x86-64-mem.ll +++ b/libclamav/c++/llvm/test/CodeGen/X86/x86-64-mem.ll @@ -1,10 +1,10 @@ -; RUN: llvm-as < %s | llc -mtriple=x86_64-apple-darwin -o %t1 -f +; RUN: llvm-as < %s | llc -mtriple=x86_64-apple-darwin -o %t1 ; RUN: grep GOTPCREL %t1 | count 4 ; RUN: grep %%rip %t1 | count 6 ; RUN: grep movq %t1 | count 6 ; RUN: grep leaq %t1 | count 1 ; RUN: llvm-as < %s | \ -; RUN: llc -mtriple=x86_64-pc-linux -relocation-model=static -o %t2 -f +; RUN: llc -mtriple=x86_64-pc-linux -relocation-model=static -o %t2 ; RUN: grep movl %t2 | count 2 ; RUN: grep movq %t2 | count 2 diff --git a/libclamav/c++/llvm/test/CodeGen/X86/x86-64-pic-1.ll b/libclamav/c++/llvm/test/CodeGen/X86/x86-64-pic-1.ll index f5303c6ad..016528a7d 100644 --- a/libclamav/c++/llvm/test/CodeGen/X86/x86-64-pic-1.ll +++ b/libclamav/c++/llvm/test/CodeGen/X86/x86-64-pic-1.ll @@ -1,5 +1,5 @@ ; RUN: llvm-as < %s | \ -; RUN: llc -mtriple=x86_64-pc-linux -relocation-model=pic -o %t1 -f +; RUN: llc -mtriple=x86_64-pc-linux -relocation-model=pic -o %t1 ; RUN: grep {call f@PLT} %t1 define void @g() { diff --git a/libclamav/c++/llvm/test/CodeGen/X86/x86-64-pic-10.ll b/libclamav/c++/llvm/test/CodeGen/X86/x86-64-pic-10.ll index bc0d0c09f..e0fcc0573 100644 --- a/libclamav/c++/llvm/test/CodeGen/X86/x86-64-pic-10.ll +++ b/libclamav/c++/llvm/test/CodeGen/X86/x86-64-pic-10.ll @@ -1,5 +1,5 @@ ; RUN: llvm-as < %s | \ -; RUN: llc -mtriple=x86_64-pc-linux -relocation-model=pic -o %t1 -f +; RUN: llc -mtriple=x86_64-pc-linux -relocation-model=pic -o %t1 ; RUN: grep {call g@PLT} %t1 @g = alias weak i32 ()* @f diff --git a/libclamav/c++/llvm/test/CodeGen/X86/x86-64-pic-11.ll b/libclamav/c++/llvm/test/CodeGen/X86/x86-64-pic-11.ll index e4032b527..e5cad9e16 100644 --- a/libclamav/c++/llvm/test/CodeGen/X86/x86-64-pic-11.ll +++ b/libclamav/c++/llvm/test/CodeGen/X86/x86-64-pic-11.ll @@ -1,5 +1,5 @@ ; RUN: llvm-as < %s | \ -; RUN: llc -mtriple=x86_64-pc-linux -relocation-model=pic -o %t1 -f +; RUN: llc -mtriple=x86_64-pc-linux -relocation-model=pic -o %t1 ; RUN: grep {call __fixunsxfti@PLT} %t1 define i128 @f(x86_fp80 %a) nounwind { diff --git a/libclamav/c++/llvm/test/CodeGen/X86/x86-64-pic-2.ll b/libclamav/c++/llvm/test/CodeGen/X86/x86-64-pic-2.ll index 39aecbadc..0fc62ff84 100644 --- a/libclamav/c++/llvm/test/CodeGen/X86/x86-64-pic-2.ll +++ b/libclamav/c++/llvm/test/CodeGen/X86/x86-64-pic-2.ll @@ -1,5 +1,5 @@ ; RUN: llvm-as < %s | \ -; RUN: llc -mtriple=x86_64-pc-linux -relocation-model=pic -o %t1 -f +; RUN: llc -mtriple=x86_64-pc-linux -relocation-model=pic -o %t1 ; RUN: grep {call f} %t1 ; RUN: not grep {call f@PLT} %t1 diff --git a/libclamav/c++/llvm/test/CodeGen/X86/x86-64-pic-3.ll b/libclamav/c++/llvm/test/CodeGen/X86/x86-64-pic-3.ll index 0f5f4b706..671b94d91 100644 --- a/libclamav/c++/llvm/test/CodeGen/X86/x86-64-pic-3.ll +++ b/libclamav/c++/llvm/test/CodeGen/X86/x86-64-pic-3.ll @@ -1,5 +1,5 @@ ; RUN: llvm-as < %s | \ -; RUN: llc -mtriple=x86_64-pc-linux -relocation-model=pic -o %t1 -f +; RUN: llc -mtriple=x86_64-pc-linux -relocation-model=pic -o %t1 ; RUN: grep {call f} %t1 ; RUN: not grep {call f@PLT} %t1 diff --git a/libclamav/c++/llvm/test/CodeGen/X86/x86-64-pic-4.ll b/libclamav/c++/llvm/test/CodeGen/X86/x86-64-pic-4.ll index f8dfa9278..10428dc6d 100644 --- a/libclamav/c++/llvm/test/CodeGen/X86/x86-64-pic-4.ll +++ b/libclamav/c++/llvm/test/CodeGen/X86/x86-64-pic-4.ll @@ -1,5 +1,5 @@ ; RUN: llvm-as < %s | \ -; RUN: llc -mtriple=x86_64-pc-linux -relocation-model=pic -o %t1 -f +; RUN: llc -mtriple=x86_64-pc-linux -relocation-model=pic -o %t1 ; RUN: grep {movq a@GOTPCREL(%rip),} %t1 @a = global i32 0 diff --git a/libclamav/c++/llvm/test/CodeGen/X86/x86-64-pic-5.ll b/libclamav/c++/llvm/test/CodeGen/X86/x86-64-pic-5.ll index 694755da5..a1f658fd2 100644 --- a/libclamav/c++/llvm/test/CodeGen/X86/x86-64-pic-5.ll +++ b/libclamav/c++/llvm/test/CodeGen/X86/x86-64-pic-5.ll @@ -1,5 +1,5 @@ ; RUN: llvm-as < %s | \ -; RUN: llc -mtriple=x86_64-pc-linux -relocation-model=pic -o %t1 -f +; RUN: llc -mtriple=x86_64-pc-linux -relocation-model=pic -o %t1 ; RUN: grep {movl a(%rip),} %t1 ; RUN: not grep GOTPCREL %t1 diff --git a/libclamav/c++/llvm/test/CodeGen/X86/x86-64-pic-6.ll b/libclamav/c++/llvm/test/CodeGen/X86/x86-64-pic-6.ll index 965a55010..88978188e 100644 --- a/libclamav/c++/llvm/test/CodeGen/X86/x86-64-pic-6.ll +++ b/libclamav/c++/llvm/test/CodeGen/X86/x86-64-pic-6.ll @@ -1,5 +1,5 @@ ; RUN: llvm-as < %s | \ -; RUN: llc -mtriple=x86_64-pc-linux -relocation-model=pic -o %t1 -f +; RUN: llc -mtriple=x86_64-pc-linux -relocation-model=pic -o %t1 ; RUN: grep {movl a(%rip),} %t1 ; RUN: not grep GOTPCREL %t1 diff --git a/libclamav/c++/llvm/test/CodeGen/X86/x86-64-pic-7.ll b/libclamav/c++/llvm/test/CodeGen/X86/x86-64-pic-7.ll index 95b7197ff..57e78b604 100644 --- a/libclamav/c++/llvm/test/CodeGen/X86/x86-64-pic-7.ll +++ b/libclamav/c++/llvm/test/CodeGen/X86/x86-64-pic-7.ll @@ -1,5 +1,5 @@ ; RUN: llvm-as < %s | \ -; RUN: llc -mtriple=x86_64-pc-linux -relocation-model=pic -o %t1 -f +; RUN: llc -mtriple=x86_64-pc-linux -relocation-model=pic -o %t1 ; RUN: grep {movq f@GOTPCREL(%rip),} %t1 define void ()* @g() nounwind { diff --git a/libclamav/c++/llvm/test/CodeGen/X86/x86-64-pic-8.ll b/libclamav/c++/llvm/test/CodeGen/X86/x86-64-pic-8.ll index 369e0cf36..6231991ef 100644 --- a/libclamav/c++/llvm/test/CodeGen/X86/x86-64-pic-8.ll +++ b/libclamav/c++/llvm/test/CodeGen/X86/x86-64-pic-8.ll @@ -1,5 +1,5 @@ ; RUN: llvm-as < %s | \ -; RUN: llc -mtriple=x86_64-pc-linux -relocation-model=pic -o %t1 -f +; RUN: llc -mtriple=x86_64-pc-linux -relocation-model=pic -o %t1 ; RUN: grep {leaq f(%rip),} %t1 ; RUN: not grep GOTPCREL %t1 diff --git a/libclamav/c++/llvm/test/CodeGen/X86/x86-64-pic-9.ll b/libclamav/c++/llvm/test/CodeGen/X86/x86-64-pic-9.ll index 175ec4e5e..3ad1d9558 100644 --- a/libclamav/c++/llvm/test/CodeGen/X86/x86-64-pic-9.ll +++ b/libclamav/c++/llvm/test/CodeGen/X86/x86-64-pic-9.ll @@ -1,5 +1,5 @@ ; RUN: llvm-as < %s | \ -; RUN: llc -mtriple=x86_64-pc-linux -relocation-model=pic -o %t1 -f +; RUN: llc -mtriple=x86_64-pc-linux -relocation-model=pic -o %t1 ; RUN: grep {leaq f(%rip),} %t1 ; RUN: not grep GOTPCREL %t1 diff --git a/libclamav/c++/llvm/test/DebugInfo/2008-11-06-Mem2Reg.ll b/libclamav/c++/llvm/test/DebugInfo/2008-11-06-Mem2Reg.ll deleted file mode 100644 index afb6f68db..000000000 --- a/libclamav/c++/llvm/test/DebugInfo/2008-11-06-Mem2Reg.ll +++ /dev/null @@ -1,56 +0,0 @@ -; RUN: llvm-as < %s | opt -mem2reg | llvm-dis | grep alloca | count 1 -target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" -target triple = "i386-apple-darwin9.5" - %llvm.dbg.anchor.type = type { i32, i32 } - %llvm.dbg.basictype.type = type { i32, { }*, i8*, { }*, i32, i64, i64, i64, i32, i32 } - %llvm.dbg.compile_unit.type = type { i32, { }*, i32, i8*, i8*, i8* } - %llvm.dbg.subprogram.type = type { i32, { }*, { }*, i8*, i8*, i8*, { }*, i32, { }*, i1, i1 } - %llvm.dbg.variable.type = type { i32, { }*, i8*, { }*, i32, { }* } -@llvm.dbg.subprogram = internal constant %llvm.dbg.subprogram.type { i32 393262, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to { }*), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([4 x i8]* @.str3, i32 0, i32 0), i8* getelementptr ([4 x i8]* @.str3, i32 0, i32 0), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 2, { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*), i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1] -@llvm.dbg.subprograms = linkonce constant %llvm.dbg.anchor.type { i32 393216, i32 46 }, section "llvm.metadata" ; <%llvm.dbg.anchor.type*> [#uses=1] -@llvm.dbg.compile_unit = internal constant %llvm.dbg.compile_unit.type { i32 393233, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to { }*), i32 1, i8* getelementptr ([7 x i8]* @.str, i32 0, i32 0), i8* getelementptr ([6 x i8]* @.str1, i32 0, i32 0), i8* getelementptr ([55 x i8]* @.str2, i32 0, i32 0) }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1] -@llvm.dbg.compile_units = linkonce constant %llvm.dbg.anchor.type { i32 393216, i32 17 }, section "llvm.metadata" ; <%llvm.dbg.anchor.type*> [#uses=1] -@.str = internal constant [7 x i8] c"adce.c\00", section "llvm.metadata" ; <[7 x i8]*> [#uses=1] -@.str1 = internal constant [6 x i8] c"/tmp/\00", section "llvm.metadata" ; <[6 x i8]*> [#uses=1] -@.str2 = internal constant [55 x i8] c"4.2.1 (Based on Apple Inc. build 5623) (LLVM build 00)\00", section "llvm.metadata" ; <[55 x i8]*> [#uses=1] -@.str3 = internal constant [4 x i8] c"foo\00", section "llvm.metadata" ; <[4 x i8]*> [#uses=1] -@llvm.dbg.basictype = internal constant %llvm.dbg.basictype.type { i32 393252, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([4 x i8]* @.str4, i32 0, i32 0), { }* null, i32 0, i64 32, i64 32, i64 0, i32 0, i32 5 }, section "llvm.metadata" ; <%llvm.dbg.basictype.type*> [#uses=1] -@.str4 = internal constant [4 x i8] c"int\00", section "llvm.metadata" ; <[4 x i8]*> [#uses=1] -@llvm.dbg.variable = internal constant %llvm.dbg.variable.type { i32 393472, { }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram to { }*), i8* getelementptr ([2 x i8]* @.str5, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 3, { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*) }, section "llvm.metadata" ; <%llvm.dbg.variable.type*> [#uses=1] -@.str5 = internal constant [2 x i8] c"i\00", section "llvm.metadata" ; <[2 x i8]*> [#uses=1] - -define i32 @foo() nounwind { -entry: - %retval = alloca i32 ; [#uses=2] - %i = alloca i32 ; [#uses=4] - %0 = alloca i32 ; [#uses=2] - %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] - call void @llvm.dbg.func.start({ }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram to { }*)) - %i1 = bitcast i32* %i to { }* ; <{ }*> [#uses=1] - call void @llvm.dbg.declare({ }* %i1, { }* bitcast (%llvm.dbg.variable.type* @llvm.dbg.variable to { }*)) - call void @llvm.dbg.stoppoint(i32 3, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*)) - store i32 4, i32* %i, align 4 - call void @llvm.dbg.stoppoint(i32 4, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*)) - %1 = load i32* %i, align 4 ; [#uses=1] - %2 = mul i32 %1, 84 ; [#uses=1] - store i32 %2, i32* %i, align 4 - call void @llvm.dbg.stoppoint(i32 5, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*)) - store i32 42, i32* %0, align 4 - %3 = load i32* %0, align 4 ; [#uses=1] - store i32 %3, i32* %retval, align 4 - br label %return - -return: ; preds = %entry - %retval2 = load i32* %retval ; [#uses=1] - call void @llvm.dbg.stoppoint(i32 5, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*)) - call void @llvm.dbg.region.end({ }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram to { }*)) - ret i32 %retval2 -} - -declare void @llvm.dbg.func.start({ }*) nounwind - -declare void @llvm.dbg.declare({ }*, { }*) nounwind - -declare void @llvm.dbg.stoppoint(i32, i32, { }*) nounwind - -declare void @llvm.dbg.region.end({ }*) nounwind diff --git a/libclamav/c++/llvm/test/DebugInfo/2008-11-19-InstCombine.ll b/libclamav/c++/llvm/test/DebugInfo/2008-11-19-InstCombine.ll deleted file mode 100644 index f99b964ba..000000000 --- a/libclamav/c++/llvm/test/DebugInfo/2008-11-19-InstCombine.ll +++ /dev/null @@ -1,44 +0,0 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep stoppoint | count 3 -target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" -target triple = "i386-apple-darwin9.5" - %llvm.dbg.anchor.type = type { i32, i32 } - %llvm.dbg.basictype.type = type { i32, { }*, i8*, { }*, i32, i64, i64, i64, i32, i32 } - %llvm.dbg.compile_unit.type = type { i32, { }*, i32, i8*, i8*, i8* } - %llvm.dbg.subprogram.type = type { i32, { }*, { }*, i8*, i8*, i8*, { }*, i32, { }*, i1, i1 } - %llvm.dbg.variable.type = type { i32, { }*, i8*, { }*, i32, { }* } -@llvm.dbg.subprogram = internal constant %llvm.dbg.subprogram.type { i32 393262, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to { }*), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([4 x i8]* @.str3, i32 0, i32 0), i8* getelementptr ([4 x i8]* @.str3, i32 0, i32 0), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 2, { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*), i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1] -@llvm.dbg.subprograms = linkonce constant %llvm.dbg.anchor.type { i32 393216, i32 46 }, section "llvm.metadata" ; <%llvm.dbg.anchor.type*> [#uses=1] -@llvm.dbg.compile_unit = internal constant %llvm.dbg.compile_unit.type { i32 393233, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to { }*), i32 1, i8* getelementptr ([7 x i8]* @.str, i32 0, i32 0), i8* getelementptr ([6 x i8]* @.str1, i32 0, i32 0), i8* getelementptr ([55 x i8]* @.str2, i32 0, i32 0) }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1] -@llvm.dbg.compile_units = linkonce constant %llvm.dbg.anchor.type { i32 393216, i32 17 }, section "llvm.metadata" ; <%llvm.dbg.anchor.type*> [#uses=1] -@.str = internal constant [7 x i8] c"adce.c\00", section "llvm.metadata" ; <[7 x i8]*> [#uses=1] -@.str1 = internal constant [6 x i8] c"/tmp/\00", section "llvm.metadata" ; <[6 x i8]*> [#uses=1] -@.str2 = internal constant [55 x i8] c"4.2.1 (Based on Apple Inc. build 5623) (LLVM build 00)\00", section "llvm.metadata" ; <[55 x i8]*> [#uses=1] -@.str3 = internal constant [4 x i8] c"foo\00", section "llvm.metadata" ; <[4 x i8]*> [#uses=1] -@llvm.dbg.basictype = internal constant %llvm.dbg.basictype.type { i32 393252, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([4 x i8]* @.str4, i32 0, i32 0), { }* null, i32 0, i64 32, i64 32, i64 0, i32 0, i32 5 }, section "llvm.metadata" ; <%llvm.dbg.basictype.type*> [#uses=1] -@.str4 = internal constant [4 x i8] c"int\00", section "llvm.metadata" ; <[4 x i8]*> [#uses=1] -@llvm.dbg.variable = internal constant %llvm.dbg.variable.type { i32 393472, { }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram to { }*), i8* getelementptr ([2 x i8]* @.str5, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 3, { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*) }, section "llvm.metadata" ; <%llvm.dbg.variable.type*> [#uses=0] -@.str5 = internal constant [2 x i8] c"i\00", section "llvm.metadata" ; <[2 x i8]*> [#uses=1] - -define i32 @foo() nounwind { -entry: - %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] - call void @llvm.dbg.func.start({ }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram to { }*)) - call void @llvm.dbg.stoppoint(i32 3, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*)) - call void @llvm.dbg.stoppoint(i32 4, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*)) - %0 = mul i32 4, 84 ; [#uses=0] - call void @llvm.dbg.stoppoint(i32 5, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*)) - br label %return - -return: ; preds = %entry - call void @llvm.dbg.stoppoint(i32 5, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*)) - call void @llvm.dbg.region.end({ }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram to { }*)) - ret i32 42 -} - -declare void @llvm.dbg.func.start({ }*) nounwind - -declare void @llvm.dbg.declare({ }*, { }*) nounwind - -declare void @llvm.dbg.stoppoint(i32, i32, { }*) nounwind - -declare void @llvm.dbg.region.end({ }*) nounwind diff --git a/libclamav/c++/llvm/test/DebugInfo/2009-01-15-RecordVariableCrash.ll b/libclamav/c++/llvm/test/DebugInfo/2009-01-15-RecordVariableCrash.ll index 68268bac4..3ed85c3e4 100644 --- a/libclamav/c++/llvm/test/DebugInfo/2009-01-15-RecordVariableCrash.ll +++ b/libclamav/c++/llvm/test/DebugInfo/2009-01-15-RecordVariableCrash.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -f -o /dev/null -verify-dom-info +; RUN: llvm-as < %s | llc -o /dev/null -verify-dom-info %llvm.dbg.anchor.type = type { i32, i32 } %llvm.dbg.basictype.type = type { i32, { }*, i8*, { }*, i32, i64, i64, i64, i32, i32, i8*, i8* } %llvm.dbg.compile_unit.type = type { i32, { }*, i32, i8*, i8*, i8* } diff --git a/libclamav/c++/llvm/test/DebugInfo/2009-01-15-dbg_declare.ll b/libclamav/c++/llvm/test/DebugInfo/2009-01-15-dbg_declare.ll index 37c163021..2a7823bbd 100644 --- a/libclamav/c++/llvm/test/DebugInfo/2009-01-15-dbg_declare.ll +++ b/libclamav/c++/llvm/test/DebugInfo/2009-01-15-dbg_declare.ll @@ -1,8 +1,5 @@ +; RUN: llvm-as < %s | llc -o /dev/null -; RUN: llvm-as < %s | llc -f -o /dev/null -; XFAIL: powerpc - -target triple = "powerpc-apple-darwin9.5" %llvm.dbg.variable.type = type { i32, { }*, i8*, { }*, i32, { }*, i8*, i8* } @llvm.dbg.variable24 = external constant %llvm.dbg.variable.type ; <%llvm.dbg.variable.type*> [#uses=1] diff --git a/libclamav/c++/llvm/test/DebugInfo/2009-01-15-member.ll b/libclamav/c++/llvm/test/DebugInfo/2009-01-15-member.ll index 7eb81f8f3..dc72bb7ce 100644 --- a/libclamav/c++/llvm/test/DebugInfo/2009-01-15-member.ll +++ b/libclamav/c++/llvm/test/DebugInfo/2009-01-15-member.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -f -o /dev/null +; RUN: llvm-as < %s | llc -o /dev/null %llvm.dbg.anchor.type = type { i32, i32 } %llvm.dbg.basictype.type = type { i32, { }*, i8*, { }*, i32, i64, i64, i64, i32, i32, i8*, i8* } %llvm.dbg.compile_unit.type = type { i32, { }*, i32, i8*, i8*, i8* } @@ -27,4 +27,4 @@ @llvm.dbg.composite11 = internal constant %llvm.dbg.composite.type { i32 458771, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([2 x i8]* @.str3, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 3, i64 64, i64 32, i64 0, i32 0, { }* null, { }* bitcast ([2 x { }*]* @llvm.dbg.array to { }*), i8* getelementptr ([4 x i8]* @.str, i32 0, i32 0), i8* getelementptr ([6 x i8]* @.str1, i32 0, i32 0) }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1] @llvm.dbg.global_variables = linkonce constant %llvm.dbg.anchor.type { i32 458752, i32 52 }, section "llvm.metadata" ; <%llvm.dbg.anchor.type*> [#uses=1] @.str12 = internal constant [3 x i8] c"s2\00", section "llvm.metadata" ; <[3 x i8]*> [#uses=1] -@llvm.dbg.global_variable = internal constant %llvm.dbg.global_variable.type { i32 458804, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.global_variables to { }*), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([3 x i8]* @.str12, i32 0, i32 0), i8* getelementptr ([3 x i8]* @.str12, i32 0, i32 0), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 6, { }* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite11 to { }*), i1 false, i1 true, { }* bitcast (%struct.s* @s2 to { }*), i8* getelementptr ([4 x i8]* @.str, i32 0, i32 0), i8* getelementptr ([6 x i8]* @.str1, i32 0, i32 0) }, section "llvm.metadata" ; <%llvm.dbg.global_variable.type*> [#uses=0] \ No newline at end of file +@llvm.dbg.global_variable = internal constant %llvm.dbg.global_variable.type { i32 458804, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.global_variables to { }*), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([3 x i8]* @.str12, i32 0, i32 0), i8* getelementptr ([3 x i8]* @.str12, i32 0, i32 0), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 6, { }* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite11 to { }*), i1 false, i1 true, { }* bitcast (%struct.s* @s2 to { }*), i8* getelementptr ([4 x i8]* @.str, i32 0, i32 0), i8* getelementptr ([6 x i8]* @.str1, i32 0, i32 0) }, section "llvm.metadata" ; <%llvm.dbg.global_variable.type*> [#uses=0] diff --git a/libclamav/c++/llvm/test/DebugInfo/2009-01-28-ArrayType.ll b/libclamav/c++/llvm/test/DebugInfo/2009-01-28-ArrayType.ll deleted file mode 100644 index 81905953b..000000000 --- a/libclamav/c++/llvm/test/DebugInfo/2009-01-28-ArrayType.ll +++ /dev/null @@ -1,23 +0,0 @@ -; RUN: llvm-as < %s | llc | grep 0x49 | count 3 -; Count number of DW_AT_Type attributes. -target triple = "i386-apple-darwin*" - %llvm.dbg.anchor.type = type { i32, i32 } - %llvm.dbg.basictype.type = type { i32, { }*, i8*, { }*, i32, i64, i64, i64, i32, i32 } - %llvm.dbg.compile_unit.type = type { i32, { }*, i32, i8*, i8*, i8*, i1, i1, i8* } - %llvm.dbg.composite.type = type { i32, { }*, i8*, { }*, i32, i64, i64, i64, i32, { }*, { }* } - %llvm.dbg.global_variable.type = type { i32, { }*, { }*, i8*, i8*, i8*, { }*, i32, { }*, i1, i1, { }* } - %llvm.dbg.subrange.type = type { i32, i64, i64 } -@llvm.dbg.compile_units = linkonce constant %llvm.dbg.anchor.type { i32 458752, i32 17 }, section "llvm.metadata" ; <%llvm.dbg.anchor.type*> [#uses=1] -@.str = internal constant [8 x i8] c"array.c\00", section "llvm.metadata" ; <[8 x i8]*> [#uses=1] -@.str1 = internal constant [26 x i8] c"/Volumes/Nanpura/dbg.test\00", section "llvm.metadata" ; <[26 x i8]*> [#uses=1] -@.str2 = internal constant [52 x i8] c"4.2.1 (Based on Apple Inc. build 5636) (LLVM build)\00", section "llvm.metadata" ; <[52 x i8]*> [#uses=1] -@llvm.dbg.compile_unit = internal constant %llvm.dbg.compile_unit.type { i32 458769, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to { }*), i32 1, i8* getelementptr ([8 x i8]* @.str, i32 0, i32 0), i8* getelementptr ([26 x i8]* @.str1, i32 0, i32 0), i8* getelementptr ([52 x i8]* @.str2, i32 0, i32 0), i1 true, i1 false, i8* null }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1] -@c = common global [3 x i32] zeroinitializer ; <[3 x i32]*> [#uses=1] -@llvm.dbg.subrange = internal constant %llvm.dbg.subrange.type { i32 458785, i64 0, i64 2 }, section "llvm.metadata" ; <%llvm.dbg.subrange.type*> [#uses=1] -@llvm.dbg.array = internal constant [1 x { }*] [ { }* bitcast (%llvm.dbg.subrange.type* @llvm.dbg.subrange to { }*) ], section "llvm.metadata" ; <[1 x { }*]*> [#uses=1] -@.str3 = internal constant [4 x i8] c"int\00", section "llvm.metadata" ; <[4 x i8]*> [#uses=1] -@llvm.dbg.basictype = internal constant %llvm.dbg.basictype.type { i32 458788, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([4 x i8]* @.str3, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 32, i64 32, i64 0, i32 0, i32 5 }, section "llvm.metadata" ; <%llvm.dbg.basictype.type*> [#uses=1] -@llvm.dbg.composite = internal constant %llvm.dbg.composite.type { i32 458753, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 96, i64 32, i64 0, i32 0, { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*), { }* bitcast ([1 x { }*]* @llvm.dbg.array to { }*) }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1] -@llvm.dbg.global_variables = linkonce constant %llvm.dbg.anchor.type { i32 458752, i32 52 }, section "llvm.metadata" ; <%llvm.dbg.anchor.type*> [#uses=1] -@.str4 = internal constant [2 x i8] c"c\00", section "llvm.metadata" ; <[2 x i8]*> [#uses=1] -@llvm.dbg.global_variable = internal constant %llvm.dbg.global_variable.type { i32 458804, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.global_variables to { }*), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([2 x i8]* @.str4, i32 0, i32 0), i8* getelementptr ([2 x i8]* @.str4, i32 0, i32 0), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 2, { }* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite to { }*), i1 false, i1 true, { }* bitcast ([3 x i32]* @c to { }*) }, section "llvm.metadata" ; <%llvm.dbg.global_variable.type*> [#uses=0] diff --git a/libclamav/c++/llvm/test/DebugInfo/2009-01-29-HeaderLocation.ll b/libclamav/c++/llvm/test/DebugInfo/2009-01-29-HeaderLocation.ll deleted file mode 100644 index a201bd5a0..000000000 --- a/libclamav/c++/llvm/test/DebugInfo/2009-01-29-HeaderLocation.ll +++ /dev/null @@ -1,46 +0,0 @@ -; RUN: llvm-as < %s | llc | grep "\\"m.h\\"" | count 1 -target triple = "i386-apple-darwin9.6" - %llvm.dbg.anchor.type = type { i32, i32 } - %llvm.dbg.basictype.type = type { i32, { }*, i8*, { }*, i32, i64, i64, i64, i32, i32 } - %llvm.dbg.compile_unit.type = type { i32, { }*, i32, i8*, i8*, i8*, i1, i1, i8* } - %llvm.dbg.composite.type = type { i32, { }*, i8*, { }*, i32, i64, i64, i64, i32, { }*, { }* } - %llvm.dbg.subprogram.type = type { i32, { }*, { }*, i8*, i8*, i8*, { }*, i32, { }*, i1, i1 } -@llvm.dbg.compile_units = linkonce constant %llvm.dbg.anchor.type { i32 458752, i32 17 }, section "llvm.metadata" ; <%llvm.dbg.anchor.type*> [#uses=1] -@.str = internal constant [4 x i8] c"m.c\00", section "llvm.metadata" ; <[4 x i8]*> [#uses=1] -@.str1 = internal constant [26 x i8] c"/Volumes/Nanpura/dbg.test\00", section "llvm.metadata" ; <[26 x i8]*> [#uses=1] -@.str2 = internal constant [52 x i8] c"4.2.1 (Based on Apple Inc. build 5636) (LLVM build)\00", section "llvm.metadata" ; <[52 x i8]*> [#uses=1] -@llvm.dbg.compile_unit = internal constant %llvm.dbg.compile_unit.type { i32 458769, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to { }*), i32 1, i8* getelementptr ([4 x i8]* @.str, i32 0, i32 0), i8* getelementptr ([26 x i8]* @.str1, i32 0, i32 0), i8* getelementptr ([52 x i8]* @.str2, i32 0, i32 0), i1 true, i1 false, i8* null }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1] -@.str3 = internal constant [4 x i8] c"int\00", section "llvm.metadata" ; <[4 x i8]*> [#uses=1] -@llvm.dbg.basictype = internal constant %llvm.dbg.basictype.type { i32 458788, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([4 x i8]* @.str3, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 32, i64 32, i64 0, i32 0, i32 5 }, section "llvm.metadata" ; <%llvm.dbg.basictype.type*> [#uses=1] -@llvm.dbg.array = internal constant [1 x { }*] [ { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*) ], section "llvm.metadata" ; <[1 x { }*]*> [#uses=1] -@llvm.dbg.composite = internal constant %llvm.dbg.composite.type { i32 458773, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 0, i64 0, i64 0, i32 0, { }* null, { }* bitcast ([1 x { }*]* @llvm.dbg.array to { }*) }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1] -@.str4 = internal constant [4 x i8] c"m.h\00", section "llvm.metadata" ; <[4 x i8]*> [#uses=1] -@llvm.dbg.compile_unit5 = internal constant %llvm.dbg.compile_unit.type { i32 458769, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to { }*), i32 1, i8* getelementptr ([4 x i8]* @.str4, i32 0, i32 0), i8* getelementptr ([26 x i8]* @.str1, i32 0, i32 0), i8* getelementptr ([52 x i8]* @.str2, i32 0, i32 0), i1 false, i1 false, i8* null }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1] -@llvm.dbg.subprograms = linkonce constant %llvm.dbg.anchor.type { i32 458752, i32 46 }, section "llvm.metadata" ; <%llvm.dbg.anchor.type*> [#uses=1] -@.str6 = internal constant [5 x i8] c"main\00", section "llvm.metadata" ; <[5 x i8]*> [#uses=1] -@llvm.dbg.subprogram = internal constant %llvm.dbg.subprogram.type { i32 458798, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to { }*), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([5 x i8]* @.str6, i32 0, i32 0), i8* getelementptr ([5 x i8]* @.str6, i32 0, i32 0), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to { }*), i32 2, { }* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite to { }*), i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1] - -define i32 @main() nounwind { -entry: - %retval = alloca i32 ; [#uses=2] - %0 = alloca i32 ; [#uses=2] - %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] - call void @llvm.dbg.func.start({ }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram to { }*)) - call void @llvm.dbg.stoppoint(i32 2, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to { }*)) - store i32 0, i32* %0, align 4 - %1 = load i32* %0, align 4 ; [#uses=1] - store i32 %1, i32* %retval, align 4 - br label %return - -return: ; preds = %entry - %retval1 = load i32* %retval ; [#uses=1] - call void @llvm.dbg.stoppoint(i32 2, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit5 to { }*)) - call void @llvm.dbg.region.end({ }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram to { }*)) - ret i32 %retval1 -} - -declare void @llvm.dbg.func.start({ }*) nounwind - -declare void @llvm.dbg.stoppoint(i32, i32, { }*) nounwind - -declare void @llvm.dbg.region.end({ }*) nounwind diff --git a/libclamav/c++/llvm/test/DebugInfo/2009-01-29-MethodDeclaration.ll b/libclamav/c++/llvm/test/DebugInfo/2009-01-29-MethodDeclaration.ll deleted file mode 100644 index 6d1e1e91b..000000000 --- a/libclamav/c++/llvm/test/DebugInfo/2009-01-29-MethodDeclaration.ll +++ /dev/null @@ -1,32 +0,0 @@ -; RUN: llvm-as < %s | llc | grep 0x3C | count 1 -; Check DW_AT_declaration attribute for class method foo. -target triple = "i386-apple-darwin*" - %llvm.dbg.anchor.type = type { i32, i32 } - %llvm.dbg.basictype.type = type { i32, { }*, i8*, { }*, i32, i64, i64, i64, i32, i32, i8*, i8* } - %llvm.dbg.compile_unit.type = type { i32, { }*, i32, i8*, i8*, i8*, i1, i8* } - %llvm.dbg.composite.type = type { i32, { }*, i8*, { }*, i32, i64, i64, i64, i32, { }*, { }*, i8*, i8* } - %llvm.dbg.derivedtype.type = type { i32, { }*, i8*, { }*, i32, i64, i64, i64, i32, { }*, i8*, i8* } - %llvm.dbg.global_variable.type = type { i32, { }*, { }*, i8*, i8*, i8*, { }*, i32, { }*, i1, i1, { }*, i8*, i8* } - %llvm.dbg.subprogram.type = type { i32, { }*, { }*, i8*, i8*, i8*, { }*, i32, { }*, i1, i1, i8*, i8* } - %struct.A = type <{ i8 }> -@llvm.dbg.compile_units = linkonce constant %llvm.dbg.anchor.type { i32 458752, i32 17 }, section "llvm.metadata" ; <%llvm.dbg.anchor.type*> [#uses=1] -@.str = internal constant [6 x i8] c"cl.cc\00", section "llvm.metadata" ; <[6 x i8]*> [#uses=1] -@.str1 = internal constant [26 x i8] c"/Volumes/Nanpura/dbg.test\00", section "llvm.metadata" ; <[26 x i8]*> [#uses=1] -@.str2 = internal constant [52 x i8] c"4.2.1 (Based on Apple Inc. build 5636) (LLVM build)\00", section "llvm.metadata" ; <[52 x i8]*> [#uses=1] -@llvm.dbg.compile_unit = internal constant %llvm.dbg.compile_unit.type { i32 458769, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to { }*), i32 4, i8* getelementptr ([6 x i8]* @.str, i32 0, i32 0), i8* getelementptr ([26 x i8]* @.str1, i32 0, i32 0), i8* getelementptr ([52 x i8]* @.str2, i32 0, i32 0), i1 false, i8* null }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1] -@a = global %struct.A zeroinitializer ; <%struct.A*> [#uses=1] -@.str3 = internal constant [2 x i8] c"A\00", section "llvm.metadata" ; <[2 x i8]*> [#uses=1] -@.str4 = internal constant [4 x i8] c"int\00", section "llvm.metadata" ; <[4 x i8]*> [#uses=1] -@llvm.dbg.basictype = internal constant %llvm.dbg.basictype.type { i32 458788, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([4 x i8]* @.str4, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 32, i64 32, i64 0, i32 0, i32 5, i8* null, i8* null }, section "llvm.metadata" ; <%llvm.dbg.basictype.type*> [#uses=1] -@llvm.dbg.derivedtype = internal constant %llvm.dbg.derivedtype.type { i32 458767, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 32, i64 32, i64 0, i32 0, { }* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite9 to { }*), i8* null, i8* null }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1] -@llvm.dbg.array = internal constant [2 x { }*] [ { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*), { }* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype to { }*) ], section "llvm.metadata" ; <[2 x { }*]*> [#uses=1] -@llvm.dbg.composite5 = internal constant %llvm.dbg.composite.type { i32 458773, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 0, i64 0, i64 0, i32 0, { }* null, { }* bitcast ([2 x { }*]* @llvm.dbg.array to { }*), i8* null, i8* null }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1] -@llvm.dbg.subprograms = linkonce constant %llvm.dbg.anchor.type { i32 458752, i32 46 }, section "llvm.metadata" ; <%llvm.dbg.anchor.type*> [#uses=1] -@.str6 = internal constant [4 x i8] c"foo\00", section "llvm.metadata" ; <[4 x i8]*> [#uses=1] -@.str7 = internal constant [12 x i8] c"_ZN1A3fooEv\00", section "llvm.metadata" ; <[12 x i8]*> [#uses=1] -@llvm.dbg.subprogram = internal constant %llvm.dbg.subprogram.type { i32 458798, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to { }*), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([4 x i8]* @.str6, i32 0, i32 0), i8* getelementptr ([4 x i8]* @.str6, i32 0, i32 0), i8* getelementptr ([12 x i8]* @.str7, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 4, { }* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite5 to { }*), i1 false, i1 false, i8* getelementptr ([6 x i8]* @.str, i32 0, i32 0), i8* getelementptr ([26 x i8]* @.str1, i32 0, i32 0) }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1] -@llvm.dbg.array8 = internal constant [1 x { }*] [ { }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram to { }*) ], section "llvm.metadata" ; <[1 x { }*]*> [#uses=1] -@llvm.dbg.composite9 = internal constant %llvm.dbg.composite.type { i32 458771, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([2 x i8]* @.str3, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 2, i64 8, i64 8, i64 0, i32 0, { }* null, { }* bitcast ([1 x { }*]* @llvm.dbg.array8 to { }*), i8* getelementptr ([6 x i8]* @.str, i32 0, i32 0), i8* getelementptr ([26 x i8]* @.str1, i32 0, i32 0) }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1] -@llvm.dbg.global_variables = linkonce constant %llvm.dbg.anchor.type { i32 458752, i32 52 }, section "llvm.metadata" ; <%llvm.dbg.anchor.type*> [#uses=1] -@.str10 = internal constant [2 x i8] c"a\00", section "llvm.metadata" ; <[2 x i8]*> [#uses=1] -@llvm.dbg.global_variable = internal constant %llvm.dbg.global_variable.type { i32 458804, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.global_variables to { }*), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([2 x i8]* @.str10, i32 0, i32 0), i8* getelementptr ([2 x i8]* @.str10, i32 0, i32 0), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 7, { }* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite9 to { }*), i1 false, i1 true, { }* bitcast (%struct.A* @a to { }*), i8* getelementptr ([6 x i8]* @.str, i32 0, i32 0), i8* getelementptr ([26 x i8]* @.str1, i32 0, i32 0) }, section "llvm.metadata" ; <%llvm.dbg.global_variable.type*> [#uses=0] diff --git a/libclamav/c++/llvm/test/DebugInfo/2009-01-30-Method.ll b/libclamav/c++/llvm/test/DebugInfo/2009-01-30-Method.ll deleted file mode 100644 index d49076cf3..000000000 --- a/libclamav/c++/llvm/test/DebugInfo/2009-01-30-Method.ll +++ /dev/null @@ -1,103 +0,0 @@ -; RUN: llvm-as < %s | llc -O0 | grep "\\"foo" | count 3 -; 1 declaration, 1 definition and 1 pubnames entry. -target triple = "i386-apple-darwin*" - %llvm.dbg.anchor.type = type { i32, i32 } - %llvm.dbg.basictype.type = type { i32, { }*, i8*, { }*, i32, i64, i64, i64, i32, i32 } - %llvm.dbg.compile_unit.type = type { i32, { }*, i32, i8*, i8*, i8*, i1, i1, i8* } - %llvm.dbg.composite.type = type { i32, { }*, i8*, { }*, i32, i64, i64, i64, i32, { }*, { }* } - %llvm.dbg.derivedtype.type = type { i32, { }*, i8*, { }*, i32, i64, i64, i64, i32, { }* } - %llvm.dbg.subprogram.type = type { i32, { }*, { }*, i8*, i8*, i8*, { }*, i32, { }*, i1, i1 } - %llvm.dbg.variable.type = type { i32, { }*, i8*, { }*, i32, { }* } - %struct.Fibonancci = type { i32 } -@llvm.dbg.compile_units = linkonce constant %llvm.dbg.anchor.type { i32 458752, i32 17 }, section "llvm.metadata" ; <%llvm.dbg.anchor.type*> [#uses=1] -@.str = internal constant [10 x i8] c"method.cc\00", section "llvm.metadata" ; <[10 x i8]*> [#uses=1] -@.str1 = internal constant [64 x i8] c"/Volumes/Nanpura/mainline/llvmgcc42.build/gcc/../../../dbg.test\00", section "llvm.metadata" ; <[64 x i8]*> [#uses=1] -@.str2 = internal constant [52 x i8] c"4.2.1 (Based on Apple Inc. build 5636) (LLVM build)\00", section "llvm.metadata" ; <[52 x i8]*> [#uses=1] -@llvm.dbg.compile_unit = internal constant %llvm.dbg.compile_unit.type { i32 458769, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to { }*), i32 4, i8* getelementptr ([10 x i8]* @.str, i32 0, i32 0), i8* getelementptr ([64 x i8]* @.str1, i32 0, i32 0), i8* getelementptr ([52 x i8]* @.str2, i32 0, i32 0), i1 true, i1 false, i8* null }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1] -@.str3 = internal constant [11 x i8] c"Fibonancci\00", section "llvm.metadata" ; <[11 x i8]*> [#uses=1] -@.str4 = internal constant [4 x i8] c"int\00", section "llvm.metadata" ; <[4 x i8]*> [#uses=1] -@llvm.dbg.basictype = internal constant %llvm.dbg.basictype.type { i32 458788, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([4 x i8]* @.str4, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 32, i64 32, i64 0, i32 0, i32 5 }, section "llvm.metadata" ; <%llvm.dbg.basictype.type*> [#uses=1] -@.str5 = internal constant [2 x i8] c"N\00", section "llvm.metadata" ; <[2 x i8]*> [#uses=1] -@llvm.dbg.derivedtype = internal constant %llvm.dbg.derivedtype.type { i32 458765, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([2 x i8]* @.str5, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 5, i64 32, i64 32, i64 0, i32 1, { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1] -@llvm.dbg.derivedtype6 = internal constant %llvm.dbg.derivedtype.type { i32 458767, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 32, i64 32, i64 0, i32 0, { }* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite11 to { }*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1] -@llvm.dbg.array = internal constant [3 x { }*] [ { }* null, { }* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype6 to { }*), { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*) ], section "llvm.metadata" ; <[3 x { }*]*> [#uses=1] -@llvm.dbg.composite7 = internal constant %llvm.dbg.composite.type { i32 458773, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 0, i64 0, i64 0, i32 0, { }* null, { }* bitcast ([3 x { }*]* @llvm.dbg.array to { }*) }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1] -@llvm.dbg.subprograms = linkonce constant %llvm.dbg.anchor.type { i32 458752, i32 46 }, section "llvm.metadata" ; <%llvm.dbg.anchor.type*> [#uses=1] -@.str8 = internal constant [4 x i8] c"foo\00", section "llvm.metadata" ; <[4 x i8]*> [#uses=1] -@.str9 = internal constant [22 x i8] c"_ZN10Fibonancci3fooEi\00", section "llvm.metadata" ; <[22 x i8]*> [#uses=1] -@llvm.dbg.subprogram = internal constant %llvm.dbg.subprogram.type { i32 458798, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to { }*), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([4 x i8]* @.str8, i32 0, i32 0), i8* getelementptr ([4 x i8]* @.str8, i32 0, i32 0), i8* getelementptr ([22 x i8]* @.str9, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 10, { }* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite7 to { }*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1] -@llvm.dbg.array10 = internal constant [2 x { }*] [ { }* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype to { }*), { }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram to { }*) ], section "llvm.metadata" ; <[2 x { }*]*> [#uses=1] -@llvm.dbg.composite11 = internal constant %llvm.dbg.composite.type { i32 458771, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([11 x i8]* @.str3, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 3, i64 32, i64 32, i64 0, i32 0, { }* null, { }* bitcast ([2 x { }*]* @llvm.dbg.array10 to { }*) }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1] -@llvm.dbg.derivedtype12 = internal constant %llvm.dbg.derivedtype.type { i32 458767, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 32, i64 32, i64 0, i32 0, { }* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite11 to { }*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1] -@llvm.dbg.array13 = internal constant [3 x { }*] [ { }* null, { }* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype12 to { }*), { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*) ], section "llvm.metadata" ; <[3 x { }*]*> [#uses=1] -@llvm.dbg.composite = internal constant %llvm.dbg.composite.type { i32 458773, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 0, i64 0, i64 0, i32 0, { }* null, { }* bitcast ([3 x { }*]* @llvm.dbg.array13 to { }*) }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1] -@llvm.dbg.subprogram14 = internal constant %llvm.dbg.subprogram.type { i32 458798, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to { }*), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([4 x i8]* @.str8, i32 0, i32 0), i8* getelementptr ([4 x i8]* @.str8, i32 0, i32 0), i8* getelementptr ([22 x i8]* @.str9, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 10, { }* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite to { }*), i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1] -@llvm.dbg.derivedtype15 = internal constant %llvm.dbg.derivedtype.type { i32 458790, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 32, i64 32, i64 0, i32 0, { }* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype12 to { }*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1] -@.str16 = internal constant [5 x i8] c"this\00", section "llvm.metadata" ; <[5 x i8]*> [#uses=1] -@llvm.dbg.variable = internal constant %llvm.dbg.variable.type { i32 459009, { }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram14 to { }*), i8* getelementptr ([5 x i8]* @.str16, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 10, { }* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype15 to { }*) }, section "llvm.metadata" ; <%llvm.dbg.variable.type*> [#uses=1] -@.str17 = internal constant [2 x i8] c"i\00", section "llvm.metadata" ; <[2 x i8]*> [#uses=1] -@llvm.dbg.variable18 = internal constant %llvm.dbg.variable.type { i32 459009, { }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram14 to { }*), i8* getelementptr ([2 x i8]* @.str17, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 10, { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*) }, section "llvm.metadata" ; <%llvm.dbg.variable.type*> [#uses=1] -@llvm.dbg.array19 = internal constant [1 x { }*] [ { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*) ], section "llvm.metadata" ; <[1 x { }*]*> [#uses=1] -@llvm.dbg.composite20 = internal constant %llvm.dbg.composite.type { i32 458773, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 0, i64 0, i64 0, i32 0, { }* null, { }* bitcast ([1 x { }*]* @llvm.dbg.array19 to { }*) }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1] -@.str21 = internal constant [5 x i8] c"main\00", section "llvm.metadata" ; <[5 x i8]*> [#uses=1] -@llvm.dbg.subprogram22 = internal constant %llvm.dbg.subprogram.type { i32 458798, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to { }*), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([5 x i8]* @.str21, i32 0, i32 0), i8* getelementptr ([5 x i8]* @.str21, i32 0, i32 0), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 14, { }* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite20 to { }*), i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1] -@.str23 = internal constant [4 x i8] c"fib\00", section "llvm.metadata" ; <[4 x i8]*> [#uses=1] -@llvm.dbg.variable24 = internal constant %llvm.dbg.variable.type { i32 459008, { }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram22 to { }*), i8* getelementptr ([4 x i8]* @.str23, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 15, { }* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite11 to { }*) }, section "llvm.metadata" ; <%llvm.dbg.variable.type*> [#uses=1] - -define void @_ZN10Fibonancci3fooEi(%struct.Fibonancci* %this, i32 %i) nounwind { -entry: - %this_addr = alloca %struct.Fibonancci* ; <%struct.Fibonancci**> [#uses=3] - %i_addr = alloca i32 ; [#uses=3] - %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] - call void @llvm.dbg.func.start({ }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram14 to { }*)) - %0 = bitcast %struct.Fibonancci** %this_addr to { }* ; <{ }*> [#uses=1] - call void @llvm.dbg.declare({ }* %0, { }* bitcast (%llvm.dbg.variable.type* @llvm.dbg.variable to { }*)) - store %struct.Fibonancci* %this, %struct.Fibonancci** %this_addr - %1 = bitcast i32* %i_addr to { }* ; <{ }*> [#uses=1] - call void @llvm.dbg.declare({ }* %1, { }* bitcast (%llvm.dbg.variable.type* @llvm.dbg.variable18 to { }*)) - store i32 %i, i32* %i_addr - call void @llvm.dbg.stoppoint(i32 11, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*)) - %2 = load %struct.Fibonancci** %this_addr, align 4 ; <%struct.Fibonancci*> [#uses=1] - %3 = getelementptr %struct.Fibonancci* %2, i32 0, i32 0 ; [#uses=1] - %4 = load i32* %i_addr, align 4 ; [#uses=1] - store i32 %4, i32* %3, align 4 - call void @llvm.dbg.stoppoint(i32 12, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*)) - br label %return - -return: ; preds = %entry - call void @llvm.dbg.stoppoint(i32 12, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*)) - call void @llvm.dbg.region.end({ }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram14 to { }*)) - ret void -} - -declare void @llvm.dbg.func.start({ }*) nounwind - -declare void @llvm.dbg.declare({ }*, { }*) nounwind - -declare void @llvm.dbg.stoppoint(i32, i32, { }*) nounwind - -declare void @llvm.dbg.region.end({ }*) nounwind - -define i32 @main() nounwind { -entry: - %retval = alloca i32 ; [#uses=2] - %fib = alloca %struct.Fibonancci ; <%struct.Fibonancci*> [#uses=2] - %0 = alloca i32 ; [#uses=2] - %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] - call void @llvm.dbg.func.start({ }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram22 to { }*)) - %1 = bitcast %struct.Fibonancci* %fib to { }* ; <{ }*> [#uses=1] - call void @llvm.dbg.declare({ }* %1, { }* bitcast (%llvm.dbg.variable.type* @llvm.dbg.variable24 to { }*)) - call void @llvm.dbg.stoppoint(i32 16, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*)) - call void @_ZN10Fibonancci3fooEi(%struct.Fibonancci* %fib, i32 42) nounwind - call void @llvm.dbg.stoppoint(i32 17, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*)) - store i32 0, i32* %0, align 4 - %2 = load i32* %0, align 4 ; [#uses=1] - store i32 %2, i32* %retval, align 4 - br label %return - -return: ; preds = %entry - %retval1 = load i32* %retval ; [#uses=1] - call void @llvm.dbg.stoppoint(i32 17, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*)) - call void @llvm.dbg.region.end({ }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram22 to { }*)) - ret i32 %retval1 -} diff --git a/libclamav/c++/llvm/test/DebugInfo/2009-02-18-DefaultScope-Crash.ll b/libclamav/c++/llvm/test/DebugInfo/2009-02-18-DefaultScope-Crash.ll index 1ad776d64..ea9e04623 100644 --- a/libclamav/c++/llvm/test/DebugInfo/2009-02-18-DefaultScope-Crash.ll +++ b/libclamav/c++/llvm/test/DebugInfo/2009-02-18-DefaultScope-Crash.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -f -o /dev/null +; RUN: llvm-as < %s | llc -o /dev/null %llvm.dbg.anchor.type = type { i32, i32 } %llvm.dbg.basictype.type = type { i32, { }*, i8*, { }*, i32, i64, i64, i64, i32, i32 } %llvm.dbg.compile_unit.type = type { i32, { }*, i32, i8*, i8*, i8*, i1, i1, i8* } diff --git a/libclamav/c++/llvm/test/DebugInfo/2009-02-23-InstCombine.ll b/libclamav/c++/llvm/test/DebugInfo/2009-02-23-InstCombine.ll deleted file mode 100644 index f0253526d..000000000 --- a/libclamav/c++/llvm/test/DebugInfo/2009-02-23-InstCombine.ll +++ /dev/null @@ -1,41 +0,0 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep stoppoint | count 3 -target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32" -target triple = "i386-pc-linux-gnu" - %llvm.dbg.anchor.type = type { i32, i32 } - %llvm.dbg.basictype.type = type { i32, { }*, i8*, { }*, i32, i64, i64, i64, i32, i32 } - %llvm.dbg.compile_unit.type = type { i32, { }*, i32, i8*, i8*, i8*, i1, i1, i8*, i32 } - %llvm.dbg.composite.type = type { i32, { }*, i8*, { }*, i32, i64, i64, i64, i32, { }*, { }*, i32 } - %llvm.dbg.subprogram.type = type { i32, { }*, { }*, i8*, i8*, i8*, { }*, i32, { }*, i1, i1 } - %llvm.dbg.variable.type = type { i32, { }*, i8*, { }*, i32, { }* } -@llvm.dbg.compile_units = linkonce constant %llvm.dbg.anchor.type { i32 458752, i32 17 }, section "llvm.metadata" ; <%llvm.dbg.anchor.type*> [#uses=1] -@.str = internal constant [8 x i8] c"brach.c\00", section "llvm.metadata" ; <[8 x i8]*> [#uses=1] -@.str1 = internal constant [38 x i8] c"/developer/home2/zsth/test/debug/tmp/\00", section "llvm.metadata" ; <[38 x i8]*> [#uses=1] -@.str2 = internal constant [52 x i8] c"4.2.1 (Based on Apple Inc. build 5641) (LLVM build)\00", section "llvm.metadata" ; <[52 x i8]*> [#uses=1] -@llvm.dbg.compile_unit = internal constant %llvm.dbg.compile_unit.type { i32 458769, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to { }*), i32 1, i8* getelementptr ([8 x i8]* @.str, i32 0, i32 0), i8* getelementptr ([38 x i8]* @.str1, i32 0, i32 0), i8* getelementptr ([52 x i8]* @.str2, i32 0, i32 0), i1 true, i1 false, i8* null, i32 -1 }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1] -@.str3 = internal constant [4 x i8] c"int\00", section "llvm.metadata" ; <[4 x i8]*> [#uses=1] -@llvm.dbg.basictype = internal constant %llvm.dbg.basictype.type { i32 458788, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([4 x i8]* @.str3, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 32, i64 32, i64 0, i32 0, i32 5 }, section "llvm.metadata" ; <%llvm.dbg.basictype.type*> [#uses=1] -@llvm.dbg.array = internal constant [2 x { }*] [{ }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*), { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*)], section "llvm.metadata" ; <[2 x { }*]*> [#uses=1] -@llvm.dbg.composite = internal constant %llvm.dbg.composite.type { i32 458773, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 0, i64 0, i64 0, i32 0, { }* null, { }* bitcast ([2 x { }*]* @llvm.dbg.array to { }*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1] -@llvm.dbg.subprograms = linkonce constant %llvm.dbg.anchor.type { i32 458752, i32 46 }, section "llvm.metadata" ; <%llvm.dbg.anchor.type*> [#uses=1] -@.str4 = internal constant [4 x i8] c"foo\00", section "llvm.metadata" ; <[4 x i8]*> [#uses=1] -@llvm.dbg.subprogram = internal constant %llvm.dbg.subprogram.type { i32 458798, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to { }*), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([4 x i8]* @.str4, i32 0, i32 0), i8* getelementptr ([4 x i8]* @.str4, i32 0, i32 0), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 1, { }* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite to { }*), i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1] -@.str5 = internal constant [2 x i8] c"x\00", section "llvm.metadata" ; <[2 x i8]*> [#uses=1] -@llvm.dbg.variable = internal constant %llvm.dbg.variable.type { i32 459009, { }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram to { }*), i8* getelementptr ([2 x i8]* @.str5, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 1, { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*) }, section "llvm.metadata" ; <%llvm.dbg.variable.type*> [#uses=0] - -define i32 @foo(i32 %x) nounwind { -entry: - %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] - call void @llvm.dbg.stoppoint(i32 2, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*)) - %0 = icmp sgt i32 %x, 5 ; [#uses=1] - %.0 = select i1 %0, i32 %x, i32 0 ; [#uses=1] - call void @llvm.dbg.stoppoint(i32 5, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*)) - ret i32 %.0 -} - -declare void @llvm.dbg.func.start({ }*) nounwind - -declare void @llvm.dbg.declare({ }*, { }*) nounwind - -declare void @llvm.dbg.stoppoint(i32, i32, { }*) nounwind - -declare void @llvm.dbg.region.end({ }*) nounwind diff --git a/libclamav/c++/llvm/test/DebugInfo/2009-03-02-sink.ll b/libclamav/c++/llvm/test/DebugInfo/2009-03-02-sink.ll deleted file mode 100644 index ce3955a4f..000000000 --- a/libclamav/c++/llvm/test/DebugInfo/2009-03-02-sink.ll +++ /dev/null @@ -1,57 +0,0 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | %prcontext sdiv 1 | grep {stoppoint(i32 2} -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | %prcontext add 1 | grep {stoppoint(i32 3} -; ModuleID = 'sink.c' -target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" -target triple = "i386-apple-darwin9.6" - %llvm.dbg.anchor.type = type { i32, i32 } - %llvm.dbg.basictype.type = type { i32, { }*, i8*, { }*, i32, i64, i64, i64, i32, i32 } - %llvm.dbg.compile_unit.type = type { i32, { }*, i32, i8*, i8*, i8*, i1, i1, i8*, i32 } - %llvm.dbg.composite.type = type { i32, { }*, i8*, { }*, i32, i64, i64, i64, i32, { }*, { }*, i32 } - %llvm.dbg.subprogram.type = type { i32, { }*, { }*, i8*, i8*, i8*, { }*, i32, { }*, i1, i1 } - %llvm.dbg.variable.type = type { i32, { }*, i8*, { }*, i32, { }* } -@llvm.dbg.compile_units = linkonce constant %llvm.dbg.anchor.type { i32 458752, i32 17 }, section "llvm.metadata" ; <%llvm.dbg.anchor.type*> [#uses=1] -@.str = internal constant [7 x i8] c"sink.c\00", section "llvm.metadata" ; <[7 x i8]*> [#uses=1] -@.str1 = internal constant [23 x i8] c"/Volumes/MacOS9/tests/\00", section "llvm.metadata" ; <[23 x i8]*> [#uses=1] -@.str2 = internal constant [52 x i8] c"4.2.1 (Based on Apple Inc. build 5641) (LLVM build)\00", section "llvm.metadata" ; <[52 x i8]*> [#uses=1] -@llvm.dbg.compile_unit = internal constant %llvm.dbg.compile_unit.type { i32 458769, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to { }*), i32 1, i8* getelementptr ([7 x i8]* @.str, i32 0, i32 0), i8* getelementptr ([23 x i8]* @.str1, i32 0, i32 0), i8* getelementptr ([52 x i8]* @.str2, i32 0, i32 0), i1 true, i1 false, i8* null, i32 0 }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1] -@.str3 = internal constant [4 x i8] c"int\00", section "llvm.metadata" ; <[4 x i8]*> [#uses=1] -@llvm.dbg.basictype = internal constant %llvm.dbg.basictype.type { i32 458788, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([4 x i8]* @.str3, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 32, i64 32, i64 0, i32 0, i32 5 }, section "llvm.metadata" ; <%llvm.dbg.basictype.type*> [#uses=1] -@llvm.dbg.array = internal constant [4 x { }*] [{ }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*), { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*), { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*), { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*)], section "llvm.metadata" ; <[4 x { }*]*> [#uses=1] -@llvm.dbg.composite = internal constant %llvm.dbg.composite.type { i32 458773, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 0, i64 0, i64 0, i32 0, { }* null, { }* bitcast ([4 x { }*]* @llvm.dbg.array to { }*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1] -@llvm.dbg.subprograms = linkonce constant %llvm.dbg.anchor.type { i32 458752, i32 46 }, section "llvm.metadata" ; <%llvm.dbg.anchor.type*> [#uses=1] -@.str4 = internal constant [4 x i8] c"foo\00", section "llvm.metadata" ; <[4 x i8]*> [#uses=1] -@llvm.dbg.subprogram = internal constant %llvm.dbg.subprogram.type { i32 458798, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to { }*), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([4 x i8]* @.str4, i32 0, i32 0), i8* getelementptr ([4 x i8]* @.str4, i32 0, i32 0), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 1, { }* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite to { }*), i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1] -@.str5 = internal constant [2 x i8] c"c\00", section "llvm.metadata" ; <[2 x i8]*> [#uses=1] -@llvm.dbg.variable = internal constant %llvm.dbg.variable.type { i32 459009, { }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram to { }*), i8* getelementptr ([2 x i8]* @.str5, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 1, { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*) }, section "llvm.metadata" ; <%llvm.dbg.variable.type*> [#uses=1] -@.str6 = internal constant [2 x i8] c"a\00", section "llvm.metadata" ; <[2 x i8]*> [#uses=1] -@llvm.dbg.variable7 = internal constant %llvm.dbg.variable.type { i32 459009, { }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram to { }*), i8* getelementptr ([2 x i8]* @.str6, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 1, { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*) }, section "llvm.metadata" ; <%llvm.dbg.variable.type*> [#uses=1] -@.str8 = internal constant [2 x i8] c"b\00", section "llvm.metadata" ; <[2 x i8]*> [#uses=1] -@llvm.dbg.variable9 = internal constant %llvm.dbg.variable.type { i32 459009, { }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram to { }*), i8* getelementptr ([2 x i8]* @.str8, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 1, { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*) }, section "llvm.metadata" ; <%llvm.dbg.variable.type*> [#uses=1] - -define i32 @foo(i32 %c, i32 %a, i32 %b) nounwind { -entry: - call void @llvm.dbg.func.start({ }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram to { }*)) - call void @llvm.dbg.stoppoint(i32 2, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*)) - %tmp.2 = sdiv i32 %a, %b ; [#uses=1] - call void @llvm.dbg.stoppoint(i32 3, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*)) - %tmp.9 = add i32 %b, %a ; [#uses=1] - call void @llvm.dbg.stoppoint(i32 4, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*)) - %tmp.10 = icmp ne i32 %c, 0 ; [#uses=1] - br i1 %tmp.10, label %bb, label %bb1 - -bb: ; preds = %entry - call void @llvm.dbg.stoppoint(i32 5, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*)) - ret i32 %tmp.9 - -bb1: ; preds = %entry - call void @llvm.dbg.stoppoint(i32 7, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*)) - ret i32 %tmp.2 -} - -declare void @llvm.dbg.func.start({ }*) nounwind - -declare void @llvm.dbg.declare({ }*, { }*) nounwind - -declare void @llvm.dbg.stoppoint(i32, i32, { }*) nounwind - -declare void @llvm.dbg.region.end({ }*) nounwind diff --git a/libclamav/c++/llvm/test/DebugInfo/2009-06-12-Inline.ll b/libclamav/c++/llvm/test/DebugInfo/2009-06-12-Inline.ll index 87c42d5a6..f6993378f 100644 --- a/libclamav/c++/llvm/test/DebugInfo/2009-06-12-Inline.ll +++ b/libclamav/c++/llvm/test/DebugInfo/2009-06-12-Inline.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -f -o /dev/null +; RUN: llvm-as < %s | llc -o /dev/null %llvm.dbg.anchor.type = type { i32, i32 } %llvm.dbg.basictype.type = type { i32, { }*, i8*, { }*, i32, i64, i64, i64, i32, i32 } %llvm.dbg.compile_unit.type = type { i32, { }*, i32, i8*, i8*, i8*, i1, i1, i8*, i32 } diff --git a/libclamav/c++/llvm/test/DebugInfo/dataOnly.ll b/libclamav/c++/llvm/test/DebugInfo/dataOnly.ll deleted file mode 100644 index a93355549..000000000 --- a/libclamav/c++/llvm/test/DebugInfo/dataOnly.ll +++ /dev/null @@ -1,47 +0,0 @@ -; RUN: llvm-as < %s | llc | grep DWARF -; ModuleID = 'foo.c' -target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" -target triple = "i386-apple-darwin8" - %llvm.dbg.anchor.type = type { i32, i32 } - %llvm.dbg.basictype.type = type { i32, { }*, i8*, { }*, i32, i64, i64, i64, i32, i32 } - %llvm.dbg.compile_unit.type = type { i32, { }*, i32, i8*, i8*, i8* } - %llvm.dbg.global_variable.type = type { i32, { }*, { }*, i8*, i8*, i8*, { }*, i32, { }*, i1, i1, { }* } -@x = common global i32 0 ; [#uses=1] -@llvm.dbg.global_variable = internal constant %llvm.dbg.global_variable.type { - i32 393268, - { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.global_variables to { }*), - { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), - i8* getelementptr ([2 x i8]* @.str3, i32 0, i32 0), - i8* getelementptr ([2 x i8]* @.str3, i32 0, i32 0), - i8* null, - { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), - i32 1, - { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*), - i1 false, - i1 true, - { }* bitcast (i32* @x to { }*) }, section "llvm.metadata" ; <%llvm.dbg.global_variable.type*> [#uses=0] -@llvm.dbg.global_variables = linkonce constant %llvm.dbg.anchor.type { i32 393216, i32 52 }, section "llvm.metadata" ; <%llvm.dbg.anchor.type*> [#uses=1] -@llvm.dbg.compile_unit = internal constant %llvm.dbg.compile_unit.type { - i32 393233, - { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to { }*), - i32 1, - i8* getelementptr ([6 x i8]* @.str, i32 0, i32 0), - i8* getelementptr ([23 x i8]* @.str1, i32 0, i32 0), - i8* getelementptr ([52 x i8]* @.str2, i32 0, i32 0) }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1] -@llvm.dbg.compile_units = linkonce constant %llvm.dbg.anchor.type { i32 393216, i32 17 }, section "llvm.metadata" ; <%llvm.dbg.anchor.type*> [#uses=1] -@.str = internal constant [6 x i8] c"foo.c\00", section "llvm.metadata" ; <[6 x i8]*> [#uses=1] -@.str1 = internal constant [23 x i8] c"/Volumes/MacOS9/tests/\00", section "llvm.metadata" ; <[23 x i8]*> [#uses=1] -@.str2 = internal constant [52 x i8] c"4.2.1 (Based on Apple Inc. build 5555) (LLVM build)\00", section "llvm.metadata" ; <[52 x i8]*> [#uses=1] -@.str3 = internal constant [2 x i8] c"x\00", section "llvm.metadata" ; <[2 x i8]*> [#uses=1] -@llvm.dbg.basictype = internal constant %llvm.dbg.basictype.type { - i32 393252, - { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), - i8* getelementptr ([4 x i8]* @.str4, i32 0, i32 0), - { }* null, - i32 0, - i64 32, - i64 32, - i64 0, - i32 0, - i32 5 }, section "llvm.metadata" ; <%llvm.dbg.basictype.type*> [#uses=1] -@.str4 = internal constant [4 x i8] c"int\00", section "llvm.metadata" ; <[4 x i8]*> [#uses=1] diff --git a/libclamav/c++/llvm/test/DebugInfo/forwardDecl.ll b/libclamav/c++/llvm/test/DebugInfo/forwardDecl.ll deleted file mode 100644 index a3d1927bd..000000000 --- a/libclamav/c++/llvm/test/DebugInfo/forwardDecl.ll +++ /dev/null @@ -1,49 +0,0 @@ -; RUN: llvm-as < %s | llc -O0 | %prcontext ST 1 | grep 0x1 | count 1 - -target triple = "i386-apple-darwin9.6" - %llvm.dbg.anchor.type = type { i32, i32 } - %llvm.dbg.compile_unit.type = type { i32, { }*, i32, i8*, i8*, i8* } - %llvm.dbg.compositetype.type = type { i32, { }*, i8*, { }*, i32, i64, i64, i64, i32, { }*, { }* } - %llvm.dbg.derivedtype.type = type { i32, { }*, i8*, { }*, i32, i64, i64, i64, i32, { }* } - %llvm.dbg.subprogram.type = type { i32, { }*, { }*, i8*, i8*, i8*, { }*, i32, { }*, i1, i1 } - %llvm.dbg.variable.type = type { i32, { }*, i8*, { }*, i32, { }* } - %struct.ST = type opaque -@llvm.dbg.subprogram = internal constant %llvm.dbg.subprogram.type { i32 393262, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to { }*), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([4 x i8]* @.str3, i32 0, i32 0), i8* getelementptr ([4 x i8]* @.str3, i32 0, i32 0), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 3, { }* null, i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1] -@llvm.dbg.subprograms = linkonce constant %llvm.dbg.anchor.type { i32 393216, i32 46 }, section "llvm.metadata" ; <%llvm.dbg.anchor.type*> [#uses=1] -@llvm.dbg.compile_unit = internal constant %llvm.dbg.compile_unit.type { i32 393233, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to { }*), i32 1, i8* getelementptr ([4 x i8]* @.str, i32 0, i32 0), i8* getelementptr ([36 x i8]* @.str1, i32 0, i32 0), i8* getelementptr ([52 x i8]* @.str2, i32 0, i32 0) }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1] -@llvm.dbg.compile_units = linkonce constant %llvm.dbg.anchor.type { i32 393216, i32 17 }, section "llvm.metadata" ; <%llvm.dbg.anchor.type*> [#uses=1] -@.str = internal constant [4 x i8] c"t.c\00", section "llvm.metadata" ; <[20 x i8]*> [#uses=1] -@.str1 = internal constant [36 x i8] c"/Users/echeng/LLVM/radars/r6395152/\00", section "llvm.metadata" ; <[36 x i8]*> [#uses=1] -@.str2 = internal constant [52 x i8] c"4.2.1 (Based on Apple Inc. build 5628) (LLVM build)\00", section "llvm.metadata" ; <[52 x i8]*> [#uses=1] -@.str3 = internal constant [4 x i8] c"foo\00", section "llvm.metadata" ; <[4 x i8]*> [#uses=1] -@llvm.dbg.variable = internal constant %llvm.dbg.variable.type { i32 393473, { }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram to { }*), i8* getelementptr ([2 x i8]* @.str4, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 3, { }* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype to { }*) }, section "llvm.metadata" ; <%llvm.dbg.variable.type*> [#uses=1] -@.str4 = internal constant [2 x i8] c"x\00", section "llvm.metadata" ; <[2 x i8]*> [#uses=1] -@llvm.dbg.derivedtype = internal constant %llvm.dbg.derivedtype.type { i32 393231, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 32, i64 32, i64 0, i32 0, { }* bitcast (%llvm.dbg.compositetype.type* @llvm.dbg.compositetype to { }*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1] -@llvm.dbg.compositetype = internal constant %llvm.dbg.compositetype.type { i32 393235, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([3 x i8]* @.str5, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 1, i64 0, i64 8, i64 0, i32 4, { }* null, { }* bitcast ([0 x { }*]* @llvm.dbg.array to { }*) }, section "llvm.metadata" ; <%llvm.dbg.compositetype.type*> [#uses=1] -@.str5 = internal constant [3 x i8] c"ST\00", section "llvm.metadata" ; <[3 x i8]*> [#uses=1] -@llvm.dbg.array = internal constant [0 x { }*] zeroinitializer, section "llvm.metadata" ; <[0 x { }*]*> [#uses=1] - -define void @foo(%struct.ST* %x1) nounwind { -entry: - %x_addr = alloca %struct.ST* ; <%struct.ST**> [#uses=2] - %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] - call void @llvm.dbg.func.start({ }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram to { }*)) - %x = bitcast %struct.ST** %x_addr to { }* ; <{ }*> [#uses=1] - call void @llvm.dbg.declare({ }* %x, { }* bitcast (%llvm.dbg.variable.type* @llvm.dbg.variable to { }*)) - store %struct.ST* %x1, %struct.ST** %x_addr - call void @llvm.dbg.stoppoint(i32 4, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*)) - br label %return - -return: ; preds = %entry - call void @llvm.dbg.stoppoint(i32 4, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*)) - call void @llvm.dbg.region.end({ }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram to { }*)) - ret void -} - -declare void @llvm.dbg.func.start({ }*) nounwind - -declare void @llvm.dbg.declare({ }*, { }*) nounwind - -declare void @llvm.dbg.stoppoint(i32, i32, { }*) nounwind - -declare void @llvm.dbg.region.end({ }*) nounwind diff --git a/libclamav/c++/llvm/test/DebugInfo/printdbginfo.ll b/libclamav/c++/llvm/test/DebugInfo/printdbginfo.ll deleted file mode 100644 index b3a871d4b..000000000 --- a/libclamav/c++/llvm/test/DebugInfo/printdbginfo.ll +++ /dev/null @@ -1,136 +0,0 @@ -; RUN: llvm-as < %s | opt -print-dbginfo -disable-output > %t1 -; RUN: %prcontext {function name: Bar::bar return type: int at line 12} 1 < %t1 | grep {(tst.cpp:14)} -; RUN: %prcontext {%%tmp1} 1 < %t1 | grep -E {variable tmp.+at tst.cpp:23} -; RUN: %prcontext {; tst.cpp:24} 2 < %t1 | grep {%%6} - %llvm.dbg.anchor.type = type { i32, i32 } - %llvm.dbg.basictype.type = type { i32, { }*, i8*, { }*, i32, i64, i64, i64, i32, i32 } - %llvm.dbg.compile_unit.type = type { i32, { }*, i32, i8*, i8*, i8* } - %llvm.dbg.compositetype.type = type { i32, { }*, i8*, { }*, i32, i64, i64, i64, i32, { }*, { }* } - %llvm.dbg.derivedtype.type = type { i32, { }*, i8*, { }*, i32, i64, i64, i64, i32, { }* } - %llvm.dbg.subprogram.type = type { i32, { }*, { }*, i8*, i8*, i8*, { }*, i32, { }*, i1, i1 } - %llvm.dbg.variable.type = type { i32, { }*, i8*, { }*, i32, { }* } - %struct.Bar = type { %struct.Foo, i32 } - %struct.Foo = type { i32 } -@llvm.dbg.subprogram = internal constant %llvm.dbg.subprogram.type { i32 458798, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to { }*), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([4 x i8]* @.str3, i32 0, i32 0), i8* getelementptr ([9 x i8]* @.str4, i32 0, i32 0), i8* getelementptr ([14 x i8]* @.str5, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 12, { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*), i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1] -@llvm.dbg.subprograms = linkonce constant %llvm.dbg.anchor.type { i32 45872, i32 46 }, section "llvm.metadata" ; <%llvm.dbg.anchor.type*> [#uses=1] -@llvm.dbg.compile_unit = internal constant %llvm.dbg.compile_unit.type { i32 458769, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to { }*), i32 4, i8* getelementptr ([8 x i8]* @.str, i32 0, i32 0), i8* getelementptr ([13 x i8]* @.str1, i32 0, i32 0), i8* getelementptr ([52 x i8]* @.str2, i32 0, i32 0) }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1] -@llvm.dbg.compile_units = linkonce constant %llvm.dbg.anchor.type { i32 45872, i32 17 }, section "llvm.metadata" ; <%llvm.dbg.anchor.type*> [#uses=1] -@.str = internal constant [8 x i8] c"tst.cpp\00", section "llvm.metadata" ; <[8 x i8]*> [#uses=1] -@.str1 = internal constant [13 x i8] c"/home/edwin/\00", section "llvm.metadata" ; <[13 x i8]*> [#uses=1] -@.str2 = internal constant [52 x i8] c"4.2.1 (Based on Apple Inc. build 5623) (LLVM build)\00", section "llvm.metadata" ; <[52 x i8]*> [#uses=1] -@.str3 = internal constant [4 x i8] c"bar\00", section "llvm.metadata" ; <[4 x i8]*> [#uses=1] -@.str4 = internal constant [9 x i8] c"Bar::bar\00", section "llvm.metadata" ; <[9 x i8]*> [#uses=1] -@.str5 = internal constant [14 x i8] c"_ZN3Bar3barEv\00", section "llvm.metadata" ; <[14 x i8]*> [#uses=1] -@llvm.dbg.basictype = internal constant %llvm.dbg.basictype.type { i32 458788, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([4 x i8]* @.str6, i32 0, i32 0), { }* null, i32 0, i64 32, i64 32, i64 0, i32 0, i32 5 }, section "llvm.metadata" ; <%llvm.dbg.basictype.type*> [#uses=1] -@.str6 = internal constant [4 x i8] c"int\00", section "llvm.metadata" ; <[4 x i8]*> [#uses=1] -@llvm.dbg.variable = internal constant %llvm.dbg.variable.type { i32 459009, { }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram to { }*), i8* getelementptr ([5 x i8]* @.str7, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 12, { }* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype to { }*) }, section "llvm.metadata" ; <%llvm.dbg.variable.type*> [#uses=0] -@.str7 = internal constant [5 x i8] c"this\00", section "llvm.metadata" ; <[5 x i8]*> [#uses=1] -@llvm.dbg.derivedtype = internal constant %llvm.dbg.derivedtype.type { i32 458767, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* null, { }* null, i32 0, i64 64, i64 64, i64 0, i32 0, { }* bitcast (%llvm.dbg.compositetype.type* @llvm.dbg.compositetype to { }*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1] -@llvm.dbg.compositetype = internal constant %llvm.dbg.compositetype.type { i32 458771, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([4 x i8]* @.str8, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 5, i64 64, i64 32, i64 0, i32 0, { }* null, { }* bitcast ([5 x { }*]* @llvm.dbg.array36 to { }*) }, section "llvm.metadata" ; <%llvm.dbg.compositetype.type*> [#uses=1] -@.str8 = internal constant [4 x i8] c"Bar\00", section "llvm.metadata" ; <[4 x i8]*> [#uses=1] -@llvm.dbg.derivedtype9 = internal constant %llvm.dbg.derivedtype.type { i32 458780, { }* null, i8* null, { }* null, i32 0, i64 0, i64 0, i64 0, i32 0, { }* bitcast (%llvm.dbg.compositetype.type* @llvm.dbg.compositetype10 to { }*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1] -@llvm.dbg.compositetype10 = internal constant %llvm.dbg.compositetype.type { i32 458771, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([4 x i8]* @.str11, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 1, i64 32, i64 32, i64 0, i32 0, { }* null, { }* bitcast ([3 x { }*]* @llvm.dbg.array22 to { }*) }, section "llvm.metadata" ; <%llvm.dbg.compositetype.type*> [#uses=1] -@.str11 = internal constant [4 x i8] c"Foo\00", section "llvm.metadata" ; <[4 x i8]*> [#uses=1] -@llvm.dbg.derivedtype12 = internal constant %llvm.dbg.derivedtype.type { i32 458765, { }* null, i8* getelementptr ([7 x i8]* @.str13, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 2, i64 32, i64 32, i64 0, i32 0, { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1] -@.str13 = internal constant [7 x i8] c"FooVar\00", section "llvm.metadata" ; <[7 x i8]*> [#uses=1] -@llvm.dbg.subprogram14 = internal constant %llvm.dbg.subprogram.type { i32 458798, { }* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([4 x i8]* @.str11, i32 0, i32 0), i8* getelementptr ([9 x i8]* @.str15, i32 0, i32 0), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 12, { }* bitcast (%llvm.dbg.compositetype.type* @llvm.dbg.compositetype16 to { }*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1] -@.str15 = internal constant [9 x i8] c"Foo::Foo\00", section "llvm.metadata" ; <[9 x i8]*> [#uses=1] -@llvm.dbg.compositetype16 = internal constant %llvm.dbg.compositetype.type { i32 458773, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* null, { }* null, i32 0, i64 8, i64 8, i64 0, i32 0, { }* null, { }* bitcast ([3 x { }*]* @llvm.dbg.array to { }*) }, section "llvm.metadata" ; <%llvm.dbg.compositetype.type*> [#uses=1] -@llvm.dbg.derivedtype17 = internal constant %llvm.dbg.derivedtype.type { i32 458767, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* null, { }* null, i32 0, i64 64, i64 64, i64 0, i32 0, { }* bitcast (%llvm.dbg.compositetype.type* @llvm.dbg.compositetype10 to { }*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1] -@llvm.dbg.derivedtype18 = internal constant %llvm.dbg.derivedtype.type { i32 458768, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* null, { }* null, i32 0, i64 64, i64 64, i64 0, i32 0, { }* bitcast (%llvm.dbg.compositetype.type* @llvm.dbg.compositetype10 to { }*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1] -@llvm.dbg.array = internal constant [3 x { }*] [ { }* null, { }* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype17 to { }*), { }* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype18 to { }*) ], section "llvm.metadata" ; <[3 x { }*]*> [#uses=1] -@llvm.dbg.subprogram19 = internal constant %llvm.dbg.subprogram.type { i32 458798, { }* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([4 x i8]* @.str11, i32 0, i32 0), i8* getelementptr ([9 x i8]* @.str15, i32 0, i32 0), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 12, { }* bitcast (%llvm.dbg.compositetype.type* @llvm.dbg.compositetype20 to { }*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1] -@llvm.dbg.compositetype20 = internal constant %llvm.dbg.compositetype.type { i32 458773, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* null, { }* null, i32 0, i64 8, i64 8, i64 0, i32 0, { }* null, { }* bitcast ([2 x { }*]* @llvm.dbg.array21 to { }*) }, section "llvm.metadata" ; <%llvm.dbg.compositetype.type*> [#uses=1] -@llvm.dbg.array21 = internal constant [2 x { }*] [ { }* null, { }* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype17 to { }*) ], section "llvm.metadata" ; <[2 x { }*]*> [#uses=1] -@llvm.dbg.array22 = internal constant [3 x { }*] [ { }* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype12 to { }*), { }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram14 to { }*), { }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram19 to { }*) ], section "llvm.metadata" ; <[3 x { }*]*> [#uses=1] -@llvm.dbg.derivedtype23 = internal constant %llvm.dbg.derivedtype.type { i32 458765, { }* null, i8* getelementptr ([7 x i8]* @.str24, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 6, i64 32, i64 32, i64 32, i32 1, { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1] -@.str24 = internal constant [7 x i8] c"BarVar\00", section "llvm.metadata" ; <[7 x i8]*> [#uses=1] -@llvm.dbg.subprogram25 = internal constant %llvm.dbg.subprogram.type { i32 458798, { }* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([4 x i8]* @.str8, i32 0, i32 0), i8* getelementptr ([9 x i8]* @.str26, i32 0, i32 0), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 12, { }* bitcast (%llvm.dbg.compositetype.type* @llvm.dbg.compositetype27 to { }*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1] -@.str26 = internal constant [9 x i8] c"Bar::Bar\00", section "llvm.metadata" ; <[9 x i8]*> [#uses=1] -@llvm.dbg.compositetype27 = internal constant %llvm.dbg.compositetype.type { i32 458773, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* null, { }* null, i32 0, i64 8, i64 8, i64 0, i32 0, { }* null, { }* bitcast ([3 x { }*]* @llvm.dbg.array29 to { }*) }, section "llvm.metadata" ; <%llvm.dbg.compositetype.type*> [#uses=1] -@llvm.dbg.derivedtype28 = internal constant %llvm.dbg.derivedtype.type { i32 458768, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* null, { }* null, i32 0, i64 64, i64 64, i64 0, i32 0, { }* bitcast (%llvm.dbg.compositetype.type* @llvm.dbg.compositetype to { }*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1] -@llvm.dbg.array29 = internal constant [3 x { }*] [ { }* null, { }* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype to { }*), { }* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype28 to { }*) ], section "llvm.metadata" ; <[3 x { }*]*> [#uses=1] -@llvm.dbg.subprogram30 = internal constant %llvm.dbg.subprogram.type { i32 458798, { }* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([4 x i8]* @.str8, i32 0, i32 0), i8* getelementptr ([9 x i8]* @.str26, i32 0, i32 0), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 12, { }* bitcast (%llvm.dbg.compositetype.type* @llvm.dbg.compositetype31 to { }*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1] -@llvm.dbg.compositetype31 = internal constant %llvm.dbg.compositetype.type { i32 458773, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* null, { }* null, i32 0, i64 8, i64 8, i64 0, i32 0, { }* null, { }* bitcast ([2 x { }*]* @llvm.dbg.array32 to { }*) }, section "llvm.metadata" ; <%llvm.dbg.compositetype.type*> [#uses=1] -@llvm.dbg.array32 = internal constant [2 x { }*] [ { }* null, { }* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype to { }*) ], section "llvm.metadata" ; <[2 x { }*]*> [#uses=1] -@llvm.dbg.subprogram33 = internal constant %llvm.dbg.subprogram.type { i32 458798, { }* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([4 x i8]* @.str3, i32 0, i32 0), i8* getelementptr ([9 x i8]* @.str4, i32 0, i32 0), i8* getelementptr ([14 x i8]* @.str5, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 12, { }* bitcast (%llvm.dbg.compositetype.type* @llvm.dbg.compositetype34 to { }*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1] -@llvm.dbg.compositetype34 = internal constant %llvm.dbg.compositetype.type { i32 458773, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* null, { }* null, i32 0, i64 8, i64 8, i64 0, i32 0, { }* null, { }* bitcast ([2 x { }*]* @llvm.dbg.array35 to { }*) }, section "llvm.metadata" ; <%llvm.dbg.compositetype.type*> [#uses=1] -@llvm.dbg.array35 = internal constant [2 x { }*] [ { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*), { }* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype to { }*) ], section "llvm.metadata" ; <[2 x { }*]*> [#uses=1] -@llvm.dbg.array36 = internal constant [5 x { }*] [ { }* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype9 to { }*), { }* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype23 to { }*), { }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram25 to { }*), { }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram30 to { }*), { }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram33 to { }*) ], section "llvm.metadata" ; <[5 x { }*]*> [#uses=1] -@llvm.dbg.variable37 = internal constant %llvm.dbg.variable.type { i32 459008, { }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram to { }*), i8* getelementptr ([4 x i8]* @.str38, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 15, { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*) }, section "llvm.metadata" ; <%llvm.dbg.variable.type*> [#uses=0] -@.str38 = internal constant [4 x i8] c"tmp\00", section "llvm.metadata" ; <[4 x i8]*> [#uses=1] -@llvm.dbg.subprogram39 = internal constant %llvm.dbg.subprogram.type { i32 458798, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to { }*), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([7 x i8]* @.str40, i32 0, i32 0), i8* getelementptr ([7 x i8]* @.str40, i32 0, i32 0), i8* getelementptr ([11 x i8]* @.str41, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 21, { }* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype to { }*), i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1] -@.str40 = internal constant [7 x i8] c"foobar\00", section "llvm.metadata" ; <[7 x i8]*> [#uses=1] -@.str41 = internal constant [11 x i8] c"_Z6foobarv\00", section "llvm.metadata" ; <[11 x i8]*> [#uses=1] -@llvm.dbg.variable42 = internal constant %llvm.dbg.variable.type { i32 459008, { }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram39 to { }*), i8* getelementptr ([4 x i8]* @.str38, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 23, { }* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype to { }*) }, section "llvm.metadata" ; <%llvm.dbg.variable.type*> [#uses=0] - -define i32 @_ZN3Bar3barEv(%struct.Bar* %this1) nounwind { -entry: - tail call void @llvm.dbg.func.start({ }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram to { }*)) - tail call void @llvm.dbg.stoppoint(i32 14, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*)) - %0 = getelementptr %struct.Bar* %this1, i64 0, i32 0, i32 0 ; [#uses=1] - %1 = load i32* %0, align 4 ; [#uses=1] - %2 = icmp sgt i32 %1, 0 ; [#uses=1] - br i1 %2, label %bb, label %bb3 - -bb: ; preds = %entry - %3 = getelementptr %struct.Bar* %this1, i64 0, i32 1 ; [#uses=1] - %4 = load i32* %3, align 4 ; [#uses=1] - %5 = shl i32 %4, 1 ; [#uses=1] - tail call void @llvm.dbg.stoppoint(i32 16, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*)) - br label %bb4 - -bb3: ; preds = %entry - tail call void @llvm.dbg.stoppoint(i32 18, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*)) - br label %bb4 - -bb4: ; preds = %bb3, %bb - %.0 = phi i32 [ 0, %bb3 ], [ %5, %bb ] ; [#uses=1] - tail call void @llvm.dbg.stoppoint(i32 18, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*)) - tail call void @llvm.dbg.region.end({ }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram to { }*)) - ret i32 %.0 -} - -declare void @llvm.dbg.func.start({ }*) nounwind - -declare void @llvm.dbg.declare({ }*, { }*) nounwind - -declare void @llvm.dbg.stoppoint(i32, i32, { }*) nounwind - -declare void @llvm.dbg.region.end({ }*) nounwind - -define %struct.Bar* @_Z6foobarv() { -entry: - %retval = alloca %struct.Bar* ; <%struct.Bar**> [#uses=2] - %tmp = alloca %struct.Bar* ; <%struct.Bar**> [#uses=3] - %0 = alloca %struct.Bar* ; <%struct.Bar**> [#uses=2] - %1 = alloca %struct.Bar* ; <%struct.Bar**> [#uses=3] - %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] - call void @llvm.dbg.func.start({ }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram39 to { }*)) - %tmp1 = bitcast %struct.Bar** %tmp to { }* ; <{ }*> [#uses=1] - call void @llvm.dbg.declare({ }* %tmp1, { }* bitcast (%llvm.dbg.variable.type* @llvm.dbg.variable42 to { }*)) - call void @llvm.dbg.stoppoint(i32 23, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*)) - %2 = call i8* @_Znwm(i64 8) ; [#uses=1] - %3 = bitcast i8* %2 to %struct.Bar* ; <%struct.Bar*> [#uses=1] - store %struct.Bar* %3, %struct.Bar** %1, align 8 - %4 = load %struct.Bar** %1, align 8 ; <%struct.Bar*> [#uses=1] - call void @_ZN3BarC1Ev(%struct.Bar* %4) nounwind - %5 = load %struct.Bar** %1, align 8 ; <%struct.Bar*> [#uses=1] - store %struct.Bar* %5, %struct.Bar** %tmp, align 8 - call void @llvm.dbg.stoppoint(i32 24, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*)) - %6 = load %struct.Bar** %tmp, align 8 ; <%struct.Bar*> [#uses=1] - store %struct.Bar* %6, %struct.Bar** %0, align 8 - %7 = load %struct.Bar** %0, align 8 ; <%struct.Bar*> [#uses=1] - store %struct.Bar* %7, %struct.Bar** %retval, align 8 - br label %return - -return: ; preds = %entry - %retval2 = load %struct.Bar** %retval ; <%struct.Bar*> [#uses=1] - call void @llvm.dbg.stoppoint(i32 24, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*)) - call void @llvm.dbg.region.end({ }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram39 to { }*)) - ret %struct.Bar* %retval2 -} - -declare i8* @_Znwm(i64) - -declare void @_ZN3BarC1Ev(%struct.Bar*) nounwind diff --git a/libclamav/c++/llvm/test/DebugInfo/printdbginfo2.ll b/libclamav/c++/llvm/test/DebugInfo/printdbginfo2.ll deleted file mode 100644 index 6c8275adb..000000000 --- a/libclamav/c++/llvm/test/DebugInfo/printdbginfo2.ll +++ /dev/null @@ -1,74 +0,0 @@ -; RUN: llvm-as < %s | opt -print-dbginfo -disable-output > %t1 -; RUN: grep {%b is variable b of type x declared at x.c:7} %t1 -; RUN: grep {%2 is variable b of type x declared at x.c:7} %t1 -; RUN: grep {@c.1442 is variable c of type int declared at x.c:4} %t1 - type { } ; type %0 - %llvm.dbg.anchor.type = type { i32, i32 } - %llvm.dbg.basictype.type = type { i32, %0*, i8*, %0*, i32, i64, i64, i64, i32, i32 } - %llvm.dbg.compile_unit.type = type { i32, %0*, i32, i8*, i8*, i8*, i1, i1, i8*, i32 } - %llvm.dbg.composite.type = type { i32, %0*, i8*, %0*, i32, i64, i64, i64, i32, %0*, %0*, i32 } - %llvm.dbg.derivedtype.type = type { i32, %0*, i8*, %0*, i32, i64, i64, i64, i32, %0* } - %llvm.dbg.global_variable.type = type { i32, %0*, %0*, i8*, i8*, i8*, %0*, i32, %0*, i1, i1, %0* } - %llvm.dbg.subprogram.type = type { i32, %0*, %0*, i8*, i8*, i8*, %0*, i32, %0*, i1, i1 } - %llvm.dbg.subrange.type = type { i32, i64, i64 } - %llvm.dbg.variable.type = type { i32, %0*, i8*, %0*, i32, %0* } - %struct..0x = type { i32 } -@llvm.dbg.compile_units = linkonce constant %llvm.dbg.anchor.type { i32 458752, i32 17 }, section "llvm.metadata" ; <%llvm.dbg.anchor.type*> [#uses=1] -@.str = internal constant [4 x i8] c"x.c\00", section "llvm.metadata" ; <[4 x i8]*> [#uses=1] -@.str1 = internal constant [27 x i8] c"/home/edwin/llvm-svn/llvm/\00", section "llvm.metadata" ; <[27 x i8]*> [#uses=1] -@.str2 = internal constant [52 x i8] c"4.2.1 (Based on Apple Inc. build 5641) (LLVM build)\00", section "llvm.metadata" ; <[52 x i8]*> [#uses=1] -@llvm.dbg.compile_unit = internal constant %llvm.dbg.compile_unit.type { i32 458769, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to %0*), i32 1, i8* getelementptr ([4 x i8]* @.str, i32 0, i32 0), i8* getelementptr ([27 x i8]* @.str1, i32 0, i32 0), i8* getelementptr ([52 x i8]* @.str2, i32 0, i32 0), i1 true, i1 false, i8* null, i32 0 }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1] -@.str3 = internal constant [4 x i8] c"int\00", section "llvm.metadata" ; <[4 x i8]*> [#uses=1] -@llvm.dbg.basictype = internal constant %llvm.dbg.basictype.type { i32 458788, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([4 x i8]* @.str3, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 32, i64 32, i64 0, i32 0, i32 5 }, section "llvm.metadata" ; <%llvm.dbg.basictype.type*> [#uses=1] -@llvm.dbg.array = internal constant [1 x %0*] [%0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to %0*)], section "llvm.metadata" ; <[1 x %0*]*> [#uses=1] -@llvm.dbg.composite = internal constant %llvm.dbg.composite.type { i32 458773, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 0, i64 0, i64 0, i32 0, %0* null, %0* bitcast ([1 x %0*]* @llvm.dbg.array to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1] -@llvm.dbg.subprograms = linkonce constant %llvm.dbg.anchor.type { i32 458752, i32 46 }, section "llvm.metadata" ; <%llvm.dbg.anchor.type*> [#uses=1] -@.str4 = internal constant [5 x i8] c"main\00", section "llvm.metadata" ; <[5 x i8]*> [#uses=1] -@llvm.dbg.subprogram = internal constant %llvm.dbg.subprogram.type { i32 458798, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([5 x i8]* @.str4, i32 0, i32 0), i8* getelementptr ([5 x i8]* @.str4, i32 0, i32 0), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 2, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite to %0*), i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1] -@.str5 = internal constant [2 x i8] c"x\00", section "llvm.metadata" ; <[2 x i8]*> [#uses=1] -@.str7 = internal constant [2 x i8] c"a\00", section "llvm.metadata" ; <[2 x i8]*> [#uses=1] -@llvm.dbg.derivedtype = internal constant %llvm.dbg.derivedtype.type { i32 458765, %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram to %0*), i8* getelementptr ([2 x i8]* @.str7, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 6, i64 32, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to %0*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1] -@llvm.dbg.array8 = internal constant [1 x %0*] [%0* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype to %0*)], section "llvm.metadata" ; <[1 x %0*]*> [#uses=1] -@llvm.dbg.composite9 = internal constant %llvm.dbg.composite.type { i32 458771, %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram to %0*), i8* getelementptr ([2 x i8]* @.str5, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 5, i64 32, i64 32, i64 0, i32 0, %0* null, %0* bitcast ([1 x %0*]* @llvm.dbg.array8 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1] -@.str10 = internal constant [2 x i8] c"b\00", section "llvm.metadata" ; <[2 x i8]*> [#uses=1] -@llvm.dbg.variable = internal constant %llvm.dbg.variable.type { i32 459008, %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram to %0*), i8* getelementptr ([2 x i8]* @.str10, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 7, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite9 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.variable.type*> [#uses=1] -@llvm.dbg.subrange = internal constant %llvm.dbg.subrange.type { i32 458785, i64 0, i64 3 }, section "llvm.metadata" ; <%llvm.dbg.subrange.type*> [#uses=1] -@llvm.dbg.array11 = internal constant [1 x %0*] [%0* bitcast (%llvm.dbg.subrange.type* @llvm.dbg.subrange to %0*)], section "llvm.metadata" ; <[1 x %0*]*> [#uses=1] -@llvm.dbg.composite12 = internal constant %llvm.dbg.composite.type { i32 458753, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 0, i64 128, i64 32, i64 0, i32 0, %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to %0*), %0* bitcast ([1 x %0*]* @llvm.dbg.array11 to %0*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1] -@llvm.dbg.variable13 = internal constant %llvm.dbg.variable.type { i32 459008, %0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram to %0*), i8* getelementptr ([2 x i8]* @.str7, i32 0, i32 0), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 3, %0* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite12 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.variable.type*> [#uses=1] -@c.1442 = internal global i32 5 ; [#uses=2] -@llvm.dbg.global_variables = linkonce constant %llvm.dbg.anchor.type { i32 458752, i32 52 }, section "llvm.metadata" ; <%llvm.dbg.anchor.type*> [#uses=1] -@.str14 = internal constant [7 x i8] c"c.1442\00", section "llvm.metadata" ; <[7 x i8]*> [#uses=1] -@.str15 = internal constant [2 x i8] c"c\00", section "llvm.metadata" ; <[2 x i8]*> [#uses=1] -@llvm.dbg.global_variable = internal constant %llvm.dbg.global_variable.type { i32 458804, %0* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.global_variables to %0*), %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i8* getelementptr ([7 x i8]* @.str14, i32 0, i32 0), i8* getelementptr ([2 x i8]* @.str15, i32 0, i32 0), i8* null, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*), i32 4, %0* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to %0*), i1 true, i1 true, %0* bitcast (i32* @c.1442 to %0*) }, section "llvm.metadata" ; <%llvm.dbg.global_variable.type*> [#uses=0] - -define i32 @main() nounwind { -entry: - %b = alloca %struct..0x ; <%struct..0x*> [#uses=2] - %a = alloca [4 x i32] ; <[4 x i32]*> [#uses=1] - %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] - call void @llvm.dbg.func.start(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram to %0*)) - %0 = bitcast %struct..0x* %b to %0* ; <%0*> [#uses=1] - call void @llvm.dbg.declare(%0* %0, %0* bitcast (%llvm.dbg.variable.type* @llvm.dbg.variable to %0*)) - %1 = bitcast [4 x i32]* %a to %0* ; <%0*> [#uses=1] - call void @llvm.dbg.declare(%0* %1, %0* bitcast (%llvm.dbg.variable.type* @llvm.dbg.variable13 to %0*)) - call void @llvm.dbg.stoppoint(i32 8, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*)) - %2 = getelementptr %struct..0x* %b, i32 0, i32 0 ; [#uses=1] - store i32 5, i32* %2, align 4 - call void @llvm.dbg.stoppoint(i32 9, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*)) - %3 = load i32* @c.1442, align 4 ; [#uses=1] - br label %return - -return: ; preds = %entry - call void @llvm.dbg.stoppoint(i32 9, i32 0, %0* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to %0*)) - call void @llvm.dbg.region.end(%0* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram to %0*)) - ret i32 %3 -} - -declare void @llvm.dbg.func.start(%0*) nounwind readnone - -declare void @llvm.dbg.declare(%0*, %0*) nounwind readnone - -declare void @llvm.dbg.stoppoint(i32, i32, %0*) nounwind readnone - -declare void @llvm.dbg.region.end(%0*) nounwind readnone diff --git a/libclamav/c++/llvm/test/ExecutionEngine/2002-12-16-ArgTest.ll b/libclamav/c++/llvm/test/ExecutionEngine/2002-12-16-ArgTest.ll index a51e3a110..455196923 100644 --- a/libclamav/c++/llvm/test/ExecutionEngine/2002-12-16-ArgTest.ll +++ b/libclamav/c++/llvm/test/ExecutionEngine/2002-12-16-ArgTest.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as %s -f -o %t.bc +; RUN: llvm-as %s -o %t.bc ; RUN: lli %t.bc > /dev/null @.LC0 = internal global [10 x i8] c"argc: %d\0A\00" ; <[10 x i8]*> [#uses=1] diff --git a/libclamav/c++/llvm/test/ExecutionEngine/2003-01-04-ArgumentBug.ll b/libclamav/c++/llvm/test/ExecutionEngine/2003-01-04-ArgumentBug.ll index 89106b5b2..5d37e9664 100644 --- a/libclamav/c++/llvm/test/ExecutionEngine/2003-01-04-ArgumentBug.ll +++ b/libclamav/c++/llvm/test/ExecutionEngine/2003-01-04-ArgumentBug.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as %s -f -o %t.bc +; RUN: llvm-as %s -o %t.bc ; RUN: lli %t.bc > /dev/null define i32 @foo(i32 %X, i32 %Y, double %A) { diff --git a/libclamav/c++/llvm/test/ExecutionEngine/2003-01-04-LoopTest.ll b/libclamav/c++/llvm/test/ExecutionEngine/2003-01-04-LoopTest.ll index 07cb1d3c9..653cf79a5 100644 --- a/libclamav/c++/llvm/test/ExecutionEngine/2003-01-04-LoopTest.ll +++ b/libclamav/c++/llvm/test/ExecutionEngine/2003-01-04-LoopTest.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as %s -o %t.bc -f +; RUN: llvm-as %s -o %t.bc ; RUN: lli %t.bc > /dev/null define i32 @main() { diff --git a/libclamav/c++/llvm/test/ExecutionEngine/2003-01-04-PhiTest.ll b/libclamav/c++/llvm/test/ExecutionEngine/2003-01-04-PhiTest.ll index 649ed0b24..b5c9d8132 100644 --- a/libclamav/c++/llvm/test/ExecutionEngine/2003-01-04-PhiTest.ll +++ b/libclamav/c++/llvm/test/ExecutionEngine/2003-01-04-PhiTest.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as %s -f -o %t.bc +; RUN: llvm-as %s -o %t.bc ; RUN: lli %t.bc > /dev/null define i32 @main() { diff --git a/libclamav/c++/llvm/test/ExecutionEngine/2003-01-09-SARTest.ll b/libclamav/c++/llvm/test/ExecutionEngine/2003-01-09-SARTest.ll index a9df7f203..81478972d 100644 --- a/libclamav/c++/llvm/test/ExecutionEngine/2003-01-09-SARTest.ll +++ b/libclamav/c++/llvm/test/ExecutionEngine/2003-01-09-SARTest.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as %s -f -o %t.bc +; RUN: llvm-as %s -o %t.bc ; RUN: lli %t.bc > /dev/null ; We were accidentally inverting the signedness of right shifts. Whoops. diff --git a/libclamav/c++/llvm/test/ExecutionEngine/2003-01-10-FUCOM.ll b/libclamav/c++/llvm/test/ExecutionEngine/2003-01-10-FUCOM.ll index 30f93309d..d996fa53d 100644 --- a/libclamav/c++/llvm/test/ExecutionEngine/2003-01-10-FUCOM.ll +++ b/libclamav/c++/llvm/test/ExecutionEngine/2003-01-10-FUCOM.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as %s -f -o %t.bc +; RUN: llvm-as %s -o %t.bc ; RUN: lli %t.bc > /dev/null define i32 @main() { diff --git a/libclamav/c++/llvm/test/ExecutionEngine/2003-01-15-AlignmentTest.ll b/libclamav/c++/llvm/test/ExecutionEngine/2003-01-15-AlignmentTest.ll index 7529eb477..a55d74df0 100644 --- a/libclamav/c++/llvm/test/ExecutionEngine/2003-01-15-AlignmentTest.ll +++ b/libclamav/c++/llvm/test/ExecutionEngine/2003-01-15-AlignmentTest.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as %s -f -o %t.bc +; RUN: llvm-as %s -o %t.bc ; RUN: lli %t.bc > /dev/null define i32 @bar(i8* %X) { diff --git a/libclamav/c++/llvm/test/ExecutionEngine/2003-05-11-PHIRegAllocBug.ll b/libclamav/c++/llvm/test/ExecutionEngine/2003-05-11-PHIRegAllocBug.ll index 7b48f579a..5a13b21b5 100644 --- a/libclamav/c++/llvm/test/ExecutionEngine/2003-05-11-PHIRegAllocBug.ll +++ b/libclamav/c++/llvm/test/ExecutionEngine/2003-05-11-PHIRegAllocBug.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as %s -f -o %t.bc +; RUN: llvm-as %s -o %t.bc ; RUN: lli %t.bc > /dev/null target datalayout = "e-p:32:32" diff --git a/libclamav/c++/llvm/test/ExecutionEngine/2003-06-04-bzip2-bug.ll b/libclamav/c++/llvm/test/ExecutionEngine/2003-06-04-bzip2-bug.ll index 6dee717f4..6e2da70f7 100644 --- a/libclamav/c++/llvm/test/ExecutionEngine/2003-06-04-bzip2-bug.ll +++ b/libclamav/c++/llvm/test/ExecutionEngine/2003-06-04-bzip2-bug.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as %s -f -o %t.bc +; RUN: llvm-as %s -o %t.bc ; RUN: lli %t.bc > /dev/null ; Testcase distilled from 256.bzip2. diff --git a/libclamav/c++/llvm/test/ExecutionEngine/2003-06-05-PHIBug.ll b/libclamav/c++/llvm/test/ExecutionEngine/2003-06-05-PHIBug.ll index 2cd9c1b21..50b48da49 100644 --- a/libclamav/c++/llvm/test/ExecutionEngine/2003-06-05-PHIBug.ll +++ b/libclamav/c++/llvm/test/ExecutionEngine/2003-06-05-PHIBug.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as %s -f -o %t.bc +; RUN: llvm-as %s -o %t.bc ; RUN: lli %t.bc > /dev/null ; Testcase distilled from 256.bzip2. diff --git a/libclamav/c++/llvm/test/ExecutionEngine/2003-08-15-AllocaAssertion.ll b/libclamav/c++/llvm/test/ExecutionEngine/2003-08-15-AllocaAssertion.ll index 8a96377ae..6c90b33cb 100644 --- a/libclamav/c++/llvm/test/ExecutionEngine/2003-08-15-AllocaAssertion.ll +++ b/libclamav/c++/llvm/test/ExecutionEngine/2003-08-15-AllocaAssertion.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as %s -f -o %t.bc +; RUN: llvm-as %s -o %t.bc ; RUN: lli %t.bc > /dev/null ; This testcase failed to work because two variable sized allocas confused the diff --git a/libclamav/c++/llvm/test/ExecutionEngine/2003-08-21-EnvironmentTest.ll b/libclamav/c++/llvm/test/ExecutionEngine/2003-08-21-EnvironmentTest.ll index 23efbeed0..3a4a4e439 100644 --- a/libclamav/c++/llvm/test/ExecutionEngine/2003-08-21-EnvironmentTest.ll +++ b/libclamav/c++/llvm/test/ExecutionEngine/2003-08-21-EnvironmentTest.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as %s -f -o %t.bc +; RUN: llvm-as %s -o %t.bc ; RUN: lli %t.bc > /dev/null ; diff --git a/libclamav/c++/llvm/test/ExecutionEngine/2003-08-23-RegisterAllocatePhysReg.ll b/libclamav/c++/llvm/test/ExecutionEngine/2003-08-23-RegisterAllocatePhysReg.ll index 25a24f5e5..b165a1cf3 100644 --- a/libclamav/c++/llvm/test/ExecutionEngine/2003-08-23-RegisterAllocatePhysReg.ll +++ b/libclamav/c++/llvm/test/ExecutionEngine/2003-08-23-RegisterAllocatePhysReg.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as %s -f -o %t.bc +; RUN: llvm-as %s -o %t.bc ; RUN: lli %t.bc > /dev/null ; This testcase exposes a bug in the local register allocator where it runs out diff --git a/libclamav/c++/llvm/test/ExecutionEngine/2003-10-18-PHINode-ConstantExpr-CondCode-Failure.ll b/libclamav/c++/llvm/test/ExecutionEngine/2003-10-18-PHINode-ConstantExpr-CondCode-Failure.ll index e289e10c0..aa9d7e7d3 100644 --- a/libclamav/c++/llvm/test/ExecutionEngine/2003-10-18-PHINode-ConstantExpr-CondCode-Failure.ll +++ b/libclamav/c++/llvm/test/ExecutionEngine/2003-10-18-PHINode-ConstantExpr-CondCode-Failure.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as %s -f -o %t.bc +; RUN: llvm-as %s -o %t.bc ; RUN: lli %t.bc > /dev/null @A = global i32 0 ; [#uses=1] diff --git a/libclamav/c++/llvm/test/ExecutionEngine/2008-06-05-APInt-OverAShr.ll b/libclamav/c++/llvm/test/ExecutionEngine/2008-06-05-APInt-OverAShr.ll index 02b65b13f..e7e434f27 100644 --- a/libclamav/c++/llvm/test/ExecutionEngine/2008-06-05-APInt-OverAShr.ll +++ b/libclamav/c++/llvm/test/ExecutionEngine/2008-06-05-APInt-OverAShr.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as %s -f -o %t.bc +; RUN: llvm-as %s -o %t.bc ; RUN: lli -force-interpreter=true %t.bc | grep 1 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32" diff --git a/libclamav/c++/llvm/test/ExecutionEngine/hello.ll b/libclamav/c++/llvm/test/ExecutionEngine/hello.ll index 3cd29f62a..fad36ed58 100644 --- a/libclamav/c++/llvm/test/ExecutionEngine/hello.ll +++ b/libclamav/c++/llvm/test/ExecutionEngine/hello.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as %s -f -o %t.bc +; RUN: llvm-as %s -o %t.bc ; RUN: lli %t.bc > /dev/null @.LC0 = internal global [12 x i8] c"Hello World\00" ; <[12 x i8]*> [#uses=1] diff --git a/libclamav/c++/llvm/test/ExecutionEngine/hello2.ll b/libclamav/c++/llvm/test/ExecutionEngine/hello2.ll index a6a6194ca..7ca0d8827 100644 --- a/libclamav/c++/llvm/test/ExecutionEngine/hello2.ll +++ b/libclamav/c++/llvm/test/ExecutionEngine/hello2.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as %s -f -o %t.bc +; RUN: llvm-as %s -o %t.bc ; RUN: lli %t.bc > /dev/null @X = global i32 7 ; [#uses=0] diff --git a/libclamav/c++/llvm/test/ExecutionEngine/simplesttest.ll b/libclamav/c++/llvm/test/ExecutionEngine/simplesttest.ll index fa69533fa..5d9cf767b 100644 --- a/libclamav/c++/llvm/test/ExecutionEngine/simplesttest.ll +++ b/libclamav/c++/llvm/test/ExecutionEngine/simplesttest.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as %s -f -o %t.bc +; RUN: llvm-as %s -o %t.bc ; RUN: lli %t.bc > /dev/null define i32 @main() { diff --git a/libclamav/c++/llvm/test/ExecutionEngine/simpletest.ll b/libclamav/c++/llvm/test/ExecutionEngine/simpletest.ll index 0ed5b44c1..53fb79c2c 100644 --- a/libclamav/c++/llvm/test/ExecutionEngine/simpletest.ll +++ b/libclamav/c++/llvm/test/ExecutionEngine/simpletest.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as %s -f -o %t.bc +; RUN: llvm-as %s -o %t.bc ; RUN: lli %t.bc > /dev/null define i32 @bar() { diff --git a/libclamav/c++/llvm/test/ExecutionEngine/test-arith.ll b/libclamav/c++/llvm/test/ExecutionEngine/test-arith.ll index d99e30f51..8c51e6b2e 100644 --- a/libclamav/c++/llvm/test/ExecutionEngine/test-arith.ll +++ b/libclamav/c++/llvm/test/ExecutionEngine/test-arith.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as %s -f -o %t.bc +; RUN: llvm-as %s -o %t.bc ; RUN: lli %t.bc > /dev/null define i32 @main() { diff --git a/libclamav/c++/llvm/test/ExecutionEngine/test-branch.ll b/libclamav/c++/llvm/test/ExecutionEngine/test-branch.ll index d7251f8e6..dd8db5465 100644 --- a/libclamav/c++/llvm/test/ExecutionEngine/test-branch.ll +++ b/libclamav/c++/llvm/test/ExecutionEngine/test-branch.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as %s -f -o %t.bc +; RUN: llvm-as %s -o %t.bc ; RUN: lli %t.bc > /dev/null ; test unconditional branch diff --git a/libclamav/c++/llvm/test/ExecutionEngine/test-call.ll b/libclamav/c++/llvm/test/ExecutionEngine/test-call.ll index a1b3cd66a..4464ebd39 100644 --- a/libclamav/c++/llvm/test/ExecutionEngine/test-call.ll +++ b/libclamav/c++/llvm/test/ExecutionEngine/test-call.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as %s -f -o %t.bc +; RUN: llvm-as %s -o %t.bc ; RUN: lli %t.bc > /dev/null declare void @exit(i32) diff --git a/libclamav/c++/llvm/test/ExecutionEngine/test-cast.ll b/libclamav/c++/llvm/test/ExecutionEngine/test-cast.ll index 1458f6cc6..82d494978 100644 --- a/libclamav/c++/llvm/test/ExecutionEngine/test-cast.ll +++ b/libclamav/c++/llvm/test/ExecutionEngine/test-cast.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as %s -f -o %t.bc +; RUN: llvm-as %s -o %t.bc ; RUN: lli %t.bc > /dev/null define i32 @foo() { diff --git a/libclamav/c++/llvm/test/ExecutionEngine/test-constantexpr.ll b/libclamav/c++/llvm/test/ExecutionEngine/test-constantexpr.ll index 3623cf4bd..cd5c63533 100644 --- a/libclamav/c++/llvm/test/ExecutionEngine/test-constantexpr.ll +++ b/libclamav/c++/llvm/test/ExecutionEngine/test-constantexpr.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as %s -f -o %t.bc +; RUN: llvm-as %s -o %t.bc ; RUN: lli %t.bc > /dev/null ; This tests to make sure that we can evaluate weird constant expressions diff --git a/libclamav/c++/llvm/test/ExecutionEngine/test-fp.ll b/libclamav/c++/llvm/test/ExecutionEngine/test-fp.ll index 2e8ecd5a7..4ebcf6f7a 100644 --- a/libclamav/c++/llvm/test/ExecutionEngine/test-fp.ll +++ b/libclamav/c++/llvm/test/ExecutionEngine/test-fp.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as %s -f -o %t.bc +; RUN: llvm-as %s -o %t.bc ; RUN: lli %t.bc > /dev/null define double @test(double* %DP, double %Arg) { diff --git a/libclamav/c++/llvm/test/ExecutionEngine/test-loadstore.ll b/libclamav/c++/llvm/test/ExecutionEngine/test-loadstore.ll index 298ea96fd..ba0f0baf8 100644 --- a/libclamav/c++/llvm/test/ExecutionEngine/test-loadstore.ll +++ b/libclamav/c++/llvm/test/ExecutionEngine/test-loadstore.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as %s -f -o %t.bc +; RUN: llvm-as %s -o %t.bc ; RUN: lli %t.bc > /dev/null define void @test(i8* %P, i16* %P.upgrd.1, i32* %P.upgrd.2, i64* %P.upgrd.3) { diff --git a/libclamav/c++/llvm/test/ExecutionEngine/test-logical.ll b/libclamav/c++/llvm/test/ExecutionEngine/test-logical.ll index f30c33431..e560e52d5 100644 --- a/libclamav/c++/llvm/test/ExecutionEngine/test-logical.ll +++ b/libclamav/c++/llvm/test/ExecutionEngine/test-logical.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as %s -f -o %t.bc +; RUN: llvm-as %s -o %t.bc ; RUN: lli %t.bc > /dev/null define i32 @main() { diff --git a/libclamav/c++/llvm/test/ExecutionEngine/test-loop.ll b/libclamav/c++/llvm/test/ExecutionEngine/test-loop.ll index 78fc3144a..7cd69e294 100644 --- a/libclamav/c++/llvm/test/ExecutionEngine/test-loop.ll +++ b/libclamav/c++/llvm/test/ExecutionEngine/test-loop.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as %s -f -o %t.bc +; RUN: llvm-as %s -o %t.bc ; RUN: lli %t.bc > /dev/null define i32 @main() { diff --git a/libclamav/c++/llvm/test/ExecutionEngine/test-malloc.ll b/libclamav/c++/llvm/test/ExecutionEngine/test-malloc.ll index bc857ed5e..8f79d974e 100644 --- a/libclamav/c++/llvm/test/ExecutionEngine/test-malloc.ll +++ b/libclamav/c++/llvm/test/ExecutionEngine/test-malloc.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as %s -f -o %t.bc +; RUN: llvm-as %s -o %t.bc ; RUN: lli %t.bc > /dev/null define i32 @main() { diff --git a/libclamav/c++/llvm/test/ExecutionEngine/test-phi.ll b/libclamav/c++/llvm/test/ExecutionEngine/test-phi.ll index 69d1b0866..f1aaefa50 100644 --- a/libclamav/c++/llvm/test/ExecutionEngine/test-phi.ll +++ b/libclamav/c++/llvm/test/ExecutionEngine/test-phi.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as %s -f -o %t.bc +; RUN: llvm-as %s -o %t.bc ; RUN: lli %t.bc > /dev/null ; test phi node diff --git a/libclamav/c++/llvm/test/ExecutionEngine/test-ret.ll b/libclamav/c++/llvm/test/ExecutionEngine/test-ret.ll index e684fd5e3..eae91f553 100644 --- a/libclamav/c++/llvm/test/ExecutionEngine/test-ret.ll +++ b/libclamav/c++/llvm/test/ExecutionEngine/test-ret.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as %s -f -o %t.bc +; RUN: llvm-as %s -o %t.bc ; RUN: lli %t.bc > /dev/null ; test return instructions diff --git a/libclamav/c++/llvm/test/ExecutionEngine/test-setcond-fp.ll b/libclamav/c++/llvm/test/ExecutionEngine/test-setcond-fp.ll index b917693ab..4264e2c59 100644 --- a/libclamav/c++/llvm/test/ExecutionEngine/test-setcond-fp.ll +++ b/libclamav/c++/llvm/test/ExecutionEngine/test-setcond-fp.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as %s -f -o %t.bc +; RUN: llvm-as %s -o %t.bc ; RUN: lli %t.bc > /dev/null diff --git a/libclamav/c++/llvm/test/ExecutionEngine/test-setcond-int.ll b/libclamav/c++/llvm/test/ExecutionEngine/test-setcond-int.ll index f80c2477a..772f4fa70 100644 --- a/libclamav/c++/llvm/test/ExecutionEngine/test-setcond-int.ll +++ b/libclamav/c++/llvm/test/ExecutionEngine/test-setcond-int.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as %s -f -o %t.bc +; RUN: llvm-as %s -o %t.bc ; RUN: lli %t.bc > /dev/null define i32 @main() { diff --git a/libclamav/c++/llvm/test/ExecutionEngine/test-shift.ll b/libclamav/c++/llvm/test/ExecutionEngine/test-shift.ll index 330de0bfb..2791b8534 100644 --- a/libclamav/c++/llvm/test/ExecutionEngine/test-shift.ll +++ b/libclamav/c++/llvm/test/ExecutionEngine/test-shift.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as %s -f -o %t.bc +; RUN: llvm-as %s -o %t.bc ; RUN: lli %t.bc > /dev/null define i32 @main() { diff --git a/libclamav/c++/llvm/test/Feature/NamedMDNode2.ll b/libclamav/c++/llvm/test/Feature/NamedMDNode2.ll index b560772c7..0524dd27a 100644 --- a/libclamav/c++/llvm/test/Feature/NamedMDNode2.ll +++ b/libclamav/c++/llvm/test/Feature/NamedMDNode2.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s -f -o /dev/null +; RUN: llvm-as < %s -o /dev/null ; PR4654 diff --git a/libclamav/c++/llvm/test/Feature/globalredefinition3.ll b/libclamav/c++/llvm/test/Feature/globalredefinition3.ll index 0183e5a04..5a5b3f1f8 100644 --- a/libclamav/c++/llvm/test/Feature/globalredefinition3.ll +++ b/libclamav/c++/llvm/test/Feature/globalredefinition3.ll @@ -1,4 +1,4 @@ -; RUN: not llvm-as %s -o /dev/null -f |& grep {redefinition of global '@B'} +; RUN: not llvm-as %s -o /dev/null |& grep {redefinition of global '@B'} @B = global i32 7 @B = global i32 7 diff --git a/libclamav/c++/llvm/test/FrontendC++/2003-08-20-ExceptionFail.cpp b/libclamav/c++/llvm/test/FrontendC++/2003-08-20-ExceptionFail.cpp index fd1c6ad4c..f071c3c0e 100644 --- a/libclamav/c++/llvm/test/FrontendC++/2003-08-20-ExceptionFail.cpp +++ b/libclamav/c++/llvm/test/FrontendC++/2003-08-20-ExceptionFail.cpp @@ -1,4 +1,4 @@ -// RUN: %llvmgxx -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgxx -S %s -o - | llvm-as -o /dev/null void foo(); diff --git a/libclamav/c++/llvm/test/FrontendC++/2003-08-21-EmptyClass.cpp b/libclamav/c++/llvm/test/FrontendC++/2003-08-21-EmptyClass.cpp index 2f90b3a10..5dbfa33e0 100644 --- a/libclamav/c++/llvm/test/FrontendC++/2003-08-21-EmptyClass.cpp +++ b/libclamav/c++/llvm/test/FrontendC++/2003-08-21-EmptyClass.cpp @@ -1,4 +1,4 @@ -// RUN: %llvmgxx -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgxx -S %s -o - | llvm-as -o /dev/null // This tests compilation of EMPTY_CLASS_EXPR's diff --git a/libclamav/c++/llvm/test/FrontendC++/2003-08-27-TypeNamespaces.cpp b/libclamav/c++/llvm/test/FrontendC++/2003-08-27-TypeNamespaces.cpp index cd7247e60..dec97180a 100644 --- a/libclamav/c++/llvm/test/FrontendC++/2003-08-27-TypeNamespaces.cpp +++ b/libclamav/c++/llvm/test/FrontendC++/2003-08-27-TypeNamespaces.cpp @@ -1,4 +1,4 @@ -// RUN: %llvmgxx -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgxx -S %s -o - | llvm-as -o /dev/null namespace foo { diff --git a/libclamav/c++/llvm/test/FrontendC++/2003-08-28-ForwardType.cpp b/libclamav/c++/llvm/test/FrontendC++/2003-08-28-ForwardType.cpp index 38c4e2d84..9330e94ae 100644 --- a/libclamav/c++/llvm/test/FrontendC++/2003-08-28-ForwardType.cpp +++ b/libclamav/c++/llvm/test/FrontendC++/2003-08-28-ForwardType.cpp @@ -1,4 +1,4 @@ -// RUN: %llvmgxx -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgxx -S %s -o - | llvm-as -o /dev/null // Default placement versions of operator new. #include diff --git a/libclamav/c++/llvm/test/FrontendC++/2003-08-28-SaveExprBug.cpp b/libclamav/c++/llvm/test/FrontendC++/2003-08-28-SaveExprBug.cpp index 2be35d8d5..98c5f5d8d 100644 --- a/libclamav/c++/llvm/test/FrontendC++/2003-08-28-SaveExprBug.cpp +++ b/libclamav/c++/llvm/test/FrontendC++/2003-08-28-SaveExprBug.cpp @@ -1,4 +1,4 @@ -// RUN: %llvmgxx -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgxx -S %s -o - | llvm-as -o /dev/null char* eback(); diff --git a/libclamav/c++/llvm/test/FrontendC++/2003-08-31-StructLayout.cpp b/libclamav/c++/llvm/test/FrontendC++/2003-08-31-StructLayout.cpp index 99d668266..a45ad030e 100644 --- a/libclamav/c++/llvm/test/FrontendC++/2003-08-31-StructLayout.cpp +++ b/libclamav/c++/llvm/test/FrontendC++/2003-08-31-StructLayout.cpp @@ -1,4 +1,4 @@ -// RUN: %llvmgxx -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgxx -S %s -o - | llvm-as -o /dev/null // There is a HOLE in the derived2 object due to not wanting to place the two // baseclass instances at the same offset! diff --git a/libclamav/c++/llvm/test/FrontendC++/2003-09-22-CompositeExprValue.cpp b/libclamav/c++/llvm/test/FrontendC++/2003-09-22-CompositeExprValue.cpp index a8208adc5..3bd707ed8 100644 --- a/libclamav/c++/llvm/test/FrontendC++/2003-09-22-CompositeExprValue.cpp +++ b/libclamav/c++/llvm/test/FrontendC++/2003-09-22-CompositeExprValue.cpp @@ -1,4 +1,4 @@ -// RUN: %llvmgxx -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgxx -S %s -o - | llvm-as -o /dev/null struct duration { duration operator/=(int c) { diff --git a/libclamav/c++/llvm/test/FrontendC++/2003-09-29-ArgumentNumberMismatch.cpp b/libclamav/c++/llvm/test/FrontendC++/2003-09-29-ArgumentNumberMismatch.cpp index 4873123d1..72997c524 100644 --- a/libclamav/c++/llvm/test/FrontendC++/2003-09-29-ArgumentNumberMismatch.cpp +++ b/libclamav/c++/llvm/test/FrontendC++/2003-09-29-ArgumentNumberMismatch.cpp @@ -1,4 +1,4 @@ -// RUN: %llvmgxx -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgxx -S %s -o - | llvm-as -o /dev/null // Non-POD classes cannot be passed into a function by component, because their // dtors must be run. Instead, pass them in by reference. The C++ front-end diff --git a/libclamav/c++/llvm/test/FrontendC++/2003-09-30-CommaExprBug.cpp b/libclamav/c++/llvm/test/FrontendC++/2003-09-30-CommaExprBug.cpp index afe470cd1..365795daf 100644 --- a/libclamav/c++/llvm/test/FrontendC++/2003-09-30-CommaExprBug.cpp +++ b/libclamav/c++/llvm/test/FrontendC++/2003-09-30-CommaExprBug.cpp @@ -1,4 +1,4 @@ -// RUN: %llvmgxx -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgxx -S %s -o - | llvm-as -o /dev/null class Empty {}; diff --git a/libclamav/c++/llvm/test/FrontendC++/2003-09-30-ForIncrementExprBug.cpp b/libclamav/c++/llvm/test/FrontendC++/2003-09-30-ForIncrementExprBug.cpp index 40c9c87ae..63f62f28d 100644 --- a/libclamav/c++/llvm/test/FrontendC++/2003-09-30-ForIncrementExprBug.cpp +++ b/libclamav/c++/llvm/test/FrontendC++/2003-09-30-ForIncrementExprBug.cpp @@ -1,4 +1,4 @@ -// RUN: %llvmgxx -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgxx -S %s -o - | llvm-as -o /dev/null struct C {}; diff --git a/libclamav/c++/llvm/test/FrontendC++/2003-09-30-ForIncrementExprBug2.cpp b/libclamav/c++/llvm/test/FrontendC++/2003-09-30-ForIncrementExprBug2.cpp index e07eb425d..a1eee71f5 100644 --- a/libclamav/c++/llvm/test/FrontendC++/2003-09-30-ForIncrementExprBug2.cpp +++ b/libclamav/c++/llvm/test/FrontendC++/2003-09-30-ForIncrementExprBug2.cpp @@ -1,4 +1,4 @@ -// RUN: %llvmgxx -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgxx -S %s -o - | llvm-as -o /dev/null // Test with an opaque type diff --git a/libclamav/c++/llvm/test/FrontendC++/2003-09-30-NestedFunctionDecl.cpp b/libclamav/c++/llvm/test/FrontendC++/2003-09-30-NestedFunctionDecl.cpp index b1c54b89d..94c119989 100644 --- a/libclamav/c++/llvm/test/FrontendC++/2003-09-30-NestedFunctionDecl.cpp +++ b/libclamav/c++/llvm/test/FrontendC++/2003-09-30-NestedFunctionDecl.cpp @@ -1,4 +1,4 @@ -// RUN: %llvmgxx -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgxx -S %s -o - | llvm-as -o /dev/null // The C++ front-end thinks the two foo's are different, the LLVM emitter // thinks they are the same. The disconnect causes problems. diff --git a/libclamav/c++/llvm/test/FrontendC++/2003-10-17-BoolBitfields.cpp b/libclamav/c++/llvm/test/FrontendC++/2003-10-17-BoolBitfields.cpp index 547a367d3..103945df8 100644 --- a/libclamav/c++/llvm/test/FrontendC++/2003-10-17-BoolBitfields.cpp +++ b/libclamav/c++/llvm/test/FrontendC++/2003-10-17-BoolBitfields.cpp @@ -1,4 +1,4 @@ -// RUN: %llvmgxx -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgxx -S %s -o - | llvm-as -o /dev/null struct test { bool A : 1; diff --git a/libclamav/c++/llvm/test/FrontendC++/2003-10-27-VirtualBaseClassCrash.cpp b/libclamav/c++/llvm/test/FrontendC++/2003-10-27-VirtualBaseClassCrash.cpp index f9fc80ee9..abda017ab 100644 --- a/libclamav/c++/llvm/test/FrontendC++/2003-10-27-VirtualBaseClassCrash.cpp +++ b/libclamav/c++/llvm/test/FrontendC++/2003-10-27-VirtualBaseClassCrash.cpp @@ -1,4 +1,4 @@ -// RUN: %llvmgxx -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgxx -S %s -o - | llvm-as -o /dev/null template diff --git a/libclamav/c++/llvm/test/FrontendC++/2003-11-04-ArrayConstructors.cpp b/libclamav/c++/llvm/test/FrontendC++/2003-11-04-ArrayConstructors.cpp index 4df4f9b67..4ab33988e 100644 --- a/libclamav/c++/llvm/test/FrontendC++/2003-11-04-ArrayConstructors.cpp +++ b/libclamav/c++/llvm/test/FrontendC++/2003-11-04-ArrayConstructors.cpp @@ -1,4 +1,4 @@ -// RUN: %llvmgxx -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgxx -S %s -o - | llvm-as -o /dev/null struct Foo { diff --git a/libclamav/c++/llvm/test/FrontendC++/2003-11-04-CatchLabelName.cpp b/libclamav/c++/llvm/test/FrontendC++/2003-11-04-CatchLabelName.cpp index 8acf88ddb..7dbe788f4 100644 --- a/libclamav/c++/llvm/test/FrontendC++/2003-11-04-CatchLabelName.cpp +++ b/libclamav/c++/llvm/test/FrontendC++/2003-11-04-CatchLabelName.cpp @@ -1,4 +1,4 @@ -// RUN: %llvmgxx -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgxx -S %s -o - | llvm-as -o /dev/null #include diff --git a/libclamav/c++/llvm/test/FrontendC++/2003-11-18-EnumArray.cpp b/libclamav/c++/llvm/test/FrontendC++/2003-11-18-EnumArray.cpp index 6eaf9d66f..bb1b3bf30 100644 --- a/libclamav/c++/llvm/test/FrontendC++/2003-11-18-EnumArray.cpp +++ b/libclamav/c++/llvm/test/FrontendC++/2003-11-18-EnumArray.cpp @@ -1,4 +1,4 @@ -// RUN: %llvmgxx -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgxx -S %s -o - | llvm-as -o /dev/null enum TchkType { tchkNum, tchkString, tchkSCN, tchkNone diff --git a/libclamav/c++/llvm/test/FrontendC++/2003-11-18-PtrMemConstantInitializer.cpp b/libclamav/c++/llvm/test/FrontendC++/2003-11-18-PtrMemConstantInitializer.cpp index ae76a6c63..72609e7cc 100644 --- a/libclamav/c++/llvm/test/FrontendC++/2003-11-18-PtrMemConstantInitializer.cpp +++ b/libclamav/c++/llvm/test/FrontendC++/2003-11-18-PtrMemConstantInitializer.cpp @@ -1,4 +1,4 @@ -// RUN: %llvmgxx -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgxx -S %s -o - | llvm-as -o /dev/null struct Gfx { void opMoveSetShowText(); diff --git a/libclamav/c++/llvm/test/FrontendC++/2003-11-25-ReturningOpaqueByValue.cpp b/libclamav/c++/llvm/test/FrontendC++/2003-11-25-ReturningOpaqueByValue.cpp index 83fe1b3e8..5ea0a2c4a 100644 --- a/libclamav/c++/llvm/test/FrontendC++/2003-11-25-ReturningOpaqueByValue.cpp +++ b/libclamav/c++/llvm/test/FrontendC++/2003-11-25-ReturningOpaqueByValue.cpp @@ -1,4 +1,4 @@ -// RUN: %llvmgxx -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgxx -S %s -o - | llvm-as -o /dev/null #include std::vector my_method (); diff --git a/libclamav/c++/llvm/test/FrontendC++/2003-11-27-MultipleInheritanceThunk.cpp b/libclamav/c++/llvm/test/FrontendC++/2003-11-27-MultipleInheritanceThunk.cpp index 16026c34b..99cfc8d21 100644 --- a/libclamav/c++/llvm/test/FrontendC++/2003-11-27-MultipleInheritanceThunk.cpp +++ b/libclamav/c++/llvm/test/FrontendC++/2003-11-27-MultipleInheritanceThunk.cpp @@ -1,4 +1,4 @@ -// RUN: %llvmgxx -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgxx -S %s -o - | llvm-as -o /dev/null struct CallSite { diff --git a/libclamav/c++/llvm/test/FrontendC++/2003-11-29-DuplicatedCleanupTest.cpp b/libclamav/c++/llvm/test/FrontendC++/2003-11-29-DuplicatedCleanupTest.cpp index 8131baafa..8df95cb1e 100644 --- a/libclamav/c++/llvm/test/FrontendC++/2003-11-29-DuplicatedCleanupTest.cpp +++ b/libclamav/c++/llvm/test/FrontendC++/2003-11-29-DuplicatedCleanupTest.cpp @@ -1,4 +1,4 @@ -// RUN: %llvmgxx -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgxx -S %s -o - | llvm-as -o /dev/null void doesntThrow() throw(); diff --git a/libclamav/c++/llvm/test/FrontendC++/2003-12-08-ArrayOfPtrToMemberFunc.cpp b/libclamav/c++/llvm/test/FrontendC++/2003-12-08-ArrayOfPtrToMemberFunc.cpp index d51223402..b87e7869e 100644 --- a/libclamav/c++/llvm/test/FrontendC++/2003-12-08-ArrayOfPtrToMemberFunc.cpp +++ b/libclamav/c++/llvm/test/FrontendC++/2003-12-08-ArrayOfPtrToMemberFunc.cpp @@ -1,4 +1,4 @@ -// RUN: %llvmgxx -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgxx -S %s -o - | llvm-as -o /dev/null struct Evil { void fun (); diff --git a/libclamav/c++/llvm/test/FrontendC++/2004-03-08-ReinterpretCastCopy.cpp b/libclamav/c++/llvm/test/FrontendC++/2004-03-08-ReinterpretCastCopy.cpp index 755d7c762..35880ab36 100644 --- a/libclamav/c++/llvm/test/FrontendC++/2004-03-08-ReinterpretCastCopy.cpp +++ b/libclamav/c++/llvm/test/FrontendC++/2004-03-08-ReinterpretCastCopy.cpp @@ -1,4 +1,4 @@ -// RUN: %llvmgxx -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgxx -S %s -o - | llvm-as -o /dev/null struct A { virtual void Method() = 0; diff --git a/libclamav/c++/llvm/test/FrontendC++/2004-03-15-CleanupsAndGotos.cpp b/libclamav/c++/llvm/test/FrontendC++/2004-03-15-CleanupsAndGotos.cpp index 9bc70c84a..c2e52f66d 100644 --- a/libclamav/c++/llvm/test/FrontendC++/2004-03-15-CleanupsAndGotos.cpp +++ b/libclamav/c++/llvm/test/FrontendC++/2004-03-15-CleanupsAndGotos.cpp @@ -1,4 +1,4 @@ -// RUN: %llvmgxx -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgxx -S %s -o - | llvm-as -o /dev/null // Testcase from Bug 291 diff --git a/libclamav/c++/llvm/test/FrontendC++/2004-06-08-LateTemplateInstantiation.cpp b/libclamav/c++/llvm/test/FrontendC++/2004-06-08-LateTemplateInstantiation.cpp index 16d8e5edf..4ad4c7d06 100644 --- a/libclamav/c++/llvm/test/FrontendC++/2004-06-08-LateTemplateInstantiation.cpp +++ b/libclamav/c++/llvm/test/FrontendC++/2004-06-08-LateTemplateInstantiation.cpp @@ -1,4 +1,4 @@ -// RUN: %llvmgxx -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgxx -S %s -o - | llvm-as -o /dev/null diff --git a/libclamav/c++/llvm/test/FrontendC++/2004-09-27-CompilerCrash.cpp b/libclamav/c++/llvm/test/FrontendC++/2004-09-27-CompilerCrash.cpp index f507c2391..f52baaf70 100644 --- a/libclamav/c++/llvm/test/FrontendC++/2004-09-27-CompilerCrash.cpp +++ b/libclamav/c++/llvm/test/FrontendC++/2004-09-27-CompilerCrash.cpp @@ -1,4 +1,4 @@ -// RUN: %llvmgxx -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgxx -S %s -o - | llvm-as -o /dev/null struct Pass {} ; template diff --git a/libclamav/c++/llvm/test/FrontendC++/2006-11-06-StackTrace.cpp b/libclamav/c++/llvm/test/FrontendC++/2006-11-06-StackTrace.cpp index e83a87f02..bbb9af199 100644 --- a/libclamav/c++/llvm/test/FrontendC++/2006-11-06-StackTrace.cpp +++ b/libclamav/c++/llvm/test/FrontendC++/2006-11-06-StackTrace.cpp @@ -1,7 +1,7 @@ // This is a regression test on debug info to make sure that we can get a // meaningful stack trace from a C++ program. // RUN: %llvmgcc -S -O0 -g %s -o - | llvm-as | \ -// RUN: llc --disable-fp-elim -o %t.s -f -O0 -relocation-model=pic +// RUN: llc --disable-fp-elim -o %t.s -O0 -relocation-model=pic // RUN: %compile_c %t.s -o %t.o // RUN: %link %t.o -o %t.exe // RUN: echo {break DeepStack::deepest\nrun 17\nwhere\n} > %t.in diff --git a/libclamav/c++/llvm/test/FrontendC++/2006-11-30-NoCompileUnit.cpp b/libclamav/c++/llvm/test/FrontendC++/2006-11-30-NoCompileUnit.cpp index 4b5cf510f..3522c6708 100644 --- a/libclamav/c++/llvm/test/FrontendC++/2006-11-30-NoCompileUnit.cpp +++ b/libclamav/c++/llvm/test/FrontendC++/2006-11-30-NoCompileUnit.cpp @@ -1,7 +1,7 @@ // This is a regression test on debug info to make sure we don't hit a compile // unit size issue with gdb. // RUN: %llvmgcc -S -O0 -g %s -o - | llvm-as | \ -// RUN: llc --disable-fp-elim -o NoCompileUnit.s -f +// RUN: llc --disable-fp-elim -o NoCompileUnit.s // RUN: %compile_c NoCompileUnit.s -o NoCompileUnit.o // RUN: %link NoCompileUnit.o -o NoCompileUnit.exe // RUN: echo {break main\nrun\np NoCompileUnit::pubname} > %t2 diff --git a/libclamav/c++/llvm/test/FrontendC++/2006-11-30-Pubnames.cpp b/libclamav/c++/llvm/test/FrontendC++/2006-11-30-Pubnames.cpp index b1df02d3f..b44566af6 100644 --- a/libclamav/c++/llvm/test/FrontendC++/2006-11-30-Pubnames.cpp +++ b/libclamav/c++/llvm/test/FrontendC++/2006-11-30-Pubnames.cpp @@ -1,7 +1,7 @@ // This is a regression test on debug info to make sure that we can access // qualified global names. // RUN: %llvmgcc -S -O0 -g %s -o - | llvm-as | \ -// RUN: llc --disable-fp-elim -o %t.s -f -O0 +// RUN: llc --disable-fp-elim -o %t.s -O0 // RUN: %compile_c %t.s -o %t.o // RUN: %link %t.o -o %t.exe // RUN: %llvmdsymutil %t.exe diff --git a/libclamav/c++/llvm/test/FrontendC++/2007-04-05-PackedBitFields-1.cpp b/libclamav/c++/llvm/test/FrontendC++/2007-04-05-PackedBitFields-1.cpp index 4797baf2d..174dddf6a 100644 --- a/libclamav/c++/llvm/test/FrontendC++/2007-04-05-PackedBitFields-1.cpp +++ b/libclamav/c++/llvm/test/FrontendC++/2007-04-05-PackedBitFields-1.cpp @@ -1,4 +1,4 @@ -// RUN: %llvmgxx -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgxx -S %s -o - | llvm-as -o /dev/null #ifdef PACKED #define P __attribute__((packed)) diff --git a/libclamav/c++/llvm/test/FrontendC++/2007-04-05-PackedBitFieldsOverlap-2.cpp b/libclamav/c++/llvm/test/FrontendC++/2007-04-05-PackedBitFieldsOverlap-2.cpp index 3ba5d7bd8..55da1a6ab 100644 --- a/libclamav/c++/llvm/test/FrontendC++/2007-04-05-PackedBitFieldsOverlap-2.cpp +++ b/libclamav/c++/llvm/test/FrontendC++/2007-04-05-PackedBitFieldsOverlap-2.cpp @@ -1,4 +1,4 @@ -// RUN: %llvmgxx -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgxx -S %s -o - | llvm-as -o /dev/null #ifdef PACKED #define P __attribute__((packed)) diff --git a/libclamav/c++/llvm/test/FrontendC++/2007-04-05-PackedBitFieldsOverlap.cpp b/libclamav/c++/llvm/test/FrontendC++/2007-04-05-PackedBitFieldsOverlap.cpp index ad272c947..46a89491e 100644 --- a/libclamav/c++/llvm/test/FrontendC++/2007-04-05-PackedBitFieldsOverlap.cpp +++ b/libclamav/c++/llvm/test/FrontendC++/2007-04-05-PackedBitFieldsOverlap.cpp @@ -1,4 +1,4 @@ -// RUN: %llvmgxx -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgxx -S %s -o - | llvm-as -o /dev/null #ifdef PACKED diff --git a/libclamav/c++/llvm/test/FrontendC++/2007-04-05-PackedBitFieldsSmall.cpp b/libclamav/c++/llvm/test/FrontendC++/2007-04-05-PackedBitFieldsSmall.cpp index e7517dd74..7377b8292 100644 --- a/libclamav/c++/llvm/test/FrontendC++/2007-04-05-PackedBitFieldsSmall.cpp +++ b/libclamav/c++/llvm/test/FrontendC++/2007-04-05-PackedBitFieldsSmall.cpp @@ -1,4 +1,4 @@ -// RUN: %llvmgxx -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgxx -S %s -o - | llvm-as -o /dev/null #ifdef PACKED diff --git a/libclamav/c++/llvm/test/FrontendC++/2007-04-05-StructPackedFieldUnpacked.cpp b/libclamav/c++/llvm/test/FrontendC++/2007-04-05-StructPackedFieldUnpacked.cpp index 52e247133..b550b5fdb 100644 --- a/libclamav/c++/llvm/test/FrontendC++/2007-04-05-StructPackedFieldUnpacked.cpp +++ b/libclamav/c++/llvm/test/FrontendC++/2007-04-05-StructPackedFieldUnpacked.cpp @@ -1,4 +1,4 @@ -// RUN: %llvmgxx -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgxx -S %s -o - | llvm-as -o /dev/null #ifdef PACKED #define P __attribute__((packed)) diff --git a/libclamav/c++/llvm/test/FrontendC++/2009-02-16-AnonTypedef-Dbg.cpp b/libclamav/c++/llvm/test/FrontendC++/2009-02-16-AnonTypedef-Dbg.cpp deleted file mode 100644 index 56508b7c5..000000000 --- a/libclamav/c++/llvm/test/FrontendC++/2009-02-16-AnonTypedef-Dbg.cpp +++ /dev/null @@ -1,5 +0,0 @@ -// Test on debug info to make sure that anon typedef info is emitted. -// RUN: %llvmgcc -S --emit-llvm -x c++ -g %s -o - | grep composite -typedef struct { int a; long b; } foo; -foo x; - diff --git a/libclamav/c++/llvm/test/FrontendC++/2009-04-21-DtorNames-dbg.cpp b/libclamav/c++/llvm/test/FrontendC++/2009-04-21-DtorNames-dbg.cpp index dfc607e65..997c3f703 100644 --- a/libclamav/c++/llvm/test/FrontendC++/2009-04-21-DtorNames-dbg.cpp +++ b/libclamav/c++/llvm/test/FrontendC++/2009-04-21-DtorNames-dbg.cpp @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -c -g %s -o - | llc -O0 -f -o %t.s +// RUN: %llvmgcc -c -g %s -o - | llc -O0 -o %t.s // RUN: %compile_c %t.s -o %t.o // PR4025 diff --git a/libclamav/c++/llvm/test/FrontendC++/2009-07-15-LineNumbers.cpp b/libclamav/c++/llvm/test/FrontendC++/2009-07-15-LineNumbers.cpp index 6030c172a..54624a366 100644 --- a/libclamav/c++/llvm/test/FrontendC++/2009-07-15-LineNumbers.cpp +++ b/libclamav/c++/llvm/test/FrontendC++/2009-07-15-LineNumbers.cpp @@ -1,7 +1,7 @@ // This is a regression test on debug info to make sure that we can // print line numbers in asm. // RUN: %llvmgcc -S -O0 -g %s -o - | llvm-as | \ -// RUN: llc --disable-fp-elim -f -O0 -relocation-model=pic | grep {# SrcLine 25} +// RUN: llc --disable-fp-elim -O0 -relocation-model=pic | grep {# SrcLine 25} // XFAIL: * #include diff --git a/libclamav/c++/llvm/test/FrontendC/2002-01-23-LoadQISIReloadFailure.c b/libclamav/c++/llvm/test/FrontendC/2002-01-23-LoadQISIReloadFailure.c index 258d3cc0e..1779a9994 100644 --- a/libclamav/c++/llvm/test/FrontendC/2002-01-23-LoadQISIReloadFailure.c +++ b/libclamav/c++/llvm/test/FrontendC/2002-01-23-LoadQISIReloadFailure.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null /* Regression test. Just compile .c -> .ll to test */ int foo(void) { diff --git a/libclamav/c++/llvm/test/FrontendC/2002-01-24-ComplexSpaceInType.c b/libclamav/c++/llvm/test/FrontendC/2002-01-24-ComplexSpaceInType.c index 9559d5b37..13d92c730 100644 --- a/libclamav/c++/llvm/test/FrontendC/2002-01-24-ComplexSpaceInType.c +++ b/libclamav/c++/llvm/test/FrontendC/2002-01-24-ComplexSpaceInType.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null // This caused generation of the following type name: // %Array = uninitialized global [10 x %complex int] diff --git a/libclamav/c++/llvm/test/FrontendC/2002-01-24-HandleCallInsnSEGV.c b/libclamav/c++/llvm/test/FrontendC/2002-01-24-HandleCallInsnSEGV.c index 09029fb94..e619cf469 100644 --- a/libclamav/c++/llvm/test/FrontendC/2002-01-24-HandleCallInsnSEGV.c +++ b/libclamav/c++/llvm/test/FrontendC/2002-01-24-HandleCallInsnSEGV.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null void *dlclose(void*); diff --git a/libclamav/c++/llvm/test/FrontendC/2002-02-13-ConditionalInCall.c b/libclamav/c++/llvm/test/FrontendC/2002-02-13-ConditionalInCall.c index 0dad6ff5c..f361088c1 100644 --- a/libclamav/c++/llvm/test/FrontendC/2002-02-13-ConditionalInCall.c +++ b/libclamav/c++/llvm/test/FrontendC/2002-02-13-ConditionalInCall.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null /* Test problem where bad code was generated with a ?: statement was in a function call argument */ diff --git a/libclamav/c++/llvm/test/FrontendC/2002-02-13-ReloadProblem.c b/libclamav/c++/llvm/test/FrontendC/2002-02-13-ReloadProblem.c index ab9b56da3..2ae97b722 100644 --- a/libclamav/c++/llvm/test/FrontendC/2002-02-13-ReloadProblem.c +++ b/libclamav/c++/llvm/test/FrontendC/2002-02-13-ReloadProblem.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null /* This triggered a problem in reload, fixed by disabling most of the * steps of compilation in GCC. Before this change, the code went through diff --git a/libclamav/c++/llvm/test/FrontendC/2002-02-13-TypeVarNameCollision.c b/libclamav/c++/llvm/test/FrontendC/2002-02-13-TypeVarNameCollision.c index ec334013a..2dede68a3 100644 --- a/libclamav/c++/llvm/test/FrontendC/2002-02-13-TypeVarNameCollision.c +++ b/libclamav/c++/llvm/test/FrontendC/2002-02-13-TypeVarNameCollision.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null /* This testcase causes a symbol table collision. Type names and variable * names should be in distinct namespaces diff --git a/libclamav/c++/llvm/test/FrontendC/2002-02-13-UnnamedLocal.c b/libclamav/c++/llvm/test/FrontendC/2002-02-13-UnnamedLocal.c index 6fdc7efdd..85aa61520 100644 --- a/libclamav/c++/llvm/test/FrontendC/2002-02-13-UnnamedLocal.c +++ b/libclamav/c++/llvm/test/FrontendC/2002-02-13-UnnamedLocal.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null /* Testcase for a problem where GCC allocated xqic to a register, * and did not have a VAR_DECL that explained the stack slot to LLVM. diff --git a/libclamav/c++/llvm/test/FrontendC/2002-02-14-EntryNodePreds.c b/libclamav/c++/llvm/test/FrontendC/2002-02-14-EntryNodePreds.c index f1e01515f..851af9121 100644 --- a/libclamav/c++/llvm/test/FrontendC/2002-02-14-EntryNodePreds.c +++ b/libclamav/c++/llvm/test/FrontendC/2002-02-14-EntryNodePreds.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null /* GCC Used to generate code that contained a branch to the entry node of * the do_merge function. This is illegal LLVM code. To fix this, GCC now diff --git a/libclamav/c++/llvm/test/FrontendC/2002-02-16-RenamingTest.c b/libclamav/c++/llvm/test/FrontendC/2002-02-16-RenamingTest.c index 952af90c8..6042b67dc 100644 --- a/libclamav/c++/llvm/test/FrontendC/2002-02-16-RenamingTest.c +++ b/libclamav/c++/llvm/test/FrontendC/2002-02-16-RenamingTest.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null /* test that locals are renamed with . notation */ diff --git a/libclamav/c++/llvm/test/FrontendC/2002-02-17-ArgumentAddress.c b/libclamav/c++/llvm/test/FrontendC/2002-02-17-ArgumentAddress.c index 937929559..acd7e37a7 100644 --- a/libclamav/c++/llvm/test/FrontendC/2002-02-17-ArgumentAddress.c +++ b/libclamav/c++/llvm/test/FrontendC/2002-02-17-ArgumentAddress.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null int test(int X) { return X; diff --git a/libclamav/c++/llvm/test/FrontendC/2002-02-18-64bitConstant.c b/libclamav/c++/llvm/test/FrontendC/2002-02-18-64bitConstant.c index 31e5c6ead..a88587a96 100644 --- a/libclamav/c++/llvm/test/FrontendC/2002-02-18-64bitConstant.c +++ b/libclamav/c++/llvm/test/FrontendC/2002-02-18-64bitConstant.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null /* GCC wasn't handling 64 bit constants right fixed */ diff --git a/libclamav/c++/llvm/test/FrontendC/2002-02-18-StaticData.c b/libclamav/c++/llvm/test/FrontendC/2002-02-18-StaticData.c index 10439c373..76cb0e670 100644 --- a/libclamav/c++/llvm/test/FrontendC/2002-02-18-StaticData.c +++ b/libclamav/c++/llvm/test/FrontendC/2002-02-18-StaticData.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null double FOO = 17; diff --git a/libclamav/c++/llvm/test/FrontendC/2002-03-11-LargeCharInString.c b/libclamav/c++/llvm/test/FrontendC/2002-03-11-LargeCharInString.c index d8a1671fc..b383d03f7 100644 --- a/libclamav/c++/llvm/test/FrontendC/2002-03-11-LargeCharInString.c +++ b/libclamav/c++/llvm/test/FrontendC/2002-03-11-LargeCharInString.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null #include diff --git a/libclamav/c++/llvm/test/FrontendC/2002-03-12-ArrayInitialization.c b/libclamav/c++/llvm/test/FrontendC/2002-03-12-ArrayInitialization.c index d6cf44625..1997a3cd0 100644 --- a/libclamav/c++/llvm/test/FrontendC/2002-03-12-ArrayInitialization.c +++ b/libclamav/c++/llvm/test/FrontendC/2002-03-12-ArrayInitialization.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null /* GCC would generate bad code if not enough initializers are specified for an array. diff --git a/libclamav/c++/llvm/test/FrontendC/2002-03-12-StructInitialize.c b/libclamav/c++/llvm/test/FrontendC/2002-03-12-StructInitialize.c index 5174ad490..9eb11e187 100644 --- a/libclamav/c++/llvm/test/FrontendC/2002-03-12-StructInitialize.c +++ b/libclamav/c++/llvm/test/FrontendC/2002-03-12-StructInitialize.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null typedef struct Connection_Type { diff --git a/libclamav/c++/llvm/test/FrontendC/2002-03-12-StructInitializer.c b/libclamav/c++/llvm/test/FrontendC/2002-03-12-StructInitializer.c index cf2ba4e8c..fa333b78a 100644 --- a/libclamav/c++/llvm/test/FrontendC/2002-03-12-StructInitializer.c +++ b/libclamav/c++/llvm/test/FrontendC/2002-03-12-StructInitializer.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null /* GCC was not emitting string constants of the correct length when * embedded into a structure field like this. It thought the strlength diff --git a/libclamav/c++/llvm/test/FrontendC/2002-03-14-BrokenPHINode.c b/libclamav/c++/llvm/test/FrontendC/2002-03-14-BrokenPHINode.c index 16d9bc781..48d9ab705 100644 --- a/libclamav/c++/llvm/test/FrontendC/2002-03-14-BrokenPHINode.c +++ b/libclamav/c++/llvm/test/FrontendC/2002-03-14-BrokenPHINode.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null /* GCC was generating PHI nodes with an arity < #pred of the basic block the * PHI node lived in. This was breaking LLVM because the number of entries diff --git a/libclamav/c++/llvm/test/FrontendC/2002-03-14-BrokenSSA.c b/libclamav/c++/llvm/test/FrontendC/2002-03-14-BrokenSSA.c index 01f259738..9dc674aea 100644 --- a/libclamav/c++/llvm/test/FrontendC/2002-03-14-BrokenSSA.c +++ b/libclamav/c++/llvm/test/FrontendC/2002-03-14-BrokenSSA.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null /* This code used to break GCC's SSA computation code. It would create uses of B & C that are not dominated by their definitions. See: diff --git a/libclamav/c++/llvm/test/FrontendC/2002-03-14-QuotesInStrConst.c b/libclamav/c++/llvm/test/FrontendC/2002-03-14-QuotesInStrConst.c index 42f82bfa8..63eaeef46 100644 --- a/libclamav/c++/llvm/test/FrontendC/2002-03-14-QuotesInStrConst.c +++ b/libclamav/c++/llvm/test/FrontendC/2002-03-14-QuotesInStrConst.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null /* GCC was not escaping quotes in string constants correctly, so this would * get emitted: diff --git a/libclamav/c++/llvm/test/FrontendC/2002-04-07-SwitchStmt.c b/libclamav/c++/llvm/test/FrontendC/2002-04-07-SwitchStmt.c index 79632c9eb..33e9c3d7a 100644 --- a/libclamav/c++/llvm/test/FrontendC/2002-04-07-SwitchStmt.c +++ b/libclamav/c++/llvm/test/FrontendC/2002-04-07-SwitchStmt.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null int printf(const char *, ...); int foo(); diff --git a/libclamav/c++/llvm/test/FrontendC/2002-04-08-LocalArray.c b/libclamav/c++/llvm/test/FrontendC/2002-04-08-LocalArray.c index 75475a1b3..1dc51a092 100644 --- a/libclamav/c++/llvm/test/FrontendC/2002-04-08-LocalArray.c +++ b/libclamav/c++/llvm/test/FrontendC/2002-04-08-LocalArray.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null /* GCC is not outputting the static array to the LLVM backend, so bad things * happen. Note that if this is defined static, everything seems fine. diff --git a/libclamav/c++/llvm/test/FrontendC/2002-04-09-StructRetVal.c b/libclamav/c++/llvm/test/FrontendC/2002-04-09-StructRetVal.c index c655e4a4d..de3b6fc26 100644 --- a/libclamav/c++/llvm/test/FrontendC/2002-04-09-StructRetVal.c +++ b/libclamav/c++/llvm/test/FrontendC/2002-04-09-StructRetVal.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null struct S { int i; diff --git a/libclamav/c++/llvm/test/FrontendC/2002-04-10-StructParameters.c b/libclamav/c++/llvm/test/FrontendC/2002-04-10-StructParameters.c index 9db6a132b..aaaba2abd 100644 --- a/libclamav/c++/llvm/test/FrontendC/2002-04-10-StructParameters.c +++ b/libclamav/c++/llvm/test/FrontendC/2002-04-10-StructParameters.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null typedef struct { diff --git a/libclamav/c++/llvm/test/FrontendC/2002-05-23-StaticValues.c b/libclamav/c++/llvm/test/FrontendC/2002-05-23-StaticValues.c index bf583e203..a5753b95f 100644 --- a/libclamav/c++/llvm/test/FrontendC/2002-05-23-StaticValues.c +++ b/libclamav/c++/llvm/test/FrontendC/2002-05-23-StaticValues.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null /* Make sure the frontend is correctly marking static stuff as internal! */ diff --git a/libclamav/c++/llvm/test/FrontendC/2002-05-23-TypeNameCollision.c b/libclamav/c++/llvm/test/FrontendC/2002-05-23-TypeNameCollision.c index 43faf97b1..25d114965 100644 --- a/libclamav/c++/llvm/test/FrontendC/2002-05-23-TypeNameCollision.c +++ b/libclamav/c++/llvm/test/FrontendC/2002-05-23-TypeNameCollision.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null /* Testcase for when struct tag conflicts with typedef name... grr */ diff --git a/libclamav/c++/llvm/test/FrontendC/2002-05-24-Alloca.c b/libclamav/c++/llvm/test/FrontendC/2002-05-24-Alloca.c index ac5b78d0c..128bc8b7c 100644 --- a/libclamav/c++/llvm/test/FrontendC/2002-05-24-Alloca.c +++ b/libclamav/c++/llvm/test/FrontendC/2002-05-24-Alloca.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null #include #include diff --git a/libclamav/c++/llvm/test/FrontendC/2002-06-25-FWriteInterfaceFailure.c b/libclamav/c++/llvm/test/FrontendC/2002-06-25-FWriteInterfaceFailure.c index fb1b54bf7..4380dc7b2 100644 --- a/libclamav/c++/llvm/test/FrontendC/2002-06-25-FWriteInterfaceFailure.c +++ b/libclamav/c++/llvm/test/FrontendC/2002-06-25-FWriteInterfaceFailure.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null #include diff --git a/libclamav/c++/llvm/test/FrontendC/2002-07-14-MiscListTests.c b/libclamav/c++/llvm/test/FrontendC/2002-07-14-MiscListTests.c index baae585f6..4a5459ad7 100644 --- a/libclamav/c++/llvm/test/FrontendC/2002-07-14-MiscListTests.c +++ b/libclamav/c++/llvm/test/FrontendC/2002-07-14-MiscListTests.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null // Test list stuff diff --git a/libclamav/c++/llvm/test/FrontendC/2002-07-14-MiscTests.c b/libclamav/c++/llvm/test/FrontendC/2002-07-14-MiscTests.c index 02703e269..57c412083 100644 --- a/libclamav/c++/llvm/test/FrontendC/2002-07-14-MiscTests.c +++ b/libclamav/c++/llvm/test/FrontendC/2002-07-14-MiscTests.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -w -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -w -S %s -o - | llvm-as -o /dev/null /* These are random tests that I used when working on the GCC frontend originally. */ diff --git a/libclamav/c++/llvm/test/FrontendC/2002-07-14-MiscTests2.c b/libclamav/c++/llvm/test/FrontendC/2002-07-14-MiscTests2.c index ac58926ab..f2c7c81c4 100644 --- a/libclamav/c++/llvm/test/FrontendC/2002-07-14-MiscTests2.c +++ b/libclamav/c++/llvm/test/FrontendC/2002-07-14-MiscTests2.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null // Test ?: in function calls diff --git a/libclamav/c++/llvm/test/FrontendC/2002-07-14-MiscTests3.c b/libclamav/c++/llvm/test/FrontendC/2002-07-14-MiscTests3.c index 773193cef..7ef7e232d 100644 --- a/libclamav/c++/llvm/test/FrontendC/2002-07-14-MiscTests3.c +++ b/libclamav/c++/llvm/test/FrontendC/2002-07-14-MiscTests3.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -w -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -w -S %s -o - | llvm-as -o /dev/null diff --git a/libclamav/c++/llvm/test/FrontendC/2002-07-16-HardStringInit.c b/libclamav/c++/llvm/test/FrontendC/2002-07-16-HardStringInit.c index d1d03216c..2785e5189 100644 --- a/libclamav/c++/llvm/test/FrontendC/2002-07-16-HardStringInit.c +++ b/libclamav/c++/llvm/test/FrontendC/2002-07-16-HardStringInit.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null char auto_kibitz_list[100][20] = { {"diepx"}, diff --git a/libclamav/c++/llvm/test/FrontendC/2002-07-17-StringConstant.c b/libclamav/c++/llvm/test/FrontendC/2002-07-17-StringConstant.c index 8a392033f..9ba0c2521 100644 --- a/libclamav/c++/llvm/test/FrontendC/2002-07-17-StringConstant.c +++ b/libclamav/c++/llvm/test/FrontendC/2002-07-17-StringConstant.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null char * foo() { return "\\begin{"; } diff --git a/libclamav/c++/llvm/test/FrontendC/2002-07-29-Casts.c b/libclamav/c++/llvm/test/FrontendC/2002-07-29-Casts.c index 6794e80b5..44bb61019 100644 --- a/libclamav/c++/llvm/test/FrontendC/2002-07-29-Casts.c +++ b/libclamav/c++/llvm/test/FrontendC/2002-07-29-Casts.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null #include #include diff --git a/libclamav/c++/llvm/test/FrontendC/2002-07-30-SubregSetAssertion.c b/libclamav/c++/llvm/test/FrontendC/2002-07-30-SubregSetAssertion.c index 6d4f9f620..af72eda65 100644 --- a/libclamav/c++/llvm/test/FrontendC/2002-07-30-SubregSetAssertion.c +++ b/libclamav/c++/llvm/test/FrontendC/2002-07-30-SubregSetAssertion.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null union X { diff --git a/libclamav/c++/llvm/test/FrontendC/2002-07-30-UnionTest.c b/libclamav/c++/llvm/test/FrontendC/2002-07-30-UnionTest.c index b2c481e40..c931b8024 100644 --- a/libclamav/c++/llvm/test/FrontendC/2002-07-30-UnionTest.c +++ b/libclamav/c++/llvm/test/FrontendC/2002-07-30-UnionTest.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null union X; struct Empty {}; diff --git a/libclamav/c++/llvm/test/FrontendC/2002-07-30-VarArgsCallFailure.c b/libclamav/c++/llvm/test/FrontendC/2002-07-30-VarArgsCallFailure.c index b37a46222..5d93947a7 100644 --- a/libclamav/c++/llvm/test/FrontendC/2002-07-30-VarArgsCallFailure.c +++ b/libclamav/c++/llvm/test/FrontendC/2002-07-30-VarArgsCallFailure.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null int tcount; void test(char *, const char*, int); diff --git a/libclamav/c++/llvm/test/FrontendC/2002-07-31-BadAssert.c b/libclamav/c++/llvm/test/FrontendC/2002-07-31-BadAssert.c index 5801d03a0..5c3d74cfb 100644 --- a/libclamav/c++/llvm/test/FrontendC/2002-07-31-BadAssert.c +++ b/libclamav/c++/llvm/test/FrontendC/2002-07-31-BadAssert.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null typedef struct { diff --git a/libclamav/c++/llvm/test/FrontendC/2002-07-31-SubregFailure.c b/libclamav/c++/llvm/test/FrontendC/2002-07-31-SubregFailure.c index 15573f912..72fcb496c 100644 --- a/libclamav/c++/llvm/test/FrontendC/2002-07-31-SubregFailure.c +++ b/libclamav/c++/llvm/test/FrontendC/2002-07-31-SubregFailure.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null typedef union { diff --git a/libclamav/c++/llvm/test/FrontendC/2002-08-02-UnionTest.c b/libclamav/c++/llvm/test/FrontendC/2002-08-02-UnionTest.c index e0862ed10..e2b8c3dd4 100644 --- a/libclamav/c++/llvm/test/FrontendC/2002-08-02-UnionTest.c +++ b/libclamav/c++/llvm/test/FrontendC/2002-08-02-UnionTest.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null /* In this testcase, the return value of foo() is being promotedto a register * which breaks stuff diff --git a/libclamav/c++/llvm/test/FrontendC/2002-08-19-RecursiveLocals.c b/libclamav/c++/llvm/test/FrontendC/2002-08-19-RecursiveLocals.c index e5007af72..59220ac9b 100644 --- a/libclamav/c++/llvm/test/FrontendC/2002-08-19-RecursiveLocals.c +++ b/libclamav/c++/llvm/test/FrontendC/2002-08-19-RecursiveLocals.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null /* This testcase doesn't actually test a bug, it's just the result of me * figuring out the syntax for forward declaring a static variable. */ diff --git a/libclamav/c++/llvm/test/FrontendC/2002-09-08-PointerShifts.c b/libclamav/c++/llvm/test/FrontendC/2002-09-08-PointerShifts.c index cc7e91a7f..86ff2f98a 100644 --- a/libclamav/c++/llvm/test/FrontendC/2002-09-08-PointerShifts.c +++ b/libclamav/c++/llvm/test/FrontendC/2002-09-08-PointerShifts.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null int foo(int *A, unsigned X) { diff --git a/libclamav/c++/llvm/test/FrontendC/2002-09-18-UnionProblem.c b/libclamav/c++/llvm/test/FrontendC/2002-09-18-UnionProblem.c index 56ec6cec8..54588f121 100644 --- a/libclamav/c++/llvm/test/FrontendC/2002-09-18-UnionProblem.c +++ b/libclamav/c++/llvm/test/FrontendC/2002-09-18-UnionProblem.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null struct DWstruct { diff --git a/libclamav/c++/llvm/test/FrontendC/2002-09-19-StarInLabel.c b/libclamav/c++/llvm/test/FrontendC/2002-09-19-StarInLabel.c index 86a2571d5..171acca2f 100644 --- a/libclamav/c++/llvm/test/FrontendC/2002-09-19-StarInLabel.c +++ b/libclamav/c++/llvm/test/FrontendC/2002-09-19-StarInLabel.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null extern void start() __asm__("start"); extern void _start() __asm__("_start"); diff --git a/libclamav/c++/llvm/test/FrontendC/2002-10-12-TooManyArguments.c b/libclamav/c++/llvm/test/FrontendC/2002-10-12-TooManyArguments.c index 206cdd98d..73c267ad3 100644 --- a/libclamav/c++/llvm/test/FrontendC/2002-10-12-TooManyArguments.c +++ b/libclamav/c++/llvm/test/FrontendC/2002-10-12-TooManyArguments.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null void foo() {} diff --git a/libclamav/c++/llvm/test/FrontendC/2002-12-15-GlobalBoolTest.c b/libclamav/c++/llvm/test/FrontendC/2002-12-15-GlobalBoolTest.c index 6b27391d9..c27a23abc 100644 --- a/libclamav/c++/llvm/test/FrontendC/2002-12-15-GlobalBoolTest.c +++ b/libclamav/c++/llvm/test/FrontendC/2002-12-15-GlobalBoolTest.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null _Bool X = 0; diff --git a/libclamav/c++/llvm/test/FrontendC/2002-12-15-GlobalConstantTest.c b/libclamav/c++/llvm/test/FrontendC/2002-12-15-GlobalConstantTest.c index a5a679db6..26de48fbb 100644 --- a/libclamav/c++/llvm/test/FrontendC/2002-12-15-GlobalConstantTest.c +++ b/libclamav/c++/llvm/test/FrontendC/2002-12-15-GlobalConstantTest.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null const char *W = "foo"; diff --git a/libclamav/c++/llvm/test/FrontendC/2002-12-15-GlobalRedefinition.c b/libclamav/c++/llvm/test/FrontendC/2002-12-15-GlobalRedefinition.c index 39632a150..3b76953b0 100644 --- a/libclamav/c++/llvm/test/FrontendC/2002-12-15-GlobalRedefinition.c +++ b/libclamav/c++/llvm/test/FrontendC/2002-12-15-GlobalRedefinition.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null extern char algbrfile[9]; char algbrfile[9] = "abcdefgh"; diff --git a/libclamav/c++/llvm/test/FrontendC/2002-12-15-StructParameters.c b/libclamav/c++/llvm/test/FrontendC/2002-12-15-StructParameters.c index c85dab1cd..90ab1ff44 100644 --- a/libclamav/c++/llvm/test/FrontendC/2002-12-15-StructParameters.c +++ b/libclamav/c++/llvm/test/FrontendC/2002-12-15-StructParameters.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null typedef struct { diff --git a/libclamav/c++/llvm/test/FrontendC/2003-03-03-DeferredType.c b/libclamav/c++/llvm/test/FrontendC/2003-03-03-DeferredType.c index fa51991b3..9e60df6f6 100644 --- a/libclamav/c++/llvm/test/FrontendC/2003-03-03-DeferredType.c +++ b/libclamav/c++/llvm/test/FrontendC/2003-03-03-DeferredType.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null diff --git a/libclamav/c++/llvm/test/FrontendC/2003-06-22-UnionCrash.c b/libclamav/c++/llvm/test/FrontendC/2003-06-22-UnionCrash.c index dab0716ae..54d8dc6dd 100644 --- a/libclamav/c++/llvm/test/FrontendC/2003-06-22-UnionCrash.c +++ b/libclamav/c++/llvm/test/FrontendC/2003-06-22-UnionCrash.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null struct Blend_Map_Entry { union { diff --git a/libclamav/c++/llvm/test/FrontendC/2003-06-23-GCC-fold-infinite-recursion.c b/libclamav/c++/llvm/test/FrontendC/2003-06-23-GCC-fold-infinite-recursion.c index ba6627668..80562c884 100644 --- a/libclamav/c++/llvm/test/FrontendC/2003-06-23-GCC-fold-infinite-recursion.c +++ b/libclamav/c++/llvm/test/FrontendC/2003-06-23-GCC-fold-infinite-recursion.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null double Test(double A, double B, double C, double D) { return -(A-B) - (C-D); diff --git a/libclamav/c++/llvm/test/FrontendC/2003-06-26-CFECrash.c b/libclamav/c++/llvm/test/FrontendC/2003-06-26-CFECrash.c index bb6977f48..10a7ed444 100644 --- a/libclamav/c++/llvm/test/FrontendC/2003-06-26-CFECrash.c +++ b/libclamav/c++/llvm/test/FrontendC/2003-06-26-CFECrash.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null typedef struct min_info { long offset; diff --git a/libclamav/c++/llvm/test/FrontendC/2003-06-29-MultipleFunctionDefinition.c b/libclamav/c++/llvm/test/FrontendC/2003-06-29-MultipleFunctionDefinition.c index b7bc80330..be042cedf 100644 --- a/libclamav/c++/llvm/test/FrontendC/2003-06-29-MultipleFunctionDefinition.c +++ b/libclamav/c++/llvm/test/FrontendC/2003-06-29-MultipleFunctionDefinition.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null /* This is apparently legal C. */ diff --git a/libclamav/c++/llvm/test/FrontendC/2003-08-18-SigSetJmp.c b/libclamav/c++/llvm/test/FrontendC/2003-08-18-SigSetJmp.c index b7f4553f4..fc0d7659d 100644 --- a/libclamav/c++/llvm/test/FrontendC/2003-08-18-SigSetJmp.c +++ b/libclamav/c++/llvm/test/FrontendC/2003-08-18-SigSetJmp.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null #include diff --git a/libclamav/c++/llvm/test/FrontendC/2003-08-18-StructAsValue.c b/libclamav/c++/llvm/test/FrontendC/2003-08-18-StructAsValue.c index 649eadc4e..26cb78a4d 100644 --- a/libclamav/c++/llvm/test/FrontendC/2003-08-18-StructAsValue.c +++ b/libclamav/c++/llvm/test/FrontendC/2003-08-18-StructAsValue.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null typedef struct { diff --git a/libclamav/c++/llvm/test/FrontendC/2003-08-20-BadBitfieldRef.c b/libclamav/c++/llvm/test/FrontendC/2003-08-20-BadBitfieldRef.c index 58cf1bc33..ef54d8ad9 100644 --- a/libclamav/c++/llvm/test/FrontendC/2003-08-20-BadBitfieldRef.c +++ b/libclamav/c++/llvm/test/FrontendC/2003-08-20-BadBitfieldRef.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null void foo() { diff --git a/libclamav/c++/llvm/test/FrontendC/2003-08-20-PrototypeMismatch.c b/libclamav/c++/llvm/test/FrontendC/2003-08-20-PrototypeMismatch.c index 8358a2f6f..85c89f694 100644 --- a/libclamav/c++/llvm/test/FrontendC/2003-08-20-PrototypeMismatch.c +++ b/libclamav/c++/llvm/test/FrontendC/2003-08-20-PrototypeMismatch.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null diff --git a/libclamav/c++/llvm/test/FrontendC/2003-08-20-vfork-bug.c b/libclamav/c++/llvm/test/FrontendC/2003-08-20-vfork-bug.c index 575bfd6c1..cfe316162 100644 --- a/libclamav/c++/llvm/test/FrontendC/2003-08-20-vfork-bug.c +++ b/libclamav/c++/llvm/test/FrontendC/2003-08-20-vfork-bug.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null extern int vfork(void); test() { diff --git a/libclamav/c++/llvm/test/FrontendC/2003-08-21-BinOp-Type-Mismatch.c b/libclamav/c++/llvm/test/FrontendC/2003-08-21-BinOp-Type-Mismatch.c index 8829652cb..a1d4574dc 100644 --- a/libclamav/c++/llvm/test/FrontendC/2003-08-21-BinOp-Type-Mismatch.c +++ b/libclamav/c++/llvm/test/FrontendC/2003-08-21-BinOp-Type-Mismatch.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null struct bar; diff --git a/libclamav/c++/llvm/test/FrontendC/2003-08-21-StmtExpr.c b/libclamav/c++/llvm/test/FrontendC/2003-08-21-StmtExpr.c index 878ed4734..7f7d22ea9 100644 --- a/libclamav/c++/llvm/test/FrontendC/2003-08-21-StmtExpr.c +++ b/libclamav/c++/llvm/test/FrontendC/2003-08-21-StmtExpr.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null typedef struct { diff --git a/libclamav/c++/llvm/test/FrontendC/2003-08-21-WideString.c b/libclamav/c++/llvm/test/FrontendC/2003-08-21-WideString.c index 69847610b..bf67a2189 100644 --- a/libclamav/c++/llvm/test/FrontendC/2003-08-21-WideString.c +++ b/libclamav/c++/llvm/test/FrontendC/2003-08-21-WideString.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null #include diff --git a/libclamav/c++/llvm/test/FrontendC/2003-08-23-LocalUnionTest.c b/libclamav/c++/llvm/test/FrontendC/2003-08-23-LocalUnionTest.c index dc2780262..987accca1 100644 --- a/libclamav/c++/llvm/test/FrontendC/2003-08-23-LocalUnionTest.c +++ b/libclamav/c++/llvm/test/FrontendC/2003-08-23-LocalUnionTest.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null diff --git a/libclamav/c++/llvm/test/FrontendC/2003-08-29-BitFieldStruct.c b/libclamav/c++/llvm/test/FrontendC/2003-08-29-BitFieldStruct.c index 8c303e8f2..57273cd86 100644 --- a/libclamav/c++/llvm/test/FrontendC/2003-08-29-BitFieldStruct.c +++ b/libclamav/c++/llvm/test/FrontendC/2003-08-29-BitFieldStruct.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null struct Word { short bar; diff --git a/libclamav/c++/llvm/test/FrontendC/2003-08-29-HugeCharConst.c b/libclamav/c++/llvm/test/FrontendC/2003-08-29-HugeCharConst.c index a997994e9..236eb2e27 100644 --- a/libclamav/c++/llvm/test/FrontendC/2003-08-29-HugeCharConst.c +++ b/libclamav/c++/llvm/test/FrontendC/2003-08-29-HugeCharConst.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null void foo() { unsigned char int_latin1[] = "f\200\372b\200\343\200\340"; diff --git a/libclamav/c++/llvm/test/FrontendC/2003-08-29-StructLayoutBug.c b/libclamav/c++/llvm/test/FrontendC/2003-08-29-StructLayoutBug.c index a5f6fb106..16731945b 100644 --- a/libclamav/c++/llvm/test/FrontendC/2003-08-29-StructLayoutBug.c +++ b/libclamav/c++/llvm/test/FrontendC/2003-08-29-StructLayoutBug.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null struct foo { unsigned int I:1; diff --git a/libclamav/c++/llvm/test/FrontendC/2003-08-30-LargeIntegerBitfieldMember.c b/libclamav/c++/llvm/test/FrontendC/2003-08-30-LargeIntegerBitfieldMember.c index f67aee4c1..e1ca88cdc 100644 --- a/libclamav/c++/llvm/test/FrontendC/2003-08-30-LargeIntegerBitfieldMember.c +++ b/libclamav/c++/llvm/test/FrontendC/2003-08-30-LargeIntegerBitfieldMember.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null struct foo { unsigned int I:1; diff --git a/libclamav/c++/llvm/test/FrontendC/2003-09-18-BitfieldTests.c b/libclamav/c++/llvm/test/FrontendC/2003-09-18-BitfieldTests.c index 900a7fdd6..2d74cb401 100644 --- a/libclamav/c++/llvm/test/FrontendC/2003-09-18-BitfieldTests.c +++ b/libclamav/c++/llvm/test/FrontendC/2003-09-18-BitfieldTests.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -w -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -w -S %s -o - | llvm-as -o /dev/null typedef struct BF { diff --git a/libclamav/c++/llvm/test/FrontendC/2003-09-30-StructLayout.c b/libclamav/c++/llvm/test/FrontendC/2003-09-30-StructLayout.c index 3a4016606..177d1f49b 100644 --- a/libclamav/c++/llvm/test/FrontendC/2003-09-30-StructLayout.c +++ b/libclamav/c++/llvm/test/FrontendC/2003-09-30-StructLayout.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null enum En { ENUM_VAL diff --git a/libclamav/c++/llvm/test/FrontendC/2003-10-02-UnionLValueError.c b/libclamav/c++/llvm/test/FrontendC/2003-10-02-UnionLValueError.c index 2ded0c64b..a4d17a4a0 100644 --- a/libclamav/c++/llvm/test/FrontendC/2003-10-02-UnionLValueError.c +++ b/libclamav/c++/llvm/test/FrontendC/2003-10-02-UnionLValueError.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null #include diff --git a/libclamav/c++/llvm/test/FrontendC/2003-10-06-NegateExprType.c b/libclamav/c++/llvm/test/FrontendC/2003-10-06-NegateExprType.c index 02386031b..fb8329b34 100644 --- a/libclamav/c++/llvm/test/FrontendC/2003-10-06-NegateExprType.c +++ b/libclamav/c++/llvm/test/FrontendC/2003-10-06-NegateExprType.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null extern int A[10]; diff --git a/libclamav/c++/llvm/test/FrontendC/2003-10-09-UnionInitializerBug.c b/libclamav/c++/llvm/test/FrontendC/2003-10-09-UnionInitializerBug.c index 90dbd37f0..57e113a7c 100644 --- a/libclamav/c++/llvm/test/FrontendC/2003-10-09-UnionInitializerBug.c +++ b/libclamav/c++/llvm/test/FrontendC/2003-10-09-UnionInitializerBug.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null struct Foo { unsigned a; diff --git a/libclamav/c++/llvm/test/FrontendC/2003-10-28-ident.c b/libclamav/c++/llvm/test/FrontendC/2003-10-28-ident.c index 9911dfd1f..06cacf87a 100644 --- a/libclamav/c++/llvm/test/FrontendC/2003-10-28-ident.c +++ b/libclamav/c++/llvm/test/FrontendC/2003-10-28-ident.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null #ident "foo" diff --git a/libclamav/c++/llvm/test/FrontendC/2003-10-29-AsmRename.c b/libclamav/c++/llvm/test/FrontendC/2003-10-29-AsmRename.c index 5750cedd0..d07ccf7fd 100644 --- a/libclamav/c++/llvm/test/FrontendC/2003-10-29-AsmRename.c +++ b/libclamav/c++/llvm/test/FrontendC/2003-10-29-AsmRename.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null struct foo { int X; }; diff --git a/libclamav/c++/llvm/test/FrontendC/2003-11-01-C99-CompoundLiteral.c b/libclamav/c++/llvm/test/FrontendC/2003-11-01-C99-CompoundLiteral.c index a0aa69858..2912c97c5 100644 --- a/libclamav/c++/llvm/test/FrontendC/2003-11-01-C99-CompoundLiteral.c +++ b/libclamav/c++/llvm/test/FrontendC/2003-11-01-C99-CompoundLiteral.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null typedef struct { int foo; } spinlock_t; typedef struct wait_queue_head_t { spinlock_t lock; } wait_queue_head_t; diff --git a/libclamav/c++/llvm/test/FrontendC/2003-11-01-EmptyStructCrash.c b/libclamav/c++/llvm/test/FrontendC/2003-11-01-EmptyStructCrash.c index fb6993bb2..c1161195d 100644 --- a/libclamav/c++/llvm/test/FrontendC/2003-11-01-EmptyStructCrash.c +++ b/libclamav/c++/llvm/test/FrontendC/2003-11-01-EmptyStructCrash.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null typedef struct { } the_coolest_struct_in_the_world; extern the_coolest_struct_in_the_world xyzzy; diff --git a/libclamav/c++/llvm/test/FrontendC/2003-11-01-GlobalUnionInit.c b/libclamav/c++/llvm/test/FrontendC/2003-11-01-GlobalUnionInit.c index be7788d1a..7cd707348 100644 --- a/libclamav/c++/llvm/test/FrontendC/2003-11-01-GlobalUnionInit.c +++ b/libclamav/c++/llvm/test/FrontendC/2003-11-01-GlobalUnionInit.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null union bdflush_param { struct { int x; } b_un; diff --git a/libclamav/c++/llvm/test/FrontendC/2003-11-04-EmptyStruct.c b/libclamav/c++/llvm/test/FrontendC/2003-11-04-EmptyStruct.c index c7a016415..b4f37beff 100644 --- a/libclamav/c++/llvm/test/FrontendC/2003-11-04-EmptyStruct.c +++ b/libclamav/c++/llvm/test/FrontendC/2003-11-04-EmptyStruct.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null typedef struct { } rwlock_t; struct fs_struct { rwlock_t lock; int umask; }; diff --git a/libclamav/c++/llvm/test/FrontendC/2003-11-04-OutOfMemory.c b/libclamav/c++/llvm/test/FrontendC/2003-11-04-OutOfMemory.c index 6a42e160f..40cb6c2e2 100644 --- a/libclamav/c++/llvm/test/FrontendC/2003-11-04-OutOfMemory.c +++ b/libclamav/c++/llvm/test/FrontendC/2003-11-04-OutOfMemory.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null void schedule_timeout(signed long timeout) { diff --git a/libclamav/c++/llvm/test/FrontendC/2003-11-12-VoidString.c b/libclamav/c++/llvm/test/FrontendC/2003-11-12-VoidString.c index db2e84bbb..5770b3661 100644 --- a/libclamav/c++/llvm/test/FrontendC/2003-11-12-VoidString.c +++ b/libclamav/c++/llvm/test/FrontendC/2003-11-12-VoidString.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null void query_newnamebuf(void) { ((void)"query_newnamebuf"); } diff --git a/libclamav/c++/llvm/test/FrontendC/2003-11-16-StaticArrayInit.c b/libclamav/c++/llvm/test/FrontendC/2003-11-16-StaticArrayInit.c index 2b42e38dc..eb83b3ad0 100644 --- a/libclamav/c++/llvm/test/FrontendC/2003-11-16-StaticArrayInit.c +++ b/libclamav/c++/llvm/test/FrontendC/2003-11-16-StaticArrayInit.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null void bar () { static char x[10]; diff --git a/libclamav/c++/llvm/test/FrontendC/2003-11-18-CondExprLValue.c b/libclamav/c++/llvm/test/FrontendC/2003-11-18-CondExprLValue.c index ec000a443..68ee622c6 100644 --- a/libclamav/c++/llvm/test/FrontendC/2003-11-18-CondExprLValue.c +++ b/libclamav/c++/llvm/test/FrontendC/2003-11-18-CondExprLValue.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null typedef struct { unsigned long pgprot; } pgprot_t; diff --git a/libclamav/c++/llvm/test/FrontendC/2003-11-19-BitFieldArray.c b/libclamav/c++/llvm/test/FrontendC/2003-11-19-BitFieldArray.c index 9d54112e8..250268a3b 100644 --- a/libclamav/c++/llvm/test/FrontendC/2003-11-19-BitFieldArray.c +++ b/libclamav/c++/llvm/test/FrontendC/2003-11-19-BitFieldArray.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null struct _GIOChannel { int write_buf; diff --git a/libclamav/c++/llvm/test/FrontendC/2003-11-20-Bitfields.c b/libclamav/c++/llvm/test/FrontendC/2003-11-20-Bitfields.c index c9ea0dc7f..4be9942cc 100644 --- a/libclamav/c++/llvm/test/FrontendC/2003-11-20-Bitfields.c +++ b/libclamav/c++/llvm/test/FrontendC/2003-11-20-Bitfields.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null struct face_cachel { unsigned int reverse :1; diff --git a/libclamav/c++/llvm/test/FrontendC/2003-11-20-ComplexDivision.c b/libclamav/c++/llvm/test/FrontendC/2003-11-20-ComplexDivision.c index cd548c031..172de8c0e 100644 --- a/libclamav/c++/llvm/test/FrontendC/2003-11-20-ComplexDivision.c +++ b/libclamav/c++/llvm/test/FrontendC/2003-11-20-ComplexDivision.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null int test() { __complex__ double C; diff --git a/libclamav/c++/llvm/test/FrontendC/2003-11-20-UnionBitfield.c b/libclamav/c++/llvm/test/FrontendC/2003-11-20-UnionBitfield.c index 12e7df589..f999c2077 100644 --- a/libclamav/c++/llvm/test/FrontendC/2003-11-20-UnionBitfield.c +++ b/libclamav/c++/llvm/test/FrontendC/2003-11-20-UnionBitfield.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null struct printf_spec { unsigned int minus_flag:1; diff --git a/libclamav/c++/llvm/test/FrontendC/2003-11-26-PointerShift.c b/libclamav/c++/llvm/test/FrontendC/2003-11-26-PointerShift.c index 079f6903a..6b5205a6e 100644 --- a/libclamav/c++/llvm/test/FrontendC/2003-11-26-PointerShift.c +++ b/libclamav/c++/llvm/test/FrontendC/2003-11-26-PointerShift.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null unsigned long do_csum(const unsigned char *buff, int len, unsigned long result) { if (2 & (unsigned long) buff) result += 1; diff --git a/libclamav/c++/llvm/test/FrontendC/2003-11-27-ConstructorCast.c b/libclamav/c++/llvm/test/FrontendC/2003-11-27-ConstructorCast.c index 3780e7a4b..15eb76947 100644 --- a/libclamav/c++/llvm/test/FrontendC/2003-11-27-ConstructorCast.c +++ b/libclamav/c++/llvm/test/FrontendC/2003-11-27-ConstructorCast.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null struct i387_soft_struct { long cwd; diff --git a/libclamav/c++/llvm/test/FrontendC/2003-11-27-UnionCtorInitialization.c b/libclamav/c++/llvm/test/FrontendC/2003-11-27-UnionCtorInitialization.c index 472b59158..e3ae1e96a 100644 --- a/libclamav/c++/llvm/test/FrontendC/2003-11-27-UnionCtorInitialization.c +++ b/libclamav/c++/llvm/test/FrontendC/2003-11-27-UnionCtorInitialization.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null struct i387_soft_struct { long cwd; diff --git a/libclamav/c++/llvm/test/FrontendC/2004-01-08-ExternInlineRedefine.c b/libclamav/c++/llvm/test/FrontendC/2004-01-08-ExternInlineRedefine.c index b3907ee99..4366b9b56 100644 --- a/libclamav/c++/llvm/test/FrontendC/2004-01-08-ExternInlineRedefine.c +++ b/libclamav/c++/llvm/test/FrontendC/2004-01-08-ExternInlineRedefine.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null extern __inline long int diff --git a/libclamav/c++/llvm/test/FrontendC/2004-03-07-ComplexDivEquals.c b/libclamav/c++/llvm/test/FrontendC/2004-03-07-ComplexDivEquals.c index b1da58054..c6c805a7b 100644 --- a/libclamav/c++/llvm/test/FrontendC/2004-03-07-ComplexDivEquals.c +++ b/libclamav/c++/llvm/test/FrontendC/2004-03-07-ComplexDivEquals.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null void test(__complex__ double D, double X) { diff --git a/libclamav/c++/llvm/test/FrontendC/2004-03-09-LargeArrayInitializers.c b/libclamav/c++/llvm/test/FrontendC/2004-03-09-LargeArrayInitializers.c index 335c56848..265206fab 100644 --- a/libclamav/c++/llvm/test/FrontendC/2004-03-09-LargeArrayInitializers.c +++ b/libclamav/c++/llvm/test/FrontendC/2004-03-09-LargeArrayInitializers.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null // Test that these initializers are handled efficiently diff --git a/libclamav/c++/llvm/test/FrontendC/2004-03-15-SimpleIndirectGoto.c b/libclamav/c++/llvm/test/FrontendC/2004-03-15-SimpleIndirectGoto.c index ad7221e96..a3f27b2a3 100644 --- a/libclamav/c++/llvm/test/FrontendC/2004-03-15-SimpleIndirectGoto.c +++ b/libclamav/c++/llvm/test/FrontendC/2004-03-15-SimpleIndirectGoto.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null int code[]={0,0,0,0,1}; void foo(int x) { diff --git a/libclamav/c++/llvm/test/FrontendC/2004-03-16-AsmRegisterCrash.c b/libclamav/c++/llvm/test/FrontendC/2004-03-16-AsmRegisterCrash.c index 2662c79a1..f13368c25 100644 --- a/libclamav/c++/llvm/test/FrontendC/2004-03-16-AsmRegisterCrash.c +++ b/libclamav/c++/llvm/test/FrontendC/2004-03-16-AsmRegisterCrash.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null int foo() { #ifdef __ppc__ diff --git a/libclamav/c++/llvm/test/FrontendC/2004-05-07-VarArrays.c b/libclamav/c++/llvm/test/FrontendC/2004-05-07-VarArrays.c index 20412983e..3a39c4fe6 100644 --- a/libclamav/c++/llvm/test/FrontendC/2004-05-07-VarArrays.c +++ b/libclamav/c++/llvm/test/FrontendC/2004-05-07-VarArrays.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null int foo(int len, char arr[][len], int X) { return arr[X][0]; diff --git a/libclamav/c++/llvm/test/FrontendC/2004-05-21-IncompleteEnum.c b/libclamav/c++/llvm/test/FrontendC/2004-05-21-IncompleteEnum.c index 106df5e48..958a8d1c0 100644 --- a/libclamav/c++/llvm/test/FrontendC/2004-05-21-IncompleteEnum.c +++ b/libclamav/c++/llvm/test/FrontendC/2004-05-21-IncompleteEnum.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -w -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -w -S %s -o - | llvm-as -o /dev/null void test(enum foo *X) { } diff --git a/libclamav/c++/llvm/test/FrontendC/2004-06-08-OpaqueStructArg.c b/libclamav/c++/llvm/test/FrontendC/2004-06-08-OpaqueStructArg.c index ede811c38..5dfdd83c9 100644 --- a/libclamav/c++/llvm/test/FrontendC/2004-06-08-OpaqueStructArg.c +++ b/libclamav/c++/llvm/test/FrontendC/2004-06-08-OpaqueStructArg.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null struct fu; void foo(struct fu); diff --git a/libclamav/c++/llvm/test/FrontendC/2004-06-17-UnorderedBuiltins.c b/libclamav/c++/llvm/test/FrontendC/2004-06-17-UnorderedBuiltins.c index 5e02e7f32..02780f0f0 100644 --- a/libclamav/c++/llvm/test/FrontendC/2004-06-17-UnorderedBuiltins.c +++ b/libclamav/c++/llvm/test/FrontendC/2004-06-17-UnorderedBuiltins.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null _Bool A, B, C, D, E, F, G, H; diff --git a/libclamav/c++/llvm/test/FrontendC/2004-06-18-VariableLengthArrayOfStructures.c b/libclamav/c++/llvm/test/FrontendC/2004-06-18-VariableLengthArrayOfStructures.c index e474a13b3..3e450a4b9 100644 --- a/libclamav/c++/llvm/test/FrontendC/2004-06-18-VariableLengthArrayOfStructures.c +++ b/libclamav/c++/llvm/test/FrontendC/2004-06-18-VariableLengthArrayOfStructures.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null struct S { }; diff --git a/libclamav/c++/llvm/test/FrontendC/2004-07-06-FunctionCast.c b/libclamav/c++/llvm/test/FrontendC/2004-07-06-FunctionCast.c index 169f74036..6d80f86fa 100644 --- a/libclamav/c++/llvm/test/FrontendC/2004-07-06-FunctionCast.c +++ b/libclamav/c++/llvm/test/FrontendC/2004-07-06-FunctionCast.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null static int unused_func(void) { return 1; diff --git a/libclamav/c++/llvm/test/FrontendC/2004-08-06-LargeStructTest.c b/libclamav/c++/llvm/test/FrontendC/2004-08-06-LargeStructTest.c index b0413b4b0..8fbb7f836 100644 --- a/libclamav/c++/llvm/test/FrontendC/2004-08-06-LargeStructTest.c +++ b/libclamav/c++/llvm/test/FrontendC/2004-08-06-LargeStructTest.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null #define A(X) int X; diff --git a/libclamav/c++/llvm/test/FrontendC/2005-09-20-ComplexConstants.c b/libclamav/c++/llvm/test/FrontendC/2005-09-20-ComplexConstants.c index db98fc238..209adc502 100644 --- a/libclamav/c++/llvm/test/FrontendC/2005-09-20-ComplexConstants.c +++ b/libclamav/c++/llvm/test/FrontendC/2005-09-20-ComplexConstants.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc %s -S -o - | llvm-as -o /dev/null -f +// RUN: %llvmgcc %s -S -o - | llvm-as -o /dev/null const double _Complex x[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; diff --git a/libclamav/c++/llvm/test/FrontendC/2009-02-17-BitField-dbg.c b/libclamav/c++/llvm/test/FrontendC/2009-02-17-BitField-dbg.c index 456b0a64a..36ee2e6f0 100644 --- a/libclamav/c++/llvm/test/FrontendC/2009-02-17-BitField-dbg.c +++ b/libclamav/c++/llvm/test/FrontendC/2009-02-17-BitField-dbg.c @@ -1,6 +1,6 @@ // Check bitfields. // RUN: %llvmgcc -S -O0 -g %s -o - | llvm-as | \ -// RUN: llc --disable-fp-elim -o 2009-02-17-BitField-dbg.s -f +// RUN: llc --disable-fp-elim -o 2009-02-17-BitField-dbg.s // RUN: %compile_c 2009-02-17-BitField-dbg.s -o 2009-02-17-BitField-dbg.o // RUN: echo {ptype mystruct} > %t2 // RUN: gdb -q -batch -n -x %t2 2009-02-17-BitField-dbg.o | \ diff --git a/libclamav/c++/llvm/test/FrontendC/2009-07-15-pad-wchar_t-array.c b/libclamav/c++/llvm/test/FrontendC/2009-07-15-pad-wchar_t-array.c index 839a7bb5c..41bdef25e 100644 --- a/libclamav/c++/llvm/test/FrontendC/2009-07-15-pad-wchar_t-array.c +++ b/libclamav/c++/llvm/test/FrontendC/2009-07-15-pad-wchar_t-array.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null +// RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null #include signed short _iodbcdm_sqlerror( ) diff --git a/libclamav/c++/llvm/test/FrontendC/2009-08-11-AsmBlocksComplexJumpTarget.c b/libclamav/c++/llvm/test/FrontendC/2009-08-11-AsmBlocksComplexJumpTarget.c index 1a801f970..e141c9a16 100644 --- a/libclamav/c++/llvm/test/FrontendC/2009-08-11-AsmBlocksComplexJumpTarget.c +++ b/libclamav/c++/llvm/test/FrontendC/2009-08-11-AsmBlocksComplexJumpTarget.c @@ -1,7 +1,7 @@ // RUN: %llvmgcc %s -fasm-blocks -S -o - | grep {\\\*1192} // Complicated expression as jump target // XFAIL: * -// XTARGET: darwin +// XTARGET: x86,i386,i686 asm void Method3() { diff --git a/libclamav/c++/llvm/test/FrontendObjC/2009-02-17-RunTimeVer-dbg.m b/libclamav/c++/llvm/test/FrontendObjC/2009-02-17-RunTimeVer-dbg.m deleted file mode 100644 index 0fab94d9f..000000000 --- a/libclamav/c++/llvm/test/FrontendObjC/2009-02-17-RunTimeVer-dbg.m +++ /dev/null @@ -1,13 +0,0 @@ -// RUN: %llvmgcc -x objective-c -S %s -g --emit-llvm -o - | grep "dbg.compile_unit =" | grep "null, i32" -// Last parameter represent i32 runtime version id. The previous paramenter -// encodes command line flags when certain env. variables are set. In this -// example it is the only compile_unit parameter that is null. This test case -// tests existence of new additional compile_unit parameter to encode -// Objective-C runtime version number. - -@interface foo -@end -@implementation foo -@end - -void fn(foo *f) {} diff --git a/libclamav/c++/llvm/test/FrontendObjC/2009-04-14-AsmSection.m b/libclamav/c++/llvm/test/FrontendObjC/2009-04-14-AsmSection.m index ec5c688a8..de2cef00f 100644 --- a/libclamav/c++/llvm/test/FrontendObjC/2009-04-14-AsmSection.m +++ b/libclamav/c++/llvm/test/FrontendObjC/2009-04-14-AsmSection.m @@ -1,6 +1,6 @@ // RUN: %llvmgcc -S %s -fobjc-abi-version=2 -emit-llvm -o %t // RUN: grep {OBJC_CLASS_\\\$_A.*section.*__DATA, __objc_data.*align} %t -// XTARGETS: darwin +// XTARGET: darwin @interface A @end diff --git a/libclamav/c++/llvm/test/FrontendObjC/2009-04-27-bitfield-vs-ivar.m b/libclamav/c++/llvm/test/FrontendObjC/2009-04-27-bitfield-vs-ivar.m index f5a4309d4..cada8438b 100644 --- a/libclamav/c++/llvm/test/FrontendObjC/2009-04-27-bitfield-vs-ivar.m +++ b/libclamav/c++/llvm/test/FrontendObjC/2009-04-27-bitfield-vs-ivar.m @@ -2,7 +2,7 @@ // RUN: grep {OBJC_CLASS_RO_\\\$_I4} %t | grep {i32 0, i32 1, i32 2, i32 0} // RUN: grep {OBJC_CLASS_RO_\\\$_I2} %t | grep {i32 0, i32 1, i32 1, i32 0} // RUN: grep {OBJC_CLASS_RO_\\\$_I5} %t | grep {i32 0, i32 0, i32 0, i32 0} -// XTARGETS: darwin +// XTARGET: darwin // Test instance variable sizing when base class ends in bitfield @interface I3 { diff --git a/libclamav/c++/llvm/test/FrontendObjC/2009-08-17-DebugInfo.m b/libclamav/c++/llvm/test/FrontendObjC/2009-08-17-DebugInfo.m index 83e76f0b7..0bc4e9a6d 100644 --- a/libclamav/c++/llvm/test/FrontendObjC/2009-08-17-DebugInfo.m +++ b/libclamav/c++/llvm/test/FrontendObjC/2009-08-17-DebugInfo.m @@ -1,12 +1,12 @@ // This is a regression test on debug info to make sure that we can set a // breakpoint on a objective message. -// RUN: %llvmgcc -S -O0 -g %s -o - | llvm-as | llc -o %t.s -f -O0 +// RUN: %llvmgcc -S -O0 -g %s -o - | llvm-as | llc -o %t.s -O0 // RUN: %compile_c %t.s -o %t.o // RUN: %link %t.o -o %t.exe -framework Foundation // RUN: echo {break randomFunc\n} > %t.in // RUN: gdb -q -batch -n -x %t.in %t.exe | tee %t.out | \ // RUN: grep {Breakpoint 1 at 0x.*: file 2009-08-17-DebugInfo.m, line 21} -// XTARGETS: darwin +// XTARGET: darwin @interface MyClass { int my; diff --git a/libclamav/c++/llvm/test/Linker/2003-01-30-LinkerRename.ll b/libclamav/c++/llvm/test/Linker/2003-01-30-LinkerRename.ll index 68812467e..6c8b49697 100644 --- a/libclamav/c++/llvm/test/Linker/2003-01-30-LinkerRename.ll +++ b/libclamav/c++/llvm/test/Linker/2003-01-30-LinkerRename.ll @@ -2,7 +2,7 @@ ; one... ; RUN: echo {define internal i32 @foo() \{ ret i32 7 \} } | llvm-as > %t.1.bc -; RUN: llvm-as %s -o %t.2.bc -f +; RUN: llvm-as %s -o %t.2.bc ; RUN: llvm-link %t.1.bc %t.2.bc | llvm-dis | grep @foo() | grep -v internal define i32 @foo() { ret i32 0 } diff --git a/libclamav/c++/llvm/test/Linker/2003-04-21-Linkage.ll b/libclamav/c++/llvm/test/Linker/2003-04-21-Linkage.ll index 31aace8e4..f6d4c4b03 100644 --- a/libclamav/c++/llvm/test/Linker/2003-04-21-Linkage.ll +++ b/libclamav/c++/llvm/test/Linker/2003-04-21-Linkage.ll @@ -1,6 +1,6 @@ ; RUN: echo {@X = linkonce global i32 5 \ ; RUN: define linkonce i32 @foo() \{ ret i32 7 \} } | llvm-as > %t.1.bc -; RUN: llvm-as %s -o %t.2.bc -f +; RUN: llvm-as %s -o %t.2.bc ; RUN: llvm-link %t.1.bc %t.2.bc @X = external global i32 diff --git a/libclamav/c++/llvm/test/Linker/2003-04-23-LinkOnceLost.ll b/libclamav/c++/llvm/test/Linker/2003-04-23-LinkOnceLost.ll index d0858d95a..7f15e51e2 100644 --- a/libclamav/c++/llvm/test/Linker/2003-04-23-LinkOnceLost.ll +++ b/libclamav/c++/llvm/test/Linker/2003-04-23-LinkOnceLost.ll @@ -2,8 +2,8 @@ ; one... ; RUN: echo { define linkonce void @foo() \{ ret void \} } | \ -; RUN: llvm-as -o %t.2.bc -f -; RUN: llvm-as %s -o %t.1.bc -f +; RUN: llvm-as -o %t.2.bc +; RUN: llvm-as %s -o %t.1.bc ; RUN: llvm-link %t.1.bc %t.2.bc | llvm-dis | grep foo | grep linkonce declare void @foo() diff --git a/libclamav/c++/llvm/test/Linker/2003-04-26-NullPtrLinkProblem.ll b/libclamav/c++/llvm/test/Linker/2003-04-26-NullPtrLinkProblem.ll index df12fb3a7..54ba05153 100644 --- a/libclamav/c++/llvm/test/Linker/2003-04-26-NullPtrLinkProblem.ll +++ b/libclamav/c++/llvm/test/Linker/2003-04-26-NullPtrLinkProblem.ll @@ -2,7 +2,7 @@ ; the same type to be created! ; RUN: echo {%T = type i32} | llvm-as > %t.2.bc -; RUN: llvm-as %s -f -o %t.1.bc +; RUN: llvm-as %s -o %t.1.bc ; RUN: llvm-link %t.1.bc %t.2.bc %T = type opaque diff --git a/libclamav/c++/llvm/test/Linker/2004-02-17-WeakStrongLinkage.ll b/libclamav/c++/llvm/test/Linker/2004-02-17-WeakStrongLinkage.ll index 0e970ddb4..224463949 100644 --- a/libclamav/c++/llvm/test/Linker/2004-02-17-WeakStrongLinkage.ll +++ b/libclamav/c++/llvm/test/Linker/2004-02-17-WeakStrongLinkage.ll @@ -1,6 +1,6 @@ ; RUN: llvm-as < %s > %t.out2.bc ; RUN: echo "@me = global i32* null" | llvm-as > %t.out1.bc -; RUN: llvm-link %t.out1.bc %t.out2.bc -o /dev/null -f +; RUN: llvm-link %t.out1.bc %t.out2.bc -o /dev/null @me = weak global i32* null ; [#uses=0] diff --git a/libclamav/c++/llvm/test/Linker/2004-05-07-TypeResolution1.ll b/libclamav/c++/llvm/test/Linker/2004-05-07-TypeResolution1.ll index 36651541e..f0ade3371 100644 --- a/libclamav/c++/llvm/test/Linker/2004-05-07-TypeResolution1.ll +++ b/libclamav/c++/llvm/test/Linker/2004-05-07-TypeResolution1.ll @@ -1,6 +1,6 @@ -; RUN: llvm-as %s -f -o %t1.bc -; RUN: llvm-as < %p/2004-05-07-TypeResolution2.ll -o %t2.bc -f -; RUN: llvm-link -f -o %t3.bc %t1.bc %t2.bc +; RUN: llvm-as %s -o %t1.bc +; RUN: llvm-as < %p/2004-05-07-TypeResolution2.ll -o %t2.bc +; RUN: llvm-link -o %t3.bc %t1.bc %t2.bc target datalayout = "e-p:32:32" %myint = type opaque diff --git a/libclamav/c++/llvm/test/Linker/2006-01-19-ConstantPacked.ll b/libclamav/c++/llvm/test/Linker/2006-01-19-ConstantPacked.ll index d7d864b41..d2409e20c 100644 --- a/libclamav/c++/llvm/test/Linker/2006-01-19-ConstantPacked.ll +++ b/libclamav/c++/llvm/test/Linker/2006-01-19-ConstantPacked.ll @@ -1,5 +1,5 @@ -; RUN: llvm-as %s -f -o %t1.bc -; RUN: llvm-link -f -o %t2.bc %t1.bc +; RUN: llvm-as %s -o %t1.bc +; RUN: llvm-link -o %t2.bc %t1.bc target datalayout = "E-p:32:32" target triple = "powerpc-apple-darwin7.7.0" diff --git a/libclamav/c++/llvm/test/Linker/2008-03-05-AliasReference.ll b/libclamav/c++/llvm/test/Linker/2008-03-05-AliasReference.ll index 1663b0084..7c19dfa15 100644 --- a/libclamav/c++/llvm/test/Linker/2008-03-05-AliasReference.ll +++ b/libclamav/c++/llvm/test/Linker/2008-03-05-AliasReference.ll @@ -1,7 +1,7 @@ ; PR2054 -; RUN: llvm-as %s -o %t1.bc -f -; RUN: llvm-as %p/2008-03-05-AliasReference2.ll -o %t2.bc -f -; RUN: llvm-link %t2.bc %t1.bc -f -o %t3.bc +; RUN: llvm-as %s -o %t1.bc +; RUN: llvm-as %p/2008-03-05-AliasReference2.ll -o %t2.bc +; RUN: llvm-link %t2.bc %t1.bc -o %t3.bc ; ModuleID = 'bug.o' target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128" diff --git a/libclamav/c++/llvm/test/Linker/2008-06-13-LinkOnceRedefinition.ll b/libclamav/c++/llvm/test/Linker/2008-06-13-LinkOnceRedefinition.ll index 3478880eb..8c23250e8 100644 --- a/libclamav/c++/llvm/test/Linker/2008-06-13-LinkOnceRedefinition.ll +++ b/libclamav/c++/llvm/test/Linker/2008-06-13-LinkOnceRedefinition.ll @@ -1,8 +1,8 @@ ; Test linking two functions with different prototypes and two globals ; in different modules. -; RUN: llvm-as %s -o %t.foo1.bc -f -; RUN: llvm-as %s -o %t.foo2.bc -f -; RUN: echo {define linkonce void @foo(i32 %x) { ret void }} | llvm-as -o %t.foo3.bc -f +; RUN: llvm-as %s -o %t.foo1.bc +; RUN: llvm-as %s -o %t.foo2.bc +; RUN: echo {define linkonce void @foo(i32 %x) { ret void }} | llvm-as -o %t.foo3.bc ; RUN: llvm-link %t.foo1.bc %t.foo2.bc | llvm-dis ; RUN: llvm-link %t.foo1.bc %t.foo3.bc | llvm-dis define linkonce void @foo() { ret void } diff --git a/libclamav/c++/llvm/test/Linker/2008-06-26-AddressSpace.ll b/libclamav/c++/llvm/test/Linker/2008-06-26-AddressSpace.ll index 7f2110628..0847bb583 100644 --- a/libclamav/c++/llvm/test/Linker/2008-06-26-AddressSpace.ll +++ b/libclamav/c++/llvm/test/Linker/2008-06-26-AddressSpace.ll @@ -1,7 +1,7 @@ ; Test linking two functions with different prototypes and two globals ; in different modules. -; RUN: llvm-as %s -o %t.foo1.bc -f -; RUN: echo | llvm-as -o %t.foo2.bc -f +; RUN: llvm-as %s -o %t.foo1.bc +; RUN: echo | llvm-as -o %t.foo2.bc ; RUN: llvm-link %t.foo2.bc %t.foo1.bc | llvm-dis | grep {addrspace(2)} ; RUN: llvm-link %t.foo1.bc %t.foo2.bc | llvm-dis | grep {addrspace(2)} ; rdar://6038021 diff --git a/libclamav/c++/llvm/test/Linker/2008-07-06-AliasFnDecl.ll b/libclamav/c++/llvm/test/Linker/2008-07-06-AliasFnDecl.ll index dca9cd8e8..8e8c8454d 100644 --- a/libclamav/c++/llvm/test/Linker/2008-07-06-AliasFnDecl.ll +++ b/libclamav/c++/llvm/test/Linker/2008-07-06-AliasFnDecl.ll @@ -1,7 +1,7 @@ ; PR2146 -; RUN: llvm-as %s -o %t1.bc -f -; RUN: llvm-as %p/2008-07-06-AliasFnDecl2.ll -o %t2.bc -f -; RUN: llvm-link %t1.bc %t2.bc -f -o %t3.bc +; RUN: llvm-as %s -o %t1.bc +; RUN: llvm-as %p/2008-07-06-AliasFnDecl2.ll -o %t2.bc +; RUN: llvm-link %t1.bc %t2.bc -o %t3.bc @b = alias void ()* @a diff --git a/libclamav/c++/llvm/test/Linker/2008-07-06-AliasWeakDest.ll b/libclamav/c++/llvm/test/Linker/2008-07-06-AliasWeakDest.ll index af8964064..e63117544 100644 --- a/libclamav/c++/llvm/test/Linker/2008-07-06-AliasWeakDest.ll +++ b/libclamav/c++/llvm/test/Linker/2008-07-06-AliasWeakDest.ll @@ -1,8 +1,8 @@ ; PR2463 -; RUN: llvm-as %s -o %t1.bc -f -; RUN: llvm-as %p/2008-07-06-AliasWeakDest2.ll -o %t2.bc -f -; RUN: llvm-link %t1.bc %t2.bc -f -o %t3.bc -; RUN: llvm-link %t2.bc %t1.bc -f -o %t4.bc +; RUN: llvm-as %s -o %t1.bc +; RUN: llvm-as %p/2008-07-06-AliasWeakDest2.ll -o %t2.bc +; RUN: llvm-link %t1.bc %t2.bc -o %t3.bc +; RUN: llvm-link %t2.bc %t1.bc -o %t4.bc target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32" target triple = "i386-pc-linux-gnu" diff --git a/libclamav/c++/llvm/test/Linker/basiclink.ll b/libclamav/c++/llvm/test/Linker/basiclink.ll index 711a0f471..afe0320ba 100644 --- a/libclamav/c++/llvm/test/Linker/basiclink.ll +++ b/libclamav/c++/llvm/test/Linker/basiclink.ll @@ -1,10 +1,10 @@ ; Test linking two functions with different prototypes and two globals ; in different modules. This is for PR411 -; RUN: llvm-as %s -o %t.bar.bc -f +; RUN: llvm-as %s -o %t.bar.bc ; RUN: echo {define i32* @foo(i32 %x) \{ ret i32* @baz \} \ -; RUN: @baz = external global i32 } | llvm-as -o %t.foo.bc -f -; RUN: llvm-link %t.bar.bc %t.foo.bc -o %t.bc -f -; RUN: llvm-link %t.foo.bc %t.bar.bc -o %t.bc -f +; RUN: @baz = external global i32 } | llvm-as -o %t.foo.bc +; RUN: llvm-link %t.bar.bc %t.foo.bc -o %t.bc +; RUN: llvm-link %t.foo.bc %t.bar.bc -o %t.bc declare i32* @foo(...) define i32* @bar() { %ret = call i32* (...)* @foo( i32 123 ) diff --git a/libclamav/c++/llvm/test/Linker/link-archive.ll b/libclamav/c++/llvm/test/Linker/link-archive.ll index 33088c09c..6696fcc68 100644 --- a/libclamav/c++/llvm/test/Linker/link-archive.ll +++ b/libclamav/c++/llvm/test/Linker/link-archive.ll @@ -1,8 +1,8 @@ ; Test linking of a bc file to an archive via llvm-ld. ; PR1434 -; RUN: llvm-as %s -o %t.bar.bc -f +; RUN: llvm-as %s -o %t.bar.bc ; RUN: echo {define i32* @foo(i32 %x) \{ ret i32* @baz \} \ -; RUN: @baz = external global i32 } | llvm-as -o %t.foo.bc -f +; RUN: @baz = external global i32 } | llvm-as -o %t.foo.bc ; RUN: llvm-ar rcf %t.foo.a %t.foo.bc ; RUN: llvm-ar rcf %t.bar.a %t.bar.bc ; RUN: llvm-ld -disable-opt %t.bar.bc %t.foo.a -o %t.bc diff --git a/libclamav/c++/llvm/test/Linker/link-global-to-func.ll b/libclamav/c++/llvm/test/Linker/link-global-to-func.ll index f9cbc46f7..a805035ea 100644 --- a/libclamav/c++/llvm/test/Linker/link-global-to-func.ll +++ b/libclamav/c++/llvm/test/Linker/link-global-to-func.ll @@ -1,5 +1,5 @@ -; RUN: llvm-as %s -o %t1.bc -f -; RUN: echo {declare void @__eprintf(i8*, i8*, i32, i8*) noreturn define void @foo() { tail call void @__eprintf( i8* undef, i8* undef, i32 4, i8* null ) noreturn nounwind unreachable }} | llvm-as -o %t2.bc -f +; RUN: llvm-as %s -o %t1.bc +; RUN: echo {declare void @__eprintf(i8*, i8*, i32, i8*) noreturn define void @foo() { tail call void @__eprintf( i8* undef, i8* undef, i32 4, i8* null ) noreturn nounwind unreachable }} | llvm-as -o %t2.bc ; RUN: llvm-link %t2.bc %t1.bc -o - | llvm-dis | grep __eprintf ; RUN: llvm-link %t1.bc %t2.bc -o - | llvm-dis | grep __eprintf diff --git a/libclamav/c++/llvm/test/Linker/link-messages.ll b/libclamav/c++/llvm/test/Linker/link-messages.ll index f0f10aa83..920782d15 100644 --- a/libclamav/c++/llvm/test/Linker/link-messages.ll +++ b/libclamav/c++/llvm/test/Linker/link-messages.ll @@ -1,7 +1,7 @@ ; Test that linking two files with the same definition causes an error and ; that error is printed out. -; RUN: llvm-as %s -o %t.one.bc -f -; RUN: llvm-as %s -o %t.two.bc -f +; RUN: llvm-as %s -o %t.one.bc +; RUN: llvm-as %s -o %t.two.bc ; RUN: not llvm-ld -disable-opt -link-as-library %t.one.bc %t.two.bc \ ; RUN: -o %t.bc 2>%t.err ; RUN: grep "symbol multiply defined" %t.err diff --git a/libclamav/c++/llvm/test/Linker/redefinition.ll b/libclamav/c++/llvm/test/Linker/redefinition.ll index 15d03bce2..0d056891d 100644 --- a/libclamav/c++/llvm/test/Linker/redefinition.ll +++ b/libclamav/c++/llvm/test/Linker/redefinition.ll @@ -1,8 +1,8 @@ ; Test linking two functions with different prototypes and two globals ; in different modules. -; RUN: llvm-as %s -o %t.foo1.bc -f -; RUN: llvm-as %s -o %t.foo2.bc -f -; RUN: echo {define void @foo(i32 %x) { ret void }} | llvm-as -o %t.foo3.bc -f +; RUN: llvm-as %s -o %t.foo1.bc +; RUN: llvm-as %s -o %t.foo2.bc +; RUN: echo {define void @foo(i32 %x) { ret void }} | llvm-as -o %t.foo3.bc ; RUN: not llvm-link %t.foo1.bc %t.foo2.bc -o %t.bc |& \ ; RUN: grep {symbol multiply defined} ; RUN: not llvm-link %t.foo1.bc %t.foo3.bc -o %t.bc |& \ diff --git a/libclamav/c++/llvm/test/Linker/weakextern.ll b/libclamav/c++/llvm/test/Linker/weakextern.ll index edb23bc4b..aa38b1264 100644 --- a/libclamav/c++/llvm/test/Linker/weakextern.ll +++ b/libclamav/c++/llvm/test/Linker/weakextern.ll @@ -1,6 +1,6 @@ ; RUN: llvm-as < %s > %t.bc ; RUN: llvm-as < %p/testlink1.ll > %t2.bc -; RUN: llvm-link %t.bc %t.bc %t2.bc -o %t1.bc -f +; RUN: llvm-link %t.bc %t.bc %t2.bc -o %t1.bc ; RUN: llvm-dis < %t1.bc | grep {kallsyms_names = extern_weak} ; RUN: llvm-dis < %t1.bc | grep {MyVar = external global i32} ; RUN: llvm-dis < %t1.bc | grep {Inte = global i32} diff --git a/libclamav/c++/llvm/test/MC/AsmParser/conditional_asm.s b/libclamav/c++/llvm/test/MC/AsmParser/conditional_asm.s index f619ef9bb..b9ff67059 100644 --- a/libclamav/c++/llvm/test/MC/AsmParser/conditional_asm.s +++ b/libclamav/c++/llvm/test/MC/AsmParser/conditional_asm.s @@ -1,6 +1,6 @@ # RUN: llvm-mc -triple i386-unknown-unknown %s -I %p | FileCheck %s -# CHECK: .byte 2 +# CHECK: .byte (1 + 1) .if 1+2 .if 1-1 .byte 1 diff --git a/libclamav/c++/llvm/test/MC/AsmParser/dg.exp b/libclamav/c++/llvm/test/MC/AsmParser/dg.exp index ebd84187f..ca6aefe9c 100644 --- a/libclamav/c++/llvm/test/MC/AsmParser/dg.exp +++ b/libclamav/c++/llvm/test/MC/AsmParser/dg.exp @@ -1,3 +1,6 @@ load_lib llvm.exp -RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{s}]] +if { [llvm_supports_target X86] } { + RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{s}]] +} + diff --git a/libclamav/c++/llvm/test/MC/AsmParser/directive_include.s b/libclamav/c++/llvm/test/MC/AsmParser/directive_include.s index c6526eb29..fabd941d9 100644 --- a/libclamav/c++/llvm/test/MC/AsmParser/directive_include.s +++ b/libclamav/c++/llvm/test/MC/AsmParser/directive_include.s @@ -2,7 +2,7 @@ # CHECK: TESTA: # CHECK: TEST0: -# CHECK: .set a, 0 +# CHECK: a = 0 # CHECK: TESTB: TESTA: .include "directive_set.s" diff --git a/libclamav/c++/llvm/test/MC/AsmParser/directive_lcomm.s b/libclamav/c++/llvm/test/MC/AsmParser/directive_lcomm.s index afc61216c..d38805fc4 100644 --- a/libclamav/c++/llvm/test/MC/AsmParser/directive_lcomm.s +++ b/libclamav/c++/llvm/test/MC/AsmParser/directive_lcomm.s @@ -1,9 +1,9 @@ # RUN: llvm-mc -triple i386-unknown-unknown %s | FileCheck %s # CHECK: TEST0: -# CHECK: .lcomm a,7,4 -# CHECK: .lcomm b,8 -# CHECK: .lcomm c,0 +# CHECK: .zerofill __DATA,__bss,a,7,4 +# CHECK: .zerofill __DATA,__bss,b,8 +# CHECK: .zerofill __DATA,__bss,c,0 TEST0: .lcomm a, 8-1, 4 .lcomm b,8 diff --git a/libclamav/c++/llvm/test/MC/AsmParser/directive_lsym.s b/libclamav/c++/llvm/test/MC/AsmParser/directive_lsym.s index 3d5403e97..7b70cac3d 100644 --- a/libclamav/c++/llvm/test/MC/AsmParser/directive_lsym.s +++ b/libclamav/c++/llvm/test/MC/AsmParser/directive_lsym.s @@ -1,5 +1,10 @@ # RUN: llvm-mc -triple i386-unknown-unknown %s | FileCheck %s +# FIXME: This is currently unsupported. If it turns out no one uses it, we +# should just rip it out. + +# XFAIL: * + # CHECK: TEST0: # CHECK: .lsym bar,foo # CHECK: .lsym baz,3 diff --git a/libclamav/c++/llvm/test/MC/AsmParser/directive_set.s b/libclamav/c++/llvm/test/MC/AsmParser/directive_set.s index 89085668b..f1fc30a85 100644 --- a/libclamav/c++/llvm/test/MC/AsmParser/directive_set.s +++ b/libclamav/c++/llvm/test/MC/AsmParser/directive_set.s @@ -1,7 +1,7 @@ # RUN: llvm-mc -triple i386-unknown-unknown %s | FileCheck %s # CHECK: TEST0: -# CHECK: .set a, 0 +# CHECK: a = 0 TEST0: .set a, 0 diff --git a/libclamav/c++/llvm/test/MC/AsmParser/exprs-invalid.s b/libclamav/c++/llvm/test/MC/AsmParser/exprs-invalid.s index 4accc3908..5358fc5d7 100644 --- a/libclamav/c++/llvm/test/MC/AsmParser/exprs-invalid.s +++ b/libclamav/c++/llvm/test/MC/AsmParser/exprs-invalid.s @@ -1,6 +1,11 @@ // RUN: not llvm-mc -triple i386-unknown-unknown %s 2> %t // RUN: FileCheck -input-file %t %s +// Currently XFAIL'ed, since the front-end isn't validating this. Figure out the +// right resolution. +// +// XFAIL: * + .text a: .data diff --git a/libclamav/c++/llvm/test/MC/AsmParser/labels.s b/libclamav/c++/llvm/test/MC/AsmParser/labels.s index f30668525..ac8025f8b 100644 --- a/libclamav/c++/llvm/test/MC/AsmParser/labels.s +++ b/libclamav/c++/llvm/test/MC/AsmParser/labels.s @@ -15,18 +15,18 @@ a: foo: // CHECK: addl $24, "a$b"(%eax) addl $24, "a$b"(%eax) -// CHECK: addl $24, "a$b" + 10(%eax) +// CHECK: addl $24, ("a$b" + 10)(%eax) addl $24, ("a$b" + 10)(%eax) // CHECK: "b$c" = 10 "b$c" = 10 -// CHECK: addl $10, %eax +// CHECK: addl $"b$c", %eax addl "b$c", %eax -// CHECK: set "a 0", 11 +// CHECK: "a 0" = 11 .set "a 0", 11 -// CHECK: .long 11 +// CHECK: .long "a 0" .long "a 0" // XXCHCK: .section "a 1,a 2" @@ -44,13 +44,15 @@ foo: // CHECK: .comm "a 6",1 .comm "a 6", 1 -// CHECK: .lcomm "a 7",1 +// CHECK: .zerofill __DATA,__bss,"a 7",1,0 .lcomm "a 7", 1 -// CHECK: .lsym "a 8",1 - .lsym "a 8", 1 +// FIXME: We don't bother to support .lsym. + +// CHECX: .lsym "a 8",1 +// .lsym "a 8", 1 -// CHECK: set "a 9", a - b +// CHECK: "a 9" = (a - b) .set "a 9", a - b // CHECK: .long "a 9" diff --git a/libclamav/c++/llvm/test/MC/AsmParser/x86_operands.s b/libclamav/c++/llvm/test/MC/AsmParser/x86_operands.s index d6c16808c..f21cf3472 100644 --- a/libclamav/c++/llvm/test/MC/AsmParser/x86_operands.s +++ b/libclamav/c++/llvm/test/MC/AsmParser/x86_operands.s @@ -5,11 +5,11 @@ # Immediates # CHECK: addl $1, %eax addl $1, %eax -# CHECK: addl $3, %eax +# CHECK: addl $(1 + 2), %eax addl $(1+2), %eax # CHECK: addl $a, %eax addl $a, %eax -# CHECK: addl $3, %eax +# CHECK: addl $(1 + 2), %eax addl $1 + 2, %eax # Disambiguation @@ -18,15 +18,15 @@ #addl $1, 4+4 # FIXME: Add back when we can match this. #addl $1, (4+4) -# CHECK: addl $1, 8(%eax) +# CHECK: addl $1, (4 + 4)(%eax) addl $1, 4+4(%eax) -# CHECK: addl $1, 8(%eax) +# CHECK: addl $1, (4 + 4)(%eax) addl $1, (4+4)(%eax) # CHECK: addl $1, 8(%eax) addl $1, 8(%eax) # CHECK: addl $1, 0(%eax) addl $1, (%eax) -# CHECK: addl $1, 8(,%eax) +# CHECK: addl $1, (4 + 4)(,%eax) addl $1, (4+4)(,%eax) # Indirect Memory Operands diff --git a/libclamav/c++/llvm/test/MC/MachO/comm-1.s b/libclamav/c++/llvm/test/MC/MachO/comm-1.s new file mode 100644 index 000000000..e979fb139 --- /dev/null +++ b/libclamav/c++/llvm/test/MC/MachO/comm-1.s @@ -0,0 +1,114 @@ +// RUN: llvm-mc -triple i386-apple-darwin9 %s -filetype=obj -o - | macho-dump | FileCheck %s + + .comm sym_comm_B, 2 + .comm sym_comm_A, 4 + .comm sym_comm_C, 8, 2 + .comm sym_comm_D, 2, 3 + + .no_dead_strip sym_comm_C + +// CHECK: ('cputype', 7) +// CHECK: ('cpusubtype', 3) +// CHECK: ('filetype', 1) +// CHECK: ('num_load_commands', 1) +// CHECK: ('load_commands_size', 228) +// CHECK: ('flag', 0) +// CHECK: ('load_commands', [ +// CHECK: # Load Command 0 +// CHECK: (('command', 1) +// CHECK: ('size', 124) +// CHECK: ('segment_name', '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') +// CHECK: ('vm_addr', 0) +// CHECK: ('vm_size', 0) +// CHECK: ('file_offset', 256) +// CHECK: ('file_size', 0) +// CHECK: ('maxprot', 7) +// CHECK: ('initprot', 7) +// CHECK: ('num_sections', 1) +// CHECK: ('flags', 0) +// CHECK: ('sections', [ +// CHECK: # Section 0 +// CHECK: (('section_name', '__text\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') +// CHECK: ('segment_name', '__TEXT\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') +// CHECK: ('address', 0) +// CHECK: ('size', 0) +// CHECK: ('offset', 256) +// CHECK: ('alignment', 0) +// CHECK: ('reloc_offset', 0) +// CHECK: ('num_reloc', 0) +// CHECK: ('flags', 0x80000000) +// CHECK: ('reserved1', 0) +// CHECK: ('reserved2', 0) +// CHECK: ), +// CHECK: ('_relocations', [ +// CHECK: ]) +// CHECK: ]) +// CHECK: ), +// CHECK: # Load Command 1 +// CHECK: (('command', 2) +// CHECK: ('size', 24) +// CHECK: ('symoff', 256) +// CHECK: ('nsyms', 4) +// CHECK: ('stroff', 304) +// CHECK: ('strsize', 48) +// CHECK: ('_string_data', '\x00sym_comm_B\x00sym_comm_A\x00sym_comm_C\x00sym_comm_D\x00\x00\x00\x00') +// CHECK: ('_symbols', [ +// CHECK: # Symbol 0 +// CHECK: (('n_strx', 12) +// CHECK: ('n_type', 0x1) +// CHECK: ('n_sect', 0) +// CHECK: ('n_desc', 0) +// CHECK: ('n_value', 4) +// CHECK: ('_string', 'sym_comm_A') +// CHECK: ), +// CHECK: # Symbol 1 +// CHECK: (('n_strx', 1) +// CHECK: ('n_type', 0x1) +// CHECK: ('n_sect', 0) +// CHECK: ('n_desc', 0) +// CHECK: ('n_value', 2) +// CHECK: ('_string', 'sym_comm_B') +// CHECK: ), +// CHECK: # Symbol 2 +// CHECK: (('n_strx', 23) +// CHECK: ('n_type', 0x1) +// CHECK: ('n_sect', 0) +// CHECK: ('n_desc', 544) +// CHECK: ('n_value', 8) +// CHECK: ('_string', 'sym_comm_C') +// CHECK: ), +// CHECK: # Symbol 3 +// CHECK: (('n_strx', 34) +// CHECK: ('n_type', 0x1) +// CHECK: ('n_sect', 0) +// CHECK: ('n_desc', 768) +// CHECK: ('n_value', 2) +// CHECK: ('_string', 'sym_comm_D') +// CHECK: ), +// CHECK: ]) +// CHECK: ), +// CHECK: # Load Command 2 +// CHECK: (('command', 11) +// CHECK: ('size', 80) +// CHECK: ('ilocalsym', 0) +// CHECK: ('nlocalsym', 0) +// CHECK: ('iextdefsym', 0) +// CHECK: ('nextdefsym', 0) +// CHECK: ('iundefsym', 0) +// CHECK: ('nundefsym', 4) +// CHECK: ('tocoff', 0) +// CHECK: ('ntoc', 0) +// CHECK: ('modtaboff', 0) +// CHECK: ('nmodtab', 0) +// CHECK: ('extrefsymoff', 0) +// CHECK: ('nextrefsyms', 0) +// CHECK: ('indirectsymoff', 0) +// CHECK: ('nindirectsyms', 0) +// CHECK: ('extreloff', 0) +// CHECK: ('nextrel', 0) +// CHECK: ('locreloff', 0) +// CHECK: ('nlocrel', 0) +// CHECK: ('_indirect_symbols', [ +// CHECK: ]) +// CHECK: ), +// CHECK: ]) diff --git a/libclamav/c++/llvm/test/MC/MachO/dg.exp b/libclamav/c++/llvm/test/MC/MachO/dg.exp index ebd84187f..ca6aefe9c 100644 --- a/libclamav/c++/llvm/test/MC/MachO/dg.exp +++ b/libclamav/c++/llvm/test/MC/MachO/dg.exp @@ -1,3 +1,6 @@ load_lib llvm.exp -RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{s}]] +if { [llvm_supports_target X86] } { + RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{s}]] +} + diff --git a/libclamav/c++/llvm/test/MC/MachO/lcomm-attributes.s b/libclamav/c++/llvm/test/MC/MachO/lcomm-attributes.s new file mode 100644 index 000000000..2685395e1 --- /dev/null +++ b/libclamav/c++/llvm/test/MC/MachO/lcomm-attributes.s @@ -0,0 +1,136 @@ +// RUN: llvm-mc -triple i386-apple-darwin9 %s -filetype=obj -o - | macho-dump | FileCheck %s + + // Note, this test intentionally mismatches Darwin 'as', which loses the + // following global marker. + // + // FIXME: We should probably warn about our interpretation of this. + .globl sym_lcomm_ext_A + .lcomm sym_lcomm_ext_A, 4 + .lcomm sym_lcomm_ext_B, 4 + .globl sym_lcomm_ext_B + + .globl sym_zfill_ext_A + .zerofill __DATA, __bss, sym_zfill_ext_A, 4 + .zerofill __DATA, __bss, sym_zfill_ext_B, 4 + .globl sym_zfill_ext_B + +// CHECK: ('cputype', 7) +// CHECK: ('cpusubtype', 3) +// CHECK: ('filetype', 1) +// CHECK: ('num_load_commands', 1) +// CHECK: ('load_commands_size', 296) +// CHECK: ('flag', 0) +// CHECK: ('load_commands', [ +// CHECK: # Load Command 0 +// CHECK: (('command', 1) +// CHECK: ('size', 192) +// CHECK: ('segment_name', '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') +// CHECK: ('vm_addr', 0) +// CHECK: ('vm_size', 16) +// CHECK: ('file_offset', 324) +// CHECK: ('file_size', 0) +// CHECK: ('maxprot', 7) +// CHECK: ('initprot', 7) +// CHECK: ('num_sections', 2) +// CHECK: ('flags', 0) +// CHECK: ('sections', [ +// CHECK: # Section 0 +// CHECK: (('section_name', '__text\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') +// CHECK: ('segment_name', '__TEXT\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') +// CHECK: ('address', 0) +// CHECK: ('size', 0) +// CHECK: ('offset', 324) +// CHECK: ('alignment', 0) +// CHECK: ('reloc_offset', 0) +// CHECK: ('num_reloc', 0) +// CHECK: ('flags', 0x80000000) +// CHECK: ('reserved1', 0) +// CHECK: ('reserved2', 0) +// CHECK: ), +// CHECK: ('_relocations', [ +// CHECK: ]) +// CHECK: # Section 1 +// CHECK: (('section_name', '__bss\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') +// CHECK: ('segment_name', '__DATA\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') +// CHECK: ('address', 0) +// CHECK: ('size', 16) +// CHECK: ('offset', 0) +// CHECK: ('alignment', 0) +// CHECK: ('reloc_offset', 0) +// CHECK: ('num_reloc', 0) +// CHECK: ('flags', 0x1) +// CHECK: ('reserved1', 0) +// CHECK: ('reserved2', 0) +// CHECK: ), +// CHECK: ('_relocations', [ +// CHECK: ]) +// CHECK: ]) +// CHECK: ), +// CHECK: # Load Command 1 +// CHECK: (('command', 2) +// CHECK: ('size', 24) +// CHECK: ('symoff', 324) +// CHECK: ('nsyms', 4) +// CHECK: ('stroff', 372) +// CHECK: ('strsize', 68) +// CHECK: ('_string_data', '\x00sym_lcomm_ext_A\x00sym_lcomm_ext_B\x00sym_zfill_ext_A\x00sym_zfill_ext_B\x00\x00\x00\x00') +// CHECK: ('_symbols', [ +// CHECK: # Symbol 0 +// CHECK: (('n_strx', 1) +// CHECK: ('n_type', 0xf) +// CHECK: ('n_sect', 2) +// CHECK: ('n_desc', 0) +// CHECK: ('n_value', 0) +// CHECK: ('_string', 'sym_lcomm_ext_A') +// CHECK: ), +// CHECK: # Symbol 1 +// CHECK: (('n_strx', 17) +// CHECK: ('n_type', 0xf) +// CHECK: ('n_sect', 2) +// CHECK: ('n_desc', 0) +// CHECK: ('n_value', 4) +// CHECK: ('_string', 'sym_lcomm_ext_B') +// CHECK: ), +// CHECK: # Symbol 2 +// CHECK: (('n_strx', 33) +// CHECK: ('n_type', 0xf) +// CHECK: ('n_sect', 2) +// CHECK: ('n_desc', 0) +// CHECK: ('n_value', 8) +// CHECK: ('_string', 'sym_zfill_ext_A') +// CHECK: ), +// CHECK: # Symbol 3 +// CHECK: (('n_strx', 49) +// CHECK: ('n_type', 0xf) +// CHECK: ('n_sect', 2) +// CHECK: ('n_desc', 0) +// CHECK: ('n_value', 12) +// CHECK: ('_string', 'sym_zfill_ext_B') +// CHECK: ), +// CHECK: ]) +// CHECK: ), +// CHECK: # Load Command 2 +// CHECK: (('command', 11) +// CHECK: ('size', 80) +// CHECK: ('ilocalsym', 0) +// CHECK: ('nlocalsym', 0) +// CHECK: ('iextdefsym', 0) +// CHECK: ('nextdefsym', 4) +// CHECK: ('iundefsym', 4) +// CHECK: ('nundefsym', 0) +// CHECK: ('tocoff', 0) +// CHECK: ('ntoc', 0) +// CHECK: ('modtaboff', 0) +// CHECK: ('nmodtab', 0) +// CHECK: ('extrefsymoff', 0) +// CHECK: ('nextrefsyms', 0) +// CHECK: ('indirectsymoff', 0) +// CHECK: ('nindirectsyms', 0) +// CHECK: ('extreloff', 0) +// CHECK: ('nextrel', 0) +// CHECK: ('locreloff', 0) +// CHECK: ('nlocrel', 0) +// CHECK: ('_indirect_symbols', [ +// CHECK: ]) +// CHECK: ), +// CHECK: ]) diff --git a/libclamav/c++/llvm/test/MC/MachO/reloc.s b/libclamav/c++/llvm/test/MC/MachO/reloc.s new file mode 100644 index 000000000..e86ed8c6d --- /dev/null +++ b/libclamav/c++/llvm/test/MC/MachO/reloc.s @@ -0,0 +1,227 @@ +// RUN: llvm-mc -triple i386-apple-darwin9 %s -filetype=obj -o - | macho-dump --dump-section-data | FileCheck %s + + .data + .long undef + .long (undef + 4) + + .globl local_a_ext +local_a_ext: + .long local_a_ext + +local_a: + .long 0 +local_a_elt: + .long 0 +local_b: + .long local_b - local_c + 245 + .long 0 +local_c: + .long 0 + + + .long local_a_elt + 1 + .long local_a_elt + 10 + .short local_a_elt + 20 + .byte local_a_elt + 89 + + .const + + .long +bar: + .long local_a_elt - bar + 33 + +// CHECK: ('cputype', 7) +// CHECK: ('cpusubtype', 3) +// CHECK: ('filetype', 1) +// CHECK: ('num_load_commands', 1) +// CHECK: ('load_commands_size', 364) +// CHECK: ('flag', 0) +// CHECK: ('load_commands', [ +// CHECK: # Load Command 0 +// CHECK: (('command', 1) +// CHECK: ('size', 260) +// CHECK: ('segment_name', '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') +// CHECK: ('vm_addr', 0) +// CHECK: ('vm_size', 47) +// CHECK: ('file_offset', 392) +// CHECK: ('file_size', 47) +// CHECK: ('maxprot', 7) +// CHECK: ('initprot', 7) +// CHECK: ('num_sections', 3) +// CHECK: ('flags', 0) +// CHECK: ('sections', [ +// CHECK: # Section 0 +// CHECK: (('section_name', '__text\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') +// CHECK: ('segment_name', '__TEXT\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') +// CHECK: ('address', 0) +// CHECK: ('size', 0) +// CHECK: ('offset', 392) +// CHECK: ('alignment', 0) +// CHECK: ('reloc_offset', 0) +// CHECK: ('num_reloc', 0) +// CHECK: ('flags', 0x80000000) +// CHECK: ('reserved1', 0) +// CHECK: ('reserved2', 0) +// CHECK: ), +// CHECK: ('_relocations', [ +// CHECK: ]) +// CHECK: ('_section_data', '') +// CHECK: # Section 1 +// CHECK: (('section_name', '__data\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') +// CHECK: ('segment_name', '__DATA\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') +// CHECK: ('address', 0) +// CHECK: ('size', 43) +// CHECK: ('offset', 392) +// CHECK: ('alignment', 0) +// CHECK: ('reloc_offset', 440) +// CHECK: ('num_reloc', 9) +// CHECK: ('flags', 0x0) +// CHECK: ('reserved1', 0) +// CHECK: ('reserved2', 0) +// CHECK: ), +// CHECK: ('_relocations', [ +// CHECK: # Relocation 0 +// CHECK: (('word-0', 0x8000002a), +// CHECK: ('word-1', 0x10)), +// CHECK: # Relocation 1 +// CHECK: (('word-0', 0x90000028), +// CHECK: ('word-1', 0x10)), +// CHECK: # Relocation 2 +// CHECK: (('word-0', 0xa0000024), +// CHECK: ('word-1', 0x10)), +// CHECK: # Relocation 3 +// CHECK: (('word-0', 0xa0000020), +// CHECK: ('word-1', 0x10)), +// CHECK: # Relocation 4 +// CHECK: (('word-0', 0xa4000014), +// CHECK: ('word-1', 0x14)), +// CHECK: # Relocation 5 +// CHECK: (('word-0', 0xa1000000), +// CHECK: ('word-1', 0x1c)), +// CHECK: # Relocation 6 +// CHECK: (('word-0', 0x8), +// CHECK: ('word-1', 0x4000002)), +// CHECK: # Relocation 7 +// CHECK: (('word-0', 0x4), +// CHECK: ('word-1', 0xc000006)), +// CHECK: # Relocation 8 +// CHECK: (('word-0', 0x0), +// CHECK: ('word-1', 0xc000006)), +// CHECK: ]) +// CHECK: ('_section_data', '\x00\x00\x00\x00\x04\x00\x00\x00\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xed\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x11\x00\x00\x00\x1a\x00\x00\x00$\x00i') +// CHECK: # Section 2 +// CHECK: (('section_name', '__const\x00\x00\x00\x00\x00\x00\x00\x00\x00') +// CHECK: ('segment_name', '__TEXT\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') +// CHECK: ('address', 43) +// CHECK: ('size', 4) +// CHECK: ('offset', 435) +// CHECK: ('alignment', 0) +// CHECK: ('reloc_offset', 512) +// CHECK: ('num_reloc', 2) +// CHECK: ('flags', 0x0) +// CHECK: ('reserved1', 0) +// CHECK: ('reserved2', 0) +// CHECK: ), +// CHECK: ('_relocations', [ +// CHECK: # Relocation 0 +// CHECK: (('word-0', 0xa4000000), +// CHECK: ('word-1', 0x10)), +// CHECK: # Relocation 1 +// CHECK: (('word-0', 0xa1000000), +// CHECK: ('word-1', 0x2b)), +// CHECK: ]) +// CHECK: ('_section_data', '\x06\x00\x00\x00') +// CHECK: ]) +// CHECK: ), +// CHECK: # Load Command 1 +// CHECK: (('command', 2) +// CHECK: ('size', 24) +// CHECK: ('symoff', 528) +// CHECK: ('nsyms', 7) +// CHECK: ('stroff', 612) +// CHECK: ('strsize', 60) +// CHECK: ('_string_data', '\x00undef\x00local_a_ext\x00local_a\x00local_a_elt\x00local_b\x00local_c\x00bar\x00\x00') +// CHECK: ('_symbols', [ +// CHECK: # Symbol 0 +// CHECK: (('n_strx', 19) +// CHECK: ('n_type', 0xe) +// CHECK: ('n_sect', 2) +// CHECK: ('n_desc', 0) +// CHECK: ('n_value', 12) +// CHECK: ('_string', 'local_a') +// CHECK: ), +// CHECK: # Symbol 1 +// CHECK: (('n_strx', 27) +// CHECK: ('n_type', 0xe) +// CHECK: ('n_sect', 2) +// CHECK: ('n_desc', 0) +// CHECK: ('n_value', 16) +// CHECK: ('_string', 'local_a_elt') +// CHECK: ), +// CHECK: # Symbol 2 +// CHECK: (('n_strx', 39) +// CHECK: ('n_type', 0xe) +// CHECK: ('n_sect', 2) +// CHECK: ('n_desc', 0) +// CHECK: ('n_value', 20) +// CHECK: ('_string', 'local_b') +// CHECK: ), +// CHECK: # Symbol 3 +// CHECK: (('n_strx', 47) +// CHECK: ('n_type', 0xe) +// CHECK: ('n_sect', 2) +// CHECK: ('n_desc', 0) +// CHECK: ('n_value', 28) +// CHECK: ('_string', 'local_c') +// CHECK: ), +// CHECK: # Symbol 4 +// CHECK: (('n_strx', 55) +// CHECK: ('n_type', 0xe) +// CHECK: ('n_sect', 3) +// CHECK: ('n_desc', 0) +// CHECK: ('n_value', 43) +// CHECK: ('_string', 'bar') +// CHECK: ), +// CHECK: # Symbol 5 +// CHECK: (('n_strx', 7) +// CHECK: ('n_type', 0xf) +// CHECK: ('n_sect', 2) +// CHECK: ('n_desc', 0) +// CHECK: ('n_value', 8) +// CHECK: ('_string', 'local_a_ext') +// CHECK: ), +// CHECK: # Symbol 6 +// CHECK: (('n_strx', 1) +// CHECK: ('n_type', 0x1) +// CHECK: ('n_sect', 0) +// CHECK: ('n_desc', 0) +// CHECK: ('n_value', 0) +// CHECK: ('_string', 'undef') +// CHECK: ), +// CHECK: ]) +// CHECK: ), +// CHECK: # Load Command 2 +// CHECK: (('command', 11) +// CHECK: ('size', 80) +// CHECK: ('ilocalsym', 0) +// CHECK: ('nlocalsym', 5) +// CHECK: ('iextdefsym', 5) +// CHECK: ('nextdefsym', 1) +// CHECK: ('iundefsym', 6) +// CHECK: ('nundefsym', 1) +// CHECK: ('tocoff', 0) +// CHECK: ('ntoc', 0) +// CHECK: ('modtaboff', 0) +// CHECK: ('nmodtab', 0) +// CHECK: ('extrefsymoff', 0) +// CHECK: ('nextrefsyms', 0) +// CHECK: ('indirectsymoff', 0) +// CHECK: ('nindirectsyms', 0) +// CHECK: ('extreloff', 0) +// CHECK: ('nextrel', 0) +// CHECK: ('locreloff', 0) +// CHECK: ('nlocrel', 0) +// CHECK: ('_indirect_symbols', [ +// CHECK: ]) +// CHECK: ), +// CHECK: ]) diff --git a/libclamav/c++/llvm/test/MC/MachO/section-align-1.s b/libclamav/c++/llvm/test/MC/MachO/section-align-1.s new file mode 100644 index 000000000..6a5e247c9 --- /dev/null +++ b/libclamav/c++/llvm/test/MC/MachO/section-align-1.s @@ -0,0 +1,87 @@ +// RUN: llvm-mc -triple i386-apple-darwin9 %s -filetype=obj -o - | macho-dump | FileCheck %s + +name: + .byte 0 + + // Check that symbol table is aligned to 4 bytes. + + +// CHECK: ('cputype', 7) +// CHECK: ('cpusubtype', 3) +// CHECK: ('filetype', 1) +// CHECK: ('num_load_commands', 1) +// CHECK: ('load_commands_size', 228) +// CHECK: ('flag', 0) +// CHECK: ('load_commands', [ +// CHECK: # Load Command 0 +// CHECK: (('command', 1) +// CHECK: ('size', 124) +// CHECK: ('segment_name', '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') +// CHECK: ('vm_addr', 0) +// CHECK: ('vm_size', 1) +// CHECK: ('file_offset', 256) +// CHECK: ('file_size', 1) +// CHECK: ('maxprot', 7) +// CHECK: ('initprot', 7) +// CHECK: ('num_sections', 1) +// CHECK: ('flags', 0) +// CHECK: ('sections', [ +// CHECK: # Section 0 +// CHECK: (('section_name', '__text\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') +// CHECK: ('segment_name', '__TEXT\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') +// CHECK: ('address', 0) +// CHECK: ('size', 1) +// CHECK: ('offset', 256) +// CHECK: ('alignment', 0) +// CHECK: ('reloc_offset', 0) +// CHECK: ('num_reloc', 0) +// CHECK: ('flags', 0x80000000) +// CHECK: ('reserved1', 0) +// CHECK: ('reserved2', 0) +// CHECK: ), +// CHECK: ]) +// CHECK: ), +// CHECK: # Load Command 1 +// CHECK: (('command', 2) +// CHECK: ('size', 24) +// CHECK: ('symoff', 260) +// CHECK: ('nsyms', 1) +// CHECK: ('stroff', 272) +// CHECK: ('strsize', 8) +// CHECK: ('_string_data', '\x00name\x00\x00\x00') +// CHECK: ('_symbols', [ +// CHECK: # Symbol 0 +// CHECK: (('n_strx', 1) +// CHECK: ('n_type', 0xe) +// CHECK: ('n_sect', 1) +// CHECK: ('n_desc', 0) +// CHECK: ('n_value', 0) +// CHECK: ('_string', 'name') +// CHECK: ), +// CHECK: ]) +// CHECK: ), +// CHECK: # Load Command 2 +// CHECK: (('command', 11) +// CHECK: ('size', 80) +// CHECK: ('ilocalsym', 0) +// CHECK: ('nlocalsym', 1) +// CHECK: ('iextdefsym', 1) +// CHECK: ('nextdefsym', 0) +// CHECK: ('iundefsym', 1) +// CHECK: ('nundefsym', 0) +// CHECK: ('tocoff', 0) +// CHECK: ('ntoc', 0) +// CHECK: ('modtaboff', 0) +// CHECK: ('nmodtab', 0) +// CHECK: ('extrefsymoff', 0) +// CHECK: ('nextrefsyms', 0) +// CHECK: ('indirectsymoff', 0) +// CHECK: ('nindirectsyms', 0) +// CHECK: ('extreloff', 0) +// CHECK: ('nextrel', 0) +// CHECK: ('locreloff', 0) +// CHECK: ('nlocrel', 0) +// CHECK: ('_indirect_symbols', [ +// CHECK: ]) +// CHECK: ), +// CHECK: ]) diff --git a/libclamav/c++/llvm/test/MC/MachO/section-align-2.s b/libclamav/c++/llvm/test/MC/MachO/section-align-2.s new file mode 100644 index 000000000..e0704734a --- /dev/null +++ b/libclamav/c++/llvm/test/MC/MachO/section-align-2.s @@ -0,0 +1,137 @@ +// RUN: llvm-mc -triple i386-apple-darwin9 %s -filetype=obj -o - | macho-dump | FileCheck %s + + .byte 0 + + // There should be 3 padding bytes here. + + .data + .align 2 +foo: + .org 8 +bar: + .byte 0 + + .const +baz: + +// CHECK: ('cputype', 7) +// CHECK: ('cpusubtype', 3) +// CHECK: ('filetype', 1) +// CHECK: ('num_load_commands', 1) +// CHECK: ('load_commands_size', 364) +// CHECK: ('flag', 0) +// CHECK: ('load_commands', [ +// CHECK: # Load Command 0 +// CHECK: (('command', 1) +// CHECK: ('size', 260) +// CHECK: ('segment_name', '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') +// CHECK: ('vm_addr', 0) +// CHECK: ('vm_size', 13) +// CHECK: ('file_offset', 392) +// CHECK: ('file_size', 13) +// CHECK: ('maxprot', 7) +// CHECK: ('initprot', 7) +// CHECK: ('num_sections', 3) +// CHECK: ('flags', 0) +// CHECK: ('sections', [ +// CHECK: # Section 0 +// CHECK: (('section_name', '__text\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') +// CHECK: ('segment_name', '__TEXT\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') +// CHECK: ('address', 0) +// CHECK: ('size', 1) +// CHECK: ('offset', 392) +// CHECK: ('alignment', 0) +// CHECK: ('reloc_offset', 0) +// CHECK: ('num_reloc', 0) +// CHECK: ('flags', 0x80000000) +// CHECK: ('reserved1', 0) +// CHECK: ('reserved2', 0) +// CHECK: ), +// CHECK: # Section 1 +// CHECK: (('section_name', '__data\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') +// CHECK: ('segment_name', '__DATA\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') +// CHECK: ('address', 4) +// CHECK: ('size', 9) +// CHECK: ('offset', 396) +// CHECK: ('alignment', 2) +// CHECK: ('reloc_offset', 0) +// CHECK: ('num_reloc', 0) +// CHECK: ('flags', 0x0) +// CHECK: ('reserved1', 0) +// CHECK: ('reserved2', 0) +// CHECK: ), +// CHECK: # Section 2 +// CHECK: (('section_name', '__const\x00\x00\x00\x00\x00\x00\x00\x00\x00') +// CHECK: ('segment_name', '__TEXT\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') +// CHECK: ('address', 13) +// CHECK: ('size', 0) +// CHECK: ('offset', 405) +// CHECK: ('alignment', 0) +// CHECK: ('reloc_offset', 0) +// CHECK: ('num_reloc', 0) +// CHECK: ('flags', 0x0) +// CHECK: ('reserved1', 0) +// CHECK: ('reserved2', 0) +// CHECK: ), +// CHECK: ]) +// CHECK: ), +// CHECK: # Load Command 1 +// CHECK: (('command', 2) +// CHECK: ('size', 24) +// CHECK: ('symoff', 408) +// CHECK: ('nsyms', 3) +// CHECK: ('stroff', 444) +// CHECK: ('strsize', 16) +// CHECK: ('_string_data', '\x00foo\x00bar\x00baz\x00\x00\x00\x00') +// CHECK: ('_symbols', [ +// CHECK: # Symbol 0 +// CHECK: (('n_strx', 1) +// CHECK: ('n_type', 0xe) +// CHECK: ('n_sect', 2) +// CHECK: ('n_desc', 0) +// CHECK: ('n_value', 4) +// CHECK: ('_string', 'foo') +// CHECK: ), +// CHECK: # Symbol 1 +// CHECK: (('n_strx', 5) +// CHECK: ('n_type', 0xe) +// CHECK: ('n_sect', 2) +// CHECK: ('n_desc', 0) +// CHECK: ('n_value', 12) +// CHECK: ('_string', 'bar') +// CHECK: ), +// CHECK: # Symbol 2 +// CHECK: (('n_strx', 9) +// CHECK: ('n_type', 0xe) +// CHECK: ('n_sect', 3) +// CHECK: ('n_desc', 0) +// CHECK: ('n_value', 13) +// CHECK: ('_string', 'baz') +// CHECK: ), +// CHECK: ]) +// CHECK: ), +// CHECK: # Load Command 2 +// CHECK: (('command', 11) +// CHECK: ('size', 80) +// CHECK: ('ilocalsym', 0) +// CHECK: ('nlocalsym', 3) +// CHECK: ('iextdefsym', 3) +// CHECK: ('nextdefsym', 0) +// CHECK: ('iundefsym', 3) +// CHECK: ('nundefsym', 0) +// CHECK: ('tocoff', 0) +// CHECK: ('ntoc', 0) +// CHECK: ('modtaboff', 0) +// CHECK: ('nmodtab', 0) +// CHECK: ('extrefsymoff', 0) +// CHECK: ('nextrefsyms', 0) +// CHECK: ('indirectsymoff', 0) +// CHECK: ('nindirectsyms', 0) +// CHECK: ('extreloff', 0) +// CHECK: ('nextrel', 0) +// CHECK: ('locreloff', 0) +// CHECK: ('nlocrel', 0) +// CHECK: ('_indirect_symbols', [ +// CHECK: ]) +// CHECK: ), +// CHECK: ]) diff --git a/libclamav/c++/llvm/test/MC/MachO/sections.s b/libclamav/c++/llvm/test/MC/MachO/sections.s index 27d978266..bcbd9f466 100644 --- a/libclamav/c++/llvm/test/MC/MachO/sections.s +++ b/libclamav/c++/llvm/test/MC/MachO/sections.s @@ -1,5 +1,8 @@ // RUN: llvm-mc -triple i386-apple-darwin9 %s -filetype=obj -o - | macho-dump | FileCheck %s + .text + .section __TEXT,__text,regular,pure_instructions + .const .static_const .cstring @@ -42,13 +45,14 @@ .objc_selector_strs - + .subsections_via_symbols + // CHECK: ('cputype', 7) // CHECK: ('cpusubtype', 3) // CHECK: ('filetype', 1) // CHECK: ('num_load_commands', 1) // CHECK: ('load_commands_size', 2436) -// CHECK: ('flag', 0) +// CHECK: ('flag', 8192) // CHECK: ('load_commands', [ // CHECK: # Load Command 0 // CHECK: (('command', 1) diff --git a/libclamav/c++/llvm/test/MC/MachO/symbol-indirect.s b/libclamav/c++/llvm/test/MC/MachO/symbol-indirect.s new file mode 100644 index 000000000..461291a3c --- /dev/null +++ b/libclamav/c++/llvm/test/MC/MachO/symbol-indirect.s @@ -0,0 +1,268 @@ +// RUN: llvm-mc -triple i386-apple-darwin9 %s -filetype=obj -o - | macho-dump | FileCheck %s + +// FIXME: We are missing a lot of diagnostics on this kind of stuff which the +// assembler has. + + .lazy_symbol_pointer + .indirect_symbol sym_lsp_B + .long 0 + + .globl sym_lsp_A + .indirect_symbol sym_lsp_A + .long 0 + +sym_lsp_C: + .indirect_symbol sym_lsp_C + .long 0 + +// FIXME: Enable this test once missing llvm-mc support is in place. +.if 0 + .indirect_symbol sym_lsp_D + .long sym_lsp_D +.endif + + .indirect_symbol sym_lsp_E + .long 0xFA + +// FIXME: Enable this test once missing llvm-mc support is in place. +.if 0 +sym_lsp_F = 10 + .indirect_symbol sym_lsp_F + .long 0 +.endif + + .globl sym_lsp_G +sym_lsp_G: + .indirect_symbol sym_lsp_G + .long 0 + + .non_lazy_symbol_pointer + .indirect_symbol sym_nlp_B + .long 0 + + .globl sym_nlp_A + .indirect_symbol sym_nlp_A + .long 0 + +sym_nlp_C: + .indirect_symbol sym_nlp_C + .long 0 + +// FIXME: Enable this test once missing llvm-mc support is in place. +.if 0 + .indirect_symbol sym_nlp_D + .long sym_nlp_D +.endif + + .indirect_symbol sym_nlp_E + .long 0xAF + +// FIXME: Enable this test once missing llvm-mc support is in place. +.if 0 +sym_nlp_F = 10 + .indirect_symbol sym_nlp_F + .long 0 +.endif + + .globl sym_nlp_G +sym_nlp_G: + .indirect_symbol sym_nlp_G + .long 0 + +// CHECK: ('cputype', 7) +// CHECK: ('cpusubtype', 3) +// CHECK: ('filetype', 1) +// CHECK: ('num_load_commands', 1) +// CHECK: ('load_commands_size', 364) +// CHECK: ('flag', 0) +// CHECK: ('load_commands', [ +// CHECK: # Load Command 0 +// CHECK: (('command', 1) +// CHECK: ('size', 260) +// CHECK: ('segment_name', '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') +// CHECK: ('vm_addr', 0) +// CHECK: ('vm_size', 40) +// CHECK: ('file_offset', 392) +// CHECK: ('file_size', 40) +// CHECK: ('maxprot', 7) +// CHECK: ('initprot', 7) +// CHECK: ('num_sections', 3) +// CHECK: ('flags', 0) +// CHECK: ('sections', [ +// CHECK: # Section 0 +// CHECK: (('section_name', '__text\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') +// CHECK: ('address', 0) +// CHECK: ('size', 0) +// CHECK: ('offset', 392) +// CHECK: ('alignment', 0) +// CHECK: ('reloc_offset', 0) +// CHECK: ('num_reloc', 0) +// CHECK: ('flags', 0x80000000) +// CHECK: ('reserved1', 0) +// CHECK: ('reserved2', 0) +// CHECK: ), +// CHECK: # Section 1 +// CHECK: (('section_name', '__la_symbol_ptr\x00') +// CHECK: ('segment_name', '__DATA\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') +// CHECK: ('address', 0) +// CHECK: ('size', 20) +// CHECK: ('offset', 392) +// CHECK: ('alignment', 2) +// CHECK: ('reloc_offset', 0) +// CHECK: ('num_reloc', 0) +// CHECK: ('flags', 0x7) +// CHECK: ('reserved1', 0) +// CHECK: ('reserved2', 0) +// CHECK: ), +// CHECK: # Section 2 +// CHECK: (('section_name', '__nl_symbol_ptr\x00') +// CHECK: ('segment_name', '__DATA\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') +// CHECK: ('address', 20) +// CHECK: ('size', 20) +// CHECK: ('offset', 412) +// CHECK: ('alignment', 2) +// CHECK: ('reloc_offset', 0) +// CHECK: ('num_reloc', 0) +// CHECK: ('flags', 0x6) + // FIXME: Enable this when fixed! +// CHECX: ('reserved1', 5) +// CHECK: ('reserved2', 0) +// CHECK: ), +// CHECK: ]) +// CHECK: ), +// CHECK: # Load Command 1 +// CHECK: (('command', 2) +// CHECK: ('size', 24) +// CHECK: ('symoff', 472) +// CHECK: ('nsyms', 10) +// CHECK: ('stroff', 592) +// CHECK: ('strsize', 104) +// CHECK: ('_string_data', '\x00sym_lsp_A\x00sym_lsp_G\x00sym_nlp_A\x00sym_nlp_G\x00sym_nlp_B\x00sym_nlp_E\x00sym_lsp_B\x00sym_lsp_E\x00sym_lsp_C\x00sym_nlp_C\x00\x00\x00\x00') +// CHECK: ('_symbols', [ +// CHECK: # Symbol 0 +// CHECK: (('n_strx', 81) +// CHECK: ('n_type', 0xe) +// CHECK: ('n_sect', 2) +// CHECK: ('n_desc', 0) +// CHECK: ('n_value', 8) +// CHECK: ('_string', 'sym_lsp_C') +// CHECK: ), +// CHECK: # Symbol 1 +// CHECK: (('n_strx', 91) +// CHECK: ('n_type', 0xe) +// CHECK: ('n_sect', 3) +// CHECK: ('n_desc', 0) +// CHECK: ('n_value', 28) +// CHECK: ('_string', 'sym_nlp_C') +// CHECK: ), +// CHECK: # Symbol 2 +// CHECK: (('n_strx', 11) +// CHECK: ('n_type', 0xf) +// CHECK: ('n_sect', 2) +// CHECK: ('n_desc', 0) +// CHECK: ('n_value', 16) +// CHECK: ('_string', 'sym_lsp_G') +// CHECK: ), +// CHECK: # Symbol 3 +// CHECK: (('n_strx', 31) +// CHECK: ('n_type', 0xf) +// CHECK: ('n_sect', 3) +// CHECK: ('n_desc', 0) +// CHECK: ('n_value', 36) +// CHECK: ('_string', 'sym_nlp_G') +// CHECK: ), +// CHECK: # Symbol 4 +// CHECK: (('n_strx', 1) +// CHECK: ('n_type', 0x1) +// CHECK: ('n_sect', 0) +// CHECK: ('n_desc', 0) +// CHECK: ('n_value', 0) +// CHECK: ('_string', 'sym_lsp_A') +// CHECK: ), +// CHECK: # Symbol 5 +// CHECK: (('n_strx', 61) +// CHECK: ('n_type', 0x1) +// CHECK: ('n_sect', 0) +// CHECK: ('n_desc', 1) +// CHECK: ('n_value', 0) +// CHECK: ('_string', 'sym_lsp_B') +// CHECK: ), +// CHECK: # Symbol 6 +// CHECK: (('n_strx', 71) +// CHECK: ('n_type', 0x1) +// CHECK: ('n_sect', 0) +// CHECK: ('n_desc', 1) +// CHECK: ('n_value', 0) +// CHECK: ('_string', 'sym_lsp_E') +// CHECK: ), +// CHECK: # Symbol 7 +// CHECK: (('n_strx', 21) +// CHECK: ('n_type', 0x1) +// CHECK: ('n_sect', 0) +// CHECK: ('n_desc', 0) +// CHECK: ('n_value', 0) +// CHECK: ('_string', 'sym_nlp_A') +// CHECK: ), +// CHECK: # Symbol 8 +// CHECK: (('n_strx', 41) +// CHECK: ('n_type', 0x1) +// CHECK: ('n_sect', 0) +// CHECK: ('n_desc', 0) +// CHECK: ('n_value', 0) +// CHECK: ('_string', 'sym_nlp_B') +// CHECK: ), +// CHECK: # Symbol 9 +// CHECK: (('n_strx', 51) +// CHECK: ('n_type', 0x1) +// CHECK: ('n_sect', 0) +// CHECK: ('n_desc', 0) +// CHECK: ('n_value', 0) +// CHECK: ('_string', 'sym_nlp_E') +// CHECK: ), +// CHECK: ]) +// CHECK: ), +// CHECK: # Load Command 2 +// CHECK: (('command', 11) +// CHECK: ('size', 80) +// CHECK: ('ilocalsym', 0) +// CHECK: ('nlocalsym', 2) +// CHECK: ('iextdefsym', 2) +// CHECK: ('nextdefsym', 2) +// CHECK: ('iundefsym', 4) +// CHECK: ('nundefsym', 6) +// CHECK: ('tocoff', 0) +// CHECK: ('ntoc', 0) +// CHECK: ('modtaboff', 0) +// CHECK: ('nmodtab', 0) +// CHECK: ('extrefsymoff', 0) +// CHECK: ('nextrefsyms', 0) +// CHECK: ('indirectsymoff', 432) +// CHECK: ('nindirectsyms', 10) +// CHECK: ('extreloff', 0) +// CHECK: ('nextrel', 0) +// CHECK: ('locreloff', 0) +// CHECK: ('nlocrel', 0) +// CHECK: ('_indirect_symbols', [ +// CHECK: # Indirect Symbol 0 +// CHECK: (('symbol_index', 0x5),), +// CHECK: # Indirect Symbol 1 +// CHECK: (('symbol_index', 0x4),), +// CHECK: # Indirect Symbol 2 +// CHECK: (('symbol_index', 0x0),), +// CHECK: # Indirect Symbol 3 +// CHECK: (('symbol_index', 0x6),), +// CHECK: # Indirect Symbol 4 +// CHECK: (('symbol_index', 0x2),), +// CHECK: # Indirect Symbol 5 +// CHECK: (('symbol_index', 0x8),), +// CHECK: # Indirect Symbol 6 +// CHECK: (('symbol_index', 0x7),), +// CHECK: # Indirect Symbol 7 +// CHECK: (('symbol_index', 0x80000000),), +// CHECK: # Indirect Symbol 8 +// CHECK: (('symbol_index', 0x9),), +// CHECK: # Indirect Symbol 9 +// CHECK: (('symbol_index', 0x3),), +// CHECK: ]) +// CHECK: ), +// CHECK: ]) diff --git a/libclamav/c++/llvm/test/MC/MachO/symbols-1.s b/libclamav/c++/llvm/test/MC/MachO/symbols-1.s index 2cf1311eb..4c72fb3e7 100644 --- a/libclamav/c++/llvm/test/MC/MachO/symbols-1.s +++ b/libclamav/c++/llvm/test/MC/MachO/symbols-1.s @@ -13,8 +13,9 @@ sym_local_C: sym_globl_def_A: sym_globl_def_B: sym_globl_def_C: +Lsym_asm_temp: .long 0 - + // CHECK: ('cputype', 7) // CHECK: ('cpusubtype', 3) // CHECK: ('filetype', 1) diff --git a/libclamav/c++/llvm/test/MC/MachO/values.s b/libclamav/c++/llvm/test/MC/MachO/values.s new file mode 100644 index 000000000..2a472ab60 --- /dev/null +++ b/libclamav/c++/llvm/test/MC/MachO/values.s @@ -0,0 +1,135 @@ +// RUN: llvm-mc -triple i386-apple-darwin9 %s -filetype=obj -o - | macho-dump | FileCheck %s + + .long 0 +text_def_int: + .long 0 + + .globl text_def_ext +text_def_ext: + .long 0 + + .data + .long 0 +data_def_int: + .long 0 + + .globl data_def_ext +data_def_ext: + .long 0 + +// CHECK: ('cputype', 7) +// CHECK: ('cpusubtype', 3) +// CHECK: ('filetype', 1) +// CHECK: ('num_load_commands', 1) +// CHECK: ('load_commands_size', 296) +// CHECK: ('flag', 0) +// CHECK: ('load_commands', [ +// CHECK: # Load Command 0 +// CHECK: (('command', 1) +// CHECK: ('size', 192) +// CHECK: ('segment_name', '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') +// CHECK: ('vm_addr', 0) +// CHECK: ('vm_size', 24) +// CHECK: ('file_offset', 324) +// CHECK: ('file_size', 24) +// CHECK: ('maxprot', 7) +// CHECK: ('initprot', 7) +// CHECK: ('num_sections', 2) +// CHECK: ('flags', 0) +// CHECK: ('sections', [ +// CHECK: # Section 0 +// CHECK: (('section_name', '__text\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') +// CHECK: ('segment_name', '__TEXT\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') +// CHECK: ('address', 0) +// CHECK: ('size', 12) +// CHECK: ('offset', 324) +// CHECK: ('alignment', 0) +// CHECK: ('reloc_offset', 0) +// CHECK: ('num_reloc', 0) +// CHECK: ('flags', 0x80000000) +// CHECK: ('reserved1', 0) +// CHECK: ('reserved2', 0) +// CHECK: ), +// CHECK: # Section 1 +// CHECK: (('section_name', '__data\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') +// CHECK: ('segment_name', '__DATA\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') +// CHECK: ('address', 12) +// CHECK: ('size', 12) +// CHECK: ('offset', 336) +// CHECK: ('alignment', 0) +// CHECK: ('reloc_offset', 0) +// CHECK: ('num_reloc', 0) +// CHECK: ('flags', 0x0) +// CHECK: ('reserved1', 0) +// CHECK: ('reserved2', 0) +// CHECK: ), +// CHECK: ]) +// CHECK: ), +// CHECK: # Load Command 1 +// CHECK: (('command', 2) +// CHECK: ('size', 24) +// CHECK: ('symoff', 348) +// CHECK: ('nsyms', 4) +// CHECK: ('stroff', 396) +// CHECK: ('strsize', 56) +// CHECK: ('_string_data', '\x00text_def_ext\x00data_def_ext\x00text_def_int\x00data_def_int\x00\x00\x00\x00') +// CHECK: ('_symbols', [ +// CHECK: # Symbol 0 +// CHECK: (('n_strx', 27) +// CHECK: ('n_type', 0xe) +// CHECK: ('n_sect', 1) +// CHECK: ('n_desc', 0) +// CHECK: ('n_value', 4) +// CHECK: ('_string', 'text_def_int') +// CHECK: ), +// CHECK: # Symbol 1 +// CHECK: (('n_strx', 40) +// CHECK: ('n_type', 0xe) +// CHECK: ('n_sect', 2) +// CHECK: ('n_desc', 0) +// CHECK: ('n_value', 16) +// CHECK: ('_string', 'data_def_int') +// CHECK: ), +// CHECK: # Symbol 2 +// CHECK: (('n_strx', 14) +// CHECK: ('n_type', 0xf) +// CHECK: ('n_sect', 2) +// CHECK: ('n_desc', 0) +// CHECK: ('n_value', 20) +// CHECK: ('_string', 'data_def_ext') +// CHECK: ), +// CHECK: # Symbol 3 +// CHECK: (('n_strx', 1) +// CHECK: ('n_type', 0xf) +// CHECK: ('n_sect', 1) +// CHECK: ('n_desc', 0) +// CHECK: ('n_value', 8) +// CHECK: ('_string', 'text_def_ext') +// CHECK: ), +// CHECK: ]) +// CHECK: ), +// CHECK: # Load Command 2 +// CHECK: (('command', 11) +// CHECK: ('size', 80) +// CHECK: ('ilocalsym', 0) +// CHECK: ('nlocalsym', 2) +// CHECK: ('iextdefsym', 2) +// CHECK: ('nextdefsym', 2) +// CHECK: ('iundefsym', 4) +// CHECK: ('nundefsym', 0) +// CHECK: ('tocoff', 0) +// CHECK: ('ntoc', 0) +// CHECK: ('modtaboff', 0) +// CHECK: ('nmodtab', 0) +// CHECK: ('extrefsymoff', 0) +// CHECK: ('nextrefsyms', 0) +// CHECK: ('indirectsymoff', 0) +// CHECK: ('nindirectsyms', 0) +// CHECK: ('extreloff', 0) +// CHECK: ('nextrel', 0) +// CHECK: ('locreloff', 0) +// CHECK: ('nlocrel', 0) +// CHECK: ('_indirect_symbols', [ +// CHECK: ]) +// CHECK: ), +// CHECK: ]) diff --git a/libclamav/c++/llvm/test/MC/MachO/zerofill-1.s b/libclamav/c++/llvm/test/MC/MachO/zerofill-1.s new file mode 100644 index 000000000..a175d4c4d --- /dev/null +++ b/libclamav/c++/llvm/test/MC/MachO/zerofill-1.s @@ -0,0 +1,121 @@ +// RUN: llvm-mc -triple i386-apple-darwin9 %s -filetype=obj -o - | macho-dump --dump-section-data | FileCheck %s + + .text + .byte 0 // Align to 2**3 bytes, not 2**1 + + .zerofill __DATA, __common, zfill, 2, 1 + + .data + .align 3 + +// CHECK: ('cputype', 7) +// CHECK: ('cpusubtype', 3) +// CHECK: ('filetype', 1) +// CHECK: ('num_load_commands', 1) +// CHECK: ('load_commands_size', 364) +// CHECK: ('flag', 0) +// CHECK: ('load_commands', [ +// CHECK: # Load Command 0 +// CHECK: (('command', 1) +// CHECK: ('size', 260) +// CHECK: ('segment_name', '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') +// CHECK: ('vm_addr', 0) +// CHECK: ('vm_size', 10) +// CHECK: ('file_offset', 392) +// CHECK: ('file_size', 8) +// CHECK: ('maxprot', 7) +// CHECK: ('initprot', 7) +// CHECK: ('num_sections', 3) +// CHECK: ('flags', 0) +// CHECK: ('sections', [ +// CHECK: # Section 0 +// CHECK: (('section_name', '__text\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') +// CHECK: ('segment_name', '__TEXT\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') +// CHECK: ('address', 0) +// CHECK: ('size', 1) +// CHECK: ('offset', 392) +// CHECK: ('alignment', 0) +// CHECK: ('reloc_offset', 0) +// CHECK: ('num_reloc', 0) +// CHECK: ('flags', 0x80000000) +// CHECK: ('reserved1', 0) +// CHECK: ('reserved2', 0) +// CHECK: ), +// CHECK: ('_relocations', [ +// CHECK: ]) +// CHECK: # Section 1 +// CHECK: (('section_name', '__common\x00\x00\x00\x00\x00\x00\x00\x00') +// CHECK: ('segment_name', '__DATA\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') +// CHECK: ('address', 8) +// CHECK: ('size', 2) +// CHECK: ('offset', 0) +// CHECK: ('alignment', 1) +// CHECK: ('reloc_offset', 0) +// CHECK: ('num_reloc', 0) +// CHECK: ('flags', 0x1) +// CHECK: ('reserved1', 0) +// CHECK: ('reserved2', 0) +// CHECK: ), +// CHECK: ('_relocations', [ +// CHECK: ]) +// CHECK: # Section 2 +// CHECK: (('section_name', '__data\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') +// CHECK: ('segment_name', '__DATA\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') +// CHECK: ('address', 8) +// CHECK: ('size', 0) +// CHECK: ('offset', 400) +// CHECK: ('alignment', 3) +// CHECK: ('reloc_offset', 0) +// CHECK: ('num_reloc', 0) +// CHECK: ('flags', 0x0) +// CHECK: ('reserved1', 0) +// CHECK: ('reserved2', 0) +// CHECK: ), +// CHECK: ('_relocations', [ +// CHECK: ]) +// CHECK: ]) +// CHECK: ), +// CHECK: # Load Command 1 +// CHECK: (('command', 2) +// CHECK: ('size', 24) +// CHECK: ('symoff', 400) +// CHECK: ('nsyms', 1) +// CHECK: ('stroff', 412) +// CHECK: ('strsize', 8) +// CHECK: ('_string_data', '\x00zfill\x00\x00') +// CHECK: ('_symbols', [ +// CHECK: # Symbol 0 +// CHECK: (('n_strx', 1) +// CHECK: ('n_type', 0xe) +// CHECK: ('n_sect', 2) +// CHECK: ('n_desc', 0) +// CHECK: ('n_value', 8) +// CHECK: ('_string', 'zfill') +// CHECK: ), +// CHECK: ]) +// CHECK: ), +// CHECK: # Load Command 2 +// CHECK: (('command', 11) +// CHECK: ('size', 80) +// CHECK: ('ilocalsym', 0) +// CHECK: ('nlocalsym', 1) +// CHECK: ('iextdefsym', 1) +// CHECK: ('nextdefsym', 0) +// CHECK: ('iundefsym', 1) +// CHECK: ('nundefsym', 0) +// CHECK: ('tocoff', 0) +// CHECK: ('ntoc', 0) +// CHECK: ('modtaboff', 0) +// CHECK: ('nmodtab', 0) +// CHECK: ('extrefsymoff', 0) +// CHECK: ('nextrefsyms', 0) +// CHECK: ('indirectsymoff', 0) +// CHECK: ('nindirectsyms', 0) +// CHECK: ('extreloff', 0) +// CHECK: ('nextrel', 0) +// CHECK: ('locreloff', 0) +// CHECK: ('nlocrel', 0) +// CHECK: ('_indirect_symbols', [ +// CHECK: ]) +// CHECK: ), +// CHECK: ]) diff --git a/libclamav/c++/llvm/test/MC/MachO/zerofill-2.s b/libclamav/c++/llvm/test/MC/MachO/zerofill-2.s new file mode 100644 index 000000000..e76de8453 --- /dev/null +++ b/libclamav/c++/llvm/test/MC/MachO/zerofill-2.s @@ -0,0 +1,103 @@ +// RUN: llvm-mc -triple i386-apple-darwin9 %s -filetype=obj -o - | macho-dump --dump-section-data | FileCheck %s + + .byte 0 + + // This file has size 2, the tail padding doesn't count. + .zerofill __DATA, __bss, sym_a, 1 + +// CHECK: ('cputype', 7) +// CHECK: ('cpusubtype', 3) +// CHECK: ('filetype', 1) +// CHECK: ('num_load_commands', 1) +// CHECK: ('load_commands_size', 296) +// CHECK: ('flag', 0) +// CHECK: ('load_commands', [ +// CHECK: # Load Command 0 +// CHECK: (('command', 1) +// CHECK: ('size', 192) +// CHECK: ('segment_name', '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') +// CHECK: ('vm_addr', 0) +// CHECK: ('vm_size', 2) +// CHECK: ('file_offset', 324) +// CHECK: ('file_size', 1) +// CHECK: ('maxprot', 7) +// CHECK: ('initprot', 7) +// CHECK: ('num_sections', 2) +// CHECK: ('flags', 0) +// CHECK: ('sections', [ +// CHECK: # Section 0 +// CHECK: (('section_name', '__text\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') +// CHECK: ('segment_name', '__TEXT\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') +// CHECK: ('address', 0) +// CHECK: ('size', 1) +// CHECK: ('offset', 324) +// CHECK: ('alignment', 0) +// CHECK: ('reloc_offset', 0) +// CHECK: ('num_reloc', 0) +// CHECK: ('flags', 0x80000000) +// CHECK: ('reserved1', 0) +// CHECK: ('reserved2', 0) +// CHECK: ), +// CHECK: ('_relocations', [ +// CHECK: ]) +// CHECK: # Section 1 +// CHECK: (('section_name', '__bss\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') +// CHECK: ('segment_name', '__DATA\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') +// CHECK: ('address', 1) +// CHECK: ('size', 1) +// CHECK: ('offset', 0) +// CHECK: ('alignment', 0) +// CHECK: ('reloc_offset', 0) +// CHECK: ('num_reloc', 0) +// CHECK: ('flags', 0x1) +// CHECK: ('reserved1', 0) +// CHECK: ('reserved2', 0) +// CHECK: ), +// CHECK: ('_relocations', [ +// CHECK: ]) +// CHECK: ]) +// CHECK: ), +// CHECK: # Load Command 1 +// CHECK: (('command', 2) +// CHECK: ('size', 24) +// CHECK: ('symoff', 328) +// CHECK: ('nsyms', 1) +// CHECK: ('stroff', 340) +// CHECK: ('strsize', 8) +// CHECK: ('_string_data', '\x00sym_a\x00\x00') +// CHECK: ('_symbols', [ +// CHECK: # Symbol 0 +// CHECK: (('n_strx', 1) +// CHECK: ('n_type', 0xe) +// CHECK: ('n_sect', 2) +// CHECK: ('n_desc', 0) +// CHECK: ('n_value', 1) +// CHECK: ('_string', 'sym_a') +// CHECK: ), +// CHECK: ]) +// CHECK: ), +// CHECK: # Load Command 2 +// CHECK: (('command', 11) +// CHECK: ('size', 80) +// CHECK: ('ilocalsym', 0) +// CHECK: ('nlocalsym', 1) +// CHECK: ('iextdefsym', 1) +// CHECK: ('nextdefsym', 0) +// CHECK: ('iundefsym', 1) +// CHECK: ('nundefsym', 0) +// CHECK: ('tocoff', 0) +// CHECK: ('ntoc', 0) +// CHECK: ('modtaboff', 0) +// CHECK: ('nmodtab', 0) +// CHECK: ('extrefsymoff', 0) +// CHECK: ('nextrefsyms', 0) +// CHECK: ('indirectsymoff', 0) +// CHECK: ('nindirectsyms', 0) +// CHECK: ('extreloff', 0) +// CHECK: ('nextrel', 0) +// CHECK: ('locreloff', 0) +// CHECK: ('nlocrel', 0) +// CHECK: ('_indirect_symbols', [ +// CHECK: ]) +// CHECK: ), +// CHECK: ]) diff --git a/libclamav/c++/llvm/test/MC/MachO/zerofill-3.s b/libclamav/c++/llvm/test/MC/MachO/zerofill-3.s new file mode 100644 index 000000000..e7f4c7b44 --- /dev/null +++ b/libclamav/c++/llvm/test/MC/MachO/zerofill-3.s @@ -0,0 +1,141 @@ +// RUN: llvm-mc -triple i386-apple-darwin9 %s -filetype=obj -o - | macho-dump --dump-section-data | FileCheck %s + + // FIXME: We don't get the order right currently, the assembler first + // orders the symbols, then assigns addresses. :( +.if 0 + .lcomm sym_lcomm_B, 4 + .lcomm sym_lcomm_C, 4, 4 + .lcomm sym_lcomm_A, 4, 3 + .lcomm sym_lcomm_D, 4 + .globl sym_lcomm_D + .globl sym_lcomm_C +.else + .lcomm sym_lcomm_C, 4, 4 + .lcomm sym_lcomm_D, 4 + .globl sym_lcomm_D + .globl sym_lcomm_C + + .lcomm sym_lcomm_A, 4, 3 + .lcomm sym_lcomm_B, 4 +.endif + +// CHECK: ('cputype', 7) +// CHECK: ('cpusubtype', 3) +// CHECK: ('filetype', 1) +// CHECK: ('num_load_commands', 1) +// CHECK: ('load_commands_size', 296) +// CHECK: ('flag', 0) +// CHECK: ('load_commands', [ +// CHECK: # Load Command 0 +// CHECK: (('command', 1) +// CHECK: ('size', 192) +// CHECK: ('segment_name', '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') +// CHECK: ('vm_addr', 0) +// CHECK: ('vm_size', 16) +// CHECK: ('file_offset', 324) +// CHECK: ('file_size', 0) +// CHECK: ('maxprot', 7) +// CHECK: ('initprot', 7) +// CHECK: ('num_sections', 2) +// CHECK: ('flags', 0) +// CHECK: ('sections', [ +// CHECK: # Section 0 +// CHECK: (('section_name', '__text\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') +// CHECK: ('segment_name', '__TEXT\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') +// CHECK: ('address', 0) +// CHECK: ('size', 0) +// CHECK: ('offset', 324) +// CHECK: ('alignment', 0) +// CHECK: ('reloc_offset', 0) +// CHECK: ('num_reloc', 0) +// CHECK: ('flags', 0x80000000) +// CHECK: ('reserved1', 0) +// CHECK: ('reserved2', 0) +// CHECK: ), +// CHECK: ('_relocations', [ +// CHECK: ]) +// CHECK: # Section 1 +// CHECK: (('section_name', '__bss\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') +// CHECK: ('segment_name', '__DATA\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') +// CHECK: ('address', 0) +// CHECK: ('size', 16) +// CHECK: ('offset', 0) +// CHECK: ('alignment', 4) +// CHECK: ('reloc_offset', 0) +// CHECK: ('num_reloc', 0) +// CHECK: ('flags', 0x1) +// CHECK: ('reserved1', 0) +// CHECK: ('reserved2', 0) +// CHECK: ), +// CHECK: ('_relocations', [ +// CHECK: ]) +// CHECK: ]) +// CHECK: ), +// CHECK: # Load Command 1 +// CHECK: (('command', 2) +// CHECK: ('size', 24) +// CHECK: ('symoff', 324) +// CHECK: ('nsyms', 4) +// CHECK: ('stroff', 372) +// CHECK: ('strsize', 52) +// CHECK: ('_string_data', '\x00sym_lcomm_C\x00sym_lcomm_D\x00sym_lcomm_A\x00sym_lcomm_B\x00\x00\x00\x00') +// CHECK: ('_symbols', [ +// CHECK: # Symbol 0 +// CHECK: (('n_strx', 25) +// CHECK: ('n_type', 0xe) +// CHECK: ('n_sect', 2) +// CHECK: ('n_desc', 0) +// CHECK: ('n_value', 8) +// CHECK: ('_string', 'sym_lcomm_A') +// CHECK: ), +// CHECK: # Symbol 1 +// CHECK: (('n_strx', 37) +// CHECK: ('n_type', 0xe) +// CHECK: ('n_sect', 2) +// CHECK: ('n_desc', 0) +// CHECK: ('n_value', 12) +// CHECK: ('_string', 'sym_lcomm_B') +// CHECK: ), +// CHECK: # Symbol 2 +// CHECK: (('n_strx', 1) +// CHECK: ('n_type', 0xf) +// CHECK: ('n_sect', 2) +// CHECK: ('n_desc', 0) +// CHECK: ('n_value', 0) +// CHECK: ('_string', 'sym_lcomm_C') +// CHECK: ), +// CHECK: # Symbol 3 +// CHECK: (('n_strx', 13) +// CHECK: ('n_type', 0xf) +// CHECK: ('n_sect', 2) +// CHECK: ('n_desc', 0) +// CHECK: ('n_value', 4) +// CHECK: ('_string', 'sym_lcomm_D') +// CHECK: ), +// CHECK: ]) +// CHECK: ), +// CHECK: # Load Command 2 +// CHECK: (('command', 11) +// CHECK: ('size', 80) +// CHECK: ('ilocalsym', 0) +// CHECK: ('nlocalsym', 2) +// CHECK: ('iextdefsym', 2) +// CHECK: ('nextdefsym', 2) +// CHECK: ('iundefsym', 4) +// CHECK: ('nundefsym', 0) +// CHECK: ('tocoff', 0) +// CHECK: ('ntoc', 0) +// CHECK: ('modtaboff', 0) +// CHECK: ('nmodtab', 0) +// CHECK: ('extrefsymoff', 0) +// CHECK: ('nextrefsyms', 0) +// CHECK: ('indirectsymoff', 0) +// CHECK: ('nindirectsyms', 0) +// CHECK: ('extreloff', 0) +// CHECK: ('nextrel', 0) +// CHECK: ('locreloff', 0) +// CHECK: ('nlocrel', 0) +// CHECK: ('_indirect_symbols', [ +// CHECK: ]) +// CHECK: ), +// CHECK: ]) diff --git a/libclamav/c++/llvm/test/Makefile.tests b/libclamav/c++/llvm/test/Makefile.tests index ad9f2eabc..90e9f2c70 100644 --- a/libclamav/c++/llvm/test/Makefile.tests +++ b/libclamav/c++/llvm/test/Makefile.tests @@ -69,7 +69,7 @@ Output/%.bc: Output/%.ll $(LGCCAS) # LLVM source, use the non-transforming assembler. # Output/%.bc: %.ll $(LLVMAS) Output/.dir - -$(LLVMAS) -f $< -o $@ + -$(LLVMAS) $< -o $@ ## Cancel built-in implicit rules that override above rules %: %.s diff --git a/libclamav/c++/llvm/test/Scripts/macho-dump b/libclamav/c++/llvm/test/Scripts/macho-dump index 665399d06..12ec26d45 100755 --- a/libclamav/c++/llvm/test/Scripts/macho-dump +++ b/libclamav/c++/llvm/test/Scripts/macho-dump @@ -198,7 +198,7 @@ def dumpDysymtabCommand(f, opts): print " ('_indirect_symbols', [" for i in range(nindirectsyms): print " # Indirect Symbol %r" % i - print " (('symbol_index', %r),)," % f.read32() + print " (('symbol_index', %#x),)," % f.read32() print " ])" f.seek(prev_pos) @@ -208,20 +208,42 @@ def dumpSection32(f, i, opts): print " (('section_name', %r)" % f.read(16) print " ('segment_name', %r)" % f.read(16) print " ('address', %r)" % f.read32() - print " ('size', %r)" % f.read32() - print " ('offset', %r)" % f.read32() - print " ('alignment', %r)" % f.read32() - print " ('reloc_offset', %r)" % f.read32() - print " ('num_reloc', %r)" % f.read32() + size = f.read32() + print " ('size', %r)" % size + offset = f.read32() + print " ('offset', %r)" % offset + print " ('alignment', %r)" % f.read32() + reloc_offset = f.read32() + print " ('reloc_offset', %r)" % reloc_offset + num_reloc = f.read32() + print " ('num_reloc', %r)" % num_reloc print " ('flags', %#x)" % f.read32() print " ('reserved1', %r)" % f.read32() print " ('reserved2', %r)" % f.read32() print " )," + + prev_pos = f.tell() + + f.seek(reloc_offset) + print " ('_relocations', [" + for i in range(num_reloc): + print " # Relocation %r" % i + print " (('word-0', %#x)," % f.read32() + print " ('word-1', %#x))," % f.read32() + print " ])" + + if opts.dumpSectionData: + f.seek(offset) + print " ('_section_data', %r)" % f.read(size) + + f.seek(prev_pos) def main(): from optparse import OptionParser, OptionGroup parser = OptionParser("usage: %prog [options] {files}") - + parser.add_option("", "--dump-section-data", dest="dumpSectionData", + help="Dump the contents of sections", + action="store_true", default=False) (opts, args) = parser.parse_args() if not args: diff --git a/libclamav/c++/llvm/test/Transforms/IndVarSimplify/sink-alloca.ll b/libclamav/c++/llvm/test/Transforms/IndVarSimplify/sink-alloca.ll new file mode 100644 index 000000000..f5378ccea --- /dev/null +++ b/libclamav/c++/llvm/test/Transforms/IndVarSimplify/sink-alloca.ll @@ -0,0 +1,31 @@ +; RUN: llvm-as < %s | opt -indvars | llvm-dis | FileCheck %s +; PR4775 + +; Indvars shouldn't sink the alloca out of the entry block, even though +; it's not used until after the loop. + +target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" +target triple = "i386-apple-darwin10.0" + +@llvm.used = appending global [1 x i8*] [i8* bitcast (i32 ()* @main to i8*)], +section "llvm.metadata" ; <[1 x i8*]*> [#uses=0] + +define i32 @main() nounwind { +; CHECK: entry: +; CHECK-NEXT: %result.i = alloca i32, align 4 +entry: + %result.i = alloca i32, align 4 ; [#uses=2] + br label %while.cond + +while.cond: ; preds = %while.cond, %entry + %call = call i32 @bar() nounwind ; [#uses=1] + %tobool = icmp eq i32 %call, 0 ; [#uses=1] + br i1 %tobool, label %while.end, label %while.cond + +while.end: ; preds = %while.cond + volatile store i32 0, i32* %result.i + %tmp.i = volatile load i32* %result.i ; [#uses=0] + ret i32 0 +} + +declare i32 @bar() diff --git a/libclamav/c++/llvm/test/Transforms/Inline/2007-06-06-NoInline.ll b/libclamav/c++/llvm/test/Transforms/Inline/2007-06-06-NoInline.ll index 51bba0705..f71507493 100644 --- a/libclamav/c++/llvm/test/Transforms/Inline/2007-06-06-NoInline.ll +++ b/libclamav/c++/llvm/test/Transforms/Inline/2007-06-06-NoInline.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -inline -f - | llvm-dis | grep "define internal i32 @bar" +; RUN: llvm-as < %s | opt -inline - | llvm-dis | grep "define internal i32 @bar" @llvm.noinline = appending global [1 x i8*] [ i8* bitcast (i32 (i32, i32)* @bar to i8*) ], section "llvm.metadata" ; <[1 x i8*]*> [#uses=0] define internal i32 @bar(i32 %x, i32 %y) { diff --git a/libclamav/c++/llvm/test/Transforms/Inline/alloca-in-scc.ll b/libclamav/c++/llvm/test/Transforms/Inline/alloca-in-scc.ll new file mode 100644 index 000000000..2ee8742f0 --- /dev/null +++ b/libclamav/c++/llvm/test/Transforms/Inline/alloca-in-scc.ll @@ -0,0 +1,31 @@ +; RUN: llvm-as < %s | opt -inline | llvm-dis + +target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" +target triple = "i386-apple-darwin10.0" + +define i32 @main(i32 %argc, i8** %argv) nounwind ssp { +entry: + call fastcc void @c() nounwind + unreachable +} + +define internal fastcc void @a() nounwind ssp { +entry: + %al = alloca [3 x i32], align 4 + %0 = getelementptr inbounds [3 x i32]* %al, i32 0, i32 2 + + call fastcc void @c() nounwind + unreachable +} + +define internal fastcc void @b() nounwind ssp { +entry: + tail call fastcc void @a() nounwind ssp + unreachable +} + +define internal fastcc void @c() nounwind ssp { +entry: + call fastcc void @b() nounwind + unreachable +} diff --git a/libclamav/c++/llvm/test/Transforms/Inline/array_merge.ll b/libclamav/c++/llvm/test/Transforms/Inline/array_merge.ll new file mode 100644 index 000000000..f4f53ca1c --- /dev/null +++ b/libclamav/c++/llvm/test/Transforms/Inline/array_merge.ll @@ -0,0 +1,26 @@ +; RUN: llvm-as < %s | opt -inline | llvm-dis | FileCheck %s +; rdar://7173846 +target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" +target triple = "i386-apple-darwin10.0" + +define internal void @foo() nounwind ssp { +entry: + %A = alloca [100 x i32] + %B = alloca [100 x i32] + call void @bar([100 x i32]* %A, [100 x i32]* %B) nounwind + ret void +} + +declare void @bar([100 x i32]*, [100 x i32]*) + +define void @test() nounwind ssp { +entry: +; CHECK: @test() +; CHECK-NEXT: entry: +; CHECK-NEXT: %A.i = alloca +; CHECK-NEXT: %B.i = alloca +; CHECK-NEXT: call void + call void @foo() nounwind + call void @foo() nounwind + ret void +} diff --git a/libclamav/c++/llvm/test/Transforms/Inline/crash.ll b/libclamav/c++/llvm/test/Transforms/Inline/crash.ll new file mode 100644 index 000000000..ebf8147c5 --- /dev/null +++ b/libclamav/c++/llvm/test/Transforms/Inline/crash.ll @@ -0,0 +1,57 @@ +; RUN: llvm-as < %s | opt -inline -argpromotion -instcombine -disable-output + +; This test was failing because the inliner would inline @list_DeleteElement +; into @list_DeleteDuplicates and then into @inf_GetBackwardPartnerLits, +; turning the indirect call into a direct one. This allowed instcombine to see +; the bitcast and eliminate it, deleting the original call and introducing +; another one. This crashed the inliner because the new call was not in the +; callgraph. + +target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" +target triple = "i386-apple-darwin10.0" + + +define void @list_DeleteElement(i32 (i8*, i8*)* nocapture %Test) nounwind ssp { +entry: + %0 = call i32 %Test(i8* null, i8* undef) nounwind + ret void +} + + +define void @list_DeleteDuplicates(i32 (i8*, i8*)* nocapture %Test) nounwind ssp { +foo: + call void @list_DeleteElement(i32 (i8*, i8*)* %Test) nounwind ssp + call fastcc void @list_Rplacd1284() nounwind ssp + unreachable + +} + +define internal i32 @inf_LiteralsHaveSameSubtermAndAreFromSameClause(i32* nocapture %L1, i32* nocapture %L2) nounwind readonly ssp { +entry: + unreachable +} + + +define internal fastcc void @inf_GetBackwardPartnerLits(i32* nocapture %Flags) nounwind ssp { +test: + call void @list_DeleteDuplicates(i32 (i8*, i8*)* bitcast (i32 (i32*, i32*)* @inf_LiteralsHaveSameSubtermAndAreFromSameClause to i32 (i8*, i8*)*)) nounwind + ret void +} + + +define void @inf_BackwardEmptySortPlusPlus() nounwind ssp { +entry: + call fastcc void @inf_GetBackwardPartnerLits(i32* null) nounwind ssp + unreachable +} + +define void @inf_BackwardWeakening() nounwind ssp { +entry: + call fastcc void @inf_GetBackwardPartnerLits(i32* null) nounwind ssp + unreachable +} + + + + +declare fastcc void @list_Rplacd1284() nounwind ssp diff --git a/libclamav/c++/llvm/test/Transforms/Inline/indirect_resolve.ll b/libclamav/c++/llvm/test/Transforms/Inline/indirect_resolve.ll new file mode 100644 index 000000000..4be55d434 --- /dev/null +++ b/libclamav/c++/llvm/test/Transforms/Inline/indirect_resolve.ll @@ -0,0 +1,16 @@ +; RUN: llvm-as < %s | opt -inline | llvm-dis +; PR4834 + +define i32 @main() { + %funcall1_ = call fastcc i32 ()* ()* @f1() + %executecommandptr1_ = call i32 %funcall1_() + ret i32 %executecommandptr1_ +} + +define internal fastcc i32 ()* @f1() nounwind readnone { + ret i32 ()* @f2 +} + +define internal i32 @f2() nounwind readnone { + ret i32 1 +} diff --git a/libclamav/c++/llvm/test/Transforms/InstCombine/2002-05-14-TouchDeletedInst.ll b/libclamav/c++/llvm/test/Transforms/InstCombine/2002-05-14-TouchDeletedInst.ll deleted file mode 100644 index 4ebbe2470..000000000 --- a/libclamav/c++/llvm/test/Transforms/InstCombine/2002-05-14-TouchDeletedInst.ll +++ /dev/null @@ -1,508 +0,0 @@ -; This testcase, obviously distilled from a large program (bzip2 from -; Specint2000) caused instcombine to fail because it got the same instruction -; on it's worklist more than once (which is ok), but then deleted the -; instruction. Since the inst stayed on the worklist, as soon as it came back -; up to be processed, bad things happened, and opt asserted. -; -; RUN: llvm-as < %s | opt -instcombine -; -; END. - -@.LC0 = internal global [21 x i8] c"hbMakeCodeLengths(1)\00" ; <[21 x i8]*> [#uses=1] -@.LC1 = internal global [21 x i8] c"hbMakeCodeLengths(2)\00" ; <[21 x i8]*> [#uses=1] - -define void @hbMakeCodeLengths(i8* %len, i32* %freq, i32 %alphaSize, i32 %maxLen) { -bb0: - %len.upgrd.1 = alloca i8* ; [#uses=2] - store i8* %len, i8** %len.upgrd.1 - %freq.upgrd.2 = alloca i32* ; [#uses=2] - store i32* %freq, i32** %freq.upgrd.2 - %alphaSize.upgrd.3 = alloca i32 ; [#uses=2] - store i32 %alphaSize, i32* %alphaSize.upgrd.3 - %maxLen.upgrd.4 = alloca i32 ; [#uses=2] - store i32 %maxLen, i32* %maxLen.upgrd.4 - %heap = alloca i32, i32 260 ; [#uses=27] - %weight = alloca i32, i32 516 ; [#uses=18] - %parent = alloca i32, i32 516 ; [#uses=7] - br label %bb1 - -bb1: ; preds = %bb0 - %reg107 = load i8** %len.upgrd.1 ; [#uses=1] - %reg108 = load i32** %freq.upgrd.2 ; [#uses=1] - %reg109 = load i32* %alphaSize.upgrd.3 ; [#uses=10] - %reg110 = load i32* %maxLen.upgrd.4 ; [#uses=1] - %cond747 = icmp sge i32 0, %reg109 ; [#uses=1] - br i1 %cond747, label %bb6, label %bb2 - -bb2: ; preds = %bb5, %bb1 - %reg591 = phi i32 [ %reg594, %bb5 ], [ 0, %bb1 ] ; [#uses=3] - %reg591-idxcast1 = bitcast i32 %reg591 to i32 ; [#uses=1] - %reg591-idxcast1-offset = add i32 %reg591-idxcast1, 1 ; [#uses=1] - %reg591-idxcast1-offset.upgrd.5 = zext i32 %reg591-idxcast1-offset to i64 ; [#uses=1] - %reg126 = getelementptr i32* %weight, i64 %reg591-idxcast1-offset.upgrd.5 ; [#uses=1] - %reg591-idxcast = sext i32 %reg591 to i64 ; [#uses=1] - %reg132 = getelementptr i32* %reg108, i64 %reg591-idxcast ; [#uses=1] - %reg133 = load i32* %reg132 ; [#uses=2] - %cond748 = icmp eq i32 %reg133, 0 ; [#uses=1] - br i1 %cond748, label %bb4, label %bb3 - -bb3: ; preds = %bb2 - %reg127 = shl i32 %reg133, 8 ; [#uses=1] - br label %bb5 - -bb4: ; preds = %bb2 - br label %bb5 - -bb5: ; preds = %bb4, %bb3 - %reg593 = phi i32 [ 256, %bb4 ], [ %reg127, %bb3 ] ; [#uses=1] - store i32 %reg593, i32* %reg126 - %reg594 = add i32 %reg591, 1 ; [#uses=2] - %cond749 = icmp slt i32 %reg594, %reg109 ; [#uses=1] - br i1 %cond749, label %bb2, label %bb6 - -bb6: ; preds = %bb43, %bb41, %bb5, %bb1 - store i32 0, i32* %heap - store i32 0, i32* %weight - store i32 -2, i32* %parent - %cond750 = icmp sgt i32 1, %reg109 ; [#uses=1] - br i1 %cond750, label %bb11, label %bb7 - -bb7: ; preds = %bb10, %bb6 - %reg597 = phi i32 [ %reg598, %bb10 ], [ 0, %bb6 ] ; [#uses=5] - %reg597-casted = bitcast i32 %reg597 to i32 ; [#uses=1] - %reg596 = add i32 %reg597-casted, 1 ; [#uses=3] - %reg597-offset = add i32 %reg597, 1 ; [#uses=1] - %reg597-offset.upgrd.6 = zext i32 %reg597-offset to i64 ; [#uses=1] - %reg149 = getelementptr i32* %parent, i64 %reg597-offset.upgrd.6 ; [#uses=1] - store i32 -1, i32* %reg149 - %reg598 = add i32 %reg597, 1 ; [#uses=3] - %reg597-offset1 = add i32 %reg597, 1 ; [#uses=1] - %reg597-offset1.upgrd.7 = zext i32 %reg597-offset1 to i64 ; [#uses=1] - %reg157 = getelementptr i32* %heap, i64 %reg597-offset1.upgrd.7 ; [#uses=1] - store i32 %reg596, i32* %reg157 - br label %bb9 - -bb8: ; preds = %bb9 - %reg599 = zext i32 %reg599.upgrd.8 to i64 ; [#uses=1] - %reg198 = getelementptr i32* %heap, i64 %reg599 ; [#uses=1] - store i32 %reg182, i32* %reg198 - %cast938 = bitcast i32 %reg174 to i32 ; [#uses=1] - br label %bb9 - -bb9: ; preds = %bb8, %bb7 - %reg599.upgrd.8 = phi i32 [ %cast938, %bb8 ], [ %reg598, %bb7 ] ; [#uses=3] - %cast807 = bitcast i32 %reg599.upgrd.8 to i32 ; [#uses=1] - %reg597-offset2 = add i32 %reg597, 1 ; [#uses=1] - %reg597-offset2.upgrd.9 = zext i32 %reg597-offset2 to i64 ; [#uses=1] - %reg173 = getelementptr i32* %weight, i64 %reg597-offset2.upgrd.9 ; [#uses=1] - %reg174 = ashr i32 %cast807, 1 ; [#uses=2] - %reg174-idxcast = bitcast i32 %reg174 to i32 ; [#uses=1] - zext i32 %reg174-idxcast to i64 ; :0 [#uses=1] - %reg181 = getelementptr i32* %heap, i64 %0 ; [#uses=1] - %reg182 = load i32* %reg181 ; [#uses=2] - %reg182-idxcast = bitcast i32 %reg182 to i32 ; [#uses=1] - zext i32 %reg182-idxcast to i64 ; :1 [#uses=1] - %reg189 = getelementptr i32* %weight, i64 %1 ; [#uses=1] - %reg190 = load i32* %reg173 ; [#uses=1] - %reg191 = load i32* %reg189 ; [#uses=1] - %cond751 = icmp slt i32 %reg190, %reg191 ; [#uses=1] - br i1 %cond751, label %bb8, label %bb10 - -bb10: ; preds = %bb9 - zext i32 %reg599.upgrd.8 to i64 ; :2 [#uses=1] - %reg214 = getelementptr i32* %heap, i64 %2 ; [#uses=1] - store i32 %reg596, i32* %reg214 - %reg601 = add i32 %reg596, 1 ; [#uses=1] - %cond752 = icmp sle i32 %reg601, %reg109 ; [#uses=1] - br i1 %cond752, label %bb7, label %bb11 - -bb11: ; preds = %bb10, %bb6 - %reg602 = phi i32 [ %reg598, %bb10 ], [ 0, %bb6 ] ; [#uses=3] - %cast819 = bitcast i32 %reg602 to i32 ; [#uses=1] - %cast818 = bitcast i32 %reg602 to i32 ; [#uses=1] - %cond753 = icmp sle i32 %cast818, 259 ; [#uses=1] - br i1 %cond753, label %bb13, label %bb12 - -bb12: ; preds = %bb11 - zext i32 0 to i64 ; :3 [#uses=1] - zext i32 0 to i64 ; :4 [#uses=1] - %cast784 = getelementptr [21 x i8]* @.LC0, i64 %3, i64 %4 ; [#uses=1] - call void @panic( i8* %cast784 ) - br label %bb13 - -bb13: ; preds = %bb12, %bb11 - %cond754 = icmp sle i32 %cast819, 1 ; [#uses=1] - %cast918 = bitcast i32 %reg109 to i32 ; [#uses=1] - %cast940 = bitcast i32 %reg602 to i32 ; [#uses=1] - %cast942 = bitcast i32 %reg109 to i32 ; [#uses=1] - br i1 %cond754, label %bb32, label %bb14 - -bb14: ; preds = %bb31, %bb13 - %cann-indvar1 = phi i32 [ 0, %bb13 ], [ %add1-indvar1, %bb31 ] ; [#uses=3] - %cann-indvar1-casted = bitcast i32 %cann-indvar1 to i32 ; [#uses=1] - %reg603-scale = mul i32 %cann-indvar1-casted, -1 ; [#uses=1] - %reg603 = add i32 %reg603-scale, %cast940 ; [#uses=4] - %reg604 = add i32 %cann-indvar1, %cast942 ; [#uses=4] - %add1-indvar1 = add i32 %cann-indvar1, 1 ; [#uses=1] - zext i32 1 to i64 ; :5 [#uses=1] - %reg7551 = getelementptr i32* %heap, i64 %5 ; [#uses=1] - %reg113 = load i32* %reg7551 ; [#uses=2] - %reg603-idxcast = bitcast i32 %reg603 to i32 ; [#uses=1] - zext i32 %reg603-idxcast to i64 ; :6 [#uses=1] - %reg222 = getelementptr i32* %heap, i64 %6 ; [#uses=1] - %reg223 = load i32* %reg222 ; [#uses=1] - zext i32 1 to i64 ; :7 [#uses=1] - %reg7561 = getelementptr i32* %heap, i64 %7 ; [#uses=1] - store i32 %reg223, i32* %reg7561 - %reg605 = add i32 %reg603, -1 ; [#uses=4] - zext i32 1 to i64 ; :8 [#uses=1] - %reg757 = getelementptr i32* %heap, i64 %8 ; [#uses=1] - %reg226 = load i32* %reg757 ; [#uses=2] - %cond758 = icmp sgt i32 2, %reg605 ; [#uses=1] - br i1 %cond758, label %bb20, label %bb15 - -bb15: ; preds = %bb19, %bb14 - %reg606 = phi i32 [ %reg611, %bb19 ], [ 2, %bb14 ] ; [#uses=6] - %reg607 = phi i32 [ %reg609, %bb19 ], [ 1, %bb14 ] ; [#uses=2] - %cond759 = icmp sge i32 %reg606, %reg605 ; [#uses=1] - br i1 %cond759, label %bb18, label %bb16 - -bb16: ; preds = %bb15 - %reg606-idxcast = bitcast i32 %reg606 to i32 ; [#uses=1] - %reg606-idxcast-offset = add i32 %reg606-idxcast, 1 ; [#uses=1] - zext i32 %reg606-idxcast-offset to i64 ; :9 [#uses=1] - %reg241 = getelementptr i32* %heap, i64 %9 ; [#uses=1] - %reg242 = load i32* %reg241 ; [#uses=1] - %reg242-idxcast = bitcast i32 %reg242 to i32 ; [#uses=1] - zext i32 %reg242-idxcast to i64 ; :10 [#uses=1] - %reg249 = getelementptr i32* %weight, i64 %10 ; [#uses=1] - %reg606-idxcast1 = bitcast i32 %reg606 to i32 ; [#uses=1] - zext i32 %reg606-idxcast1 to i64 ; :11 [#uses=1] - %reg256 = getelementptr i32* %heap, i64 %11 ; [#uses=1] - %reg257 = load i32* %reg256 ; [#uses=1] - %reg257-idxcast = bitcast i32 %reg257 to i32 ; [#uses=1] - zext i32 %reg257-idxcast to i64 ; :12 [#uses=1] - %reg264 = getelementptr i32* %weight, i64 %12 ; [#uses=1] - %reg265 = load i32* %reg249 ; [#uses=1] - %reg266 = load i32* %reg264 ; [#uses=1] - %cond760 = icmp sge i32 %reg265, %reg266 ; [#uses=1] - br i1 %cond760, label %bb18, label %bb17 - -bb17: ; preds = %bb16 - %reg608 = add i32 %reg606, 1 ; [#uses=1] - br label %bb18 - -bb18: ; preds = %bb17, %bb16, %bb15 - %reg609 = phi i32 [ %reg608, %bb17 ], [ %reg606, %bb16 ], [ %reg606, %bb15 ] ; [#uses=4] - %reg226-idxcast = bitcast i32 %reg226 to i32 ; [#uses=1] - zext i32 %reg226-idxcast to i64 ; :13 [#uses=1] - %reg273 = getelementptr i32* %weight, i64 %13 ; [#uses=1] - %reg609-idxcast = bitcast i32 %reg609 to i32 ; [#uses=1] - zext i32 %reg609-idxcast to i64 ; :14 [#uses=1] - %reg280 = getelementptr i32* %heap, i64 %14 ; [#uses=1] - %reg281 = load i32* %reg280 ; [#uses=2] - %reg281-idxcast = bitcast i32 %reg281 to i32 ; [#uses=1] - zext i32 %reg281-idxcast to i64 ; :15 [#uses=1] - %reg288 = getelementptr i32* %weight, i64 %15 ; [#uses=1] - %reg289 = load i32* %reg273 ; [#uses=1] - %reg290 = load i32* %reg288 ; [#uses=1] - %cond761 = icmp slt i32 %reg289, %reg290 ; [#uses=1] - br i1 %cond761, label %bb20, label %bb19 - -bb19: ; preds = %bb18 - %reg607-idxcast = bitcast i32 %reg607 to i32 ; [#uses=1] - zext i32 %reg607-idxcast to i64 ; :16 [#uses=1] - %reg297 = getelementptr i32* %heap, i64 %16 ; [#uses=1] - store i32 %reg281, i32* %reg297 - %reg611 = shl i32 %reg609, 1 ; [#uses=2] - %cond762 = icmp sle i32 %reg611, %reg605 ; [#uses=1] - br i1 %cond762, label %bb15, label %bb20 - -bb20: ; preds = %bb19, %bb18, %bb14 - %reg612 = phi i32 [ %reg609, %bb19 ], [ %reg607, %bb18 ], [ 1, %bb14 ] ; [#uses=1] - %reg612-idxcast = bitcast i32 %reg612 to i32 ; [#uses=1] - zext i32 %reg612-idxcast to i64 ; :17 [#uses=1] - %reg312 = getelementptr i32* %heap, i64 %17 ; [#uses=1] - store i32 %reg226, i32* %reg312 - zext i32 1 to i64 ; :18 [#uses=1] - %reg7631 = getelementptr i32* %heap, i64 %18 ; [#uses=1] - %reg114 = load i32* %reg7631 ; [#uses=2] - %reg603-idxcast1 = bitcast i32 %reg603 to i32 ; [#uses=1] - %reg603-idxcast1-offset = add i32 %reg603-idxcast1, 1073741823 ; [#uses=1] - zext i32 %reg603-idxcast1-offset to i64 ; :19 [#uses=1] - %reg319 = getelementptr i32* %heap, i64 %19 ; [#uses=1] - %reg320 = load i32* %reg319 ; [#uses=1] - zext i32 1 to i64 ; :20 [#uses=1] - %reg7641 = getelementptr i32* %heap, i64 %20 ; [#uses=1] - store i32 %reg320, i32* %reg7641 - %reg613 = add i32 %reg605, -1 ; [#uses=4] - zext i32 1 to i64 ; :21 [#uses=1] - %reg765 = getelementptr i32* %heap, i64 %21 ; [#uses=1] - %reg323 = load i32* %reg765 ; [#uses=2] - %cond766 = icmp sgt i32 2, %reg613 ; [#uses=1] - br i1 %cond766, label %bb26, label %bb21 - -bb21: ; preds = %bb25, %bb20 - %reg614 = phi i32 [ %reg619, %bb25 ], [ 2, %bb20 ] ; [#uses=6] - %reg615 = phi i32 [ %reg617, %bb25 ], [ 1, %bb20 ] ; [#uses=2] - %cond767 = icmp sge i32 %reg614, %reg613 ; [#uses=1] - br i1 %cond767, label %bb24, label %bb22 - -bb22: ; preds = %bb21 - %reg614-idxcast = bitcast i32 %reg614 to i32 ; [#uses=1] - %reg614-idxcast-offset = add i32 %reg614-idxcast, 1 ; [#uses=1] - zext i32 %reg614-idxcast-offset to i64 ; :22 [#uses=1] - %reg338 = getelementptr i32* %heap, i64 %22 ; [#uses=1] - %reg339 = load i32* %reg338 ; [#uses=1] - %reg339-idxcast = bitcast i32 %reg339 to i32 ; [#uses=1] - zext i32 %reg339-idxcast to i64 ; :23 [#uses=1] - %reg346 = getelementptr i32* %weight, i64 %23 ; [#uses=1] - %reg614-idxcast1 = bitcast i32 %reg614 to i32 ; [#uses=1] - zext i32 %reg614-idxcast1 to i64 ; :24 [#uses=1] - %reg353 = getelementptr i32* %heap, i64 %24 ; [#uses=1] - %reg354 = load i32* %reg353 ; [#uses=1] - %reg354-idxcast = bitcast i32 %reg354 to i32 ; [#uses=1] - zext i32 %reg354-idxcast to i64 ; :25 [#uses=1] - %reg361 = getelementptr i32* %weight, i64 %25 ; [#uses=1] - %reg362 = load i32* %reg346 ; [#uses=1] - %reg363 = load i32* %reg361 ; [#uses=1] - %cond768 = icmp sge i32 %reg362, %reg363 ; [#uses=1] - br i1 %cond768, label %bb24, label %bb23 - -bb23: ; preds = %bb22 - %reg616 = add i32 %reg614, 1 ; [#uses=1] - br label %bb24 - -bb24: ; preds = %bb23, %bb22, %bb21 - %reg617 = phi i32 [ %reg616, %bb23 ], [ %reg614, %bb22 ], [ %reg614, %bb21 ] ; [#uses=4] - %reg323-idxcast = bitcast i32 %reg323 to i32 ; [#uses=1] - zext i32 %reg323-idxcast to i64 ; :26 [#uses=1] - %reg370 = getelementptr i32* %weight, i64 %26 ; [#uses=1] - %reg617-idxcast = bitcast i32 %reg617 to i32 ; [#uses=1] - zext i32 %reg617-idxcast to i64 ; :27 [#uses=1] - %reg377 = getelementptr i32* %heap, i64 %27 ; [#uses=1] - %reg378 = load i32* %reg377 ; [#uses=2] - %reg378-idxcast = bitcast i32 %reg378 to i32 ; [#uses=1] - zext i32 %reg378-idxcast to i64 ; :28 [#uses=1] - %reg385 = getelementptr i32* %weight, i64 %28 ; [#uses=1] - %reg386 = load i32* %reg370 ; [#uses=1] - %reg387 = load i32* %reg385 ; [#uses=1] - %cond769 = icmp slt i32 %reg386, %reg387 ; [#uses=1] - br i1 %cond769, label %bb26, label %bb25 - -bb25: ; preds = %bb24 - %reg615-idxcast = bitcast i32 %reg615 to i32 ; [#uses=1] - zext i32 %reg615-idxcast to i64 ; :29 [#uses=1] - %reg394 = getelementptr i32* %heap, i64 %29 ; [#uses=1] - store i32 %reg378, i32* %reg394 - %reg619 = shl i32 %reg617, 1 ; [#uses=2] - %cond770 = icmp sle i32 %reg619, %reg613 ; [#uses=1] - br i1 %cond770, label %bb21, label %bb26 - -bb26: ; preds = %bb25, %bb24, %bb20 - %reg620 = phi i32 [ %reg617, %bb25 ], [ %reg615, %bb24 ], [ 1, %bb20 ] ; [#uses=1] - %reg620-idxcast = bitcast i32 %reg620 to i32 ; [#uses=1] - zext i32 %reg620-idxcast to i64 ; :30 [#uses=1] - %reg409 = getelementptr i32* %heap, i64 %30 ; [#uses=1] - store i32 %reg323, i32* %reg409 - %reg621 = add i32 %reg604, 1 ; [#uses=5] - %reg113-idxcast = bitcast i32 %reg113 to i32 ; [#uses=1] - zext i32 %reg113-idxcast to i64 ; :31 [#uses=1] - %reg416 = getelementptr i32* %parent, i64 %31 ; [#uses=1] - %reg114-idxcast = bitcast i32 %reg114 to i32 ; [#uses=1] - zext i32 %reg114-idxcast to i64 ; :32 [#uses=1] - %reg423 = getelementptr i32* %parent, i64 %32 ; [#uses=1] - %cast889 = bitcast i32 %reg621 to i32 ; [#uses=1] - store i32 %cast889, i32* %reg423 - %cast890 = bitcast i32 %reg621 to i32 ; [#uses=1] - store i32 %cast890, i32* %reg416 - %reg604-offset = add i32 %reg604, 1 ; [#uses=1] - zext i32 %reg604-offset to i64 ; :33 [#uses=1] - %reg431 = getelementptr i32* %weight, i64 %33 ; [#uses=1] - %reg113-idxcast2 = bitcast i32 %reg113 to i32 ; [#uses=1] - zext i32 %reg113-idxcast2 to i64 ; :34 [#uses=1] - %reg4381 = getelementptr i32* %weight, i64 %34 ; [#uses=1] - %reg439 = load i32* %reg4381 ; [#uses=2] - %reg440 = and i32 %reg439, -256 ; [#uses=1] - %reg114-idxcast2 = bitcast i32 %reg114 to i32 ; [#uses=1] - zext i32 %reg114-idxcast2 to i64 ; :35 [#uses=1] - %reg4471 = getelementptr i32* %weight, i64 %35 ; [#uses=1] - %reg448 = load i32* %reg4471 ; [#uses=2] - %reg449 = and i32 %reg448, -256 ; [#uses=1] - %reg450 = add i32 %reg440, %reg449 ; [#uses=1] - %reg460 = and i32 %reg439, 255 ; [#uses=2] - %reg451 = and i32 %reg448, 255 ; [#uses=2] - %cond771 = icmp sge i32 %reg451, %reg460 ; [#uses=1] - br i1 %cond771, label %bb28, label %bb27 - -bb27: ; preds = %bb26 - br label %bb28 - -bb28: ; preds = %bb27, %bb26 - %reg623 = phi i32 [ %reg460, %bb27 ], [ %reg451, %bb26 ] ; [#uses=1] - %reg469 = add i32 %reg623, 1 ; [#uses=1] - %reg470 = or i32 %reg450, %reg469 ; [#uses=1] - store i32 %reg470, i32* %reg431 - %reg604-offset1 = add i32 %reg604, 1 ; [#uses=1] - zext i32 %reg604-offset1 to i64 ; :36 [#uses=1] - %reg4771 = getelementptr i32* %parent, i64 %36 ; [#uses=1] - store i32 -1, i32* %reg4771 - %reg624 = add i32 %reg613, 1 ; [#uses=2] - %reg603-idxcast2 = bitcast i32 %reg603 to i32 ; [#uses=1] - %reg603-idxcast2-offset = add i32 %reg603-idxcast2, 1073741823 ; [#uses=1] - zext i32 %reg603-idxcast2-offset to i64 ; :37 [#uses=1] - %reg485 = getelementptr i32* %heap, i64 %37 ; [#uses=1] - %cast902 = bitcast i32 %reg621 to i32 ; [#uses=1] - store i32 %cast902, i32* %reg485 - br label %bb30 - -bb29: ; preds = %bb30 - %reg625-idxcast = bitcast i32 %reg625 to i32 ; [#uses=1] - zext i32 %reg625-idxcast to i64 ; :38 [#uses=1] - %reg526 = getelementptr i32* %heap, i64 %38 ; [#uses=1] - store i32 %reg510, i32* %reg526 - br label %bb30 - -bb30: ; preds = %bb29, %bb28 - %reg625 = phi i32 [ %reg502, %bb29 ], [ %reg624, %bb28 ] ; [#uses=3] - %reg604-offset2 = add i32 %reg604, 1 ; [#uses=1] - zext i32 %reg604-offset2 to i64 ; :39 [#uses=1] - %reg501 = getelementptr i32* %weight, i64 %39 ; [#uses=1] - %reg502 = ashr i32 %reg625, 1 ; [#uses=2] - %reg502-idxcast = bitcast i32 %reg502 to i32 ; [#uses=1] - zext i32 %reg502-idxcast to i64 ; :40 [#uses=1] - %reg509 = getelementptr i32* %heap, i64 %40 ; [#uses=1] - %reg510 = load i32* %reg509 ; [#uses=2] - %reg510-idxcast = bitcast i32 %reg510 to i32 ; [#uses=1] - zext i32 %reg510-idxcast to i64 ; :41 [#uses=1] - %reg517 = getelementptr i32* %weight, i64 %41 ; [#uses=1] - %reg518 = load i32* %reg501 ; [#uses=1] - %reg519 = load i32* %reg517 ; [#uses=1] - %cond772 = icmp slt i32 %reg518, %reg519 ; [#uses=1] - br i1 %cond772, label %bb29, label %bb31 - -bb31: ; preds = %bb30 - %reg625-idxcast1 = bitcast i32 %reg625 to i32 ; [#uses=1] - zext i32 %reg625-idxcast1 to i64 ; :42 [#uses=1] - %reg542 = getelementptr i32* %heap, i64 %42 ; [#uses=1] - %cast916 = bitcast i32 %reg621 to i32 ; [#uses=1] - store i32 %cast916, i32* %reg542 - %cond773 = icmp sgt i32 %reg624, 1 ; [#uses=1] - br i1 %cond773, label %bb14, label %bb32 - -bb32: ; preds = %bb31, %bb13 - %reg627 = phi i32 [ %reg621, %bb31 ], [ %cast918, %bb13 ] ; [#uses=1] - %cast919 = bitcast i32 %reg627 to i32 ; [#uses=1] - %cond774 = icmp sle i32 %cast919, 515 ; [#uses=1] - br i1 %cond774, label %bb34, label %bb33 - -bb33: ; preds = %bb32 - zext i32 0 to i64 ; :43 [#uses=1] - zext i32 0 to i64 ; :44 [#uses=1] - %cast785 = getelementptr [21 x i8]* @.LC1, i64 %43, i64 %44 ; [#uses=1] - call void @panic( i8* %cast785 ) - br label %bb34 - -bb34: ; preds = %bb33, %bb32 - %cond775 = icmp sgt i32 1, %reg109 ; [#uses=1] - br i1 %cond775, label %bb40, label %bb35 - -bb35: ; preds = %bb39, %bb34 - %reg629 = phi i8 [ %reg639, %bb39 ], [ 0, %bb34 ] ; [#uses=1] - %cann-indvar = phi i32 [ 0, %bb34 ], [ %add1-indvar, %bb39 ] ; [#uses=4] - %cann-indvar-casted = bitcast i32 %cann-indvar to i32 ; [#uses=1] - %reg630 = add i32 %cann-indvar-casted, 1 ; [#uses=2] - %add1-indvar = add i32 %cann-indvar, 1 ; [#uses=1] - %cann-indvar-offset1 = add i32 %cann-indvar, 1 ; [#uses=1] - zext i32 %cann-indvar-offset1 to i64 ; :45 [#uses=1] - %reg589 = getelementptr i32* %parent, i64 %45 ; [#uses=1] - %reg590 = load i32* %reg589 ; [#uses=1] - %cond776 = icmp slt i32 %reg590, 0 ; [#uses=1] - %parent-idxcast = ptrtoint i32* %parent to i32 ; [#uses=1] - %cast948 = bitcast i32 %reg630 to i32 ; [#uses=1] - br i1 %cond776, label %bb37, label %bb36 - -bb36: ; preds = %bb36, %bb35 - %reg632 = phi i32 [ %reg634, %bb36 ], [ %cast948, %bb35 ] ; [#uses=1] - %reg633 = phi i32 [ %reg635, %bb36 ], [ 0, %bb35 ] ; [#uses=3] - %reg633-casted = inttoptr i32 %reg633 to i8* ; [#uses=0] - %reg631-scale = mul i32 %reg633, 0 ; [#uses=1] - %reg631-scale.upgrd.10 = inttoptr i32 %reg631-scale to i8* ; [#uses=1] - zext i32 %parent-idxcast to i64 ; :46 [#uses=1] - %reg6311 = getelementptr i8* %reg631-scale.upgrd.10, i64 %46 ; [#uses=2] - %reg632-scale = mul i32 %reg632, 4 ; [#uses=1] - zext i32 %reg632-scale to i64 ; :47 [#uses=1] - %reg5581 = getelementptr i8* %reg6311, i64 %47 ; [#uses=1] - %cast924 = bitcast i8* %reg5581 to i32* ; [#uses=1] - %reg634 = load i32* %cast924 ; [#uses=2] - %reg635 = add i32 %reg633, 1 ; [#uses=2] - %reg634-scale = mul i32 %reg634, 4 ; [#uses=1] - zext i32 %reg634-scale to i64 ; :48 [#uses=1] - %reg5501 = getelementptr i8* %reg6311, i64 %48 ; [#uses=1] - %cast925 = bitcast i8* %reg5501 to i32* ; [#uses=1] - %reg551 = load i32* %cast925 ; [#uses=1] - %cond777 = icmp sge i32 %reg551, 0 ; [#uses=1] - br i1 %cond777, label %bb36, label %bb37 - -bb37: ; preds = %bb36, %bb35 - %reg637 = phi i32 [ %reg635, %bb36 ], [ 0, %bb35 ] ; [#uses=2] - %cast928 = bitcast i32 %reg637 to i32 ; [#uses=1] - %cann-indvar-offset = add i32 %cann-indvar, 1 ; [#uses=1] - zext i32 %cann-indvar-offset to i64 ; :49 [#uses=1] - %reg561 = getelementptr i8* %reg107, i64 %49 ; [#uses=1] - zext i32 -1 to i64 ; :50 [#uses=1] - %reg778 = getelementptr i8* %reg561, i64 %50 ; [#uses=1] - %cast788 = trunc i32 %reg637 to i8 ; [#uses=1] - store i8 %cast788, i8* %reg778 - %cond779 = icmp sle i32 %cast928, %reg110 ; [#uses=1] - br i1 %cond779, label %bb39, label %bb38 - -bb38: ; preds = %bb37 - br label %bb39 - -bb39: ; preds = %bb38, %bb37 - %reg639 = phi i8 [ 1, %bb38 ], [ %reg629, %bb37 ] ; [#uses=2] - %reg640 = add i32 %reg630, 1 ; [#uses=1] - %cond780 = icmp sle i32 %reg640, %reg109 ; [#uses=1] - br i1 %cond780, label %bb35, label %bb40 - -bb40: ; preds = %bb39, %bb34 - %reg641 = phi i8 [ %reg639, %bb39 ], [ 0, %bb34 ] ; [#uses=1] - %cond781 = icmp eq i8 %reg641, 0 ; [#uses=1] - br i1 %cond781, label %bb44, label %bb41 - -bb41: ; preds = %bb40 - %cond782 = icmp sge i32 1, %reg109 ; [#uses=1] - br i1 %cond782, label %bb6, label %bb42 - -bb42: ; preds = %bb42, %bb41 - %cann-indvar2 = phi i32 [ 0, %bb41 ], [ %add1-indvar2, %bb42 ] ; [#uses=3] - %reg643 = add i32 %cann-indvar2, 1 ; [#uses=1] - %add1-indvar2 = add i32 %cann-indvar2, 1 ; [#uses=1] - %cann-indvar2-idxcast = bitcast i32 %cann-indvar2 to i32 ; [#uses=1] - %cann-indvar2-idxcast-offset = add i32 %cann-indvar2-idxcast, 1 ; [#uses=1] - zext i32 %cann-indvar2-idxcast-offset to i64 ; :51 [#uses=1] - %reg569 = getelementptr i32* %weight, i64 %51 ; [#uses=2] - %reg570 = load i32* %reg569 ; [#uses=2] - %reg644 = ashr i32 %reg570, 8 ; [#uses=1] - %reg572 = ashr i32 %reg570, 31 ; [#uses=1] - %cast933 = bitcast i32 %reg572 to i32 ; [#uses=1] - %reg573 = lshr i32 %cast933, 31 ; [#uses=1] - %cast934 = bitcast i32 %reg573 to i32 ; [#uses=1] - %reg574 = add i32 %reg644, %cast934 ; [#uses=1] - %reg571 = ashr i32 %reg574, 1 ; [#uses=1] - %reg645 = add i32 %reg571, 1 ; [#uses=1] - %reg582 = shl i32 %reg645, 8 ; [#uses=1] - store i32 %reg582, i32* %reg569 - %reg646 = add i32 %reg643, 1 ; [#uses=1] - %cond783 = icmp slt i32 %reg646, %reg109 ; [#uses=1] - br i1 %cond783, label %bb42, label %bb43 - -bb43: ; preds = %bb42 - br label %bb6 - -bb44: ; preds = %bb40 - ret void -} - -declare void @panic(i8*) diff --git a/libclamav/c++/llvm/test/Transforms/InstCombine/2002-09-17-GetElementPtrCrash.ll b/libclamav/c++/llvm/test/Transforms/InstCombine/2002-09-17-GetElementPtrCrash.ll deleted file mode 100644 index 5b127d7b7..000000000 --- a/libclamav/c++/llvm/test/Transforms/InstCombine/2002-09-17-GetElementPtrCrash.ll +++ /dev/null @@ -1,12 +0,0 @@ -; RUN: llvm-as < %s | opt -instcombine - - %bob = type { i32 } - -define i32 @alias() { - %pbob1 = alloca %bob ; <%bob*> [#uses=1] - %pbob2 = getelementptr %bob* %pbob1 ; <%bob*> [#uses=1] - %pbobel = getelementptr %bob* %pbob2, i64 0, i32 0 ; [#uses=1] - %rval = load i32* %pbobel ; [#uses=1] - ret i32 %rval -} - diff --git a/libclamav/c++/llvm/test/Transforms/InstCombine/2003-06-22-ConstantExprCrash.ll b/libclamav/c++/llvm/test/Transforms/InstCombine/2003-06-22-ConstantExprCrash.ll deleted file mode 100644 index d6cacece0..000000000 --- a/libclamav/c++/llvm/test/Transforms/InstCombine/2003-06-22-ConstantExprCrash.ll +++ /dev/null @@ -1,13 +0,0 @@ -; This is a bug in the VMcode library, not instcombine, it's just convenient -; to expose it here. - -; RUN: llvm-as < %s | opt -instcombine -disable-output - -@A = global i32 1 ; [#uses=1] -@B = global i32 2 ; [#uses=1] - -define i1 @test() { - %C = icmp ult i32* getelementptr (i32* @A, i64 1), getelementptr (i32* @B, i64 2) ; [#uses=1] - ret i1 %C -} - diff --git a/libclamav/c++/llvm/test/Transforms/InstCombine/2003-10-23-InstcombineNullFail.ll b/libclamav/c++/llvm/test/Transforms/InstCombine/2003-10-23-InstcombineNullFail.ll deleted file mode 100644 index 7daf7cb63..000000000 --- a/libclamav/c++/llvm/test/Transforms/InstCombine/2003-10-23-InstcombineNullFail.ll +++ /dev/null @@ -1,12 +0,0 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep false -; -; This actually looks like a constant propagation bug - -%X = type { [10 x i32], float } - -define i1 @test() { - %A = getelementptr %X* null, i64 0, i32 0, i64 0 ; [#uses=1] - %B = icmp ne i32* %A, null ; [#uses=1] - ret i1 %B -} - diff --git a/libclamav/c++/llvm/test/Transforms/InstCombine/2004-12-08-InstCombineCrash.ll b/libclamav/c++/llvm/test/Transforms/InstCombine/2004-12-08-InstCombineCrash.ll deleted file mode 100644 index 590820520..000000000 --- a/libclamav/c++/llvm/test/Transforms/InstCombine/2004-12-08-InstCombineCrash.ll +++ /dev/null @@ -1,14 +0,0 @@ -; RUN: llvm-as %s -o - | opt -instcombine - - -%"java/lang/Object" = type { %struct.llvm_java_object_base } -%"java/lang/StringBuffer" = type { %"java/lang/Object", i32, { %"java/lang/Object", i32, [0 x i16] }*, i1 } -%struct.llvm_java_object_base = type opaque - -define void @"java/lang/StringBuffer/append(Ljava/lang/String;)Ljava/lang/StringBuffer;"() { -bc0: - %tmp53 = getelementptr %"java/lang/StringBuffer"* null, i32 0, i32 1 ; [#uses=1] - store i32 0, i32* %tmp53 - ret void -} - diff --git a/libclamav/c++/llvm/test/Transforms/InstCombine/2006-02-07-SextZextCrash.ll b/libclamav/c++/llvm/test/Transforms/InstCombine/2006-02-07-SextZextCrash.ll deleted file mode 100644 index d7df5a01f..000000000 --- a/libclamav/c++/llvm/test/Transforms/InstCombine/2006-02-07-SextZextCrash.ll +++ /dev/null @@ -1,21 +0,0 @@ -; RUN: llvm-as < %s | opt -instcombine -disable-output - - %struct.rtx_const = type { i32, { %union.real_extract } } - %struct.rtx_def = type { i32, [1 x %union.rtunion_def] } - %union.real_extract = type { double } - %union.rtunion_def = type { i32 } - -define fastcc void @decode_rtx_const(%struct.rtx_def* %x, %struct.rtx_const* %value) { - %tmp.54 = getelementptr %struct.rtx_const* %value, i32 0, i32 0 ; [#uses=1] - %tmp.56 = getelementptr %struct.rtx_def* %x, i32 0, i32 0 ; [#uses=1] - %tmp.57 = load i32* %tmp.56 ; [#uses=1] - %tmp.58 = shl i32 %tmp.57, 8 ; [#uses=1] - %tmp.59 = ashr i32 %tmp.58, 24 ; [#uses=1] - %tmp.60 = trunc i32 %tmp.59 to i16 ; [#uses=1] - %tmp.61 = zext i16 %tmp.60 to i32 ; [#uses=1] - %tmp.62 = shl i32 %tmp.61, 16 ; [#uses=1] - %tmp.65 = or i32 0, %tmp.62 ; [#uses=1] - store i32 %tmp.65, i32* %tmp.54 - ret void -} - diff --git a/libclamav/c++/llvm/test/Transforms/InstCombine/2006-04-01-InfLoop.ll b/libclamav/c++/llvm/test/Transforms/InstCombine/2006-04-01-InfLoop.ll deleted file mode 100644 index 6ea3d1112..000000000 --- a/libclamav/c++/llvm/test/Transforms/InstCombine/2006-04-01-InfLoop.ll +++ /dev/null @@ -1,444 +0,0 @@ -; RUN: llvm-as < %s | opt -instcombine -disable-output -; END. - %struct.DecRefPicMarking_s = type { i32, i32, i32, i32, i32, %struct.DecRefPicMarking_s* } - %struct.datapartition = type { %typedef.Bitstream*, %typedef.DecodingEnvironment, i32 (%struct.syntaxelement*, %struct.img_par*, %struct.inp_par*, %struct.datapartition*)* } - %struct.img_par = type { i32, i32, i32, i32, i32*, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, [16 x [16 x i16]], [6 x [32 x i32]], [16 x [16 x i32]], [4 x [12 x [4 x [4 x i32]]]], [16 x i32], i32**, i32*, i32***, i32**, i32, i32, i32, i32, %typedef.Slice*, %struct.macroblock*, i32, i32, i32, i32, i32, i32, i32**, %struct.DecRefPicMarking_s*, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, [3 x i32], i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32***, i32***, i32****, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, %struct.timeb, %struct.timeb, i32, i32, i32, i32, i32, i32, i32, i32 } - %struct.inp_par = type { [100 x i8], [100 x i8], [100 x i8], i32, i32, i32, i32, i32, i32, i32 } - %struct.macroblock = type { i32, i32, i32, %struct.macroblock*, %struct.macroblock*, i32, [2 x [4 x [4 x [2 x i32]]]], i32, i64, i64, i32, i32, [4 x i32], [4 x i32], i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 } - %struct.pix_pos = type { i32, i32, i32, i32, i32, i32 } - %struct.storable_picture = type { i32, i32, i32, i32, i32, [50 x [6 x [33 x i64]]], [50 x [6 x [33 x i64]]], [50 x [6 x [33 x i64]]], [50 x [6 x [33 x i64]]], i32, i32, i32, i32, i32, i32, i32, i32, i16, i32, i32, i32, i32, i32, i32, i32, i32, i32, i16**, i16***, i8*, i16**, i8***, i64***, i64***, i16****, i8**, i8**, %struct.storable_picture*, %struct.storable_picture*, %struct.storable_picture*, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, [2 x i32], i32, %struct.DecRefPicMarking_s*, i32 } - %struct.syntaxelement = type { i32, i32, i32, i32, i32, i32, i32, i32, void (i32, i32, i32*, i32*)*, void (%struct.syntaxelement*, %struct.inp_par*, %struct.img_par*, %typedef.DecodingEnvironment*)* } - %struct.timeb = type { i32, i16, i16, i16 } - %typedef.BiContextType = type { i16, i8 } - %typedef.Bitstream = type { i32, i32, i32, i32, i8*, i32 } - %typedef.DecodingEnvironment = type { i32, i32, i32, i32, i32, i8*, i32* } - %typedef.MotionInfoContexts = type { [4 x [11 x %typedef.BiContextType]], [2 x [9 x %typedef.BiContextType]], [2 x [10 x %typedef.BiContextType]], [2 x [6 x %typedef.BiContextType]], [4 x %typedef.BiContextType], [4 x %typedef.BiContextType], [3 x %typedef.BiContextType] } - %typedef.Slice = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, %struct.datapartition*, %typedef.MotionInfoContexts*, %typedef.TextureInfoContexts*, i32, i32*, i32*, i32*, i32, i32*, i32*, i32*, i32 (%struct.img_par*, %struct.inp_par*)*, i32, i32, i32, i32 } - %typedef.TextureInfoContexts = type { [2 x %typedef.BiContextType], [4 x %typedef.BiContextType], [3 x [4 x %typedef.BiContextType]], [10 x [4 x %typedef.BiContextType]], [10 x [15 x %typedef.BiContextType]], [10 x [15 x %typedef.BiContextType]], [10 x [5 x %typedef.BiContextType]], [10 x [5 x %typedef.BiContextType]], [10 x [15 x %typedef.BiContextType]], [10 x [15 x %typedef.BiContextType]] } -@dec_picture = external global %struct.storable_picture* ; <%struct.storable_picture**> [#uses=1] -@last_dquant = external global i32 ; [#uses=1] - -define void @readCBP_CABAC(%struct.syntaxelement* %se, %struct.inp_par* %inp, %struct.img_par* %img.1, %typedef.DecodingEnvironment* %dep_dp) { -entry: - %block_a = alloca %struct.pix_pos ; <%struct.pix_pos*> [#uses=5] - %tmp.1 = getelementptr %struct.img_par* %img.1, i32 0, i32 37 ; <%typedef.Slice**> [#uses=1] - %tmp.2 = load %typedef.Slice** %tmp.1 ; <%typedef.Slice*> [#uses=1] - %tmp.3 = getelementptr %typedef.Slice* %tmp.2, i32 0, i32 11 ; <%typedef.TextureInfoContexts**> [#uses=1] - %tmp.4 = load %typedef.TextureInfoContexts** %tmp.3 ; <%typedef.TextureInfoContexts*> [#uses=3] - %tmp.6 = getelementptr %struct.img_par* %img.1, i32 0, i32 38 ; <%struct.macroblock**> [#uses=1] - %tmp.7 = load %struct.macroblock** %tmp.6 ; <%struct.macroblock*> [#uses=1] - %tmp.9 = getelementptr %struct.img_par* %img.1, i32 0, i32 1 ; [#uses=1] - %tmp.10 = load i32* %tmp.9 ; [#uses=1] - %tmp.11 = bitcast i32 %tmp.10 to i32 ; [#uses=1] - %tmp.12 = getelementptr %struct.macroblock* %tmp.7, i32 %tmp.11 ; <%struct.macroblock*> [#uses=18] - br label %loopentry.0 - -loopentry.0: ; preds = %loopexit.1, %entry - %mask.1 = phi i32 [ undef, %entry ], [ %mask.0, %loopexit.1 ] ; [#uses=1] - %cbp_bit.1 = phi i32 [ undef, %entry ], [ %cbp_bit.0, %loopexit.1 ] ; [#uses=1] - %cbp.2 = phi i32 [ 0, %entry ], [ %cbp.1, %loopexit.1 ] ; [#uses=5] - %curr_cbp_ctx.1 = phi i32 [ undef, %entry ], [ %curr_cbp_ctx.0, %loopexit.1 ] ; [#uses=1] - %b.2 = phi i32 [ undef, %entry ], [ %b.1, %loopexit.1 ] ; [#uses=1] - %a.2 = phi i32 [ undef, %entry ], [ %a.1, %loopexit.1 ] ; [#uses=1] - %mb_y.0 = phi i32 [ 0, %entry ], [ %tmp.152, %loopexit.1 ] ; [#uses=7] - %mb_x.0 = phi i32 [ undef, %entry ], [ %mb_x.1, %loopexit.1 ] ; [#uses=0] - %tmp.14 = icmp sle i32 %mb_y.0, 3 ; [#uses=2] - %tmp.15 = zext i1 %tmp.14 to i32 ; [#uses=0] - br i1 %tmp.14, label %no_exit.0, label %loopexit.0 - -no_exit.0: ; preds = %loopentry.0 - br label %loopentry.1 - -loopentry.1: ; preds = %endif.7, %no_exit.0 - %mask.0 = phi i32 [ %mask.1, %no_exit.0 ], [ %tmp.131, %endif.7 ] ; [#uses=1] - %cbp_bit.0 = phi i32 [ %cbp_bit.1, %no_exit.0 ], [ %tmp.142, %endif.7 ] ; [#uses=1] - %cbp.1 = phi i32 [ %cbp.2, %no_exit.0 ], [ %cbp.0, %endif.7 ] ; [#uses=5] - %curr_cbp_ctx.0 = phi i32 [ %curr_cbp_ctx.1, %no_exit.0 ], [ %tmp.125, %endif.7 ] ; [#uses=1] - %b.1 = phi i32 [ %b.2, %no_exit.0 ], [ %b.0, %endif.7 ] ; [#uses=1] - %a.1 = phi i32 [ %a.2, %no_exit.0 ], [ %a.0, %endif.7 ] ; [#uses=1] - %mb_x.1 = phi i32 [ 0, %no_exit.0 ], [ %tmp.150, %endif.7 ] ; [#uses=9] - %tmp.17 = icmp sle i32 %mb_x.1, 3 ; [#uses=2] - %tmp.18 = zext i1 %tmp.17 to i32 ; [#uses=0] - br i1 %tmp.17, label %no_exit.1, label %loopexit.1 - -no_exit.1: ; preds = %loopentry.1 - %tmp.20 = getelementptr %struct.macroblock* %tmp.12, i32 0, i32 12 ; <[4 x i32]*> [#uses=1] - %tmp.22 = sdiv i32 %mb_x.1, 2 ; [#uses=1] - %tmp.24 = add i32 %tmp.22, %mb_y.0 ; [#uses=1] - %tmp.25 = getelementptr [4 x i32]* %tmp.20, i32 0, i32 %tmp.24 ; [#uses=1] - %tmp.26 = load i32* %tmp.25 ; [#uses=1] - %tmp.27 = icmp eq i32 %tmp.26, 11 ; [#uses=2] - %tmp.28 = zext i1 %tmp.27 to i32 ; [#uses=0] - br i1 %tmp.27, label %then.0, label %else.0 - -then.0: ; preds = %no_exit.1 - br label %endif.0 - -else.0: ; preds = %no_exit.1 - br label %endif.0 - -endif.0: ; preds = %else.0, %then.0 - %tmp.30 = icmp eq i32 %mb_y.0, 0 ; [#uses=2] - %tmp.31 = zext i1 %tmp.30 to i32 ; [#uses=0] - br i1 %tmp.30, label %then.1, label %else.1 - -then.1: ; preds = %endif.0 - %tmp.33 = getelementptr %struct.macroblock* %tmp.12, i32 0, i32 3 ; <%struct.macroblock**> [#uses=1] - %tmp.34 = load %struct.macroblock** %tmp.33 ; <%struct.macroblock*> [#uses=1] - %tmp.35 = bitcast %struct.macroblock* %tmp.34 to i8* ; [#uses=1] - %tmp.36 = icmp eq i8* %tmp.35, null ; [#uses=2] - %tmp.37 = zext i1 %tmp.36 to i32 ; [#uses=0] - br i1 %tmp.36, label %then.2, label %else.2 - -then.2: ; preds = %then.1 - br label %endif.1 - -else.2: ; preds = %then.1 - %tmp.39 = getelementptr %struct.macroblock* %tmp.12, i32 0, i32 3 ; <%struct.macroblock**> [#uses=1] - %tmp.40 = load %struct.macroblock** %tmp.39 ; <%struct.macroblock*> [#uses=1] - %tmp.41 = getelementptr %struct.macroblock* %tmp.40, i32 0, i32 5 ; [#uses=1] - %tmp.42 = load i32* %tmp.41 ; [#uses=1] - %tmp.43 = icmp eq i32 %tmp.42, 14 ; [#uses=2] - %tmp.44 = zext i1 %tmp.43 to i32 ; [#uses=0] - br i1 %tmp.43, label %then.3, label %else.3 - -then.3: ; preds = %else.2 - br label %endif.1 - -else.3: ; preds = %else.2 - %tmp.46 = getelementptr %struct.macroblock* %tmp.12, i32 0, i32 3 ; <%struct.macroblock**> [#uses=1] - %tmp.47 = load %struct.macroblock** %tmp.46 ; <%struct.macroblock*> [#uses=1] - %tmp.48 = getelementptr %struct.macroblock* %tmp.47, i32 0, i32 7 ; [#uses=1] - %tmp.49 = load i32* %tmp.48 ; [#uses=1] - %tmp.51 = sdiv i32 %mb_x.1, 2 ; [#uses=1] - %tmp.52 = add i32 %tmp.51, 2 ; [#uses=1] - %tmp.53 = trunc i32 %tmp.52 to i8 ; [#uses=1] - %shift.upgrd.1 = zext i8 %tmp.53 to i32 ; [#uses=1] - %tmp.54 = ashr i32 %tmp.49, %shift.upgrd.1 ; [#uses=1] - %tmp.55 = bitcast i32 %tmp.54 to i32 ; [#uses=1] - %tmp.57 = xor i32 %tmp.55, 1 ; [#uses=1] - %tmp.58 = bitcast i32 %tmp.57 to i32 ; [#uses=1] - %tmp.59 = and i32 %tmp.58, 1 ; [#uses=1] - br label %endif.1 - -else.1: ; preds = %endif.0 - %tmp.62 = sdiv i32 %mb_x.1, 2 ; [#uses=1] - %tmp.63 = trunc i32 %tmp.62 to i8 ; [#uses=1] - %shift.upgrd.2 = zext i8 %tmp.63 to i32 ; [#uses=1] - %tmp.64 = ashr i32 %cbp.1, %shift.upgrd.2 ; [#uses=1] - %tmp.65 = bitcast i32 %tmp.64 to i32 ; [#uses=1] - %tmp.67 = xor i32 %tmp.65, 1 ; [#uses=1] - %tmp.68 = bitcast i32 %tmp.67 to i32 ; [#uses=1] - %tmp.69 = and i32 %tmp.68, 1 ; [#uses=1] - br label %endif.1 - -endif.1: ; preds = %else.1, %else.3, %then.3, %then.2 - %b.0 = phi i32 [ 0, %then.2 ], [ 0, %then.3 ], [ %tmp.59, %else.3 ], [ %tmp.69, %else.1 ] ; [#uses=2] - %tmp.71 = icmp eq i32 %mb_x.1, 0 ; [#uses=2] - %tmp.72 = zext i1 %tmp.71 to i32 ; [#uses=0] - br i1 %tmp.71, label %then.4, label %else.4 - -then.4: ; preds = %endif.1 - %tmp.74 = getelementptr %struct.img_par* %img.1, i32 0, i32 1 ; [#uses=1] - %tmp.75 = load i32* %tmp.74 ; [#uses=1] - %tmp.76 = bitcast i32 %tmp.75 to i32 ; [#uses=1] - call void @getLuma4x4Neighbour( i32 %tmp.76, i32 %mb_x.1, i32 %mb_y.0, i32 -1, i32 0, %struct.pix_pos* %block_a ) - %tmp.79 = getelementptr %struct.pix_pos* %block_a, i32 0, i32 0 ; [#uses=1] - %tmp.80 = load i32* %tmp.79 ; [#uses=1] - %tmp.81 = icmp ne i32 %tmp.80, 0 ; [#uses=2] - %tmp.82 = zext i1 %tmp.81 to i32 ; [#uses=0] - br i1 %tmp.81, label %then.5, label %else.5 - -then.5: ; preds = %then.4 - %tmp.84 = getelementptr %struct.img_par* %img.1, i32 0, i32 38 ; <%struct.macroblock**> [#uses=1] - %tmp.85 = load %struct.macroblock** %tmp.84 ; <%struct.macroblock*> [#uses=1] - %tmp.86 = getelementptr %struct.pix_pos* %block_a, i32 0, i32 1 ; [#uses=1] - %tmp.87 = load i32* %tmp.86 ; [#uses=1] - %tmp.88 = getelementptr %struct.macroblock* %tmp.85, i32 %tmp.87 ; <%struct.macroblock*> [#uses=1] - %tmp.89 = getelementptr %struct.macroblock* %tmp.88, i32 0, i32 5 ; [#uses=1] - %tmp.90 = load i32* %tmp.89 ; [#uses=1] - %tmp.91 = icmp eq i32 %tmp.90, 14 ; [#uses=2] - %tmp.92 = zext i1 %tmp.91 to i32 ; [#uses=0] - br i1 %tmp.91, label %then.6, label %else.6 - -then.6: ; preds = %then.5 - br label %endif.4 - -else.6: ; preds = %then.5 - %tmp.94 = getelementptr %struct.img_par* %img.1, i32 0, i32 38 ; <%struct.macroblock**> [#uses=1] - %tmp.95 = load %struct.macroblock** %tmp.94 ; <%struct.macroblock*> [#uses=1] - %tmp.96 = getelementptr %struct.pix_pos* %block_a, i32 0, i32 1 ; [#uses=1] - %tmp.97 = load i32* %tmp.96 ; [#uses=1] - %tmp.98 = getelementptr %struct.macroblock* %tmp.95, i32 %tmp.97 ; <%struct.macroblock*> [#uses=1] - %tmp.99 = getelementptr %struct.macroblock* %tmp.98, i32 0, i32 7 ; [#uses=1] - %tmp.100 = load i32* %tmp.99 ; [#uses=1] - %tmp.101 = getelementptr %struct.pix_pos* %block_a, i32 0, i32 3 ; [#uses=1] - %tmp.102 = load i32* %tmp.101 ; [#uses=1] - %tmp.103 = sdiv i32 %tmp.102, 2 ; [#uses=1] - %tmp.104 = mul i32 %tmp.103, 2 ; [#uses=1] - %tmp.105 = add i32 %tmp.104, 1 ; [#uses=1] - %tmp.106 = trunc i32 %tmp.105 to i8 ; [#uses=1] - %shift.upgrd.3 = zext i8 %tmp.106 to i32 ; [#uses=1] - %tmp.107 = ashr i32 %tmp.100, %shift.upgrd.3 ; [#uses=1] - %tmp.108 = bitcast i32 %tmp.107 to i32 ; [#uses=1] - %tmp.110 = xor i32 %tmp.108, 1 ; [#uses=1] - %tmp.111 = bitcast i32 %tmp.110 to i32 ; [#uses=1] - %tmp.112 = and i32 %tmp.111, 1 ; [#uses=1] - br label %endif.4 - -else.5: ; preds = %then.4 - br label %endif.4 - -else.4: ; preds = %endif.1 - %tmp.115 = trunc i32 %mb_y.0 to i8 ; [#uses=1] - %shift.upgrd.4 = zext i8 %tmp.115 to i32 ; [#uses=1] - %tmp.116 = ashr i32 %cbp.1, %shift.upgrd.4 ; [#uses=1] - %tmp.117 = bitcast i32 %tmp.116 to i32 ; [#uses=1] - %tmp.119 = xor i32 %tmp.117, 1 ; [#uses=1] - %tmp.120 = bitcast i32 %tmp.119 to i32 ; [#uses=1] - %tmp.121 = and i32 %tmp.120, 1 ; [#uses=1] - br label %endif.4 - -endif.4: ; preds = %else.4, %else.5, %else.6, %then.6 - %a.0 = phi i32 [ 0, %then.6 ], [ %tmp.112, %else.6 ], [ 0, %else.5 ], [ %tmp.121, %else.4 ] ; [#uses=2] - %tmp.123 = mul i32 %b.0, 2 ; [#uses=1] - %tmp.125 = add i32 %tmp.123, %a.0 ; [#uses=2] - %tmp.127 = sdiv i32 %mb_x.1, 2 ; [#uses=1] - %tmp.129 = add i32 %tmp.127, %mb_y.0 ; [#uses=1] - %tmp.130 = trunc i32 %tmp.129 to i8 ; [#uses=1] - %shift.upgrd.5 = zext i8 %tmp.130 to i32 ; [#uses=1] - %tmp.131 = shl i32 1, %shift.upgrd.5 ; [#uses=2] - %tmp.135 = getelementptr %typedef.TextureInfoContexts* %tmp.4, i32 0, i32 2 ; <[3 x [4 x %typedef.BiContextType]]*> [#uses=1] - %tmp.136 = getelementptr [3 x [4 x %typedef.BiContextType]]* %tmp.135, i32 0, i32 0 ; <[4 x %typedef.BiContextType]*> [#uses=1] - %tmp.137 = getelementptr [4 x %typedef.BiContextType]* %tmp.136, i32 0, i32 0 ; <%typedef.BiContextType*> [#uses=1] - %tmp.139 = bitcast i32 %tmp.125 to i32 ; [#uses=1] - %tmp.140 = bitcast i32 %tmp.139 to i32 ; [#uses=1] - %tmp.141 = getelementptr %typedef.BiContextType* %tmp.137, i32 %tmp.140 ; <%typedef.BiContextType*> [#uses=1] - %tmp.132 = call i32 @biari_decode_symbol( %typedef.DecodingEnvironment* %dep_dp, %typedef.BiContextType* %tmp.141 ) ; [#uses=1] - %tmp.142 = bitcast i32 %tmp.132 to i32 ; [#uses=2] - %tmp.144 = icmp ne i32 %tmp.142, 0 ; [#uses=2] - %tmp.145 = zext i1 %tmp.144 to i32 ; [#uses=0] - br i1 %tmp.144, label %then.7, label %endif.7 - -then.7: ; preds = %endif.4 - %tmp.148 = add i32 %cbp.1, %tmp.131 ; [#uses=1] - br label %endif.7 - -endif.7: ; preds = %then.7, %endif.4 - %cbp.0 = phi i32 [ %tmp.148, %then.7 ], [ %cbp.1, %endif.4 ] ; [#uses=1] - %tmp.150 = add i32 %mb_x.1, 2 ; [#uses=1] - br label %loopentry.1 - -loopexit.1: ; preds = %loopentry.1 - %tmp.152 = add i32 %mb_y.0, 2 ; [#uses=1] - br label %loopentry.0 - -loopexit.0: ; preds = %loopentry.0 - %tmp.153 = load %struct.storable_picture** @dec_picture ; <%struct.storable_picture*> [#uses=1] - %tmp.154 = getelementptr %struct.storable_picture* %tmp.153, i32 0, i32 45 ; [#uses=1] - %tmp.155 = load i32* %tmp.154 ; [#uses=1] - %tmp.156 = icmp ne i32 %tmp.155, 0 ; [#uses=2] - %tmp.157 = zext i1 %tmp.156 to i32 ; [#uses=0] - br i1 %tmp.156, label %then.8, label %endif.8 - -then.8: ; preds = %loopexit.0 - %tmp.159 = getelementptr %struct.macroblock* %tmp.12, i32 0, i32 3 ; <%struct.macroblock**> [#uses=1] - %tmp.160 = load %struct.macroblock** %tmp.159 ; <%struct.macroblock*> [#uses=1] - %tmp.161 = bitcast %struct.macroblock* %tmp.160 to i8* ; [#uses=1] - %tmp.162 = icmp ne i8* %tmp.161, null ; [#uses=2] - %tmp.163 = zext i1 %tmp.162 to i32 ; [#uses=0] - br i1 %tmp.162, label %then.9, label %endif.9 - -then.9: ; preds = %then.8 - %tmp.165 = getelementptr %struct.macroblock* %tmp.12, i32 0, i32 3 ; <%struct.macroblock**> [#uses=1] - %tmp.166 = load %struct.macroblock** %tmp.165 ; <%struct.macroblock*> [#uses=1] - %tmp.167 = getelementptr %struct.macroblock* %tmp.166, i32 0, i32 5 ; [#uses=1] - %tmp.168 = load i32* %tmp.167 ; [#uses=1] - %tmp.169 = icmp eq i32 %tmp.168, 14 ; [#uses=2] - %tmp.170 = zext i1 %tmp.169 to i32 ; [#uses=0] - br i1 %tmp.169, label %then.10, label %else.7 - -then.10: ; preds = %then.9 - br label %endif.9 - -else.7: ; preds = %then.9 - %tmp.172 = getelementptr %struct.macroblock* %tmp.12, i32 0, i32 3 ; <%struct.macroblock**> [#uses=1] - %tmp.173 = load %struct.macroblock** %tmp.172 ; <%struct.macroblock*> [#uses=1] - %tmp.174 = getelementptr %struct.macroblock* %tmp.173, i32 0, i32 7 ; [#uses=1] - %tmp.175 = load i32* %tmp.174 ; [#uses=1] - %tmp.176 = icmp sgt i32 %tmp.175, 15 ; [#uses=1] - %tmp.177 = zext i1 %tmp.176 to i32 ; [#uses=1] - br label %endif.9 - -endif.9: ; preds = %else.7, %then.10, %then.8 - %b.4 = phi i32 [ 1, %then.10 ], [ %tmp.177, %else.7 ], [ 0, %then.8 ] ; [#uses=1] - %tmp.179 = getelementptr %struct.macroblock* %tmp.12, i32 0, i32 4 ; <%struct.macroblock**> [#uses=1] - %tmp.180 = load %struct.macroblock** %tmp.179 ; <%struct.macroblock*> [#uses=1] - %tmp.181 = bitcast %struct.macroblock* %tmp.180 to i8* ; [#uses=1] - %tmp.182 = icmp ne i8* %tmp.181, null ; [#uses=2] - %tmp.183 = zext i1 %tmp.182 to i32 ; [#uses=0] - br i1 %tmp.182, label %then.11, label %endif.11 - -then.11: ; preds = %endif.9 - %tmp.185 = getelementptr %struct.macroblock* %tmp.12, i32 0, i32 4 ; <%struct.macroblock**> [#uses=1] - %tmp.186 = load %struct.macroblock** %tmp.185 ; <%struct.macroblock*> [#uses=1] - %tmp.187 = getelementptr %struct.macroblock* %tmp.186, i32 0, i32 5 ; [#uses=1] - %tmp.188 = load i32* %tmp.187 ; [#uses=1] - %tmp.189 = icmp eq i32 %tmp.188, 14 ; [#uses=2] - %tmp.190 = zext i1 %tmp.189 to i32 ; [#uses=0] - br i1 %tmp.189, label %then.12, label %else.8 - -then.12: ; preds = %then.11 - br label %endif.11 - -else.8: ; preds = %then.11 - %tmp.192 = getelementptr %struct.macroblock* %tmp.12, i32 0, i32 4 ; <%struct.macroblock**> [#uses=1] - %tmp.193 = load %struct.macroblock** %tmp.192 ; <%struct.macroblock*> [#uses=1] - %tmp.194 = getelementptr %struct.macroblock* %tmp.193, i32 0, i32 7 ; [#uses=1] - %tmp.195 = load i32* %tmp.194 ; [#uses=1] - %tmp.196 = icmp sgt i32 %tmp.195, 15 ; [#uses=1] - %tmp.197 = zext i1 %tmp.196 to i32 ; [#uses=1] - br label %endif.11 - -endif.11: ; preds = %else.8, %then.12, %endif.9 - %a.4 = phi i32 [ 1, %then.12 ], [ %tmp.197, %else.8 ], [ 0, %endif.9 ] ; [#uses=1] - %tmp.199 = mul i32 %b.4, 2 ; [#uses=1] - %tmp.201 = add i32 %tmp.199, %a.4 ; [#uses=1] - %tmp.205 = getelementptr %typedef.TextureInfoContexts* %tmp.4, i32 0, i32 2 ; <[3 x [4 x %typedef.BiContextType]]*> [#uses=1] - %tmp.206 = getelementptr [3 x [4 x %typedef.BiContextType]]* %tmp.205, i32 0, i32 1 ; <[4 x %typedef.BiContextType]*> [#uses=1] - %tmp.207 = getelementptr [4 x %typedef.BiContextType]* %tmp.206, i32 0, i32 0 ; <%typedef.BiContextType*> [#uses=1] - %tmp.209 = bitcast i32 %tmp.201 to i32 ; [#uses=1] - %tmp.210 = bitcast i32 %tmp.209 to i32 ; [#uses=1] - %tmp.211 = getelementptr %typedef.BiContextType* %tmp.207, i32 %tmp.210 ; <%typedef.BiContextType*> [#uses=1] - %tmp.202 = call i32 @biari_decode_symbol( %typedef.DecodingEnvironment* %dep_dp, %typedef.BiContextType* %tmp.211 ) ; [#uses=1] - %tmp.212 = bitcast i32 %tmp.202 to i32 ; [#uses=1] - %tmp.214 = icmp ne i32 %tmp.212, 0 ; [#uses=2] - %tmp.215 = zext i1 %tmp.214 to i32 ; [#uses=0] - br i1 %tmp.214, label %then.13, label %endif.8 - -then.13: ; preds = %endif.11 - %tmp.217 = getelementptr %struct.macroblock* %tmp.12, i32 0, i32 3 ; <%struct.macroblock**> [#uses=1] - %tmp.218 = load %struct.macroblock** %tmp.217 ; <%struct.macroblock*> [#uses=1] - %tmp.219 = bitcast %struct.macroblock* %tmp.218 to i8* ; [#uses=1] - %tmp.220 = icmp ne i8* %tmp.219, null ; [#uses=2] - %tmp.221 = zext i1 %tmp.220 to i32 ; [#uses=0] - br i1 %tmp.220, label %then.14, label %endif.14 - -then.14: ; preds = %then.13 - %tmp.223 = getelementptr %struct.macroblock* %tmp.12, i32 0, i32 3 ; <%struct.macroblock**> [#uses=1] - %tmp.224 = load %struct.macroblock** %tmp.223 ; <%struct.macroblock*> [#uses=1] - %tmp.225 = getelementptr %struct.macroblock* %tmp.224, i32 0, i32 5 ; [#uses=1] - %tmp.226 = load i32* %tmp.225 ; [#uses=1] - %tmp.227 = icmp eq i32 %tmp.226, 14 ; [#uses=2] - %tmp.228 = zext i1 %tmp.227 to i32 ; [#uses=0] - br i1 %tmp.227, label %then.15, label %else.9 - -then.15: ; preds = %then.14 - br label %endif.14 - -else.9: ; preds = %then.14 - %tmp.230 = getelementptr %struct.macroblock* %tmp.12, i32 0, i32 3 ; <%struct.macroblock**> [#uses=1] - %tmp.231 = load %struct.macroblock** %tmp.230 ; <%struct.macroblock*> [#uses=1] - %tmp.232 = getelementptr %struct.macroblock* %tmp.231, i32 0, i32 7 ; [#uses=1] - %tmp.233 = load i32* %tmp.232 ; [#uses=1] - %tmp.234 = icmp sgt i32 %tmp.233, 15 ; [#uses=2] - %tmp.235 = zext i1 %tmp.234 to i32 ; [#uses=0] - br i1 %tmp.234, label %then.16, label %endif.14 - -then.16: ; preds = %else.9 - %tmp.237 = getelementptr %struct.macroblock* %tmp.12, i32 0, i32 3 ; <%struct.macroblock**> [#uses=1] - %tmp.238 = load %struct.macroblock** %tmp.237 ; <%struct.macroblock*> [#uses=1] - %tmp.239 = getelementptr %struct.macroblock* %tmp.238, i32 0, i32 7 ; [#uses=1] - %tmp.240 = load i32* %tmp.239 ; [#uses=1] - %tmp.242 = ashr i32 %tmp.240, 4 ; [#uses=1] - %tmp.243 = icmp eq i32 %tmp.242, 2 ; [#uses=1] - %tmp.244 = zext i1 %tmp.243 to i32 ; [#uses=1] - br label %endif.14 - -endif.14: ; preds = %then.16, %else.9, %then.15, %then.13 - %b.5 = phi i32 [ 1, %then.15 ], [ %tmp.244, %then.16 ], [ 0, %else.9 ], [ 0, %then.13 ] ; [#uses=1] - %tmp.246 = getelementptr %struct.macroblock* %tmp.12, i32 0, i32 4 ; <%struct.macroblock**> [#uses=1] - %tmp.247 = load %struct.macroblock** %tmp.246 ; <%struct.macroblock*> [#uses=1] - %tmp.248 = bitcast %struct.macroblock* %tmp.247 to i8* ; [#uses=1] - %tmp.249 = icmp ne i8* %tmp.248, null ; [#uses=2] - %tmp.250 = zext i1 %tmp.249 to i32 ; [#uses=0] - br i1 %tmp.249, label %then.17, label %endif.17 - -then.17: ; preds = %endif.14 - %tmp.252 = getelementptr %struct.macroblock* %tmp.12, i32 0, i32 4 ; <%struct.macroblock**> [#uses=1] - %tmp.253 = load %struct.macroblock** %tmp.252 ; <%struct.macroblock*> [#uses=1] - %tmp.254 = getelementptr %struct.macroblock* %tmp.253, i32 0, i32 5 ; [#uses=1] - %tmp.255 = load i32* %tmp.254 ; [#uses=1] - %tmp.256 = icmp eq i32 %tmp.255, 14 ; [#uses=2] - %tmp.257 = zext i1 %tmp.256 to i32 ; [#uses=0] - br i1 %tmp.256, label %then.18, label %else.10 - -then.18: ; preds = %then.17 - br label %endif.17 - -else.10: ; preds = %then.17 - %tmp.259 = getelementptr %struct.macroblock* %tmp.12, i32 0, i32 4 ; <%struct.macroblock**> [#uses=1] - %tmp.260 = load %struct.macroblock** %tmp.259 ; <%struct.macroblock*> [#uses=1] - %tmp.261 = getelementptr %struct.macroblock* %tmp.260, i32 0, i32 7 ; [#uses=1] - %tmp.262 = load i32* %tmp.261 ; [#uses=1] - %tmp.263 = icmp sgt i32 %tmp.262, 15 ; [#uses=2] - %tmp.264 = zext i1 %tmp.263 to i32 ; [#uses=0] - br i1 %tmp.263, label %then.19, label %endif.17 - -then.19: ; preds = %else.10 - %tmp.266 = getelementptr %struct.macroblock* %tmp.12, i32 0, i32 4 ; <%struct.macroblock**> [#uses=1] - %tmp.267 = load %struct.macroblock** %tmp.266 ; <%struct.macroblock*> [#uses=1] - %tmp.268 = getelementptr %struct.macroblock* %tmp.267, i32 0, i32 7 ; [#uses=1] - %tmp.269 = load i32* %tmp.268 ; [#uses=1] - %tmp.271 = ashr i32 %tmp.269, 4 ; [#uses=1] - %tmp.272 = icmp eq i32 %tmp.271, 2 ; [#uses=1] - %tmp.273 = zext i1 %tmp.272 to i32 ; [#uses=1] - br label %endif.17 - -endif.17: ; preds = %then.19, %else.10, %then.18, %endif.14 - %a.5 = phi i32 [ 1, %then.18 ], [ %tmp.273, %then.19 ], [ 0, %else.10 ], [ 0, %endif.14 ] ; [#uses=1] - %tmp.275 = mul i32 %b.5, 2 ; [#uses=1] - %tmp.277 = add i32 %tmp.275, %a.5 ; [#uses=1] - %tmp.281 = getelementptr %typedef.TextureInfoContexts* %tmp.4, i32 0, i32 2 ; <[3 x [4 x %typedef.BiContextType]]*> [#uses=1] - %tmp.282 = getelementptr [3 x [4 x %typedef.BiContextType]]* %tmp.281, i32 0, i32 2 ; <[4 x %typedef.BiContextType]*> [#uses=1] - %tmp.283 = getelementptr [4 x %typedef.BiContextType]* %tmp.282, i32 0, i32 0 ; <%typedef.BiContextType*> [#uses=1] - %tmp.285 = bitcast i32 %tmp.277 to i32 ; [#uses=1] - %tmp.286 = bitcast i32 %tmp.285 to i32 ; [#uses=1] - %tmp.287 = getelementptr %typedef.BiContextType* %tmp.283, i32 %tmp.286 ; <%typedef.BiContextType*> [#uses=1] - %tmp.278 = call i32 @biari_decode_symbol( %typedef.DecodingEnvironment* %dep_dp, %typedef.BiContextType* %tmp.287 ) ; [#uses=1] - %tmp.288 = bitcast i32 %tmp.278 to i32 ; [#uses=1] - %tmp.290 = icmp eq i32 %tmp.288, 1 ; [#uses=2] - %tmp.291 = zext i1 %tmp.290 to i32 ; [#uses=0] - br i1 %tmp.290, label %cond_true, label %cond_false - -cond_true: ; preds = %endif.17 - %tmp.293 = add i32 %cbp.2, 32 ; [#uses=1] - br label %cond_continue - -cond_false: ; preds = %endif.17 - %tmp.295 = add i32 %cbp.2, 16 ; [#uses=1] - br label %cond_continue - -cond_continue: ; preds = %cond_false, %cond_true - %mem_tmp.0 = phi i32 [ %tmp.293, %cond_true ], [ %tmp.295, %cond_false ] ; [#uses=1] - br label %endif.8 - -endif.8: ; preds = %cond_continue, %endif.11, %loopexit.0 - %cbp.3 = phi i32 [ %mem_tmp.0, %cond_continue ], [ %cbp.2, %endif.11 ], [ %cbp.2, %loopexit.0 ] ; [#uses=2] - %tmp.298 = getelementptr %struct.syntaxelement* %se, i32 0, i32 1 ; [#uses=1] - store i32 %cbp.3, i32* %tmp.298 - %tmp.301 = icmp eq i32 %cbp.3, 0 ; [#uses=2] - %tmp.302 = zext i1 %tmp.301 to i32 ; [#uses=0] - br i1 %tmp.301, label %then.20, label %return - -then.20: ; preds = %endif.8 - store i32 0, i32* @last_dquant - ret void - -return: ; preds = %endif.8 - ret void -} - -declare i32 @biari_decode_symbol(%typedef.DecodingEnvironment*, %typedef.BiContextType*) - -declare void @getLuma4x4Neighbour(i32, i32, i32, i32, i32, %struct.pix_pos*) diff --git a/libclamav/c++/llvm/test/Transforms/InstCombine/2006-05-06-Infloop.ll b/libclamav/c++/llvm/test/Transforms/InstCombine/2006-05-06-Infloop.ll deleted file mode 100644 index ec67d7178..000000000 --- a/libclamav/c++/llvm/test/Transforms/InstCombine/2006-05-06-Infloop.ll +++ /dev/null @@ -1,519 +0,0 @@ -; RUN: llvm-as < %s | opt -instcombine -disable-output -; END. - %struct.gs_matrix = type { float, i32, float, i32, float, i32, float, i32, float, i32, float, i32 } - %struct.gx_bitmap = type { i8*, i32, i32, i32 } - %struct.gx_device = type { i32, %struct.gx_device_procs*, i8*, i32, i32, float, float, i32, i16, i32, i32 } - %struct.gx_device_memory = type { i32, %struct.gx_device_procs*, i8*, i32, i32, float, float, i32, i16, i32, i32, %struct.gs_matrix, i32, i8*, i8**, i32 (%struct.gx_device_memory*, i32, i32, i32, i32, i32)*, i32, i32, i8* } - %struct.gx_device_procs = type { i32 (%struct.gx_device*)*, void (%struct.gx_device*, %struct.gs_matrix*)*, i32 (%struct.gx_device*)*, i32 (%struct.gx_device*)*, i32 (%struct.gx_device*)*, i32 (%struct.gx_device*, i16, i16, i16)*, i32 (%struct.gx_device*, i32, i16*)*, i32 (%struct.gx_device*, i32, i32, i32, i32, i32)*, i32 (%struct.gx_device*, %struct.gx_bitmap*, i32, i32, i32, i32, i32, i32)*, i32 (%struct.gx_device*, i8*, i32, i32, i32, i32, i32, i32, i32, i32)*, i32 (%struct.gx_device*, i8*, i32, i32, i32, i32, i32, i32)*, i32 (%struct.gx_device*, i32, i32, i32, i32, i32)*, i32 (%struct.gx_device*, i32, i32, i32, i32, i32, i32, i32)*, i32 (%struct.gx_device*, %struct.gx_bitmap*, i32, i32, i32, i32, i32, i32, i32, i32)* } - -define i32 @mem_mono_copy_mono(%struct.gx_device* %dev, i8* %base, i32 %sourcex, i32 %raster, i32 %x, i32 %y, i32 %w, i32 %h, i32 %zero, i32 %one) { -entry: - %tmp = icmp eq i32 %one, %zero ; [#uses=1] - br i1 %tmp, label %cond_true, label %cond_next - -cond_true: ; preds = %entry - %tmp6 = tail call i32 @mem_mono_fill_rectangle( %struct.gx_device* %dev, i32 %x, i32 %y, i32 %w, i32 %h, i32 %zero ) ; [#uses=1] - ret i32 %tmp6 - -cond_next: ; preds = %entry - %tmp8 = bitcast %struct.gx_device* %dev to %struct.gx_device_memory* ; <%struct.gx_device_memory*> [#uses=6] - %tmp.upgrd.1 = getelementptr %struct.gx_device_memory* %tmp8, i32 0, i32 15 ; [#uses=1] - %tmp.upgrd.2 = load i32 (%struct.gx_device_memory*, i32, i32, i32, i32, i32)** %tmp.upgrd.1 ; [#uses=2] - %tmp9 = icmp eq i32 (%struct.gx_device_memory*, i32, i32, i32, i32, i32)* %tmp.upgrd.2, @mem_no_fault_proc ; [#uses=1] - br i1 %tmp9, label %cond_next46, label %cond_true10 - -cond_true10: ; preds = %cond_next - %tmp16 = add i32 %x, 7 ; [#uses=1] - %tmp17 = add i32 %tmp16, %w ; [#uses=1] - %tmp18 = ashr i32 %tmp17, 3 ; [#uses=1] - %tmp20 = ashr i32 %x, 3 ; [#uses=2] - %tmp21 = sub i32 %tmp18, %tmp20 ; [#uses=1] - %tmp27 = tail call i32 %tmp.upgrd.2( %struct.gx_device_memory* %tmp8, i32 %tmp20, i32 %y, i32 %tmp21, i32 %h, i32 1 ) ; [#uses=2] - %tmp29 = icmp slt i32 %tmp27, 0 ; [#uses=1] - br i1 %tmp29, label %cond_true30, label %cond_next46 - -cond_true30: ; preds = %cond_true10 - %tmp41 = tail call i32 @mem_copy_mono_recover( %struct.gx_device* %dev, i8* %base, i32 %sourcex, i32 %raster, i32 %x, i32 %y, i32 %w, i32 %h, i32 %zero, i32 %one, i32 %tmp27 ) ; [#uses=1] - ret i32 %tmp41 - -cond_next46: ; preds = %cond_true10, %cond_next - %tmp48 = icmp sgt i32 %w, 0 ; [#uses=1] - %tmp53 = icmp sgt i32 %h, 0 ; [#uses=1] - %bothcond = and i1 %tmp53, %tmp48 ; [#uses=1] - br i1 %bothcond, label %bb58, label %return - -bb58: ; preds = %cond_next46 - %tmp60 = icmp slt i32 %x, 0 ; [#uses=1] - br i1 %tmp60, label %return, label %cond_next63 - -cond_next63: ; preds = %bb58 - %tmp65 = getelementptr %struct.gx_device_memory* %tmp8, i32 0, i32 3 ; [#uses=1] - %tmp66 = load i32* %tmp65 ; [#uses=1] - %tmp68 = sub i32 %tmp66, %w ; [#uses=1] - %tmp70 = icmp slt i32 %tmp68, %x ; [#uses=1] - %tmp75 = icmp slt i32 %y, 0 ; [#uses=1] - %bothcond1 = or i1 %tmp70, %tmp75 ; [#uses=1] - br i1 %bothcond1, label %return, label %cond_next78 - -cond_next78: ; preds = %cond_next63 - %tmp80 = getelementptr %struct.gx_device_memory* %tmp8, i32 0, i32 4 ; [#uses=1] - %tmp81 = load i32* %tmp80 ; [#uses=1] - %tmp83 = sub i32 %tmp81, %h ; [#uses=1] - %tmp85 = icmp slt i32 %tmp83, %y ; [#uses=1] - br i1 %tmp85, label %return, label %bb91 - -bb91: ; preds = %cond_next78 - %tmp93 = ashr i32 %x, 3 ; [#uses=4] - %tmp.upgrd.3 = getelementptr %struct.gx_device_memory* %tmp8, i32 0, i32 14 ; [#uses=1] - %tmp.upgrd.4 = load i8*** %tmp.upgrd.3 ; [#uses=1] - %tmp96 = getelementptr i8** %tmp.upgrd.4, i32 %y ; [#uses=4] - %tmp98 = load i8** %tmp96 ; [#uses=1] - %tmp100 = getelementptr i8* %tmp98, i32 %tmp93 ; [#uses=3] - %tmp102 = ashr i32 %sourcex, 3 ; [#uses=3] - %tmp106 = and i32 %sourcex, 7 ; [#uses=1] - %tmp107 = sub i32 8, %tmp106 ; [#uses=4] - %tmp109 = and i32 %x, 7 ; [#uses=3] - %tmp110 = sub i32 8, %tmp109 ; [#uses=8] - %tmp112 = sub i32 8, %tmp110 ; [#uses=1] - %tmp112.upgrd.5 = trunc i32 %tmp112 to i8 ; [#uses=1] - %shift.upgrd.6 = zext i8 %tmp112.upgrd.5 to i32 ; [#uses=1] - %tmp113464 = lshr i32 255, %shift.upgrd.6 ; [#uses=4] - %tmp116 = icmp sgt i32 %tmp110, %w ; [#uses=1] - %tmp132 = getelementptr %struct.gx_device_memory* %tmp8, i32 0, i32 16 ; [#uses=2] - br i1 %tmp116, label %cond_true117, label %cond_false123 - -cond_true117: ; preds = %bb91 - %tmp119 = trunc i32 %w to i8 ; [#uses=1] - %shift.upgrd.7 = zext i8 %tmp119 to i32 ; [#uses=1] - %tmp120 = lshr i32 %tmp113464, %shift.upgrd.7 ; [#uses=1] - %tmp122 = sub i32 %tmp113464, %tmp120 ; [#uses=2] - %tmp13315 = load i32* %tmp132 ; [#uses=1] - %tmp13416 = icmp eq i32 %tmp13315, 0 ; [#uses=1] - br i1 %tmp13416, label %cond_next151, label %cond_true135 - -cond_false123: ; preds = %bb91 - %tmp126 = sub i32 %w, %tmp110 ; [#uses=1] - %tmp126.upgrd.8 = trunc i32 %tmp126 to i8 ; [#uses=1] - %tmp127 = and i8 %tmp126.upgrd.8, 7 ; [#uses=1] - %shift.upgrd.9 = zext i8 %tmp127 to i32 ; [#uses=1] - %tmp128 = lshr i32 255, %shift.upgrd.9 ; [#uses=1] - %tmp1295 = sub i32 255, %tmp128 ; [#uses=2] - %tmp133 = load i32* %tmp132 ; [#uses=1] - %tmp134 = icmp eq i32 %tmp133, 0 ; [#uses=1] - br i1 %tmp134, label %cond_next151, label %cond_true135 - -cond_true135: ; preds = %cond_false123, %cond_true117 - %rmask.0.0 = phi i32 [ undef, %cond_true117 ], [ %tmp1295, %cond_false123 ] ; [#uses=2] - %mask.1.0 = phi i32 [ %tmp122, %cond_true117 ], [ %tmp113464, %cond_false123 ] ; [#uses=2] - %not.tmp137 = icmp ne i32 %zero, -1 ; [#uses=1] - %tmp140 = zext i1 %not.tmp137 to i32 ; [#uses=1] - %zero_addr.0 = xor i32 %tmp140, %zero ; [#uses=2] - %tmp144 = icmp eq i32 %one, -1 ; [#uses=1] - br i1 %tmp144, label %cond_next151, label %cond_true145 - -cond_true145: ; preds = %cond_true135 - %tmp147 = xor i32 %one, 1 ; [#uses=1] - br label %cond_next151 - -cond_next151: ; preds = %cond_true145, %cond_true135, %cond_false123, %cond_true117 - %rmask.0.1 = phi i32 [ %rmask.0.0, %cond_true145 ], [ undef, %cond_true117 ], [ %tmp1295, %cond_false123 ], [ %rmask.0.0, %cond_true135 ] ; [#uses=4] - %mask.1.1 = phi i32 [ %mask.1.0, %cond_true145 ], [ %tmp122, %cond_true117 ], [ %tmp113464, %cond_false123 ], [ %mask.1.0, %cond_true135 ] ; [#uses=4] - %one_addr.0 = phi i32 [ %tmp147, %cond_true145 ], [ %one, %cond_true117 ], [ %one, %cond_false123 ], [ %one, %cond_true135 ] ; [#uses=2] - %zero_addr.1 = phi i32 [ %zero_addr.0, %cond_true145 ], [ %zero, %cond_true117 ], [ %zero, %cond_false123 ], [ %zero_addr.0, %cond_true135 ] ; [#uses=2] - %tmp153 = icmp eq i32 %zero_addr.1, 1 ; [#uses=2] - %tmp158 = icmp eq i32 %one_addr.0, 0 ; [#uses=2] - %bothcond2 = or i1 %tmp153, %tmp158 ; [#uses=1] - %iftmp.35.0 = select i1 %bothcond2, i32 -1, i32 0 ; [#uses=9] - %tmp167 = icmp eq i32 %zero_addr.1, 0 ; [#uses=1] - %bothcond3 = or i1 %tmp167, %tmp158 ; [#uses=1] - %iftmp.36.0 = select i1 %bothcond3, i32 0, i32 -1 ; [#uses=4] - %tmp186 = icmp eq i32 %one_addr.0, 1 ; [#uses=1] - %bothcond4 = or i1 %tmp153, %tmp186 ; [#uses=1] - %iftmp.37.0 = select i1 %bothcond4, i32 -1, i32 0 ; [#uses=6] - %tmp196 = icmp eq i32 %tmp107, %tmp110 ; [#uses=1] - br i1 %tmp196, label %cond_true197, label %cond_false299 - -cond_true197: ; preds = %cond_next151 - %tmp29222 = add i32 %h, -1 ; [#uses=3] - %tmp29424 = icmp slt i32 %tmp29222, 0 ; [#uses=1] - br i1 %tmp29424, label %return, label %cond_true295.preheader - -cond_true249.preheader: ; preds = %cond_true295 - br label %cond_true249 - -cond_true249: ; preds = %cond_true249, %cond_true249.preheader - %indvar = phi i32 [ 0, %cond_true249.preheader ], [ %indvar.next, %cond_true249 ] ; [#uses=3] - %optr.3.2 = phi i8* [ %tmp232.upgrd.12, %cond_true249 ], [ %dest.1.0, %cond_true249.preheader ] ; [#uses=1] - %bptr.3.2 = phi i8* [ %tmp226.upgrd.10, %cond_true249 ], [ %line.1.0, %cond_true249.preheader ] ; [#uses=1] - %tmp. = add i32 %tmp109, %w ; [#uses=1] - %tmp.58 = mul i32 %indvar, -8 ; [#uses=1] - %tmp.57 = add i32 %tmp., -16 ; [#uses=1] - %tmp246.2 = add i32 %tmp.58, %tmp.57 ; [#uses=1] - %tmp225 = ptrtoint i8* %bptr.3.2 to i32 ; [#uses=1] - %tmp226 = add i32 %tmp225, 1 ; [#uses=1] - %tmp226.upgrd.10 = inttoptr i32 %tmp226 to i8* ; [#uses=3] - %tmp228 = load i8* %tmp226.upgrd.10 ; [#uses=1] - %tmp228.upgrd.11 = zext i8 %tmp228 to i32 ; [#uses=1] - %tmp230 = xor i32 %tmp228.upgrd.11, %iftmp.35.0 ; [#uses=2] - %tmp231 = ptrtoint i8* %optr.3.2 to i32 ; [#uses=1] - %tmp232 = add i32 %tmp231, 1 ; [#uses=1] - %tmp232.upgrd.12 = inttoptr i32 %tmp232 to i8* ; [#uses=4] - %tmp235 = or i32 %tmp230, %iftmp.36.0 ; [#uses=1] - %tmp235.upgrd.13 = trunc i32 %tmp235 to i8 ; [#uses=1] - %tmp237 = load i8* %tmp232.upgrd.12 ; [#uses=1] - %tmp238 = and i8 %tmp235.upgrd.13, %tmp237 ; [#uses=1] - %tmp241 = and i32 %tmp230, %iftmp.37.0 ; [#uses=1] - %tmp241.upgrd.14 = trunc i32 %tmp241 to i8 ; [#uses=1] - %tmp242 = or i8 %tmp238, %tmp241.upgrd.14 ; [#uses=1] - store i8 %tmp242, i8* %tmp232.upgrd.12 - %tmp24629 = add i32 %tmp246.2, -8 ; [#uses=2] - %tmp24831 = icmp slt i32 %tmp24629, 0 ; [#uses=1] - %indvar.next = add i32 %indvar, 1 ; [#uses=1] - br i1 %tmp24831, label %bb252.loopexit, label %cond_true249 - -bb252.loopexit: ; preds = %cond_true249 - br label %bb252 - -bb252: ; preds = %cond_true295, %bb252.loopexit - %optr.3.3 = phi i8* [ %dest.1.0, %cond_true295 ], [ %tmp232.upgrd.12, %bb252.loopexit ] ; [#uses=1] - %bptr.3.3 = phi i8* [ %line.1.0, %cond_true295 ], [ %tmp226.upgrd.10, %bb252.loopexit ] ; [#uses=1] - %tmp246.3 = phi i32 [ %tmp246, %cond_true295 ], [ %tmp24629, %bb252.loopexit ] ; [#uses=1] - %tmp254 = icmp sgt i32 %tmp246.3, -8 ; [#uses=1] - br i1 %tmp254, label %cond_true255, label %cond_next280 - -cond_true255: ; preds = %bb252 - %tmp256 = ptrtoint i8* %bptr.3.3 to i32 ; [#uses=1] - %tmp257 = add i32 %tmp256, 1 ; [#uses=1] - %tmp257.upgrd.15 = inttoptr i32 %tmp257 to i8* ; [#uses=1] - %tmp259 = load i8* %tmp257.upgrd.15 ; [#uses=1] - %tmp259.upgrd.16 = zext i8 %tmp259 to i32 ; [#uses=1] - %tmp261 = xor i32 %tmp259.upgrd.16, %iftmp.35.0 ; [#uses=2] - %tmp262 = ptrtoint i8* %optr.3.3 to i32 ; [#uses=1] - %tmp263 = add i32 %tmp262, 1 ; [#uses=1] - %tmp263.upgrd.17 = inttoptr i32 %tmp263 to i8* ; [#uses=2] - %tmp265 = trunc i32 %tmp261 to i8 ; [#uses=1] - %tmp268 = or i8 %tmp266, %tmp265 ; [#uses=1] - %tmp270 = load i8* %tmp263.upgrd.17 ; [#uses=1] - %tmp271 = and i8 %tmp268, %tmp270 ; [#uses=1] - %tmp276 = and i32 %tmp274, %tmp261 ; [#uses=1] - %tmp276.upgrd.18 = trunc i32 %tmp276 to i8 ; [#uses=1] - %tmp277 = or i8 %tmp271, %tmp276.upgrd.18 ; [#uses=1] - store i8 %tmp277, i8* %tmp263.upgrd.17 - br label %cond_next280 - -cond_next280: ; preds = %cond_true255, %bb252 - %tmp281 = ptrtoint i8** %dest_line.1.0 to i32 ; [#uses=1] - %tmp282 = add i32 %tmp281, 4 ; [#uses=1] - %tmp282.upgrd.19 = inttoptr i32 %tmp282 to i8** ; [#uses=2] - %tmp284 = load i8** %tmp282.upgrd.19 ; [#uses=1] - %tmp286 = getelementptr i8* %tmp284, i32 %tmp93 ; [#uses=1] - %tmp292 = add i32 %tmp292.0, -1 ; [#uses=1] - %tmp294 = icmp slt i32 %tmp292, 0 ; [#uses=1] - %indvar.next61 = add i32 %indvar60, 1 ; [#uses=1] - br i1 %tmp294, label %return.loopexit, label %cond_true295 - -cond_true295.preheader: ; preds = %cond_true197 - %tmp200 = sub i32 %w, %tmp110 ; [#uses=1] - %tmp209 = trunc i32 %mask.1.1 to i8 ; [#uses=1] - %tmp209not = xor i8 %tmp209, -1 ; [#uses=1] - %tmp212 = trunc i32 %iftmp.36.0 to i8 ; [#uses=2] - %tmp211 = or i8 %tmp212, %tmp209not ; [#uses=2] - %tmp219 = and i32 %iftmp.37.0, %mask.1.1 ; [#uses=2] - %tmp246 = add i32 %tmp200, -8 ; [#uses=3] - %tmp248 = icmp slt i32 %tmp246, 0 ; [#uses=1] - %tmp264 = trunc i32 %rmask.0.1 to i8 ; [#uses=1] - %tmp264not = xor i8 %tmp264, -1 ; [#uses=1] - %tmp266 = or i8 %tmp212, %tmp264not ; [#uses=2] - %tmp274 = and i32 %iftmp.37.0, %rmask.0.1 ; [#uses=2] - br i1 %tmp248, label %cond_true295.preheader.split.us, label %cond_true295.preheader.split - -cond_true295.preheader.split.us: ; preds = %cond_true295.preheader - br label %cond_true295.us - -cond_true295.us: ; preds = %cond_next280.us, %cond_true295.preheader.split.us - %indvar86 = phi i32 [ 0, %cond_true295.preheader.split.us ], [ %indvar.next87, %cond_next280.us ] ; [#uses=3] - %dest.1.0.us = phi i8* [ %tmp286.us, %cond_next280.us ], [ %tmp100, %cond_true295.preheader.split.us ] ; [#uses=3] - %dest_line.1.0.us = phi i8** [ %tmp282.us.upgrd.21, %cond_next280.us ], [ %tmp96, %cond_true295.preheader.split.us ] ; [#uses=1] - %tmp.89 = sub i32 0, %indvar86 ; [#uses=2] - %tmp292.0.us = add i32 %tmp.89, %tmp29222 ; [#uses=1] - %tmp.91 = mul i32 %indvar86, %raster ; [#uses=2] - %tmp104.sum101 = add i32 %tmp102, %tmp.91 ; [#uses=1] - %line.1.0.us = getelementptr i8* %base, i32 %tmp104.sum101 ; [#uses=2] - %tmp.us = load i8* %line.1.0.us ; [#uses=1] - %tmp206.us = zext i8 %tmp.us to i32 ; [#uses=1] - %tmp208.us = xor i32 %tmp206.us, %iftmp.35.0 ; [#uses=2] - %tmp210.us = trunc i32 %tmp208.us to i8 ; [#uses=1] - %tmp213.us = or i8 %tmp211, %tmp210.us ; [#uses=1] - %tmp215.us = load i8* %dest.1.0.us ; [#uses=1] - %tmp216.us = and i8 %tmp213.us, %tmp215.us ; [#uses=1] - %tmp221.us = and i32 %tmp219, %tmp208.us ; [#uses=1] - %tmp221.us.upgrd.20 = trunc i32 %tmp221.us to i8 ; [#uses=1] - %tmp222.us = or i8 %tmp216.us, %tmp221.us.upgrd.20 ; [#uses=1] - store i8 %tmp222.us, i8* %dest.1.0.us - br i1 true, label %bb252.us, label %cond_true249.preheader.us - -cond_next280.us: ; preds = %bb252.us, %cond_true255.us - %tmp281.us = ptrtoint i8** %dest_line.1.0.us to i32 ; [#uses=1] - %tmp282.us = add i32 %tmp281.us, 4 ; [#uses=1] - %tmp282.us.upgrd.21 = inttoptr i32 %tmp282.us to i8** ; [#uses=2] - %tmp284.us = load i8** %tmp282.us.upgrd.21 ; [#uses=1] - %tmp286.us = getelementptr i8* %tmp284.us, i32 %tmp93 ; [#uses=1] - %tmp292.us = add i32 %tmp292.0.us, -1 ; [#uses=1] - %tmp294.us = icmp slt i32 %tmp292.us, 0 ; [#uses=1] - %indvar.next87 = add i32 %indvar86, 1 ; [#uses=1] - br i1 %tmp294.us, label %return.loopexit.us, label %cond_true295.us - -cond_true255.us: ; preds = %bb252.us - %tmp256.us = ptrtoint i8* %bptr.3.3.us to i32 ; [#uses=1] - %tmp257.us = add i32 %tmp256.us, 1 ; [#uses=1] - %tmp257.us.upgrd.22 = inttoptr i32 %tmp257.us to i8* ; [#uses=1] - %tmp259.us = load i8* %tmp257.us.upgrd.22 ; [#uses=1] - %tmp259.us.upgrd.23 = zext i8 %tmp259.us to i32 ; [#uses=1] - %tmp261.us = xor i32 %tmp259.us.upgrd.23, %iftmp.35.0 ; [#uses=2] - %tmp262.us = ptrtoint i8* %optr.3.3.us to i32 ; [#uses=1] - %tmp263.us = add i32 %tmp262.us, 1 ; [#uses=1] - %tmp263.us.upgrd.24 = inttoptr i32 %tmp263.us to i8* ; [#uses=2] - %tmp265.us = trunc i32 %tmp261.us to i8 ; [#uses=1] - %tmp268.us = or i8 %tmp266, %tmp265.us ; [#uses=1] - %tmp270.us = load i8* %tmp263.us.upgrd.24 ; [#uses=1] - %tmp271.us = and i8 %tmp268.us, %tmp270.us ; [#uses=1] - %tmp276.us = and i32 %tmp274, %tmp261.us ; [#uses=1] - %tmp276.us.upgrd.25 = trunc i32 %tmp276.us to i8 ; [#uses=1] - %tmp277.us = or i8 %tmp271.us, %tmp276.us.upgrd.25 ; [#uses=1] - store i8 %tmp277.us, i8* %tmp263.us.upgrd.24 - br label %cond_next280.us - -bb252.us: ; preds = %bb252.loopexit.us, %cond_true295.us - %optr.3.3.us = phi i8* [ %dest.1.0.us, %cond_true295.us ], [ undef, %bb252.loopexit.us ] ; [#uses=1] - %bptr.3.3.us = phi i8* [ %line.1.0.us, %cond_true295.us ], [ undef, %bb252.loopexit.us ] ; [#uses=1] - %tmp246.3.us = phi i32 [ %tmp246, %cond_true295.us ], [ undef, %bb252.loopexit.us ] ; [#uses=1] - %tmp254.us = icmp sgt i32 %tmp246.3.us, -8 ; [#uses=1] - br i1 %tmp254.us, label %cond_true255.us, label %cond_next280.us - -cond_true249.us: ; preds = %cond_true249.preheader.us, %cond_true249.us - br i1 undef, label %bb252.loopexit.us, label %cond_true249.us - -cond_true249.preheader.us: ; preds = %cond_true295.us - br label %cond_true249.us - -bb252.loopexit.us: ; preds = %cond_true249.us - br label %bb252.us - -return.loopexit.us: ; preds = %cond_next280.us - br label %return.loopexit.split - -cond_true295.preheader.split: ; preds = %cond_true295.preheader - br label %cond_true295 - -cond_true295: ; preds = %cond_true295.preheader.split, %cond_next280 - %indvar60 = phi i32 [ 0, %cond_true295.preheader.split ], [ %indvar.next61, %cond_next280 ] ; [#uses=3] - %dest.1.0 = phi i8* [ %tmp286, %cond_next280 ], [ %tmp100, %cond_true295.preheader.split ] ; [#uses=4] - %dest_line.1.0 = phi i8** [ %tmp282.upgrd.19, %cond_next280 ], [ %tmp96, %cond_true295.preheader.split ] ; [#uses=1] - %tmp.63 = sub i32 0, %indvar60 ; [#uses=2] - %tmp292.0 = add i32 %tmp.63, %tmp29222 ; [#uses=1] - %tmp.65 = mul i32 %indvar60, %raster ; [#uses=2] - %tmp104.sum97 = add i32 %tmp102, %tmp.65 ; [#uses=1] - %line.1.0 = getelementptr i8* %base, i32 %tmp104.sum97 ; [#uses=3] - %tmp.upgrd.26 = load i8* %line.1.0 ; [#uses=1] - %tmp206 = zext i8 %tmp.upgrd.26 to i32 ; [#uses=1] - %tmp208 = xor i32 %tmp206, %iftmp.35.0 ; [#uses=2] - %tmp210 = trunc i32 %tmp208 to i8 ; [#uses=1] - %tmp213 = or i8 %tmp211, %tmp210 ; [#uses=1] - %tmp215 = load i8* %dest.1.0 ; [#uses=1] - %tmp216 = and i8 %tmp213, %tmp215 ; [#uses=1] - %tmp221 = and i32 %tmp219, %tmp208 ; [#uses=1] - %tmp221.upgrd.27 = trunc i32 %tmp221 to i8 ; [#uses=1] - %tmp222 = or i8 %tmp216, %tmp221.upgrd.27 ; [#uses=1] - store i8 %tmp222, i8* %dest.1.0 - br i1 false, label %bb252, label %cond_true249.preheader - -cond_false299: ; preds = %cond_next151 - %tmp302 = sub i32 %tmp107, %tmp110 ; [#uses=1] - %tmp303 = and i32 %tmp302, 7 ; [#uses=3] - %tmp305 = sub i32 8, %tmp303 ; [#uses=1] - %tmp45438 = add i32 %h, -1 ; [#uses=2] - %tmp45640 = icmp slt i32 %tmp45438, 0 ; [#uses=1] - br i1 %tmp45640, label %return, label %cond_true457.preheader - -cond_true316: ; preds = %cond_true457 - %tmp318 = zext i8 %tmp318.upgrd.48 to i32 ; [#uses=1] - %shift.upgrd.28 = zext i8 %tmp319 to i32 ; [#uses=1] - %tmp320 = lshr i32 %tmp318, %shift.upgrd.28 ; [#uses=1] - br label %cond_next340 - -cond_false321: ; preds = %cond_true457 - %tmp3188 = zext i8 %tmp318.upgrd.48 to i32 ; [#uses=1] - %shift.upgrd.29 = zext i8 %tmp324 to i32 ; [#uses=1] - %tmp325 = shl i32 %tmp3188, %shift.upgrd.29 ; [#uses=2] - %tmp326 = ptrtoint i8* %line.3.0 to i32 ; [#uses=1] - %tmp327 = add i32 %tmp326, 1 ; [#uses=1] - %tmp327.upgrd.30 = inttoptr i32 %tmp327 to i8* ; [#uses=3] - br i1 %tmp330, label %cond_true331, label %cond_next340 - -cond_true331: ; preds = %cond_false321 - %tmp333 = load i8* %tmp327.upgrd.30 ; [#uses=1] - %tmp333.upgrd.31 = zext i8 %tmp333 to i32 ; [#uses=1] - %shift.upgrd.32 = zext i8 %tmp319 to i32 ; [#uses=1] - %tmp335 = lshr i32 %tmp333.upgrd.31, %shift.upgrd.32 ; [#uses=1] - %tmp337 = add i32 %tmp335, %tmp325 ; [#uses=1] - br label %cond_next340 - -cond_next340: ; preds = %cond_true331, %cond_false321, %cond_true316 - %bits.0 = phi i32 [ %tmp320, %cond_true316 ], [ %tmp337, %cond_true331 ], [ %tmp325, %cond_false321 ] ; [#uses=1] - %bptr307.3 = phi i8* [ %line.3.0, %cond_true316 ], [ %tmp327.upgrd.30, %cond_true331 ], [ %tmp327.upgrd.30, %cond_false321 ] ; [#uses=2] - %tmp343 = xor i32 %bits.0, %iftmp.35.0 ; [#uses=2] - %tmp345 = trunc i32 %tmp343 to i8 ; [#uses=1] - %tmp348 = or i8 %tmp346, %tmp345 ; [#uses=1] - %tmp350 = load i8* %dest.3.0 ; [#uses=1] - %tmp351 = and i8 %tmp348, %tmp350 ; [#uses=1] - %tmp356 = and i32 %tmp354, %tmp343 ; [#uses=1] - %tmp356.upgrd.33 = trunc i32 %tmp356 to i8 ; [#uses=1] - %tmp357 = or i8 %tmp351, %tmp356.upgrd.33 ; [#uses=1] - store i8 %tmp357, i8* %dest.3.0 - %tmp362 = ptrtoint i8* %dest.3.0 to i32 ; [#uses=1] - %optr309.3.in51 = add i32 %tmp362, 1 ; [#uses=2] - %optr309.353 = inttoptr i32 %optr309.3.in51 to i8* ; [#uses=2] - br i1 %tmp39755, label %cond_true398.preheader, label %bb401 - -cond_true398.preheader: ; preds = %cond_next340 - br label %cond_true398 - -cond_true398: ; preds = %cond_true398, %cond_true398.preheader - %indvar66 = phi i32 [ 0, %cond_true398.preheader ], [ %indvar.next67, %cond_true398 ] ; [#uses=4] - %bptr307.4.0 = phi i8* [ %tmp370.upgrd.35, %cond_true398 ], [ %bptr307.3, %cond_true398.preheader ] ; [#uses=2] - %optr309.3.0 = phi i8* [ %optr309.3, %cond_true398 ], [ %optr309.353, %cond_true398.preheader ] ; [#uses=2] - %optr309.3.in.0 = add i32 %indvar66, %optr309.3.in51 ; [#uses=1] - %tmp.70 = add i32 %tmp109, %w ; [#uses=1] - %tmp.72 = mul i32 %indvar66, -8 ; [#uses=1] - %tmp.71 = add i32 %tmp.70, -8 ; [#uses=1] - %count308.3.0 = add i32 %tmp.72, %tmp.71 ; [#uses=1] - %tmp366 = load i8* %bptr307.4.0 ; [#uses=1] - %tmp366.upgrd.34 = zext i8 %tmp366 to i32 ; [#uses=1] - %tmp369 = ptrtoint i8* %bptr307.4.0 to i32 ; [#uses=1] - %tmp370 = add i32 %tmp369, 1 ; [#uses=1] - %tmp370.upgrd.35 = inttoptr i32 %tmp370 to i8* ; [#uses=3] - %tmp372 = load i8* %tmp370.upgrd.35 ; [#uses=1] - %tmp372.upgrd.36 = zext i8 %tmp372 to i32 ; [#uses=1] - %shift.upgrd.37 = zext i8 %tmp319 to i32 ; [#uses=1] - %tmp374463 = lshr i32 %tmp372.upgrd.36, %shift.upgrd.37 ; [#uses=1] - %shift.upgrd.38 = zext i8 %tmp324 to i32 ; [#uses=1] - %tmp368 = shl i32 %tmp366.upgrd.34, %shift.upgrd.38 ; [#uses=1] - %tmp377 = add i32 %tmp374463, %tmp368 ; [#uses=1] - %tmp379 = xor i32 %tmp377, %iftmp.35.0 ; [#uses=2] - %tmp382 = or i32 %tmp379, %iftmp.36.0 ; [#uses=1] - %tmp382.upgrd.39 = trunc i32 %tmp382 to i8 ; [#uses=1] - %tmp384 = load i8* %optr309.3.0 ; [#uses=1] - %tmp385 = and i8 %tmp382.upgrd.39, %tmp384 ; [#uses=1] - %tmp388 = and i32 %tmp379, %iftmp.37.0 ; [#uses=1] - %tmp388.upgrd.40 = trunc i32 %tmp388 to i8 ; [#uses=1] - %tmp389 = or i8 %tmp385, %tmp388.upgrd.40 ; [#uses=1] - store i8 %tmp389, i8* %optr309.3.0 - %tmp392 = add i32 %count308.3.0, -8 ; [#uses=2] - %optr309.3.in = add i32 %optr309.3.in.0, 1 ; [#uses=1] - %optr309.3 = inttoptr i32 %optr309.3.in to i8* ; [#uses=2] - %tmp397 = icmp sgt i32 %tmp392, 7 ; [#uses=1] - %indvar.next67 = add i32 %indvar66, 1 ; [#uses=1] - br i1 %tmp397, label %cond_true398, label %bb401.loopexit - -bb401.loopexit: ; preds = %cond_true398 - br label %bb401 - -bb401: ; preds = %bb401.loopexit, %cond_next340 - %count308.3.1 = phi i32 [ %tmp361, %cond_next340 ], [ %tmp392, %bb401.loopexit ] ; [#uses=2] - %bptr307.4.1 = phi i8* [ %bptr307.3, %cond_next340 ], [ %tmp370.upgrd.35, %bb401.loopexit ] ; [#uses=2] - %optr309.3.1 = phi i8* [ %optr309.353, %cond_next340 ], [ %optr309.3, %bb401.loopexit ] ; [#uses=2] - %tmp403 = icmp sgt i32 %count308.3.1, 0 ; [#uses=1] - br i1 %tmp403, label %cond_true404, label %cond_next442 - -cond_true404: ; preds = %bb401 - %tmp406 = load i8* %bptr307.4.1 ; [#uses=1] - %tmp406.upgrd.41 = zext i8 %tmp406 to i32 ; [#uses=1] - %shift.upgrd.42 = zext i8 %tmp324 to i32 ; [#uses=1] - %tmp408 = shl i32 %tmp406.upgrd.41, %shift.upgrd.42 ; [#uses=2] - %tmp413 = icmp sgt i32 %count308.3.1, %tmp303 ; [#uses=1] - br i1 %tmp413, label %cond_true414, label %cond_next422 - -cond_true414: ; preds = %cond_true404 - %tmp409 = ptrtoint i8* %bptr307.4.1 to i32 ; [#uses=1] - %tmp410 = add i32 %tmp409, 1 ; [#uses=1] - %tmp410.upgrd.43 = inttoptr i32 %tmp410 to i8* ; [#uses=1] - %tmp416 = load i8* %tmp410.upgrd.43 ; [#uses=1] - %tmp416.upgrd.44 = zext i8 %tmp416 to i32 ; [#uses=1] - %shift.upgrd.45 = zext i8 %tmp319 to i32 ; [#uses=1] - %tmp418 = lshr i32 %tmp416.upgrd.44, %shift.upgrd.45 ; [#uses=2] - %tmp420 = add i32 %tmp418, %tmp408 ; [#uses=1] - br label %cond_next422 - -cond_next422: ; preds = %cond_true414, %cond_true404 - %bits.6 = phi i32 [ %tmp420, %cond_true414 ], [ %tmp408, %cond_true404 ] ; [#uses=1] - %tmp425 = xor i32 %bits.6, %iftmp.35.0 ; [#uses=1] - %tmp427 = trunc i32 %tmp425 to i8 ; [#uses=2] - %tmp430 = or i8 %tmp428, %tmp427 ; [#uses=1] - %tmp432 = load i8* %optr309.3.1 ; [#uses=1] - %tmp433 = and i8 %tmp430, %tmp432 ; [#uses=1] - %tmp438 = and i8 %tmp436.upgrd.47, %tmp427 ; [#uses=1] - %tmp439 = or i8 %tmp433, %tmp438 ; [#uses=1] - store i8 %tmp439, i8* %optr309.3.1 - br label %cond_next442 - -cond_next442: ; preds = %cond_next422, %bb401 - %tmp443 = ptrtoint i8** %dest_line.3.0 to i32 ; [#uses=1] - %tmp444 = add i32 %tmp443, 4 ; [#uses=1] - %tmp444.upgrd.46 = inttoptr i32 %tmp444 to i8** ; [#uses=2] - %tmp446 = load i8** %tmp444.upgrd.46 ; [#uses=1] - %tmp448 = getelementptr i8* %tmp446, i32 %tmp93 ; [#uses=1] - %tmp454 = add i32 %tmp454.0, -1 ; [#uses=1] - %tmp456 = icmp slt i32 %tmp454, 0 ; [#uses=1] - %indvar.next75 = add i32 %indvar74, 1 ; [#uses=1] - br i1 %tmp456, label %return.loopexit56, label %cond_true457 - -cond_true457.preheader: ; preds = %cond_false299 - %tmp315 = icmp slt i32 %tmp107, %tmp110 ; [#uses=1] - %tmp319 = trunc i32 %tmp303 to i8 ; [#uses=4] - %tmp324 = trunc i32 %tmp305 to i8 ; [#uses=3] - %tmp330 = icmp slt i32 %tmp107, %w ; [#uses=1] - %tmp344 = trunc i32 %mask.1.1 to i8 ; [#uses=1] - %tmp344not = xor i8 %tmp344, -1 ; [#uses=1] - %tmp347 = trunc i32 %iftmp.36.0 to i8 ; [#uses=2] - %tmp346 = or i8 %tmp347, %tmp344not ; [#uses=1] - %tmp354 = and i32 %iftmp.37.0, %mask.1.1 ; [#uses=1] - %tmp361 = sub i32 %w, %tmp110 ; [#uses=2] - %tmp39755 = icmp sgt i32 %tmp361, 7 ; [#uses=1] - %tmp426 = trunc i32 %rmask.0.1 to i8 ; [#uses=1] - %tmp426not = xor i8 %tmp426, -1 ; [#uses=1] - %tmp428 = or i8 %tmp347, %tmp426not ; [#uses=1] - %tmp436 = and i32 %iftmp.37.0, %rmask.0.1 ; [#uses=1] - %tmp436.upgrd.47 = trunc i32 %tmp436 to i8 ; [#uses=1] - br label %cond_true457 - -cond_true457: ; preds = %cond_true457.preheader, %cond_next442 - %indvar74 = phi i32 [ 0, %cond_true457.preheader ], [ %indvar.next75, %cond_next442 ] ; [#uses=3] - %dest.3.0 = phi i8* [ %tmp448, %cond_next442 ], [ %tmp100, %cond_true457.preheader ] ; [#uses=3] - %dest_line.3.0 = phi i8** [ %tmp444.upgrd.46, %cond_next442 ], [ %tmp96, %cond_true457.preheader ] ; [#uses=1] - %tmp.77 = sub i32 0, %indvar74 ; [#uses=2] - %tmp454.0 = add i32 %tmp.77, %tmp45438 ; [#uses=1] - %tmp.79 = mul i32 %indvar74, %raster ; [#uses=2] - %tmp104.sum = add i32 %tmp102, %tmp.79 ; [#uses=1] - %line.3.0 = getelementptr i8* %base, i32 %tmp104.sum ; [#uses=3] - %tmp318.upgrd.48 = load i8* %line.3.0 ; [#uses=2] - br i1 %tmp315, label %cond_false321, label %cond_true316 - -return.loopexit: ; preds = %cond_next280 - br label %return.loopexit.split - -return.loopexit.split: ; preds = %return.loopexit, %return.loopexit.us - br label %return - -return.loopexit56: ; preds = %cond_next442 - br label %return - -return: ; preds = %return.loopexit56, %return.loopexit.split, %cond_false299, %cond_true197, %cond_next78, %cond_next63, %bb58, %cond_next46 - %retval.0 = phi i32 [ 0, %cond_next46 ], [ -1, %bb58 ], [ -1, %cond_next63 ], [ -1, %cond_next78 ], [ 0, %cond_true197 ], [ 0, %cond_false299 ], [ 0, %return.loopexit.split ], [ 0, %return.loopexit56 ] ; [#uses=1] - ret i32 %retval.0 -} - -declare i32 @mem_no_fault_proc(%struct.gx_device_memory*, i32, i32, i32, i32, i32) - -declare i32 @mem_mono_fill_rectangle(%struct.gx_device*, i32, i32, i32, i32, i32) - -declare i32 @mem_copy_mono_recover(%struct.gx_device*, i8*, i32, i32, i32, i32, i32, i32, i32, i32, i32) diff --git a/libclamav/c++/llvm/test/Transforms/InstCombine/2006-06-28-infloop.ll b/libclamav/c++/llvm/test/Transforms/InstCombine/2006-06-28-infloop.ll deleted file mode 100644 index 84e751037..000000000 --- a/libclamav/c++/llvm/test/Transforms/InstCombine/2006-06-28-infloop.ll +++ /dev/null @@ -1,20 +0,0 @@ -; RUN: llvm-as < %s | opt -instcombine -disable-output - -target datalayout = "E-p:32:32" -target triple = "powerpc-apple-darwin8" - -define void @test() { -entry: - %tmp = getelementptr { i64, i64, i64, i64 }* null, i32 0, i32 3 ; [#uses=1] - %tmp.upgrd.1 = load i64* %tmp ; [#uses=1] - %tmp8.ui = load i64* null ; [#uses=1] - %tmp8 = bitcast i64 %tmp8.ui to i64 ; [#uses=1] - %tmp9 = and i64 %tmp8, %tmp.upgrd.1 ; [#uses=1] - %sext = trunc i64 %tmp9 to i32 ; [#uses=1] - %tmp27.i = sext i32 %sext to i64 ; [#uses=1] - tail call void @foo( i32 0, i64 %tmp27.i ) - unreachable -} - -declare void @foo(i32, i64) - diff --git a/libclamav/c++/llvm/test/Transforms/InstCombine/2006-09-11-EmptyStructCrash.ll b/libclamav/c++/llvm/test/Transforms/InstCombine/2006-09-11-EmptyStructCrash.ll deleted file mode 100644 index bf9252a34..000000000 --- a/libclamav/c++/llvm/test/Transforms/InstCombine/2006-09-11-EmptyStructCrash.ll +++ /dev/null @@ -1,46 +0,0 @@ -; PR905 -; RUN: llvm-as < %s | opt -instcombine -disable-output -; END. - -%RPYTHON_EXCEPTION = type { %RPYTHON_EXCEPTION_VTABLE* } -%RPYTHON_EXCEPTION_VTABLE = type { %RPYTHON_EXCEPTION_VTABLE*, i32, i32, %RPyOpaque_RuntimeTypeInfo*, %arraytype_Char*, %functiontype_12* } -%RPyOpaque_RuntimeTypeInfo = type opaque* -%arraytype_Char = type { i32, [0 x i8] } -%fixarray_array1019 = type [1019 x i8*] -%functiontype_12 = type %RPYTHON_EXCEPTION* () -%functiontype_14 = type void (%structtype_pypy.rpython.memory.gc.MarkSweepGC*) -%structtype_AddressLinkedListChunk = type { %structtype_AddressLinkedListChunk*, i32, %fixarray_array1019 } -%structtype_exceptions.Exception = type { %RPYTHON_EXCEPTION } -%structtype_gc_pool = type { } -%structtype_gc_pool_node = type { %structtype_header*, %structtype_gc_pool_node* } -%structtype_header = type { i32, %structtype_header* } -%structtype_pypy.rpython.memory.gc.MarkSweepGC = type { %structtype_exceptions.Exception, i32, i32, i1, %structtype_gc_pool*, i32, %structtype_header*, %structtype_header*, %structtype_gc_pool_node*, double, double } - -define fastcc void @pypy_MarkSweepGC.collect() { -block0: - %v1221 = load %structtype_AddressLinkedListChunk** null ; <%structtype_AddressLinkedListChunk*> [#uses=1] - %v1222 = icmp ne %structtype_AddressLinkedListChunk* %v1221, null ; [#uses=1] - br i1 %v1222, label %block79, label %block4 - -block4: ; preds = %block0 - ret void - -block22: ; preds = %block79 - ret void - -block67: ; preds = %block79 - %v1459 = load %structtype_gc_pool** null ; <%structtype_gc_pool*> [#uses=1] - %v1460 = bitcast %structtype_gc_pool* %v1459 to i8* ; [#uses=1] - %tmp_873 = ptrtoint i8* %v1460 to i32 ; [#uses=1] - %tmp_874 = sub i32 %tmp_873, 0 ; [#uses=1] - %v1461 = inttoptr i32 %tmp_874 to i8* ; [#uses=1] - %v1462 = bitcast i8* %v1461 to %structtype_header* ; <%structtype_header*> [#uses=1] - %tmp_876 = getelementptr %structtype_header* %v1462, i32 0, i32 0 ; [#uses=1] - store i32 0, i32* %tmp_876 - ret void - -block79: ; preds = %block0 - %v1291 = load %structtype_gc_pool** null ; <%structtype_gc_pool*> [#uses=1] - %v1292 = icmp ne %structtype_gc_pool* %v1291, null ; [#uses=1] - br i1 %v1292, label %block67, label %block22 -} diff --git a/libclamav/c++/llvm/test/Transforms/InstCombine/2006-12-10-ICmp-GEP-GEP.ll b/libclamav/c++/llvm/test/Transforms/InstCombine/2006-12-10-ICmp-GEP-GEP.ll deleted file mode 100644 index 15f73622d..000000000 --- a/libclamav/c++/llvm/test/Transforms/InstCombine/2006-12-10-ICmp-GEP-GEP.ll +++ /dev/null @@ -1,162 +0,0 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \ -; RUN: grep -v {icmp ult i32} -; END. - -target datalayout = "e-p:32:32" -target triple = "i686-pc-linux-gnu" - %struct.edgeBox = type { i16, i16, i16, i16, i16, i16 } -@qsz = external global i32 ; [#uses=12] -@thresh = external global i32 ; [#uses=2] -@mthresh = external global i32 ; [#uses=1] - -define i32 @qsorte(i8* %base, i32 %n, i32 %size) { -entry: - %tmp = icmp sgt i32 %n, 1 ; [#uses=1] - br i1 %tmp, label %cond_next, label %return - -cond_next: ; preds = %entry - store i32 %size, i32* @qsz - %tmp3 = shl i32 %size, 2 ; [#uses=1] - store i32 %tmp3, i32* @thresh - %tmp4 = load i32* @qsz ; [#uses=1] - %tmp5 = mul i32 %tmp4, 6 ; [#uses=1] - store i32 %tmp5, i32* @mthresh - %tmp6 = load i32* @qsz ; [#uses=1] - %tmp8 = mul i32 %tmp6, %n ; [#uses=1] - %tmp9 = getelementptr i8* %base, i32 %tmp8 ; [#uses=3] - %tmp11 = icmp sgt i32 %n, 3 ; [#uses=1] - br i1 %tmp11, label %cond_true12, label %bb30 - -cond_true12: ; preds = %cond_next - %tmp156 = call i32 @qste( i8* %base, i8* %tmp9 ) ; [#uses=0] - %tmp16 = load i32* @thresh ; [#uses=1] - %tmp18 = getelementptr i8* %base, i32 %tmp16 ; [#uses=2] - %tmp3117 = load i32* @qsz ; [#uses=1] - %tmp3318 = getelementptr i8* %base, i32 %tmp3117 ; [#uses=2] - %tmp3621 = icmp ult i8* %tmp3318, %tmp18 ; [#uses=1] - br i1 %tmp3621, label %bb, label %bb37 - -bb: ; preds = %bb30, %cond_true12 - %hi.0.0 = phi i8* [ %tmp18, %cond_true12 ], [ %hi.0, %bb30 ] ; [#uses=4] - %j.1.0 = phi i8* [ %base, %cond_true12 ], [ %j.1, %bb30 ] ; [#uses=4] - %tmp33.0 = phi i8* [ %tmp3318, %cond_true12 ], [ %tmp33, %bb30 ] ; [#uses=6] - %tmp3.upgrd.1 = bitcast i8* %j.1.0 to %struct.edgeBox* ; <%struct.edgeBox*> [#uses=1] - %tmp4.upgrd.2 = bitcast i8* %tmp33.0 to %struct.edgeBox* ; <%struct.edgeBox*> [#uses=1] - %tmp255 = call i32 @comparee( %struct.edgeBox* %tmp3.upgrd.1, %struct.edgeBox* %tmp4.upgrd.2 ) ; [#uses=1] - %tmp26 = icmp sgt i32 %tmp255, 0 ; [#uses=1] - br i1 %tmp26, label %cond_true27, label %bb30 - -cond_true27: ; preds = %bb - br label %bb30 - -bb30: ; preds = %cond_true27, %bb, %cond_next - %hi.0.3 = phi i8* [ %hi.0.0, %cond_true27 ], [ %hi.0.0, %bb ], [ undef, %cond_next ] ; [#uses=0] - %j.1.3 = phi i8* [ %j.1.0, %cond_true27 ], [ %j.1.0, %bb ], [ undef, %cond_next ] ; [#uses=0] - %tmp33.3 = phi i8* [ %tmp33.0, %cond_true27 ], [ %tmp33.0, %bb ], [ undef, %cond_next ] ; [#uses=0] - %hi.0 = phi i8* [ %tmp9, %cond_next ], [ %hi.0.0, %bb ], [ %hi.0.0, %cond_true27 ] ; [#uses=2] - %lo.1 = phi i8* [ %tmp33.0, %cond_true27 ], [ %tmp33.0, %bb ], [ %base, %cond_next ] ; [#uses=1] - %j.1 = phi i8* [ %tmp33.0, %cond_true27 ], [ %j.1.0, %bb ], [ %base, %cond_next ] ; [#uses=2] - %tmp31 = load i32* @qsz ; [#uses=1] - %tmp33 = getelementptr i8* %lo.1, i32 %tmp31 ; [#uses=2] - %tmp36 = icmp ult i8* %tmp33, %hi.0 ; [#uses=1] - br i1 %tmp36, label %bb, label %bb37 - -bb37: ; preds = %bb30, %cond_true12 - %j.1.1 = phi i8* [ %j.1, %bb30 ], [ %base, %cond_true12 ] ; [#uses=4] - %tmp40 = icmp eq i8* %j.1.1, %base ; [#uses=1] - br i1 %tmp40, label %bb115, label %cond_true41 - -cond_true41: ; preds = %bb37 - %tmp43 = load i32* @qsz ; [#uses=1] - %tmp45 = getelementptr i8* %base, i32 %tmp43 ; [#uses=2] - %tmp6030 = icmp ult i8* %base, %tmp45 ; [#uses=1] - br i1 %tmp6030, label %bb46, label %bb115 - -bb46: ; preds = %bb46, %cond_true41 - %j.2.0 = phi i8* [ %j.1.1, %cond_true41 ], [ %tmp52, %bb46 ] ; [#uses=3] - %i.2.0 = phi i8* [ %base, %cond_true41 ], [ %tmp56, %bb46 ] ; [#uses=3] - %tmp.upgrd.3 = load i8* %j.2.0 ; [#uses=2] - %tmp49 = load i8* %i.2.0 ; [#uses=1] - store i8 %tmp49, i8* %j.2.0 - %tmp52 = getelementptr i8* %j.2.0, i32 1 ; [#uses=2] - store i8 %tmp.upgrd.3, i8* %i.2.0 - %tmp56 = getelementptr i8* %i.2.0, i32 1 ; [#uses=3] - %tmp60 = icmp ult i8* %tmp56, %tmp45 ; [#uses=1] - br i1 %tmp60, label %bb46, label %bb115 - -bb66: ; preds = %bb115, %bb66 - %hi.3 = phi i8* [ %tmp118, %bb115 ], [ %tmp70, %bb66 ] ; [#uses=2] - %tmp67 = load i32* @qsz ; [#uses=2] - %tmp68 = sub i32 0, %tmp67 ; [#uses=1] - %tmp70 = getelementptr i8* %hi.3, i32 %tmp68 ; [#uses=2] - %tmp.upgrd.4 = bitcast i8* %tmp70 to %struct.edgeBox* ; <%struct.edgeBox*> [#uses=1] - %tmp1 = bitcast i8* %tmp118 to %struct.edgeBox* ; <%struct.edgeBox*> [#uses=1] - %tmp732 = call i32 @comparee( %struct.edgeBox* %tmp.upgrd.4, %struct.edgeBox* %tmp1 ) ; [#uses=1] - %tmp74 = icmp sgt i32 %tmp732, 0 ; [#uses=1] - br i1 %tmp74, label %bb66, label %bb75 - -bb75: ; preds = %bb66 - %tmp76 = load i32* @qsz ; [#uses=1] - %tmp70.sum = sub i32 %tmp76, %tmp67 ; [#uses=1] - %tmp78 = getelementptr i8* %hi.3, i32 %tmp70.sum ; [#uses=3] - %tmp81 = icmp eq i8* %tmp78, %tmp118 ; [#uses=1] - br i1 %tmp81, label %bb115, label %cond_true82 - -cond_true82: ; preds = %bb75 - %tmp83 = load i32* @qsz ; [#uses=1] - %tmp118.sum = add i32 %tmp116, %tmp83 ; [#uses=1] - %tmp85 = getelementptr i8* %min.1, i32 %tmp118.sum ; [#uses=1] - %tmp10937 = getelementptr i8* %tmp85, i32 -1 ; [#uses=3] - %tmp11239 = icmp ult i8* %tmp10937, %tmp118 ; [#uses=1] - br i1 %tmp11239, label %bb115, label %bb86 - -bb86: ; preds = %bb104, %cond_true82 - %tmp109.0 = phi i8* [ %tmp10937, %cond_true82 ], [ %tmp109, %bb104 ] ; [#uses=5] - %i.5.2 = phi i8* [ %i.5.3, %cond_true82 ], [ %i.5.1, %bb104 ] ; [#uses=0] - %tmp100.2 = phi i8* [ %tmp100.3, %cond_true82 ], [ %tmp100.1, %bb104 ] ; [#uses=0] - %tmp88 = load i8* %tmp109.0 ; [#uses=2] - %tmp9746 = load i32* @qsz ; [#uses=1] - %tmp9847 = sub i32 0, %tmp9746 ; [#uses=1] - %tmp10048 = getelementptr i8* %tmp109.0, i32 %tmp9847 ; [#uses=3] - %tmp10350 = icmp ult i8* %tmp10048, %tmp78 ; [#uses=1] - br i1 %tmp10350, label %bb104, label %bb91 - -bb91: ; preds = %bb91, %bb86 - %i.5.0 = phi i8* [ %tmp109.0, %bb86 ], [ %tmp100.0, %bb91 ] ; [#uses=1] - %tmp100.0 = phi i8* [ %tmp10048, %bb86 ], [ %tmp100, %bb91 ] ; [#uses=4] - %tmp93 = load i8* %tmp100.0 ; [#uses=1] - store i8 %tmp93, i8* %i.5.0 - %tmp97 = load i32* @qsz ; [#uses=1] - %tmp98 = sub i32 0, %tmp97 ; [#uses=1] - %tmp100 = getelementptr i8* %tmp100.0, i32 %tmp98 ; [#uses=3] - %tmp103 = icmp ult i8* %tmp100, %tmp78 ; [#uses=1] - br i1 %tmp103, label %bb104, label %bb91 - -bb104: ; preds = %bb91, %bb86 - %i.5.1 = phi i8* [ %tmp109.0, %bb86 ], [ %tmp100.0, %bb91 ] ; [#uses=4] - %tmp100.1 = phi i8* [ %tmp10048, %bb86 ], [ %tmp100, %bb91 ] ; [#uses=3] - store i8 %tmp88, i8* %i.5.1 - %tmp109 = getelementptr i8* %tmp109.0, i32 -1 ; [#uses=3] - %tmp112 = icmp ult i8* %tmp109, %tmp118 ; [#uses=1] - br i1 %tmp112, label %bb115, label %bb86 - -bb115: ; preds = %bb104, %cond_true82, %bb75, %bb46, %cond_true41, %bb37 - %tmp109.1 = phi i8* [ undef, %bb37 ], [ %tmp109.1, %bb75 ], [ %tmp10937, %cond_true82 ], [ %tmp109, %bb104 ], [ undef, %bb46 ], [ undef, %cond_true41 ] ; [#uses=1] - %i.5.3 = phi i8* [ undef, %bb37 ], [ %i.5.3, %bb75 ], [ %i.5.3, %cond_true82 ], [ %i.5.1, %bb104 ], [ undef, %bb46 ], [ undef, %cond_true41 ] ; [#uses=3] - %tmp100.3 = phi i8* [ undef, %bb37 ], [ %tmp100.3, %bb75 ], [ %tmp100.3, %cond_true82 ], [ %tmp100.1, %bb104 ], [ undef, %bb46 ], [ undef, %cond_true41 ] ; [#uses=3] - %min.1 = phi i8* [ %tmp118, %bb104 ], [ %tmp118, %bb75 ], [ %base, %bb37 ], [ %base, %bb46 ], [ %base, %cond_true41 ], [ %tmp118, %cond_true82 ] ; [#uses=2] - %j.5 = phi i8* [ %tmp100.1, %bb104 ], [ %j.5, %bb75 ], [ %tmp52, %bb46 ], [ %j.1.1, %bb37 ], [ %j.1.1, %cond_true41 ], [ %j.5, %cond_true82 ] ; [#uses=2] - %i.4 = phi i8* [ %i.5.1, %bb104 ], [ %i.4, %bb75 ], [ %tmp56, %bb46 ], [ undef, %bb37 ], [ %base, %cond_true41 ], [ %i.4, %cond_true82 ] ; [#uses=2] - %c.4 = phi i8 [ %tmp88, %bb104 ], [ %c.4, %bb75 ], [ %tmp.upgrd.3, %bb46 ], [ undef, %bb37 ], [ undef, %cond_true41 ], [ %c.4, %cond_true82 ] ; [#uses=2] - %tmp116 = load i32* @qsz ; [#uses=2] - %tmp118 = getelementptr i8* %min.1, i32 %tmp116 ; [#uses=9] - %tmp122 = icmp ult i8* %tmp118, %tmp9 ; [#uses=1] - br i1 %tmp122, label %bb66, label %return - -return: ; preds = %bb115, %entry - ret i32 undef -} - -declare i32 @qste(i8*, i8*) - -declare i32 @comparee(%struct.edgeBox*, %struct.edgeBox*) diff --git a/libclamav/c++/llvm/test/Transforms/InstCombine/2007-03-31-InfiniteLoop.ll b/libclamav/c++/llvm/test/Transforms/InstCombine/2007-03-31-InfiniteLoop.ll deleted file mode 100644 index 640f6d575..000000000 --- a/libclamav/c++/llvm/test/Transforms/InstCombine/2007-03-31-InfiniteLoop.ll +++ /dev/null @@ -1,302 +0,0 @@ -; RUN: llvm-as < %s | opt -instcombine -disable-output -; END. - -target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64" -target triple = "i686-apple-darwin8" - %struct.ZZIP_FILE = type { %struct.zzip_dir*, i32, i32, i32, i32, i32, i32, i64, i8*, i64, %struct.z_stream, %struct.zzip_plugin_io* } - %struct.anon = type { %struct.ZZIP_FILE*, i8* } - %struct.internal_state = type { i32 } - %struct.z_stream = type { i8*, i32, i32, i8*, i32, i32, i8*, %struct.internal_state*, i8* (i8*, i32, i32)*, void (i8*, i8*)*, i8*, i32, i32, i32 } - %struct.zzip_dir = type { i32, i32, i32, %struct.anon, %struct.zzip_dir_hdr*, %struct.zzip_dir_hdr*, %struct.ZZIP_FILE*, %struct.zzip_dirent, i8*, i8*, i8**, %struct.zzip_plugin_io* } - %struct.zzip_dir_hdr = type { i32, i32, i32, i32, i16, i16, i8, i16, [1 x i8] } - %struct.zzip_dirent = type { i32, i32, i32, i16, i8*, i32, i32 } - %struct.zzip_plugin_io = type { i32 (i8*, i32, ...)*, i32 (i32)*, i32 (i32, i8*, i32)*, i64 (i32, i64, i32)*, i64 (i32)*, i32 } - -define %struct.ZZIP_FILE* @zzip_open_shared_io(%struct.ZZIP_FILE* %stream, i8* %filename, i32 %o_flags, i32 %o_modes, i8** %ext, %struct.zzip_plugin_io* %io) { -entry: - %basename = alloca [1024 x i8], align 16 ; <[1024 x i8]*> [#uses=5] - %e = alloca i32, align 4 ; [#uses=4] - icmp eq %struct.ZZIP_FILE* %stream, null ; :0 [#uses=1] - br i1 %0, label %cond_next22, label %cond_true - -cond_true: ; preds = %entry - %tmp3 = getelementptr %struct.ZZIP_FILE* %stream, i32 0, i32 0 ; <%struct.zzip_dir**> [#uses=1] - %tmp4 = load %struct.zzip_dir** %tmp3 ; <%struct.zzip_dir*> [#uses=1] - icmp eq %struct.zzip_dir* %tmp4, null ; :1 [#uses=1] - br i1 %1, label %cond_next22, label %cond_true5 - -cond_true5: ; preds = %cond_true - icmp eq i8** %ext, null ; :2 [#uses=1] - br i1 %2, label %cond_true7, label %cond_next - -cond_true7: ; preds = %cond_true5 - %tmp9 = getelementptr %struct.ZZIP_FILE* %stream, i32 0, i32 0 ; <%struct.zzip_dir**> [#uses=1] - %tmp10 = load %struct.zzip_dir** %tmp9 ; <%struct.zzip_dir*> [#uses=1] - %tmp11 = getelementptr %struct.zzip_dir* %tmp10, i32 0, i32 10 ; [#uses=1] - %tmp12 = load i8*** %tmp11 ; [#uses=1] - br label %cond_next - -cond_next: ; preds = %cond_true7, %cond_true5 - %ext_addr.0 = phi i8** [ %ext, %cond_true5 ], [ %tmp12, %cond_true7 ] ; [#uses=2] - icmp eq %struct.zzip_plugin_io* %io, null ; :3 [#uses=1] - br i1 %3, label %cond_true14, label %cond_next22 - -cond_true14: ; preds = %cond_next - %tmp16 = getelementptr %struct.ZZIP_FILE* %stream, i32 0, i32 0 ; <%struct.zzip_dir**> [#uses=1] - %tmp17 = load %struct.zzip_dir** %tmp16 ; <%struct.zzip_dir*> [#uses=1] - %tmp18 = getelementptr %struct.zzip_dir* %tmp17, i32 0, i32 11 ; <%struct.zzip_plugin_io**> [#uses=1] - %tmp19 = load %struct.zzip_plugin_io** %tmp18 ; <%struct.zzip_plugin_io*> [#uses=1] - br label %cond_next22 - -cond_next22: ; preds = %cond_true14, %cond_next, %cond_true, %entry - %io_addr.0 = phi %struct.zzip_plugin_io* [ %io, %entry ], [ %io, %cond_true ], [ %io, %cond_next ], [ %tmp19, %cond_true14 ] ; <%struct.zzip_plugin_io*> [#uses=2] - %ext_addr.1 = phi i8** [ %ext, %entry ], [ %ext, %cond_true ], [ %ext_addr.0, %cond_next ], [ %ext_addr.0, %cond_true14 ] ; [#uses=2] - icmp eq %struct.zzip_plugin_io* %io_addr.0, null ; :4 [#uses=1] - br i1 %4, label %cond_true24, label %cond_next26 - -cond_true24: ; preds = %cond_next22 - %tmp25 = call %struct.zzip_plugin_io* @zzip_get_default_io( ) ; <%struct.zzip_plugin_io*> [#uses=1] - br label %cond_next26 - -cond_next26: ; preds = %cond_true24, %cond_next22 - %io_addr.1 = phi %struct.zzip_plugin_io* [ %io_addr.0, %cond_next22 ], [ %tmp25, %cond_true24 ] ; <%struct.zzip_plugin_io*> [#uses=4] - %tmp28 = and i32 %o_modes, 81920 ; [#uses=1] - icmp eq i32 %tmp28, 0 ; :5 [#uses=1] - br i1 %5, label %try_real, label %try_zzip - -try_real: ; preds = %bb223, %cond_next26 - %fd160.2 = phi i32 [ undef, %cond_next26 ], [ %fd160.0, %bb223 ] ; [#uses=1] - %len.2 = phi i32 [ undef, %cond_next26 ], [ %len.0, %bb223 ] ; [#uses=1] - %o_flags_addr.1 = phi i32 [ %o_flags, %cond_next26 ], [ %o_flags_addr.0, %bb223 ] ; [#uses=2] - %tmp33348 = and i32 %o_modes, 262144 ; [#uses=1] - icmp eq i32 %tmp33348, 0 ; :6 [#uses=1] - br i1 %6, label %cond_next38, label %cond_true35 - -cond_true35: ; preds = %try_real - %tmp36 = call %struct.zzip_plugin_io* @zzip_get_default_io( ) ; <%struct.zzip_plugin_io*> [#uses=1] - br label %cond_next38 - -cond_next38: ; preds = %cond_true35, %try_real - %iftmp.21.0 = phi %struct.zzip_plugin_io* [ %tmp36, %cond_true35 ], [ %io_addr.1, %try_real ] ; <%struct.zzip_plugin_io*> [#uses=3] - %tmp41 = getelementptr %struct.zzip_plugin_io* %iftmp.21.0, i32 0, i32 0 ; [#uses=1] - %tmp42 = load i32 (i8*, i32, ...)** %tmp41 ; [#uses=1] - %tmp45 = call i32 (i8*, i32, ...)* %tmp42( i8* %filename, i32 %o_flags_addr.1 ) ; [#uses=3] - icmp eq i32 %tmp45, -1 ; :7 [#uses=1] - br i1 %7, label %cond_next67, label %cond_true47 - -cond_true47: ; preds = %cond_next38 - %tmp48 = call i8* @cli_calloc( i32 1, i32 108 ) ; [#uses=2] - %tmp4849 = bitcast i8* %tmp48 to %struct.ZZIP_FILE* ; <%struct.ZZIP_FILE*> [#uses=3] - icmp eq i8* %tmp48, null ; :8 [#uses=1] - br i1 %8, label %cond_true51, label %cond_next58 - -cond_true51: ; preds = %cond_true47 - %tmp53 = getelementptr %struct.zzip_plugin_io* %iftmp.21.0, i32 0, i32 1 ; [#uses=1] - %tmp54 = load i32 (i32)** %tmp53 ; [#uses=1] - %tmp56 = call i32 %tmp54( i32 %tmp45 ) ; [#uses=0] - ret %struct.ZZIP_FILE* null - -cond_next58: ; preds = %cond_true47 - %tmp60 = getelementptr %struct.ZZIP_FILE* %tmp4849, i32 0, i32 1 ; [#uses=1] - store i32 %tmp45, i32* %tmp60 - %tmp63 = getelementptr %struct.ZZIP_FILE* %tmp4849, i32 0, i32 11 ; <%struct.zzip_plugin_io**> [#uses=1] - store %struct.zzip_plugin_io* %iftmp.21.0, %struct.zzip_plugin_io** %tmp63 - ret %struct.ZZIP_FILE* %tmp4849 - -cond_next67: ; preds = %cond_next38 - %tmp70716 = and i32 %o_modes, 16384 ; [#uses=1] - icmp eq i32 %tmp70716, 0 ; :9 [#uses=1] - br i1 %9, label %try_zzip, label %return - -try_zzip: ; preds = %cond_next67, %cond_next26 - %fd160.3 = phi i32 [ %fd160.2, %cond_next67 ], [ undef, %cond_next26 ] ; [#uses=6] - %len.3 = phi i32 [ %len.2, %cond_next67 ], [ undef, %cond_next26 ] ; [#uses=3] - %o_flags_addr.3 = phi i32 [ %o_flags_addr.1, %cond_next67 ], [ %o_flags, %cond_next26 ] ; [#uses=4] - %tmp76 = and i32 %o_flags_addr.3, 513 ; [#uses=1] - icmp eq i32 %tmp76, 0 ; :10 [#uses=1] - br i1 %10, label %cond_next80, label %cond_true77 - -cond_true77: ; preds = %try_zzip - %tmp78 = call i32* @__error( ) ; [#uses=1] - store i32 22, i32* %tmp78 - ret %struct.ZZIP_FILE* null - -cond_next80: ; preds = %try_zzip - %tmp83844 = and i32 %o_flags_addr.3, 2 ; [#uses=1] - icmp eq i32 %tmp83844, 0 ; :11 [#uses=1] - %tmp87 = xor i32 %o_flags_addr.3, 2 ; [#uses=1] - %o_flags_addr.0 = select i1 %11, i32 %o_flags_addr.3, i32 %tmp87 ; [#uses=2] - %basename90 = getelementptr [1024 x i8]* %basename, i32 0, i32 0 ; [#uses=1] - %tmp92 = call i8* @strcpy( i8* %basename90, i8* %filename ) ; [#uses=0] - icmp eq %struct.ZZIP_FILE* %stream, null ; :12 [#uses=1] - br i1 %12, label %bb219, label %cond_true94 - -cond_true94: ; preds = %cond_next80 - %tmp96 = getelementptr %struct.ZZIP_FILE* %stream, i32 0, i32 0 ; <%struct.zzip_dir**> [#uses=1] - %tmp97 = load %struct.zzip_dir** %tmp96 ; <%struct.zzip_dir*> [#uses=1] - icmp eq %struct.zzip_dir* %tmp97, null ; :13 [#uses=1] - br i1 %13, label %bb219, label %cond_true98 - -cond_true98: ; preds = %cond_true94 - %tmp100 = getelementptr %struct.ZZIP_FILE* %stream, i32 0, i32 0 ; <%struct.zzip_dir**> [#uses=1] - %tmp101 = load %struct.zzip_dir** %tmp100 ; <%struct.zzip_dir*> [#uses=1] - %tmp102 = getelementptr %struct.zzip_dir* %tmp101, i32 0, i32 9 ; [#uses=1] - %tmp103 = load i8** %tmp102 ; [#uses=1] - icmp eq i8* %tmp103, null ; :14 [#uses=1] - br i1 %14, label %bb219, label %cond_true104 - -cond_true104: ; preds = %cond_true98 - %tmp106 = getelementptr %struct.ZZIP_FILE* %stream, i32 0, i32 0 ; <%struct.zzip_dir**> [#uses=1] - %tmp107 = load %struct.zzip_dir** %tmp106 ; <%struct.zzip_dir*> [#uses=1] - %tmp108 = getelementptr %struct.zzip_dir* %tmp107, i32 0, i32 9 ; [#uses=1] - %tmp109 = load i8** %tmp108 ; [#uses=1] - %tmp110 = call i32 @strlen( i8* %tmp109 ) ; [#uses=7] - %tmp112 = getelementptr %struct.ZZIP_FILE* %stream, i32 0, i32 0 ; <%struct.zzip_dir**> [#uses=1] - %tmp113 = load %struct.zzip_dir** %tmp112 ; <%struct.zzip_dir*> [#uses=1] - %tmp114 = getelementptr %struct.zzip_dir* %tmp113, i32 0, i32 9 ; [#uses=1] - %tmp115 = load i8** %tmp114 ; [#uses=1] - %tmp118 = call i32 @memcmp( i8* %filename, i8* %tmp115, i32 %tmp110 ) ; [#uses=1] - icmp eq i32 %tmp118, 0 ; :15 [#uses=1] - br i1 %15, label %cond_true119, label %bb219 - -cond_true119: ; preds = %cond_true104 - %tmp122 = getelementptr i8* %filename, i32 %tmp110 ; [#uses=1] - %tmp123 = load i8* %tmp122 ; [#uses=1] - icmp eq i8 %tmp123, 47 ; :16 [#uses=1] - br i1 %16, label %cond_true124, label %bb219 - -cond_true124: ; preds = %cond_true119 - %tmp126 = add i32 %tmp110, 1 ; [#uses=1] - %tmp128 = getelementptr i8* %filename, i32 %tmp126 ; [#uses=1] - %tmp129 = load i8* %tmp128 ; [#uses=1] - icmp eq i8 %tmp129, 0 ; :17 [#uses=1] - br i1 %17, label %bb219, label %cond_true130 - -cond_true130: ; preds = %cond_true124 - %tmp134.sum = add i32 %tmp110, 1 ; [#uses=1] - %tmp135 = getelementptr i8* %filename, i32 %tmp134.sum ; [#uses=1] - %tmp137 = getelementptr %struct.ZZIP_FILE* %stream, i32 0, i32 0 ; <%struct.zzip_dir**> [#uses=1] - %tmp138 = load %struct.zzip_dir** %tmp137 ; <%struct.zzip_dir*> [#uses=1] - %tmp140 = call %struct.ZZIP_FILE* @zzip_file_open( %struct.zzip_dir* %tmp138, i8* %tmp135, i32 %o_modes, i32 -1 ) ; <%struct.ZZIP_FILE*> [#uses=3] - icmp eq %struct.ZZIP_FILE* %tmp140, null ; :18 [#uses=1] - br i1 %18, label %cond_true142, label %return - -cond_true142: ; preds = %cond_true130 - %tmp144 = getelementptr %struct.ZZIP_FILE* %stream, i32 0, i32 0 ; <%struct.zzip_dir**> [#uses=1] - %tmp145 = load %struct.zzip_dir** %tmp144 ; <%struct.zzip_dir*> [#uses=1] - %tmp146 = getelementptr %struct.zzip_dir* %tmp145, i32 0, i32 1 ; [#uses=1] - %tmp147 = load i32* %tmp146 ; [#uses=1] - %tmp148 = call i32 @zzip_errno( i32 %tmp147 ) ; [#uses=1] - %tmp149 = call i32* @__error( ) ; [#uses=1] - store i32 %tmp148, i32* %tmp149 - ret %struct.ZZIP_FILE* %tmp140 - -bb: ; preds = %bb219 - store i32 0, i32* %e - store i8 0, i8* %tmp221 - %basename162 = getelementptr [1024 x i8]* %basename, i32 0, i32 0 ; [#uses=1] - %tmp166 = call i32 @__zzip_try_open( i8* %basename162, i32 %o_flags_addr.0, i8** %ext_addr.1, %struct.zzip_plugin_io* %io_addr.1 ) ; [#uses=4] - icmp eq i32 %tmp166, -1 ; :19 [#uses=1] - br i1 %19, label %bb219, label %cond_next169 - -cond_next169: ; preds = %bb - %tmp173 = call %struct.zzip_dir* @zzip_dir_fdopen_ext_io( i32 %tmp166, i32* %e, i8** %ext_addr.1, %struct.zzip_plugin_io* %io_addr.1 ) ; <%struct.zzip_dir*> [#uses=7] - %tmp174 = load i32* %e ; [#uses=1] - icmp eq i32 %tmp174, 0 ; :20 [#uses=1] - br i1 %20, label %cond_next185, label %cond_true175 - -cond_true175: ; preds = %cond_next169 - %tmp176 = load i32* %e ; [#uses=1] - %tmp177 = call i32 @zzip_errno( i32 %tmp176 ) ; [#uses=1] - %tmp178 = call i32* @__error( ) ; [#uses=1] - store i32 %tmp177, i32* %tmp178 - %tmp180 = getelementptr %struct.zzip_plugin_io* %io_addr.1, i32 0, i32 1 ; [#uses=1] - %tmp181 = load i32 (i32)** %tmp180 ; [#uses=1] - %tmp183 = call i32 %tmp181( i32 %tmp166 ) ; [#uses=0] - ret %struct.ZZIP_FILE* null - -cond_next185: ; preds = %cond_next169 - %tmp186187 = ptrtoint i8* %tmp221 to i32 ; [#uses=1] - %basename188189 = ptrtoint [1024 x i8]* %basename to i32 ; [#uses=1] - %tmp190 = sub i32 %tmp186187, %basename188189 ; [#uses=1] - %tmp192.sum = add i32 %tmp190, 1 ; [#uses=1] - %tmp193 = getelementptr i8* %filename, i32 %tmp192.sum ; [#uses=1] - %tmp196 = call %struct.ZZIP_FILE* @zzip_file_open( %struct.zzip_dir* %tmp173, i8* %tmp193, i32 %o_modes, i32 -1 ) ; <%struct.ZZIP_FILE*> [#uses=4] - icmp eq %struct.ZZIP_FILE* %tmp196, null ; :21 [#uses=1] - br i1 %21, label %cond_true198, label %cond_false204 - -cond_true198: ; preds = %cond_next185 - %tmp200 = getelementptr %struct.zzip_dir* %tmp173, i32 0, i32 1 ; [#uses=1] - %tmp201 = load i32* %tmp200 ; [#uses=1] - %tmp202 = call i32 @zzip_errno( i32 %tmp201 ) ; [#uses=1] - %tmp203 = call i32* @__error( ) ; [#uses=1] - store i32 %tmp202, i32* %tmp203 - %tmp2169 = call i32 @zzip_dir_close( %struct.zzip_dir* %tmp173 ) ; [#uses=0] - ret %struct.ZZIP_FILE* %tmp196 - -cond_false204: ; preds = %cond_next185 - %tmp206 = getelementptr %struct.zzip_dir* %tmp173, i32 0, i32 9 ; [#uses=1] - %tmp207 = load i8** %tmp206 ; [#uses=1] - icmp eq i8* %tmp207, null ; :22 [#uses=1] - br i1 %22, label %cond_true208, label %cond_next214 - -cond_true208: ; preds = %cond_false204 - %basename209 = getelementptr [1024 x i8]* %basename, i32 0, i32 0 ; [#uses=1] - %tmp210 = call i8* @strdup( i8* %basename209 ) ; [#uses=1] - %tmp212 = getelementptr %struct.zzip_dir* %tmp173, i32 0, i32 9 ; [#uses=1] - store i8* %tmp210, i8** %tmp212 - %tmp21610 = call i32 @zzip_dir_close( %struct.zzip_dir* %tmp173 ) ; [#uses=0] - ret %struct.ZZIP_FILE* %tmp196 - -cond_next214: ; preds = %cond_false204 - %tmp216 = call i32 @zzip_dir_close( %struct.zzip_dir* %tmp173 ) ; [#uses=0] - ret %struct.ZZIP_FILE* %tmp196 - -bb219: ; preds = %bb, %cond_true124, %cond_true119, %cond_true104, %cond_true98, %cond_true94, %cond_next80 - %fd160.0 = phi i32 [ %fd160.3, %cond_next80 ], [ %tmp166, %bb ], [ %fd160.3, %cond_true94 ], [ %fd160.3, %cond_true98 ], [ %fd160.3, %cond_true104 ], [ %fd160.3, %cond_true119 ], [ %fd160.3, %cond_true124 ] ; [#uses=1] - %len.0 = phi i32 [ %len.3, %cond_next80 ], [ %len.0, %bb ], [ %len.3, %cond_true94 ], [ %len.3, %cond_true98 ], [ %tmp110, %cond_true104 ], [ %tmp110, %cond_true119 ], [ %tmp110, %cond_true124 ] ; [#uses=2] - %basename220 = getelementptr [1024 x i8]* %basename, i32 0, i32 0 ; [#uses=1] - %tmp221 = call i8* @strrchr( i8* %basename220, i32 47 ) ; [#uses=3] - icmp eq i8* %tmp221, null ; :23 [#uses=1] - br i1 %23, label %bb223, label %bb - -bb223: ; preds = %bb219 - %tmp2262272 = and i32 %o_modes, 16384 ; [#uses=1] - icmp eq i32 %tmp2262272, 0 ; :24 [#uses=1] - br i1 %24, label %cond_next229, label %try_real - -cond_next229: ; preds = %bb223 - %tmp230 = call i32* @__error( ) ; [#uses=1] - store i32 2, i32* %tmp230 - ret %struct.ZZIP_FILE* null - -return: ; preds = %cond_true130, %cond_next67 - %retval.0 = phi %struct.ZZIP_FILE* [ null, %cond_next67 ], [ %tmp140, %cond_true130 ] ; <%struct.ZZIP_FILE*> [#uses=1] - ret %struct.ZZIP_FILE* %retval.0 -} - -declare i32 @zzip_dir_close(%struct.zzip_dir*) - -declare i8* @strrchr(i8*, i32) - -declare %struct.ZZIP_FILE* @zzip_file_open(%struct.zzip_dir*, i8*, i32, i32) - -declare i8* @cli_calloc(i32, i32) - -declare i32 @zzip_errno(i32) - -declare i32* @__error() - -declare %struct.zzip_plugin_io* @zzip_get_default_io() - -declare i8* @strcpy(i8*, i8*) - -declare i32 @strlen(i8*) - -declare i32 @memcmp(i8*, i8*, i32) - -declare i32 @__zzip_try_open(i8*, i32, i8**, %struct.zzip_plugin_io*) - -declare %struct.zzip_dir* @zzip_dir_fdopen_ext_io(i32, i32*, i8**, %struct.zzip_plugin_io*) - -declare i8* @strdup(i8*) diff --git a/libclamav/c++/llvm/test/Transforms/InstCombine/2007-09-05-EqualGEP.ll b/libclamav/c++/llvm/test/Transforms/InstCombine/2007-09-05-EqualGEP.ll deleted file mode 100644 index 77bae78cc..000000000 --- a/libclamav/c++/llvm/test/Transforms/InstCombine/2007-09-05-EqualGEP.ll +++ /dev/null @@ -1,10 +0,0 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {ret i1 true} -; PR1637 - -define i1 @f(i8* %arr) { - %X = getelementptr i8* %arr, i32 1 - %Y = getelementptr i8* %arr, i32 1 - %test = icmp uge i8* %X, %Y - ret i1 %test -} - diff --git a/libclamav/c++/llvm/test/Transforms/InstCombine/2007-10-28-EmptyField.ll b/libclamav/c++/llvm/test/Transforms/InstCombine/2007-10-28-EmptyField.ll deleted file mode 100644 index 31ae985a6..000000000 --- a/libclamav/c++/llvm/test/Transforms/InstCombine/2007-10-28-EmptyField.ll +++ /dev/null @@ -1,24 +0,0 @@ -; RUN: llvm-as < %s | opt -instcombine -disable-output -; PR1749 - -target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128" -target triple = "x86_64-unknown-linux-gnu" - %struct.__large_struct = type { [100 x i64] } - %struct.compat_siginfo = type { i32, i32, i32, { [29 x i32] } } - %struct.siginfo_t = type { i32, i32, i32, { { i32, i32, [0 x i8], %struct.sigval_t, i32 }, [88 x i8] } } - %struct.sigval_t = type { i8* } - -define i32 @copy_siginfo_to_user32(%struct.compat_siginfo* %to, %struct.siginfo_t* %from) { -entry: - %from_addr = alloca %struct.siginfo_t* ; <%struct.siginfo_t**> [#uses=1] - %tmp344 = load %struct.siginfo_t** %from_addr, align 8 ; <%struct.siginfo_t*> [#uses=1] - %tmp345 = getelementptr %struct.siginfo_t* %tmp344, i32 0, i32 3 ; <{ { i32, i32, [0 x i8], %struct.sigval_t, i32 }, [88 x i8] }*> [#uses=1] - %tmp346 = getelementptr { { i32, i32, [0 x i8], %struct.sigval_t, i32 }, [88 x i8] }* %tmp345, i32 0, i32 0 ; <{ i32, i32, [0 x i8], %struct.sigval_t, i32 }*> [#uses=1] - %tmp346347 = bitcast { i32, i32, [0 x i8], %struct.sigval_t, i32 }* %tmp346 to { i32, i32, %struct.sigval_t }* ; <{ i32, i32, %struct.sigval_t }*> [#uses=1] - %tmp348 = getelementptr { i32, i32, %struct.sigval_t }* %tmp346347, i32 0, i32 2 ; <%struct.sigval_t*> [#uses=1] - %tmp349 = getelementptr %struct.sigval_t* %tmp348, i32 0, i32 0 ; [#uses=1] - %tmp349350 = bitcast i8** %tmp349 to i32* ; [#uses=1] - %tmp351 = load i32* %tmp349350, align 8 ; [#uses=1] - %tmp360 = call i32 asm sideeffect "1:\09movl ${1:k},$2\0A2:\0A.section .fixup,\22ax\22\0A3:\09mov $3,$0\0A\09jmp 2b\0A.previous\0A.section __ex_table,\22a\22\0A\09.align 8\0A\09.quad 1b,3b\0A.previous", "=r,ir,*m,i,0,~{dirflag},~{fpsr},~{flags}"( i32 %tmp351, %struct.__large_struct* null, i32 -14, i32 0 ) ; [#uses=0] - unreachable -} diff --git a/libclamav/c++/llvm/test/Transforms/InstCombine/2008-02-04-GEPIdxBug.ll b/libclamav/c++/llvm/test/Transforms/InstCombine/2008-02-04-GEPIdxBug.ll deleted file mode 100644 index 064fbd13f..000000000 --- a/libclamav/c++/llvm/test/Transforms/InstCombine/2008-02-04-GEPIdxBug.ll +++ /dev/null @@ -1,33 +0,0 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {icmp eq i32 %indvar, 0} -; PR1978 -target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" -target triple = "i686-apple-darwin8" - %struct.x = type <{ i8 }> -@.str = internal constant [6 x i8] c"Main!\00" ; <[6 x i8]*> [#uses=1] -@.str1 = internal constant [12 x i8] c"destroy %p\0A\00" ; <[12 x i8]*> [#uses=1] - -define i32 @main() nounwind { -entry: - %orientations = alloca [1 x [1 x %struct.x]] ; <[1 x [1 x %struct.x]]*> [#uses=2] - %tmp3 = call i32 @puts( i8* getelementptr ([6 x i8]* @.str, i32 0, i32 0) ) nounwind ; [#uses=0] - %tmp45 = getelementptr inbounds [1 x [1 x %struct.x]]* %orientations, i32 1, i32 0, i32 0 ; <%struct.x*> [#uses=1] - %orientations62 = getelementptr [1 x [1 x %struct.x]]* %orientations, i32 0, i32 0, i32 0 ; <%struct.x*> [#uses=1] - br label %bb10 - -bb10: ; preds = %bb10, %entry - %indvar = phi i32 [ 0, %entry ], [ %indvar.next, %bb10 ] ; [#uses=2] - %tmp.0.reg2mem.0.rec = mul i32 %indvar, -1 ; [#uses=1] - %tmp12.rec = add i32 %tmp.0.reg2mem.0.rec, -1 ; [#uses=1] - %tmp12 = getelementptr inbounds %struct.x* %tmp45, i32 %tmp12.rec ; <%struct.x*> [#uses=2] - %tmp16 = call i32 (i8*, ...)* @printf( i8* getelementptr ([12 x i8]* @.str1, i32 0, i32 0), %struct.x* %tmp12 ) nounwind ; [#uses=0] - %tmp84 = icmp eq %struct.x* %tmp12, %orientations62 ; [#uses=1] - %indvar.next = add i32 %indvar, 1 ; [#uses=1] - br i1 %tmp84, label %bb17, label %bb10 - -bb17: ; preds = %bb10 - ret i32 0 -} - -declare i32 @puts(i8*) - -declare i32 @printf(i8*, ...) diff --git a/libclamav/c++/llvm/test/Transforms/InstCombine/2009-03-02-VarLengthArrayGEP.ll b/libclamav/c++/llvm/test/Transforms/InstCombine/2009-03-02-VarLengthArrayGEP.ll deleted file mode 100644 index 1e136f5ea..000000000 --- a/libclamav/c++/llvm/test/Transforms/InstCombine/2009-03-02-VarLengthArrayGEP.ll +++ /dev/null @@ -1,14 +0,0 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {getelementptr i32} -; PR3694 - -define i32 @e(i32 %m, i32 %n) nounwind { -entry: - %0 = alloca i32, i32 %n, align 4 ; [#uses=2] - %1 = bitcast i32* %0 to [0 x i32]* ; <[0 x i32]*> [#uses=1] - call void @f(i32* %0) nounwind - %2 = getelementptr [0 x i32]* %1, i32 0, i32 %m ; [#uses=1] - %3 = load i32* %2, align 4 ; [#uses=1] - ret i32 %3 -} - -declare void @f(i32*) diff --git a/libclamav/c++/llvm/test/Transforms/InstCombine/2009-04-06-GEP-Index-Crash.ll b/libclamav/c++/llvm/test/Transforms/InstCombine/2009-04-06-GEP-Index-Crash.ll deleted file mode 100644 index 49e1f0af6..000000000 --- a/libclamav/c++/llvm/test/Transforms/InstCombine/2009-04-06-GEP-Index-Crash.ll +++ /dev/null @@ -1,24 +0,0 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis -; rdar://6762290 - -target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" -target triple = "i386-apple-darwin9" - %T = type <{ i64, i64, i64 }> - -define i32 @test(i8* %start, i32 %X) nounwind { -entry: - %tmp3 = load i64* null ; [#uses=1] - %add.ptr = getelementptr i8* %start, i64 %tmp3 ; [#uses=1] - %tmp158 = load i32* null ; [#uses=1] - %add.ptr159 = getelementptr %T* null, i32 %tmp158 - %add.ptr209 = getelementptr i8* %start, i64 0 ; [#uses=1] - %add.ptr212 = getelementptr i8* %add.ptr209, i32 %X ; [#uses=1] - %cmp214 = icmp ugt i8* %add.ptr212, %add.ptr ; [#uses=1] - br i1 %cmp214, label %if.then216, label %if.end363 - -if.then216: ; preds = %for.body162 - ret i32 1 - -if.end363: ; preds = %for.body162 - ret i32 0 -} diff --git a/libclamav/c++/llvm/test/Transforms/InstCombine/GEPIdxCanon.ll b/libclamav/c++/llvm/test/Transforms/InstCombine/GEPIdxCanon.ll deleted file mode 100644 index f2e5e6745..000000000 --- a/libclamav/c++/llvm/test/Transforms/InstCombine/GEPIdxCanon.ll +++ /dev/null @@ -1,10 +0,0 @@ -; RUN: llvm-as < %s | opt -instcombine -gvn -instcombine | \ -; RUN: llvm-dis | not grep getelementptr - -define i1 @test(i32* %A) { - %B = getelementptr i32* %A, i32 1 ; [#uses=1] - %C = getelementptr i32* %A, i64 1 ; [#uses=1] - %V = icmp eq i32* %B, %C ; [#uses=1] - ret i1 %V -} - diff --git a/libclamav/c++/llvm/test/Transforms/InstCombine/bitcast-gep.ll b/libclamav/c++/llvm/test/Transforms/InstCombine/bitcast-gep.ll deleted file mode 100644 index 2e1f7693f..000000000 --- a/libclamav/c++/llvm/test/Transforms/InstCombine/bitcast-gep.ll +++ /dev/null @@ -1,30 +0,0 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep bitcast -; RUN: llvm-as < %s | opt -instcombine -scalarrepl | llvm-dis | grep {ret i8. %v} -; PR1345 - -target datalayout = "E-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64" -target triple = "powerpc-apple-darwin8.8.0" - -define i8* @test(i8* %v) { - %A = alloca [4 x i8*], align 16 ; <[4 x i8*]*> [#uses=3] - %B = getelementptr [4 x i8*]* %A, i32 0, i32 0 ; [#uses=1] - store i8* null, i8** %B - %C = bitcast [4 x i8*]* %A to { [16 x i8] }* ; <{ [16 x i8] }*> [#uses=1] - %D = getelementptr { [16 x i8] }* %C, i32 0, i32 0, i32 8 ; [#uses=1] - %E = bitcast i8* %D to i8** ; [#uses=1] - store i8* %v, i8** %E - %F = getelementptr [4 x i8*]* %A, i32 0, i32 2 ; [#uses=1] - %G = load i8** %F ; [#uses=1] - ret i8* %G -} - -; PR3290 -%struct.Key = type { { i32, i32 } } -%struct.anon = type <{ i8, [3 x i8], i32 }> - -define i32 *@test2(%struct.Key *%A) { - %B = bitcast %struct.Key* %A to %struct.anon* - %C = getelementptr %struct.anon* %B, i32 0, i32 2 - ret i32 *%C -} - diff --git a/libclamav/c++/llvm/test/Transforms/InstCombine/cast-store-gep.ll b/libclamav/c++/llvm/test/Transforms/InstCombine/cast-store-gep.ll deleted file mode 100644 index 95a069d60..000000000 --- a/libclamav/c++/llvm/test/Transforms/InstCombine/cast-store-gep.ll +++ /dev/null @@ -1,17 +0,0 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep inttoptr -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep alloca - -target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128" -target triple = "x86_64-apple-darwin10.0" - %T = type { i8*, i8 } - -define i8* @test(i8* %Val, i64 %V) nounwind { -entry: - %A = alloca %T, align 8 - %mrv_gep = bitcast %T* %A to i64* ; [#uses=1] - %B = getelementptr %T* %A, i64 0, i32 0 ; [#uses=1] - - store i64 %V, i64* %mrv_gep - %C = load i8** %B, align 8 ; [#uses=1] - ret i8* %C -} diff --git a/libclamav/c++/llvm/test/Transforms/InstCombine/constant-fold-gep-overindex.ll b/libclamav/c++/llvm/test/Transforms/InstCombine/constant-fold-gep-overindex.ll deleted file mode 100644 index 954cccb01..000000000 --- a/libclamav/c++/llvm/test/Transforms/InstCombine/constant-fold-gep-overindex.ll +++ /dev/null @@ -1,33 +0,0 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | FileCheck %s - -target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" -target triple = "i386-apple-darwin10.0" - -%0 = type { i8*, [19 x i8] } -%1 = type { i8*, [0 x i8] } - -@array = external global [11 x i8] - -@s = external global %0 ; <%0*> [#uses=1] -@"\01LC8" = external constant [17 x i8] ; <[17 x i8]*> [#uses=1] - -; Instcombine should be able to fold this getelementptr. - -define i32 @main() nounwind { -; CHECK: call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([17 x i8]* @"\01LC8", i32 0, i32 0), i8* undef, i8* bitcast (i8** getelementptr (%1* bitcast (%0* @s to %1*), i32 1, i32 0) to i8*)) nounwind - - call i32 (i8*, ...)* @printf(i8* getelementptr ([17 x i8]* @"\01LC8", i32 0, i32 0), i8* undef, i8* getelementptr (%1* bitcast (%0* @s to %1*), i32 0, i32 1, i32 0)) nounwind ; [#uses=0] - ret i32 0 -} - -; Instcombine should constant-fold the GEP so that indices that have -; static array extents are within bounds of those array extents. -; In the below, -1 is not in the range [0,11). After the transformation, -; the same address is computed, but 3 is in the range of [0,11). - -define i8* @foo() nounwind { -; CHECK: ret i8* getelementptr ([11 x i8]* @array, i32 390451572, i32 3) - ret i8* getelementptr ([11 x i8]* @array, i32 0, i64 -1) -} - -declare i32 @printf(i8*, ...) nounwind diff --git a/libclamav/c++/llvm/test/Transforms/InstCombine/crash.ll b/libclamav/c++/llvm/test/Transforms/InstCombine/crash.ll new file mode 100644 index 000000000..03bad9924 --- /dev/null +++ b/libclamav/c++/llvm/test/Transforms/InstCombine/crash.ll @@ -0,0 +1,14 @@ +; RUN: llvm-as < %s | opt -instcombine | llvm-dis +target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" +target triple = "i386-apple-darwin10.0" + +define i32 @_Z9model8bitR5Mixeri(i8 %tmp2) ssp { +entry: + %tmp3 = zext i8 %tmp2 to i32 + %tmp8 = lshr i32 %tmp3, 6 + %tmp9 = lshr i32 %tmp3, 7 + %tmp10 = xor i32 %tmp9, 67108858 + %tmp11 = xor i32 %tmp10, %tmp8 + %tmp12 = xor i32 %tmp11, 0 + ret i32 %tmp12 +} diff --git a/libclamav/c++/llvm/test/Transforms/InstCombine/getelementptr-setcc.ll b/libclamav/c++/llvm/test/Transforms/InstCombine/getelementptr-setcc.ll deleted file mode 100644 index c90390ac1..000000000 --- a/libclamav/c++/llvm/test/Transforms/InstCombine/getelementptr-setcc.ll +++ /dev/null @@ -1,31 +0,0 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \ -; RUN: not grep getelementptr - -define i1 @test1(i16* %P, i32 %I, i32 %J) { - %X = getelementptr inbounds i16* %P, i32 %I ; [#uses=1] - %Y = getelementptr inbounds i16* %P, i32 %J ; [#uses=1] - %C = icmp ult i16* %X, %Y ; [#uses=1] - ret i1 %C -} - -define i1 @test2(i16* %P, i32 %I) { - %X = getelementptr inbounds i16* %P, i32 %I ; [#uses=1] - %C = icmp ult i16* %X, %P ; [#uses=1] - ret i1 %C -} - -define i32 @test3(i32* %P, i32 %A, i32 %B) { - %tmp.4 = getelementptr inbounds i32* %P, i32 %A ; [#uses=1] - %tmp.9 = getelementptr inbounds i32* %P, i32 %B ; [#uses=1] - %tmp.10 = icmp eq i32* %tmp.4, %tmp.9 ; [#uses=1] - %tmp.11 = zext i1 %tmp.10 to i32 ; [#uses=1] - ret i32 %tmp.11 -} - -define i32 @test4(i32* %P, i32 %A, i32 %B) { - %tmp.4 = getelementptr inbounds i32* %P, i32 %A ; [#uses=1] - %tmp.6 = icmp eq i32* %tmp.4, %P ; [#uses=1] - %tmp.7 = zext i1 %tmp.6 to i32 ; [#uses=1] - ret i32 %tmp.7 -} - diff --git a/libclamav/c++/llvm/test/Transforms/InstCombine/getelementptr-seteq.ll b/libclamav/c++/llvm/test/Transforms/InstCombine/getelementptr-seteq.ll deleted file mode 100644 index 2cd6f77b8..000000000 --- a/libclamav/c++/llvm/test/Transforms/InstCombine/getelementptr-seteq.ll +++ /dev/null @@ -1,13 +0,0 @@ -; Test folding of constantexpr geps into normal geps. -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {icmp eq i64 %X, -1} -; PR2235 - -%S = type { i32, [ 100 x i32] } - -define i1 @test(i64 %X, %S* %P) { - %A = getelementptr inbounds %S* %P, i32 0, i32 1, i64 %X - %B = getelementptr inbounds %S* %P, i32 0, i32 0 - %C = icmp eq i32* %A, %B - ret i1 %C -} - diff --git a/libclamav/c++/llvm/test/Transforms/InstCombine/getelementptr.ll b/libclamav/c++/llvm/test/Transforms/InstCombine/getelementptr.ll index c2cb72080..7bc08d046 100644 --- a/libclamav/c++/llvm/test/Transforms/InstCombine/getelementptr.ll +++ b/libclamav/c++/llvm/test/Transforms/InstCombine/getelementptr.ll @@ -1,81 +1,461 @@ -; The %A getelementptr instruction should be eliminated here +; RUN: llvm-as < %s | opt -instcombine | llvm-dis | FileCheck %s -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \ -; RUN: grep -v %B | not grep getelementptr -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep foo1 -; END. +target datalayout = "e-p:64:64" +%intstruct = type { i32 } +%pair = type { i32, i32 } +%struct.B = type { double } +%struct.A = type { %struct.B, i32, i32 } -@Global = constant [10 x i8] c"helloworld" ; <[10 x i8]*> [#uses=1] + +@Global = constant [10 x i8] c"helloworld" ; Test noop elimination -define i32* @foo1(i32* %I) { - %A = getelementptr i32* %I, i64 0 ; [#uses=1] +define i32* @test1(i32* %I) { + %A = getelementptr i32* %I, i64 0 ret i32* %A +; CHECK: @test1 +; CHECK: ret i32* %I } ; Test noop elimination -define i32* @foo2(i32* %I) { - %A = getelementptr i32* %I ; [#uses=1] +define i32* @test2(i32* %I) { + %A = getelementptr i32* %I ret i32* %A +; CHECK: @test2 +; CHECK: ret i32* %I } ; Test that two array indexing geps fold -define i32* @foo3(i32* %I) { - %A = getelementptr i32* %I, i64 17 ; [#uses=1] - %B = getelementptr i32* %A, i64 4 ; [#uses=1] +define i32* @test3(i32* %I) { + %A = getelementptr i32* %I, i64 17 + %B = getelementptr i32* %A, i64 4 ret i32* %B +; CHECK: @test3 +; CHECK: getelementptr i32* %I, i64 21 } ; Test that two getelementptr insts fold -define i32* @foo4({ i32 }* %I) { - %A = getelementptr { i32 }* %I, i64 1 ; <{ i32 }*> [#uses=1] - %B = getelementptr { i32 }* %A, i64 0, i32 0 ; [#uses=1] +define i32* @test4({ i32 }* %I) { + %A = getelementptr { i32 }* %I, i64 1 + %B = getelementptr { i32 }* %A, i64 0, i32 0 ret i32* %B +; CHECK: @test4 +; CHECK: getelementptr %intstruct* %I, i64 1, i32 0 } -define void @foo5(i8 %B) { +define void @test5(i8 %B) { ; This should be turned into a constexpr instead of being an instruction - %A = getelementptr [10 x i8]* @Global, i64 0, i64 4 ; [#uses=1] + %A = getelementptr [10 x i8]* @Global, i64 0, i64 4 store i8 %B, i8* %A ret void +; CHECK: @test5 +; CHECK: store i8 %B, i8* getelementptr inbounds ([10 x i8]* @Global, i64 0, i64 4) } -define i32* @foo6() { - %M = malloc [4 x i32] ; <[4 x i32]*> [#uses=1] - %A = getelementptr [4 x i32]* %M, i64 0, i64 0 ; [#uses=1] - %B = getelementptr i32* %A, i64 2 ; [#uses=1] +define i32* @test6() { + %M = malloc [4 x i32] + %A = getelementptr [4 x i32]* %M, i64 0, i64 0 + %B = getelementptr i32* %A, i64 2 ret i32* %B +; CHECK: @test6 +; CHECK: getelementptr [4 x i32]* %M, i64 0, i64 2 } -define i32* @foo7(i32* %I, i64 %C, i64 %D) { - %A = getelementptr i32* %I, i64 %C ; [#uses=1] - %B = getelementptr i32* %A, i64 %D ; [#uses=1] +define i32* @test7(i32* %I, i64 %C, i64 %D) { + %A = getelementptr i32* %I, i64 %C + %B = getelementptr i32* %A, i64 %D ret i32* %B +; CHECK: @test7 +; CHECK: %A.sum = add i64 %C, %D +; CHECK: getelementptr i32* %I, i64 %A.sum } -define i8* @foo8([10 x i32]* %X) { +define i8* @test8([10 x i32]* %X) { ;; Fold into the cast. - %A = getelementptr [10 x i32]* %X, i64 0, i64 0 ; [#uses=1] - %B = bitcast i32* %A to i8* ; [#uses=1] + %A = getelementptr [10 x i32]* %X, i64 0, i64 0 + %B = bitcast i32* %A to i8* ret i8* %B +; CHECK: @test8 +; CHECK: bitcast [10 x i32]* %X to i8* } define i32 @test9() { - %A = getelementptr { i32, double }* null, i32 0, i32 1 ; [#uses=1] - %B = ptrtoint double* %A to i32 ; [#uses=1] + %A = getelementptr { i32, double }* null, i32 0, i32 1 + %B = ptrtoint double* %A to i32 ret i32 %B +; CHECK: @test9 +; CHECK: ret i32 8 } define i1 @test10({ i32, i32 }* %x, { i32, i32 }* %y) { - %tmp.1 = getelementptr { i32, i32 }* %x, i32 0, i32 1 ; [#uses=1] - %tmp.3 = getelementptr { i32, i32 }* %y, i32 0, i32 1 ; [#uses=1] + %tmp.1 = getelementptr { i32, i32 }* %x, i32 0, i32 1 + %tmp.3 = getelementptr { i32, i32 }* %y, i32 0, i32 1 ;; seteq x, y - %tmp.4 = icmp eq i32* %tmp.1, %tmp.3 ; [#uses=1] + %tmp.4 = icmp eq i32* %tmp.1, %tmp.3 ret i1 %tmp.4 +; CHECK: @test10 +; CHECK: icmp eq %pair* %x, %y } define i1 @test11({ i32, i32 }* %X) { - %P = getelementptr { i32, i32 }* %X, i32 0, i32 0 ; [#uses=1] - %Q = icmp eq i32* %P, null ; [#uses=1] + %P = getelementptr { i32, i32 }* %X, i32 0, i32 0 + %Q = icmp eq i32* %P, null ret i1 %Q +; CHECK: @test11 +; CHECK: icmp eq %pair* %X, null } + + +; PR4748 +define i32 @test12(%struct.A* %a) { +entry: + %g3 = getelementptr %struct.A* %a, i32 0, i32 1 + store i32 10, i32* %g3, align 4 + + %g4 = getelementptr %struct.A* %a, i32 0, i32 0 + + %new_a = bitcast %struct.B* %g4 to %struct.A* + + %g5 = getelementptr %struct.A* %new_a, i32 0, i32 1 + %a_a = load i32* %g5, align 4 + ret i32 %a_a +; CHECK: @test12 +; CHECK: getelementptr %struct.A* %a, i64 0, i32 1 +; CHECK-NEXT: store i32 10, i32* %g3 +; CHECK-NEXT: ret i32 10 +} + + +; PR2235 +%S = type { i32, [ 100 x i32] } +define i1 @test13(i64 %X, %S* %P) { + %A = getelementptr inbounds %S* %P, i32 0, i32 1, i64 %X + %B = getelementptr inbounds %S* %P, i32 0, i32 0 + %C = icmp eq i32* %A, %B + ret i1 %C +; CHECK: @test13 +; CHECK: %C = icmp eq i64 %X, -1 +} + + +@G = external global [3 x i8] +define i8* @test14(i32 %Idx) { + %idx = zext i32 %Idx to i64 + %tmp = getelementptr i8* getelementptr ([3 x i8]* @G, i32 0, i32 0), i64 %idx + ret i8* %tmp +; CHECK: @test14 +; CHECK: getelementptr [3 x i8]* @G, i64 0, i64 %idx +} + + +; Test folding of constantexpr geps into normal geps. +@Array = external global [40 x i32] +define i32 *@test15(i64 %X) { + %A = getelementptr i32* getelementptr ([40 x i32]* @Array, i64 0, i64 0), i64 %X + ret i32* %A +; CHECK: @test15 +; CHECK: getelementptr [40 x i32]* @Array, i64 0, i64 %X +} + + +define i32* @test16(i32* %X, i32 %Idx) { + %R = getelementptr i32* %X, i32 %Idx + ret i32* %R +; CHECK: @test16 +; CHECK: sext i32 %Idx to i64 +} + + +define i1 @test17(i16* %P, i32 %I, i32 %J) { + %X = getelementptr inbounds i16* %P, i32 %I + %Y = getelementptr inbounds i16* %P, i32 %J + %C = icmp ult i16* %X, %Y + ret i1 %C +; CHECK: @test17 +; CHECK: %C = icmp slt i32 %I, %J +} + +define i1 @test18(i16* %P, i32 %I) { + %X = getelementptr inbounds i16* %P, i32 %I + %C = icmp ult i16* %X, %P + ret i1 %C +; CHECK: @test18 +; CHECK: %C = icmp slt i32 %I, 0 +} + +define i32 @test19(i32* %P, i32 %A, i32 %B) { + %tmp.4 = getelementptr inbounds i32* %P, i32 %A + %tmp.9 = getelementptr inbounds i32* %P, i32 %B + %tmp.10 = icmp eq i32* %tmp.4, %tmp.9 + %tmp.11 = zext i1 %tmp.10 to i32 + ret i32 %tmp.11 +; CHECK: @test19 +; CHECK: icmp eq i32 %A, %B +} + +define i32 @test20(i32* %P, i32 %A, i32 %B) { + %tmp.4 = getelementptr inbounds i32* %P, i32 %A + %tmp.6 = icmp eq i32* %tmp.4, %P + %tmp.7 = zext i1 %tmp.6 to i32 + ret i32 %tmp.7 +; CHECK: @test20 +; CHECK: icmp eq i32 %A, 0 +} + + +define i32 @test21() { + %pbob1 = alloca %intstruct + %pbob2 = getelementptr %intstruct* %pbob1 + %pbobel = getelementptr %intstruct* %pbob2, i64 0, i32 0 + %rval = load i32* %pbobel + ret i32 %rval +; CHECK: @test21 +; CHECK: getelementptr %intstruct* %pbob1, i64 0, i32 0 +} + + +@A = global i32 1 ; [#uses=1] +@B = global i32 2 ; [#uses=1] + +define i1 @test22() { + %C = icmp ult i32* getelementptr (i32* @A, i64 1), + getelementptr (i32* @B, i64 2) + ret i1 %C +; CHECK: @test22 +; CHECK: icmp ult (i32* getelementptr (i32* @A, i64 1), i32* getelementptr (i32* @B, i64 2)) +} + + +%X = type { [10 x i32], float } + +define i1 @test23() { + %A = getelementptr %X* null, i64 0, i32 0, i64 0 ; [#uses=1] + %B = icmp ne i32* %A, null ; [#uses=1] + ret i1 %B +; CHECK: @test23 +; CHECK: ret i1 false +} + +%"java/lang/Object" = type { %struct.llvm_java_object_base } +%"java/lang/StringBuffer" = type { %"java/lang/Object", i32, { %"java/lang/Object", i32, [0 x i16] }*, i1 } +%struct.llvm_java_object_base = type opaque + +define void @test24() { +bc0: + %tmp53 = getelementptr %"java/lang/StringBuffer"* null, i32 0, i32 1 ; [#uses=1] + store i32 0, i32* %tmp53 + ret void +; CHECK: @test24 +; CHECK: store i32 0, i32* getelementptr (%"java/lang/StringBuffer"* null, i32 0, i32 1) +} + +define void @test25() { +entry: + %tmp = getelementptr { i64, i64, i64, i64 }* null, i32 0, i32 3 ; [#uses=1] + %tmp.upgrd.1 = load i64* %tmp ; [#uses=1] + %tmp8.ui = load i64* null ; [#uses=1] + %tmp8 = bitcast i64 %tmp8.ui to i64 ; [#uses=1] + %tmp9 = and i64 %tmp8, %tmp.upgrd.1 ; [#uses=1] + %sext = trunc i64 %tmp9 to i32 ; [#uses=1] + %tmp27.i = sext i32 %sext to i64 ; [#uses=1] + tail call void @foo25( i32 0, i64 %tmp27.i ) + unreachable +; CHECK: @test25 +} + +declare void @foo25(i32, i64) + + +; PR1637 +define i1 @test26(i8* %arr) { + %X = getelementptr i8* %arr, i32 1 + %Y = getelementptr i8* %arr, i32 1 + %test = icmp uge i8* %X, %Y + ret i1 %test +; CHECK: @test26 +; CHECK: ret i1 true +} + + %struct.__large_struct = type { [100 x i64] } + %struct.compat_siginfo = type { i32, i32, i32, { [29 x i32] } } + %struct.siginfo_t = type { i32, i32, i32, { { i32, i32, [0 x i8], %struct.sigval_t, i32 }, [88 x i8] } } + %struct.sigval_t = type { i8* } + +define i32 @test27(%struct.compat_siginfo* %to, %struct.siginfo_t* %from) { +entry: + %from_addr = alloca %struct.siginfo_t* + %tmp344 = load %struct.siginfo_t** %from_addr, align 8 + %tmp345 = getelementptr %struct.siginfo_t* %tmp344, i32 0, i32 3 + %tmp346 = getelementptr { { i32, i32, [0 x i8], %struct.sigval_t, i32 }, [88 x i8] }* %tmp345, i32 0, i32 0 + %tmp346347 = bitcast { i32, i32, [0 x i8], %struct.sigval_t, i32 }* %tmp346 to { i32, i32, %struct.sigval_t }* + %tmp348 = getelementptr { i32, i32, %struct.sigval_t }* %tmp346347, i32 0, i32 2 + %tmp349 = getelementptr %struct.sigval_t* %tmp348, i32 0, i32 0 + %tmp349350 = bitcast i8** %tmp349 to i32* + %tmp351 = load i32* %tmp349350, align 8 + %tmp360 = call i32 asm sideeffect "...", + "=r,ir,*m,i,0,~{dirflag},~{fpsr},~{flags}"( i32 %tmp351, + %struct.__large_struct* null, i32 -14, i32 0 ) + unreachable +; CHECK: @test27 +} + +; PR1978 + %struct.x = type <{ i8 }> +@.str = internal constant [6 x i8] c"Main!\00" +@.str1 = internal constant [12 x i8] c"destroy %p\0A\00" + +define i32 @test28() nounwind { +entry: + %orientations = alloca [1 x [1 x %struct.x]] + %tmp3 = call i32 @puts( i8* getelementptr ([6 x i8]* @.str, i32 0, i32 0) ) nounwind + %tmp45 = getelementptr inbounds [1 x [1 x %struct.x]]* %orientations, i32 1, i32 0, i32 0 + %orientations62 = getelementptr [1 x [1 x %struct.x]]* %orientations, i32 0, i32 0, i32 0 + br label %bb10 + +bb10: + %indvar = phi i32 [ 0, %entry ], [ %indvar.next, %bb10 ] + %tmp.0.reg2mem.0.rec = mul i32 %indvar, -1 + %tmp12.rec = add i32 %tmp.0.reg2mem.0.rec, -1 + %tmp12 = getelementptr inbounds %struct.x* %tmp45, i32 %tmp12.rec + %tmp16 = call i32 (i8*, ...)* @printf( i8* getelementptr ([12 x i8]* @.str1, i32 0, i32 0), %struct.x* %tmp12 ) nounwind + %tmp84 = icmp eq %struct.x* %tmp12, %orientations62 + %indvar.next = add i32 %indvar, 1 + br i1 %tmp84, label %bb17, label %bb10 + +bb17: + ret i32 0 +; CHECK: @test28 +; CHECK: icmp eq i32 %indvar, 0 +} + +declare i32 @puts(i8*) + +declare i32 @printf(i8*, ...) + + + + +; rdar://6762290 + %T = type <{ i64, i64, i64 }> +define i32 @test29(i8* %start, i32 %X) nounwind { +entry: + %tmp3 = load i64* null + %add.ptr = getelementptr i8* %start, i64 %tmp3 + %tmp158 = load i32* null + %add.ptr159 = getelementptr %T* null, i32 %tmp158 + %add.ptr209 = getelementptr i8* %start, i64 0 + %add.ptr212 = getelementptr i8* %add.ptr209, i32 %X + %cmp214 = icmp ugt i8* %add.ptr212, %add.ptr + br i1 %cmp214, label %if.then216, label %if.end363 + +if.then216: + ret i32 1 + +if.end363: + ret i32 0 +; CHECK: @test29 +} + + +; PR3694 +define i32 @test30(i32 %m, i32 %n) nounwind { +entry: + %0 = alloca i32, i32 %n, align 4 + %1 = bitcast i32* %0 to [0 x i32]* + call void @test30f(i32* %0) nounwind + %2 = getelementptr [0 x i32]* %1, i32 0, i32 %m + %3 = load i32* %2, align 4 + ret i32 %3 +; CHECK: @test30 +; CHECK: getelementptr i32 +} + +declare void @test30f(i32*) + + + +define i1 @test31(i32* %A) { + %B = getelementptr i32* %A, i32 1 + %C = getelementptr i32* %A, i64 1 + %V = icmp eq i32* %B, %C + ret i1 %V +; CHECK: @test31 +; CHECK: ret i1 true +} + + +; PR1345 +define i8* @test32(i8* %v) { + %A = alloca [4 x i8*], align 16 + %B = getelementptr [4 x i8*]* %A, i32 0, i32 0 + store i8* null, i8** %B + %C = bitcast [4 x i8*]* %A to { [16 x i8] }* + %D = getelementptr { [16 x i8] }* %C, i32 0, i32 0, i32 8 + %E = bitcast i8* %D to i8** + store i8* %v, i8** %E + %F = getelementptr [4 x i8*]* %A, i32 0, i32 2 + %G = load i8** %F + ret i8* %G +; CHECK: @test32 +; CHECK: %D = getelementptr [4 x i8*]* %A, i64 0, i64 1 +; CHECK: %F = getelementptr [4 x i8*]* %A, i64 0, i64 2 +} + +; PR3290 +%struct.Key = type { { i32, i32 } } +%struct.anon = type <{ i8, [3 x i8], i32 }> + +define i32 *@test33(%struct.Key *%A) { + %B = bitcast %struct.Key* %A to %struct.anon* + %C = getelementptr %struct.anon* %B, i32 0, i32 2 + ret i32 *%C +; CHECK: @test33 +; CHECK: getelementptr %struct.Key* %A, i64 0, i32 0, i32 1 +} + + + + %T2 = type { i8*, i8 } +define i8* @test34(i8* %Val, i64 %V) nounwind { +entry: + %A = alloca %T2, align 8 + %mrv_gep = bitcast %T2* %A to i64* + %B = getelementptr %T2* %A, i64 0, i32 0 + + store i64 %V, i64* %mrv_gep + %C = load i8** %B, align 8 + ret i8* %C +; CHECK: @test34 +; CHECK: %V.c = inttoptr i64 %V to i8* +; CHECK: ret i8* %V.c +} + +%t0 = type { i8*, [19 x i8] } +%t1 = type { i8*, [0 x i8] } + +@array = external global [11 x i8] + +@s = external global %t0 +@"\01LC8" = external constant [17 x i8] + +; Instcombine should be able to fold this getelementptr. + +define i32 @test35() nounwind { + call i32 (i8*, ...)* @printf(i8* getelementptr ([17 x i8]* @"\01LC8", i32 0, i32 0), + i8* getelementptr (%t1* bitcast (%t0* @s to %t1*), i32 0, i32 1, i32 0)) nounwind + ret i32 0 +; CHECK: @test35 +; CHECK: call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([17 x i8]* @"\01LC8", i64 0, i64 0), i8* bitcast (i8** getelementptr (%t1* bitcast (%t0* @s to %t1*), i64 1, i32 0) to i8*)) nounwind +} + +; Instcombine should constant-fold the GEP so that indices that have +; static array extents are within bounds of those array extents. +; In the below, -1 is not in the range [0,11). After the transformation, +; the same address is computed, but 3 is in the range of [0,11). + +define i8* @test36() nounwind { + ret i8* getelementptr ([11 x i8]* @array, i32 0, i64 -1) +; CHECK: @test36 +; CHECK: ret i8* getelementptr ([11 x i8]* @array, i64 1676976733973595601, i64 4) +} + diff --git a/libclamav/c++/llvm/test/Transforms/InstCombine/getelementptr_cast.ll b/libclamav/c++/llvm/test/Transforms/InstCombine/getelementptr_cast.ll deleted file mode 100644 index 1d2fcce13..000000000 --- a/libclamav/c++/llvm/test/Transforms/InstCombine/getelementptr_cast.ll +++ /dev/null @@ -1,11 +0,0 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \ -; RUN: notcast {} {getelementptr.*} - -@G = external global [3 x i8] ; <[3 x i8]*> [#uses=1] - -define i8* @foo(i32 %Idx) { - %gep.upgrd.1 = zext i32 %Idx to i64 ; [#uses=1] - %tmp = getelementptr i8* getelementptr ([3 x i8]* @G, i32 0, i32 0), i64 %gep.upgrd.1 ; [#uses=1] - ret i8* %tmp -} - diff --git a/libclamav/c++/llvm/test/Transforms/InstCombine/getelementptr_const.ll b/libclamav/c++/llvm/test/Transforms/InstCombine/getelementptr_const.ll deleted file mode 100644 index 823ff5efd..000000000 --- a/libclamav/c++/llvm/test/Transforms/InstCombine/getelementptr_const.ll +++ /dev/null @@ -1,15 +0,0 @@ -; Test folding of constantexpr geps into normal geps. -; RUN: llvm-as < %s | opt -instcombine -gvn -instcombine | \ -; RUN: llvm-dis | not grep getelementptr - -@Array = external global [40 x i32] ; <[40 x i32]*> [#uses=2] - -define i32 @test(i64 %X) { - %A = getelementptr i32* getelementptr ([40 x i32]* @Array, i64 0, i64 0), i64 %X ; [#uses=1] - %B = getelementptr [40 x i32]* @Array, i64 0, i64 %X ; [#uses=1] - %a = ptrtoint i32* %A to i32 ; [#uses=1] - %b = ptrtoint i32* %B to i32 ; [#uses=1] - %c = sub i32 %a, %b ; [#uses=1] - ret i32 %c -} - diff --git a/libclamav/c++/llvm/test/Transforms/InstCombine/getelementptr_index.ll b/libclamav/c++/llvm/test/Transforms/InstCombine/getelementptr_index.ll deleted file mode 100644 index 556096516..000000000 --- a/libclamav/c++/llvm/test/Transforms/InstCombine/getelementptr_index.ll +++ /dev/null @@ -1,9 +0,0 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep trunc - -target datalayout = "e-p:32:32" - -define i32* @test(i32* %X, i64 %Idx) { - %R = getelementptr i32* %X, i64 %Idx ; [#uses=1] - ret i32* %R -} - diff --git a/libclamav/c++/llvm/test/Transforms/InstCombine/getelementptr_promote.ll b/libclamav/c++/llvm/test/Transforms/InstCombine/getelementptr_promote.ll deleted file mode 100644 index 811c5a959..000000000 --- a/libclamav/c++/llvm/test/Transforms/InstCombine/getelementptr_promote.ll +++ /dev/null @@ -1,58 +0,0 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep getelementptr | grep {, i64} - -; Instcombine should promote the getelementptr index up to the target's -; pointer size, making the conversion explicit, which helps expose it to -; other optimizations. - -target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128" -target triple = "x86_64-apple-darwin8" - -define i64 @test(i64* %first, i32 %count) nounwind { -entry: - %first_addr = alloca i64* ; [#uses=2] - %count_addr = alloca i32 ; [#uses=2] - %retval = alloca i64 ; [#uses=2] - %n = alloca i32 ; [#uses=5] - %result = alloca i64 ; [#uses=4] - %0 = alloca i64 ; [#uses=2] - %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] - store i64* %first, i64** %first_addr - store i32 %count, i32* %count_addr - store i64 0, i64* %result, align 8 - store i32 0, i32* %n, align 4 - br label %bb1 - -bb: ; preds = %bb1 - %1 = load i64** %first_addr, align 8 ; [#uses=1] - %2 = load i32* %n, align 4 ; [#uses=1] - %3 = bitcast i32 %2 to i32 ; [#uses=1] - %4 = getelementptr i64* %1, i32 %3 ; [#uses=1] - %5 = load i64* %4, align 8 ; [#uses=1] - %6 = lshr i64 %5, 4 ; [#uses=1] - %7 = load i64* %result, align 8 ; [#uses=1] - %8 = add i64 %6, %7 ; [#uses=1] - store i64 %8, i64* %result, align 8 - %9 = load i32* %n, align 4 ; [#uses=1] - %10 = add i32 %9, 1 ; [#uses=1] - store i32 %10, i32* %n, align 4 - br label %bb1 - -bb1: ; preds = %bb, %entry - %11 = load i32* %n, align 4 ; [#uses=1] - %12 = load i32* %count_addr, align 4 ; [#uses=1] - %13 = icmp slt i32 %11, %12 ; [#uses=1] - %14 = zext i1 %13 to i8 ; [#uses=1] - %toBool = icmp ne i8 %14, 0 ; [#uses=1] - br i1 %toBool, label %bb, label %bb2 - -bb2: ; preds = %bb1 - %15 = load i64* %result, align 8 ; [#uses=1] - store i64 %15, i64* %0, align 8 - %16 = load i64* %0, align 8 ; [#uses=1] - store i64 %16, i64* %retval, align 8 - br label %return - -return: ; preds = %bb2 - %retval3 = load i64* %retval ; [#uses=1] - ret i64 %retval3 -} diff --git a/libclamav/c++/llvm/test/Transforms/InstCombine/udiv_select_to_select_shift.ll b/libclamav/c++/llvm/test/Transforms/InstCombine/udiv_select_to_select_shift.ll index 614ae3dc9..5594e277e 100644 --- a/libclamav/c++/llvm/test/Transforms/InstCombine/udiv_select_to_select_shift.ll +++ b/libclamav/c++/llvm/test/Transforms/InstCombine/udiv_select_to_select_shift.ll @@ -1,7 +1,7 @@ ; Test that this transform works: ; udiv X, (Select Cond, C1, C2) --> Select Cond, (shr X, C1), (shr X, C2) ; -; RUN: llvm-as < %s | opt -instcombine | llvm-dis -f -o %t +; RUN: llvm-as < %s | opt -instcombine | llvm-dis -o %t ; RUN: not grep select %t ; RUN: grep lshr %t | count 2 ; RUN: not grep udiv %t diff --git a/libclamav/c++/llvm/test/Transforms/LICM/2003-08-04-TrappingInstOkHoist.ll b/libclamav/c++/llvm/test/Transforms/LICM/2003-08-04-TrappingInstOkHoist.ll deleted file mode 100644 index 59cc0d662..000000000 --- a/libclamav/c++/llvm/test/Transforms/LICM/2003-08-04-TrappingInstOkHoist.ll +++ /dev/null @@ -1,21 +0,0 @@ -; This testcase tests to make sure a trapping instruction is hoisted when -; it is guaranteed to execute. -; -; RUN: llvm-as < %s | opt -licm | llvm-dis | %prcontext "test" 2 | grep div - -@X = global i32 0 ; [#uses=1] - -declare void @foo(i32) - -define i32 @test(i1 %c) { - %A = load i32* @X ; [#uses=2] - br label %Loop -Loop: ; preds = %Loop, %0 - ;; Should have hoisted this div! - %B = sdiv i32 4, %A ; [#uses=2] - call void @foo( i32 %B ) - br i1 %c, label %Loop, label %Out -Out: ; preds = %Loop - %C = sub i32 %A, %B ; [#uses=1] - ret i32 %C -} diff --git a/libclamav/c++/llvm/test/Transforms/LICM/2003-12-13-VolatilePromote.ll b/libclamav/c++/llvm/test/Transforms/LICM/2003-12-13-VolatilePromote.ll deleted file mode 100644 index 85c93c62b..000000000 --- a/libclamav/c++/llvm/test/Transforms/LICM/2003-12-13-VolatilePromote.ll +++ /dev/null @@ -1,16 +0,0 @@ -; RUN: llvm-as < %s | opt -licm | llvm-dis | %prcontext volatile 1 | grep Loop - -@X = global i32 7 ; [#uses=2] - -define void @testfunc(i32 %i) { - br label %Loop -Loop: ; preds = %Loop, %0 - ; Should not promote this to a register - %x = volatile load i32* @X ; [#uses=1] - %x2 = add i32 %x, 1 ; [#uses=1] - store i32 %x2, i32* @X - br i1 true, label %Out, label %Loop -Out: ; preds = %Loop - ret void -} - diff --git a/libclamav/c++/llvm/test/Transforms/LICM/call_sink_const_function.ll b/libclamav/c++/llvm/test/Transforms/LICM/call_sink_const_function.ll deleted file mode 100644 index f187e2733..000000000 --- a/libclamav/c++/llvm/test/Transforms/LICM/call_sink_const_function.ll +++ /dev/null @@ -1,17 +0,0 @@ -; RUN: llvm-as < %s | opt -basicaa -licm | llvm-dis | %prcontext sin 1 | grep Out: - -declare double @sin(double) readnone - -declare void @foo() - -define double @test(double %X) { - br label %Loop - -Loop: ; preds = %Loop, %0 - call void @foo( ) - %A = call double @sin( double %X ) readnone ; [#uses=1] - br i1 true, label %Loop, label %Out - -Out: ; preds = %Loop - ret double %A -} diff --git a/libclamav/c++/llvm/test/Transforms/LICM/call_sink_pure_function.ll b/libclamav/c++/llvm/test/Transforms/LICM/call_sink_pure_function.ll deleted file mode 100644 index c0457a17f..000000000 --- a/libclamav/c++/llvm/test/Transforms/LICM/call_sink_pure_function.ll +++ /dev/null @@ -1,16 +0,0 @@ -; RUN: llvm-as < %s | opt -basicaa -licm | llvm-dis | %prcontext strlen 1 | grep Out: - -declare i32 @strlen(i8*) readonly - -declare void @foo() - -define i32 @test(i8* %P) { - br label %Loop - -Loop: ; preds = %Loop, %0 - %A = call i32 @strlen( i8* %P ) readonly ; [#uses=1] - br i1 false, label %Loop, label %Out - -Out: ; preds = %Loop - ret i32 %A -} diff --git a/libclamav/c++/llvm/test/Transforms/LICM/2003-08-04-TrappingInstHoist.ll b/libclamav/c++/llvm/test/Transforms/LICM/hoisting.ll similarity index 50% rename from libclamav/c++/llvm/test/Transforms/LICM/2003-08-04-TrappingInstHoist.ll rename to libclamav/c++/llvm/test/Transforms/LICM/hoisting.ll index a00eb8c7a..821c8a3fd 100644 --- a/libclamav/c++/llvm/test/Transforms/LICM/2003-08-04-TrappingInstHoist.ll +++ b/libclamav/c++/llvm/test/Transforms/LICM/hoisting.ll @@ -1,21 +1,25 @@ -; This testcase tests for a problem where LICM hoists -; potentially trapping instructions when they are not guaranteed to execute. -; -; RUN: llvm-as < %s | opt -licm | llvm-dis | %prcontext "IfUnEqual" 2 | grep div +; RUN: llvm-as < %s | opt -licm | llvm-dis | FileCheck %s @X = global i32 0 ; [#uses=1] declare void @foo() -define i32 @test(i1 %c) { +; This testcase tests for a problem where LICM hoists +; potentially trapping instructions when they are not guaranteed to execute. +define i32 @test1(i1 %c) { +; CHECK: @test1 %A = load i32* @X ; [#uses=2] br label %Loop Loop: ; preds = %LoopTail, %0 call void @foo( ) br i1 %c, label %LoopTail, label %IfUnEqual + IfUnEqual: ; preds = %Loop +; CHECK: IfUnEqual: +; CHECK-NEXT: sdiv i32 4, %A %B1 = sdiv i32 4, %A ; [#uses=1] br label %LoopTail + LoopTail: ; preds = %IfUnEqual, %Loop %B = phi i32 [ 0, %Loop ], [ %B1, %IfUnEqual ] ; [#uses=1] br i1 %c, label %Loop, label %Out @@ -24,3 +28,23 @@ Out: ; preds = %LoopTail ret i32 %C } + +declare void @foo2(i32) + + +;; It is ok and desirable to hoist this potentially trapping instruction. +define i32 @test2(i1 %c) { +; CHECK: @test2 +; CHECK-NEXT: load i32* @X +; CHECK-NEXT: %B = sdiv i32 4, %A + %A = load i32* @X ; [#uses=2] + br label %Loop +Loop: + ;; Should have hoisted this div! + %B = sdiv i32 4, %A ; [#uses=2] + call void @foo2( i32 %B ) + br i1 %c, label %Loop, label %Out +Out: ; preds = %Loop + %C = sub i32 %A, %B ; [#uses=1] + ret i32 %C +} diff --git a/libclamav/c++/llvm/test/Transforms/LICM/scalar_promote.ll b/libclamav/c++/llvm/test/Transforms/LICM/scalar_promote.ll index f6c0f0821..8f00d0332 100644 --- a/libclamav/c++/llvm/test/Transforms/LICM/scalar_promote.ll +++ b/libclamav/c++/llvm/test/Transforms/LICM/scalar_promote.ll @@ -1,13 +1,17 @@ -; RUN: llvm-as < %s | opt -licm -disable-output -stats |& \ -; RUN: grep {memory locations promoted to register} +; RUN: llvm-as < %s | opt -licm | llvm-dis | FileCheck %s @X = global i32 7 ; [#uses=4] -define void @testfunc(i32 %i) { -;