Set function attribute llvm::Attribute::NoRedZone appropriately.

llvm-svn: 72902
This commit is contained in:
Devang Patel 2009-06-04 23:32:02 +00:00
parent 319ce956a9
commit 6e467b1a46
3 changed files with 14 additions and 0 deletions

View File

@ -41,6 +41,7 @@ public:
/// should be run through the LLVM Verifier.
unsigned TimePasses : 1; /// Set when -ftime-report is enabled.
unsigned NoCommon : 1; /// Set when -fno-common or C++ is enabled.
unsigned DisableRedZone : 1; /// Set when -mno-red-zone is enabled.
/// Inlining - The kind of inlining to perform.
InliningMethod Inlining;
@ -63,6 +64,7 @@ public:
TimePasses = 0;
NoCommon = 0;
Inlining = NoInlining;
DisableRedZone = 0;
}
};

View File

@ -21,6 +21,7 @@
#include "clang/AST/DeclCXX.h"
#include "clang/AST/DeclObjC.h"
#include "clang/AST/RecordLayout.h"
#include "clang/Frontend/CompileOptions.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Attributes.h"
#include "llvm/Support/CallSite.h"
@ -1751,6 +1752,9 @@ void CodeGenModule::ConstructAttributeList(const CGFunctionInfo &FI,
FuncAttrs |= llvm::Attribute::ReadOnly;
}
if (CompileOpts.DisableRedZone)
FuncAttrs |= llvm::Attribute::NoRedZone;
QualType RetTy = FI.getReturnType();
unsigned Index = 1;
const ABIArgInfo &RetAI = FI.getReturnInfo();

View File

@ -1395,6 +1395,12 @@ TargetCPU("mcpu",
static llvm::cl::list<std::string>
TargetFeatures("target-feature", llvm::cl::desc("Target specific attributes"));
static llvm::cl::opt<bool>
DisableRedZone("disable-red-zone",
llvm::cl::desc("Do not emit code that uses the red zone."),
llvm::cl::init(false));
/// ComputeTargetFeatures - Recompute the target feature list to only
/// be the list of things that are enabled, based on the target cpu
/// and feature list.
@ -1471,6 +1477,8 @@ static void InitializeCompileOptions(CompileOptions &Opts,
// Handle -ftime-report.
Opts.TimePasses = TimeReport;
Opts.DisableRedZone = DisableRedZone;
}
//===----------------------------------------------------------------------===//