[llvm] r260553 - [GlobalISel] Add a hook in TargetConfigPass to run GlobalISel.

Quentin Colombet via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 11 09:57:23 PST 2016


Author: qcolombet
Date: Thu Feb 11 11:57:22 2016
New Revision: 260553

URL: http://llvm.org/viewvc/llvm-project?rev=260553&view=rev
Log:
[GlobalISel] Add a hook in TargetConfigPass to run GlobalISel.

Modified:
    llvm/trunk/include/llvm/CodeGen/Passes.h
    llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp

Modified: llvm/trunk/include/llvm/CodeGen/Passes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/Passes.h?rev=260553&r1=260552&r2=260553&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/Passes.h (original)
+++ llvm/trunk/include/llvm/CodeGen/Passes.h Thu Feb 11 11:57:22 2016
@@ -216,6 +216,12 @@ public:
     return true;
   }
 
+#ifdef LLVM_BUILD_GLOBAL_ISEL
+  /// This method should install an IR translator pass, which converts from
+  /// LLVM code to machine instructions with possibly generic opcodes.
+  virtual bool addIRTranslator() { return true; }
+#endif
+
   /// Add the complete, standard set of LLVM CodeGen passes.
   /// Fully developed targets will not generally override this.
   virtual void addMachinePasses();

Modified: llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp?rev=260553&r1=260552&r2=260553&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp (original)
+++ llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp Thu Feb 11 11:57:22 2016
@@ -42,6 +42,12 @@ static cl::opt<cl::boolOrDefault>
 EnableFastISelOption("fast-isel", cl::Hidden,
   cl::desc("Enable the \"fast\" instruction selector"));
 
+#ifdef LLVM_BUILD_GLOBAL_ISEL
+static cl::opt<bool>
+    EnableGlobalISel("global-isel", cl::Hidden, cl::init(false),
+                     cl::desc("Enable the \"global\" instruction selector"));
+#endif
+
 void LLVMTargetMachine::initAsmInfo() {
   MRI = TheTarget.createMCRegInfo(getTargetTriple().str());
   MII = TheTarget.createMCInstrInfo();
@@ -135,8 +141,14 @@ addPassesToGenerateCode(LLVMTargetMachin
        TM->getO0WantsFastISel()))
     TM->setFastISel(true);
 
-  // Ask the target for an isel.
-  if (PassConfig->addInstSelector())
+#ifdef LLVM_BUILD_GLOBAL_ISEL
+  if (EnableGlobalISel) {
+    if (PassConfig->addIRTranslator())
+      return nullptr;
+  } else
+#endif
+      // Ask the target for an isel.
+      if (PassConfig->addInstSelector())
     return nullptr;
 
   PassConfig->addMachinePasses();




More information about the llvm-commits mailing list