[PATCH] D101538: [GlobalISel][IRTranslator] Make translate() methods virtual.

Aleksandr Bezzubikov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 29 07:40:03 PDT 2021


zuban32 created this revision.
Herald added a subscriber: rovka.
zuban32 requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Although IRTranslator::translate() methods were designed as
general as possible, for some targets (e.g. SPIR-V) it's
quite convenient to override those to be able to perform
some very target-specific activities.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D101538

Files:
  llvm/include/llvm/CodeGen/GlobalISel/IRTranslator.h


Index: llvm/include/llvm/CodeGen/GlobalISel/IRTranslator.h
===================================================================
--- llvm/include/llvm/CodeGen/GlobalISel/IRTranslator.h
+++ llvm/include/llvm/CodeGen/GlobalISel/IRTranslator.h
@@ -194,14 +194,14 @@
   /// 3. Create the generic instruction.
   ///
   /// \return true if the translation succeeded.
-  bool translate(const Instruction &Inst);
+  virtual bool translate(const Instruction &Inst);
 
   /// Materialize \p C into virtual-register \p Reg. The generic instructions
   /// performing this materialization will be inserted into the entry block of
   /// the function.
   ///
   /// \return true if the materialization succeeded.
-  bool translate(const Constant &C, Register Reg);
+  virtual bool translate(const Constant &C, Register Reg);
 
   // Translate U as a copy of V.
   bool translateCopy(const User &U, const Value &V,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D101538.341516.patch
Type: text/x-patch
Size: 900 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210429/7b14c968/attachment.bin>


More information about the llvm-commits mailing list