[PATCH] D111160: [UnknownProvenance] Add LLVM-IR support for unknown_provenance
Jeroen Dobbelaere via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 12 01:35:37 PST 2023
jeroen.dobbelaere updated this revision to Diff 488531.
jeroen.dobbelaere added a comment.
Herald added a subscriber: StephenFan.
Rebased to ef545ef62a833152d8975ff16333b57cc41befcc <https://reviews.llvm.org/rGef545ef62a833152d8975ff16333b57cc41befcc> (Jan 9, 2023)
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D111160/new/
https://reviews.llvm.org/D111160
Files:
llvm/include/llvm/AsmParser/LLParser.h
llvm/include/llvm/AsmParser/LLToken.h
llvm/lib/AsmParser/LLLexer.cpp
llvm/lib/AsmParser/LLParser.cpp
llvm/lib/IR/AsmWriter.cpp
Index: llvm/lib/IR/AsmWriter.cpp
===================================================================
--- llvm/lib/IR/AsmWriter.cpp
+++ llvm/lib/IR/AsmWriter.cpp
@@ -1581,6 +1581,11 @@
return;
}
+ if (isa<UnknownProvenance>(CV)) {
+ Out << "unknown_provenance";
+ return;
+ }
+
if (const ConstantExpr *CE = dyn_cast<ConstantExpr>(CV)) {
Out << CE->getOpcodeName();
WriteOptimizationInfo(Out, CE);
Index: llvm/lib/AsmParser/LLParser.cpp
===================================================================
--- llvm/lib/AsmParser/LLParser.cpp
+++ llvm/lib/AsmParser/LLParser.cpp
@@ -3450,6 +3450,7 @@
break;
case lltok::kw_null: ID.Kind = ValID::t_Null; break;
case lltok::kw_undef: ID.Kind = ValID::t_Undef; break;
+ case lltok::kw_unknown_provenance: ID.Kind = ValID::t_UnknownProvenance; break;
case lltok::kw_poison: ID.Kind = ValID::t_Poison; break;
case lltok::kw_zeroinitializer: ID.Kind = ValID::t_Zero; break;
case lltok::kw_none: ID.Kind = ValID::t_None; break;
@@ -5745,6 +5746,11 @@
return error(ID.Loc, "invalid type for undef constant");
V = UndefValue::get(Ty);
return false;
+ case ValID::t_UnknownProvenance:
+ if (!Ty->isPointerTy())
+ return error(ID.Loc, "unknown_provenance must be a pointer type");
+ V = UnknownProvenance::get(cast<PointerType>(Ty));
+ return false;
case ValID::t_EmptyArray:
if (!Ty->isArrayTy() || cast<ArrayType>(Ty)->getNumElements() != 0)
return error(ID.Loc, "invalid empty array initializer");
Index: llvm/lib/AsmParser/LLLexer.cpp
===================================================================
--- llvm/lib/AsmParser/LLLexer.cpp
+++ llvm/lib/AsmParser/LLLexer.cpp
@@ -545,6 +545,7 @@
KEYWORD(unwind);
KEYWORD(datalayout);
KEYWORD(volatile);
+ KEYWORD(unknown_provenance);
KEYWORD(atomic);
KEYWORD(unordered);
KEYWORD(monotonic);
Index: llvm/include/llvm/AsmParser/LLToken.h
===================================================================
--- llvm/include/llvm/AsmParser/LLToken.h
+++ llvm/include/llvm/AsmParser/LLToken.h
@@ -90,6 +90,7 @@
kw_unwind,
kw_datalayout,
kw_volatile,
+ kw_unknown_provenance,
kw_atomic,
kw_unordered,
kw_monotonic,
Index: llvm/include/llvm/AsmParser/LLParser.h
===================================================================
--- llvm/include/llvm/AsmParser/LLParser.h
+++ llvm/include/llvm/AsmParser/LLParser.h
@@ -55,6 +55,7 @@
t_LocalName, t_GlobalName, // Name in StrVal.
t_APSInt, t_APFloat, // Value in APSIntVal/APFloatVal.
t_Null, t_Undef, t_Zero, t_None, t_Poison, // No value.
+ t_UnknownProvenance, // No value.
t_EmptyArray, // No value: []
t_Constant, // Value in ConstantVal.
t_InlineAsm, // Value in FTy/StrVal/StrVal2/UIntVal.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D111160.488531.patch
Type: text/x-patch
Size: 2902 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230112/3fcea430/attachment.bin>
More information about the llvm-commits
mailing list