Skip to content

Commit 91560a5

Browse files
committed
Add cmake comments and a test
1 parent 9b67848 commit 91560a5

File tree

2 files changed

+36
-3
lines changed

2 files changed

+36
-3
lines changed

mlir/include/mlir/Dialect/LLVMIR/CMakeLists.txt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,21 @@ mlir_tablegen(LLVMOpsDialect.h.inc -gen-dialect-decls)
77
mlir_tablegen(LLVMOpsDialect.cpp.inc -gen-dialect-defs)
88
mlir_tablegen(LLVMOpsEnums.h.inc -gen-enum-decls)
99
mlir_tablegen(LLVMOpsEnums.cpp.inc -gen-enum-defs)
10+
#For LLVMOpsAttrDefs.h.inc, see below.
1011
mlir_tablegen(LLVMOpsAttrDefs.cpp.inc -gen-attrdef-defs
1112
-attrdefs-dialect=llvm)
1213
add_public_tablegen_target(MLIRLLVMOpsIncGen)
1314

14-
# FIXME: explain how this solves generated header recursive dependency
15+
# NB: Separate out LLVMOpsAttrDefs.h.inc generation as generating it
16+
# through LLVMOps.td ends up defining LLVMTargetFeaturesAttr even
17+
# though LLVMTargetFeaturesAttrDefs.* is responsible for that.
1518
set(LLVM_TARGET_DEFINITIONS LLVMAttrAndEnumDefs.td)
1619
mlir_tablegen(LLVMOpsAttrDefs.h.inc -gen-attrdef-decls -attrdefs-dialect=llvm)
1720
add_public_tablegen_target(MLIRLLVMAttrsIncGen)
1821

19-
# FIXME: explain how this solves generated header recursive dependency
22+
# NB: LLVMTargetFeaturesAttr is split out into its own file
23+
# to break a recursive dependency: LLVMInterfaces depends
24+
# on it, and other LLVMAttrs depending on LLVMInterfaces.
2025
set(LLVM_TARGET_DEFINITIONS LLVMTargetFeaturesAttrDefs.td)
2126
mlir_tablegen(LLVMTargetFeaturesAttrDefs.h.inc -gen-attrdef-decls)
2227
mlir_tablegen(LLVMTargetFeaturesAttrDefs.cpp.inc -gen-attrdef-defs)

mlir/test/Dialect/LLVMIR/data-layout-from-target.mlir

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,36 @@ module attributes { llvm.target = #llvm.target<triple = "x86_64-unknown-linux">
1212

1313
// -----
1414

15+
// TODO: module attributes
16+
// TODO-SAME: dlti.dl_spec = #llvm.data_layout
17+
// TODO-SAME: llvm.target = #llvm.target<
18+
// TODO-SAME: triple = "x86_64-unknown-linux"
19+
// TODO-NOT: chip = "skylake"
20+
// TODO-SAME: #llvm.target_features<["+mmx", "+sse"]>
21+
// TODO-NOT: chip = "skylake"
22+
23+
//module attributes { llvm.target = #llvm.target<triple = "x86_64-unknown-linux",
24+
// // Generated parser is dumb: expected 'chip'
25+
// #llvm.target_features<["+mmx", "+sse"]>> } {
26+
//}
27+
28+
// -----
29+
1530
// CHECK: module attributes
16-
// CHECK-SAME: dlti.dl_spec = #llvm.data_layout<"[[DL_STR:.*]]">
31+
// CHECK-SAME: dlti.dl_spec = #llvm.data_layout
32+
// CHECK-SAME: llvm.target = #llvm.target<
33+
// CHECK-SAME: triple = "x86_64-unknown-linux"
34+
// CHECK-SAME: chip = "skylake"
35+
// CHECK-NOT: #llvm.target_features
36+
37+
module attributes { llvm.target = #llvm.target<triple = "x86_64-unknown-linux",
38+
chip = "skylake"> } {
39+
}
40+
41+
// -----
42+
43+
// CHECK: module attributes
44+
// CHECK-SAME: dlti.dl_spec = #llvm.data_layout
1745
// CHECK-SAME: llvm.target = #llvm.target<
1846
// CHECK-SAME: triple = "x86_64-unknown-linux"
1947
// CHECK-SAME: chip = "skylake"

0 commit comments

Comments
 (0)