LLVM  6.0.0svn
Macros | Functions | Variables
X86FloatingPoint.cpp File Reference
#include "X86.h"
#include "X86InstrInfo.h"
#include "llvm/ADT/DepthFirstIterator.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/CodeGen/EdgeBundles.h"
#include "llvm/CodeGen/LivePhysRegs.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/Passes.h"
#include "llvm/CodeGen/TargetInstrInfo.h"
#include "llvm/CodeGen/TargetSubtargetInfo.h"
#include "llvm/IR/InlineAsm.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Target/TargetMachine.h"
#include <algorithm>
#include <bitset>
Include dependency graph for X86FloatingPoint.cpp:

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "x86-codegen"
 
#define ASSERT_SORTED(TABLE)
 

Functions

 STATISTIC (NumFXCH, "Number of fxch instructions inserted")
 
 STATISTIC (NumFP, "Number of floating point instructions")
 
static unsigned getFPReg (const MachineOperand &MO)
 getFPReg - Return the X86::FPx register number for the specified operand. More...
 
static int Lookup (ArrayRef< TableEntry > Table, unsigned Opcode)
 
static unsigned getConcreteOpcode (unsigned Opcode)
 

Variables

static const TableEntry OpcodeTable []
 
static const TableEntry PopTable []
 
static const TableEntry ForwardST0Table []
 
static const TableEntry ReverseST0Table []
 
static const TableEntry ForwardSTiTable []
 
static const TableEntry ReverseSTiTable []
 

Macro Definition Documentation

◆ ASSERT_SORTED

#define ASSERT_SORTED (   TABLE)
Value:
{ static bool TABLE##Checked = false; \
if (!TABLE##Checked) { \
assert(std::is_sorted(std::begin(TABLE), std::end(TABLE)) && \
"All lookup tables must be sorted for efficient access!"); \
TABLE##Checked = true; \
} \
}
const_iterator end(StringRef path)
Get end iterator over path.
Definition: Path.cpp:244
const_iterator begin(StringRef path, Style style=Style::native)
Get begin iterator over path.
Definition: Path.cpp:235

Definition at line 602 of file X86FloatingPoint.cpp.

Referenced by getConcreteOpcode().

◆ DEBUG_TYPE

#define DEBUG_TYPE   "x86-codegen"

Definition at line 51 of file X86FloatingPoint.cpp.

Function Documentation

◆ getConcreteOpcode()

static unsigned getConcreteOpcode ( unsigned  Opcode)
static

Definition at line 782 of file X86FloatingPoint.cpp.

References assert(), ASSERT_SORTED, and Lookup().

◆ getFPReg()

static unsigned getFPReg ( const MachineOperand MO)
static

getFPReg - Return the X86::FPx register number for the specified operand.

For example, this returns 3 for X86::FP3.

Definition at line 308 of file X86FloatingPoint.cpp.

References assert(), llvm::MachineBasicBlock::begin(), llvm::SmallVectorImpl< T >::clear(), llvm::X86II::CompareFP, llvm::X86II::CondMovFP, llvm::dbgs(), DEBUG, llvm::depth_first_ext(), llvm::MachineBasicBlock::dump(), llvm::SmallVectorBase::empty(), llvm::MachineBasicBlock::end(), llvm::X86II::FPTypeMask, llvm::MachineFunction::front(), llvm::EdgeBundles::getBundle(), llvm::Function::getCallingConv(), llvm::MachineInstr::getDesc(), llvm::MachineBasicBlock::getFirstTerminator(), llvm::MachineFunction::getFunction(), llvm::TargetSubtargetInfo::getInstrInfo(), llvm::MachineBasicBlock::getName(), llvm::MachineBasicBlock::getNumber(), llvm::EdgeBundles::getNumBundles(), llvm::MachineInstr::getNumOperands(), llvm::MachineInstr::getOperand(), llvm::MachineBasicBlock::getParent(), llvm::MachineOperand::getReg(), llvm::MachineFunction::getRegInfo(), llvm::MachineFunction::getSubtarget(), I, llvm::df_iterator_default_set< NodeRef, SmallSize >::insert(), llvm::MachineInstr::isCall(), llvm::MachineInstr::isCopy(), llvm::MachineOperand::isDead(), llvm::MachineInstr::isImplicitDef(), llvm::MachineInstr::isInlineAsm(), isLive(), llvm::MachineOperand::isReg(), LLVM_ATTRIBUTE_UNUSED, llvm_unreachable, MRI, llvm::X86II::NotFP, llvm::X86II::OneArgFP, llvm::X86II::OneArgFPRW, llvm::operator<(), llvm::SmallVectorTemplateBase< T, isPodLike >::push_back(), llvm::MachineRegisterInfo::reg_nodbg_empty(), llvm::SmallVectorImpl< T >::resize(), llvm::SmallPtrSetImplBase::size(), llvm::SmallVectorTemplateCommon< T, typename >::size(), llvm::MachineFunction::size(), llvm::X86II::SpecialFP, llvm::MachineBasicBlock::succ_empty(), llvm::MCInstrDesc::TSFlags, llvm::X86II::TwoArgFP, llvm::CallingConv::X86_RegCall, and llvm::X86II::ZeroArgFP.

◆ Lookup()

static int Lookup ( ArrayRef< TableEntry >  Table,
unsigned  Opcode 
)
static

◆ STATISTIC() [1/2]

STATISTIC ( NumFXCH  ,
"Number of fxch instructions inserted"   
)

◆ STATISTIC() [2/2]

