LLVM API Documentation

X86FloatingPoint.cpp File Reference

#include "X86.h"
#include "X86InstrInfo.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/CodeGen/LiveVariables.h"
#include "llvm/CodeGen/Passes.h"
#include "llvm/Target/TargetInstrInfo.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/Visibility.h"
#include "llvm/ADT/DepthFirstIterator.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/ADT/STLExtras.h"
#include <algorithm>
#include <iostream>
#include <set>

Include dependency graph for X86FloatingPoint.cpp:

Go to the source code of this file.

Defines

#define DEBUG_TYPE   "fp"
#define ARRAY_SIZE(TABLE)   (sizeof(TABLE)/sizeof(TABLE[0]))
#define ASSERT_SORTED(TABLE)

Functions

FunctionPassllvm::createX86FloatingPointStackifierPass ()
static bool TableIsSorted (const TableEntry *Table, unsigned NumEntries)
static int Lookup (const TableEntry *Table, unsigned N, unsigned Opcode)
static unsigned getConcreteOpcode (unsigned Opcode)
static unsigned getFPReg (const MachineOperand &MO)

Variables

Statistic NumFXCH ("x86-codegen","Number of fxch instructions inserted")
Statistic NumFP ("x86-codegen","Number of floating point instructions")
static const TableEntry OpcodeTable []
static const TableEntry PopTable []
static const TableEntry ForwardST0Table []
static const TableEntry ReverseST0Table []
static const TableEntry ForwardSTiTable []
static const TableEntry ReverseSTiTable []


Define Documentation

#define ARRAY_SIZE ( TABLE   )     (sizeof(TABLE)/sizeof(TABLE[0]))

Definition at line 307 of file X86FloatingPoint.cpp.

Referenced by llvm::X86RegisterInfo::foldMemoryOperand(), and getConcreteOpcode().

#define ASSERT_SORTED ( TABLE   ) 

Value:

{ static bool TABLE##Checked = false;                                   \
    if (!TABLE##Checked) {                                                \
       assert(TableIsSorted(TABLE, ARRAY_SIZE(TABLE)) &&                  \
              "All lookup tables must be sorted for efficient access!");  \
       TABLE##Checked = true;                                             \
    }                                                                     \
  }

Definition at line 313 of file X86FloatingPoint.cpp.

Referenced by llvm::X86RegisterInfo::foldMemoryOperand(), and getConcreteOpcode().

#define DEBUG_TYPE   "fp"

Definition at line 31 of file X86FloatingPoint.cpp.


Function Documentation

static unsigned getConcreteOpcode ( unsigned  Opcode  )  [static]

Definition at line 389 of file X86FloatingPoint.cpp.

References ARRAY_SIZE, ASSERT_SORTED, Lookup(), and OpcodeTable.

static unsigned getFPReg ( const MachineOperand MO  )  [static]

Definition at line 474 of file X86FloatingPoint.cpp.

References llvm::MachineOperand::getReg(), llvm::MachineOperand::isRegister(), and Reg.

static int Lookup ( const TableEntry *  Table,
unsigned  N,
unsigned  Opcode 
) [static]

Definition at line 300 of file X86FloatingPoint.cpp.

Referenced by getConcreteOpcode(), llvm::ValueMap< ValType, TypeClass, ConstantClass, HasLargeKey >::getOrCreate(), llvm::ConstantStruct::replaceUsesOfWithOnConstant(), and llvm::ConstantArray::replaceUsesOfWithOnConstant().

static bool TableIsSorted ( const TableEntry *  Table,
unsigned  NumEntries 
) [static]

Definition at line 294 of file X86FloatingPoint.cpp.


Variable Documentation

const TableEntry ForwardST0Table[] [static]

Initial value:

 {
  { X86::FpADD  , X86::FADDST0r },
  { X86::FpDIV  , X86::FDIVST0r },
  { X86::FpMUL  , X86::FMULST0r },
  { X86::FpSUB  , X86::FSUBST0r },
}

Definition at line 584 of file X86FloatingPoint.cpp.

const TableEntry ForwardSTiTable[] [static]

Initial value:

 {
  { X86::FpADD  , X86::FADDrST0  },   
  { X86::FpDIV  , X86::FDIVRrST0 },
  { X86::FpMUL  , X86::FMULrST0  },   
  { X86::FpSUB  , X86::FSUBRrST0 },
}

Definition at line 600 of file X86FloatingPoint.cpp.

unsigned from

Definition at line 282 of file X86FloatingPoint.cpp.

Referenced by TableIsSorted().

LiveVariables* LV

Definition at line 64 of file X86FloatingPoint.cpp.

MachineBasicBlock* MBB

Definition at line 65 of file X86FloatingPoint.cpp.

