From 6338bdaa756451430c915c7cf4e0db640c647d18 Mon Sep 17 00:00:00 2001 From: Thomas Symalla Date: Wed, 2 Oct 2024 13:57:15 +0200 Subject: [PATCH] Fix namespace issue in `isDialectOp` This is using the `cppNamespace`. Use the IR-level namespace instead. --- example/CMakeLists.txt | 4 +- example/ExampleDialect.td | 2 +- lib/TableGen/GenDialect.cpp | 2 +- test/example/generated/ExampleDialect.cpp.inc | 90 +++++++++---------- test/example/generated/ExampleDialect.h.inc | 48 +++++----- test/example/test-builder.test | 80 +++++++++-------- test/example/verifier-basic.ll | 26 +++--- test/example/visitor-basic.ll | 46 +++++----- test/example/visitor-rpot.ll | 20 ++--- 9 files changed, 160 insertions(+), 158 deletions(-) diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt index 2d34721..b2b6877 100644 --- a/example/CMakeLists.txt +++ b/example/CMakeLists.txt @@ -23,9 +23,9 @@ set(EXAMPLE_TABLEGEN_EXE llvm-dialects-tblgen) set(EXAMPLE_TABLEGEN_TARGET llvm-dialects-tblgen) set(LLVM_TARGET_DEFINITIONS ExampleDialect.td) -tablegen(EXAMPLE ExampleDialect.h.inc -gen-dialect-decls --dialect xd +tablegen(EXAMPLE ExampleDialect.h.inc -gen-dialect-decls --dialect xd.ir EXTRA_INCLUDES ${CMAKE_CURRENT_SOURCE_DIR}/../include) -tablegen(EXAMPLE ExampleDialect.cpp.inc -gen-dialect-defs --dialect xd +tablegen(EXAMPLE ExampleDialect.cpp.inc -gen-dialect-defs --dialect xd.ir EXTRA_INCLUDES ${CMAKE_CURRENT_SOURCE_DIR}/../include) add_public_tablegen_target(ExampleDialectTableGen) diff --git a/example/ExampleDialect.td b/example/ExampleDialect.td index 3bc6761..4455ac0 100644 --- a/example/ExampleDialect.td +++ b/example/ExampleDialect.td @@ -26,7 +26,7 @@ include "llvm-dialects/Dialect/Dialect.td" def ExampleDialect : Dialect { - let name = "xd"; + let name = "xd.ir"; let cppNamespace = "xd"; } diff --git a/lib/TableGen/GenDialect.cpp b/lib/TableGen/GenDialect.cpp index 262ba78..6e50cad 100644 --- a/lib/TableGen/GenDialect.cpp +++ b/lib/TableGen/GenDialect.cpp @@ -316,7 +316,7 @@ void llvm_dialects::genDialectDefs(raw_ostream& out, RecordKeeper& records) { } bool $Dialect::isDialectOp(::llvm::StringRef funcName) { - return funcName.starts_with("$namespace."); + return funcName.starts_with("$dialect."); } ::llvm_dialects::Dialect* $Dialect::make(::llvm::LLVMContext& context) { diff --git a/test/example/generated/ExampleDialect.cpp.inc b/test/example/generated/ExampleDialect.cpp.inc index 90cfbff..938f489 100644 --- a/test/example/generated/ExampleDialect.cpp.inc +++ b/test/example/generated/ExampleDialect.cpp.inc @@ -45,7 +45,7 @@ namespace xd { } bool ExampleDialect::isDialectOp(::llvm::StringRef funcName) { - return funcName.starts_with("xd."); + return funcName.starts_with("xd.ir."); } ::llvm_dialects::Dialect* ExampleDialect::make(::llvm::LLVMContext& context) { @@ -343,7 +343,7 @@ return true; setArgOperand(2, initial); } - const ::llvm::StringLiteral Add32Op::s_name{"xd.add32"}; + const ::llvm::StringLiteral Add32Op::s_name{"xd.ir.add32"}; Add32Op* Add32Op::create(llvm_dialects::Builder& b, ::llvm::Value * lhs, ::llvm::Value * rhs, uint32_t extra, const llvm::Twine &instName) { ::llvm::LLVMContext& context = b.getContext(); @@ -465,7 +465,7 @@ uint32_t const extra = getExtra(); - const ::llvm::StringLiteral CombineOp::s_name{"xd.combine"}; + const ::llvm::StringLiteral CombineOp::s_name{"xd.ir.combine"}; CombineOp* CombineOp::create(llvm_dialects::Builder& b, ::llvm::Value * lhs, ::llvm::Value * rhs, const llvm::Twine &instName) { ::llvm::LLVMContext& context = b.getContext(); @@ -560,7 +560,7 @@ rhs - const ::llvm::StringLiteral ExtractElementOp::s_name{"xd.extractelement"}; + const ::llvm::StringLiteral ExtractElementOp::s_name{"xd.ir.extractelement"}; ExtractElementOp* ExtractElementOp::create(llvm_dialects::Builder& b, ::llvm::Value * vector, ::llvm::Value * index, const llvm::Twine &instName) { ::llvm::LLVMContext& context = b.getContext(); @@ -664,7 +664,7 @@ index - const ::llvm::StringLiteral FromFixedVectorOp::s_name{"xd.fromfixedvector"}; + const ::llvm::StringLiteral FromFixedVectorOp::s_name{"xd.ir.fromfixedvector"}; FromFixedVectorOp* FromFixedVectorOp::create(llvm_dialects::Builder& b, ::llvm::Type* resultType, ::llvm::Value * source, const llvm::Twine &instName) { ::llvm::LLVMContext& context = b.getContext(); @@ -834,7 +834,7 @@ source - const ::llvm::StringLiteral HandleGetOp::s_name{"xd.handle.get"}; + const ::llvm::StringLiteral HandleGetOp::s_name{"xd.ir.handle.get"}; HandleGetOp* HandleGetOp::create(llvm_dialects::Builder& b, const llvm::Twine &instName) { ::llvm::LLVMContext& context = b.getContext(); @@ -896,7 +896,7 @@ source - const ::llvm::StringLiteral IExtOp::s_name{"xd.iext"}; + const ::llvm::StringLiteral IExtOp::s_name{"xd.ir.iext"}; IExtOp* IExtOp::create(llvm_dialects::Builder& b, ::llvm::Type* resultType, ::llvm::Value * source, const llvm::Twine &instName) { ::llvm::LLVMContext& context = b.getContext(); @@ -994,7 +994,7 @@ source - const ::llvm::StringLiteral ITruncOp::s_name{"xd.itrunc"}; + const ::llvm::StringLiteral ITruncOp::s_name{"xd.ir.itrunc"}; ITruncOp* ITruncOp::create(llvm_dialects::Builder& b, ::llvm::Type* resultType, ::llvm::Value * source, const llvm::Twine &instName) { ::llvm::LLVMContext& context = b.getContext(); @@ -1092,7 +1092,7 @@ source - const ::llvm::StringLiteral ImmutableOp::s_name{"xd.immutable.op"}; + const ::llvm::StringLiteral ImmutableOp::s_name{"xd.ir.immutable.op"}; ImmutableOp* ImmutableOp::create(llvm_dialects::Builder& b, bool val, const llvm::Twine &instName) { ::llvm::LLVMContext& context = b.getContext(); @@ -1161,7 +1161,7 @@ source - const ::llvm::StringLiteral InsertElementOp::s_name{"xd.insertelement"}; + const ::llvm::StringLiteral InsertElementOp::s_name{"xd.ir.insertelement"}; InsertElementOp* InsertElementOp::create(llvm_dialects::Builder& b, ::llvm::Value * vector, ::llvm::Value * value, ::llvm::Value * index, const llvm::Twine &instName) { ::llvm::LLVMContext& context = b.getContext(); @@ -1283,7 +1283,7 @@ index - const ::llvm::StringLiteral InstNameConflictDoubleOp::s_name{"xd.inst.name.conflict.double"}; + const ::llvm::StringLiteral InstNameConflictDoubleOp::s_name{"xd.ir.inst.name.conflict.double"}; InstNameConflictDoubleOp* InstNameConflictDoubleOp::create(llvm_dialects::Builder& b, ::llvm::Value * instName, ::llvm::Value * instName_0, const llvm::Twine &instName_1) { ::llvm::LLVMContext& context = b.getContext(); @@ -1367,7 +1367,7 @@ instName_0 - const ::llvm::StringLiteral InstNameConflictOp::s_name{"xd.inst.name.conflict"}; + const ::llvm::StringLiteral InstNameConflictOp::s_name{"xd.ir.inst.name.conflict"}; InstNameConflictOp* InstNameConflictOp::create(llvm_dialects::Builder& b, ::llvm::Value * instName, const llvm::Twine &instName_0) { ::llvm::LLVMContext& context = b.getContext(); @@ -1441,7 +1441,7 @@ instName - const ::llvm::StringLiteral InstNameConflictVarargsOp::s_name{"xd.inst.name.conflict.varargs"}; + const ::llvm::StringLiteral InstNameConflictVarargsOp::s_name{"xd.ir.inst.name.conflict.varargs"}; InstNameConflictVarargsOp* InstNameConflictVarargsOp::create(llvm_dialects::Builder& b, ::llvm::ArrayRef<::llvm::Value *> instName_0, const llvm::Twine &instName) { ::llvm::LLVMContext& context = b.getContext(); @@ -1519,7 +1519,7 @@ instName - const ::llvm::StringLiteral ReadOp::s_name{"xd.read"}; + const ::llvm::StringLiteral ReadOp::s_name{"xd.ir.read"}; ReadOp* ReadOp::create(llvm_dialects::Builder& b, ::llvm::Type* dataType, const llvm::Twine &instName) { ::llvm::LLVMContext& context = b.getContext(); @@ -1576,7 +1576,7 @@ instName - const ::llvm::StringLiteral SetReadOp::s_name{"xd.set.read"}; + const ::llvm::StringLiteral SetReadOp::s_name{"xd.ir.set.read"}; SetReadOp* SetReadOp::create(llvm_dialects::Builder& b, ::llvm::Type* dataType, const llvm::Twine &instName) { ::llvm::LLVMContext& context = b.getContext(); @@ -1633,7 +1633,7 @@ instName - const ::llvm::StringLiteral SetWriteOp::s_name{"xd.set.write"}; + const ::llvm::StringLiteral SetWriteOp::s_name{"xd.ir.set.write"}; SetWriteOp* SetWriteOp::create(llvm_dialects::Builder& b, ::llvm::Value * data, const llvm::Twine &instName) { ::llvm::LLVMContext& context = b.getContext(); @@ -1696,7 +1696,7 @@ data - const ::llvm::StringLiteral SizeOfOp::s_name{"xd.sizeof"}; + const ::llvm::StringLiteral SizeOfOp::s_name{"xd.ir.sizeof"}; SizeOfOp* SizeOfOp::create(llvm_dialects::Builder& b, ::llvm::Type * sizeofType, const llvm::Twine &instName) { ::llvm::LLVMContext& context = b.getContext(); @@ -1770,7 +1770,7 @@ data - const ::llvm::StringLiteral StreamAddOp::s_name{"xd.stream.add"}; + const ::llvm::StringLiteral StreamAddOp::s_name{"xd.ir.stream.add"}; StreamAddOp* StreamAddOp::create(llvm_dialects::Builder& b, ::llvm::Value * ptr, ::llvm::Value * count, ::llvm::Value * initial, const llvm::Twine &instName) { ::llvm::LLVMContext& context = b.getContext(); @@ -1862,7 +1862,7 @@ initial - const ::llvm::StringLiteral StreamMaxOp::s_name{"xd.stream.max"}; + const ::llvm::StringLiteral StreamMaxOp::s_name{"xd.ir.stream.max"}; StreamMaxOp* StreamMaxOp::create(llvm_dialects::Builder& b, ::llvm::Value * ptr, ::llvm::Value * count, ::llvm::Value * initial, const llvm::Twine &instName) { ::llvm::LLVMContext& context = b.getContext(); @@ -1954,7 +1954,7 @@ initial - const ::llvm::StringLiteral StreamMinOp::s_name{"xd.stream.min"}; + const ::llvm::StringLiteral StreamMinOp::s_name{"xd.ir.stream.min"}; StreamMinOp* StreamMinOp::create(llvm_dialects::Builder& b, ::llvm::Value * ptr, ::llvm::Value * count, ::llvm::Value * initial, const llvm::Twine &instName) { ::llvm::LLVMContext& context = b.getContext(); @@ -2046,7 +2046,7 @@ initial - const ::llvm::StringLiteral StringAttrOp::s_name{"xd.string.attr.op"}; + const ::llvm::StringLiteral StringAttrOp::s_name{"xd.ir.string.attr.op"}; StringAttrOp* StringAttrOp::create(llvm_dialects::Builder& b, ::llvm::StringRef val, const llvm::Twine &instName) { ::llvm::LLVMContext& context = b.getContext(); @@ -2115,7 +2115,7 @@ initial - const ::llvm::StringLiteral WriteOp::s_name{"xd.write"}; + const ::llvm::StringLiteral WriteOp::s_name{"xd.ir.write"}; WriteOp* WriteOp::create(llvm_dialects::Builder& b, ::llvm::Value * data, const llvm::Twine &instName) { ::llvm::LLVMContext& context = b.getContext(); @@ -2178,7 +2178,7 @@ data - const ::llvm::StringLiteral WriteVarArgOp::s_name{"xd.write.vararg"}; + const ::llvm::StringLiteral WriteVarArgOp::s_name{"xd.ir.write.vararg"}; WriteVarArgOp* WriteVarArgOp::create(llvm_dialects::Builder& b, ::llvm::Value * data, ::llvm::ArrayRef<::llvm::Value *> args, const llvm::Twine &instName) { ::llvm::LLVMContext& context = b.getContext(); @@ -2264,7 +2264,7 @@ data template <> const ::llvm_dialects::OpDescription & ::llvm_dialects::OpDescription::get() { - static const ::llvm_dialects::OpDescription desc{false, "xd.add32"}; + static const ::llvm_dialects::OpDescription desc{false, "xd.ir.add32"}; return desc; } @@ -2272,7 +2272,7 @@ data template <> const ::llvm_dialects::OpDescription & ::llvm_dialects::OpDescription::get() { - static const ::llvm_dialects::OpDescription desc{true, "xd.combine"}; + static const ::llvm_dialects::OpDescription desc{true, "xd.ir.combine"}; return desc; } @@ -2280,7 +2280,7 @@ data template <> const ::llvm_dialects::OpDescription & ::llvm_dialects::OpDescription::get() { - static const ::llvm_dialects::OpDescription desc{true, "xd.extractelement"}; + static const ::llvm_dialects::OpDescription desc{true, "xd.ir.extractelement"}; return desc; } @@ -2288,7 +2288,7 @@ data template <> const ::llvm_dialects::OpDescription & ::llvm_dialects::OpDescription::get() { - static const ::llvm_dialects::OpDescription desc{true, "xd.fromfixedvector"}; + static const ::llvm_dialects::OpDescription desc{true, "xd.ir.fromfixedvector"}; return desc; } @@ -2296,7 +2296,7 @@ data template <> const ::llvm_dialects::OpDescription & ::llvm_dialects::OpDescription::get() { - static const ::llvm_dialects::OpDescription desc{false, "xd.handle.get"}; + static const ::llvm_dialects::OpDescription desc{false, "xd.ir.handle.get"}; return desc; } @@ -2304,7 +2304,7 @@ data template <> const ::llvm_dialects::OpDescription & ::llvm_dialects::OpDescription::get() { - static const ::llvm_dialects::OpDescription desc{true, "xd.iext"}; + static const ::llvm_dialects::OpDescription desc{true, "xd.ir.iext"}; return desc; } @@ -2312,7 +2312,7 @@ data template <> const ::llvm_dialects::OpDescription & ::llvm_dialects::OpDescription::get() { - static const ::llvm_dialects::OpDescription desc{true, "xd.itrunc"}; + static const ::llvm_dialects::OpDescription desc{true, "xd.ir.itrunc"}; return desc; } @@ -2320,7 +2320,7 @@ data template <> const ::llvm_dialects::OpDescription & ::llvm_dialects::OpDescription::get() { - static const ::llvm_dialects::OpDescription desc{false, "xd.immutable.op"}; + static const ::llvm_dialects::OpDescription desc{false, "xd.ir.immutable.op"}; return desc; } @@ -2328,7 +2328,7 @@ data template <> const ::llvm_dialects::OpDescription & ::llvm_dialects::OpDescription::get() { - static const ::llvm_dialects::OpDescription desc{true, "xd.insertelement"}; + static const ::llvm_dialects::OpDescription desc{true, "xd.ir.insertelement"}; return desc; } @@ -2336,7 +2336,7 @@ data template <> const ::llvm_dialects::OpDescription & ::llvm_dialects::OpDescription::get() { - static const ::llvm_dialects::OpDescription desc{false, "xd.inst.name.conflict.double"}; + static const ::llvm_dialects::OpDescription desc{false, "xd.ir.inst.name.conflict.double"}; return desc; } @@ -2344,7 +2344,7 @@ data template <> const ::llvm_dialects::OpDescription & ::llvm_dialects::OpDescription::get() { - static const ::llvm_dialects::OpDescription desc{false, "xd.inst.name.conflict"}; + static const ::llvm_dialects::OpDescription desc{false, "xd.ir.inst.name.conflict"}; return desc; } @@ -2352,7 +2352,7 @@ data template <> const ::llvm_dialects::OpDescription & ::llvm_dialects::OpDescription::get() { - static const ::llvm_dialects::OpDescription desc{false, "xd.inst.name.conflict.varargs"}; + static const ::llvm_dialects::OpDescription desc{false, "xd.ir.inst.name.conflict.varargs"}; return desc; } @@ -2360,7 +2360,7 @@ data template <> const ::llvm_dialects::OpDescription & ::llvm_dialects::OpDescription::get() { - static const ::llvm_dialects::OpDescription desc{true, "xd.read"}; + static const ::llvm_dialects::OpDescription desc{true, "xd.ir.read"}; return desc; } @@ -2368,7 +2368,7 @@ data template <> const ::llvm_dialects::OpDescription & ::llvm_dialects::OpDescription::get() { - static const ::llvm_dialects::OpDescription desc{true, "xd.set.read"}; + static const ::llvm_dialects::OpDescription desc{true, "xd.ir.set.read"}; return desc; } @@ -2376,7 +2376,7 @@ data template <> const ::llvm_dialects::OpDescription & ::llvm_dialects::OpDescription::get() { - static const ::llvm_dialects::OpDescription desc{false, "xd.set.write"}; + static const ::llvm_dialects::OpDescription desc{false, "xd.ir.set.write"}; return desc; } @@ -2384,7 +2384,7 @@ data template <> const ::llvm_dialects::OpDescription & ::llvm_dialects::OpDescription::get() { - static const ::llvm_dialects::OpDescription desc{false, "xd.sizeof"}; + static const ::llvm_dialects::OpDescription desc{false, "xd.ir.sizeof"}; return desc; } @@ -2392,7 +2392,7 @@ data template <> const ::llvm_dialects::OpDescription & ::llvm_dialects::OpDescription::get() { - static const ::llvm_dialects::OpDescription desc{true, "xd.stream.add"}; + static const ::llvm_dialects::OpDescription desc{true, "xd.ir.stream.add"}; return desc; } @@ -2400,7 +2400,7 @@ data template <> const ::llvm_dialects::OpDescription & ::llvm_dialects::OpDescription::get() { - static const ::llvm_dialects::OpDescription desc{true, "xd.stream.max"}; + static const ::llvm_dialects::OpDescription desc{true, "xd.ir.stream.max"}; return desc; } @@ -2408,7 +2408,7 @@ data template <> const ::llvm_dialects::OpDescription & ::llvm_dialects::OpDescription::get() { - static const ::llvm_dialects::OpDescription desc{true, "xd.stream.min"}; + static const ::llvm_dialects::OpDescription desc{true, "xd.ir.stream.min"}; return desc; } @@ -2416,7 +2416,7 @@ data template <> const ::llvm_dialects::OpDescription & ::llvm_dialects::OpDescription::get() { - static const ::llvm_dialects::OpDescription desc{false, "xd.string.attr.op"}; + static const ::llvm_dialects::OpDescription desc{false, "xd.ir.string.attr.op"}; return desc; } @@ -2424,7 +2424,7 @@ data template <> const ::llvm_dialects::OpDescription & ::llvm_dialects::OpDescription::get() { - static const ::llvm_dialects::OpDescription desc{false, "xd.write"}; + static const ::llvm_dialects::OpDescription desc{false, "xd.ir.write"}; return desc; } @@ -2432,7 +2432,7 @@ data template <> const ::llvm_dialects::OpDescription & ::llvm_dialects::OpDescription::get() { - static const ::llvm_dialects::OpDescription desc{false, "xd.write.vararg"}; + static const ::llvm_dialects::OpDescription desc{false, "xd.ir.write.vararg"}; return desc; } diff --git a/test/example/generated/ExampleDialect.h.inc b/test/example/generated/ExampleDialect.h.inc index 3198f89..b296d9b 100644 --- a/test/example/generated/ExampleDialect.h.inc +++ b/test/example/generated/ExampleDialect.h.inc @@ -51,7 +51,7 @@ namespace xd { }; class XdHandleType : public ::llvm::TargetExtType { - static constexpr ::llvm::StringLiteral s_name{"xd.handle"}; + static constexpr ::llvm::StringLiteral s_name{"xd.ir.handle"}; public: static bool classof(const ::llvm::TargetExtType *t) { @@ -70,7 +70,7 @@ namespace xd { class XdVectorType : public ::llvm::TargetExtType { - static constexpr ::llvm::StringLiteral s_name{"xd.vector"}; + static constexpr ::llvm::StringLiteral s_name{"xd.ir.vector"}; public: static bool classof(const ::llvm::TargetExtType *t) { @@ -108,7 +108,7 @@ uint32_t getNumElements() const; }; class Add32Op : public ::llvm::CallInst { - static const ::llvm::StringLiteral s_name; //{"xd.add32"}; + static const ::llvm::StringLiteral s_name; //{"xd.ir.add32"}; public: static bool classof(const ::llvm::CallInst* i) { @@ -135,7 +135,7 @@ bool verifier(::llvm::raw_ostream &errs); }; class CombineOp : public ::llvm::CallInst { - static const ::llvm::StringLiteral s_name; //{"xd.combine"}; + static const ::llvm::StringLiteral s_name; //{"xd.ir.combine"}; public: static bool classof(const ::llvm::CallInst* i) { @@ -160,7 +160,7 @@ bool verifier(::llvm::raw_ostream &errs); }; class ExtractElementOp : public ::llvm::CallInst { - static const ::llvm::StringLiteral s_name; //{"xd.extractelement"}; + static const ::llvm::StringLiteral s_name; //{"xd.ir.extractelement"}; public: static bool classof(const ::llvm::CallInst* i) { @@ -185,7 +185,7 @@ bool verifier(::llvm::raw_ostream &errs); }; class FromFixedVectorOp : public ::llvm::CallInst { - static const ::llvm::StringLiteral s_name; //{"xd.fromfixedvector"}; + static const ::llvm::StringLiteral s_name; //{"xd.ir.fromfixedvector"}; public: static bool classof(const ::llvm::CallInst* i) { @@ -208,7 +208,7 @@ bool verifier(::llvm::raw_ostream &errs); }; class HandleGetOp : public ::llvm::CallInst { - static const ::llvm::StringLiteral s_name; //{"xd.handle.get"}; + static const ::llvm::StringLiteral s_name; //{"xd.ir.handle.get"}; public: static bool classof(const ::llvm::CallInst* i) { @@ -229,7 +229,7 @@ bool verifier(::llvm::raw_ostream &errs); }; class IExtOp : public ::llvm::CallInst { - static const ::llvm::StringLiteral s_name; //{"xd.iext"}; + static const ::llvm::StringLiteral s_name; //{"xd.ir.iext"}; public: static bool classof(const ::llvm::CallInst* i) { @@ -252,7 +252,7 @@ bool verifier(::llvm::raw_ostream &errs); }; class ITruncOp : public ::llvm::CallInst { - static const ::llvm::StringLiteral s_name; //{"xd.itrunc"}; + static const ::llvm::StringLiteral s_name; //{"xd.ir.itrunc"}; public: static bool classof(const ::llvm::CallInst* i) { @@ -275,7 +275,7 @@ bool verifier(::llvm::raw_ostream &errs); }; class ImmutableOp : public ::llvm::CallInst { - static const ::llvm::StringLiteral s_name; //{"xd.immutable.op"}; + static const ::llvm::StringLiteral s_name; //{"xd.ir.immutable.op"}; public: static bool classof(const ::llvm::CallInst* i) { @@ -295,7 +295,7 @@ bool getVal() const; }; class InsertElementOp : public ::llvm::CallInst { - static const ::llvm::StringLiteral s_name; //{"xd.insertelement"}; + static const ::llvm::StringLiteral s_name; //{"xd.ir.insertelement"}; public: static bool classof(const ::llvm::CallInst* i) { @@ -322,7 +322,7 @@ bool verifier(::llvm::raw_ostream &errs); }; class InstNameConflictDoubleOp : public ::llvm::CallInst { - static const ::llvm::StringLiteral s_name; //{"xd.inst.name.conflict.double"}; + static const ::llvm::StringLiteral s_name; //{"xd.ir.inst.name.conflict.double"}; public: static bool classof(const ::llvm::CallInst* i) { @@ -347,7 +347,7 @@ bool verifier(::llvm::raw_ostream &errs); }; class InstNameConflictOp : public ::llvm::CallInst { - static const ::llvm::StringLiteral s_name; //{"xd.inst.name.conflict"}; + static const ::llvm::StringLiteral s_name; //{"xd.ir.inst.name.conflict"}; public: static bool classof(const ::llvm::CallInst* i) { @@ -370,7 +370,7 @@ bool verifier(::llvm::raw_ostream &errs); }; class InstNameConflictVarargsOp : public ::llvm::CallInst { - static const ::llvm::StringLiteral s_name; //{"xd.inst.name.conflict.varargs"}; + static const ::llvm::StringLiteral s_name; //{"xd.ir.inst.name.conflict.varargs"}; public: static bool classof(const ::llvm::CallInst* i) { @@ -395,7 +395,7 @@ bool verifier(::llvm::raw_ostream &errs); }; class ReadOp : public ::llvm::CallInst { - static const ::llvm::StringLiteral s_name; //{"xd.read"}; + static const ::llvm::StringLiteral s_name; //{"xd.ir.read"}; public: static bool classof(const ::llvm::CallInst* i) { @@ -416,7 +416,7 @@ bool verifier(::llvm::raw_ostream &errs); }; class SetReadOp : public ::llvm::CallInst { - static const ::llvm::StringLiteral s_name; //{"xd.set.read"}; + static const ::llvm::StringLiteral s_name; //{"xd.ir.set.read"}; public: static bool classof(const ::llvm::CallInst* i) { @@ -437,7 +437,7 @@ bool verifier(::llvm::raw_ostream &errs); }; class SetWriteOp : public ::llvm::CallInst { - static const ::llvm::StringLiteral s_name; //{"xd.set.write"}; + static const ::llvm::StringLiteral s_name; //{"xd.ir.set.write"}; public: static bool classof(const ::llvm::CallInst* i) { @@ -459,7 +459,7 @@ bool verifier(::llvm::raw_ostream &errs); }; class SizeOfOp : public ::llvm::CallInst { - static const ::llvm::StringLiteral s_name; //{"xd.sizeof"}; + static const ::llvm::StringLiteral s_name; //{"xd.ir.sizeof"}; public: static bool classof(const ::llvm::CallInst* i) { @@ -482,7 +482,7 @@ bool verifier(::llvm::raw_ostream &errs); }; class StreamAddOp : public StreamReduceOp { - static const ::llvm::StringLiteral s_name; //{"xd.stream.add"}; + static const ::llvm::StringLiteral s_name; //{"xd.ir.stream.add"}; public: static bool classof(const ::llvm::CallInst* i) { @@ -503,7 +503,7 @@ bool verifier(::llvm::raw_ostream &errs); }; class StreamMaxOp : public StreamReduceOp { - static const ::llvm::StringLiteral s_name; //{"xd.stream.max"}; + static const ::llvm::StringLiteral s_name; //{"xd.ir.stream.max"}; public: static bool classof(const ::llvm::CallInst* i) { @@ -524,7 +524,7 @@ bool verifier(::llvm::raw_ostream &errs); }; class StreamMinOp : public StreamReduceOp { - static const ::llvm::StringLiteral s_name; //{"xd.stream.min"}; + static const ::llvm::StringLiteral s_name; //{"xd.ir.stream.min"}; public: static bool classof(const ::llvm::CallInst* i) { @@ -545,7 +545,7 @@ bool verifier(::llvm::raw_ostream &errs); }; class StringAttrOp : public ::llvm::CallInst { - static const ::llvm::StringLiteral s_name; //{"xd.string.attr.op"}; + static const ::llvm::StringLiteral s_name; //{"xd.ir.string.attr.op"}; public: static bool classof(const ::llvm::CallInst* i) { @@ -565,7 +565,7 @@ bool verifier(::llvm::raw_ostream &errs); }; class WriteOp : public ::llvm::CallInst { - static const ::llvm::StringLiteral s_name; //{"xd.write"}; + static const ::llvm::StringLiteral s_name; //{"xd.ir.write"}; public: static bool classof(const ::llvm::CallInst* i) { @@ -587,7 +587,7 @@ bool verifier(::llvm::raw_ostream &errs); }; class WriteVarArgOp : public ::llvm::CallInst { - static const ::llvm::StringLiteral s_name; //{"xd.write.vararg"}; + static const ::llvm::StringLiteral s_name; //{"xd.ir.write.vararg"}; public: static bool classof(const ::llvm::CallInst* i) { diff --git a/test/example/test-builder.test b/test/example/test-builder.test index 96603b4..df4c6c4 100644 --- a/test/example/test-builder.test +++ b/test/example/test-builder.test @@ -7,46 +7,46 @@ ;. ; CHECK-LABEL: @example( ; CHECK-NEXT: entry: -; CHECK-NEXT: [[TMP0:%.*]] = call i32 @xd.read__i32() -; CHECK-NEXT: [[TMP1:%.*]] = call i64 (...) @xd.sizeof(double poison) -; CHECK-NEXT: [[TMP2:%.*]] = call i32 (...) @xd.itrunc__i32(i64 [[TMP1]]) -; CHECK-NEXT: [[TMP3:%.*]] = call i32 @xd.add32(i32 [[TMP0]], i32 [[TMP2]], i32 7) -; CHECK-NEXT: [[TMP4:%.*]] = call i32 (...) @xd.combine__i32(i32 [[TMP3]], i32 [[TMP0]]) -; CHECK-NEXT: [[TMP5:%.*]] = call i64 (...) @xd.iext__i64(i32 [[TMP4]]) -; CHECK-NEXT: call void (...) @xd.write(i64 [[TMP5]]) -; CHECK-NEXT: [[TMP6:%.*]] = call <2 x i32> @xd.read__v2i32() -; CHECK-NEXT: [[TMP7:%.*]] = call target("xd.vector", i32, 1, 2) (...) @xd.fromfixedvector__txd.vector_i32_1_2t(<2 x i32> [[TMP6]]) -; CHECK-NEXT: [[TMP8:%.*]] = call target("xd.vector", i32, 1, 4) @xd.read__txd.vector_i32_1_4t() -; CHECK-NEXT: [[TMP9:%.*]] = call i32 (...) @xd.extractelement__i32(target("xd.vector", i32, 1, 4) [[TMP8]], i32 [[TMP0]]) -; CHECK-NEXT: [[TMP10:%.*]] = call i32 (...) @xd.extractelement__i32(target("xd.vector", i32, 1, 4) [[TMP8]], i32 2) +; CHECK-NEXT: [[TMP0:%.*]] = call i32 @xd.ir.read__i32() +; CHECK-NEXT: [[TMP1:%.*]] = call i64 (...) @xd.ir.sizeof(double poison) +; CHECK-NEXT: [[TMP2:%.*]] = call i32 (...) @xd.ir.itrunc__i32(i64 [[TMP1]]) +; CHECK-NEXT: [[TMP3:%.*]] = call i32 @xd.ir.add32(i32 [[TMP0]], i32 [[TMP2]], i32 7) +; CHECK-NEXT: [[TMP4:%.*]] = call i32 (...) @xd.ir.combine__i32(i32 [[TMP3]], i32 [[TMP0]]) +; CHECK-NEXT: [[TMP5:%.*]] = call i64 (...) @xd.ir.iext__i64(i32 [[TMP4]]) +; CHECK-NEXT: call void (...) @xd.ir.write(i64 [[TMP5]]) +; CHECK-NEXT: [[TMP6:%.*]] = call <2 x i32> @xd.ir.read__v2i32() +; CHECK-NEXT: [[TMP7:%.*]] = call target("xd.ir.vector", i32, 1, 2) (...) @xd.ir.fromfixedvector__txd.ir.vector_i32_1_2t(<2 x i32> [[TMP6]]) +; CHECK-NEXT: [[TMP8:%.*]] = call target("xd.ir.vector", i32, 1, 4) @xd.ir.read__txd.ir.vector_i32_1_4t() +; CHECK-NEXT: [[TMP9:%.*]] = call i32 (...) @xd.ir.extractelement__i32(target("xd.ir.vector", i32, 1, 4) [[TMP8]], i32 [[TMP0]]) +; CHECK-NEXT: [[TMP10:%.*]] = call i32 (...) @xd.ir.extractelement__i32(target("xd.ir.vector", i32, 1, 4) [[TMP8]], i32 2) ; CHECK-NEXT: [[TMP11:%.*]] = add i32 [[TMP9]], [[TMP10]] -; CHECK-NEXT: [[TMP12:%.*]] = call target("xd.vector", i32, 1, 2) (...) @xd.insertelement__txd.vector_i32_1_2t(target("xd.vector", i32, 1, 2) [[TMP7]], i32 [[TMP11]], i32 [[TMP0]]) -; CHECK-NEXT: [[TMP13:%.*]] = call target("xd.vector", i32, 1, 2) (...) @xd.insertelement__txd.vector_i32_1_2t(target("xd.vector", i32, 1, 2) [[TMP12]], i32 [[TMP9]], i32 1) -; CHECK-NEXT: call void (...) @xd.write(target("xd.vector", i32, 1, 2) [[TMP13]]) -; CHECK-NEXT: [[P1:%.*]] = call ptr @xd.read__p0() -; CHECK-NEXT: [[P2:%.*]] = call i8 (...) @xd.stream.add__i8(ptr [[P1]], i64 14, i8 0) -; CHECK-NEXT: call void (...) @xd.write(i8 [[P2]]) -; CHECK-NEXT: call void (...) @xd.write.vararg(i8 [[P2]], ptr [[P1]], i8 [[P2]]) -; CHECK-NEXT: [[TMP14:%.*]] = call target("xd.handle") @xd.handle.get() -; CHECK-NEXT: call void (...) @xd.write.vararg(i8 [[P2]], ptr [[P1]], i8 [[P2]], i8 [[P2]]), !testMd !{{.*}} -; CHECK-NEXT: [[TMP15:%.*]] = call <2 x i32> @xd.set.read__v2i32() -; CHECK-NEXT: call void (...) @xd.set.write(target("xd.vector", i32, 1, 2) [[TMP13]]) -; CHECK-NEXT: [[TMP16:%.*]] = call [[TMP0]] @xd.read__s_s() -; CHECK-NEXT: [[TMP17:%.*]] = call [[TMP1]] @xd.read__s_s_0() -; CHECK-NEXT: [[TMP18:%.*]] = call [[TMP2]] @xd.read__s_s_1() -; CHECK-NEXT: call void (...) @xd.write([[TMP0]] [[TMP16]]) -; CHECK-NEXT: call void (...) @xd.write([[TMP1]] [[TMP17]]) -; CHECK-NEXT: call void (...) @xd.write([[TMP2]] [[TMP18]]) -; CHECK-NEXT: [[NAME_OF_LLVM_VALUE:%.*]] = call target("xd.handle") @xd.handle.get() -; CHECK-NEXT: [[TMP19:%.*]] = call i32 (...) @xd.inst.name.conflict(i32 1) -; CHECK-NEXT: [[NAME_FOO:%.*]] = call i32 (...) @xd.inst.name.conflict(i32 1) -; CHECK-NEXT: [[TMP20:%.*]] = call i32 (...) @xd.inst.name.conflict.double(i32 1, i32 2) -; CHECK-NEXT: [[BAR:%.*]] = call i32 (...) @xd.inst.name.conflict.double(i32 1, i32 2) -; CHECK-NEXT: [[TMP21:%.*]] = call i32 (...) @xd.inst.name.conflict.varargs(ptr [[P1]], i8 [[P2]]) -; CHECK-NEXT: [[TWO_VARARGS:%.*]] = call i32 (...) @xd.inst.name.conflict.varargs(ptr [[P1]], i8 [[P2]]) -; CHECK-NEXT: [[THREE_VARARGS:%.*]] = call i32 (...) @xd.inst.name.conflict.varargs(ptr [[P1]], i8 [[P2]], i32 3) -; CHECK-NEXT: [[FOUR_VARARGS:%.*]] = call i32 (...) @xd.inst.name.conflict.varargs(ptr [[P1]], i8 [[P2]], i32 3, i32 4) -; CHECK-NEXT: call void @xd.string.attr.op(ptr @str) +; CHECK-NEXT: [[TMP12:%.*]] = call target("xd.ir.vector", i32, 1, 2) (...) @xd.ir.insertelement__txd.ir.vector_i32_1_2t(target("xd.ir.vector", i32, 1, 2) [[TMP7]], i32 [[TMP11]], i32 [[TMP0]]) +; CHECK-NEXT: [[TMP13:%.*]] = call target("xd.ir.vector", i32, 1, 2) (...) @xd.ir.insertelement__txd.ir.vector_i32_1_2t(target("xd.ir.vector", i32, 1, 2) [[TMP12]], i32 [[TMP9]], i32 1) +; CHECK-NEXT: call void (...) @xd.ir.write(target("xd.ir.vector", i32, 1, 2) [[TMP13]]) +; CHECK-NEXT: [[P1:%.*]] = call ptr @xd.ir.read__p0() +; CHECK-NEXT: [[P2:%.*]] = call i8 (...) @xd.ir.stream.add__i8(ptr [[P1]], i64 14, i8 0) +; CHECK-NEXT: call void (...) @xd.ir.write(i8 [[P2]]) +; CHECK-NEXT: call void (...) @xd.ir.write.vararg(i8 [[P2]], ptr [[P1]], i8 [[P2]]) +; CHECK-NEXT: [[TMP14:%.*]] = call target("xd.ir.handle") @xd.ir.handle.get() +; CHECK-NEXT: call void (...) @xd.ir.write.vararg(i8 [[P2]], ptr [[P1]], i8 [[P2]], i8 [[P2]]), !testMd [[META0:![0-9]+]] +; CHECK-NEXT: [[TMP15:%.*]] = call <2 x i32> @xd.ir.set.read__v2i32() +; CHECK-NEXT: call void (...) @xd.ir.set.write(target("xd.ir.vector", i32, 1, 2) [[TMP13]]) +; CHECK-NEXT: [[TMP16:%.*]] = call [[TMP0]] @[[XD_IR_READ__S_S:[a-zA-Z0-9_$\"\\.-]*[a-zA-Z_$\"\\.-][a-zA-Z0-9_$\"\\.-]*]]() +; CHECK-NEXT: [[TMP17:%.*]] = call [[TMP1]] @[[XD_IR_READ__S_S_0:[a-zA-Z0-9_$\"\\.-]*[a-zA-Z_$\"\\.-][a-zA-Z0-9_$\"\\.-]*]]() +; CHECK-NEXT: [[TMP18:%.*]] = call [[TMP2]] @[[XD_IR_READ__S_S_1:[a-zA-Z0-9_$\"\\.-]*[a-zA-Z_$\"\\.-][a-zA-Z0-9_$\"\\.-]*]]() +; CHECK-NEXT: call void (...) @xd.ir.write([[TMP0]] [[TMP16]]) +; CHECK-NEXT: call void (...) @xd.ir.write([[TMP1]] [[TMP17]]) +; CHECK-NEXT: call void (...) @xd.ir.write([[TMP2]] [[TMP18]]) +; CHECK-NEXT: [[NAME_OF_LLVM_VALUE:%.*]] = call target("xd.ir.handle") @xd.ir.handle.get() +; CHECK-NEXT: [[TMP19:%.*]] = call i32 (...) @xd.ir.inst.name.conflict(i32 1) +; CHECK-NEXT: [[NAME_FOO:%.*]] = call i32 (...) @xd.ir.inst.name.conflict(i32 1) +; CHECK-NEXT: [[TMP20:%.*]] = call i32 (...) @xd.ir.inst.name.conflict.double(i32 1, i32 2) +; CHECK-NEXT: [[BAR:%.*]] = call i32 (...) @xd.ir.inst.name.conflict.double(i32 1, i32 2) +; CHECK-NEXT: [[TMP21:%.*]] = call i32 (...) @xd.ir.inst.name.conflict.varargs(ptr [[P1]], i8 [[P2]]) +; CHECK-NEXT: [[TWO_VARARGS:%.*]] = call i32 (...) @xd.ir.inst.name.conflict.varargs(ptr [[P1]], i8 [[P2]]) +; CHECK-NEXT: [[THREE_VARARGS:%.*]] = call i32 (...) @xd.ir.inst.name.conflict.varargs(ptr [[P1]], i8 [[P2]], i32 3) +; CHECK-NEXT: [[FOUR_VARARGS:%.*]] = call i32 (...) @xd.ir.inst.name.conflict.varargs(ptr [[P1]], i8 [[P2]], i32 3, i32 4) +; CHECK-NEXT: call void @xd.ir.string.attr.op(ptr @str) ; CHECK-NEXT: ret void ; ;. @@ -56,3 +56,5 @@ ; CHECK: attributes #[[ATTR3:[0-9]+]] = { nounwind willreturn memory(read) } ; CHECK: attributes #[[ATTR4:[0-9]+]] = { willreturn } ;. +; CHECK: [[META0]] = !{i32 1} +;. diff --git a/test/example/verifier-basic.ll b/test/example/verifier-basic.ll index d5407fc..261cdbd 100644 --- a/test/example/verifier-basic.ll +++ b/test/example/verifier-basic.ll @@ -6,35 +6,35 @@ entry: ; CHECK: unexpected value of $result: ; CHECK: expected: i64 ; CHECK: actual: i32 - %sizeof1 = call i32 (...) @xd.sizeof(<10 x i32> poison) + %sizeof1 = call i32 (...) @xd.ir.sizeof(<10 x i32> poison) ; CHECK-LABEL: Verifier error in: %trunc1 = ; CHECK: failed check for (le ?:$result_width, ?:$source_width) ; CHECK: with $result_width = 64 ; CHECK: with $source_width = 32 - %trunc1 = call i64 (...) @xd.itrunc__i64(i32 %sizeof1) + %trunc1 = call i64 (...) @xd.ir.itrunc__i64(i32 %sizeof1) ; CHECK-LABEL: Verifier error in: %fromfixedvector1 = ; CHECK: unexpected value of $scalar_type: ; CHECK: expected: i32 ; CHECK: actual: i64 - %fromfixedvector1 = call target("xd.vector", i32, 0, 2) (...) @xd.fromfixedvector__txd.vector_i32_0_2t(<2 x i64> poison) + %fromfixedvector1 = call target("xd.ir.vector", i32, 0, 2) (...) @xd.ir.fromfixedvector__txd.vector_i32_0_2t(<2 x i64> poison) ; CHECK-LABEL: Verifier error in: %fromfixedvector2 = ; CHECK: unexpected value of $num_elements: ; CHECK: expected: 2 ; CHECK: actual: 4 - %fromfixedvector2 = call target("xd.vector", i32, 0, 2) (...) @xd.fromfixedvector__txd.vector_i32_0_2t(<4 x i32> poison) + %fromfixedvector2 = call target("xd.ir.vector", i32, 0, 2) (...) @xd.ir.fromfixedvector__txd.vector_i32_0_2t(<4 x i32> poison) ; CHECK-LABEL: Verifier error in: %stream.max1 = ; CHECK: unexpected value of $result: ; CHECK: expected: i16 ; CHECK: actual: <2 x i16> - %stream.max1 = call <2 x i16> (...) @xd.stream.max__v2i16(ptr %p, i64 %trunc1, i16 0) + %stream.max1 = call <2 x i16> (...) @xd.ir.stream.max__v2i16(ptr %p, i64 %trunc1, i16 0) ; CHECK-LABEL: Verifier error in: %stream.min1 = ; CHECK: wrong number of arguments: 2, expected 3 - %stream.min1 = call i8 (...) @xd.stream.min__i8(ptr %p, i64 14) + %stream.min1 = call i8 (...) @xd.ir.stream.min__i8(ptr %p, i64 14) ; CHECK-LABEL: Verifier error in: %fromfixedvector3 = ; CHECK: eq:$rhs (MiddleEndian) does not match any available option @@ -50,14 +50,14 @@ entry: ; CHECK: previously: MiddleEndian ; CHECK: while checking (isReasonableVectorKind ?:$kind) ; CHECK: with $kind = MiddleEndian - %fromfixedvector3 = call target("xd.vector", i32, 2, 2) (...) @xd.fromfixedvector__txd.vector_i32_2_2t(<2 x i32> poison) + %fromfixedvector3 = call target("xd.ir.vector", i32, 2, 2) (...) @xd.ir.fromfixedvector__txd.vector_i32_2_2t(<2 x i32> poison) ret void } -declare i32 @xd.sizeof(...) -declare i64 @xd.itrunc__i64(...) -declare target("xd.vector", i32, 0, 2) @xd.fromfixedvector__txd.vector_i32_0_2t(...) -declare target("xd.vector", i32, 2, 2) @xd.fromfixedvector__txd.vector_i32_2_2t(...) -declare <2 x i16> @xd.stream.max__v2i16(...) -declare i8 @xd.stream.min__i8(...) +declare i32 @xd.ir.sizeof(...) +declare i64 @xd.ir.itrunc__i64(...) +declare target("xd.ir.vector", i32, 0, 2) @xd.ir.fromfixedvector__txd.vector_i32_0_2t(...) +declare target("xd.ir.vector", i32, 2, 2) @xd.ir.fromfixedvector__txd.vector_i32_2_2t(...) +declare <2 x i16> @xd.ir.stream.max__v2i16(...) +declare i8 @xd.ir.stream.min__i8(...) diff --git a/test/example/visitor-basic.ll b/test/example/visitor-basic.ll index eaeea9b..919a429 100644 --- a/test/example/visitor-basic.ll +++ b/test/example/visitor-basic.ll @@ -1,18 +1,18 @@ ; RUN: llvm-dialects-example -visit %s | FileCheck --check-prefixes=DEFAULT %s -; DEFAULT: visiting ReadOp: %v = call i32 @xd.read__i32() +; DEFAULT: visiting ReadOp: %v = call i32 @xd.ir.read__i32() ; DEFAULT-NEXT: visiting UnaryInstruction (pre): %w = load i32, ptr %p ; DEFAULT-NEXT: visiting UnaryInstruction (pre): %q = load i32, ptr %p1 ; DEFAULT-NEXT: visiting BinaryOperator: %v1 = add i32 %v, %w ; DEFAULT-NEXT: visiting umax intrinsic: %v2 = call i32 @llvm.umax.i32(i32 %v1, i32 %q) -; DEFAULT-NEXT: visiting WriteOp: call void (...) @xd.write(i8 %t) -; DEFAULT-NEXT: visiting SetReadOp: %v.0 = call i1 @xd.set.read__i1() -; DEFAULT-NEXT: visiting SetReadOp: %v.1 = call i32 @xd.set.read__i32() -; DEFAULT-NEXT: visiting SetReadOp (set): %v.1 = call i32 @xd.set.read__i32() +; DEFAULT-NEXT: visiting WriteOp: call void (...) @xd.ir.write(i8 %t) +; DEFAULT-NEXT: visiting SetReadOp: %v.0 = call i1 @xd.ir.set.read__i1() +; DEFAULT-NEXT: visiting SetReadOp: %v.1 = call i32 @xd.ir.set.read__i32() +; DEFAULT-NEXT: visiting SetReadOp (set): %v.1 = call i32 @xd.ir.set.read__i32() ; DEFAULT-NEXT: visiting UnaryInstruction (pre): %v.2 = trunc i32 %v.1 to i8 ; DEFAULT-NEXT: visiting UnaryInstruction: %v.2 = trunc i32 %v.1 to i8 -; DEFAULT-NEXT: visiting SetWriteOp (set): call void (...) @xd.set.write(i8 %v.2) -; DEFAULT-NEXT: visiting WriteVarArgOp: call void (...) @xd.write.vararg(i8 %t, i32 %v2, i32 %q) +; DEFAULT-NEXT: visiting SetWriteOp (set): call void (...) @xd.ir.set.write(i8 %v.2) +; DEFAULT-NEXT: visiting WriteVarArgOp: call void (...) @xd.ir.write.vararg(i8 %t, i32 %v2, i32 %q) ; DEFAULT-NEXT: %v2 = ; DEFAULT-NEXT: %q = ; DEFAULT-NEXT: visiting umin (set): %vm = call i32 @llvm.umin.i32(i32 %v1, i32 %q) @@ -25,31 +25,31 @@ define void @test1(ptr %p) { entry: - %v = call i32 @xd.read__i32() + %v = call i32 @xd.ir.read__i32() %w = load i32, ptr %p %p1 = getelementptr i32, ptr %p, i32 1 %q = load i32, ptr %p1 %v1 = add i32 %v, %w %v2 = call i32 @llvm.umax.i32(i32 %v1, i32 %q) - %t = call i8 (...) @xd.itrunc__i8(i32 %v2) - call void (...) @xd.write(i8 %t) - %v.0 = call i1 @xd.set.read__i1() - %v.1 = call i32 @xd.set.read__i32() + %t = call i8 (...) @xd.ir.itrunc__i8(i32 %v2) + call void (...) @xd.ir.write(i8 %t) + %v.0 = call i1 @xd.ir.set.read__i1() + %v.1 = call i32 @xd.ir.set.read__i32() %v.2 = trunc i32 %v.1 to i8 - call void (...) @xd.set.write(i8 %v.2) - call void (...) @xd.write.vararg(i8 %t, i32 %v2, i32 %q) + call void (...) @xd.ir.set.write(i8 %v.2) + call void (...) @xd.ir.write.vararg(i8 %t, i32 %v2, i32 %q) %vm = call i32 @llvm.umin.i32(i32 %v1, i32 %q) - call void @xd.string.attr.op(ptr @0) + call void @xd.ir.string.attr.op(ptr @0) ret void } -declare i32 @xd.read__i32() -declare i1 @xd.set.read__i1() -declare i32 @xd.set.read__i32() -declare void @xd.write(...) -declare void @xd.set.write(...) -declare void @xd.write.vararg(...) -declare i8 @xd.itrunc__i8(...) -declare void @xd.string.attr.op(ptr) +declare i32 @xd.ir.read__i32() +declare i1 @xd.ir.set.read__i1() +declare i32 @xd.ir.set.read__i32() +declare void @xd.ir.write(...) +declare void @xd.ir.set.write(...) +declare void @xd.ir.write.vararg(...) +declare i8 @xd.ir.itrunc__i8(...) +declare void @xd.ir.string.attr.op(ptr) declare i32 @llvm.umax.i32(i32, i32) declare i32 @llvm.umin.i32(i32, i32) diff --git a/test/example/visitor-rpot.ll b/test/example/visitor-rpot.ll index e04ea4e..70ca557 100644 --- a/test/example/visitor-rpot.ll +++ b/test/example/visitor-rpot.ll @@ -1,26 +1,26 @@ ; RUN: llvm-dialects-example -visit %s | FileCheck --check-prefixes=DEFAULT %s ; RUN: llvm-dialects-example -visit -rpot %s | FileCheck --check-prefixes=RPOT %s -; DEFAULT: visiting WriteOp: call void (...) @xd.write(i32 0) -; DEFAULT: visiting WriteOp: call void (...) @xd.write(i32 2) -; DEFAULT: visiting WriteOp: call void (...) @xd.write(i32 1) +; DEFAULT: visiting WriteOp: call void (...) @xd.ir.write(i32 0) +; DEFAULT: visiting WriteOp: call void (...) @xd.ir.write(i32 2) +; DEFAULT: visiting WriteOp: call void (...) @xd.ir.write(i32 1) -; RPOT: visiting WriteOp: call void (...) @xd.write(i32 0) -; RPOT: visiting WriteOp: call void (...) @xd.write(i32 1) -; RPOT: visiting WriteOp: call void (...) @xd.write(i32 2) +; RPOT: visiting WriteOp: call void (...) @xd.ir.write(i32 0) +; RPOT: visiting WriteOp: call void (...) @xd.ir.write(i32 1) +; RPOT: visiting WriteOp: call void (...) @xd.ir.write(i32 2) define void @test1(ptr %p) { entry: - call void (...) @xd.write(i32 0) + call void (...) @xd.ir.write(i32 0) br label %a b: - call void (...) @xd.write(i32 2) + call void (...) @xd.ir.write(i32 2) ret void a: - call void (...) @xd.write(i32 1) + call void (...) @xd.ir.write(i32 1) br label %b } -declare void @xd.write(...) +declare void @xd.ir.write(...)