Allow controlling the CodeGenOpt::Level independent of the LTO optimization level in LLD via new options for the COFF, ELF, MachO, and wasm frontends to lld. Most are spelled as --lto-CGO[0-3], but COFF is spelled as -opt:lldltocgo=[0-3]. See D57422 for discussion surrounding the issue of how to set the CG opt level. The ultimate goal is to let each function control its CG opt level, but until then the current default means it is impossible to specify a CG opt level lower than 2 while using LTO. This option gives the user a means to control it for as long as it is not handled on a per-function basis. Reviewed By: MaskRay, #lld-macho, int3 Differential Revision: https://reviews.llvm.org/D141970
47 lines
1.2 KiB
C++
47 lines
1.2 KiB
C++
//===- Args.h ---------------------------------------------------*- C++ -*-===//
|
|
//
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef LLD_ARGS_H
|
|
#define LLD_ARGS_H
|
|
|
|
#include "lld/Common/LLVM.h"
|
|
#include "llvm/Support/CodeGen.h"
|
|
#include "llvm/Support/MemoryBuffer.h"
|
|
#include <vector>
|
|
|
|
namespace llvm {
|
|
namespace opt {
|
|
class InputArgList;
|
|
}
|
|
} // namespace llvm
|
|
|
|
namespace lld {
|
|
namespace args {
|
|
|
|
int getCGOptLevel(int optLevelLTO);
|
|
|
|
int64_t getInteger(llvm::opt::InputArgList &args, unsigned key,
|
|
int64_t Default);
|
|
|
|
int64_t getHex(llvm::opt::InputArgList &args, unsigned key, int64_t Default);
|
|
|
|
llvm::SmallVector<StringRef, 0> getStrings(llvm::opt::InputArgList &args,
|
|
int id);
|
|
|
|
uint64_t getZOptionValue(llvm::opt::InputArgList &args, int id, StringRef key,
|
|
uint64_t Default);
|
|
|
|
std::vector<StringRef> getLines(MemoryBufferRef mb);
|
|
|
|
StringRef getFilenameWithoutExe(StringRef path);
|
|
|
|
} // namespace args
|
|
} // namespace lld
|
|
|
|
#endif
|