Move cl_options out of LDCShared

This commit is contained in:
Eldar Insafutdinov 2012-04-02 14:53:52 +01:00
parent 71044056e4
commit feefad412c
12 changed files with 26 additions and 35 deletions

View file

@ -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 file

@ -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
@ -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 file

@ -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 file

@ -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 file

@ -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 file

@ -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 file

@ -17,8 +17,6 @@
#include "ir/irmodule.h"
#include "ir/irtypestruct.h"
#include "gen/cl_options.h"
//////////////////////////////////////////////////////////////////////////////////////////
static LLValue *DtoSlice(DValue *dval)

View file

@ -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 file

@ -1,4 +1,3 @@
#include "linkage.h"
#include "gen/cl_options.h"
LLGlobalValue::LinkageTypes templateLinkage;

View file

@ -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 file

@ -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;