diff --git a/docs/LangRef.html b/docs/LangRef.html index e3971ffed0d..074e91e684c 100644 --- a/docs/LangRef.html +++ b/docs/LangRef.html @@ -108,6 +108,10 @@ +
Information about the module as a whole is difficult to convey to LLVM's + subsystems. The LLVM IR isn't sufficient to transmit this + information. The llvm.module.flags named metadata exists in order to + facilitate this. These flags are in the form of key / value pairs — + much like a dictionary — making it easy for any subsystem who cares + about a flag to look it up.
+ +The llvm.module.flags metadata contains a list of metadata + triplets. Each triplet has the following form:
+ +When two (or more) modules are merged together, the resulting + llvm.module.flags metadata is the union of the + modules' llvm.module.flags metadata. The only exception being a flag + with the Override behavior, which may override another flag's value + (see below).
+ +The following behaviors are supported:
+ +Value | +Behavior | +
---|---|
1 | +
+ |
+
2 | +
+ |
+
3 | +
+ |
+
4 | +
+ |
+
An example of module flags:
+ ++!0 = metadata !{ i32 1, metadata !"foo", i32 1 } +!1 = metadata !{ i32 4, metadata !"bar", i32 37 } +!2 = metadata !{ i32 2, metadata !"qux", i32 42 } +!3 = metadata !{ i32 3, metadata !"qux", + metadata !{ + metadata !"foo", i32 1 + } +} +!llvm.module.flags = !{ !0, !1, !2, !3 } ++ +
Metadata !0 has the ID !"foo" and the value '1'. The + behavior if two or more !"foo" flags are seen is to emit an + error if their values are not equal.
Metadata !1 has the ID !"bar" and the value '37'. The + behavior if two or more !"bar" flags are seen is to use the + value '37' if their values are not equal.
Metadata !2 has the ID !"qux" and the value '42'. The + behavior if two or more !"qux" flags are seen is to emit a + warning if their values are not equal.
Metadata !3 has the ID !"qux" and the value:
+ ++metadata !{ metadata !"foo", i32 1 } ++
The behavior is to emit an error if the llvm.module.flags does + not contain a flag with the ID !"foo" that has the value + '1'. If two or more !"qux" flags exist, then they must have + the same value or an error will be issued.