LLVM: lib/Target/X86/X86Subtarget.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

37

38#if defined(_MSC_VER)

39#include <intrin.h>

40#endif

41

42using namespace llvm;

43

44#define DEBUG_TYPE "subtarget"

45

46#define GET_SUBTARGETINFO_TARGET_DESC

47#define GET_SUBTARGETINFO_CTOR

48#include "X86GenSubtargetInfo.inc"

49

50

51

54 cl::desc("Enable early if-conversion on X86"));

55

56

57

58

62

63

64

65unsigned char

69

70unsigned char

73

74

75

78

79

82

84

87 "Tiny codesize model not supported on X86");

88

89

92

93 if (GV)

95

96

97

99 }

100

101

102

104 }

105

106

109

111

112

113

114

117

119 }

120

122}

123

125 const Module &M) const {

126

129

130

131 if (GV) {

133

134

135

136 if (CR->getUnsignedMax().ult(128))

138 else

140 }

141 }

142

143 if (TM.shouldAssumeDSOLocal(GV))

145

147

148 if (!GV)

153 }

154

157

159

160

161

164

165

166

167 if (AllowTaggedGlobals && GV && isa<Function>(GV))

170 }

171

176 }

177

178

179

183}

184

185unsigned char

189

190unsigned char

192 const Module &M) const {

193 if (TM.shouldAssumeDSOLocal(GV))

195

196

197

198

199

201 if (!GV)

206 }

207

209

212

213

214

216

217 if (((F && F->hasFnAttribute(Attribute::NonLazyBind)) ||

218 (F && M.getRtLibUseGOT())) &&

221

225 }

226

228 if (F && F->hasFnAttribute(Attribute::NonLazyBind))

229

230

231

234 }

235

237}

238

239

241

242

243

245 return false;

247}

248

249void X86Subtarget::initSubtargetFeatures(StringRef CPU, StringRef TuneCPU,

251 if (CPU.empty())

252 CPU = "generic";

253

254 if (TuneCPU.empty())

255 TuneCPU = "i586";

256

258 assert(!FullFS.empty() && "Failed to parse X86 triple");

259

260 if (!FS.empty())

261 FullFS = (Twine(FullFS) + "," + FS).str();

262

263

264 StringRef FeaturesIn64BitOnly[] = {

265 "egpr", "push2pop2", "ppx", "ndd", "ccmp", "nf", "cf", "zu", "uintr"};

266 if (FullFS.find("-64bit-mode") != std:🧵:npos)

267 for (StringRef F : FeaturesIn64BitOnly)

268 FullFS += ",-" + F.str();

269

270

272

273

274

275

276

277 if (hasSSE42() || hasSSE4A())

278 IsUnalignedMem16Slow = false;

279

280 LLVM_DEBUG(dbgs() << "Subtarget features: SSELevel " << X86SSELevel

281 << ", MMX " << HasMMX << ", 64bit " << HasX86_64 << "\n");

282 if (Is64Bit && !HasX86_64)

284 "support it!");

285

286

287

288

289 if (StackAlignOverride)

290 stackAlignment = *StackAlignOverride;

293 stackAlignment = Align(16);

294

295

296 if (PreferVectorWidthOverride)

297 PreferVectorWidth = PreferVectorWidthOverride;

298 else if (Prefer128Bit)

299 PreferVectorWidth = 128;

300 else if (Prefer256Bit)

301 PreferVectorWidth = 256;

302}

303

307 initSubtargetFeatures(CPU, TuneCPU, FS);

308 return *this;

309}

310

314 unsigned PreferVectorWidthOverride,

315 unsigned RequiredVectorWidth)

317 PICStyle(PICStyles::Style::None), TM(TM), TargetTriple(TT),

318 StackAlignOverride(StackAlignOverride),

319 PreferVectorWidthOverride(PreferVectorWidthOverride),

320 RequiredVectorWidth(RequiredVectorWidth),

321 InstrInfo(initializeSubtargetDependencies(CPU, TuneCPU, FS)),

323

325

326

336

339

341 RegBankInfo.reset(RBI);

343}

344

345

347

349 return CallLoweringInfo.get();

350}

351

353 return InstSelector.get();

354}

355

357 return Legalizer.get();

358}

359

361 return RegBankInfo.get();

362}

363

367

369 std::vector<std::unique_ptr> &Mutations) const {

371}

372

374 return TM.isPositionIndependent();

375}

assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")

This file contains the simple types necessary to represent the attributes associated with functions a...

This file describes how to lower LLVM calls to machine code calls.

Module.h This file contains the declarations for the Module class.

This file describes how to lower LLVM calls to machine code calls.

static bool is64Bit(const char *name)

This file declares the targeting of the Machinelegalizer class for X86.

This file declares the targeting of the RegisterBankInfo class for X86.

static cl::opt< bool > X86EarlyIfConv("x86-early-ifcvt", cl::Hidden, cl::desc("Enable early if-conversion on X86"))

bool hasDLLImportStorageClass() const

bool isDeclarationForLinker() const

Module * getParent()

Get the module that this global value is contained inside of...

LLVM_ABI std::optional< ConstantRange > getAbsoluteSymbolRange() const

If this is an absolute symbol reference, returns the range of the symbol, otherwise returns std::null...

bool hasCommonLinkage() const

A Module instance is used to store all the information related to an LLVM module.

Holds all the information related to register banks.

StringRef - Represent a constant reference to a string, i.e.

constexpr bool empty() const

