clang: lib/CodeGen/TargetInfo.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

14#ifndef LLVM_CLANG_LIB_CODEGEN_TARGETINFO_H

15#define LLVM_CLANG_LIB_CODEGEN_TARGETINFO_H

16

24#include "llvm/ADT/SmallString.h"

25#include "llvm/ADT/StringRef.h"

26

27namespace llvm {

28class Constant;

29class GlobalValue;

32}

33

36

37namespace CodeGen {

38class ABIInfo;

39class CallArgList;

40class CodeGenFunction;

41class CGBlockInfo;

42class SwiftABIInfo;

43

44

45

46

48 std::unique_ptr Info;

49

50protected:

51

52

53

55

56

57 template const T &getABIInfo() const {

58 return static_cast<const T &>(*Info);

59 }

60

61public:

64

65

67

68

70 assert(SwiftInfo && "Swift ABI info has not been initialized");

72 }

73

74

75

78

79

80

83 const llvm::MapVector<GlobalDecl, StringRef> &MangledDeclNames) const {}

84

85

87

88

89

92

93

94

100

101

102

103

104

105

106

107

108

109

110

111

112

113 virtual bool

116 return false;

117 }

118

119

120

121

122

123

124

125

126

128

129

130

131

132

133

134

135

137

138

139

140

141

143 return -1;

144 }

145

146

147

148

149

151 llvm::Value *Address) const {

152 return true;

153 }

154

155

156

157

158

159

161 llvm::Value *Address) const {

163 }

164

165

166

167

168

169

171 llvm::Value *Address) const {

173 }

174

175

176

177

178 virtual llvm::Value *

181 assert(V->getType()->isFloatingPointTy() && "V should have an FP type.");

182 return nullptr;

183 }

184

185

186

187

188

189

191 StringRef Constraint,

192 llvm::Type *Ty) const {

193 return Ty;

194 }

195

196

197

199 llvm::Type *Ty) const {

200 return false;

201 }

202

203

206 std::string &Constraints, std::vector<llvm::Type *> &ResultRegTypes,

207 std::vector<llvm::Type *> &ResultTruncRegTypes,

208 std::vectorCodeGen::LValue &ResultRegDests, std::string &AsmString,

209 unsigned NumOutputs) const {}

210

211

212

214

215

216

217

218

219

220

221

222

223

224

226 return "";

227 }

228

229

230

232

233

234

235

236 virtual llvm::Constant *

238 return llvm::ConstantInt::get(CGM.Int32Ty, 0xc105cafe);

239 }

240

241

242

243

244

245

246

247

248

249

250

251

252

253

254

255

256

257

258

259

260

261

262

263

264

265

266

267

268

269

270

271

272

273

274

275

276

277

278

279

280

281

282

285

286

287

290

291

292

294 llvm::StringRef Value,

296

297

299

300

301

302

303

304

306 llvm::PointerType *T, QualType QT) const;

307

308

309

310

311

314

315

317

320 llvm::Type *DestTy,

321 bool IsNonNull = false) const;

322

323

324

325

326

327

328

330 llvm::Value *V, LangAS SrcAddr,

331 LangAS DestAddr, llvm::Type *DestTy,

332 bool IsNonNull = false) const;

333

334

335

336

337

338

340 llvm::Constant *V,

342 llvm::Type *DestTy) const;

343

344

347 }

348

349

352 llvm::AtomicOrdering Ordering,

353 llvm::LLVMContext &Ctx) const;

354

355

357 llvm::Instruction &AtomicInst,

359 }

360

361

363 public:

364 typedef std::pair<llvm::Value *, StringRef> ValueTy;

367

369

373

374

377 };

379 return nullptr;

380 }

381

382

383

384

385

386

387 virtual llvm::Value *

389 llvm::Function *BlockInvokeFunc,

390 llvm::Type *BlockTy) const;

391

392

393

394

396

397

398

399

401

403

404

406

407 return nullptr;

408 }

409

411

412 return nullptr;

413 }

414

415

417

418

420

421

425

426 return false;

427 }

428

432

433 return false;

434 }

435

436

438 return nullptr;

439 }

440

441

443 return nullptr;

444 }

445

446

447

448 static void

450 llvm::Function &F);

451

452

453 static void

455 llvm::AttrBuilder &FuncAttrs);

456

457protected:

459

462};

463

464std::unique_ptr

466

473};

474

475std::unique_ptr

477

478std::unique_ptr

480

481std::unique_ptr

483

484std::unique_ptr

486

492};

493

494std::unique_ptr

496

497std::unique_ptr

