r209289 - Make global named registers internal variables

Renato Golin renato.golin at linaro.org
Wed May 21 03:40:27 PDT 2014


Author: rengolin
Date: Wed May 21 05:40:27 2014
New Revision: 209289

URL: http://llvm.org/viewvc/llvm-project?rev=209289&view=rev
Log:
Make global named registers internal variables

Modified:
    cfe/trunk/lib/AST/ASTContext.cpp
    cfe/trunk/test/CodeGen/named_reg_global.c

Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=209289&r1=209288&r2=209289&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Wed May 21 05:40:27 2014
@@ -7874,6 +7874,9 @@ bool ASTContext::DeclMustBeEmitted(const
   if (const VarDecl *VD = dyn_cast<VarDecl>(D)) {
     if (!VD->isFileVarDecl())
       return false;
+    // Global named register variables (GNU extension) are never emitted.
+    if (VD->getStorageClass() == SC_Register)
+      return false;
   } else if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
     // We never need to emit an uninstantiated function template.
     if (FD->getTemplatedKind() == FunctionDecl::TK_FunctionTemplate)

Modified: cfe/trunk/test/CodeGen/named_reg_global.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/named_reg_global.c?rev=209289&r1=209288&r2=209289&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/named_reg_global.c (original)
+++ cfe/trunk/test/CodeGen/named_reg_global.c Wed May 21 05:40:27 2014
@@ -3,6 +3,7 @@
 // RUN: %clang_cc1 -triple arm64-linux-gnu -S -emit-llvm %s -o - | FileCheck %s
 // RUN: %clang_cc1 -triple armv7-linux-gnu -S -emit-llvm %s -o - | FileCheck %s
 
+// CHECK-NOT: @sp = common global
 register unsigned long current_stack_pointer asm("sp");
 
 // CHECK: define{{.*}} i[[bits:[0-9]+]] @get_stack_pointer_addr()





More information about the cfe-commits mailing list