LLVM 23.0.0git
AArch64CodeLayoutOpt.cpp File Reference

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "aarch64-code-layout-opt"
#define DBG(...)
#define AARCH64_CODE_LAYOUT_OPT_NAME   "AArch64 Code Layout Optimization"

Enumerations

enum  CodeLayoutOpt { CmpCsel , FcmpFcsel }

Functions

 STATISTIC (NumFunctionsAligned, "Number of functions with aligned (to 64-bytes by default)")
 STATISTIC (NumCmpCselPairsDetected, "Number of CMP/CMN-CSEL pairs detected for alignment")
 STATISTIC (NumFcmpFcselPairsDetected, "Number of FCMP-FCSEL pairs detected for alignment")
 INITIALIZE_PASS (AArch64CodeLayoutOpt, "aarch64-code-layout-opt", AARCH64_CODE_LAYOUT_OPT_NAME, false, false) void AArch64CodeLayoutOpt
static bool isFloatingPointCompare (unsigned Opc)
static bool isFloatingPointConditionalSelect (unsigned Opc)
static bool isQualifyingIntCompare (const MachineInstr &MI)

Variables

static cl::bits< CodeLayoutOptEnableCodeAlignment ("aarch64-code-layout-opt-enable", cl::Hidden, cl::CommaSeparated, cl::desc("Enable code alignment optimization for instruction pairs"), cl::values(clEnumValN(CmpCsel, "cmp-csel", "CMP/CMN-CSEL pair alignment (32-bit)"), clEnumValN(FcmpFcsel, "fcmp-fcsel", "FCMP-FCSEL pair alignment")))
static cl::opt< unsignedFunctionAlignBytes ("aarch64-code-layout-opt-align-functions", cl::Hidden, cl::desc("Function alignment in bytes for code layout optimization " "(must be a power of 2)"), cl::init(64), cl::callback([](const unsigned &Val) { if(!isPowerOf2_32(Val)) report_fatal_error("aarch64-code-layout-opt-align must be a power of 2");}))

Macro Definition Documentation

◆ AARCH64_CODE_LAYOUT_OPT_NAME

#define AARCH64_CODE_LAYOUT_OPT_NAME   "AArch64 Code Layout Optimization"

Definition at line 37 of file AArch64CodeLayoutOpt.cpp.

Referenced by INITIALIZE_PASS().

◆ DBG

#define DBG ( ...)
Value:
LLVM_DEBUG(dbgs() << DEBUG_TYPE ": " << __VA_ARGS__)
#define DEBUG_TYPE
#define LLVM_DEBUG(...)
Definition Debug.h:114
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
Definition Debug.cpp:207

Definition at line 36 of file AArch64CodeLayoutOpt.cpp.

◆ DEBUG_TYPE

#define DEBUG_TYPE   "aarch64-code-layout-opt"

Definition at line 35 of file AArch64CodeLayoutOpt.cpp.

Enumeration Type Documentation

◆ CodeLayoutOpt

Enumerator
CmpCsel 
FcmpFcsel 

Definition at line 39 of file AArch64CodeLayoutOpt.cpp.

Function Documentation

◆ INITIALIZE_PASS()

INITIALIZE_PASS ( AArch64CodeLayoutOpt ,
"aarch64-code-layout-opt" ,
AARCH64_CODE_LAYOUT_OPT_NAME ,
false ,
false  )

◆ isFloatingPointCompare()

bool isFloatingPointCompare ( unsigned Opc)
static
Returns
true iff Opc is a floating-point comparison (FCMP/FCMPE).

Definition at line 112 of file AArch64CodeLayoutOpt.cpp.

References Opc.

◆ isFloatingPointConditionalSelect()

bool isFloatingPointConditionalSelect ( unsigned Opc)
static
Returns
true iff Opc is a floating-point conditional select (FCSEL).

Definition at line 127 of file AArch64CodeLayoutOpt.cpp.

References Opc.

◆ isQualifyingIntCompare()

bool isQualifyingIntCompare ( const MachineInstr & MI)
static
Returns
true if MI is a qualifying 32-bit CMP or CMN instruction. CMP is encoded as SUBS with WZR destination, CMN as ADDS with WZR. Only simple variants (no shifted/extended reg) qualify, and immediate variants require no LSL shift and small immediates (<=15).

Definition at line 142 of file AArch64CodeLayoutOpt.cpp.

References MI.

◆ STATISTIC() [1/3]

STATISTIC ( NumCmpCselPairsDetected ,
"Number of CMP/CMN-CSEL pairs detected for alignment"  )

◆ STATISTIC() [2/3]

STATISTIC ( NumFcmpFcselPairsDetected ,
"Number of FCMP-FCSEL pairs detected for alignment"  )

◆ STATISTIC() [3/3]

STATISTIC ( NumFunctionsAligned ,
"Number of functions with aligned (to 64-bytes by default)"  )

Variable Documentation

◆ EnableCodeAlignment

cl::bits< CodeLayoutOpt > EnableCodeAlignment("aarch64-code-layout-opt-enable", cl::Hidden, cl::CommaSeparated, cl::desc("Enable code alignment optimization for instruction pairs"), cl::values( clEnumValN(CmpCsel, "cmp-csel", "CMP/CMN-CSEL pair alignment (32-bit)"), clEnumValN(FcmpFcsel, "fcmp-fcsel", "FCMP-FCSEL pair alignment"))) ( "aarch64-code-layout-opt-enable" ,
cl::Hidden ,
cl::CommaSeparated ,
cl::desc("Enable code alignment optimization for instruction pairs") ,
cl::values( clEnumValN(CmpCsel, "cmp-csel", "CMP/CMN-CSEL pair alignment (32-bit)"), clEnumValN(FcmpFcsel, "fcmp-fcsel", "FCMP-FCSEL pair alignment"))  )
static

◆ FunctionAlignBytes

cl::opt< unsigned > FunctionAlignBytes("aarch64-code-layout-opt-align-functions", cl::Hidden, cl::desc("Function alignment in bytes for code layout optimization " "(must be a power of 2)"), cl::init(64), cl::callback([](const unsigned &Val) { if(!isPowerOf2_32(Val)) report_fatal_error( "aarch64-code-layout-opt-align must be a power of 2"); })) ( "aarch64-code-layout-opt-align-functions" ,
cl::Hidden ,
cl::desc("Function alignment in bytes for code layout optimization " "(must be a power of 2)") ,
cl::init(64) ,
cl::callback([](const unsigned &Val) { if(!isPowerOf2_32(Val)) report_fatal_error( "aarch64-code-layout-opt-align must be a power of 2"); })  )
static