499

500std::unique_ptr

502

503std::unique_ptr

505

506std::unique_ptr

508

509std::unique_ptr

511

512std::unique_ptr

514

515std::unique_ptr

517 unsigned FLen);

518

519std::unique_ptr

521

522std::unique_ptr

524

525std::unique_ptr

527

528std::unique_ptr

530

531std::unique_ptr

533

537};

538

539std::unique_ptr

541

542std::unique_ptr

544

545std::unique_ptr

547

548std::unique_ptr

550 bool SoftFloatABI);

551

552std::unique_ptr

554 bool EABI);

555

556std::unique_ptr

558

559std::unique_ptr

561

562std::unique_ptr

564

565std::unique_ptr

567

568std::unique_ptr

570 bool SoftFloatABI);

571

572std::unique_ptr

574

575std::unique_ptr

577

578std::unique_ptr

580

584};

585

586std::unique_ptr

588

589

594};

595

597 CodeGenModule &CGM, bool DarwinVectorABI, bool Win32StructABI,

598 unsigned NumRegisterParameters, bool SoftFloatABI);

599

600std::unique_ptr

602 bool Win32StructABI,

603 unsigned NumRegisterParameters);

604

605std::unique_ptr

607

608std::unique_ptr

610

611std::unique_ptr

613

614}

615}

616

617#endif

enum clang::sema::@1725::IndirectLocalPathEntry::EntryKind Kind

Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.

Provides definitions for the atomic synchronization scopes.

C Language Family Type Representation.

AtomicExpr - Variadic atomic builtins: __atomic_exchange, __atomic_fetch_*, __atomic_load,...

ABIInfo - Target specific hooks for defining how a type should be passed or returned from functions.

Like RawAddress, an abstract representation of an aligned address, but the pointer contained in this ...

CGBlockInfo - Information to generate a block literal.

CallArgList - Type for representing both the value and type of arguments in a call.

CodeGenFunction - This class organizes the per-function state that is used while generating LLVM code...

This class organizes the cross-function state that is used while generating LLVM code.

LValue - This represents an lvalue references.

Target specific hooks for defining how a type should be passed or returned from functions with one of...

Interface class for filling custom fields of a block literal for OpenCL.

TargetOpenCLBlockHelper()

virtual llvm::SmallVector< llvm::Type *, 1 > getCustomFieldTypes()=0

Get the custom field types for OpenCL blocks.

virtual ~TargetOpenCLBlockHelper()

virtual llvm::SmallVector< llvm::Constant *, 1 > getCustomFieldValues(CodeGenModule &CGM, const CGBlockInfo &Info)=0

Get the custom field values for OpenCL blocks if all values are LLVM constants.

virtual bool areAllCustomFieldValuesConstant(const CGBlockInfo &Info)=0

virtual llvm::SmallVector< ValueTy, 1 > getCustomFieldValues(CodeGenFunction &CGF, const CGBlockInfo &Info)=0

Get the custom field values for OpenCL blocks.

std::pair< llvm::Value *, StringRef > ValueTy

TargetCodeGenInfo - This class organizes various target-specific codegeneration issues,...

virtual void addReturnRegisterOutputs(CodeGen::CodeGenFunction &CGF, CodeGen::LValue ReturnValue, std::string &Constraints, std::vector< llvm::Type * > &ResultRegTypes, std::vector< llvm::Type * > &ResultTruncRegTypes, std::vector< CodeGen::LValue > &ResultRegDests, std::string &AsmString, unsigned NumOutputs) const

Adds constraints and types for result registers.

virtual bool emitCUDADeviceBuiltinSurfaceDeviceCopy(CodeGenFunction &CGF, LValue Dst, LValue Src) const

Emit the device-side copy of the builtin surface type.

virtual llvm::Type * getWasmFuncrefReferenceType() const

Return the WebAssembly funcref reference type.

virtual unsigned getSizeOfUnwindException() const

Determines the size of struct _Unwind_Exception on this platform, in 8-bit units.

virtual llvm::Type * getWasmExternrefReferenceType() const

Return the WebAssembly externref reference type.

virtual llvm::Type * getOpenCLType(CodeGenModule &CGM, const Type *T) const

Return an LLVM type that corresponds to an OpenCL type.

virtual bool emitCUDADeviceBuiltinTextureDeviceCopy(CodeGenFunction &CGF, LValue Dst, LValue Src) const

Emit the device-side copy of the builtin texture type.

virtual bool doesReturnSlotInterfereWithArgs() const

doesReturnSlotInterfereWithArgs - Return true if the target uses an argument slot for an 'sret' type.

