LLVM  14.0.0git
Macros | Functions | Variables
TargetLoweringBase.cpp File Reference
#include "llvm/ADT/BitVector.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Triple.h"
#include "llvm/ADT/Twine.h"
#include "llvm/Analysis/Loads.h"
#include "llvm/Analysis/TargetTransformInfo.h"
#include "llvm/CodeGen/Analysis.h"
#include "llvm/CodeGen/ISDOpcodes.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/CodeGen/MachineMemOperand.h"
#include "llvm/CodeGen/MachineOperand.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/RuntimeLibcalls.h"
#include "llvm/CodeGen/StackMaps.h"
#include "llvm/CodeGen/TargetLowering.h"
#include "llvm/CodeGen/TargetOpcodes.h"
#include "llvm/CodeGen/TargetRegisterInfo.h"
#include "llvm/CodeGen/ValueTypes.h"
#include "llvm/IR/Attributes.h"
#include "llvm/IR/CallingConv.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/GlobalValue.h"
#include "llvm/IR/GlobalVariable.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/Type.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/MachineValueType.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetOptions.h"
#include "llvm/Transforms/Utils/SizeOpts.h"
#include <algorithm>
#include <cassert>
#include <cstddef>
#include <cstdint>
#include <cstring>
#include <iterator>
#include <string>
#include <tuple>
#include <utility>
#include "llvm/IR/RuntimeLibcalls.def"
#include "llvm/IR/ConstrainedOps.def"
#include "llvm/IR/Instruction.def"

Go to the source code of this file.

Macros

#define HANDLE_LIBCALL(code, name)   setLibcallName(RTLIB::code, name);
 
#define LCALLS(A, B)   { A##B##_RELAX, A##B##_ACQ, A##B##_REL, A##B##_ACQ_REL }
 
#define LCALL5(A)   LCALLS(A, 1), LCALLS(A, 2), LCALLS(A, 4), LCALLS(A, 8), LCALLS(A, 16)
 
#define OP_TO_LIBCALL(Name, Enum)
 
#define DAG_INSTRUCTION(NAME, NARG, ROUND_MODE, INTRINSIC, DAGN)   setOperationAction(ISD::STRICT_##DAGN, VT, Expand);
 
#define HANDLE_INST(NUM, OPCODE, CLASS)   OPCODE = NUM,
 
#define LAST_OTHER_INST(NUM)   InstructionOpcodesCount = NUM
 

Functions

static bool darwinHasSinCos (const Triple &TT)
 
static void InitCmpLibcallCCs (ISD::CondCode *CCs)
 InitCmpLibcallCCs - Set default comparison libcall CC. More...
 
static unsigned getVectorTypeBreakdownMVT (MVT VT, MVT &IntermediateVT, unsigned &NumIntermediates, MVT &RegisterVT, TargetLoweringBase *TLI)
 
static StringRef getRecipEstimateForFunc (MachineFunction &MF)
 Get the reciprocal estimate attribute string for a function that will override the target defaults. More...
 
static std::string getReciprocalOpName (bool IsSqrt, EVT VT)
 Construct a string for the given reciprocal operation of the given type. More...
 
static bool parseRefinementStep (StringRef In, size_t &Position, uint8_t &Value)
 Return the character position and value (a single numeric character) of a customized refinement operation in the input string if it exists. More...
 
static int getOpEnabled (bool IsSqrt, EVT VT, StringRef Override)
 For the input attribute string, return one of the ReciprocalEstimate enum status values (enabled, disabled, or not specified) for this operation on the specified data type. More...
 
static int getOpRefinementSteps (bool IsSqrt, EVT VT, StringRef Override)
 For the input attribute string, return the customized refinement step count for this operation on the specified data type. More...
 

Variables

static cl::opt< bool > JumpIsExpensiveOverride ("jump-is-expensive", cl::init(false), cl::desc("Do not create extra branches to split comparison logic."), cl::Hidden)
 
static cl::opt< unsigned > MinimumJumpTableEntries ("min-jump-table-entries", cl::init(4), cl::Hidden, cl::desc("Set minimum number of entries to use a jump table."))
 
static cl::opt< unsigned > MaximumJumpTableSize ("max-jump-table-size", cl::init(UINT_MAX), cl::Hidden, cl::desc("Set maximum size of jump tables."))
 
static cl::opt< unsigned > JumpTableDensity ("jump-table-density", cl::init(10), cl::Hidden, cl::desc("Minimum density for building a jump table in " "a normal function"))
 Minimum jump table density for normal functions. More...
 
