TargetInfo.h revision d0b76ca10feefcfda5cb16698e50197e87a7d876
1//===---- TargetInfo.h - Encapsulate target details -------------*- C++ -*-===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// 9// 10// These classes wrap the information about a call or function 11// definition used to handle ABI compliancy. 12// 13//===----------------------------------------------------------------------===// 14 15#ifndef CLANG_CODEGEN_TARGETINFO_H 16#define CLANG_CODEGEN_TARGETINFO_H 17 18namespace llvm { 19 class GlobalValue; 20} 21 22namespace clang { 23 class ABIInfo; 24 class Decl; 25 26 namespace CodeGen { 27 class CodeGenModule; 28 } 29 30 /// TargetCodeGenInfo - This class organizes various target-specific 31 /// codegeneration issues, like target-specific attributes, builtins and so 32 /// on. 33 class TargetCodeGenInfo { 34 ABIInfo *Info; 35 public: 36 // WARNING: Acquires the ownership of ABIInfo. 37 TargetCodeGenInfo(ABIInfo *info = 0):Info(info) { } 38 virtual ~TargetCodeGenInfo(); 39 40 /// getABIInfo() - Returns ABI info helper for the target. 41 const ABIInfo& getABIInfo() const { return *Info; } 42 43 /// SetTargetAttributes - Provides a convenient hook to handle extra 44 /// target-specific attributes for the given global. 45 virtual void SetTargetAttributes(const Decl *D, llvm::GlobalValue *GV, 46 CodeGen::CodeGenModule &M) const { } 47 48 /// Controls whether __builtin_extend_pointer should sign-extend 49 /// pointers to uint64_t or zero-extend them (the default). Has 50 /// no effect for targets: 51 /// - that have 64-bit pointers, or 52 /// - that cannot address through registers larger than pointers, or 53 /// - that implicitly ignore/truncate the top bits when addressing 54 /// through such registers. 55 virtual bool extendPointerWithSExt() const { return false; } 56 }; 57} 58 59#endif // CLANG_CODEGEN_TARGETINFO_H 60