#include "llvm/Support/ToolOutputFile.h"
#include "llvm/Target/TargetLibraryInfo.h"
#include "llvm/Target/TargetMachine.h"
+#include "llvm/Target/TargetSubtargetInfo.h"
#include <memory>
using namespace llvm;
static cl::opt<bool> DisableSimplifyLibCalls("disable-simplify-libcalls",
cl::desc("Disable simplify-libcalls"));
-static int compileModule(char**, LLVMContext&);
+static cl::opt<bool> ShowMCEncoding("show-mc-encoding", cl::Hidden,
+ cl::desc("Show encoding in .s output"));
+
+static cl::opt<bool> EnableDwarfDirectory(
+ "enable-dwarf-directory", cl::Hidden,
+ cl::desc("Use .file directives with an explicit directory."));
+
+static cl::opt<bool> AsmVerbose("asm-verbose",
+ cl::desc("Add comments to directives."),
+ cl::init(true));
+
+static int compileModule(char **, LLVMContext &);
// GetFileNameRoot - Helper function to get the basename of a filename.
static inline std::string
}
// Open the file.
- std::string error;
+ std::error_code EC;
sys::fs::OpenFlags OpenFlags = sys::fs::F_None;
if (!Binary)
OpenFlags |= sys::fs::F_Text;
- tool_output_file *FDOut = new tool_output_file(OutputFilename.c_str(), error,
- OpenFlags);
- if (!error.empty()) {
- errs() << error << '\n';
+ tool_output_file *FDOut = new tool_output_file(OutputFilename, EC, OpenFlags);
+ if (EC) {
+ errs() << EC.message() << '\n';
delete FDOut;
return nullptr;
}
// If user just wants to list available options, skip module loading
if (!SkipModule) {
- M.reset(ParseIRFile(InputFilename, Err, Context));
+ M = parseIRFile(InputFilename, Err, Context);
mod = M.get();
if (mod == nullptr) {
Err.print(argv[0], errs());
TargetOptions Options = InitTargetOptionsFromCodeGenFlags();
Options.DisableIntegratedAS = NoIntegratedAssembler;
-
- // Override default to generate verbose assembly unless we've seen the flag.
- if (AsmVerbose.getNumOccurrences() == 0)
- Options.MCOptions.AsmVerbose = true;
+ Options.MCOptions.ShowMCEncoding = ShowMCEncoding;
+ Options.MCOptions.MCUseDwarfDirectory = EnableDwarfDirectory;
+ Options.MCOptions.AsmVerbose = AsmVerbose;
std::unique_ptr<TargetMachine> target(
TheTarget->createTargetMachine(TheTriple.getTriple(), MCPU, FeaturesStr,
PM.add(TLI);
// Add the target data from the target machine, if it exists, or the module.
- if (const DataLayout *DL = Target.getDataLayout())
+ if (const DataLayout *DL = Target.getSubtargetImpl()->getDataLayout())
mod->setDataLayout(DL);
PM.add(new DataLayoutPass(mod));