.Case("!tbaa", MIToken::md_tbaa)
.Case("!alias.scope", MIToken::md_alias_scope)
.Case("!noalias", MIToken::md_noalias)
+ .Case("!range", MIToken::md_range)
.Default(MIToken::Error);
}
md_tbaa,
md_alias_scope,
md_noalias,
+ md_range,
// Identifier tokens
Identifier,
return true;
unsigned BaseAlignment = Size;
AAMDNodes AAInfo;
+ MDNode *Range = nullptr;
while (consumeIfPresent(MIToken::comma)) {
switch (Token.kind()) {
case MIToken::kw_align:
if (parseMDNode(AAInfo.NoAlias))
return true;
break;
- // TODO: Parse the ranges metadata.
+ case MIToken::md_range:
+ lex();
+ if (parseMDNode(Range))
+ return true;
+ break;
// TODO: Report an error on duplicate metadata nodes.
default:
- return error(
- "expected 'align' or '!tbaa' or '!alias.scope' or '!noalias'");
+ return error("expected 'align' or '!tbaa' or '!alias.scope' or "
+ "'!noalias' or '!range'");
}
}
if (expectAndConsume(MIToken::rparen))
return true;
- Dest = MF.getMachineMemOperand(Ptr, Flags, Size, BaseAlignment, AAInfo);
+ Dest =
+ MF.getMachineMemOperand(Ptr, Flags, Size, BaseAlignment, AAInfo, Range);
return false;
}
OS << ", !noalias ";
AAInfo.NoAlias->printAsOperand(OS, MST);
}
- // TODO: Print the ranges metadata.
+ if (Op.getRanges()) {
+ OS << ", !range ";
+ Op.getRanges()->printAsOperand(OS, MST);
+ }
OS << ')';
}
!9 = distinct !{!9, !10, !"some scope"}
!10 = distinct !{!10, !"some domain"}
+ define zeroext i1 @range_metadata(i8* %x) {
+ entry:
+ %0 = load i8, i8* %x, align 1, !range !11
+ %tobool = trunc i8 %0 to i1
+ ret i1 %tobool
+ }
+
+ !11 = !{i8 0, i8 2}
+
...
---
name: test
MOVSSmr killed %rdi, 1, _, 28, _, killed %xmm0 :: (store 4 into %ir.arrayidx)
RETQ
...
+---
+name: range_metadata
+tracksRegLiveness: true
+liveins:
+ - { reg: '%rdi' }
+body: |
+ bb.0.entry:
+ liveins: %rdi
+ ; CHECK-LABEL: name: range_metadata
+ ; CHECK: %al = MOV8rm killed %rdi, 1, _, 0, _ :: (load 1 from %ir.x, !range !11)
+ %al = MOV8rm killed %rdi, 1, _, 0, _ :: (load 1 from %ir.x, !range !11)
+ RETQ %al
+...