[PATCH] D141059: [IRParser] Pass a const Module& reference to the DataLayout callback

Alexander Richardson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 6 05:11:04 PST 2023


arichardson created this revision.
Herald added subscribers: ormris, hiraditya.
Herald added a project: All.
arichardson added reviewers: mehdi_amini, efriedma.
arichardson added a comment.
arichardson published this revision for review.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

@mehdi_amini In D78403 <https://reviews.llvm.org/D78403> you were against passing a `Module*` callback, is a read-only `const Module&` okay or should I pass DataLayout + triple instead? I prefer the former, but if there are strong objections I'm happy to change it to the latter. Passing a read-only module should make it easier to extend in the future if needed.


This allows the "override DataLayout" callback to read both the
DataLayout and TargetTriple that was defined in the IR module when
inferring the default (for example we might not want to override the
existing value if it's non-empty).
We could also add an additional argument instead, but I feel that
passing a const reference to the Module is simpler and more extensible.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D141059

Files:
  llvm/include/llvm/AsmParser/LLParser.h
  llvm/include/llvm/AsmParser/Parser.h
  llvm/include/llvm/Bitcode/BitcodeReader.h
  llvm/include/llvm/CodeGen/MIRParser/MIRParser.h
  llvm/include/llvm/IRReader/IRReader.h
  llvm/lib/AsmParser/LLParser.cpp
  llvm/lib/AsmParser/Parser.cpp
  llvm/lib/Bitcode/Reader/BitcodeReader.cpp
  llvm/lib/CodeGen/MIRParser/MIRParser.cpp
  llvm/tools/llc/llc.cpp
  llvm/tools/llvm-as/llvm-as.cpp
  llvm/tools/llvm-reduce/ReducerWorkItem.cpp
  llvm/tools/opt/opt.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D141059.486568.patch
Type: text/x-patch
Size: 13636 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230106/6b2bb9f1/attachment.bin>


More information about the llvm-commits mailing list