LLVM 22.0.0git
X86FloatingPoint.cpp File Reference

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")
 INITIALIZE_PASS_BEGIN (FPS, DEBUG_TYPE, "X86 FP Stackifier", false, false) INITIALIZE_PASS_END(FPS
static unsigned getFPReg (const MachineOperand &MO)
 getFPReg - Return the X86::FPx register number for the specified operand.
static int Lookup (ArrayRef< TableEntry > Table, unsigned Opcode)
static unsigned getConcreteOpcode (unsigned Opcode)
static bool doesInstructionSetFPSW (MachineInstr &MI)
static MachineBasicBlock::iterator getNextFPInstruction (MachineBasicBlock::iterator I)

Variables

 DEBUG_TYPE
X86 FP Stackifier
X86 FP false
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 std::atomic<bool> TABLE##Checked(false); \
if (!TABLE##Checked.load(std::memory_order_relaxed)) { \
assert(is_sorted(TABLE) && \
"All lookup tables must be sorted for efficient access!"); \
TABLE##Checked.store(true, std::memory_order_relaxed); \
} \
}
bool is_sorted(R &&Range, Compare C)
Wrapper function around std::is_sorted to check if elements in a range R are sorted with respect to a...
Definition STLExtras.h:1900

Definition at line 622 of file X86FloatingPoint.cpp.

Referenced by getConcreteOpcode().

◆ DEBUG_TYPE

#define DEBUG_TYPE   "x86-codegen"

Definition at line 51 of file X86FloatingPoint.cpp.

Function Documentation

◆ doesInstructionSetFPSW()

bool doesInstructionSetFPSW ( MachineInstr & MI)
static

Definition at line 848 of file X86FloatingPoint.cpp.

References llvm::MachineOperand::isDead(), and MI.

◆ getConcreteOpcode()

unsigned getConcreteOpcode ( unsigned Opcode)
static

Definition at line 806 of file X86FloatingPoint.cpp.

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

◆ getFPReg()

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 313 of file X86FloatingPoint.cpp.

References assert(), llvm::MachineOperand::getReg(), llvm::MachineOperand::isReg(), and Reg.

◆ getNextFPInstruction()

MachineBasicBlock::iterator getNextFPInstruction ( MachineBasicBlock::iterator I)
static

Definition at line 857 of file X86FloatingPoint.cpp.

References I, llvm::X86::isX87Instruction(), MBB, and MI.

◆ INITIALIZE_PASS_BEGIN()

INITIALIZE_PASS_BEGIN ( FPS ,
DEBUG_TYPE ,
"X86 FP Stackifier" ,
false ,
false  )

◆ Lookup()

◆ STATISTIC() [1/2]

STATISTIC ( NumFP ,
"Number of floating point instructions"  )

◆ STATISTIC() [2/2]

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

Variable Documentation

◆ DEBUG_TYPE

DEBUG_TYPE

Definition at line 306 of file X86FloatingPoint.cpp.

◆ false

X86 FP false

Definition at line 307 of file X86FloatingPoint.cpp.

◆ 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 1295 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 1327 of file X86FloatingPoint.cpp.

◆ OpcodeTable

const TableEntry OpcodeTable[]
static

Definition at line 641 of file X86FloatingPoint.cpp.

Referenced by getConcreteOpcode().

◆ PopTable

const TableEntry PopTable[]
static
Initial value:
= {
{ X86::ADD_FrST0 , X86::ADD_FPrST0 },
{ X86::COMP_FST0r, X86::FCOMPP },
{ X86::COM_FIr , X86::COM_FIPr },
{ X86::COM_FST0r , X86::COMP_FST0r },
{ 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 820 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 1311 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 1343 of file X86FloatingPoint.cpp.

◆ Stackifier

X86 FP Stackifier

Definition at line 306 of file X86FloatingPoint.cpp.