STATISTIC ( NumFP  ,
"Number of floating point instructions  
)

Variable Documentation

◆ ForwardST0Table

const TableEntry ForwardST0Table[]
static
Initial value:
= {
{ X86::ADD_Fp32 , X86::ADD_FST0r },
{ X86::ADD_Fp64 , X86::ADD_FST0r },
{ X86::ADD_Fp80 , X86::ADD_FST0r },
{ X86::DIV_Fp32 , X86::DIV_FST0r },
{ X86::DIV_Fp64 , X86::DIV_FST0r },
{ X86::DIV_Fp80 , X86::DIV_FST0r },
{ X86::MUL_Fp32 , X86::MUL_FST0r },
{ X86::MUL_Fp64 , X86::MUL_FST0r },
{ X86::MUL_Fp80 , X86::MUL_FST0r },
{ X86::SUB_Fp32 , X86::SUB_FST0r },
{ X86::SUB_Fp64 , X86::SUB_FST0r },
{ X86::SUB_Fp80 , X86::SUB_FST0r },
}

Definition at line 1198 of file X86FloatingPoint.cpp.

◆ ForwardSTiTable

const TableEntry ForwardSTiTable[]
static
Initial value:
= {
{ X86::ADD_Fp32 , X86::ADD_FrST0 },
{ X86::ADD_Fp64 , X86::ADD_FrST0 },
{ X86::ADD_Fp80 , X86::ADD_FrST0 },
{ X86::DIV_Fp32 , X86::DIVR_FrST0 },
{ X86::DIV_Fp64 , X86::DIVR_FrST0 },
{ X86::DIV_Fp80 , X86::DIVR_FrST0 },
{ X86::MUL_Fp32 , X86::MUL_FrST0 },
{ X86::MUL_Fp64 , X86::MUL_FrST0 },
{ X86::MUL_Fp80 , X86::MUL_FrST0 },
{ X86::SUB_Fp32 , X86::SUBR_FrST0 },
{ X86::SUB_Fp64 , X86::SUBR_FrST0 },
{ X86::SUB_Fp80 , X86::SUBR_FrST0 },
}

Definition at line 1230 of file X86FloatingPoint.cpp.

◆ OpcodeTable

const TableEntry OpcodeTable[]
static

Definition at line 620 of file X86FloatingPoint.cpp.

◆ PopTable

const TableEntry PopTable[]
static
Initial value:
= {
{ X86::ADD_FrST0 , X86::ADD_FPrST0 },
{ X86::DIVR_FrST0, X86::DIVR_FPrST0 },
{ X86::DIV_FrST0 , X86::DIV_FPrST0 },
{ X86::IST_F16m , X86::IST_FP16m },
{ X86::IST_F32m , X86::IST_FP32m },
{ X86::MUL_FrST0 , X86::MUL_FPrST0 },
{ X86::ST_F32m , X86::ST_FP32m },
{ X86::ST_F64m , X86::ST_FP64m },
{ X86::ST_Frr , X86::ST_FPrr },
{ X86::SUBR_FrST0, X86::SUBR_FPrST0 },
{ X86::SUB_FrST0 , X86::SUB_FPrST0 },
{ X86::UCOM_FIr , X86::UCOM_FIPr },
{ X86::UCOM_FPr , X86::UCOM_FPPr },
{ X86::UCOM_Fr , X86::UCOM_FPr },
}

Definition at line 796 of file X86FloatingPoint.cpp.

◆ ReverseST0Table

const TableEntry ReverseST0Table[]
static
Initial value:
= {
{ X86::ADD_Fp32 , X86::ADD_FST0r },
{ X86::ADD_Fp64 , X86::ADD_FST0r },
{ X86::ADD_Fp80 , X86::ADD_FST0r },
{ X86::DIV_Fp32 , X86::DIVR_FST0r },
{ X86::DIV_Fp64 , X86::DIVR_FST0r },
{ X86::DIV_Fp80 , X86::DIVR_FST0r },
{ X86::MUL_Fp32 , X86::MUL_FST0r },
{ X86::MUL_Fp64 , X86::MUL_FST0r },
{ X86::MUL_Fp80 , X86::MUL_FST0r },
{ X86::SUB_Fp32 , X86::SUBR_FST0r },
{ X86::SUB_Fp64 , X86::SUBR_FST0r },
{ X86::SUB_Fp80 , X86::SUBR_FST0r },
}

Definition at line 1214 of file X86FloatingPoint.cpp.

◆ ReverseSTiTable

const TableEntry ReverseSTiTable[]
static
Initial value:
= {
{ X86::ADD_Fp32 , X86::ADD_FrST0 },
{ X86::ADD_Fp64 , X86::ADD_FrST0 },
{ X86::ADD_Fp80 , X86::ADD_FrST0 },
{ X86::DIV_Fp32 , X86::DIV_FrST0 },
{ X86::DIV_Fp64 , X86::DIV_FrST0 },
{ X86::DIV_Fp80 , X86::DIV_FrST0 },
{ X86::MUL_Fp32 , X86::MUL_FrST0 },
{ X86::MUL_Fp64 , X86::MUL_FrST0 },
{ X86::MUL_Fp80 , X86::MUL_FrST0 },
{ X86::SUB_Fp32 , X86::SUB_FrST0 },
{ X86::SUB_Fp64 , X86::SUB_FrST0 },
{ X86::SUB_Fp80 , X86::SUB_FrST0 },
}

Definition at line 1246 of file X86FloatingPoint.cpp.