[llvm-commits] [llvm-gcc-4.0] r41882 - in /llvm-gcc-4.0/trunk/gcc: config/darwin.h llvm-backend.cpp varasm.c

Duncan Sands baldrick at free.fr
Sat Sep 15 07:00:39 PDT 2007


Hi Bill,

> Alias definitions aren't supported on some platforms. Create a flag (TARGET_DOES_NOT_SUPPORT_ALIAS_DEFINITIONS) that indicates this and stops us from creating aliases.

is doing this in the front-end really the right approach?  If a target doesn't
support aliases surely it is LLVM codegen that should complain or ignore the
alias.  Also, how does gcc handle aliases on Darwin?  Either it succeeds in
outputting them somehow, in which case llvm-gcc should too, or it rejects them
in which case there shouldn't be any need for a new flag - the info that darwin
doesn't support aliases should exist in gcc already.

Ciao,

Duncan.

> Modified:
>     llvm-gcc-4.0/trunk/gcc/config/darwin.h
>     llvm-gcc-4.0/trunk/gcc/llvm-backend.cpp
>     llvm-gcc-4.0/trunk/gcc/varasm.c
> 
> Modified: llvm-gcc-4.0/trunk/gcc/config/darwin.h
> URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/config/darwin.h?rev=41882&r1=41881&r2=41882&view=diff
> 
> ==============================================================================
> --- llvm-gcc-4.0/trunk/gcc/config/darwin.h (original)
> +++ llvm-gcc-4.0/trunk/gcc/config/darwin.h Wed Sep 12 13:55:13 2007
> @@ -674,6 +674,9 @@
>    } while (0)
>  
>  /* APPLE LOCAL begin LLVM */
> +/* As in the warning above, alias definitions aren't supported on Mach-O. */
> +#define TARGET_DOES_NOT_SUPPORT_ALIAS_DEFINITIONS
> +
>  /* weak_import, a Darwin special, does not make function definitions weak. */
>  #define TARGET_ADJUST_LLVM_LINKAGE(FN, DECL)                            \
>    do {                                                                  \
> 
> Modified: llvm-gcc-4.0/trunk/gcc/llvm-backend.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/llvm-backend.cpp?rev=41882&r1=41881&r2=41882&view=diff
> 
> ==============================================================================
> --- llvm-gcc-4.0/trunk/gcc/llvm-backend.cpp (original)
> +++ llvm-gcc-4.0/trunk/gcc/llvm-backend.cpp Wed Sep 12 13:55:13 2007
> @@ -677,7 +677,7 @@
>    else if (Function *F = dyn_cast<Function>(V))
>      F->eraseFromParent();
>    else
> -    assert(0 && "Unsuported global value");
> +    assert(0 && "Unsupported global value");
>  
>    TREE_ASM_WRITTEN(decl) = 1;
>    
> 
> Modified: llvm-gcc-4.0/trunk/gcc/varasm.c
> URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/varasm.c?rev=41882&r1=41881&r2=41882&view=diff
> 
> ==============================================================================
> --- llvm-gcc-4.0/trunk/gcc/varasm.c (original)
> +++ llvm-gcc-4.0/trunk/gcc/varasm.c Wed Sep 12 13:55:13 2007
> @@ -4762,7 +4762,12 @@
>      {
>        tree target_decl;
>        target_decl = find_decl_and_mark_needed (p->decl, p->target);
> +#ifdef TARGET_DOES_NOT_SUPPORT_ALIAS_DEFINITIONS
> +      if (target_decl)
> +        warning ("%Jalias definitions not supported; ignored", target_decl);
> +#else
>        emit_alias_to_llvm(p->decl, p->target, target_decl);
> +#endif
>      }
>  #else  
>      do_assemble_alias (p->decl, p->target);
> @@ -4819,11 +4824,19 @@
>       alias.  This saves a tad o memory.  */
>    target_decl = find_decl_and_mark_needed (decl, target);
>    if (target_decl && TREE_ASM_WRITTEN (target_decl))
> +    /* APPLE LOCAL begin LLVM */
> +    {
>  #ifdef ENABLE_LLVM
> -    emit_alias_to_llvm(decl, target, target_decl);
> +#ifdef TARGET_DOES_NOT_SUPPORT_ALIAS_DEFINITIONS
> +      warning ("%Jalias definitions not supported; ignored", target_decl);
>  #else
> -  do_assemble_alias (decl, target);
> +      emit_alias_to_llvm(decl, target, target_decl);
>  #endif
> +#else
> +      do_assemble_alias (decl, target);
> +#endif
> +    }
> +    /* APPLE LOCAL end LLVM */
>    else
>      {
>        alias_pair p;
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
> 





More information about the llvm-commits mailing list