LLVM API Documentation

BypassSlowDivision.h
Go to the documentation of this file.
00001 //===- llvm/Transforms/Utils/BypassSlowDivision.h --------------*- C++ -*-===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 //
00010 // This file contains an optimization for div and rem on architectures that
00011 // execute short instructions significantly faster than longer instructions.
00012 // For example, on Intel Atom 32-bit divides are slow enough that during
00013 // runtime it is profitable to check the value of the operands, and if they are
00014 // positive and less than 256 use an unsigned 8-bit divide.
00015 //
00016 //===----------------------------------------------------------------------===//
00017 
00018 #ifndef LLVM_TRANSFORMS_UTILS_BYPASSSLOWDIVISION_H
00019 #define LLVM_TRANSFORMS_UTILS_BYPASSSLOWDIVISION_H
00020 
00021 #include "llvm/ADT/DenseMap.h"
00022 #include "llvm/IR/Function.h"
00023 
00024 namespace llvm {
00025 
00026 /// This optimization identifies DIV instructions that can be
00027 /// profitably bypassed and carried out with a shorter, faster divide.
00028 bool bypassSlowDivision(Function &F,
00029                         Function::iterator &I,
00030                         const DenseMap<unsigned int, unsigned int> &BypassWidth);
00031 
00032 } // End llvm namespace
00033 
00034 #endif