Go to the documentation of this file.
19 #include <system_error>
42 true, DataLayoutCallback);
45 std::unique_ptr<Module>
49 std::unique_ptr<Module>
M =
50 std::make_unique<Module>(
F.getBufferIdentifier(),
Context);
64 if (std::error_code EC = FileOrErr.
getError()) {
66 "Could not open input file: " + EC.message());
78 std::unique_ptr<Module>
M =
79 std::make_unique<Module>(
F.getBufferIdentifier(),
Context);
80 std::unique_ptr<ModuleSummaryIndex>
Index =
81 std::make_unique<ModuleSummaryIndex>(
true);
85 return {
nullptr,
nullptr};
106 if (std::error_code EC = FileOrErr.
getError()) {
108 "Could not open input file: " + EC.message());
109 return {
nullptr,
nullptr};
152 return LLParser(
F.getBuffer(), SM, Err,
nullptr, &
Index, unusedContext)
156 std::unique_ptr<ModuleSummaryIndex>
158 std::unique_ptr<ModuleSummaryIndex>
Index =
159 std::make_unique<ModuleSummaryIndex>(
false);
167 std::unique_ptr<ModuleSummaryIndex>
171 if (std::error_code EC = FileOrErr.
getError()) {
173 "Could not open input file: " + EC.message());
198 if (Read !=
Asm.size()) {
This is an optimization pass for GlobalISel generic memory operations.
std::unique_ptr< Module > parseAssemblyString(StringRef AsmString, SMDiagnostic &Err, LLVMContext &Context, SlotMapping *Slots=nullptr)
The function is a secondary interface to the LLVM Assembly Parser.
We currently emits eax Perhaps this is what we really should generate is Is imull three or four cycles eax eax The current instruction priority is based on pattern complexity The former is more complex because it folds a load so the latter will not be emitted Perhaps we should use AddedComplexity to give LEA32r a higher priority We should always try to match LEA first since the LEA matching code does some estimate to determine whether the match is profitable if we care more about code then imull is better It s two bytes shorter than movl leal On a Pentium M
bool UpgradeDebugInfo(Module &M)
Check the debug info version number, if it is out-dated, drop the debug info.
bool parseTypeAtBeginning(Type *&Ty, unsigned &Read, const SlotMapping *Slots)
Type * parseTypeAtBeginning(StringRef Asm, unsigned &Read, SMDiagnostic &Err, const Module &M, const SlotMapping *Slots=nullptr)
Parse a string Asm that starts with a type.
std::unique_ptr< ModuleSummaryIndex > parseSummaryIndexAssembly(MemoryBufferRef F, SMDiagnostic &Err)
Parse LLVM Assembly for summary index from a MemoryBuffer.
The instances of the Type class are immutable: once they are created, they are never changed.
ParsedModuleAndIndex parseAssemblyWithIndex(MemoryBufferRef F, SMDiagnostic &Err, LLVMContext &Context, SlotMapping *Slots=nullptr)
Parse LLVM Assembly including the summary index from a MemoryBuffer.
std::unique_ptr< Module > parseAssembly(MemoryBufferRef F, SMDiagnostic &Err, LLVMContext &Context, SlotMapping *Slots=nullptr, DataLayoutCallbackTy DataLayoutCallback=[](StringRef) { return None;})
parseAssemblyFile and parseAssemblyString are wrappers around this function.
static bool parseSummaryIndexAssemblyInto(MemoryBufferRef F, ModuleSummaryIndex &Index, SMDiagnostic &Err)
Type * parseType(StringRef Asm, SMDiagnostic &Err, const Module &M, const SlotMapping *Slots=nullptr)
Parse a type in the given string.
static std::unique_ptr< MemoryBuffer > getMemBuffer(StringRef InputData, StringRef BufferName="", bool RequiresNullTerminator=true)
Open the specified memory range as a MemoryBuffer.
Represents a location in source code.
(vector float) vec_cmpeq(*A, *B) C
Instances of this class encapsulate one diagnostic report, allowing printing to a raw_ostream as a ca...
std::error_code getError() const
std::unique_ptr< Module > parseAssemblyFile(StringRef Filename, SMDiagnostic &Err, LLVMContext &Context, SlotMapping *Slots=nullptr)
This function is a main interface to the LLVM Assembly Parser.
static ParsedModuleAndIndex parseAssemblyFileWithIndex(StringRef Filename, SMDiagnostic &Err, LLVMContext &Context, SlotMapping *Slots, bool UpgradeDebugInfo, DataLayoutCallbackTy DataLayoutCallback)
bool Run(bool UpgradeDebugInfo, DataLayoutCallbackTy DataLayoutCallback=[](StringRef) { return None;})
Run: module ::= toplevelentity*.
An efficient, type-erasing, non-owning reference to a callable.
This struct contains the mappings from the slot numbers to unnamed metadata nodes,...
This is an important base class in LLVM.
compiles ldr LCPI1_0 ldr ldr mov lsr tst moveq r1 ldr LCPI1_1 and r0 bx lr It would be better to do something like to fold the shift into the conditional move
This is an important class for using LLVM in a threaded context.
static ErrorOr< std::unique_ptr< MemoryBuffer > > getFileOrSTDIN(const Twine &Filename, bool IsText=false, bool RequiresNullTerminator=true)
Open the specified file as a MemoryBuffer, or open stdin if the Filename is "-".
ParsedModuleAndIndex parseAssemblyFileWithIndex(StringRef Filename, SMDiagnostic &Err, LLVMContext &Context, SlotMapping *Slots=nullptr, DataLayoutCallbackTy DataLayoutCallback=[](StringRef) { return None;})
This function is a main interface to the LLVM Assembly Parser.
A Module instance is used to store all the information related to an LLVM module.
std::unique_ptr< ModuleSummaryIndex > parseSummaryIndexAssemblyFile(StringRef Filename, SMDiagnostic &Err)
This function is a main interface to the LLVM Assembly Parser.
ParsedModuleAndIndex parseAssemblyFileWithIndexNoUpgradeDebugInfo(StringRef Filename, SMDiagnostic &Err, LLVMContext &Context, SlotMapping *Slots, DataLayoutCallbackTy DataLayoutCallback)
Only for use in llvm-as for testing; this does not produce a valid module.
StringRef - Represent a constant reference to a string, i.e.
bool parseStandaloneConstantValue(Constant *&C, const SlotMapping *Slots)
This owns the files read by a parser, handles include stacks, and handles diagnostic wrangling.
Holds the Module and ModuleSummaryIndex returned by the interfaces that parse both.
static bool parseAssemblyInto(MemoryBufferRef F, Module *M, ModuleSummaryIndex *Index, SMDiagnostic &Err, SlotMapping *Slots, bool UpgradeDebugInfo, DataLayoutCallbackTy DataLayoutCallback)
unsigned AddNewSourceBuffer(std::unique_ptr< MemoryBuffer > F, SMLoc IncludeLoc)
Add a new source buffer to this source manager.
SMDiagnostic GetMessage(SMLoc Loc, DiagKind Kind, const Twine &Msg, ArrayRef< SMRange > Ranges={}, ArrayRef< SMFixIt > FixIts={}) const
Return an SMDiagnostic at the specified location with the specified string.
Constant * parseConstantValue(StringRef Asm, SMDiagnostic &Err, const Module &M, const SlotMapping *Slots=nullptr)
Parse a type and a constant value in the given string.
Class to hold module path string table and global value map, and encapsulate methods for operating on...
Represents either an error or a value T.
static SMLoc getFromPointer(const char *Ptr)
static ParsedModuleAndIndex parseAssemblyWithIndex(MemoryBufferRef F, SMDiagnostic &Err, LLVMContext &Context, SlotMapping *Slots, bool UpgradeDebugInfo, DataLayoutCallbackTy DataLayoutCallback)
bool parseAssemblyInto(MemoryBufferRef F, Module *M, ModuleSummaryIndex *Index, SMDiagnostic &Err, SlotMapping *Slots=nullptr, DataLayoutCallbackTy DataLayoutCallback=[](StringRef) { return None;})
This function is the low-level interface to the LLVM Assembly Parser.