summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-as/llvm-as.cpp
diff options
context:
space:
mode:
authorYaxun Liu <Yaxun.Liu@amd.com>2018-01-30 22:32:39 +0000
committerYaxun Liu <Yaxun.Liu@amd.com>2018-01-30 22:32:39 +0000
commitc00d81e6977cc98e0eea33d58847ffb17223635a (patch)
treea138da7f22a4cf264b9234f094b68c27cf6415ab /llvm/tools/llvm-as/llvm-as.cpp
parent4ec0d9c1b7e221524a834d9ddfb5f47b36e2ecb8 (diff)
downloadbcm5719-llvm-c00d81e6977cc98e0eea33d58847ffb17223635a.tar.gz
bcm5719-llvm-c00d81e6977cc98e0eea33d58847ffb17223635a.zip
LLParser: add an argument for overriding data layout and do not check alloca addr space
Sometimes users do not specify data layout in LLVM assembly and let llc set the data layout by target triple after loading the LLVM assembly. Currently the parser checks alloca address space no matter whether the LLVM assembly contains data layout definition, which causes false alarm since the default data layout does not contain the correct alloca address space. The parser also calls verifier to check debug info and updating invalid debug info. Currently there is no way to let the verifier to check debug info only. If the verifier finds non-debug-info issues the parser will fail. For llc, the fix is to remove the check of alloca addr space in the parser and disable updating debug info, and defer the updating of debug info and verification to be after setting data layout of the IR by target. For other llvm tools, since they do not override data layout by target but instead can override data layout by a command line option, an argument for overriding data layout is added to the parser. In cases where data layout overriding is necessary for the parser, the data layout can be provided by command line. Differential Revision: https://reviews.llvm.org/D41832 llvm-svn: 323826
Diffstat (limited to 'llvm/tools/llvm-as/llvm-as.cpp')
-rw-r--r--llvm/tools/llvm-as/llvm-as.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/llvm/tools/llvm-as/llvm-as.cpp b/llvm/tools/llvm-as/llvm-as.cpp
index 9f0f162b74f..7d04b4ddc8e 100644
--- a/llvm/tools/llvm-as/llvm-as.cpp
+++ b/llvm/tools/llvm-as/llvm-as.cpp
@@ -59,6 +59,11 @@ static cl::opt<bool> PreserveBitcodeUseListOrder(
cl::desc("Preserve use-list order when writing LLVM bitcode."),
cl::init(true), cl::Hidden);
+static cl::opt<std::string> ClDataLayout("data-layout",
+ cl::desc("data layout string to use"),
+ cl::value_desc("layout-string"),
+ cl::init(""));
+
static void WriteOutputFile(const Module *M) {
// Infer the output filename if needed.
if (OutputFilename.empty()) {
@@ -97,8 +102,8 @@ int main(int argc, char **argv) {
// Parse the file now...
SMDiagnostic Err;
- std::unique_ptr<Module> M =
- parseAssemblyFile(InputFilename, Err, Context, nullptr, !DisableVerify);
+ std::unique_ptr<Module> M = parseAssemblyFile(
+ InputFilename, Err, Context, nullptr, !DisableVerify, ClDataLayout);
if (!M.get()) {
Err.print(argv[0], errs());
return 1;
OpenPOWER on IntegriCloud