empty - Check if the string is empty.

Triple - Helper class for working with autoconf configuration names.

Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...

This class provides the information for the target register banks.

bool enableEarlyIfConversion() const override

Definition X86Subtarget.cpp:364

bool isTargetKFreeBSD() const

InstructionSelector * getInstructionSelector() const override

Definition X86Subtarget.cpp:352

const X86TargetLowering * getTargetLowering() const override

bool isLegalToCallImmediateAddr() const

Return true if the subtarget allows calls to immediate address.

Definition X86Subtarget.cpp:240

bool isTargetDarwin() const

const RegisterBankInfo * getRegBankInfo() const override

Definition X86Subtarget.cpp:360

bool isTargetCOFF() const

Align getStackAlignment() const

Returns the minimum alignment known to hold of the stack frame on entry to the function and which mus...

unsigned char classifyGlobalReference(const GlobalValue *GV, const Module &M) const

Definition X86Subtarget.cpp:124

const LegalizerInfo * getLegalizerInfo() const override

Definition X86Subtarget.cpp:356

bool isPositionIndependent() const

Definition X86Subtarget.cpp:373

unsigned char classifyLocalReference(const GlobalValue *GV) const

Classify a global variable reference for the current subtarget according to how we should reference i...

Definition X86Subtarget.cpp:71

unsigned char classifyBlockAddressReference() const

Classify a blockaddress reference for the current subtarget according to how we should reference it i...

Definition X86Subtarget.cpp:59

const X86RegisterInfo * getRegisterInfo() const override

void setPICStyle(PICStyles::Style Style)

X86Subtarget(const Triple &TT, StringRef CPU, StringRef TuneCPU, StringRef FS, const X86TargetMachine &TM, MaybeAlign StackAlignOverride, unsigned PreferVectorWidthOverride, unsigned RequiredVectorWidth)

This constructor initializes the data members to match that of the specified triple.

Definition X86Subtarget.cpp:311

const CallLowering * getCallLowering() const override

Methods used by Global ISel.

Definition X86Subtarget.cpp:348

void ParseSubtargetFeatures(StringRef CPU, StringRef TuneCPU, StringRef FS)

ParseSubtargetFeatures - Parses features string setting specified subtarget options.

void getPostRAMutations(std::vector< std::unique_ptr< ScheduleDAGMutation > > &Mutations) const override

Definition X86Subtarget.cpp:368

bool isTargetHurd() const

bool isTargetWin32() const

unsigned char classifyGlobalFunctionReference(const GlobalValue *GV, const Module &M) const

Classify a global function reference for the current subtarget.

Definition X86Subtarget.cpp:191

bool isTargetLinux() const

@ X86_RegCall

Register calling convention used for parameters transfer optimization.

The X86 backend supports a number of different styles of PIC.

@ MO_GOTPCREL_NORELAX

MO_GOTPCREL_NORELAX - Same as MO_GOTPCREL except that R_X86_64_GOTPCREL relocations are guaranteed to...

@ MO_GOTOFF

MO_GOTOFF - On a symbol operand this indicates that the immediate is the offset to the location of th...

@ MO_DARWIN_NONLAZY_PIC_BASE

MO_DARWIN_NONLAZY_PIC_BASE - On a symbol operand "FOO", this indicates that the reference is actually...

@ MO_COFFSTUB

MO_COFFSTUB - On a symbol operand "FOO", this indicates that the reference is actually to the "....

@ MO_DARWIN_NONLAZY

MO_DARWIN_NONLAZY - On a symbol operand "FOO", this indicates that the reference is actually to the "...

@ MO_GOT

MO_GOT - On a symbol operand this indicates that the immediate is the offset to the GOT entry for the...

@ MO_ABS8

MO_ABS8 - On a symbol operand this indicates that the symbol is known to be an absolute symbol in ran...

@ MO_PLT

MO_PLT - On a symbol operand this indicates that the immediate is offset to the PLT entry of symbol n...

@ MO_NO_FLAG

MO_NO_FLAG - No flag for the operand.

@ MO_DLLIMPORT

MO_DLLIMPORT - On a symbol operand "FOO", this indicates that the reference is actually to the "__imp...

@ MO_PIC_BASE_OFFSET

MO_PIC_BASE_OFFSET - On a symbol operand this indicates that the immediate should get the value of th...

@ MO_GOTPCREL

MO_GOTPCREL - On a symbol operand this indicates that the immediate is offset to the GOT entry for th...

std::string ParseX86Triple(const Triple &TT)

This is an optimization pass for GlobalISel generic memory operations.

auto dyn_cast_or_null(const Y &Val)

std::unique_ptr< ScheduleDAGMutation > createX86MacroFusionDAGMutation()

Note that you have to add: DAG.addMutation(createX86MacroFusionDAGMutation()); to X86TargetMachine::c...

LLVM_ABI raw_ostream & dbgs()

dbgs() - This returns a reference to a raw_ostream for debugging messages.

bool isa(const From &Val)

isa - Return true if the parameter to the template is an instance of one of the template type argu...

InstructionSelector * createX86InstructionSelector(const X86TargetMachine &TM, const X86Subtarget &, const X86RegisterBankInfo &)

LLVM_ABI void reportFatalUsageError(Error Err)

Report a fatal error that does not indicate a bug in LLVM.

This struct is a compact representation of a valid (non-zero power of two) alignment.

This struct is a compact representation of a valid (power of two) or undefined (0) alignment.