@@ -74,6 +74,21 @@ namespace xd {
7474 state.setError ();
7575 });
7676
77+ builder.add< InstNameConflictDoubleOp> ([](::llvm_dialects ::VerifierState & state, InstNameConflictDoubleOp & op) {
78+ if (! op.verifier (state.out ()))
79+ state.setError ();
80+ });
81+
82+ builder.add< InstNameConflictOp> ([](::llvm_dialects ::VerifierState & state, InstNameConflictOp & op) {
83+ if (! op.verifier (state.out ()))
84+ state.setError ();
85+ });
86+
87+ builder.add< InstNameConflictVarargsOp> ([](::llvm_dialects ::VerifierState & state, InstNameConflictVarargsOp & op) {
88+ if (! op.verifier (state.out ()))
89+ state.setError ();
90+ });
91+
7792 builder.add< ReadOp> ([](::llvm_dialects ::VerifierState & state, ReadOp & op) {
7893 if (! op.verifier (state.out ()))
7994 state.setError ();
@@ -157,6 +172,11 @@ attrBuilder.addAttribute(::llvm::Attribute::NoUnwind);
157172attrBuilder.addMemoryAttr (::llvm ::MemoryEffects (::llvm ::MemoryEffects ::Location ::InaccessibleMem, ::llvm ::ModRefInfo ::ModRef));
158173m_attributeLists[3 ] = ::llvm ::AttributeList ::get (context, ::llvm ::AttributeList ::FunctionIndex, attrBuilder);
159174}
175+ {
176+ ::llvm ::AttrBuilder attrBuilder{context};
177+ attrBuilder.addAttribute (::llvm ::Attribute ::WillReturn);
178+ m_attributeLists[4 ] = ::llvm ::AttributeList ::get (context, ::llvm ::AttributeList ::FunctionIndex, attrBuilder);
179+ }
160180}
161181
162182XdHandleType* XdHandleType ::get (::llvm ::LLVMContext & ctx) {
@@ -1166,6 +1186,203 @@ index
11661186
11671187
11681188
1189+ const ::llvm ::StringLiteral InstNameConflictDoubleOp ::s_name{" xd.try.conflict" };
1190+
1191+ InstNameConflictDoubleOp* InstNameConflictDoubleOp ::create (llvm_dialects ::Builder& b, ::llvm ::Value * instName, ::llvm ::Value * instName_0, const llvm ::Twine & instName_1) {
1192+ ::llvm ::LLVMContext& context = b.getContext ();
1193+ (void)context;
1194+ ::llvm ::Module& module = * b.GetInsertBlock ()- > getModule ();
1195+
1196+
1197+ const ::llvm ::AttributeList attrs
1198+ = ExampleDialect ::get (context).getAttributeList (4 );
1199+ auto fnType = ::llvm ::FunctionType ::get (::llvm ::Type ::getVoidTy (context), true );
1200+
1201+ auto fn = module.getOrInsertFunction (s_name, fnType, attrs);
1202+ ::llvm ::SmallString< 32 > newName;
1203+ for (unsigned i = 0 ; ! ::llvm ::isa< ::llvm ::Function> (fn.getCallee ()) ||
1204+ ::llvm ::cast< ::llvm ::Function> (fn.getCallee ())- > getFunctionType () ! = fn.getFunctionType (); i++ ) {
1205+ // If a function with the same name but a different types already exists,
1206+ // we get a bitcast of a function or a function with the wrong type.
1207+ // Try new names until we get one with the correct type.
1208+ newName = " " ;
1209+ ::llvm ::raw_svector_ostream newNameStream (newName);
1210+ newNameStream << s_name << " _" << i;
1211+ fn = module.getOrInsertFunction (newNameStream.str (), fnType, attrs);
1212+ }
1213+ assert (::llvm ::isa< ::llvm ::Function> (fn.getCallee ()));
1214+ assert (fn.getFunctionType () == fnType);
1215+ assert (::llvm ::cast< ::llvm ::Function> (fn.getCallee ())- > getFunctionType () == fn.getFunctionType ());
1216+
1217+ ::llvm ::SmallVector< ::llvm ::Value* , 2 > args = {
1218+ instName,
1219+ instName_0
1220+ };
1221+
1222+ return ::llvm ::cast< InstNameConflictDoubleOp> (b.CreateCall (fn, args, instName_1));
1223+ }
1224+
1225+
1226+ bool InstNameConflictDoubleOp ::verifier (::llvm ::raw_ostream & errs) {
1227+ ::llvm ::LLVMContext & context = getModule ()- > getContext ();
1228+ (void)context;
1229+
1230+ using ::llvm_dialects ::printable;
1231+
1232+ if (arg_size () ! = 2 ) {
1233+ errs << " wrong number of arguments: " << arg_size ()
1234+ << " , expected 2\n" ;
1235+ return false ;
1236+ }
1237+ ::llvm ::Type * const instNameType = getInstName ()- > getType ();
1238+ (void)instNameType;
1239+ ::llvm ::Type * const instName_0Type = getInstName_0 ()- > getType ();
1240+ (void)instName_0Type;
1241+ return true ;
1242+ }
1243+
1244+
1245+ ::llvm ::Value * InstNameConflictDoubleOp ::getInstName () {
1246+ return getArgOperand (0 );
1247+ }
1248+
1249+ void InstNameConflictDoubleOp ::setInstName (::llvm ::Value * instName) {
1250+ setArgOperand (0 , instName);
1251+ }
1252+ ::llvm ::Value * InstNameConflictDoubleOp ::getInstName_0 () {
1253+ return getArgOperand (1 );
1254+ }
1255+
1256+ void InstNameConflictDoubleOp ::setInstName_0 (::llvm ::Value * instName_0) {
1257+ setArgOperand (1 , instName_0);
1258+ }
1259+
1260+
1261+
1262+ const ::llvm ::StringLiteral InstNameConflictOp ::s_name{" xd.try.conflict" };
1263+
1264+ InstNameConflictOp* InstNameConflictOp ::create (llvm_dialects ::Builder& b, ::llvm ::Value * instName, const llvm ::Twine & instName_0) {
1265+ ::llvm ::LLVMContext& context = b.getContext ();
1266+ (void)context;
1267+ ::llvm ::Module& module = * b.GetInsertBlock ()- > getModule ();
1268+
1269+
1270+ const ::llvm ::AttributeList attrs
1271+ = ExampleDialect ::get (context).getAttributeList (4 );
1272+ auto fnType = ::llvm ::FunctionType ::get (::llvm ::Type ::getVoidTy (context), true );
1273+
1274+ auto fn = module.getOrInsertFunction (s_name, fnType, attrs);
1275+ ::llvm ::SmallString< 32 > newName;
1276+ for (unsigned i = 0 ; ! ::llvm ::isa< ::llvm ::Function> (fn.getCallee ()) ||
1277+ ::llvm ::cast< ::llvm ::Function> (fn.getCallee ())- > getFunctionType () ! = fn.getFunctionType (); i++ ) {
1278+ // If a function with the same name but a different types already exists,
1279+ // we get a bitcast of a function or a function with the wrong type.
1280+ // Try new names until we get one with the correct type.
1281+ newName = " " ;
1282+ ::llvm ::raw_svector_ostream newNameStream (newName);
1283+ newNameStream << s_name << " _" << i;
1284+ fn = module.getOrInsertFunction (newNameStream.str (), fnType, attrs);
1285+ }
1286+ assert (::llvm ::isa< ::llvm ::Function> (fn.getCallee ()));
1287+ assert (fn.getFunctionType () == fnType);
1288+ assert (::llvm ::cast< ::llvm ::Function> (fn.getCallee ())- > getFunctionType () == fn.getFunctionType ());
1289+
1290+ ::llvm ::SmallVector< ::llvm ::Value* , 1 > args = {
1291+ instName
1292+ };
1293+
1294+ return ::llvm ::cast< InstNameConflictOp> (b.CreateCall (fn, args, instName_0));
1295+ }
1296+
1297+
1298+ bool InstNameConflictOp ::verifier (::llvm ::raw_ostream & errs) {
1299+ ::llvm ::LLVMContext & context = getModule ()- > getContext ();
1300+ (void)context;
1301+
1302+ using ::llvm_dialects ::printable;
1303+
1304+ if (arg_size () ! = 1 ) {
1305+ errs << " wrong number of arguments: " << arg_size ()
1306+ << " , expected 1\n" ;
1307+ return false ;
1308+ }
1309+ ::llvm ::Type * const instNameType = getInstName ()- > getType ();
1310+ (void)instNameType;
1311+ return true ;
1312+ }
1313+
1314+
1315+ ::llvm ::Value * InstNameConflictOp ::getInstName () {
1316+ return getArgOperand (0 );
1317+ }
1318+
1319+ void InstNameConflictOp ::setInstName (::llvm ::Value * instName) {
1320+ setArgOperand (0 , instName);
1321+ }
1322+
1323+
1324+
1325+ const ::llvm ::StringLiteral InstNameConflictVarargsOp ::s_name{" xd.try.conflict.type.suffix" };
1326+
1327+ InstNameConflictVarargsOp* InstNameConflictVarargsOp ::create (llvm_dialects ::Builder& b, ::llvm ::ArrayRef< ::llvm ::Value * > instName_0, const llvm ::Twine & instName) {
1328+ ::llvm ::LLVMContext& context = b.getContext ();
1329+ (void)context;
1330+ ::llvm ::Module& module = * b.GetInsertBlock ()- > getModule ();
1331+
1332+
1333+ const ::llvm ::AttributeList attrs
1334+ = ExampleDialect ::get (context).getAttributeList (4 );
1335+ auto fnType = ::llvm ::FunctionType ::get (::llvm ::Type ::getVoidTy (context), true );
1336+
1337+ auto fn = module.getOrInsertFunction (s_name, fnType, attrs);
1338+ ::llvm ::SmallString< 32 > newName;
1339+ for (unsigned i = 0 ; ! ::llvm ::isa< ::llvm ::Function> (fn.getCallee ()) ||
1340+ ::llvm ::cast< ::llvm ::Function> (fn.getCallee ())- > getFunctionType () ! = fn.getFunctionType (); i++ ) {
1341+ // If a function with the same name but a different types already exists,
1342+ // we get a bitcast of a function or a function with the wrong type.
1343+ // Try new names until we get one with the correct type.
1344+ newName = " " ;
1345+ ::llvm ::raw_svector_ostream newNameStream (newName);
1346+ newNameStream << s_name << " _" << i;
1347+ fn = module.getOrInsertFunction (newNameStream.str (), fnType, attrs);
1348+ }
1349+ assert (::llvm ::isa< ::llvm ::Function> (fn.getCallee ()));
1350+ assert (fn.getFunctionType () == fnType);
1351+ assert (::llvm ::cast< ::llvm ::Function> (fn.getCallee ())- > getFunctionType () == fn.getFunctionType ());
1352+
1353+ ::llvm ::SmallVector< ::llvm ::Value* , 0 > args = {
1354+
1355+ };
1356+
1357+ args.append (instName_0.begin (), instName_0.end ());
1358+
1359+ return ::llvm ::cast< InstNameConflictVarargsOp> (b.CreateCall (fn, args, instName));
1360+ }
1361+
1362+
1363+ bool InstNameConflictVarargsOp ::verifier (::llvm ::raw_ostream & errs) {
1364+ ::llvm ::LLVMContext & context = getModule ()- > getContext ();
1365+ (void)context;
1366+
1367+ using ::llvm_dialects ::printable;
1368+
1369+ if (arg_size () < 0 ) {
1370+ errs << " wrong number of arguments: " << arg_size ()
1371+ << " , expected at least 0\n" ;
1372+ return false ;
1373+ }
1374+ return true ;
1375+ }
1376+
1377+
1378+ ::llvm ::iterator_range< ::llvm ::User ::value_op_iterator> InstNameConflictVarargsOp ::getInstName_0 () {
1379+ return ::llvm ::make_range (
1380+ value_op_iterator (arg_begin () + 0 ),
1381+ value_op_iterator (arg_end ()));
1382+ }
1383+
1384+
1385+
11691386 const ::llvm ::StringLiteral ReadOp ::s_name{" xd.read" };
11701387
11711388 ReadOp* ReadOp ::create (llvm_dialects ::Builder& b, ::llvm ::Type* dataType, const llvm ::Twine & instName) {
@@ -1891,6 +2108,30 @@ data
18912108 }
18922109
18932110
2111+ template <>
2112+ const ::llvm_dialects ::OpDescription &
2113+ ::llvm_dialects ::OpDescription ::get< xd ::InstNameConflictDoubleOp> () {
2114+ static const ::llvm_dialects ::OpDescription desc{false , " xd.try.conflict" };
2115+ return desc;
2116+ }
2117+
2118+
2119+ template <>
2120+ const ::llvm_dialects ::OpDescription &
2121+ ::llvm_dialects ::OpDescription ::get< xd ::InstNameConflictOp> () {
2122+ static const ::llvm_dialects ::OpDescription desc{false , " xd.try.conflict" };
2123+ return desc;
2124+ }
2125+
2126+
2127+ template <>
2128+ const ::llvm_dialects ::OpDescription &
2129+ ::llvm_dialects ::OpDescription ::get< xd ::InstNameConflictVarargsOp> () {
2130+ static const ::llvm_dialects ::OpDescription desc{false , " xd.try.conflict.type.suffix" };
2131+ return desc;
2132+ }
2133+
2134+
18942135 template <>
18952136 const ::llvm_dialects ::OpDescription &
18962137 ::llvm_dialects ::OpDescription ::get< xd ::ReadOp> () {
0 commit comments