mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-01-20 23:03:14 +01:00
Added -disable-red-zone flag.
This will disable the usage of the 'red-zone' in ABIs that make use of it (like x86). This mimics the exact flag used by clang. It is comparable to the -mno-red-zone flag in gcc. - thanks to wilkie
This commit is contained in:
@@ -100,6 +100,10 @@ cl::opt<bool> output_s("output-s",
|
||||
cl::opt<cl::boolOrDefault> output_o("output-o",
|
||||
cl::desc("Write native object"));
|
||||
|
||||
// Disabling Red Zone
|
||||
cl::opt<bool> disableRedZone("disable-red-zone",
|
||||
cl::desc("Do not emit code that uses the red zone."),
|
||||
cl::init(false));
|
||||
|
||||
// DDoc options
|
||||
static cl::opt<bool, true> doDdoc("D",
|
||||
|
||||
@@ -26,6 +26,7 @@ namespace opts {
|
||||
extern cl::opt<bool> output_ll;
|
||||
extern cl::opt<bool> output_s;
|
||||
extern cl::opt<cl::boolOrDefault> output_o;
|
||||
extern cl::opt<bool> disableRedZone;
|
||||
extern cl::opt<std::string> ddocDir;
|
||||
extern cl::opt<std::string> ddocFile;
|
||||
extern cl::opt<std::string> jsonFile;
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "gen/dvalue.h"
|
||||
#include "gen/abi.h"
|
||||
#include "gen/nested.h"
|
||||
#include "gen/cl_options.h"
|
||||
|
||||
using namespace llvm::Attribute;
|
||||
|
||||
@@ -501,6 +502,9 @@ void DtoDeclareFunction(FuncDeclaration* fdecl)
|
||||
// parameter attributes
|
||||
if (!fdecl->isIntrinsic()) {
|
||||
set_param_attrs(f, func, fdecl);
|
||||
if (opts::disableRedZone) {
|
||||
func->addFnAttr(NoRedZone);
|
||||
}
|
||||
}
|
||||
|
||||
// main
|
||||
|
||||
Reference in New Issue
Block a user