virtual bool wouldInliningViolateFunctionCallABI(const FunctionDecl *Caller, const FunctionDecl *Callee) const

Returns true if inlining the function call would produce incorrect code for the current target and sh...

std::unique_ptr< SwiftABIInfo > SwiftInfo

virtual void setCUDAKernelCallingConvention(const FunctionType *&FT) const

virtual llvm::Type * getCUDADeviceBuiltinSurfaceDeviceType() const

Return the device-side type for the CUDA device builtin surface type.

virtual llvm::Type * adjustInlineAsmType(CodeGen::CodeGenFunction &CGF, StringRef Constraint, llvm::Type *Ty) const

Corrects the low-level LLVM type for a given constraint and "usual" type.

virtual void getDependentLibraryOption(llvm::StringRef Lib, llvm::SmallString< 24 > &Opt) const

Gets the linker options necessary to link a dependent library on this platform.

virtual StringRef getARCRetainAutoreleasedReturnValueMarker() const

Retrieve the address of a function to call immediately before calling objc_retainAutoreleasedReturnVa...

const SwiftABIInfo & getSwiftABIInfo() const

Returns Swift ABI info helper for the target.

Address performAddrSpaceCast(CodeGen::CodeGenFunction &CGF, Address Addr, LangAS SrcAddr, LangAS DestAddr, llvm::Type *DestTy, bool IsNonNull=false) const

virtual llvm::Type * getHLSLType(CodeGenModule &CGM, const Type *T) const

Return an LLVM type that corresponds to a HLSL type.

virtual llvm::Value * encodeReturnAddress(CodeGen::CodeGenFunction &CGF, llvm::Value *Address) const

Performs the code-generation required to convert the address of an instruction into a return address ...

virtual llvm::SyncScope::ID getLLVMSyncScopeID(const LangOptions &LangOpts, SyncScope Scope, llvm::AtomicOrdering Ordering, llvm::LLVMContext &Ctx) const

Get the syncscope used in LLVM IR.

static void setBranchProtectionFnAttributes(const TargetInfo::BranchProtectionInfo &BPI, llvm::Function &F)

virtual void checkFunctionCallABI(CodeGenModule &CGM, SourceLocation CallLoc, const FunctionDecl *Caller, const FunctionDecl *Callee, const CallArgList &Args, QualType ReturnType) const

Any further codegen related checks that need to be done on a function call in a target specific manne...

virtual llvm::Value * decodeReturnAddress(CodeGen::CodeGenFunction &CGF, llvm::Value *Address) const

Performs the code-generation required to convert a return address as stored by the system into the ac...

virtual bool initDwarfEHRegSizeTable(CodeGen::CodeGenFunction &CGF, llvm::Value *Address) const

Initializes the given DWARF EH register-size table, a char*.

const T & getABIInfo() const

virtual unsigned getOpenCLKernelCallingConv() const

Get LLVM calling convention for OpenCL kernel.

virtual LangAS getGlobalVarAddressSpace(CodeGenModule &CGM, const VarDecl *D) const

Get target favored AST address space of a global variable for languages other than OpenCL and CUDA.

virtual void setTargetAttributes(const Decl *D, llvm::GlobalValue *GV, CodeGen::CodeGenModule &M) const

setTargetAttributes - Provides a convenient hook to handle extra target-specific attributes for the g...

virtual llvm::Type * getCUDADeviceBuiltinTextureDeviceType() const

Return the device-side type for the CUDA device builtin texture type.

virtual void checkFunctionABI(CodeGenModule &CGM, const FunctionDecl *Decl) const

Any further codegen related checks that need to be done on a function signature in a target specific ...

virtual bool isScalarizableAsmOperand(CodeGen::CodeGenFunction &CGF, llvm::Type *Ty) const

Target hook to decide whether an inline asm operand can be passed by value.

static std::string qualifyWindowsLibrary(StringRef Lib)

void addStackProbeTargetAttributes(const Decl *D, llvm::GlobalValue *GV, CodeGen::CodeGenModule &CGM) const

const ABIInfo & getABIInfo() const

getABIInfo() - Returns ABI info helper for the target.

virtual bool shouldEmitDWARFBitFieldSeparators() const

virtual LangAS getAddrSpaceOfCxaAtexitPtrParam() const

Get address space of pointer parameter for __cxa_atexit.

virtual bool extendPointerWithSExt() const

Controls whether __builtin_extend_pointer should sign-extend pointers to uint64_t or zero-extend them...

