debian/0000755000000000000000000000000012245462474007200 5ustar debian/changelog0000644000000000000000000001421612245462474011056 0ustar dragonegg (3.3-2) unstable; urgency=low * Fix FTBFS under arm. Thanks to Dan Chen (Closes: #715424) -- Sylvestre Ledru Wed, 27 Nov 2013 22:33:48 +0100 dragonegg (3.3-1) unstable; urgency=low * Upload to unstable (Closes: #686231) -- Sylvestre Ledru Sun, 07 Jul 2013 15:21:34 +0200 dragonegg (3.3-1~exp1) experimental; urgency=low * New upstream release * get ride of the support of 4.6 and provide 4.8 * Enable hardening flags also to the linker * dragonegg: empty-binary-package fixed (dependency package) -- Sylvestre Ledru Tue, 11 Jun 2013 14:44:21 +0200 dragonegg (3.2-1) unstable; urgency=low * Upload to unstable * Standards-Version updated to 3.9.4 -- Sylvestre Ledru Thu, 09 May 2013 22:22:36 +0200 dragonegg (3.2-1~exp2) experimental; urgency=low [ Matthias Klose ] * Remove subversion from the build-depends (Closes: #700070) * Link with the shared llvm library (Closes: #700071) -- Sylvestre Ledru Fri, 08 Feb 2013 09:11:44 +0100 dragonegg (3.2-1~exp1) experimental; urgency=low * New upstream release -- Sylvestre Ledru Fri, 21 Dec 2012 08:48:56 +0100 dragonegg (3.2~rc3-1~exp1) experimental; urgency=low * New testing release -- Sylvestre Ledru Thu, 06 Dec 2012 15:22:19 +0100 dragonegg (3.2~rc2-1~exp1) experimental; urgency=low * New testing release -- Sylvestre Ledru Tue, 04 Dec 2012 20:43:40 +0100 Bdragonegg (3.1-2) unstable; urgency=low [ Vincent Legout ] * debian/rules: Build with DISABLE_VERSION_CHECK=1 to be able to use a different gcc version that the one dragonegg was built against. (Closes: #679914) -- Sylvestre Ledru Sun, 15 Jul 2012 23:29:32 +0200 dragonegg (3.1-1) unstable; urgency=low * New upstream release * Introduce new dragonegg packages to manage both gcc 4.6 & 4.7: - dragonegg-4.6 & llvm-gcc-4.6 - dragonegg-4.7 & llvm-gcc-4.7 The package dragonegg will install version 4.6 -- Sylvestre Ledru Wed, 30 May 2012 15:32:20 +0200 dragonegg (3.0-3.2) unstable; urgency=low * Build-depend on g++-4.6. -- Matthias Klose Wed, 23 May 2012 00:27:00 +0000 dragonegg (3.0-3.1) unstable; urgency=low * Non maintainer upload * Explicitly build using GCC 4.6. Closes: #667153. -- Matthias Klose Tue, 22 May 2012 23:42:58 +0000 dragonegg (3.0-3) unstable; urgency=low * Standards-Version updated to version 3.9.3 * Update of the uploader list * Support of arm. Thanks to Matthias Klose for the patch * Enhance the error message (LP: #923349, #941407) (Closes: #656616) -- Sylvestre Ledru Tue, 06 Mar 2012 22:31:11 +0100 dragonegg (3.0-2) unstable; urgency=low * Install of llvm-gcc-4.6 removes llvm-gcc-4.5 (Closes: #656610) -- Sylvestre Ledru Fri, 17 Feb 2012 13:09:28 +0100 dragonegg (3.0-1) unstable; urgency=low [ Matthias Klose ] * New upstream version. * Build for gcc-4.6. * Linked against the shared libLLVM. [ Sylvestre Ledru ] * Switch to dpkg-source 3.0 (quilt) format -- Sylvestre Ledru Mon, 05 Dec 2011 13:23:18 +0100 dragonegg (2.9-2) unstable; urgency=low * Fix (probably) the kfreebsd FTBFS (Closes: #635288) -- Sylvestre Ledru Mon, 25 Jul 2011 11:34:20 +0200 dragonegg (2.9-1) unstable; urgency=low * New upstream release. Fix build issues. (Closes: #633946) (LP: #770819) * Watch file added -- Sylvestre Ledru Sun, 24 Jul 2011 12:32:35 +0200 dragonegg (2.8-3) unstable; urgency=low * Upload to unstable * Update of the tags Vcs-Svn & Vcs-Browser * Use c++ instead of c++-4.5 for llvm-c++ (Closes: #625893) * Allows usage of llvm-gcc-4.5 even if built with different versions of gcc it has been built (and display a warning when it is the case). (Closes: #618768) * Standards-Version updated to version 3.9.2 -- Sylvestre Ledru Fri, 06 May 2011 23:28:33 +0200 dragonegg (2.8-1) experimental; urgency=low * Sync from Ubuntu * New upstream release * Incompatible plugin version fixed (Closes: #578381) * LLVM Packaging team is now the maintainer * Add myself to the uploader * Standards-Version updated to version 3.9.1 * Switch to dpkg-source 3.0 (quilt) format -- Sylvestre Ledru Mon, 14 Feb 2011 00:24:46 +0100 dragonegg (2.8-0ubuntu1) maverick-proposed; urgency=low * Final 2.8 release. LP: #632727. -- Matthias Klose Thu, 14 Oct 2010 18:50:58 +0200 dragonegg (2.8~20101006-0ubuntu1) maverick; urgency=low * New upstream version, taken from the trunk. -- Matthias Klose Wed, 06 Oct 2010 16:05:42 +0200 dragonegg (2.8~20100921-0ubuntu1) maverick; urgency=low * New upstream version, taken from the trunk. -- Matthias Klose Tue, 21 Sep 2010 22:39:41 +0200 dragonegg (2.8~20100911-0ubuntu1) maverick; urgency=low * New upstream version, taken from the trunk. -- Matthias Klose Mon, 13 Sep 2010 10:37:04 +0200 dragonegg (2.8~20100907-0ubuntu1) maverick; urgency=low * New upstream version, taken from the trunk. -- Matthias Klose Tue, 07 Sep 2010 17:24:30 +0200 dragonegg (2.7-0ubuntu2) maverick; urgency=low * Build-depend on llvm-2.7-dev. -- Matthias Klose Wed, 02 Jun 2010 00:22:09 +0200 dragonegg (2.7-0ubuntu1) maverick; urgency=low * Upload to maverick. -- Matthias Klose Fri, 21 May 2010 13:22:45 +0200 dragonegg (2.7-0ubuntu1~ppa3) lucid; urgency=low * New upstream version. -- Matthias Klose Tue, 27 Apr 2010 15:09:49 +0200 dragonegg (0~20091229-2) experimental; urgency=low * control (llvm-gcc-4.5): Provide and conflict with llvm-gcc. -- Robert Millan Mon, 04 Jan 2010 13:15:08 +0100 dragonegg (0~20091229-1) experimental; urgency=low * Initial release. (Closes: #563315) -- Robert Millan Fri, 01 Jan 2010 22:55:02 +0100 debian/control0000644000000000000000000000673512155640052010604 0ustar Source: dragonegg Section: devel Priority: optional Maintainer: LLVM Packaging Team Uploaders: Robert Millan , Sylvestre Ledru Build-Depends: cdbs, dpkg-dev (>= 1.16.1~), debhelper (>= 7), gcc-4.7-plugin-dev (>= 4.7.2-10), gcc-4.8-plugin-dev, g++-4.7 (>= 4.7.2-10), g++-4.8, llvm-3.3-dev (>= 3.3), libffi-dev, libmpfr-dev, libmpc-dev Standards-Version: 3.9.4 Homepage: http://dragonegg.llvm.org/ Vcs-Svn: svn://svn.debian.org/svn/pkg-llvm/dragonegg/trunk/ Vcs-Browser: http://svn.debian.org/viewsvn/pkg-llvm/dragonegg/trunk/ Package: dragonegg Architecture: i386 kfreebsd-i386 hurd-i386 kopensolaris-i386 amd64 kfreebsd-amd64 lpia armel armhf Depends: ${shlibs:Depends}, ${misc:Depends}, dragonegg-4.7 Description: GCC plugin that uses LLVM for optimization and code generation DragonEgg is a GCC plugin (dragonegg.so) that replaces GCC's optimizers and code generators with those from the LLVM project. . It is a reimplementation of llvm-gcc that works with gcc-4.6 or later. . DragonEgg is under heavy development and is not mature - it may crash or produce wrong code. . This package is a dependency package. Package: dragonegg-4.7 Architecture: i386 kfreebsd-i386 hurd-i386 kopensolaris-i386 amd64 kfreebsd-amd64 lpia armel armhf Depends: ${shlibs:Depends}, ${misc:Depends} Recommends: gcc-4.7 | g++-4.7 Description: GCC plugin that uses LLVM for optimization and code generation DragonEgg is a GCC plugin (dragonegg.so) that replaces GCC's optimizers and code generators with those from the LLVM project. . It is a reimplementation of llvm-gcc that works with gcc-4.6 or later. . DragonEgg is under heavy development and is not mature - it may crash or produce wrong code. Package: dragonegg-4.8 Architecture: i386 kfreebsd-i386 hurd-i386 kopensolaris-i386 amd64 kfreebsd-amd64 lpia armel armhf Depends: ${shlibs:Depends}, ${misc:Depends} Recommends: gcc-4.8 | g++-4.8 Replaces: dragonegg (<< 3.3) Breaks: dragonegg (<< 3.3) Description: GCC plugin that uses LLVM for optimization and code generation DragonEgg is a GCC plugin (dragonegg.so) that replaces GCC's optimizers and code generators with those from the LLVM project. . It is a reimplementation of llvm-gcc that works with gcc-4.8 or later. . DragonEgg is under heavy development and is not mature - it may crash or produce wrong code. Package: llvm-gcc-4.7 Architecture: i386 kfreebsd-i386 hurd-i386 kopensolaris-i386 amd64 kfreebsd-amd64 lpia armel armhf Depends: ${shlibs:Depends}, ${misc:Depends}, dragonegg-4.7, gcc-4.7, g++-4.7 Replaces: llvm-gcc-4.6 Breaks: llvm-gcc-4.6 Description: C front end for LLVM C/C++ compiler The Low-Level Virtual Machine (LLVM) is a collection of libraries and tools that make it easy to build compilers, optimizers, Just-In-Time code generators, and many other compiler-related programs. . This is the DragonEgg-based version of llvm-gcc. Package: llvm-gcc-4.8 Architecture: i386 kfreebsd-i386 hurd-i386 kopensolaris-i386 amd64 kfreebsd-amd64 lpia armel armhf Depends: ${shlibs:Depends}, ${misc:Depends}, dragonegg-4.8, gcc-4.8, g++-4.8 Provides: llvm-gcc Conflicts: llvm-gcc, llvm-gcc-4.5 Replaces: llvm-gcc-4.5 Description: C front end for LLVM C/C++ compiler The Low-Level Virtual Machine (LLVM) is a collection of libraries and tools that make it easy to build compilers, optimizers, Just-In-Time code generators, and many other compiler-related programs. . This is the DragonEgg-based version of llvm-gcc. debian/compat0000644000000000000000000000000211654615457010402 0ustar 7 debian/patches/0000755000000000000000000000000012245462327010624 5ustar debian/patches/kfreebsd.diff0000644000000000000000000000120311667634603013244 0ustar Index: dragonegg-3.0.src/Makefile =================================================================== --- dragonegg-3.0.src.orig/Makefile 2011-12-05 13:27:47.000000000 +0100 +++ dragonegg-3.0.src/Makefile 2011-12-05 13:29:10.000000000 +0100 @@ -64,8 +64,9 @@ # NOTE: The following flags can only be used after TARGET_UTIL has been built. TARGET_HEADERS+=-DTARGET_NAME=\"$(shell $(TARGET_UTIL) -t)\" \ -I$(INCLUDE_DIR)/$(shell $(TARGET_UTIL) -p) \ - -I$(INCLUDE_DIR)/$(shell $(TARGET_UTIL) -o) - + -I$(INCLUDE_DIR)/$(shell $(TARGET_UTIL) -o) \ + -I$(SRC_DIR)/linux/ +# linux/ and freebsd/ have the same contents default: $(PLUGIN) debian/patches/dragonegg-arm.diff0000644000000000000000000010746411725477440014210 0ustar diff -urN ./dragonegg-3.0.src/include/arm/dragonegg/Target.h ./dragonegg-3.0.mod/include/arm/dragonegg/Target.h --- dragonegg-3.0.src/include/arm/dragonegg/Target.h 1970-01-01 09:00:00.000000000 +0900 +++ dragonegg-3.0.mod/include/arm/dragonegg/Target.h 2012-01-30 09:45:13.349995111 +0900 @@ -0,0 +1,281 @@ +//==----- Target.h - Target hooks for GCC to LLVM conversion -----*- C++ -*-==// +// +// Copyright (C) 2007, 2008, 2009, 2010, 2011 Anton Korobeynikov, Duncan Sands +// et al. +// +// This file is part of DragonEgg. +// +// DragonEgg is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free Software +// Foundation; either version 2, or (at your option) any later version. +// +// DragonEgg is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +// A PARTICULAR PURPOSE. See the GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along with +// DragonEgg; see the file COPYING. If not, write to the Free Software +// Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA. +// +//===----------------------------------------------------------------------===// +// This file declares some target-specific hooks for GCC to LLVM conversion. +// This file is derived from llvm-arm-target.h and arm.h on llvm-gcc.4.2. +//===----------------------------------------------------------------------===// + +#ifndef DRAGONEGG_TARGET_H +#define DRAGONEGG_TARGET_H + +/* LLVM specific code to select the calling conventions. The AAPCS + specification says that varargs functions must use the base standard + instead of the VFP hard float variant. We check for that with + (isVoid || hasArgList). */ + +/* from TARGET_AAPCS_BASED */ +#define DEFAULT_TARGET_AAPCS_BASED \ + (ARM_DEFAULT_ABI != ARM_ABI_APCS && ARM_DEFAULT_ABI != ARM_ABI_ATPCS) + +#define TARGET_ADJUST_LLVM_CC(CC, type) \ + { \ + if (TARGET_AAPCS_BASED) { \ + if (TARGET_VFP && TARGET_HARD_FLOAT_ABI && \ + ((TYPE_ARG_TYPES(type) == 0) || \ + (TREE_VALUE(tree_last(TYPE_ARG_TYPES(type))) == \ + void_type_node))) \ + CC = CallingConv::ARM_AAPCS_VFP; \ + else if (!DEFAULT_TARGET_AAPCS_BASED) \ + CC = CallingConv::ARM_AAPCS; \ + } else if (DEFAULT_TARGET_AAPCS_BASED) { \ + CC = CallingConv::ARM_APCS; \ + } \ + } + +#ifdef DRAGONEGG_ABI_H + +extern bool +llvm_arm_should_pass_aggregate_in_mixed_regs(tree_node *, Type *Ty, + CallingConv::ID, + std::vector&); + +#define LLVM_SHOULD_PASS_AGGREGATE_IN_MIXED_REGS(T, TY, CC, E) \ + llvm_arm_should_pass_aggregate_in_mixed_regs((T), (TY), (CC), (E)) + +struct DefaultABIClient; +extern bool +llvm_arm_try_pass_aggregate_custom(tree_node *, std::vector&, + CallingConv::ID CC, + struct DefaultABIClient*); + +#define LLVM_TRY_PASS_AGGREGATE_CUSTOM(T, E, CC, C) \ + llvm_arm_try_pass_aggregate_custom((T), (E), (CC), (C)) + +extern +bool llvm_arm_aggregate_partially_passed_in_regs(std::vector&, + std::vector&, + CallingConv::ID CC); + +#define LLVM_AGGREGATE_PARTIALLY_PASSED_IN_REGS(E, SE, ISR, CC) \ + llvm_arm_aggregate_partially_passed_in_regs((E), (SE), (CC)) + +extern Type *llvm_arm_aggr_type_for_struct_return(tree_node *type, + CallingConv::ID CC); + +/* LLVM_AGGR_TYPE_FOR_STRUCT_RETURN - Return LLVM Type if X can be + returned as an aggregate, otherwise return NULL. */ +#define LLVM_AGGR_TYPE_FOR_STRUCT_RETURN(X, CC) \ + llvm_arm_aggr_type_for_struct_return((X), (CC)) + +extern void llvm_arm_extract_multiple_return_value(Value *Src, Value *Dest, + bool isVolatile, + LLVMBuilder &B); + +/* LLVM_EXTRACT_MULTIPLE_RETURN_VALUE - Extract multiple return value from + SRC and assign it to DEST. */ +#define LLVM_EXTRACT_MULTIPLE_RETURN_VALUE(Src,Dest,V,B) \ + llvm_arm_extract_multiple_return_value((Src),(Dest),(V),(B)) + +extern +bool llvm_arm_should_pass_or_return_aggregate_in_regs(tree_node *TreeType, + CallingConv::ID CC); + +/* LLVM_SHOULD_NOT_USE_SHADOW_RETURN = Return true is the given type should + not be returned via a shadow parameter with the given calling conventions. */ +#define LLVM_SHOULD_NOT_USE_SHADOW_RETURN(X, CC) \ + llvm_arm_should_pass_or_return_aggregate_in_regs((X), (CC)) + +/* Vectors bigger than 128 are returned using sret. */ +#define LLVM_SHOULD_RETURN_VECTOR_AS_SHADOW(X, isBuiltin) \ + (TREE_INT_CST_LOW(TYPE_SIZE(X)) > 128) + +#endif /* DRAGONEGG_ABI_H */ + +#define LLVM_TARGET_INTRINSIC_PREFIX "arm" + +/* LLVM_TARGET_NAME - This specifies the name of the target, which correlates to + * the llvm::InitializeXXXTarget() function. + */ +#define LLVM_TARGET_NAME ARM + + +/* Turn -march=xx into a CPU type. + */ +#define LLVM_SET_SUBTARGET_FEATURES(C, F) \ + { switch (arm_tune) { \ + case arm8: C = ("arm8"); break;\ + case arm810: C = ("arm810"); break;\ + case strongarm: C = ("strongarm"); break;\ + case strongarm110: C = ("strongarm110"); break;\ + case strongarm1100: C = ("strongarm1100"); break;\ + case strongarm1110: C = ("strongarm1110"); break;\ + case arm7tdmi: C = ("arm7tdmi"); break;\ + case arm7tdmis: C = ("arm7tdmi-s"); break;\ + case arm710t: C = ("arm710t"); break;\ + case arm720t: C = ("arm720t"); break;\ + case arm740t: C = ("arm740t"); break;\ + case arm9: C = ("arm9"); break;\ + case arm9tdmi: C = ("arm9tdmi"); break;\ + case arm920: C = ("arm920"); break;\ + case arm920t: C = ("arm920t"); break;\ + case arm922t: C = ("arm922t"); break;\ + case arm940t: C = ("arm940t"); break;\ + case ep9312: C = ("ep9312"); break;\ + case arm10tdmi: C = ("arm10tdmi"); break;\ + case arm1020t: C = ("arm1020t"); break;\ + case arm9e: C = ("arm9e"); break;\ + case arm946es: C = ("arm946e-s"); break;\ + case arm966es: C = ("arm966e-s"); break;\ + case arm968es: C = ("arm968e-s"); break;\ + case arm10e: C = ("arm10e"); break;\ + case arm1020e: C = ("arm1020e"); break;\ + case arm1022e: C = ("arm1022e"); break;\ + case xscale: C = ("xscale"); break;\ + case iwmmxt: C = ("iwmmxt"); break;\ + case arm926ejs: C = ("arm926ej-s"); break;\ + case arm1026ejs: C = ("arm1026ej-s"); break;\ + case arm1136js: C = ("arm1136j-s"); break;\ + case arm1136jfs: C = ("arm1136jf-s"); break;\ + case arm1176jzs: C = ("arm1176jz-s"); break;\ + case arm1176jzfs: C = ("arm1176jzf-s"); break;\ + case mpcorenovfp: C = ("mpcorenovfp"); break;\ + case mpcore: C = ("mpcore"); break;\ + case arm1156t2s: C = ("arm1156t2-s"); break; \ + case arm1156t2fs: C = ("arm1156t2f-s"); break; \ + case cortexa8: C = ("cortex-a8"); break; \ + case cortexa9: C = ("cortex-a9"); break; \ + case cortexr4: C = ("cortex-r4"); break; \ + case cortexm3: C = ("cortex-m3"); break; \ + case cortexm4: C = ("cortex-m4"); break; \ + case cortexm0: C = ("cortex-m0"); break; \ + default: \ + C = ("arm7tdmi"); \ + break; \ + } \ + if (TARGET_VFP3) \ + F.AddFeature("vfp3"); \ + else { \ + F.AddFeature("vfp3", false); \ + if (TARGET_VFP && TARGET_HARD_FLOAT) \ + F.AddFeature("vfp2"); \ + else \ + F.AddFeature("vfp2", false); \ + } \ + if (TARGET_NEON) \ + F.AddFeature("neon"); \ + else \ + F.AddFeature("neon", false); \ + if (TARGET_FP16) \ + F.AddFeature("fp16"); \ + else \ + F.AddFeature("fp16", false); \ + } + +/* Encode arm / thumb modes and arm subversion number in the triplet. e.g. + * armv6-apple-darwin, thumbv5-apple-darwin. FIXME: Replace thumb triplets + * with function notes. + */ +#define LLVM_OVERRIDE_TARGET_ARCH() \ + (TARGET_THUMB \ + ? (arm_arch7 \ + ? "thumbv7" \ + : (arm_arch_thumb2 \ + ? "thumbv6t2" \ + : (arm_tune == cortexm0 \ + ? "thumbv6m" \ + : (arm_arch6 \ + ? "thumbv6" \ + : (arm_arch5e \ + ? "thumbv5e" \ + : (arm_arch5 \ + ? "thumbv5" \ + : (arm_arch4t \ + ? "thumbv4t" : ""))))))) \ + : (arm_arch7 \ + ? "armv7" \ + : (arm_arch_thumb2 \ + ? "armv6t2" \ + : (arm_arch6 \ + ? "armv6" \ + : (arm_arch5e \ + ? "armv5e" \ + : (arm_arch5 \ + ? "armv5" \ + : (arm_arch4t \ + ? "armv4t" \ + : (arm_arch4 \ + ? "armv4" : "")))))))) + +#if 0 +// Dragonegg should make flag_mkernel and flag_apple_kext option later on. +// We didn't decide place to make these flags. +#define LLVM_SET_MACHINE_OPTIONS(argvec) \ + if (flag_mkernel || flag_apple_kext) { \ + argvec.push_back("-arm-long-calls"); \ + argvec.push_back("-arm-strict-align"); \ + } +#endif + +#define LLVM_SET_TARGET_MACHINE_OPTIONS(options) \ + options.UseSoftFloat = TARGET_SOFT_FLOAT; \ + if (TARGET_HARD_FLOAT_ABI) \ + options.FloatABIType = llvm::FloatABI::Hard; + + +/* Doing struct copy by partial-word loads and stores is not a good idea on ARM. */ +#define TARGET_LLVM_MIN_BYTES_COPY_BY_MEMCPY 4 + +/* These are a couple of extensions to the asm formats + %@ prints out ASM_COMMENT_START + TODO: %r prints out REGISTER_PREFIX reg_names[arg] */ +#define LLVM_ASM_EXTENSIONS(ESCAPED_CHAR, ASM, RESULT) \ + else if ((ESCAPED_CHAR) == '@') { \ + (RESULT) += ASM_COMMENT_START; \ + } + +/* LLVM_TARGET_INTRINSIC_LOWER - To handle builtins, we want to expand the + invocation into normal LLVM code. If the target can handle the builtin, this + macro should call the target TreeToLLVM::TargetIntrinsicLower method and + return true. This macro is invoked from a method in the TreeToLLVM class. */ +#if 0 +// Because of data dependency, we will implement later on. +#define LLVM_TARGET_INTRINSIC_LOWER(EXP, BUILTIN_CODE, DESTLOC, RESULT, \ + DESTTY, OPS) \ + TargetIntrinsicLower(EXP, BUILTIN_CODE, DESTLOC, RESULT, DESTTY, OPS); +#endif + +/* LLVM_GET_REG_NAME - The registers known to llvm as "r10", "r11", and "r12" + may have different names in GCC. Register "r12" is called "ip", and on + non-Darwin OSs, "r10" is "sl" and "r11" is "fp". Translate those names. + For VFP registers, GCC doesn't distinguish between the q and d registers + so use the incoming register name if it exists. Otherwise, use the default + register names to match the backend. */ +#define LLVM_GET_REG_NAME(REG_NAME, REG_NUM) \ + ((REG_NUM) == 10 ? "r10" \ + : (REG_NUM) == 11 ? "r11" \ + : (REG_NUM) == 12 ? "r12" \ + : (REG_NUM) >= FIRST_VFP_REGNUM && REG_NAME != 0 ? REG_NAME \ + : reg_names[REG_NUM]) + +/* Define a static enumeration of the NEON builtins to be used when + converting to LLVM intrinsics. These names are derived from the + neon_builtin_data table in arm.c and should be kept in sync with that. */ + +#endif /* DRAGONEGG_TARGET_H */ diff -urN ./dragonegg-3.0.src/src/arm/Target.cpp ./dragonegg-3.0.mod/src/arm/Target.cpp --- dragonegg-3.0.src/src/arm/Target.cpp 1970-01-01 09:00:00.000000000 +0900 +++ dragonegg-3.0.mod/src/arm/Target.cpp 2012-01-30 09:49:08.789994744 +0900 @@ -0,0 +1,625 @@ +//===--------------- Target.cpp - Implements the IA-32 ABI. ---------------===// +// +// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011 Evan Cheng, +// Duncan Sands et al. +// +// This file is part of DragonEgg. +// +// DragonEgg is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free Software +// Foundation; either version 2, or (at your option) any later version. +// +// DragonEgg is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +// A PARTICULAR PURPOSE. See the GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along with +// DragonEgg; see the file COPYING. If not, write to the Free Software +// Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA. +// +//===----------------------------------------------------------------------===// +// This file implements specific LLVM IA-32 ABI. +// This file is derived from arm.c on llvm-gcc.4.2. +//===----------------------------------------------------------------------===// + +// Plugin headers +#include "dragonegg/ABI.h" +#include "dragonegg/Target.h" + +// LLVM headers +#include "llvm/Module.h" + +// System headers +#include + +// GCC headers +extern "C" { +#include "config.h" +// Stop GCC declaring 'getopt' as it can clash with the system's declaration. +#undef HAVE_DECL_GETOPT +#include "system.h" +#include "coretypes.h" +#include "target.h" +#include "tree.h" + +#include "diagnostic.h" +#include "gimple.h" +#include "toplev.h" +} + +static LLVMContext &Context = getGlobalContext(); + +// "Fundamental Data Types" according to the AAPCS spec. These are used +// to check that a given aggregate meets the criteria for a "homogeneous +// aggregate." +enum arm_fdts { + ARM_FDT_INVALID, + + ARM_FDT_HALF_FLOAT, + ARM_FDT_FLOAT, + ARM_FDT_DOUBLE, + + ARM_FDT_VECTOR_64, + ARM_FDT_VECTOR_128, + + ARM_FDT_MAX +}; + +// Classify type according to the number of fundamental data types contained +// among its members. Returns true if type is a homogeneous aggregate. +static bool +vfp_arg_homogeneous_aggregate_p(enum machine_mode mode, tree type, + int *fdt_counts) +{ + bool result = false; + HOST_WIDE_INT bytes = + (mode == BLKmode) ? int_size_in_bytes (type) : (int) GET_MODE_SIZE (mode); + + if (type && AGGREGATE_TYPE_P (type)) + { + int i; + int cnt = 0; + tree field; + + // Zero sized arrays or structures are not homogeneous aggregates. + if (!bytes) + return 0; + + // Classify each field of records. + switch (TREE_CODE (type)) + { + case RECORD_TYPE: + // For classes first merge in the field of the subclasses. + if (TYPE_BINFO (type)) { + tree binfo, base_binfo; + int basenum; + + for (binfo = TYPE_BINFO (type), basenum = 0; + BINFO_BASE_ITERATE (binfo, basenum, base_binfo); basenum++) { + int offset = tree_low_cst (BINFO_OFFSET (base_binfo), 0) * 4; + tree type = BINFO_TYPE (base_binfo); + + result = vfp_arg_homogeneous_aggregate_p(TYPE_MODE (type), type, + fdt_counts); + if (!result) + return false; + } + } + // And now merge the fields of structure. + for (field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field)) { + if (TREE_CODE (field) == FIELD_DECL) { + if (TREE_TYPE (field) == error_mark_node) + continue; + + result = vfp_arg_homogeneous_aggregate_p(TYPE_MODE(TREE_TYPE(field)), + TREE_TYPE(field), + fdt_counts); + if (!result) + return false; + } + } + break; + + case ARRAY_TYPE: + // Arrays are handled as small records. + { + int array_fdt_counts[ARM_FDT_MAX] = { 0 }; + + result = vfp_arg_homogeneous_aggregate_p(TYPE_MODE(TREE_TYPE(type)), + TREE_TYPE(type), + array_fdt_counts); + + cnt = bytes / int_size_in_bytes(TREE_TYPE(type)); + for (i = 0; i < ARM_FDT_MAX; ++i) + fdt_counts[i] += array_fdt_counts[i] * cnt; + + if (!result) + return false; + } + break; + + case UNION_TYPE: + case QUAL_UNION_TYPE: + { + // Unions are similar to RECORD_TYPE. + int union_fdt_counts[ARM_FDT_MAX] = { 0 }; + + // Unions are not derived. + gcc_assert (!TYPE_BINFO (type) + || !BINFO_N_BASE_BINFOS (TYPE_BINFO (type))); + for (field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field)) { + int union_field_fdt_counts[ARM_FDT_MAX] = { 0 }; + + if (TREE_CODE (field) == FIELD_DECL) { + if (TREE_TYPE (field) == error_mark_node) + continue; + + result = vfp_arg_homogeneous_aggregate_p( + TYPE_MODE(TREE_TYPE(field)), + TREE_TYPE(field), + union_field_fdt_counts); + if (!result) + return false; + + // track largest union field + for (i = 0; i < ARM_FDT_MAX; ++i) { + if (union_field_fdt_counts[i] > 4) // bail early if we can + return false; + + union_fdt_counts[i] = MAX(union_fdt_counts[i], + union_field_fdt_counts[i]); + union_field_fdt_counts[i] = 0; // clear it out for next iter + } + } + } + + // check for only one type across all union fields + cnt = 0; + for (i = 0; i < ARM_FDT_MAX; ++i) { + if (union_fdt_counts[i]) + ++cnt; + + if (cnt > 1) + return false; + + fdt_counts[i] += union_fdt_counts[i]; + } + } + break; + + default: + assert(0 && "What type is this?"); + } + + // Walk through fdt_counts. This is a homogeneous aggregate if + // only one FDT is used. + cnt = 0; + for (i = 0; i < ARM_FDT_MAX; ++i) { + if (fdt_counts[i]) { + // Make sure that one FDT is 4 or less elements in size. + if (fdt_counts[i] > 4) + return false; + ++cnt; + } + + if (cnt > 1) + return false; + } + + if (cnt == 0) + return false; + + return true; + } + + if (type) + { + int idx = 0; + int cnt = 0; + + switch (TREE_CODE(type)) + { + case REAL_TYPE: + idx = (TYPE_PRECISION(type) == 32) ? + ARM_FDT_FLOAT : + ((TYPE_PRECISION(type) == 64) ? + ARM_FDT_DOUBLE : + ARM_FDT_INVALID); + cnt = 1; + break; + + case COMPLEX_TYPE: + { + tree subtype = TREE_TYPE(type); + idx = (TYPE_PRECISION(subtype) == 32) ? + ARM_FDT_FLOAT : + ((TYPE_PRECISION(subtype) == 64) ? + ARM_FDT_DOUBLE : + ARM_FDT_INVALID); + cnt = 2; + } + break; + + case VECTOR_TYPE: + idx = (bytes == 8) ? + ARM_FDT_VECTOR_64 : + (bytes == 16) ? + ARM_FDT_VECTOR_128 : + ARM_FDT_INVALID; + cnt = 1; + break; + + case INTEGER_TYPE: + case POINTER_TYPE: + case ENUMERAL_TYPE: + case BOOLEAN_TYPE: + case REFERENCE_TYPE: + case FUNCTION_TYPE: + case METHOD_TYPE: + default: + return false; // All of these disqualify. + } + + fdt_counts[idx] += cnt; + return true; + } + else + assert(0 && "what type was this?"); + + return false; +} + +// Walk over an LLVM Type that we know is a homogeneous aggregate and +// push the proper LLVM Types that represent the register types to pass +// that struct member in. +static void push_elts(Type *Ty, std::vector &Elts) +{ + for (Type::subtype_iterator I = Ty->subtype_begin(), E = Ty->subtype_end(); + I != E; ++I) { + Type *STy = *I; + if (const VectorType *VTy = dyn_cast(STy)) { + switch (VTy->getBitWidth()) + { + case 64: // v2f32 + Elts.push_back(VectorType::get(Type::getFloatTy(Context), 2)); + break; + case 128: // v2f64 + Elts.push_back(VectorType::get(Type::getDoubleTy(Context), 2)); + break; + default: + assert (0 && "invalid vector type"); + } + } else if (ArrayType *ATy = dyn_cast(STy)) { + Type *ETy = ATy->getElementType(); + + for (uint64_t i = ATy->getNumElements(); i > 0; --i) + Elts.push_back(ETy); + } else if (STy->getNumContainedTypes()) + push_elts(STy, Elts); + else + Elts.push_back(STy); + } +} + +static unsigned count_num_words(std::vector &ScalarElts) { + unsigned NumWords = 0; + for (unsigned i = 0, e = ScalarElts.size(); i != e; ++i) { + Type *Ty = ScalarElts[i]; + if (Ty->isPointerTy()) { + NumWords++; + } else if (Ty->isIntegerTy()) { + const unsigned TypeSize = Ty->getPrimitiveSizeInBits(); + const unsigned NumWordsForType = (TypeSize + 31) / 32; + + NumWords += NumWordsForType; + } else { + assert (0 && "Unexpected type."); + } + } + return NumWords; +} + +// This function is used only on AAPCS. The difference from the generic +// handling of arguments is that arguments larger than 32 bits are split +// and padding arguments are added as necessary for alignment. This makes +// the IL a bit more explicit about how arguments are handled. +extern bool +llvm_arm_try_pass_aggregate_custom(tree type, + std::vector& ScalarElts, + CallingConv::ID CC, + struct DefaultABIClient* C) { + if (CC != CallingConv::ARM_AAPCS && CC != CallingConv::C) + return false; + + if (CC == CallingConv::C && !TARGET_AAPCS_BASED) + return false; + + if (TARGET_HARD_FLOAT_ABI) + return false; + Type *Ty = ConvertType(type); + if (Ty->isPointerTy()) + return false; + + const unsigned Size = TREE_INT_CST_LOW(TYPE_SIZE(type))/8; + const unsigned Alignment = TYPE_ALIGN(type)/8; + const unsigned NumWords = count_num_words(ScalarElts); + const bool AddPad = Alignment >= 8 && (NumWords % 2); + + // First, build a type that will be bitcast to the original one and + // from where elements will be extracted. + std::vector Elts; + Type* Int32Ty = Type::getInt32Ty(getGlobalContext()); + const unsigned NumRegularArgs = Size / 4; + for (unsigned i = 0; i < NumRegularArgs; ++i) { + Elts.push_back(Int32Ty); + } + const unsigned RestSize = Size % 4; + llvm::Type *RestType = NULL; + if (RestSize> 2) { + RestType = Type::getInt32Ty(getGlobalContext()); + } else if (RestSize > 1) { + RestType = Type::getInt16Ty(getGlobalContext()); + } else if (RestSize > 0) { + RestType = Type::getInt8Ty(getGlobalContext()); + } + if (RestType) + Elts.push_back(RestType); + StructType *STy = StructType::get(getGlobalContext(), Elts, false); + + if (AddPad) { + ScalarElts.push_back(Int32Ty); + C->HandlePad(Int32Ty); + } + + for (unsigned i = 0; i < NumRegularArgs; ++i) { + C->EnterField(i, STy); + C->HandleScalarArgument(Int32Ty, 0); + ScalarElts.push_back(Int32Ty); + C->ExitField(); + } + if (RestType) { + C->EnterField(NumRegularArgs, STy); + C->HandleScalarArgument(RestType, 0, RestSize); + ScalarElts.push_back(RestType); + C->ExitField(); + } + return true; +} + +// Target hook for llvm-abi.h. It returns true if an aggregate of the +// specified type should be passed in a number of registers of mixed types. +// It also returns a vector of types that correspond to the registers used +// for parameter passing. This only applies to AAPCS-VFP "homogeneous +// aggregates" as specified in 4.3.5 of the AAPCS spec. +bool +llvm_arm_should_pass_aggregate_in_mixed_regs(tree TreeType, Type *Ty, + CallingConv::ID CC, + std::vector &Elts) { + if (!llvm_arm_should_pass_or_return_aggregate_in_regs(TreeType, CC)) + return false; + + // Walk Ty and push LLVM types corresponding to register types onto + // Elts. + push_elts(Ty, Elts); + + return true; +} + +static bool alloc_next_spr(bool *SPRs) +{ + for (int i = 0; i < 16; ++i) + if (!SPRs[i]) { + SPRs[i] = true; + return true; + } + return false; +} + +static bool alloc_next_dpr(bool *SPRs) +{ + for (int i = 0; i < 16; i += 2) + if (!SPRs[i]) { + SPRs[i] = SPRs[i+1] = true; + return true; + } + return false; +} + +static bool alloc_next_qpr(bool *SPRs) { + for (int i = 0; i < 16; i += 4) + if (!SPRs[i]) { + SPRs[i] = SPRs[i+1] = SPRs[i+2] = SPRs[i+3] = true; + return true; + } + return false; +} + +// count_num_registers_uses - Simulate argument passing reg allocation in SPRs. +// Caller is expected to zero out SPRs. Returns true if all of ScalarElts fit +// in registers. +static bool count_num_registers_uses(std::vector &ScalarElts, + bool *SPRs) { + for (unsigned i = 0, e = ScalarElts.size(); i != e; ++i) { + Type *Ty = ScalarElts[i]; + if (const VectorType *VTy = dyn_cast(Ty)) { + switch (VTy->getBitWidth()) + { + case 64: + if (!alloc_next_dpr(SPRs)) + return false; + break; + case 128: + if (!alloc_next_qpr(SPRs)) + return false; + break; + default: + assert(0); + } + } else if (Ty->isIntegerTy() || Ty->isPointerTy() || + Ty==Type::getVoidTy(Context)) { + ; + } else { + // Floating point scalar argument. + assert(Ty->isFloatingPointTy() && Ty->isPrimitiveType() && + "Expecting a floating point primitive type!"); + switch (Ty->getTypeID()) + { + case Type::FloatTyID: + if (!alloc_next_spr(SPRs)) + return false; + break; + case Type::DoubleTyID: + if (!alloc_next_spr(SPRs)) + return false; + break; + default: + assert(0); + } + } + } + return true; +} + +// Target hook for llvm-abi.h. This is called when an aggregate is being passed +// in registers. If there are only enough available parameter registers to pass +// part of the aggregate, return true. That means the aggregate should instead +// be passed in memory. +bool +llvm_arm_aggregate_partially_passed_in_regs(std::vector &Elts, + std::vector &ScalarElts, + CallingConv::ID CC) { + // Homogeneous aggregates are an AAPCS-VFP feature. + if ((CC != CallingConv::ARM_AAPCS_VFP) || + !(TARGET_AAPCS_BASED && TARGET_VFP && TARGET_HARD_FLOAT_ABI)) + return true; + + bool SPRs[16] = { 0 }; // represents S0-S16 + + // Figure out which SPRs are available. + if (!count_num_registers_uses(ScalarElts, SPRs)) + return true; + + if (!count_num_registers_uses(Elts, SPRs)) + return true; + + return false; // it all fit in registers! +} + +// Return LLVM Type if TYPE can be returned as an aggregate, +// otherwise return NULL. +Type *llvm_arm_aggr_type_for_struct_return(tree TreeType, + CallingConv::ID CC) { + if (!llvm_arm_should_pass_or_return_aggregate_in_regs(TreeType, CC)) + return NULL; + + // Walk Ty and push LLVM types corresponding to register types onto + // Elts. + std::vector Elts; + Type *Ty = ConvertType(TreeType); + push_elts(Ty, Elts); + + return StructType::get(Context, Elts, false); +} + +// llvm_arm_extract_mrv_array_element - Helper function that helps extract +// an array element from multiple return value. +// +// Here, SRC is returning multiple values. DEST's DESTFIELDNO field is an array. +// Extract SRCFIELDNO's ELEMENO value and store it in DEST's FIELDNO field's +// ELEMENTNO. +// +static void llvm_arm_extract_mrv_array_element(Value *Src, Value *Dest, + unsigned SrcFieldNo, + unsigned SrcElemNo, + unsigned DestFieldNo, + unsigned DestElemNo, + LLVMBuilder &Builder, + bool isVolatile) { + Value *EVI = Builder.CreateExtractValue(Src, SrcFieldNo, "mrv_gr"); + const StructType *STy = cast(Src->getType()); + llvm::Value *Idxs[3]; + Idxs[0] = ConstantInt::get(llvm::Type::getInt32Ty(Context), 0); + Idxs[1] = ConstantInt::get(llvm::Type::getInt32Ty(Context), DestFieldNo); + Idxs[2] = ConstantInt::get(llvm::Type::getInt32Ty(Context), DestElemNo); + Value *GEP = Builder.CreateGEP(Dest, Idxs, "mrv_gep"); + if (STy->getElementType(SrcFieldNo)->isVectorTy()) { + Value *ElemIndex = ConstantInt::get(Type::getInt32Ty(Context), SrcElemNo); + Value *EVIElem = Builder.CreateExtractElement(EVI, ElemIndex, "mrv"); + Builder.CreateStore(EVIElem, GEP, isVolatile); + } else { + Builder.CreateStore(EVI, GEP, isVolatile); + } +} + +// llvm_arm_extract_multiple_return_value - Extract multiple values returned +// by SRC and store them in DEST. It is expected that SRC and +// DEST types are StructType, but they may not match. +void llvm_arm_extract_multiple_return_value(Value *Src, Value *Dest, + bool isVolatile, + LLVMBuilder &Builder) { + const StructType *STy = cast(Src->getType()); + unsigned NumElements = STy->getNumElements(); + + const PointerType *PTy = cast(Dest->getType()); + const StructType *DestTy = cast(PTy->getElementType()); + + unsigned SNO = 0; + unsigned DNO = 0; + + while (SNO < NumElements) { + + Type *DestElemType = DestTy->getElementType(DNO); + + // Directly access first class values. + if (DestElemType->isSingleValueType()) { + Value *GEP = Builder.CreateStructGEP(Dest, DNO, "mrv_gep"); + Value *EVI = Builder.CreateExtractValue(Src, SNO, "mrv_gr"); + Builder.CreateStore(EVI, GEP, isVolatile); + ++DNO; ++SNO; + continue; + } + + // Access array elements individually. Note, Src and Dest type may + // not match. For example { <2 x float>, float } and { float[3]; } + const ArrayType *ATy = cast(DestElemType); + unsigned ArraySize = ATy->getNumElements(); + unsigned DElemNo = 0; // DestTy's DNO field's element number + while (DElemNo < ArraySize) { + unsigned i = 0; + unsigned Size = 1; + + if (const VectorType *SElemTy = + dyn_cast(STy->getElementType(SNO))) { + Size = SElemTy->getNumElements(); + } + while (i < Size) { + llvm_arm_extract_mrv_array_element(Src, Dest, SNO, i++, + DNO, DElemNo++, + Builder, isVolatile); + } + // Consumed this src field. Try next one. + ++SNO; + } + // Finished building current dest field. + ++DNO; + } +} + +// Target hook for llvm-abi.h for LLVM_SHOULD_NOT_USE_SHADOW_RETURN and is +// also a utility function used for other target hooks in this file. Returns +// true if the aggregate should be passed or returned in registers. +bool llvm_arm_should_pass_or_return_aggregate_in_regs(tree TreeType, + CallingConv::ID CC) { + // Homogeneous aggregates are an AAPCS-VFP feature. + if ((CC != CallingConv::ARM_AAPCS_VFP) || + !(TARGET_AAPCS_BASED && TARGET_VFP && TARGET_HARD_FLOAT_ABI)) + return false; + + // Alas, we can't use LLVM Types to figure this out because we need to + // examine unions closely. We'll have to walk the GCC TreeType. + int fdt_counts[ARM_FDT_MAX] = { 0 }; + bool result = false; + result = vfp_arg_homogeneous_aggregate_p(TYPE_MODE(TreeType), TreeType, + fdt_counts); + return result && !TREE_ADDRESSABLE(TreeType); +} diff -urN ./dragonegg-3.0.src/src/Backend.cpp ./dragonegg-3.0.mod/src/Backend.cpp --- dragonegg-3.0.src/src/Backend.cpp 2011-10-22 05:27:13.000000000 +0900 +++ dragonegg-3.0.mod/src/Backend.cpp 2012-01-29 15:24:06.481994540 +0900 @@ -1067,7 +1067,8 @@ if (!Name.empty() && Name[0] == 1) { #ifdef REGISTER_PREFIX if (strlen (REGISTER_PREFIX) != 0) { - int reg_number = decode_reg_name(Name); + const char *TmpName = Name.c_str(); + int reg_number = decode_reg_name(TmpName); if (reg_number >= 0 || reg_number == -3) error("register name given for non-register variable %q+D", decl); } diff -urN ./dragonegg-3.0.src/src/Convert.cpp ./dragonegg-3.0.mod/src/Convert.cpp --- dragonegg-3.0.src/src/Convert.cpp 2011-11-01 13:18:24.000000000 +0900 +++ dragonegg-3.0.mod/src/Convert.cpp 2012-01-30 09:47:09.273994885 +0900 @@ -470,7 +470,7 @@ // passed in memory byval. static bool isPassedByVal(tree type, Type *Ty, std::vector &ScalarArgs, - bool isShadowRet, CallingConv::ID &/*CC*/) { + bool isShadowRet, CallingConv::ID CC) { if (LLVM_SHOULD_PASS_AGGREGATE_USING_BYVAL_ATTR(type, Ty)) return true; diff -urN ./dragonegg-3.0.src/src/DefaultABI.cpp ./dragonegg-3.0.mod/src/DefaultABI.cpp --- dragonegg-3.0.src/src/DefaultABI.cpp 2011-07-25 00:44:16.000000000 +0900 +++ dragonegg-3.0.mod/src/DefaultABI.cpp 2012-01-29 15:26:54.797994665 +0900 @@ -39,7 +39,7 @@ // doNotUseShadowReturn - Return true if the specified GCC type // should not be returned using a pointer to struct parameter. -bool doNotUseShadowReturn(tree type, tree fndecl, CallingConv::ID /*CC*/) { +bool doNotUseShadowReturn(tree type, tree fndecl, CallingConv::ID CC) { if (!TYPE_SIZE(type)) return false; if (TREE_CODE(TYPE_SIZE(type)) != INTEGER_CST) debian/patches/arm-ftbfs.diff0000644000000000000000000001057512245462327013347 0ustar Index: dragonegg-3.3/include/arm/dragonegg/Target.h =================================================================== --- dragonegg-3.3.orig/include/arm/dragonegg/Target.h 2013-03-11 13:14:04.000000000 -0400 +++ dragonegg-3.3/include/arm/dragonegg/Target.h 2013-11-27 15:17:04.413053790 -0500 @@ -31,7 +31,7 @@ (isVoid || hasArgList). */ /* from TARGET_AAPCS_BASED */ -#define DEFAULT_TARGET_AAPCS_BASED(ARM_DEFAULT_ABI != ARM_ABI_APCS && \ +#define DEFAULT_TARGET_AAPCS_BASED (ARM_DEFAULT_ABI != ARM_ABI_APCS && \ ARM_DEFAULT_ABI != ARM_ABI_ATPCS) #define TARGET_ADJUST_LLVM_CC(CC, type) \ @@ -40,44 +40,44 @@ if (TARGET_VFP && TARGET_HARD_FLOAT_ABI && \ ((TYPE_ARG_TYPES(type) == 0) || \ (TREE_VALUE(tree_last(TYPE_ARG_TYPES(type))) == void_type_node))) \ - CC = CallingConv::ARM_AAPCS_VFP; \ + CC = llvm::CallingConv::ARM_AAPCS_VFP; \ else if (!DEFAULT_TARGET_AAPCS_BASED) \ - CC = CallingConv::ARM_AAPCS; \ + CC = llvm::CallingConv::ARM_AAPCS; \ } else if (DEFAULT_TARGET_AAPCS_BASED) { \ - CC = CallingConv::ARM_APCS; \ + CC = llvm::CallingConv::ARM_APCS; \ } \ } #ifdef DRAGONEGG_ABI_H extern bool llvm_arm_should_pass_aggregate_in_mixed_regs( - tree_node *, Type *Ty, CallingConv::ID, std::vector &); + tree_node *, llvm::Type *Ty, llvm::CallingConv::ID, std::vector &); #define LLVM_SHOULD_PASS_AGGREGATE_IN_MIXED_REGS(T, TY, CC, E) \ llvm_arm_should_pass_aggregate_in_mixed_regs((T), (TY), (CC), (E)) struct DefaultABIClient; extern bool llvm_arm_try_pass_aggregate_custom( - tree_node *, std::vector &, CallingConv::ID CC, + tree_node *, std::vector &, llvm::CallingConv::ID CC, struct DefaultABIClient *); #define LLVM_TRY_PASS_AGGREGATE_CUSTOM(T, E, CC, C) \ llvm_arm_try_pass_aggregate_custom((T), (E), (CC), (C)) extern bool llvm_arm_aggregate_partially_passed_in_regs( - std::vector &, std::vector &, CallingConv::ID CC); + std::vector &, std::vector &, llvm::CallingConv::ID CC); #define LLVM_AGGREGATE_PARTIALLY_PASSED_IN_REGS(E, SE, ISR, CC) \ llvm_arm_aggregate_partially_passed_in_regs((E), (SE), (CC)) -extern Type * -llvm_arm_aggr_type_for_struct_return(tree_node *type, CallingConv::ID CC); +extern llvm::Type * +llvm_arm_aggr_type_for_struct_return(tree_node *type, llvm::CallingConv::ID CC); /* LLVM_AGGR_TYPE_FOR_STRUCT_RETURN - Return LLVM Type if X can be returned as an aggregate, otherwise return NULL. */ #define LLVM_AGGR_TYPE_FOR_STRUCT_RETURN(X, CC) \ llvm_arm_aggr_type_for_struct_return((X), (CC)) - +namespace llvm { extern void llvm_arm_extract_multiple_return_value( Value *Src, Value *Dest, bool isVolatile, LLVMBuilder &B); @@ -85,9 +85,9 @@ SRC and assign it to DEST. */ #define LLVM_EXTRACT_MULTIPLE_RETURN_VALUE(Src, Dest, V, B) \ llvm_arm_extract_multiple_return_value((Src), (Dest), (V), (B)) - +} extern bool llvm_arm_should_pass_or_return_aggregate_in_regs( - tree_node *TreeType, CallingConv::ID CC); + tree_node *TreeType, llvm::CallingConv::ID CC); /* LLVM_SHOULD_NOT_USE_SHADOW_RETURN = Return true is the given type should not be returned via a shadow parameter with the given calling conventions. */ Index: dragonegg-3.3/src/arm/Target.cpp =================================================================== --- dragonegg-3.3.orig/src/arm/Target.cpp 2013-02-25 05:54:25.000000000 -0500 +++ dragonegg-3.3/src/arm/Target.cpp 2013-11-27 15:27:01.408925004 -0500 @@ -55,6 +55,8 @@ // Trees header. #include "dragonegg/Trees.h" +using namespace llvm; + static LLVMContext &Context = getGlobalContext(); // "Fundamental Data Types" according to the AAPCS spec. These are used debian/patches/donotfailincompatiblepluginversion.diff0000644000000000000000000000130611725504032020641 0ustar --- a/src/Backend.cpp +++ b/src/Backend.cpp @@ -2000,8 +2000,10 @@ // Check that the plugin is compatible with the running gcc. if (!version_check (&gcc_version, version)) { - errs() << "Incompatible plugin version\n"; - return 1; + errs() << "Potential incompatible plugin version. GCC: " << gcc_version.basever << " (" << gcc_version.datestamp << ")" << ". Expected: " << version->basever << " (" << version->datestamp << ")" << "\n"; + errs() << "Defines 'dragonegg_disable_version_check' as env variable to remove this warning\n"; + errs() << "Please note that unexpected errors might occur.\n"; +// return 1; } // Provide GCC with our version and help information. debian/patches/series0000644000000000000000000000015312245462327012040 0ustar #donotfailincompatiblepluginversion.diff #kfreebsd.diff shared-lib.diff #dragonegg-arm.diff arm-ftbfs.diff debian/patches/shared-lib.diff0000644000000000000000000000116712155640052013466 0ustar * Linked against the shared libLLVM. Author: Matthias Klose Index: dragonegg-3.2/Makefile =================================================================== --- dragonegg-3.2.orig/Makefile 2013-02-08 03:25:01.368733889 +0000 +++ dragonegg-3.2/Makefile 2013-02-08 03:34:29.676731454 +0000 @@ -143,8 +143,7 @@ @echo Linking $@ $(QUIET)$(CXX) -o $@ $(LOADABLE_MODULE_OPTIONS) $(CXXFLAGS) \ $(PLUGIN_OBJECTS) $(TARGET_OBJECT) \ - $(shell $(LLVM_CONFIG) --libs $(LLVM_COMPONENTS) \ - $(shell $(TARGET_UTIL) -p)) \ + -lLLVM-3.3 \ $(LD_OPTIONS) $(LIT_SITE_CONFIG): $(TEST_SRC_DIR)/dragonegg-lit.site.cfg.in debian/gcc-wrap.in0000644000000000000000000000013011773154141011217 0ustar #!/bin/sh exec ${0#/usr/bin/llvm-}-@GCC_VERSION@ -fplugin=@plugindir@/dragonegg.so "$@" debian/gcc-wrap-next.in0000644000000000000000000000011211773154141012173 0ustar #!/bin/sh exec ${0#/usr/bin/llvm-} -fplugin=@plugindir@/dragonegg.so "$@" debian/watch0000644000000000000000000000036111773154141010223 0ustar version=3 opts=uversionmangle=s/\.(tar.*|tgz|zip|gz|bz2)$//i,dversionmangle=s/[-.+~]?(cvs|svn|git|snapshot|pre|hg)(.*)$//i,pasv \ http://llvm.org/releases/download.html (?:.*/)?dragonegg-?_?([\d+\.]+|\d+)\.src.(tar.*|tgz|zip|gz|bz2|) debian debian/rules0000755000000000000000000000646512155640052010261 0ustar #!/usr/bin/make -f DPKG_EXPORT_BUILDFLAGS = 1 include /usr/share/dpkg/buildflags.mk LLVM_VERSION = 3.3 GCC_VERSION = 4.7 GCC_VERSION_NEXT = 4.8 deb_version := $(shell dpkg-parsechangelog | sed -ne "s/^Version: \(.*\)/\1/p") upstream_version := $(shell echo $(deb_version) | sed -e "s/-[^-]*$$//") major := $(shell echo $(upstream_version) | sed -e "s/\([0-9]\+\.[0-9]\+\)[\.-].*/\1/g") plugindir := $(shell gcc-$(GCC_VERSION) -print-file-name=plugin) plugindir_NEXT := $(shell gcc-$(GCC_VERSION_NEXT) -print-file-name=plugin) include /usr/share/cdbs/1/rules/debhelper.mk stamps/build: # link with llvm mkdir -p $(DEB_SRCDIR)/$(GCC_VERSION) cd $(DEB_SRCDIR)/$(GCC_VERSION); \ GCC=gcc-$(GCC_VERSION) CC=gcc-$(GCC_VERSION) CXX=g++-$(GCC_VERSION) \ DISABLE_VERSION_CHECK=1 LDFLAGS="-L/usr/lib/llvm-$(LLVM_VERSION)/lib $(LDFLAGS)" \ $(MAKE) \ VERBOSE=1 \ LLVM_CONFIG=/usr/lib/llvm-$(LLVM_VERSION)/bin/llvm-config \ -C ../; \ mv ../dragonegg.so . make LLVM_CONFIG=/usr/lib/llvm-$(LLVM_VERSION)/bin/llvm-config clean mkdir -p $(DEB_SRCDIR)/$(GCC_VERSION_NEXT) cd $(DEB_SRCDIR)/$(GCC_VERSION_NEXT); \ GCC=gcc-$(GCC_VERSION_NEXT) CC=gcc-$(GCC_VERSION_NEXT) CXX=g++-$(GCC_VERSION_NEXT) \ DISABLE_VERSION_CHECK=1 LDFLAGS="-L/usr/lib/llvm-$(LLVM_VERSION)/lib $(LDFLAGS)" \ $(MAKE) \ VERBOSE=1 \ LLVM_CONFIG=/usr/lib/llvm-$(LLVM_VERSION)/bin/llvm-config \ -C ..; \ mv ../dragonegg.so . mkdir -p stamps touch $@ stamps/install: mkdir -p debian/dragonegg-$(GCC_VERSION)/$(plugindir) install -m755 $(DEB_SRCDIR)/$(GCC_VERSION)/dragonegg.so debian/dragonegg-$(GCC_VERSION)/$(plugindir)/ mkdir -p debian/dragonegg-$(GCC_VERSION_NEXT)/$(plugindir_NEXT) install -m755 $(DEB_SRCDIR)/$(GCC_VERSION_NEXT)/dragonegg.so debian/dragonegg-$(GCC_VERSION_NEXT)/$(plugindir_NEXT)/ mkdir -p stamps touch $@ stamps/install-llvm-gcc-$(GCC_VERSION): mkdir -p debian/llvm-gcc-$(GCC_VERSION)/usr/bin sed -e 's,@plugindir@,$(plugindir),' -e 's,@GCC_VERSION@,$(GCC_VERSION),' debian/gcc-wrap.in > debian/gcc-wrap for i in cpp g++ gcc gccbug gcov ; do \ install -m755 debian/gcc-wrap debian/llvm-gcc-$(GCC_VERSION)/usr/bin/llvm-$$i ; \ done # Do the same for c++ as gcc but without the version (not provided by # gcc-defaults) sed -e 's,@plugindir@,$(plugindir),' -e 's,@GCC_VERSION@,$(GCC_VERSION),' debian/c++-wrap.in > debian/c++-wrap stamps/install-llvm-gcc-$(GCC_VERSION_NEXT): mkdir -p debian/llvm-gcc-$(GCC_VERSION_NEXT)/usr/bin sed -e 's,@plugindir@,$(plugindir_NEXT),' -e 's,@GCC_VERSION@,$(GCC_VERSION_NEXT),' debian/gcc-wrap-next.in > debian/gcc-wrap for i in cpp g++ gcc gccbug gcov ; do \ install -m755 debian/gcc-wrap debian/llvm-gcc-$(GCC_VERSION_NEXT)/usr/bin/llvm-$$i-$(GCC_VERSION_NEXT) ; \ done # Do the same for c++ as gcc but without the version (not provided by # gcc-defaults) sed -e 's,@plugindir@,$(plugindir_NEXT),' -e 's,@GCC_VERSION@,$(GCC_VERSION_NEXT),' debian/c++-wrap.in > debian/c++-wrap build/dragonegg-$(GCC_VERSION):: stamps/build install/dragonegg-$(GCC_VERSION):: stamps/install install/llvm-gcc-$(GCC_VERSION):: stamps/install-llvm-gcc-$(GCC_VERSION) install/llvm-gcc-$(GCC_VERSION_NEXT):: stamps/install-llvm-gcc-$(GCC_VERSION_NEXT) clean:: rm -rf $(GCC_VERSION) $(GCC_VERSION_NEXT) $(MAKE) clean VERBOSE=1 LLVM_CONFIG=/usr/lib/llvm-$(LLVM_VERSION)/bin/llvm-config rm -f debian/gcc-wrap rm -rf stamps debian/copyright0000644000000000000000000000252211654615457011140 0ustar Name: DragonEgg Source: http://dragonegg.llvm.org/ Maintainer: Duncan Sands Files: * Copyright: 2009 Duncan Sands License: GPL-2+ Files: llvm-backend.cpp llvm-types.cpp llvm-internal.h linux/llvm-os.h llvm-convert.cpp llvm-cache.h darwin/llvm-os.h gt-llvm-cache.h llvm-debug.cpp llvm-cache.c llvm-debug.h x86/llvm-target.h x86/llvm-target.cpp llvm-abi.h Copyright: 2004, 2005, 2006, 2007, 2009 Free Software Foundation, Inc. License: GPL-2+ Files: debian/* Copyright: 2009, Robert Millan License: GPL-2+ Files: debian/patches/02_missing_gcc_headers.diff Copyright: 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009 Free Software Foundation, Inc. License: GPL-3+ Files: debian/patches/05_gcc_i386.diff Copyright: 1988, 1992, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. License: GPL-3+ License: GPL-2+ On Debian systems the full text of the GNU General Public License can be found in the `/usr/share/common-licenses/GPL-2' file. License: GPL-3+ On Debian systems the full text of the GNU General Public License can be found in the `/usr/share/common-licenses/GPL' file. debian/c++-wrap.in0000644000000000000000000000011211654615457011045 0ustar #!/bin/sh exec ${0#/usr/bin/llvm-} -fplugin=@plugindir@/dragonegg.so "$@" debian/source/0000755000000000000000000000000012216363001010460 5ustar debian/source/format0000644000000000000000000000001411654615456011711 0ustar 3.0 (quilt)