[PATCH] D27051: [X86] Add NumRegisterParameters Module Flag

Nirav Dave via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 17 17:55:49 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL298177: [X86] Add NumRegisterParameters Module Flag. (authored by niravd).

Changed prior to commit:
  https://reviews.llvm.org/D27051?vs=85928&id=92239#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D27051

Files:
  cfe/trunk/lib/CodeGen/CodeGenModule.cpp
  cfe/trunk/test/CodeGen/pr3997.c
  cfe/trunk/test/Headers/altivec-header.c


Index: cfe/trunk/test/CodeGen/pr3997.c
===================================================================
--- cfe/trunk/test/CodeGen/pr3997.c
+++ cfe/trunk/test/CodeGen/pr3997.c
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 %s -triple i386-unknown-linux-gnu -mregparm 3 -emit-llvm -o - | FileCheck %s
+
+void *memcpy(void *dest, const void *src, unsigned int n);
+
+void use_builtin_memcpy(void *dest, const void *src, unsigned int n) {
+  __builtin_memcpy(dest, src, n);
+}
+
+void use_memcpy(void *dest, const void *src, unsigned int n) {
+  memcpy(dest, src, n);
+}
+
+//CHECK: !{i32 1, !"NumRegisterParameters", i32 3}
Index: cfe/trunk/test/Headers/altivec-header.c
===================================================================
--- cfe/trunk/test/Headers/altivec-header.c
+++ cfe/trunk/test/Headers/altivec-header.c
@@ -9,4 +9,4 @@
 
 // CHECK: target triple = "powerpc64-
 // CHECK-NEXT: {{^$}}
-// CHECK-NEXT: llvm.ident
+// CHECK-NEXT: {{llvm\..*}}
Index: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
===================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp
@@ -159,6 +159,12 @@
   // CoverageMappingModuleGen object.
   if (CodeGenOpts.CoverageMapping)
     CoverageMapping.reset(new CoverageMappingModuleGen(*this, *CoverageInfo));
+
+  // Record mregparm value now so it is visible through rest of codegen.
+  if (Context.getTargetInfo().getTriple().getArch() == llvm::Triple::x86)
+    getModule().addModuleFlag(llvm::Module::Error, "NumRegisterParameters",
+                              CodeGenOpts.NumRegisterParameters);
+
 }
 
 CodeGenModule::~CodeGenModule() {}
@@ -416,6 +422,7 @@
       (Context.getLangOpts().Modules || !LinkerOptionsMetadata.empty())) {
     EmitModuleLinkOptions();
   }
+
   if (CodeGenOpts.DwarfVersion) {
     // We actually want the latest version when there are conflicts.
     // We can change from Warning to Latest if such mode is supported.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D27051.92239.patch
Type: text/x-patch
Size: 1981 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170318/a9bf29a0/attachment.bin>


More information about the llvm-commits mailing list