summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys-devel/llvm/Manifest19
-rw-r--r--sys-devel/llvm/files/ExceptionTableOverflowFix.patch111
-rw-r--r--sys-devel/llvm/files/cl-patches/0001-r600-Add-some-intrinsic-definitions.patch64
-rw-r--r--sys-devel/llvm/files/cl-patches/0002-r600-Add-get_global_size-and-get_local_size-intrinsi.patch27
-rw-r--r--sys-devel/llvm/files/llvm-2.6-commandguide-nops.patch30
-rw-r--r--sys-devel/llvm/files/llvm-2.7-nodoctargz.patch47
-rw-r--r--sys-devel/llvm/files/llvm-2.8-alignof.patch59
-rw-r--r--sys-devel/llvm/files/llvm-2.8-darwin8.patch15
-rw-r--r--sys-devel/llvm/files/llvm-2.9-Operator.h-c++0x.patch57
-rw-r--r--sys-devel/llvm/files/llvm-2.9-nodoctargz.patch39
-rw-r--r--sys-devel/llvm/files/llvm-3.0-PPCCompilationCallbackC_static.patch27
-rw-r--r--sys-devel/llvm/files/llvm-3.0-PPC_macro.patch43
-rw-r--r--sys-devel/llvm/files/llvm-3.0-gold_LTO_link.patch10
-rw-r--r--sys-devel/llvm/files/llvm-3.0-ocaml_install.patch16
-rw-r--r--sys-devel/llvm/files/llvm-3.0-set_soname.patch12
-rw-r--r--sys-devel/llvm/files/llvm-3.1-fix_debug_line_info.patch65
-rw-r--r--sys-devel/llvm/files/llvm-3.1-ivybridge_support.patch13
-rw-r--r--sys-devel/llvm/files/llvm-3.2-nodoctargz.patch45
-rw-r--r--sys-devel/llvm/llvm-3.1-r121.ebuild191
19 files changed, 890 insertions, 0 deletions
diff --git a/sys-devel/llvm/Manifest b/sys-devel/llvm/Manifest
new file mode 100644
index 0000000..d996bea
--- /dev/null
+++ b/sys-devel/llvm/Manifest
@@ -0,0 +1,19 @@
+AUX ExceptionTableOverflowFix.patch 4246 SHA256 5c656d5c7ad652df3230b415da793208856942ccbab4c6d8d6fe15681e606606 SHA512 7cf10269a28ddc164b38e11ac29667e717205a9c36616d4d5290e418f0eb5a3356b92aa5357cfbf212bb70e7f8ac427b743bee411b52618df33bf95dcd22d856 WHIRLPOOL f00d7ae05aa2101a70a5515c49d80366f192fcc4d6135d14c2450235c5b022730cd42281f791ab5c1cef778f45324b426aebc4af1280076d73bf9497a8a9d991
+AUX cl-patches/0001-r600-Add-some-intrinsic-definitions.patch 2450 SHA256 b0a718800c8969e174f3a22e61c15a370376f477e031fe97fff6aaab152f9867 SHA512 d23f9645d3e3364b1e9ce522eb15022fd3f2a685741db88b117b409ee33a07344a8e9ba9d89dc3535e5289edf79c6beb7ff144659f4e725b1a8f2c4256f9aad0 WHIRLPOOL c549806dbe5309dc441b65c942de488c6afc8c511d060d5c1459a4f99b97a357acbec51ce51bd704e5e1e74437cd413755f15377ad6b96c235242bc370af096f
+AUX cl-patches/0002-r600-Add-get_global_size-and-get_local_size-intrinsi.patch 1189 SHA256 172bbb3cb1214e61ee2684c133317bb997e94a34c91dae94d4848cbd0c216436 SHA512 cf711149c421b4258bc64b81018d0a9474d8b4e4128d0cc0cea788b54c93e9512397b2310db8a1834c3507b4d893d5743dbc53183ac0daca23da55601b976c16 WHIRLPOOL 8e6bd9f005a6a941c55d7c8d9b127826191944fab9e404f8ed958efd07017f5f9301273739f869a73f15fc2a79af9dc18687ff85403acf24e175a464838b3f2e
+AUX llvm-2.6-commandguide-nops.patch 975 SHA256 0e36fb43e020fa380230a8c6f2a79b9a19e12e857e833ef856e2b41aaa283649 SHA512 6842285e499b86581ca12fd94f5335e0dcd7afcaf0cdc5042ee8d84d0da6aba6659652eb639027bcad7caf77b0c994ac7e181a15bc609c4b3882e0f391c8cd33 WHIRLPOOL bf1212a8fd06214dba0916a73266842558bed740220d68e3447701ffeba1b3020ca4b4ab5c6d57772a60a6e09f153232f680b1e0b11cbd5d430bd9ef693d2926
+AUX llvm-2.7-nodoctargz.patch 1878 SHA256 983657329ebede731b397ba0256d729b3958f39faea64c9f7d065ab8d2a3e7fd SHA512 3f9dd34437c6dba8246cdf5c8563889f805f3c8e579190c4f0fb06f72bf5aa112ecbfa18467a35eceaadcd470544f434f319f048cb58d6631170788b10fcc75b WHIRLPOOL 63182867bf8f0bd6ca1b7d97229fd13952526d59587192727348026e8a759f1c6b79db044760465e2424851fdbdf79e4122c5bb0285b505d20f151334063e8d1
+AUX llvm-2.8-alignof.patch 2522 SHA256 a9f7add4f4002bf9af438c0c4d1ca86875d6214a5044334325a60cdcbc8a3cdc SHA512 188bdf29b60ce0f83010ef33cd28c4cb710d238fe678be731ce1d099c7df5577f51162c95e06d996e9c90535ace41fecd3eff6570214a313fe165c0945c42832 WHIRLPOOL 65dd1cf8eb106af0516a5f302a08c51bfa884e35dd5efffbbcf97e1212a6b9356c6caea4472dce8e54a5a30dc5c6ba73be29e64b1b060e63a9ce7d816066ccea
+AUX llvm-2.8-darwin8.patch 576 SHA256 6db04d9bb5fe65f8a92972988477328a7358e325abca32f30a716ff454d0fe21 SHA512 a7716ade819779bc2b8922cb6b072b85c0edef95cdc85b3b6dca18a51c7d4c48b4a8428341c2de85ac6fb0045849feada36f610a6e706eb80dfe64bb4e414d3f WHIRLPOOL 86dae6d234a8d93dd2714a9cd8ea45f7749cf1993d003da1c3a9a15cbc6e44603cd9b364a5095c5e7fb2df899d418bca29e1b50aad5ecc66829b944dff9d5488
+AUX llvm-2.9-Operator.h-c++0x.patch 2062 SHA256 1c37346b0f412556dc979fd510585f3e20d2d45319ec095dbdec37a582d590c7 SHA512 215214df015c87efa92f8896b9239e5d7385edae1f637bd837584f21a919b9be15f0608274242172c684905f080685e8de770fc16c54c42bed416e6c8e94d2de WHIRLPOOL df4a1ee6d150f95add3a6f33f5b9648dde89ace1012702e88ce5337748a0e1f826073b1b034def46e1971bc1fa5c1841d1dc2eafbf5b428803cd0d5f80c4594d
+AUX llvm-2.9-nodoctargz.patch 1569 SHA256 62f1b080364d94e528bb34f0063562d16a59395aa7f97277bba88fbd93e00b84 SHA512 3a995897f25bfb97908bd8a379249a7b04dc0d8b64aef693272b87c88eff3494d5eac0a66c786e0cc1b8d4fc6b2c555ff8d09bbcd2e29c5e6f3bfbbdeba79044 WHIRLPOOL 254f121f0a5a1974600b1240074f9f8f9bfa760e5bf34f27697c27cf65646e412279b3c523dc3ee88305f73747881c20f60258dbd90bc6a2c380dcc3000ba329
+AUX llvm-3.0-PPCCompilationCallbackC_static.patch 1046 SHA256 f197920fb1ffbebeb2f43689619d637c5102bfc73295a8edb139cca46094ec5b SHA512 29a46adf9c2205475e2fd74ce15a3094b43905f28c484961ad81c78f54e3c4d56fb4005080db7e9671654738fa25901d5bbd1f0a6ae861a5e9b6d38053a6a65e WHIRLPOOL 8ba25aca05b21e2a8a6e25f5c07aa46175b03a4233e6fe102c619b7c60d5558d28e80dbc9c0892a1ecda1e2effd50211cc145c8389e644a27282cd108671e2a7
+AUX llvm-3.0-PPC_macro.patch 1825 SHA256 e56947d9744549ef6903238653c6569b5f91a1eb1bd84ec5d69d32ce5b20d6e4 SHA512 552a6a980cb2c05b6c6924d234efdcf375d12e72829a0372d3a4754d6bfa54f022d98e08b6f286d7dd496f2e74e4f6f9e5f81994a9d183cc39a4a01170b2c57e WHIRLPOOL f40fc9c6d75d7c05c66271c74011c320e302a0502970c38312cbf57a75f06a291900e62a09e3127d0dba7f0569a89d1e35225ca4e2e2b702063c0fb4f05878f6
+AUX llvm-3.0-gold_LTO_link.patch 442 SHA256 62dc70a1d1f581b7f768ca728dcca688a741e03e64566d5f38e02e33c6372ab8 SHA512 6daf346d5fb93cb9ed498164ef42c2c565e6e4e68bd820fed54f53afea4b1a580560836cf484e370a1566603d8799c0f359f589ea99b9d920bc587145391a65c WHIRLPOOL afc7dceed1de3db657f45ec58fb6befd9ec9e79e6c55dc3fcbc26e19c5e0b9d9c0980476a34e4dabf800465a6fe57897ddc4aa1b1a1d88a639126e262bedda62
+AUX llvm-3.0-ocaml_install.patch 664 SHA256 6f451130ed8fcced98691361d33d4d44d8866e703673c293cf7f88af8362e694 SHA512 b13e26a979505df40519ec6fd859f46e3a0e8589ed29c8509ca5c737af1e94890fea2f7c7a0b95ef168dfc7993b52133d7205de228fc4b750fd84af1ee2735e8 WHIRLPOOL a5d455a5671ec1804a06849588c072c29718d5c8218c6ba4a6b7de0b7dac0ad3d37007ed8b39447545bdf917b4c8e5fa780477a28c6250b47692605be7239b02
+AUX llvm-3.0-set_soname.patch 522 SHA256 0f4fe63baa74a963929dc39359cccb6eb4fba73176d72d4a354ebf50e51318a5 SHA512 ddf1b5572d51b5af66d5d7ef28798b41a2991c1799ba091c9e6f3a64a6b1b8081d596096919c7c910ad5af0adc0c8ad02b23fba30eead994d724a334d2c9da9e WHIRLPOOL 51aa3f1dd35e085fa4d3fe700503cd348b9342ef1d7164ec3ef2627b8ed8df0764442779315720c6cd301e4c099722cf84b305717129a386fd2792751e0c20ed
+AUX llvm-3.1-fix_debug_line_info.patch 2620 SHA256 db1f1aadebbc4c4232bdad49fb9b7dc61eac727085c63154b870fa9ce64fd18d SHA512 0b8bdde081dc7eddcc3556a0220f0a47565c6b95afb31560a835abe630d641c43e3acd0f0d0ba177809495f3208c17aa1a0fd267da3a34d71039c846b03253e8 WHIRLPOOL 47decb374e7109cee7eca7ccfcae5a2bd01a837d9daf6d201f20eb0d2ded14a66e737532c033ca128b049557cd0977dee811a4c54c15036e050d7383c586b5bd
+AUX llvm-3.1-ivybridge_support.patch 405 SHA256 cc91a69be3d0f7f216a4d0484284fd054d4b0273f1c4dda7afcc005564867725 SHA512 7ec84a127eda4cbec0aaeb1e34f0606ff76e070bf1f3eb71334219b6a2e21299f30f157d022952e6f23c5e4180903239f5a4323f214041decd4ccc21f1a285d7 WHIRLPOOL 443c57305f1c9676e7191042c0ab7491a2a789433e32b5cc12050cece38eebe9ae62fd1d54200fbc32d2c7d22aedc7f6776fd250ae53e7d2afad0a325c1ba919
+AUX llvm-3.2-nodoctargz.patch 1761 SHA256 e17494aef638d2fe3fb0b669516ffcc9e560161903e1e165de0eecba684c8c1b SHA512 d12a8996d8a1160f7bad4ce3b3a9ddfb2d29d91fc160876c145f9241927b0cf4413f3b29bc2bf291f0421f61a512de8057e8f3d0029a8a09ba3f1d93582723b5 WHIRLPOOL be273271db8293829a63120cfc917711c99d8893cae6f95af2583def735131f629ee67b5a1515df007477f34abeaf5f2729d689eefdc61eb3aae6b1959971507
+DIST llvm-3.1.src.tar.gz 11077429 SHA256 1ea05135197b5400c1f88d00ff280d775ce778f8f9ea042e25a1e1e734a4b9ab SHA512 fb941094601043e405ccc57473414ef92437b09c200e71614f93d8e93b2a58cca8d78c385be037e064b0711cd6268802c774ce4a40fc0ea17bf576305304d2aa WHIRLPOOL c5c72e139296e1c186131f991010f52f958063a4fcfcb1f8527b53a2aaa7edcaca70ab6cf86c25d08640dcf6d720a865fda7dc7eb06cf1ce9c23fd37b5d597ef
+EBUILD llvm-3.1-r121.ebuild 6061 SHA256 a861722e208786010cabd80d5b1f5f9a9c114c60b451f44ae03a96b9b71cb71e SHA512 755d7ed7d0b2e6bfc73461e08b0295a22c5458dc4f4c7bd7f066c6d6fd7f94867a22368ab9d52c660a0e786a45c6a79e74ceddbd4118a1ecd6e926c852c734a1 WHIRLPOOL 23e5b4a72fc06d9d5dd530e6ebe6c0caec9580b8c41b4ae365b853b7034181c7a5d8680bde6c8f4e797d0aa0f56889a4c95506183d8c526565596d829848bb43
diff --git a/sys-devel/llvm/files/ExceptionTableOverflowFix.patch b/sys-devel/llvm/files/ExceptionTableOverflowFix.patch
new file mode 100644
index 0000000..a082dd5
--- /dev/null
+++ b/sys-devel/llvm/files/ExceptionTableOverflowFix.patch
@@ -0,0 +1,111 @@
+Index: unittests/ExecutionEngine/JIT/JITTest.cpp
+===================================================================
+--- unittests/ExecutionEngine/JIT/JITTest.cpp (revision 163535)
++++ unittests/ExecutionEngine/JIT/JITTest.cpp (working copy)
+@@ -203,14 +203,21 @@
+
+ class JITTest : public testing::Test {
+ protected:
++ virtual RecordingJITMemoryManager* CreateMemoryManager() {
++ return new RecordingJITMemoryManager;
++ }
++
+ virtual void SetUp() {
+ M = new Module("<main>", Context);
+- RJMM = new RecordingJITMemoryManager;
++ RJMM = CreateMemoryManager();
+ RJMM->setPoisonMemory(true);
+ std::string Error;
++ TargetOptions Options;
++ Options.JITExceptionHandling = true;
+ TheJIT.reset(EngineBuilder(M).setEngineKind(EngineKind::JIT)
+ .setJITMemoryManager(RJMM)
+- .setErrorStr(&Error).create());
++ .setErrorStr(&Error)
++ .setTargetOptions(Options).create());
+ ASSERT_TRUE(TheJIT.get() != NULL) << Error;
+ }
+
+@@ -292,6 +299,46 @@
+ EXPECT_EQ(3, *GPtr);
+ }
+
++// Regression test for a bug. The JITEmitter wasn't checking to verify that
++// it hadn't run out of space while generating the DWARF exception information
++// for an emitted function.
++
++class ExceptionMemoryManagerMock : public RecordingJITMemoryManager {
++ public:
++ virtual uint8_t* startExceptionTable(const Function* F,
++ uintptr_t &ActualSize) {
++ // force an insufficient size the first time through.
++ bool ChangeActualSize = false;
++ if (ActualSize == 0)
++ ChangeActualSize = true;;
++ uint8_t* result =
++ RecordingJITMemoryManager::startExceptionTable(F, ActualSize);
++ if (ChangeActualSize)
++ ActualSize = 1;
++ return result;
++ }
++};
++
++class JITExceptionMemoryTest : public JITTest {
++ protected:
++ virtual RecordingJITMemoryManager* CreateMemoryManager() {
++ return new ExceptionMemoryManagerMock;
++ }
++};
++
++TEST_F(JITExceptionMemoryTest, ExceptionTableOverflow) {
++ Function *F = Function::Create(TypeBuilder<void(void), false>::get(Context),
++ Function::ExternalLinkage,
++ "func1", M);
++ BasicBlock *Block = BasicBlock::Create(Context, "block", F);
++ IRBuilder<> Builder(Block);
++ Builder.CreateRetVoid();
++ TheJIT->getPointerToFunction(F);
++ ASSERT_TRUE(RJMM->startExceptionTableCalls.size() == 2);
++ ASSERT_TRUE(RJMM->deallocateExceptionTableCalls.size() == 1);
++ ASSERT_TRUE(RJMM->endExceptionTableCalls.size() == 1);
++}
++
+ int PlusOne(int arg) {
+ return arg + 1;
+ }
+Index: lib/ExecutionEngine/JIT/JITEmitter.cpp
+===================================================================
+--- lib/ExecutionEngine/JIT/JITEmitter.cpp (revision 163478)
++++ lib/ExecutionEngine/JIT/JITEmitter.cpp (working copy)
+@@ -974,14 +974,24 @@
+ SavedBufferBegin = BufferBegin;
+ SavedBufferEnd = BufferEnd;
+ SavedCurBufferPtr = CurBufferPtr;
++ uint8_t *FrameRegister;
+
+- BufferBegin = CurBufferPtr = MemMgr->startExceptionTable(F.getFunction(),
+- ActualSize);
+- BufferEnd = BufferBegin+ActualSize;
+- EmittedFunctions[F.getFunction()].ExceptionTable = BufferBegin;
+- uint8_t *EhStart;
+- uint8_t *FrameRegister = DE->EmitDwarfTable(F, *this, FnStart, FnEnd,
+- EhStart);
++ while (true) {
++ BufferBegin = CurBufferPtr = MemMgr->startExceptionTable(F.getFunction(),
++ ActualSize);
++ BufferEnd = BufferBegin+ActualSize;
++ EmittedFunctions[F.getFunction()].ExceptionTable = BufferBegin;
++ uint8_t *EhStart;
++ FrameRegister = DE->EmitDwarfTable(F, *this, FnStart, FnEnd, EhStart);
++
++ // If we've run out of memory, try again with twice as much space.
++ if (CurBufferPtr == BufferEnd) {
++ ActualSize = (CurBufferPtr-BufferBegin)*2;
++ MemMgr->deallocateExceptionTable(BufferBegin);
++ } else {
++ break;
++ }
++ }
+ MemMgr->endExceptionTable(F.getFunction(), BufferBegin, CurBufferPtr,
+ FrameRegister);
+ BufferBegin = SavedBufferBegin;
diff --git a/sys-devel/llvm/files/cl-patches/0001-r600-Add-some-intrinsic-definitions.patch b/sys-devel/llvm/files/cl-patches/0001-r600-Add-some-intrinsic-definitions.patch
new file mode 100644
index 0000000..9d99c9c
--- /dev/null
+++ b/sys-devel/llvm/files/cl-patches/0001-r600-Add-some-intrinsic-definitions.patch
@@ -0,0 +1,64 @@
+From e25389b66b5ced3a2b5461077dcc9a505d334e3d Mon Sep 17 00:00:00 2001
+From: Tom Stellard <thomas.stellard@amd.com>
+Date: Tue, 13 Mar 2012 14:12:21 -0400
+Subject: [PATCH 1/2] r600: Add some intrinsic definitions
+
+---
+ include/llvm/Intrinsics.td | 1 +
+ include/llvm/IntrinsicsR600.td | 35 +++++++++++++++++++++++++++++++++++
+ 2 files changed, 36 insertions(+), 0 deletions(-)
+ create mode 100644 include/llvm/IntrinsicsR600.td
+
+diff --git a/include/llvm/Intrinsics.td b/include/llvm/Intrinsics.td
+index 069f907..e90dd85 100644
+--- a/include/llvm/Intrinsics.td
++++ b/include/llvm/Intrinsics.td
+@@ -441,3 +441,4 @@ include "llvm/IntrinsicsCellSPU.td"
+ include "llvm/IntrinsicsXCore.td"
+ include "llvm/IntrinsicsPTX.td"
+ include "llvm/IntrinsicsHexagon.td"
++include "llvm/IntrinsicsR600.td"
+diff --git a/include/llvm/IntrinsicsR600.td b/include/llvm/IntrinsicsR600.td
+new file mode 100644
+index 0000000..789fecb
+--- /dev/null
++++ b/include/llvm/IntrinsicsR600.td
+@@ -0,0 +1,35 @@
++//===- IntrinsicsR600.td - Defines R600 intrinsics ---------*- tablegen -*-===//
++//
++// The LLVM Compiler Infrastructure
++//
++// This file is distributed under the University of Illinois Open Source
++// License. See LICENSE.TXT for details.
++//
++//===----------------------------------------------------------------------===//
++//
++// This file defines all of the R600-specific intrinsics.
++//
++//===----------------------------------------------------------------------===//
++//
++// Authors: Tom Stellard <thomas.stellard@amd.com>
++//
++
++let TargetPrefix = "r600" in {
++
++class R600ReadPreloadRegisterIntrinsic<string name>
++ : Intrinsic<[llvm_i32_ty], [], [IntrNoMem]>,
++ GCCBuiltin<name>;
++
++multiclass R600ReadPreloadRegisterIntrinsic_xyz<string prefix> {
++ def _x : R600ReadPreloadRegisterIntrinsic<!strconcat(prefix, "_x")>;
++ def _y : R600ReadPreloadRegisterIntrinsic<!strconcat(prefix, "_y")>;
++ def _z : R600ReadPreloadRegisterIntrinsic<!strconcat(prefix, "_z")>;
++}
++
++defm int_r600_read_ngroups : R600ReadPreloadRegisterIntrinsic_xyz <
++ "__builtin_r600_read_ngroups">;
++defm int_r600_read_tgid : R600ReadPreloadRegisterIntrinsic_xyz <
++ "__builtin_r600_read_tgid">;
++defm int_r600_read_tidig : R600ReadPreloadRegisterIntrinsic_xyz <
++ "__builtin_r600_read_tidig">;
++} // End TargetPrefix = "r600"
+--
+1.7.7.6
+
diff --git a/sys-devel/llvm/files/cl-patches/0002-r600-Add-get_global_size-and-get_local_size-intrinsi.patch b/sys-devel/llvm/files/cl-patches/0002-r600-Add-get_global_size-and-get_local_size-intrinsi.patch
new file mode 100644
index 0000000..db176dd
--- /dev/null
+++ b/sys-devel/llvm/files/cl-patches/0002-r600-Add-get_global_size-and-get_local_size-intrinsi.patch
@@ -0,0 +1,27 @@
+From 17667fa3450470f7c89fc2ba4631d908cf510749 Mon Sep 17 00:00:00 2001
+From: Tom Stellard <thomas.stellard@amd.com>
+Date: Wed, 14 Mar 2012 11:19:35 -0400
+Subject: [PATCH 2/2] r600: Add get_global_size and get_local_size intrinsics
+
+---
+ include/llvm/IntrinsicsR600.td | 4 ++++
+ 1 files changed, 4 insertions(+), 0 deletions(-)
+
+diff --git a/include/llvm/IntrinsicsR600.td b/include/llvm/IntrinsicsR600.td
+index 789fecb..0473acb 100644
+--- a/include/llvm/IntrinsicsR600.td
++++ b/include/llvm/IntrinsicsR600.td
+@@ -26,6 +26,10 @@ multiclass R600ReadPreloadRegisterIntrinsic_xyz<string prefix> {
+ def _z : R600ReadPreloadRegisterIntrinsic<!strconcat(prefix, "_z")>;
+ }
+
++defm int_r600_read_global_size : R600ReadPreloadRegisterIntrinsic_xyz <
++ "__builtin_r600_read_global_size">;
++defm int_r600_read_local_size : R600ReadPreloadRegisterIntrinsic_xyz <
++ "__builtin_r600_read_local_size">;
+ defm int_r600_read_ngroups : R600ReadPreloadRegisterIntrinsic_xyz <
+ "__builtin_r600_read_ngroups">;
+ defm int_r600_read_tgid : R600ReadPreloadRegisterIntrinsic_xyz <
+--
+1.7.7.6
+
diff --git a/sys-devel/llvm/files/llvm-2.6-commandguide-nops.patch b/sys-devel/llvm/files/llvm-2.6-commandguide-nops.patch
new file mode 100644
index 0000000..583fdf9
--- /dev/null
+++ b/sys-devel/llvm/files/llvm-2.6-commandguide-nops.patch
@@ -0,0 +1,30 @@
+--- docs/CommandGuide/Makefile.orig 2009-10-26 16:54:33.000000000 +0100
++++ docs/CommandGuide/Makefile 2009-10-26 17:32:03.000000000 +0100
+@@ -19,7 +19,7 @@
+ DST_PS_DIR=ps/
+
+ # If we are in BUILD_FOR_WEBSITE mode, default to the all target.
+-all:: html man ps
++all:: html man
+
+ clean:
+ rm -f pod2htm*.*~~ $(HTML) $(MAN) $(PS)
+@@ -81,7 +81,7 @@
+ MAN_DIR := $(PROJ_mandir)/man1
+ PS_DIR := $(PROJ_docsdir)/ps
+
+-install-local:: $(HTML) $(INSTALL_MANS) $(PS)
++install-local:: $(HTML) $(INSTALL_MANS)
+ $(Echo) Installing HTML CommandGuide Documentation
+ $(Verb) $(MKDIR) $(HTML_DIR)
+ $(Verb) $(DataInstall) $(HTML) $(HTML_DIR)
+@@ -90,9 +90,6 @@
+ $(Echo) Installing MAN CommandGuide Documentation
+ $(Verb) $(MKDIR) $(MAN_DIR)
+ $(Verb) $(DataInstall) $(INSTALL_MANS) $(MAN_DIR)
+- $(Echo) Installing PS CommandGuide Documentation
+- $(Verb) $(MKDIR) $(PS_DIR)
+- $(Verb) $(DataInstall) $(PS) $(PS_DIR)
+
+ uninstall-local::
+ $(Echo) Uninstalling CommandGuide Documentation
diff --git a/sys-devel/llvm/files/llvm-2.7-nodoctargz.patch b/sys-devel/llvm/files/llvm-2.7-nodoctargz.patch
new file mode 100644
index 0000000..cce09eb
--- /dev/null
+++ b/sys-devel/llvm/files/llvm-2.7-nodoctargz.patch
@@ -0,0 +1,47 @@
+--- docs/Makefile.orig 2010-04-26 15:00:58.000000000 +0200
++++ docs/Makefile 2010-04-26 15:03:12.000000000 +0200
+@@ -46,13 +46,12 @@
+ # 'make generated BUILD_FOR_WEBSITE=1'
+ generated:: doxygen ocamldoc
+
+-install-html: $(PROJ_OBJ_DIR)/html.tar.gz
++install-html:
+ $(Echo) Installing HTML documentation
+ $(Verb) $(MKDIR) $(DESTDIR)$(PROJ_docsdir)/html
+ $(Verb) $(MKDIR) $(DESTDIR)$(PROJ_docsdir)/html/img
+ $(Verb) $(DataInstall) $(HTML) $(DESTDIR)$(PROJ_docsdir)/html
+ $(Verb) $(DataInstall) $(IMAGES) $(DESTDIR)$(PROJ_docsdir)/html/img
+- $(Verb) $(DataInstall) $(PROJ_OBJ_DIR)/html.tar.gz $(DESTDIR)$(PROJ_docsdir)
+
+ $(PROJ_OBJ_DIR)/html.tar.gz: $(HTML)
+ $(Echo) Packaging HTML documentation
+@@ -64,12 +63,11 @@
+ install-doxygen: doxygen
+ $(Echo) Installing doxygen documentation
+ $(Verb) $(MKDIR) $(DESTDIR)$(PROJ_docsdir)/html/doxygen
+- $(Verb) $(DataInstall) $(PROJ_OBJ_DIR)/doxygen.tar.gz $(DESTDIR)$(PROJ_docsdir)
+ $(Verb) cd $(PROJ_OBJ_DIR)/doxygen && \
+ $(FIND) . -type f -exec \
+ $(DataInstall) {} $(DESTDIR)$(PROJ_docsdir)/html/doxygen \;
+
+-doxygen: regendoc $(PROJ_OBJ_DIR)/doxygen.tar.gz
++doxygen: regendoc
+
+ regendoc:
+ $(Echo) Building doxygen documentation
+@@ -95,7 +93,6 @@
+ install-ocamldoc: ocamldoc
+ $(Echo) Installing ocamldoc documentation
+ $(Verb) $(MKDIR) $(DESTDIR)$(PROJ_docsdir)/ocamldoc/html
+- $(Verb) $(DataInstall) $(PROJ_OBJ_DIR)/ocamldoc.tar.gz $(DESTDIR)$(PROJ_docsdir)
+ $(Verb) cd $(PROJ_OBJ_DIR)/ocamldoc && \
+ $(FIND) . -type f -exec \
+ $(DataInstall) {} $(DESTDIR)$(PROJ_docsdir)/ocamldoc/html \;
+@@ -105,7 +102,6 @@
+ $(Verb) $(RM) -rf $(PROJ_OBJ_DIR)/ocamldoc.tar*
+ $(Verb) $(TAR) cf $(PROJ_OBJ_DIR)/ocamldoc.tar ocamldoc
+ $(Verb) $(GZIP) $(PROJ_OBJ_DIR)/ocamldoc.tar
+- $(Verb) $(CP) $(PROJ_OBJ_DIR)/ocamldoc.tar.gz $(PROJ_OBJ_DIR)/ocamldoc/html/
+
+ regen-ocamldoc:
+ $(Echo) Building ocamldoc documentation
diff --git a/sys-devel/llvm/files/llvm-2.8-alignof.patch b/sys-devel/llvm/files/llvm-2.8-alignof.patch
new file mode 100644
index 0000000..ae7f314
--- /dev/null
+++ b/sys-devel/llvm/files/llvm-2.8-alignof.patch
@@ -0,0 +1,59 @@
+Index: include/llvm/ADT/StringMap.h
+===================================================================
+--- include/llvm/ADT/StringMap.h (révision 117773)
++++ include/llvm/ADT/StringMap.h (révision 117774)
+@@ -167,7 +167,7 @@
+
+ unsigned AllocSize = static_cast<unsigned>(sizeof(StringMapEntry))+
+ KeyLength+1;
+- unsigned Alignment = alignof<StringMapEntry>();
++ unsigned Alignment = alignOf<StringMapEntry>();
+
+ StringMapEntry *NewItem =
+ static_cast<StringMapEntry*>(Allocator.Allocate(AllocSize,Alignment));
+Index: include/llvm/Support/AlignOf.h
+===================================================================
+--- include/llvm/Support/AlignOf.h (révision 117773)
++++ include/llvm/Support/AlignOf.h (révision 117774)
+@@ -49,12 +49,12 @@
+
+ };
+
+-/// alignof - A templated function that returns the mininum alignment of
++/// alignOf - A templated function that returns the mininum alignment of
+ /// of a type. This provides no extra functionality beyond the AlignOf
+ /// class besides some cosmetic cleanliness. Example usage:
+-/// alignof<int>() returns the alignment of an int.
++/// alignOf<int>() returns the alignment of an int.
+ template <typename T>
+-static inline unsigned alignof() { return AlignOf<T>::Alignment; }
++static inline unsigned alignOf() { return AlignOf<T>::Alignment; }
+
+ } // end namespace llvm
+ #endif
+Index: include/llvm/Support/Allocator.h
+===================================================================
+--- include/llvm/Support/Allocator.h (révision 117773)
++++ include/llvm/Support/Allocator.h (révision 117774)
+@@ -201,7 +201,7 @@
+ char *End = Slab == Allocator.CurSlab ? Allocator.CurPtr :
+ (char *)Slab + Slab->Size;
+ for (char *Ptr = (char*)(Slab+1); Ptr < End; Ptr += sizeof(T)) {
+- Ptr = Allocator.AlignPtr(Ptr, alignof<T>());
++ Ptr = Allocator.AlignPtr(Ptr, alignOf<T>());
+ if (Ptr + sizeof(T) <= End)
+ reinterpret_cast<T*>(Ptr)->~T();
+ }
+Index: include/llvm/CodeGen/SlotIndexes.h
+===================================================================
+--- include/llvm/CodeGen/SlotIndexes.h (révision 117773)
++++ include/llvm/CodeGen/SlotIndexes.h (révision 117774)
+@@ -393,7 +393,7 @@
+ IndexListEntry *entry =
+ static_cast<IndexListEntry*>(
+ ileAllocator.Allocate(sizeof(IndexListEntry),
+- alignof<IndexListEntry>()));
++ alignOf<IndexListEntry>()));
+
+ new (entry) IndexListEntry(mi, index);
+
diff --git a/sys-devel/llvm/files/llvm-2.8-darwin8.patch b/sys-devel/llvm/files/llvm-2.8-darwin8.patch
new file mode 100644
index 0000000..284ab47
--- /dev/null
+++ b/sys-devel/llvm/files/llvm-2.8-darwin8.patch
@@ -0,0 +1,15 @@
+Avoid like in Makefile.rules
+ld: -rpath can only be used when targeting Mac OS X 10.5 or later
+
+--- unittests/Makefile.unittest
++++ unittests/Makefile.unittest
+@@ -37,7 +37,9 @@
+ ifeq ($(ENABLE_SHARED), 1)
+ # Add the absolute path to the dynamic library. This is ok because
+ # we'll never install unittests.
++ifneq ($(DARWIN_MAJVERS),4)
+ LD.Flags += $(RPATH) -Wl,$(SharedLibDir)
++endif
+ # Also set {DYLD,LD}_LIBRARY_PATH because OSX ignores the rpath most
+ # of the time.
+ Run.Shared := $(SHLIBPATH_VAR)="$(SharedLibDir)$${$(SHLIBPATH_VAR):+:}$$$(SHLIBPATH_VAR)"
diff --git a/sys-devel/llvm/files/llvm-2.9-Operator.h-c++0x.patch b/sys-devel/llvm/files/llvm-2.9-Operator.h-c++0x.patch
new file mode 100644
index 0000000..b95d7d7
--- /dev/null
+++ b/sys-devel/llvm/files/llvm-2.9-Operator.h-c++0x.patch
@@ -0,0 +1,57 @@
+--- llvm/trunk/include/llvm/Operator.h 2011/02/07 16:40:21 125006
++++ llvm/trunk/include/llvm/Operator.h 2011/05/08 01:59:22 131062
+@@ -186,28 +186,46 @@
+ };
+
+ class AddOperator
+- : public ConcreteOperator<OverflowingBinaryOperator, Instruction::Add> {};
++ : public ConcreteOperator<OverflowingBinaryOperator, Instruction::Add> {
++ ~AddOperator(); // DO NOT IMPLEMENT
++};
+ class SubOperator
+- : public ConcreteOperator<OverflowingBinaryOperator, Instruction::Sub> {};
++ : public ConcreteOperator<OverflowingBinaryOperator, Instruction::Sub> {
++ ~SubOperator(); // DO NOT IMPLEMENT
++};
+ class MulOperator
+- : public ConcreteOperator<OverflowingBinaryOperator, Instruction::Mul> {};
++ : public ConcreteOperator<OverflowingBinaryOperator, Instruction::Mul> {
++ ~MulOperator(); // DO NOT IMPLEMENT
++};
+ class ShlOperator
+- : public ConcreteOperator<OverflowingBinaryOperator, Instruction::Shl> {};
++ : public ConcreteOperator<OverflowingBinaryOperator, Instruction::Shl> {
++ ~ShlOperator(); // DO NOT IMPLEMENT
++};
+
+
+ class SDivOperator
+- : public ConcreteOperator<PossiblyExactOperator, Instruction::SDiv> {};
++ : public ConcreteOperator<PossiblyExactOperator, Instruction::SDiv> {
++ ~SDivOperator(); // DO NOT IMPLEMENT
++};
+ class UDivOperator
+- : public ConcreteOperator<PossiblyExactOperator, Instruction::UDiv> {};
++ : public ConcreteOperator<PossiblyExactOperator, Instruction::UDiv> {
++ ~UDivOperator(); // DO NOT IMPLEMENT
++};
+ class AShrOperator
+- : public ConcreteOperator<PossiblyExactOperator, Instruction::AShr> {};
++ : public ConcreteOperator<PossiblyExactOperator, Instruction::AShr> {
++ ~AShrOperator(); // DO NOT IMPLEMENT
++};
+ class LShrOperator
+- : public ConcreteOperator<PossiblyExactOperator, Instruction::LShr> {};
++ : public ConcreteOperator<PossiblyExactOperator, Instruction::LShr> {
++ ~LShrOperator(); // DO NOT IMPLEMENT
++};
+
+
+
+ class GEPOperator
+ : public ConcreteOperator<Operator, Instruction::GetElementPtr> {
++ ~GEPOperator(); // DO NOT IMPLEMENT
++
+ enum {
+ IsInBounds = (1 << 0)
+ };
diff --git a/sys-devel/llvm/files/llvm-2.9-nodoctargz.patch b/sys-devel/llvm/files/llvm-2.9-nodoctargz.patch
new file mode 100644
index 0000000..9507817
--- /dev/null
+++ b/sys-devel/llvm/files/llvm-2.9-nodoctargz.patch
@@ -0,0 +1,39 @@
+--- docs/Makefile.orig 2011-02-28 21:30:46.000000000 +0100
++++ docs/Makefile 2011-02-28 21:35:22.000000000 +0100
+@@ -53,13 +53,12 @@
+ # 'make generated BUILD_FOR_WEBSITE=1'
+ generated:: $(generated_targets)
+
+-install-html: $(PROJ_OBJ_DIR)/html.tar.gz
++install-html:
+ $(Echo) Installing HTML documentation
+ $(Verb) $(MKDIR) $(DESTDIR)$(PROJ_docsdir)/html
+ $(Verb) $(MKDIR) $(DESTDIR)$(PROJ_docsdir)/html/img
+ $(Verb) $(DataInstall) $(HTML) $(DESTDIR)$(PROJ_docsdir)/html
+ $(Verb) $(DataInstall) $(IMAGES) $(DESTDIR)$(PROJ_docsdir)/html/img
+- $(Verb) $(DataInstall) $(PROJ_OBJ_DIR)/html.tar.gz $(DESTDIR)$(PROJ_docsdir)
+
+ $(PROJ_OBJ_DIR)/html.tar.gz: $(HTML)
+ $(Echo) Packaging HTML documentation
+@@ -71,12 +70,11 @@
+ install-doxygen: doxygen
+ $(Echo) Installing doxygen documentation
+ $(Verb) $(MKDIR) $(DESTDIR)$(PROJ_docsdir)/html/doxygen
+- $(Verb) $(DataInstall) $(PROJ_OBJ_DIR)/doxygen.tar.gz $(DESTDIR)$(PROJ_docsdir)
+ $(Verb) cd $(PROJ_OBJ_DIR)/doxygen && \
+ $(FIND) . -type f -exec \
+ $(DataInstall) {} $(DESTDIR)$(PROJ_docsdir)/html/doxygen \;
+
+-doxygen: regendoc $(PROJ_OBJ_DIR)/doxygen.tar.gz
++doxygen: regendoc
+
+ regendoc:
+ $(Echo) Building doxygen documentation
+@@ -102,7 +100,6 @@
+ install-ocamldoc: ocamldoc
+ $(Echo) Installing ocamldoc documentation
+ $(Verb) $(MKDIR) $(DESTDIR)$(PROJ_docsdir)/ocamldoc/html
+- $(Verb) $(DataInstall) $(PROJ_OBJ_DIR)/ocamldoc.tar.gz $(DESTDIR)$(PROJ_docsdir)
+ $(Verb) cd $(PROJ_OBJ_DIR)/ocamldoc && \
+ $(FIND) . -type f -exec \
+ $(DataInstall) {} $(DESTDIR)$(PROJ_docsdir)/ocamldoc/html \;
diff --git a/sys-devel/llvm/files/llvm-3.0-PPCCompilationCallbackC_static.patch b/sys-devel/llvm/files/llvm-3.0-PPCCompilationCallbackC_static.patch
new file mode 100644
index 0000000..04e4024
--- /dev/null
+++ b/sys-devel/llvm/files/llvm-3.0-PPCCompilationCallbackC_static.patch
@@ -0,0 +1,27 @@
+https://bugs.gentoo.org/show_bug.cgi?id=403519
+http://llvm.org/viewvc/llvm-project?view=rev&revision=153938
+
+--- llvm/trunk/lib/Target/PowerPC/PPCJITInfo.cpp 2011/06/15 15:29:47 133059
++++ llvm/trunk/lib/Target/PowerPC/PPCJITInfo.cpp 2012/04/03 06:59:28 153938
+@@ -291,9 +291,10 @@
+ }
+ #endif
+
+-extern "C" void *PPCCompilationCallbackC(unsigned *StubCallAddrPlus4,
+- unsigned *OrigCallAddrPlus4,
+- bool is64Bit) {
++extern "C" {
++static void* LLVM_ATTRIBUTE_USED PPCCompilationCallbackC(unsigned *StubCallAddrPlus4,
++ unsigned *OrigCallAddrPlus4,
++ bool is64Bit) {
+ // Adjust the pointer to the address of the call instruction in the stub
+ // emitted by emitFunctionStub, rather than the instruction after it.
+ unsigned *StubCallAddr = StubCallAddrPlus4 - 1;
+@@ -337,6 +338,7 @@
+ // stack after we restore all regs.
+ return Target;
+ }
++}
+
+
+
diff --git a/sys-devel/llvm/files/llvm-3.0-PPC_macro.patch b/sys-devel/llvm/files/llvm-3.0-PPC_macro.patch
new file mode 100644
index 0000000..c485e9b
--- /dev/null
+++ b/sys-devel/llvm/files/llvm-3.0-PPC_macro.patch
@@ -0,0 +1,43 @@
+Index: llvm-3.0-3.0/lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.h
+===================================================================
+--- llvm-3.0-3.0.orig/lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.h 2011-07-25 23:24:55.000000000 +0000
++++ llvm-3.0-3.0/lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.h 2011-12-02 13:06:48.000000000 +0000
+@@ -34,6 +34,10 @@
+
+ } // End llvm namespace
+
++// Generated files will use "namespace PPC". To avoid symbol clash,
++// undefine PPC here. PPC may be predefined on some hosts.
++#undef PPC
++
+ // Defines symbolic names for PowerPC registers. This defines a mapping from
+ // register name to register number.
+ //
+Index: llvm-3.0-3.0/lib/Target/PowerPC/MCTargetDesc/PPCPredicates.h
+===================================================================
+--- llvm-3.0-3.0.orig/lib/Target/PowerPC/MCTargetDesc/PPCPredicates.h 2011-07-26 00:24:13.000000000 +0000
++++ llvm-3.0-3.0/lib/Target/PowerPC/MCTargetDesc/PPCPredicates.h 2011-12-02 13:06:48.000000000 +0000
+@@ -14,6 +14,10 @@
+ #ifndef LLVM_TARGET_POWERPC_PPCPREDICATES_H
+ #define LLVM_TARGET_POWERPC_PPCPREDICATES_H
+
++// Generated files will use "namespace PPC". To avoid symbol clash,
++// undefine PPC here. PPC may be predefined on some hosts.
++#undef PPC
++
+ namespace llvm {
+ namespace PPC {
+ /// Predicate - These are "(BI << 5) | BO" for various predicates.
+Index: llvm-3.0-3.0/lib/Target/PowerPC/MCTargetDesc/PPCFixupKinds.h
+===================================================================
+--- llvm-3.0-3.0.orig/lib/Target/PowerPC/MCTargetDesc/PPCFixupKinds.h 2011-07-25 19:53:23.000000000 +0000
++++ llvm-3.0-3.0/lib/Target/PowerPC/MCTargetDesc/PPCFixupKinds.h 2011-12-02 16:21:23.000000000 +0000
+@@ -12,6 +12,8 @@
+
+ #include "llvm/MC/MCFixup.h"
+
++#undef PPC
++
+ namespace llvm {
+ namespace PPC {
+ enum Fixups {
diff --git a/sys-devel/llvm/files/llvm-3.0-gold_LTO_link.patch b/sys-devel/llvm/files/llvm-3.0-gold_LTO_link.patch
new file mode 100644
index 0000000..031448d
--- /dev/null
+++ b/sys-devel/llvm/files/llvm-3.0-gold_LTO_link.patch
@@ -0,0 +1,10 @@
+--- tools/gold/Makefile 2011/11/23 03:03:21 145094
++++ tools/gold/Makefile 2011/11/23 03:07:25 145095
+@@ -24,6 +24,6 @@
+ # Because off_t is used in the public API, the largefile parts are required for
+ # ABI compatibility.
+ CXXFLAGS+=-I$(BINUTILS_INCDIR) -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
+-CXXFLAGS+=$(SharedLibDir)/$(SharedPrefix)LTO$(SHLIBEXT)
++CXXFLAGS+=-L$(SharedLibDir)/$(SharedPrefix) -lLTO
+
+ include $(LEVEL)/Makefile.common
diff --git a/sys-devel/llvm/files/llvm-3.0-ocaml_install.patch b/sys-devel/llvm/files/llvm-3.0-ocaml_install.patch
new file mode 100644
index 0000000..18f5cf6
--- /dev/null
+++ b/sys-devel/llvm/files/llvm-3.0-ocaml_install.patch
@@ -0,0 +1,16 @@
+https://bugs.gentoo.org/show_bug.cgi?id=393023
+http://llvm.org/bugs/show_bug.cgi?id=11177
+
+Index: llvm-3.0-3.0/bindings/ocaml/llvm/Makefile
+===================================================================
+--- llvm-3.0-3.0.orig/bindings/ocaml/llvm/Makefile 2011-11-15 12:17:02.785987852 +0100
++++ llvm-3.0-3.0/bindings/ocaml/llvm/Makefile 2011-11-15 12:20:12.661983615 +0100
+@@ -30,7 +30,7 @@
+ $(OcamlDir)/META.llvm: META.llvm
+ $(Verb) $(CP) -f $< $@
+
+-install-meta:: $(ObjDir)/META.llvm
++install-meta:: $(ObjDir)/../META.llvm
+ $(Echo) "Install $(BuildMode) $(DestMETA)"
+ $(Verb) $(MKDIR) $(PROJ_libocamldir)
+ $(Verb) $(DataInstall) META.llvm "$(DestMETA)"
diff --git a/sys-devel/llvm/files/llvm-3.0-set_soname.patch b/sys-devel/llvm/files/llvm-3.0-set_soname.patch
new file mode 100644
index 0000000..69ba74d
--- /dev/null
+++ b/sys-devel/llvm/files/llvm-3.0-set_soname.patch
@@ -0,0 +1,12 @@
+https://bugs.gentoo.org/show_bug.cgi?id=409267
+http://llvm.org/bugs/show_bug.cgi?id=12334
+--- tools/llvm-shlib/Makefile.orig 2012-03-26 18:14:13.071797115 +0200
++++ tools/llvm-shlib/Makefile 2012-03-26 17:31:12.491196254 +0200
+@@ -67,6 +67,7 @@
+ # Include everything from the .a's into the shared library.
+ LLVMLibsOptions := -Wl,--whole-archive $(LLVMLibsOptions) \
+ -Wl,--no-whole-archive
++ LLVMLibsOptions += -Wl,--soname,lib$(LIBRARYNAME)$(SHLIBEXT)
+ endif
+
+ ifeq ($(HOST_OS),Linux)
diff --git a/sys-devel/llvm/files/llvm-3.1-fix_debug_line_info.patch b/sys-devel/llvm/files/llvm-3.1-fix_debug_line_info.patch
new file mode 100644
index 0000000..de2d46b
--- /dev/null
+++ b/sys-devel/llvm/files/llvm-3.1-fix_debug_line_info.patch
@@ -0,0 +1,65 @@
+From 737fdba46f2b2b7d39bc728d15ea2334c44779e0 Mon Sep 17 00:00:00 2001
+From: Ben Longbons <b.r.longbons@gmail.com>
+Date: Fri, 29 Jun 2012 12:58:34 -0700
+Subject: [PATCH] Revert "Patch to set is_stmt a little better for prologue
+ lines in a function."
+
+This meants that the debugger could find meaningful line information.
+
+This reverts commit 60b35f408bc3194e7ea4e96367c0b42dc5e7f850.
+---
+ lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 7 ++-----
+ test/DebugInfo/X86/ending-run.ll | 6 ++----
+ 2 files changed, 4 insertions(+), 9 deletions(-)
+
+diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+index 3e79a6d..24aedfb 100644
+--- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
++++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+@@ -1093,15 +1093,12 @@ void DwarfDebug::beginInstruction(const MachineInstr *MI) {
+ if (!MI->isDebugValue()) {
+ DebugLoc DL = MI->getDebugLoc();
+ if (DL != PrevInstLoc && (!DL.isUnknown() || UnknownLocations)) {
+- unsigned Flags = 0;
++ unsigned Flags = DWARF2_FLAG_IS_STMT;
+ PrevInstLoc = DL;
+ if (DL == PrologEndLoc) {
+ Flags |= DWARF2_FLAG_PROLOGUE_END;
+ PrologEndLoc = DebugLoc();
+ }
+- if (PrologEndLoc.isUnknown())
+- Flags |= DWARF2_FLAG_IS_STMT;
+-
+ if (!DL.isUnknown()) {
+ const MDNode *Scope = DL.getScope(Asm->MF->getFunction()->getContext());
+ recordSourceLine(DL.getLine(), DL.getCol(), Scope, Flags);
+@@ -1382,7 +1379,7 @@ void DwarfDebug::beginFunction(const MachineFunction *MF) {
+ MF->getFunction()->getContext());
+ recordSourceLine(FnStartDL.getLine(), FnStartDL.getCol(),
+ FnStartDL.getScope(MF->getFunction()->getContext()),
+- 0);
++ DWARF2_FLAG_IS_STMT);
+ }
+ }
+
+diff --git a/test/DebugInfo/X86/ending-run.ll b/test/DebugInfo/X86/ending-run.ll
+index 6935c47..0cd3de1 100644
+--- a/test/DebugInfo/X86/ending-run.ll
++++ b/test/DebugInfo/X86/ending-run.ll
+@@ -1,11 +1,9 @@
+ ; RUN: llc -mtriple=x86_64-apple-darwin %s -o %t -filetype=obj
+ ; RUN: llvm-dwarfdump %t | FileCheck %s
+
+-; Check that the line table starts at 7, not 4, but that the first
+-; statement isn't until line 8.
++; Check that the line table starts at 7, not 4.
+
+-; CHECK-NOT: 0x0000000000000000 7 0 1 0 is_stmt
+-; CHECK: 0x0000000000000000 7 0 1 0
++; CHECK: 0x0000000000000000 7 0 1 0 is_stmt
+ ; CHECK: 0x0000000000000004 8 18 1 0 is_stmt prologue_end
+
+ define i32 @callee(i32 %x) nounwind uwtable ssp {
+--
+1.7.10
+
diff --git a/sys-devel/llvm/files/llvm-3.1-ivybridge_support.patch b/sys-devel/llvm/files/llvm-3.1-ivybridge_support.patch
new file mode 100644
index 0000000..a03ec42
--- /dev/null
+++ b/sys-devel/llvm/files/llvm-3.1-ivybridge_support.patch
@@ -0,0 +1,13 @@
+--- llvm/trunk/lib/Support/Host.cpp 2012/04/23 22:22:46 155401
++++ llvm/trunk/lib/Support/Host.cpp 2012/04/23 22:41:39 155402
+@@ -230,6 +230,10 @@
+ case 45:
+ return "corei7-avx";
+
++ // Ivy Bridge:
++ case 58:
++ return "core-avx-i";
++
+ case 28: // Intel Atom processor. All processors are manufactured using
+ // the 45 nm process
+ return "atom";
diff --git a/sys-devel/llvm/files/llvm-3.2-nodoctargz.patch b/sys-devel/llvm/files/llvm-3.2-nodoctargz.patch
new file mode 100644
index 0000000..3a622b5
--- /dev/null
+++ b/sys-devel/llvm/files/llvm-3.2-nodoctargz.patch
@@ -0,0 +1,45 @@
+--- docs/Makefile.orig 2012-04-30 17:00:01.000000000 +0200
++++ docs/Makefile 2012-04-30 17:15:52.000000000 +0200
+@@ -52,11 +52,10 @@
+ # 'make generated BUILD_FOR_WEBSITE=1'
+ generated:: $(generated_targets)
+
+-install-html: $(PROJ_OBJ_DIR)/html.tar.gz
++install-html:
+ $(Echo) Installing HTML documentation
+ $(Verb) $(MKDIR) $(DESTDIR)$(PROJ_docsdir)/html
+ $(Verb) $(DataInstall) $(HTML) $(DESTDIR)$(PROJ_docsdir)/html
+- $(Verb) $(DataInstall) $(PROJ_OBJ_DIR)/html.tar.gz $(DESTDIR)$(PROJ_docsdir)
+
+ $(PROJ_OBJ_DIR)/html.tar.gz: $(HTML)
+ $(Echo) Packaging HTML documentation
+@@ -68,12 +67,11 @@
+ install-doxygen: doxygen
+ $(Echo) Installing doxygen documentation
+ $(Verb) $(MKDIR) $(DESTDIR)$(PROJ_docsdir)/html/doxygen
+- $(Verb) $(DataInstall) $(PROJ_OBJ_DIR)/doxygen.tar.gz $(DESTDIR)$(PROJ_docsdir)
+ $(Verb) cd $(PROJ_OBJ_DIR)/doxygen && \
+ $(FIND) . -type f -exec \
+ $(DataInstall) {} $(DESTDIR)$(PROJ_docsdir)/html/doxygen \;
+
+-doxygen: regendoc $(PROJ_OBJ_DIR)/doxygen.tar.gz
++doxygen: regendoc
+
+ regendoc:
+ $(Echo) Building doxygen documentation
+@@ -99,7 +97,6 @@
+ install-ocamldoc: ocamldoc
+ $(Echo) Installing ocamldoc documentation
+ $(Verb) $(MKDIR) $(DESTDIR)$(PROJ_docsdir)/ocamldoc/html
+- $(Verb) $(DataInstall) $(PROJ_OBJ_DIR)/ocamldoc.tar.gz $(DESTDIR)$(PROJ_docsdir)
+ $(Verb) cd $(PROJ_OBJ_DIR)/ocamldoc && \
+ $(FIND) . -type f -exec \
+ $(DataInstall) {} $(DESTDIR)$(PROJ_docsdir)/ocamldoc/html \;
+@@ -109,7 +106,6 @@
+ $(Verb) $(RM) -rf $(PROJ_OBJ_DIR)/ocamldoc.tar*
+ $(Verb) $(TAR) cf $(PROJ_OBJ_DIR)/ocamldoc.tar ocamldoc
+ $(Verb) $(GZIPBIN) $(PROJ_OBJ_DIR)/ocamldoc.tar
+- $(Verb) $(CP) $(PROJ_OBJ_DIR)/ocamldoc.tar.gz $(PROJ_OBJ_DIR)/ocamldoc/html/
+
+ regen-ocamldoc:
+ $(Echo) Building ocamldoc documentation
diff --git a/sys-devel/llvm/llvm-3.1-r121.ebuild b/sys-devel/llvm/llvm-3.1-r121.ebuild
new file mode 100644
index 0000000..1f06bf6
--- /dev/null
+++ b/sys-devel/llvm/llvm-3.1-r121.ebuild
@@ -0,0 +1,191 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-devel/llvm/llvm-3.1-r2.ebuild,v 1.3 2012/08/05 14:04:09 ryao Exp $
+
+EAPI="4"
+PYTHON_DEPEND="2"
+inherit eutils flag-o-matic multilib toolchain-funcs python pax-utils
+
+DESCRIPTION="Low Level Virtual Machine"
+HOMEPAGE="http://llvm.org/"
+SRC_URI="http://llvm.org/releases/${PV}/${P}.src.tar.gz"
+
+LICENSE="UoI-NCSA"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~ppc ~x86 ~amd64-fbsd ~x86-fbsd ~x64-freebsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos"
+IUSE="debug gold +libffi multitarget ocaml test udis86 vim-syntax"
+
+DEPEND="dev-lang/perl
+ >=sys-devel/make-3.79
+ >=sys-devel/flex-2.5.4
+ >=sys-devel/bison-1.875d
+ || ( >=sys-devel/gcc-3.0 >=sys-devel/gcc-apple-4.2.1 )
+ || ( >=sys-devel/binutils-2.18 >=sys-devel/binutils-apple-3.2.3 )
+ gold? ( >=sys-devel/binutils-2.22[cxx] )
+ libffi? ( virtual/pkgconfig
+ virtual/libffi )
+ ocaml? ( dev-lang/ocaml )
+ udis86? ( amd64? ( dev-libs/udis86[pic] )
+ !amd64? ( dev-libs/udis86 ) )"
+RDEPEND="dev-lang/perl
+ libffi? ( virtual/libffi )
+ vim-syntax? ( || ( app-editors/vim app-editors/gvim ) )"
+
+S=${WORKDIR}/${P}.src
+
+pkg_setup() {
+ # Required for test and build
+ python_set_active_version 2
+ python_pkg_setup
+
+ # need to check if the active compiler is ok
+
+ broken_gcc=" 3.2.2 3.2.3 3.3.2 4.1.1 "
+ broken_gcc_x86=" 3.4.0 3.4.2 "
+ broken_gcc_amd64=" 3.4.6 "
+
+ gcc_vers=$(gcc-fullversion)
+
+ if [[ ${broken_gcc} == *" ${version} "* ]] ; then
+ elog "Your version of gcc is known to miscompile llvm."
+ elog "Check http://www.llvm.org/docs/GettingStarted.html for"
+ elog "possible solutions."
+ die "Your currently active version of gcc is known to miscompile llvm"
+ fi
+
+ if [[ ${CHOST} == i*86-* && ${broken_gcc_x86} == *" ${version} "* ]] ; then
+ elog "Your version of gcc is known to miscompile llvm on x86"
+ elog "architectures. Check"
+ elog "http://www.llvm.org/docs/GettingStarted.html for possible"
+ elog "solutions."
+ die "Your currently active version of gcc is known to miscompile llvm"
+ fi
+
+ if [[ ${CHOST} == x86_64-* && ${broken_gcc_amd64} == *" ${version} "* ]];
+ then
+ elog "Your version of gcc is known to miscompile llvm in amd64"
+ elog "architectures. Check"
+ elog "http://www.llvm.org/docs/GettingStarted.html for possible"
+ elog "solutions."
+ die "Your currently active version of gcc is known to miscompile llvm"
+ fi
+}
+
+src_prepare() {
+ # unfortunately ./configure won't listen to --mandir and the-like, so take
+ # care of this.
+ einfo "Fixing install dirs"
+ sed -e 's,^PROJ_docsdir.*,PROJ_docsdir := $(PROJ_prefix)/share/doc/'${PF}, \
+ -e 's,^PROJ_etcdir.*,PROJ_etcdir := '"${EPREFIX}"'/etc/llvm,' \
+ -e 's,^PROJ_libdir.*,PROJ_libdir := $(PROJ_prefix)/'$(get_libdir)/${PN}, \
+ -i Makefile.config.in || die "Makefile.config sed failed"
+ sed -e "/ActiveLibDir = ActivePrefix/s/lib/$(get_libdir)\/${PN}/" \
+ -i tools/llvm-config/llvm-config.cpp || die "llvm-config sed failed"
+
+ einfo "Fixing rpath and CFLAGS"
+ sed -e 's,\$(RPATH) -Wl\,\$(\(ToolDir\|LibDir\)),$(RPATH) -Wl\,'"${EPREFIX}"/usr/$(get_libdir)/${PN}, \
+ -e '/OmitFramePointer/s/-fomit-frame-pointer//' \
+ -i Makefile.rules || die "rpath sed failed"
+ if use gold; then
+ sed -e 's,\$(SharedLibDir),'"${EPREFIX}"/usr/$(get_libdir)/${PN}, \
+ -i tools/gold/Makefile || die "gold rpath sed failed"
+ fi
+
+ # Specify python version
+ python_convert_shebangs -r 2 test/Scripts
+
+ epatch "${FILESDIR}"/${PN}-2.6-commandguide-nops.patch
+ epatch "${FILESDIR}"/${PN}-2.9-nodoctargz.patch
+ epatch "${FILESDIR}"/${PN}-3.0-PPC_macro.patch
+ epatch "${FILESDIR}"/${P}-ivybridge_support.patch
+ epatch "${FILESDIR}"/${P}-fix_debug_line_info.patch
+ epatch "${FILESDIR}"/ExceptionTableOverflowFix.patch
+
+ # Apply r600 OpenCL-related patches, bug #425688
+ epatch "${FILESDIR}"/cl-patches/*.patch
+
+ # User patches
+ epatch_user
+}
+
+src_configure() {
+ local CONF_FLAGS="--enable-shared
+ --with-optimize-option=
+ $(use_enable !debug optimized)
+ $(use_enable debug assertions)
+ $(use_enable debug expensive-checks)"
+
+ if use multitarget; then
+ CONF_FLAGS="${CONF_FLAGS} --enable-targets=all"
+ else
+ CONF_FLAGS="${CONF_FLAGS} --enable-targets=host,cpp"
+ fi
+
+ if use amd64; then
+ CONF_FLAGS="${CONF_FLAGS} --enable-pic"
+ fi
+
+ if use gold; then
+ CONF_FLAGS="${CONF_FLAGS} --with-binutils-include=${EPREFIX}/usr/include/"
+ fi
+ if use ocaml; then
+ CONF_FLAGS="${CONF_FLAGS} --enable-bindings=ocaml"
+ else
+ CONF_FLAGS="${CONF_FLAGS} --enable-bindings=none"
+ fi
+
+ if use udis86; then
+ CONF_FLAGS="${CONF_FLAGS} --with-udis86"
+ fi
+
+ if use libffi; then
+ append-cppflags "$(pkg-config --cflags libffi)"
+ fi
+ CONF_FLAGS="${CONF_FLAGS} $(use_enable libffi)"
+
+ # llvm prefers clang over gcc, so we may need to force that
+ tc-export CC CXX
+ econf ${CONF_FLAGS}
+}
+
+src_compile() {
+ emake VERBOSE=1 KEEP_SYMBOLS=1 REQUIRES_RTTI=1
+
+ pax-mark m Release/bin/lli
+ if use test; then
+ pax-mark m unittests/ExecutionEngine/JIT/Release/JITTests
+ fi
+}
+
+src_install() {
+ emake KEEP_SYMBOLS=1 DESTDIR="${D}" install
+
+ if use vim-syntax; then
+ insinto /usr/share/vim/vimfiles/syntax
+ doins utils/vim/*.vim
+ fi
+
+ # Fix install_names on Darwin. The build system is too complicated
+ # to just fix this, so we correct it post-install
+ local lib= f= odylib=
+ if [[ ${CHOST} == *-darwin* ]] ; then
+ for lib in lib{EnhancedDisassembly,LLVM-${PV},LTO,profile_rt}.dylib {BugpointPasses,LLVMHello}.dylib ; do
+ # libEnhancedDisassembly is Darwin10 only, so non-fatal
+ [[ -f ${ED}/usr/lib/${PN}/${lib} ]] || continue
+ ebegin "fixing install_name of $lib"
+ install_name_tool \
+ -id "${EPREFIX}"/usr/lib/${PN}/${lib} \
+ "${ED}"/usr/lib/${PN}/${lib}
+ eend $?
+ done
+ for f in "${ED}"/usr/bin/* "${ED}"/usr/lib/${PN}/libLTO.dylib ; do
+ odylib=$(scanmacho -BF'%n#f' "${f}" | tr ',' '\n' | grep libLLVM-${PV}.dylib)
+ ebegin "fixing install_name reference to ${odylib} of ${f##*/}"
+ install_name_tool \
+ -change "${odylib}" \
+ "${EPREFIX}"/usr/lib/${PN}/libLLVM-${PV}.dylib \
+ "${f}"
+ eend $?
+ done
+ fi
+}