// stored as log2 of alignment with +1 bias
// 0 means unaligned different from align 1
const Attributes NoCapture = 1<<21; ///< Function creates no aliases of pointer
+const Attributes NoRedZone = 1<<22; /// disable redzone
/// @brief Attributes that only apply to function parameters.
const Attributes ParameterOnly = ByVal | Nest | StructRet | NoCapture;
/// @brief Attributes that only apply to function.
const Attributes FunctionOnly = NoReturn | NoUnwind | ReadNone | ReadOnly |
- NoInline | AlwaysInline | OptimizeForSize | StackProtect | StackProtectReq;
+ NoInline | AlwaysInline | OptimizeForSize | StackProtect | StackProtectReq |
+ NoRedZone;
/// @brief Parameter attributes that do not apply to vararg call arguments.
const Attributes VarArgsIncompatible = StructRet;
/// wth earlier copy coalescing.
extern bool StrongPHIElim;
- /// DisableRedZone - This flag disables use of the "Red Zone" on
- /// targets which would otherwise have one.
- extern bool DisableRedZone;
-
} // End llvm namespace
#endif
KEYWORD(optsize);
KEYWORD(ssp);
KEYWORD(sspreq);
+ KEYWORD(noredzone);
KEYWORD(type);
KEYWORD(opaque);
case lltok::kw_optsize: Attrs |= Attribute::OptimizeForSize; break;
case lltok::kw_ssp: Attrs |= Attribute::StackProtect; break;
case lltok::kw_sspreq: Attrs |= Attribute::StackProtectReq; break;
-
+ case lltok::kw_noredzone: Attrs |= Attribute::NoRedZone; break;
case lltok::kw_align: {
unsigned Alignment;
kw_optsize,
kw_ssp,
kw_sspreq,
+ kw_noredzone,
kw_type,
kw_opaque,
// If we are a leaf function, and use up to 224 bytes of stack space,
// don't have a frame pointer, calls, or dynamic alloca then we do not need
// to adjust the stack pointer (we fit in the Red Zone).
+ bool DisableRedZone = MF.getFunction()->hasFnAttr(Attribute::NoRedZone);
if (!DisableRedZone &&
FrameSize <= 224 && // Fits in red zone.
!MFI->hasVarSizedObjects() && // No dynamic alloca.
bool RealignStack;
bool DisableJumpTables;
bool StrongPHIElim;
- bool DisableRedZone;
bool AsmVerbosityDefault(false);
}
cl::desc("Use strong PHI elimination."),
cl::location(StrongPHIElim),
cl::init(false));
-static cl::opt<bool, true>
-DisableRedZoneOption("disable-red-zone",
- cl::desc("Do not emit code that uses the red zone."),
- cl::location(DisableRedZone),
- cl::init(false));
//---------------------------------------------------------------------------
// TargetMachine Class
// function, and use up to 128 bytes of stack space, don't have a frame
// pointer, calls, or dynamic alloca then we do not need to adjust the
// stack pointer (we fit in the Red Zone).
+ bool DisableRedZone = Fn->hasFnAttr(Attribute::NoRedZone);
if (Is64Bit && !DisableRedZone &&
!needsStackRealignment(MF) &&
!MFI->hasVarSizedObjects() && // No dynamic alloca.
Result += "ssp ";
if (Attrs & Attribute::StackProtectReq)
Result += "sspreq ";
+ if (Attrs & Attribute::NoRedZone)
+ Result += "noredzone ";
if (Attrs & Attribute::Alignment) {
Result += "align ";
Result += utostr(Attribute::getAlignmentFromAttrs(Attrs));
--- /dev/null
+; RUN: llvm-as < %s | llc -march=x86-64 > %t
+; RUN: grep subq %t | count 1
+; RUN: grep addq %t | count 1
+
+define x86_fp80 @f0(float %f) nounwind readnone noredzone {
+entry:
+ %0 = fpext float %f to x86_fp80 ; <x86_fp80> [#uses=1]
+ ret x86_fp80 %0
+}
cl::desc("Do not verify input module"));
+static cl::opt<bool>
+DisableRedZone("disable-red-zone",
+ cl::desc("Do not emit code that uses the red zone."),
+ cl::init(false));
+
// GetFileNameRoot - Helper function to get the basename of a filename.
static inline std::string
GetFileNameRoot(const std::string &InputFilename) {
// Run our queue of passes all at once now, efficiently.
// TODO: this could lazily stream functions out of the module.
for (Module::iterator I = mod.begin(), E = mod.end(); I != E; ++I)
- if (!I->isDeclaration())
+ if (!I->isDeclaration()) {
+ if (DisableRedZone)
+ I->addFnAttr(Attribute::NoRedZone);
Passes.run(*I);
+ }
Passes.doFinalization();
}