From 3b88f10f46800e035ebe5380f8f6a9508cd2759d Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Wed, 1 Oct 2008 20:39:19 +0000 Subject: [PATCH] Enable FastISel by default (on x86 and x86-64) with the -fast option. llvm-svn: 56930 --- llvm/lib/CodeGen/LLVMTargetMachine.cpp | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/llvm/lib/CodeGen/LLVMTargetMachine.cpp b/llvm/lib/CodeGen/LLVMTargetMachine.cpp index 936854013693..bd8d49997351 100644 --- a/llvm/lib/CodeGen/LLVMTargetMachine.cpp +++ b/llvm/lib/CodeGen/LLVMTargetMachine.cpp @@ -53,10 +53,15 @@ DisablePostRAScheduler("disable-post-RA-scheduler", cl::desc("Disable scheduling after register allocation"), cl::init(true)); -static cl::opt -FastISelOption("fast-isel", cl::Hidden, - cl::desc("Enable the experimental \"fast\" instruction selector"), - cl::location(EnableFastISel)); +// Enable or disable FastISel. Both options are needed, because +// FastISel is enabled by default with -fast, and we wish to be +// able to enable or disable fast-isel independently from -fast. +static cl::opt +EnableFastISelOption("fast-isel", cl::Hidden, + cl::desc("Enable the experimental \"fast\" instruction selector")); +static cl::opt +DisableFastISelOption("disable-fast-isel", cl::Hidden, + cl::desc("Disable the experimental \"fast\" instruction selector")); FileModel::Model LLVMTargetMachine::addPassesToEmitFile(PassManagerBase &PM, @@ -169,6 +174,13 @@ bool LLVMTargetMachine::addCommonCodeGenPasses(PassManagerBase &PM, bool Fast) { // Standard Lower-Level Passes. + // Enable FastISel with -fast, but allow that to be overridden. + assert((!EnableFastISelOption || !DisableFastISelOption) && + "Both -fast-isel and -disable-fast-isel given!"); + if (EnableFastISelOption || + (Fast && !DisableFastISelOption)) + EnableFastISel = true; + // Ask the target for an isel. if (addInstSelector(PM, Fast)) return true;