static cl::opt< unsigned > OptsizeJumpTableDensity ("optsize-jump-table-density", cl::init(40), cl::Hidden, cl::desc("Minimum density for building a jump table in " "an optsize function"))
 Minimum jump table density for -Os or -Oz functions. More...
 
static cl::opt< bool > DisableStrictNodeMutation ("disable-strictnode-mutation", cl::desc("Don't mutate strict-float node to a legalize node"), cl::init(false), cl::Hidden)
 

Macro Definition Documentation

◆ DAG_INSTRUCTION

#define DAG_INSTRUCTION (   NAME,
  NARG,
  ROUND_MODE,
  INTRINSIC,
  DAGN 
)    setOperationAction(ISD::STRICT_##DAGN, VT, Expand);

◆ HANDLE_INST

#define HANDLE_INST (   NUM,
  OPCODE,
  CLASS 
)    OPCODE = NUM,

◆ HANDLE_LIBCALL

#define HANDLE_LIBCALL (   code,
  name 
)    setLibcallName(RTLIB::code, name);

◆ LAST_OTHER_INST

#define LAST_OTHER_INST (   NUM)    InstructionOpcodesCount = NUM

◆ LCALL5

#define LCALL5 (   A)    LCALLS(A, 1), LCALLS(A, 2), LCALLS(A, 4), LCALLS(A, 8), LCALLS(A, 16)

◆ LCALLS

#define LCALLS (   A,
  B 
)    { A##B##_RELAX, A##B##_ACQ, A##B##_REL, A##B##_ACQ_REL }

◆ OP_TO_LIBCALL

#define OP_TO_LIBCALL (   Name,
  Enum 
)
Value:
case Name: \
switch (VT.SimpleTy) { \
default: \
return UNKNOWN_LIBCALL; \
case MVT::i8: \
return Enum##_1; \
case MVT::i16: \
return Enum##_2; \
case MVT::i32: \
return Enum##_4; \
case MVT::i64: \
return Enum##_8; \
case MVT::i128: \
return Enum##_16; \
}

Function Documentation

◆ darwinHasSinCos()

static bool darwinHasSinCos ( const Triple TT)
static

Definition at line 102 of file TargetLoweringBase.cpp.

References assert(), and llvm::Triple::x86.

◆ getOpEnabled()

static int getOpEnabled ( bool  IsSqrt,
EVT  VT,
StringRef  Override 
)
static

For the input attribute string, return one of the ReciprocalEstimate enum status values (enabled, disabled, or not specified) for this operation on the specified data type.

Definition at line 2101 of file TargetLoweringBase.cpp.

References llvm::TailPredication::Disabled, llvm::StringRef::empty(), Enabled, getReciprocalOpName(), parseRefinementStep(), llvm::StringRef::split(), and llvm::StringRef::substr().

Referenced by llvm::TargetLoweringBase::getRecipEstimateDivEnabled(), and llvm::TargetLoweringBase::getRecipEstimateSqrtEnabled().

◆ getOpRefinementSteps()

static int getOpRefinementSteps ( bool  IsSqrt,
EVT  VT,
StringRef  Override 
)
static

For the input attribute string, return the customized refinement step count for this operation on the specified data type.

If the step count does not exist, return the ReciprocalEstimate enum value for unspecified.

Definition at line 2161 of file TargetLoweringBase.cpp.

References assert(), llvm::StringRef::empty(), getReciprocalOpName(), parseRefinementStep(), llvm::StringRef::split(), and llvm::StringRef::substr().

Referenced by llvm::TargetLoweringBase::getDivRefinementSteps(), and llvm::TargetLoweringBase::getSqrtRefinementSteps().

◆ getRecipEstimateForFunc()

static StringRef getRecipEstimateForFunc ( MachineFunction MF)
static

◆ getReciprocalOpName()

static std::string getReciprocalOpName ( bool  IsSqrt,
EVT  VT 
)
static

Construct a string for the given reciprocal operation of the given type.

This string should match the corresponding option to the front-end's "-mrecip" flag assuming those strings have been passed through in an attribute string. For example, "vec-divf" for a division of a vXf32.

Definition at line 2058 of file TargetLoweringBase.cpp.

References assert(), llvm::MVT::f32, llvm::MVT::f64, llvm::EVT::getScalarType(), and llvm::EVT::isVector().

