Skip to content
Browse files

Move cl_options out of LDCShared

  • Loading branch information...
1 parent 7104405 commit feefad412c8ce7c73d753516483e74f4150fa881 @eldar eldar committed Apr 2, 2012
View
5 dmd2/mars.h
@@ -272,6 +272,11 @@ struct Param
const char* llvmArch;
const char *targetTriple;
const char *dataLayout;
+
+ // Codegen cl options
+ bool singleObj;
+ bool disableRedZone;
+ bool noVerify;
#endif
};
View
14 gen/cl_options.cpp → driver/cl_options.cpp
@@ -1,4 +1,4 @@
-#include "gen/cl_options.h"
+#include "driver/cl_options.h"
#include "gen/cl_helpers.h"
#include "llvm/Target/TargetMachine.h"
@@ -132,8 +132,9 @@ cl::opt<cl::boolOrDefault> output_o("output-o",
cl::desc("Write native object"));
// Disabling Red Zone
-cl::opt<bool> disableRedZone("disable-red-zone",
+cl::opt<bool, true> disableRedZone("disable-red-zone",
cl::desc("Do not emit code that uses the red zone."),
+ cl::location(global.params.disableRedZone),
cl::init(false));
// DDoc options
@@ -360,7 +361,7 @@ static cl::opt<bool, true, FlagParser> postconditions("postconditions",
cl::init(true));
-static MultiSetter ContractsSetter(false,
+static MultiSetter ContractsSetter(false,
&global.params.useIn, &global.params.useOut, NULL);
static cl::opt<MultiSetter, true, FlagParser> contracts("contracts",
cl::desc("(*) Enable function pre- and post-conditions"),
@@ -374,10 +375,13 @@ static cl::opt<MultiSetter, true, cl::parser<bool> > release("release",
cl::location(ReleaseSetter),
cl::ValueDisallowed);
+cl::opt<bool, true> noVerify("noverify",
+ llvm::cl::desc("Do not run the validation pass before writing bitcode"),
+ cl::location(global.params.noVerify));
-cl::opt<bool> singleObj("singleobj",
+cl::opt<bool, true> singleObj("singleobj",
cl::desc("Create only a single output object file"),
- cl::ZeroOrMore);
+ cl::location(global.params.singleObj));
cl::opt<bool> linkonceTemplates("linkonce-templates",
cl::desc("Use linkonce_odr linkage for template symbols instead of weak_odr"),
View
4 gen/cl_options.h → driver/cl_options.h
@@ -33,7 +33,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<bool, true> disableRedZone;
extern cl::opt<std::string> ddocDir;
extern cl::opt<std::string> ddocFile;
extern cl::opt<std::string> jsonFile;
@@ -50,7 +50,7 @@ namespace opts {
extern cl::opt<std::string> mTargetTriple;
extern cl::opt<llvm::Reloc::Model> mRelocModel;
extern cl::opt<llvm::CodeModel::Model> mCodeModel;
- extern cl::opt<bool> singleObj;
+ extern cl::opt<bool, true> singleObj;
extern cl::opt<bool> linkonceTemplates;
// Arguments to -d-debug
View
5 gen/linker.cpp → driver/linker.cpp
@@ -1,4 +1,3 @@
-#include "gen/linker.h"
#include "gen/llvm.h"
#include "llvm/Linker.h"
#include "llvm/Support/FileSystem.h"
@@ -13,10 +12,12 @@
#define NO_COUT_LOGGER
#include "gen/logger.h"
-#include "gen/cl_options.h"
#include "gen/optimizer.h"
#include "gen/programs.h"
+#include "driver/linker.h"
+#include "driver/cl_options.h"
+
//////////////////////////////////////////////////////////////////////////////
// Is this useful?
View
0 gen/linker.h → driver/linker.h
File renamed without changes.
View
4 driver/main.cpp
@@ -30,13 +30,13 @@
#include "gen/logger.h"
#include "gen/linkage.h"
-#include "gen/linker.h"
#include "gen/irstate.h"
#include "gen/optimizer.h"
#include "gen/metadata.h"
#include "gen/passes/Passes.h"
-#include "gen/cl_options.h"
+#include "driver/linker.h"
+#include "driver/cl_options.h"
#include "gen/cl_helpers.h"
using namespace opts;
View
8 driver/toobj.cpp
@@ -24,12 +24,6 @@
#include "gen/optimizer.h"
-//////////////////////////////////////////////////////////////////////////////////////////
-
-extern llvm::cl::opt<bool> noVerify;
-
-//////////////////////////////////////////////////////////////////////////////////////////
-
// fwd decl
void emit_file(llvm::TargetMachine &Target, llvm::Module& m, llvm::raw_fd_ostream& Out,
llvm::TargetMachine::CodeGenFileType fileType);
@@ -42,7 +36,7 @@ void writeModule(llvm::Module* m, std::string filename)
bool reverify = ldc_optimize_module(m);
// verify the llvm
- if (!noVerify && reverify) {
+ if (!global.params.noVerify && reverify) {
std::string verifyErr;
Logger::println("Verifying module... again...");
LOG_SCOPE;
View
2 gen/arrays.cpp
@@ -17,8 +17,6 @@
#include "ir/irmodule.h"
#include "ir/irtypestruct.h"
-#include "gen/cl_options.h"
-
//////////////////////////////////////////////////////////////////////////////////////////
static LLValue *DtoSlice(DValue *dval)
View
3 gen/functions.cpp
@@ -23,7 +23,6 @@
#include "gen/dvalue.h"
#include "gen/abi.h"
#include "gen/nested.h"
-#include "gen/cl_options.h"
#include "gen/pragma.h"
using namespace llvm::Attribute;
@@ -510,7 +509,7 @@ void DtoDeclareFunction(FuncDeclaration* fdecl)
// parameter attributes
if (!fdecl->isIntrinsic()) {
set_param_attrs(f, func, fdecl);
- if (opts::disableRedZone) {
+ if (global.params.disableRedZone) {
func->addFnAttr(NoRedZone);
}
}
View
1 gen/linkage.cpp
@@ -1,4 +1,3 @@
#include "linkage.h"
-#include "gen/cl_options.h"
LLGlobalValue::LinkageTypes templateLinkage;
View
3 gen/llvmhelpers.cpp
@@ -22,7 +22,6 @@
#include "gen/functions.h"
#include "gen/typeinf.h"
#include "gen/todebug.h"
-#include "gen/cl_options.h"
#include "gen/nested.h"
#include "ir/irmodule.h"
@@ -1649,7 +1648,7 @@ bool mustDefineSymbol(Dsymbol* s)
TemplateInstance* tinst = DtoIsTemplateInstance(s);
if (tinst)
{
- if (!opts::singleObj)
+ if (!global.params.singleObj)
return true;
if (!tinst->emittedInModule)
View
12 gen/module.cpp
@@ -20,7 +20,6 @@
#include "gen/abi.h"
#include "gen/arrays.h"
#include "gen/classes.h"
-#include "gen/cl_options.h"
#include "gen/functions.h"
#include "gen/llvmhelpers.h"
#include "gen/logger.h"
@@ -39,13 +38,6 @@
#define NEW_MODULEINFO_LAYOUT 1
#endif
-//////////////////////////////////////////////////////////////////////////////////////////
-
-llvm::cl::opt<bool> noVerify("noverify",
- llvm::cl::desc("Do not run the validation pass before writing bitcode"),
- llvm::cl::ZeroOrMore);
-
-//////////////////////////////////////////////////////////////////////////////////////////
static llvm::Function* build_module_function(const std::string &name, const std::list<FuncDeclaration*> &funcs,
const std::list<VarDeclaration*> &gates = std::list<VarDeclaration*>())
@@ -276,7 +268,7 @@ llvm::Module* Module::genLLVMModule(llvm::LLVMContext& context, Ir* sir)
sir->emitFunctionBodies();
// for singleobj-compilation, fully emit all seen template instances
- if (opts::singleObj)
+ if (global.params.singleObj)
{
while (!ir.seenTemplateInstances.empty())
{
@@ -297,7 +289,7 @@ llvm::Module* Module::genLLVMModule(llvm::LLVMContext& context, Ir* sir)
genmoduleinfo();
// verify the llvm
- if (!noVerify) {
+ if (!global.params.noVerify) {
std::string verifyErr;
Logger::println("Verifying module...");
LOG_SCOPE;

0 comments on commit feefad4

Please sign in to comment.
Something went wrong with that request. Please try again.