Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
There's potential for a more generic solution here. I tried passing a ArrayRef<llvm::Module::ModuleFlagEntry> through: https://github.com/ScottTodd/llvm-project/commit/e276941578e8afd1f77380eceb9d76cd1b11b41c , but I think something using attributes on the Operation might be better. For projects not using memrefs, the "malloc" and "free" functions could also be optional.
Can we just add a triple as a module attribute similarly to what we already have for DataLayout? module attributes {llvm.data_layout = "E", llvm.triple = "x86-windows-msvc"} {...}. There is always at least the top-level module. One caveat is that we need to make sure LLVM doesn't exit(1) if it fails to parse the triple.
mlir/lib/Target/LLVMIR/ModuleTranslation.cpp | ||
---|---|---|
957 | Anything debug related should be in DebugTranslation. |
You may need a refactor like Alex did here: https://reviews.llvm.org/D85650 ; what about a factory method returning ErrorOr<Triple> ?
Looked through the source and tried some bogus values, I don't think LLVM crashes if it fails to parse into a meaningful Triple:
https://github.com/llvm/llvm-project/blob/master/llvm/unittests/ADT/TripleTest.cpp
https://github.com/llvm/llvm-project/blob/4726a402a32a0553cf4da8c59646d8bc99c08383/llvm/lib/Support/Triple.cpp#L737-L773
Anything debug related should be in DebugTranslation.