r298177 - [X86] Add NumRegisterParameters Module Flag.
Nirav Dave via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 17 17:43:39 PDT 2017
Author: niravd
Date: Fri Mar 17 19:43:39 2017
New Revision: 298177
URL: http://llvm.org/viewvc/llvm-project?rev=298177&view=rev
Log:
[X86] Add NumRegisterParameters Module Flag.
Reviewers: rnk, mkuper
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D27051
Added:
cfe/trunk/test/CodeGen/pr3997.c
Modified:
cfe/trunk/lib/CodeGen/CodeGenModule.cpp
cfe/trunk/test/Headers/altivec-header.c
Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=298177&r1=298176&r2=298177&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Fri Mar 17 19:43:39 2017
@@ -159,6 +159,12 @@ CodeGenModule::CodeGenModule(ASTContext
// 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 @@ void CodeGenModule::Release() {
(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.
Added: cfe/trunk/test/CodeGen/pr3997.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/pr3997.c?rev=298177&view=auto
==============================================================================
--- cfe/trunk/test/CodeGen/pr3997.c (added)
+++ cfe/trunk/test/CodeGen/pr3997.c Fri Mar 17 19:43:39 2017
@@ -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}
Modified: cfe/trunk/test/Headers/altivec-header.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Headers/altivec-header.c?rev=298177&r1=298176&r2=298177&view=diff
==============================================================================
--- cfe/trunk/test/Headers/altivec-header.c (original)
+++ cfe/trunk/test/Headers/altivec-header.c Fri Mar 17 19:43:39 2017
@@ -9,4 +9,4 @@
// CHECK: target triple = "powerpc64-
// CHECK-NEXT: {{^$}}
-// CHECK-NEXT: llvm.ident
+// CHECK-NEXT: {{llvm\..*}}
More information about the cfe-commits
mailing list