virtual llvm::Constant * getNullPointer(const CodeGen::CodeGenModule &CGM, llvm::PointerType *T, QualType QT) const

Get target specific null pointer.

static void initBranchProtectionFnAttributes(const TargetInfo::BranchProtectionInfo &BPI, llvm::AttrBuilder &FuncAttrs)

virtual TargetOpenCLBlockHelper * getTargetOpenCLBlockHelper() const

virtual LangAS getASTAllocaAddressSpace() const

Get the AST address space for alloca.

virtual int getDwarfEHStackPointer(CodeGen::CodeGenModule &M) const

Determines the DWARF register number for the stack pointer, for exception-handling purposes.

virtual void emitTargetMetadata(CodeGen::CodeGenModule &CGM, const llvm::MapVector< GlobalDecl, StringRef > &MangledDeclNames) const

emitTargetMetadata - Provides a convenient hook to handle extra target-specific metadata for the give...

virtual void setTargetAtomicMetadata(CodeGenFunction &CGF, llvm::Instruction &AtomicInst, const AtomicExpr *Expr=nullptr) const

Allow the target to apply other metadata to an atomic instruction.

virtual llvm::Value * createEnqueuedBlockKernel(CodeGenFunction &CGF, llvm::Function *BlockInvokeFunc, llvm::Type *BlockTy) const

Create an OpenCL kernel for an enqueued block.

virtual llvm::Value * testFPKind(llvm::Value *V, unsigned BuiltinID, CGBuilderTy &Builder, CodeGenModule &CGM) const

Performs a target specific test of a floating point value for things like IsNaN, Infinity,...

virtual bool markARCOptimizedReturnCallsAsNoTail() const

Determine whether a call to objc_retainAutoreleasedReturnValue or objc_unsafeClaimAutoreleasedReturnV...

virtual void emitTargetGlobals(CodeGen::CodeGenModule &CGM) const

Provides a convenient hook to handle extra target-specific globals.

virtual ~TargetCodeGenInfo()

virtual void getDetectMismatchOption(llvm::StringRef Name, llvm::StringRef Value, llvm::SmallString< 32 > &Opt) const

Gets the linker options necessary to detect object file mismatches on this platform.

virtual llvm::Constant * getUBSanFunctionSignature(CodeGen::CodeGenModule &CGM) const

Return a constant used by UBSan as a signature to identify functions possessing type information,...

virtual bool shouldEmitStaticExternCAliases() const

virtual bool isNoProtoCallVariadic(const CodeGen::CallArgList &args, const FunctionNoProtoType *fnType) const

Determine whether a call to an unprototyped functions under the given calling convention should use t...

Decl - This represents one declaration (or definition), e.g.

This represents one expression.

Represents a function declaration or definition.

Represents a K&R-style 'int foo()' function, which has no information available about its arguments.

FunctionType - C99 6.7.5.3 - Function Declarators.

Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...

A (possibly-)qualified type.

Scope - A scope is a transient data structure that is used while parsing the program.

Encodes a location in the source.

The base class of the type hierarchy.

Represents a variable declaration or definition.

Defines the clang::TargetInfo interface.

std::unique_ptr< TargetCodeGenInfo > createARMTargetCodeGenInfo(CodeGenModule &CGM, ARMABIKind Kind)

std::unique_ptr< TargetCodeGenInfo > createM68kTargetCodeGenInfo(CodeGenModule &CGM)

@ Decl

The l-value was an access to a declared entity or something equivalently strong, like the address of ...

std::unique_ptr< TargetCodeGenInfo > createBPFTargetCodeGenInfo(CodeGenModule &CGM)

std::unique_ptr< TargetCodeGenInfo > createMSP430TargetCodeGenInfo(CodeGenModule &CGM)

std::unique_ptr< TargetCodeGenInfo > createX86_64TargetCodeGenInfo(CodeGenModule &CGM, X86AVXABILevel AVXLevel)

std::unique_ptr< TargetCodeGenInfo > createWebAssemblyTargetCodeGenInfo(CodeGenModule &CGM, WebAssemblyABIKind K)

std::unique_ptr< TargetCodeGenInfo > createPPC64_SVR4_TargetCodeGenInfo(CodeGenModule &CGM, PPC64_SVR4_ABIKind Kind, bool SoftFloatABI)

std::unique_ptr< TargetCodeGenInfo > createMIPSTargetCodeGenInfo(CodeGenModule &CGM, bool IsOS32)

std::unique_ptr< TargetCodeGenInfo > createHexagonTargetCodeGenInfo(CodeGenModule &CGM)

