mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 19:23:23 +01:00
8dc80efd4f
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
64 lines
2.7 KiB
C++
64 lines
2.7 KiB
C++
//===---- llvm/IRReader/IRReader.h - Reader for LLVM IR files ---*- C++ -*-===//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file is distributed under the University of Illinois Open Source
|
|
// License. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This file defines functions for reading LLVM IR. They support both
|
|
// Bitcode and Assembly, automatically detecting the input format.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef LLVM_IRREADER_IRREADER_H
|
|
#define LLVM_IRREADER_IRREADER_H
|
|
|
|
#include "llvm/ADT/StringRef.h"
|
|
#include <memory>
|
|
|
|
namespace llvm {
|
|
|
|
class StringRef;
|
|
class MemoryBufferRef;
|
|
class Module;
|
|
class SMDiagnostic;
|
|
class LLVMContext;
|
|
|
|
/// If the given file holds a bitcode image, return a Module
|
|
/// for it which does lazy deserialization of function bodies. Otherwise,
|
|
/// attempt to parse it as LLVM Assembly and return a fully populated
|
|
/// Module. The ShouldLazyLoadMetadata flag is passed down to the bitcode
|
|
/// reader to optionally enable lazy metadata loading.
|
|
std::unique_ptr<Module>
|
|
getLazyIRFileModule(StringRef Filename, SMDiagnostic &Err, LLVMContext &Context,
|
|
bool ShouldLazyLoadMetadata = false);
|
|
|
|
/// If the given MemoryBuffer holds a bitcode image, return a Module
|
|
/// for it. Otherwise, attempt to parse it as LLVM Assembly and return
|
|
/// a Module for it.
|
|
/// \param UpgradeDebugInfo Run UpgradeDebugInfo, which runs the Verifier.
|
|
/// This option should only be set to false by llvm-as
|
|
/// for use inside the LLVM testuite!
|
|
/// \param DataLayoutString Override datalayout in the llvm assembly.
|
|
std::unique_ptr<Module> parseIR(MemoryBufferRef Buffer, SMDiagnostic &Err,
|
|
LLVMContext &Context,
|
|
bool UpgradeDebugInfo = true,
|
|
StringRef DataLayoutString = "");
|
|
|
|
/// If the given file holds a bitcode image, return a Module for it.
|
|
/// Otherwise, attempt to parse it as LLVM Assembly and return a Module
|
|
/// for it.
|
|
/// \param UpgradeDebugInfo Run UpgradeDebugInfo, which runs the Verifier.
|
|
/// This option should only be set to false by llvm-as
|
|
/// for use inside the LLVM testuite!
|
|
/// \param DataLayoutString Override datalayout in the llvm assembly.
|
|
std::unique_ptr<Module> parseIRFile(StringRef Filename, SMDiagnostic &Err,
|
|
LLVMContext &Context,
|
|
bool UpgradeDebugInfo = true,
|
|
StringRef DataLayoutString = "");
|
|
}
|
|
|
|
#endif
|