Referenced by getOpEnabled(), and getOpRefinementSteps().

◆ getVectorTypeBreakdownMVT()

static unsigned getVectorTypeBreakdownMVT ( MVT  VT,
MVT IntermediateVT,
unsigned &  NumIntermediates,
MVT RegisterVT,
TargetLoweringBase TLI 
)
static

◆ InitCmpLibcallCCs()

static void InitCmpLibcallCCs ( ISD::CondCode CCs)
static

InitCmpLibcallCCs - Set default comparison libcall CC.

Definition at line 664 of file TargetLoweringBase.cpp.

References llvm::ISD::SETCC_INVALID, llvm::ISD::SETEQ, llvm::ISD::SETGE, llvm::ISD::SETGT, llvm::ISD::SETLE, llvm::ISD::SETLT, and llvm::ISD::SETNE.

Referenced by llvm::TargetLoweringBase::TargetLoweringBase().

◆ parseRefinementStep()

static bool parseRefinementStep ( StringRef  In,
size_t &  Position,
uint8_t &  Value 
)
static

Return the character position and value (a single numeric character) of a customized refinement operation in the input string if it exists.

Return false if there is no customized refinement step count.

Definition at line 2078 of file TargetLoweringBase.cpp.

References llvm::tgtok::In, isDigit(), llvm::StringRef::npos, llvm::report_fatal_error(), and llvm::StringRef::size().

Referenced by getOpEnabled(), and getOpRefinementSteps().

Variable Documentation

◆ DisableStrictNodeMutation

cl::opt<bool> DisableStrictNodeMutation("disable-strictnode-mutation", cl::desc("Don't mutate strict-float node to a legalize node"), cl::init(false), cl::Hidden)
static

◆ JumpIsExpensiveOverride

cl::opt<bool> JumpIsExpensiveOverride("jump-is-expensive", cl::init(false), cl::desc("Do not create extra branches to split comparison logic."), cl::Hidden)
static

◆ JumpTableDensity

cl::opt<unsigned> JumpTableDensity("jump-table-density", cl::init(10), cl::Hidden, cl::desc("Minimum density for building a jump table in " "a normal function"))
static

Minimum jump table density for normal functions.

Referenced by llvm::TargetLoweringBase::getMinimumJumpTableDensity().

◆ MaximumJumpTableSize

cl::opt<unsigned> MaximumJumpTableSize("max-jump-table-size", cl::init(UINT_MAX), cl::Hidden, cl::desc("Set maximum size of jump tables."))
static

◆ MinimumJumpTableEntries

cl::opt<unsigned> MinimumJumpTableEntries("min-jump-table-entries", cl::init(4), cl::Hidden, cl::desc("Set minimum number of entries to use a jump table."))
static

◆ OptsizeJumpTableDensity

cl::opt<unsigned> OptsizeJumpTableDensity("optsize-jump-table-density", cl::init(40), cl::Hidden, cl::desc("Minimum density for building a jump table in " "an optsize function"))
static

Minimum jump table density for -Os or -Oz functions.

Referenced by llvm::TargetLoweringBase::getMinimumJumpTableDensity().

i8
Clang compiles this i8
Definition: README.txt:504
i64
Clang compiles this i64
Definition: README.txt:504
i32
Common register allocation spilling lr str ldr sxth r3 ldr mla r4 can lr mov lr str ldr sxth r3 mla r4 and then merge mul and lr str ldr sxth r3 mla r4 It also increase the likelihood the store may become dead bb27 Successors according to LLVM ID Predecessors according to mbb< bb27, 0x8b0a7c0 > Note ADDri is not a two address instruction its result reg1037 is an operand of the PHI node in bb76 and its operand reg1039 is the result of the PHI node We should treat it as a two address code and make sure the ADDri is scheduled after any node that reads reg1039 Use info(i.e. register scavenger) to assign it a free register to allow reuse the collector could move the objects and invalidate the derived pointer This is bad enough in the first but safe points can crop up unpredictably **array_addr i32
Definition: README.txt:122
i16
< i32 > ret i32 conv5 And the following x86 eax movsbl ecx cmpl ecx sete al movzbl eax ret It should be possible to eliminate the sign extensions LLVM misses a load store narrowing opportunity in this i16
Definition: README.txt:1493
llvm::pdb::PDB_SymType::Enum
@ Enum
llvm::GraphProgram::Name
Name
Definition: GraphWriter.h:52