3434#include < tuple>
3535#include < type_traits>
3636
37- using namespace llvm ;
38- using namespace llvm_dialects ;
39-
4037namespace llvm_dialects {
4138
4239// Forward declarations.
@@ -58,7 +55,7 @@ template <typename ValueT> class OpMap final {
5855 friend class OpMapIteratorBase <ValueT, true >;
5956 friend class OpMapIteratorBase <ValueT, false >;
6057
61- using DialectOpKey = std::pair<StringRef, bool >;
58+ using DialectOpKey = std::pair<llvm:: StringRef, bool >;
6259
6360 struct DialectOpKV final {
6461 DialectOpKey Key;
@@ -179,10 +176,10 @@ template <typename ValueT> class OpMap final {
179176
180177 FIND_OVERLOAD(OpDescription)
181178 FIND_CONST_OVERLOAD(OpDescription)
182- FIND_OVERLOAD(Function)
183- FIND_CONST_OVERLOAD(Function)
184- FIND_OVERLOAD(Instruction)
185- FIND_CONST_OVERLOAD(Instruction)
179+ FIND_OVERLOAD(llvm:: Function)
180+ FIND_CONST_OVERLOAD(llvm:: Function)
181+ FIND_OVERLOAD(llvm:: Instruction)
182+ FIND_CONST_OVERLOAD(llvm:: Instruction)
186183
187184#undef FIND_CONST_OVERLOAD
188185#undef FIND_OVERLOAD
@@ -207,7 +204,7 @@ template <typename ValueT> class OpMap final {
207204
208205 // Try to lookup a function which is either the callee of an intrinsic call
209206 // or a dialect operation.
210- ValueT lookup (const Function &func) const {
207+ ValueT lookup (const llvm:: Function &func) const {
211208 auto it = find (func);
212209 if (auto val = it.val (); val)
213210 return *val;
@@ -217,7 +214,7 @@ template <typename ValueT> class OpMap final {
217214
218215 // Try to lookup an instruction which is either an intrinsic instruction,
219216 // a dialect operation or a core instruction.
220- ValueT lookup (const Instruction &inst) const {
217+ ValueT lookup (const llvm:: Instruction &inst) const {
221218 auto it = find (inst);
222219 if (auto val = it.val (); val)
223220 return *val;
@@ -377,9 +374,9 @@ template <typename ValueT> class OpMap final {
377374#undef GENERATE_ITERATOR_BODY
378375
379376private:
380- DenseMap<unsigned , ValueT> m_coreOpcodes;
381- DenseMap<unsigned , ValueT> m_intrinsics;
382- SmallVector<DialectOpKV, 1 > m_dialectOps;
377+ llvm:: DenseMap<unsigned , ValueT> m_coreOpcodes;
378+ llvm:: DenseMap<unsigned , ValueT> m_intrinsics;
379+ llvm:: SmallVector<DialectOpKV, 1 > m_dialectOps;
383380
384381 template <typename ... Args> iterator makeIterator (Args &&...args) {
385382 return iterator (this , std::forward<Args>(args)...);
@@ -406,13 +403,14 @@ template <typename ValueT> class OpMap final {
406403template <typename ValueT, bool isConst> class OpMapIteratorBase final {
407404 using OpMapT =
408405 std::conditional_t <isConst, const OpMap<ValueT>, OpMap<ValueT>>;
409- using BaseIteratorT =
410- std::conditional_t <isConst,
411- typename DenseMap<unsigned , ValueT>::const_iterator,
412- typename DenseMap<unsigned , ValueT>::iterator>;
406+ using BaseIteratorT = std::conditional_t <
407+ isConst, typename llvm::DenseMap<unsigned , ValueT>::const_iterator,
408+ typename llvm::DenseMap<unsigned , ValueT>::iterator>;
413409 using DialectOpIteratorT = std::conditional_t <
414- isConst, typename SmallVectorImpl<typename OpMapT::DialectOpKV>::const_iterator,
415- typename SmallVectorImpl<typename OpMapT::DialectOpKV>::iterator>;
410+ isConst,
411+ typename llvm::SmallVectorImpl<
412+ typename OpMapT::DialectOpKV>::const_iterator,
413+ typename llvm::SmallVectorImpl<typename OpMapT::DialectOpKV>::iterator>;
416414
417415 using InternalValueT = std::conditional_t <isConst, const ValueT, ValueT>;
418416
@@ -598,15 +596,15 @@ template <typename ValueT, bool isConst> class OpMapIteratorBase final {
598596 }
599597 }
600598
601- OpMapIteratorBase (OpMapT *map, const Function &func) : m_map{map} {
599+ OpMapIteratorBase (OpMapT *map, const llvm:: Function &func) : m_map{map} {
602600 createFromFunc (func);
603601 }
604602
605603 // Do a lookup for a given instruction. Mark the iterator as invalid
606604 // if the instruction is a call-like core instruction.
607- OpMapIteratorBase (OpMapT *map, const Instruction &inst) : m_map{map} {
608- if (auto *CI = dyn_cast<CallInst>(&inst)) {
609- const Function *callee = CI->getCalledFunction ();
605+ OpMapIteratorBase (OpMapT *map, const llvm:: Instruction &inst) : m_map{map} {
606+ if (auto *CI = llvm:: dyn_cast<llvm:: CallInst>(&inst)) {
607+ const llvm:: Function *callee = CI->getCalledFunction ();
610608 if (callee) {
611609 createFromFunc (*callee);
612610 return ;
@@ -616,7 +614,7 @@ template <typename ValueT, bool isConst> class OpMapIteratorBase final {
616614 const unsigned op = inst.getOpcode ();
617615
618616 // Construct an invalid iterator.
619- if (op == Instruction::Call || op == Instruction::CallBr) {
617+ if (op == llvm:: Instruction::Call || op == llvm:: Instruction::CallBr) {
620618 invalidate ();
621619 return ;
622620 }
@@ -697,7 +695,7 @@ template <typename ValueT, bool isConst> class OpMapIteratorBase final {
697695private:
698696 void invalidate () { m_isInvalid = true ; }
699697
700- void createFromFunc (const Function &func) {
698+ void createFromFunc (const llvm:: Function &func) {
701699 if (func.isIntrinsic ()) {
702700 m_iterator = m_map->m_intrinsics .find (func.getIntrinsicID ());
703701
@@ -710,7 +708,7 @@ template <typename ValueT, bool isConst> class OpMapIteratorBase final {
710708 createFromDialectOp (func.getName ());
711709 }
712710
713- void createFromDialectOp (StringRef funcName) {
711+ void createFromDialectOp (llvm:: StringRef funcName) {
714712 size_t idx = 0 ;
715713 bool found = false ;
716714 for (auto &dialectOpKV : m_map->m_dialectOps ) {
0 commit comments