std::unique_ptr< TargetCodeGenInfo > createNVPTXTargetCodeGenInfo(CodeGenModule &CGM)

std::unique_ptr< TargetCodeGenInfo > createSystemZTargetCodeGenInfo(CodeGenModule &CGM, bool HasVector, bool SoftFloatABI)

std::unique_ptr< TargetCodeGenInfo > createWinX86_32TargetCodeGenInfo(CodeGenModule &CGM, bool DarwinVectorABI, bool Win32StructABI, unsigned NumRegisterParameters)

std::unique_ptr< TargetCodeGenInfo > createAIXTargetCodeGenInfo(CodeGenModule &CGM, bool Is64Bit)

std::unique_ptr< TargetCodeGenInfo > createAMDGPUTargetCodeGenInfo(CodeGenModule &CGM)

X86AVXABILevel

The AVX ABI level for X86 targets.

std::unique_ptr< TargetCodeGenInfo > createTCETargetCodeGenInfo(CodeGenModule &CGM)

std::unique_ptr< TargetCodeGenInfo > createWindowsARMTargetCodeGenInfo(CodeGenModule &CGM, ARMABIKind K)

std::unique_ptr< TargetCodeGenInfo > createAVRTargetCodeGenInfo(CodeGenModule &CGM, unsigned NPR, unsigned NRR)

std::unique_ptr< TargetCodeGenInfo > createDirectXTargetCodeGenInfo(CodeGenModule &CGM)

std::unique_ptr< TargetCodeGenInfo > createARCTargetCodeGenInfo(CodeGenModule &CGM)

std::unique_ptr< TargetCodeGenInfo > createDefaultTargetCodeGenInfo(CodeGenModule &CGM)

std::unique_ptr< TargetCodeGenInfo > createAArch64TargetCodeGenInfo(CodeGenModule &CGM, AArch64ABIKind Kind)

std::unique_ptr< TargetCodeGenInfo > createSPIRVTargetCodeGenInfo(CodeGenModule &CGM)

std::unique_ptr< TargetCodeGenInfo > createSparcV8TargetCodeGenInfo(CodeGenModule &CGM)

std::unique_ptr< TargetCodeGenInfo > createVETargetCodeGenInfo(CodeGenModule &CGM)

std::unique_ptr< TargetCodeGenInfo > createCommonSPIRTargetCodeGenInfo(CodeGenModule &CGM)

std::unique_ptr< TargetCodeGenInfo > createRISCVTargetCodeGenInfo(CodeGenModule &CGM, unsigned XLen, unsigned FLen, bool EABI)

std::unique_ptr< TargetCodeGenInfo > createWindowsAArch64TargetCodeGenInfo(CodeGenModule &CGM, AArch64ABIKind K)

std::unique_ptr< TargetCodeGenInfo > createSparcV9TargetCodeGenInfo(CodeGenModule &CGM)

std::unique_ptr< TargetCodeGenInfo > createPNaClTargetCodeGenInfo(CodeGenModule &CGM)

std::unique_ptr< TargetCodeGenInfo > createX86_32TargetCodeGenInfo(CodeGenModule &CGM, bool DarwinVectorABI, bool Win32StructABI, unsigned NumRegisterParameters, bool SoftFloatABI)

std::unique_ptr< TargetCodeGenInfo > createLanaiTargetCodeGenInfo(CodeGenModule &CGM)

std::unique_ptr< TargetCodeGenInfo > createPPC32TargetCodeGenInfo(CodeGenModule &CGM, bool SoftFloatABI)

std::unique_ptr< TargetCodeGenInfo > createLoongArchTargetCodeGenInfo(CodeGenModule &CGM, unsigned GRLen, unsigned FLen)

std::unique_ptr< TargetCodeGenInfo > createPPC64TargetCodeGenInfo(CodeGenModule &CGM)

std::unique_ptr< TargetCodeGenInfo > createWinX86_64TargetCodeGenInfo(CodeGenModule &CGM, X86AVXABILevel AVXLevel)

std::unique_ptr< TargetCodeGenInfo > createXCoreTargetCodeGenInfo(CodeGenModule &CGM)

std::unique_ptr< TargetCodeGenInfo > createCSKYTargetCodeGenInfo(CodeGenModule &CGM, unsigned FLen)

The JSON file list parser is used to communicate input to InstallAPI.

LangAS

Defines the address space values used by the address space qualifier of QualType.

const FunctionProtoType * T

SyncScope

Defines synch scope values used internally by clang.

Diagnostic wrappers for TextAPI types for error reporting.

llvm::IntegerType * Int32Ty