From 0de43b225fe6a4438025b5d2a1ff33a10647f082 Mon Sep 17 00:00:00 2001 From: Quentin Colombet Date: Fri, 26 Aug 2016 22:32:59 +0000 Subject: [PATCH] [TargetPassConfig] Add a target hook to know what GlobalISel should do on error. By default, this hook tells GlobalISel to abort (report a fatal error) when it encounters an error. The alternative will be to fall back on SDISel. This fall back will be removed when the bring-up of GlobalISel is over. llvm-svn: 279879 --- llvm/include/llvm/CodeGen/TargetPassConfig.h | 5 +++++ llvm/lib/CodeGen/TargetPassConfig.cpp | 13 +++++++++++++ 2 files changed, 18 insertions(+) diff --git a/llvm/include/llvm/CodeGen/TargetPassConfig.h b/llvm/include/llvm/CodeGen/TargetPassConfig.h index a6110a6..6f94ae4 100644 --- a/llvm/include/llvm/CodeGen/TargetPassConfig.h +++ b/llvm/include/llvm/CodeGen/TargetPassConfig.h @@ -281,6 +281,11 @@ public: /// verification is enabled. void addVerifyPass(const std::string &Banner); + /// Check whether or not GlobalISel should abort on error. + /// When this is disable, GlobalISel will fall back on SDISel instead of + /// erroring out. + virtual bool isGlobalISelAbortEnabled() const; + protected: // Helper to verify the analysis is really immutable. void setOpt(bool &Opt, bool Val); diff --git a/llvm/lib/CodeGen/TargetPassConfig.cpp b/llvm/lib/CodeGen/TargetPassConfig.cpp index 94ee302..88b94f5 100644 --- a/llvm/lib/CodeGen/TargetPassConfig.cpp +++ b/llvm/lib/CodeGen/TargetPassConfig.cpp @@ -98,6 +98,12 @@ PrintMachineInstrs("print-machineinstrs", cl::ValueOptional, cl::desc("Print machine instrs"), cl::value_desc("pass-name"), cl::init("option-unspecified")); +static cl::opt EnableGlobalISelAbort( + "global-isel-abort", cl::Hidden, + cl::desc("Enable abort calls when \"global\" instruction selection " + "fails to lower/select an instruction"), + cl::init(true)); + // Temporary option to allow experimenting with MachineScheduler as a post-RA // scheduler. Targets can "properly" enable this with // substitutePass(&PostRASchedulerID, &PostMachineSchedulerID). @@ -888,3 +894,10 @@ void TargetPassConfig::addBlockPlacement() { addPass(&MachineBlockPlacementStatsID); } } + +//===---------------------------------------------------------------------===// +/// GlobalISel Configuration +//===---------------------------------------------------------------------===// +bool TargetPassConfig::isGlobalISelAbortEnabled() const { + return EnableGlobalISelAbort; +} -- 2.7.4