Commit 88089ce7 authored by Tom Stellard's avatar Tom Stellard
Browse files

Merging r298177:

------------------------------------------------------------------------
r298177 | niravd | 2017-03-17 20:43:39 -0400 (Fri, 17 Mar 2017) | 7 lines

[X86] Add NumRegisterParameters Module Flag.

Reviewers: rnk, mkuper

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D27051
------------------------------------------------------------------------

llvm-svn: 304294
parent 5273e95d
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -159,6 +159,12 @@ CodeGenModule::CodeGenModule(ASTContext &C, const HeaderSearchOptions &HSO,
  // 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.
+13 −0
Original line number Diff line number Diff line
// 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}
+1 −1
Original line number Diff line number Diff line
@@ -9,4 +9,4 @@

// CHECK: target triple = "powerpc64-
// CHECK-NEXT: {{^$}}
// CHECK-NEXT: llvm.ident
// CHECK-NEXT: {{llvm\..*}}