Referenced by llvm::LiveIntervals::addIntervalsForSpills(), llvm::MachineInstr::addMachineBasicBlockOperand(), llvm::MachineInstrBuilder::addMBB(), llvm::MachineFunction::addToMBBNumbering(), llvm::X86RegisterInfo::copyRegToReg(), llvm::SparcRegisterInfo::copyRegToReg(), llvm::PPCRegisterInfo::copyRegToReg(), llvm::IA64RegisterInfo::copyRegToReg(), llvm::ARMRegisterInfo::copyRegToReg(), llvm::AlphaRegisterInfo::copyRegToReg(), llvm::ilist_traits< MachineBasicBlock >::destroySentinel(), llvm::X86RegisterInfo::eliminateCallFramePseudoInstr(), llvm::SparcRegisterInfo::eliminateCallFramePseudoInstr(), llvm::PPCRegisterInfo::eliminateCallFramePseudoInstr(), llvm::IA64RegisterInfo::eliminateCallFramePseudoInstr(), llvm::ARMRegisterInfo::eliminateCallFramePseudoInstr(), llvm::AlphaRegisterInfo::eliminateCallFramePseudoInstr(), llvm::PPCRegisterInfo::eliminateFrameIndex(), llvm::IA64RegisterInfo::eliminateFrameIndex(), llvm::ARMRegisterInfo::eliminateFrameIndex(), llvm::AlphaRegisterInfo::eliminateFrameIndex(), llvm::X86RegisterInfo::emitEpilogue(), llvm::SparcRegisterInfo::emitEpilogue(), llvm::PPCRegisterInfo::emitEpilogue(), llvm::IA64RegisterInfo::emitEpilogue(), llvm::ARMRegisterInfo::emitEpilogue(), llvm::AlphaRegisterInfo::emitEpilogue(), llvm::X86RegisterInfo::emitPrologue(), llvm::SparcRegisterInfo::emitPrologue(), llvm::PPCRegisterInfo::emitPrologue(), llvm::IA64RegisterInfo::emitPrologue(), llvm::ARMRegisterInfo::emitPrologue(), llvm::AlphaRegisterInfo::emitPrologue(), llvm::FunctionLoweringInfo::FunctionLoweringInfo(), llvm::BasicBlockSDNode::getBasicBlock(), llvm::SelectionDAG::getBasicBlock(), llvm::LiveVariables::HandleVirtRegUse(), llvm::X86InstrInfo::insertGoto(), llvm::PPCInstrInfo::insertNoop(), llvm::X86RegisterInfo::loadRegFromStackSlot(), llvm::SparcRegisterInfo::loadRegFromStackSlot(), llvm::PPCRegisterInfo::loadRegFromStackSlot(), llvm::IA64RegisterInfo::loadRegFromStackSlot(), llvm::ARMRegisterInfo::loadRegFromStackSlot(), llvm::AlphaRegisterInfo::loadRegFromStackSlot(), llvm::MachineInstr::MachineInstr(), llvm::LiveVariables::MarkVirtRegAliveInBlock(), llvm::operator<<(), llvm::AsmPrinter::printBasicBlockLabel(), llvm::X86InstrInfo::reverseBranchCondition(), llvm::LiveVariables::runOnMachineFunction(), llvm::X86RegisterInfo::storeRegToStackSlot(), llvm::SparcRegisterInfo::storeRegToStackSlot(), llvm::PPCRegisterInfo::storeRegToStackSlot(), llvm::IA64RegisterInfo::storeRegToStackSlot(), llvm::ARMRegisterInfo::storeRegToStackSlot(), and llvm::AlphaRegisterInfo::storeRegToStackSlot().

Statistic NumFP("x86-codegen","Number of floating point instructions") [static]

Statistic NumFXCH("x86-codegen","Number of fxch instructions inserted") [static]

const TableEntry OpcodeTable[] [static]

Definition at line 331 of file X86FloatingPoint.cpp.

Referenced by llvm::X86RegisterInfo::foldMemoryOperand(), and getConcreteOpcode().

const TableEntry PopTable[] [static]

Initial value:

 {
  { X86::FADDrST0 , X86::FADDPrST0  },

  { X86::FDIVRrST0, X86::FDIVRPrST0 },
  { X86::FDIVrST0 , X86::FDIVPrST0  },

  { X86::FIST16m  , X86::FISTP16m   },
  { X86::FIST32m  , X86::FISTP32m   },

  { X86::FMULrST0 , X86::FMULPrST0  },

  { X86::FST32m   , X86::FSTP32m    },
  { X86::FST64m   , X86::FSTP64m    },
  { X86::FSTrr    , X86::FSTPrr     },

  { X86::FSUBRrST0, X86::FSUBRPrST0 },
  { X86::FSUBrST0 , X86::FSUBPrST0  },

  { X86::FUCOMIr  , X86::FUCOMIPr   },

  { X86::FUCOMPr  , X86::FUCOMPPr   },
  { X86::FUCOMr   , X86::FUCOMPr    },
}

Definition at line 403 of file X86FloatingPoint.cpp.

unsigned RegMap[8]

Definition at line 67 of file X86FloatingPoint.cpp.

Referenced by CreateVirtualRegisters(), getRegClass(), LowerFORMAL_ARGUMENT(), and LowerFORMAL_ARGUMENTS().

const TableEntry ReverseST0Table[] [static]

Initial value:

 {
  { X86::FpADD  , X86::FADDST0r  },   
  { X86::FpDIV  , X86::FDIVRST0r },
  { X86::FpMUL  , X86::FMULST0r  },   
  { X86::FpSUB  , X86::FSUBRST0r },
}

Definition at line 592 of file X86FloatingPoint.cpp.

const TableEntry ReverseSTiTable[] [static]

Initial value:

 {
  { X86::FpADD  , X86::FADDrST0 },
  { X86::FpDIV  , X86::FDIVrST0 },
  { X86::FpMUL  , X86::FMULrST0 },
  { X86::FpSUB  , X86::FSUBrST0 },
}

Definition at line 608 of file X86FloatingPoint.cpp.

unsigned Stack[8]

Definition at line 66 of file X86FloatingPoint.cpp.

unsigned StackTop

Definition at line 68 of file X86FloatingPoint.cpp.

unsigned to

Definition at line 283 of file X86FloatingPoint.cpp.