TargetInfo.h revision 8b30a9379f730875ba8fb2d0fe2d43611e0c20ff
15f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer//===--- TargetInfo.h - Expose information about the target -----*- C++ -*-===// 25f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer// 35f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer// The LLVM Compiler Infrastructure 45f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer// 50bc735ffcfb223c0186419547abaa5c84482663eChris Lattner// This file is distributed under the University of Illinois Open Source 60bc735ffcfb223c0186419547abaa5c84482663eChris Lattner// License. See LICENSE.TXT for details. 75f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer// 85f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer//===----------------------------------------------------------------------===// 95f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer// 102b59a2cbfdb93fcf1a4a303e1ea7753ff1c7b319Nate Begeman// This file defines the TargetInfo interface. 115f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer// 125f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer//===----------------------------------------------------------------------===// 135f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer 145f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer#ifndef LLVM_CLANG_BASIC_TARGETINFO_H 155f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer#define LLVM_CLANG_BASIC_TARGETINFO_H 165f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer 17686775deca8b8685eb90801495880e3abdd844c2Chris Lattner#include "clang/Basic/LLVM.h" 184f32786ac45210143654390177105eb749b614e9Ted Kremenek#include "llvm/ADT/IntrusiveRefCntPtr.h" 19868bd0aa9281929ef50d2e9a8c82a036906f53f5Daniel Dunbar#include "llvm/ADT/StringMap.h" 200a0d2b179085a52c10402feebeb6db8b4d96a140Douglas Gregor#include "llvm/ADT/StringRef.h" 2120cf717034ba1f20fc47c025ecb72ed9b631ad13Charles Davis#include "llvm/ADT/StringSwitch.h" 221752ee4849f4c37f5e03193e658be92650b0e65aDaniel Dunbar#include "llvm/ADT/Triple.h" 2303013fa9a0bf1ef4b907f5fec006c8f4000fdd21Michael J. Spencer#include "llvm/Support/DataTypes.h" 24207f4d8543529221932af82836016a2ef066c917Peter Collingbourne#include "clang/Basic/AddressSpaces.h" 250a0d2b179085a52c10402feebeb6db8b4d96a140Douglas Gregor#include "clang/Basic/VersionTuple.h" 265414fbac5f1749c0e85a8c4eeb5dfece59c3e30aTorok Edwin#include <cassert> 275f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer#include <vector> 285f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer#include <string> 295f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer 30797c3c4f5dc4fda735e55c6b5d6270a54cf6d263Chris Lattnernamespace llvm { 31797c3c4f5dc4fda735e55c6b5d6270a54cf6d263Chris Lattnerstruct fltSemantics; 32797c3c4f5dc4fda735e55c6b5d6270a54cf6d263Chris Lattner} 33525a05093a4816af961fe2bc6b8a81c17e2e26c2Chris Lattner 345f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencernamespace clang { 35d6471f7c1921c7802804ce3ff6fe9768310f72b9David Blaikieclass DiagnosticsEngine; 36d58c03f42ebb4e548c2b53fa25b1cfe02ebb9ac0Daniel Dunbarclass LangOptions; 37103b71c37a3c3a3da7128c1d0232a89b1e8d0d90Chandler Carruthclass MacroBuilder; 38797c3c4f5dc4fda735e55c6b5d6270a54cf6d263Chris Lattnerclass SourceLocation; 397a9d49fd2bfac00e905b361ba76d26ab5b6c3b09Ted Kremenekclass SourceManager; 40d58c03f42ebb4e548c2b53fa25b1cfe02ebb9ac0Daniel Dunbarclass TargetOptions; 41d58c03f42ebb4e548c2b53fa25b1cfe02ebb9ac0Daniel Dunbar 425f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencernamespace Builtin { struct Info; } 431eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump 4420cf717034ba1f20fc47c025ecb72ed9b631ad13Charles Davis/// TargetCXXABI - The types of C++ ABIs for which we can generate code. 4520cf717034ba1f20fc47c025ecb72ed9b631ad13Charles Davisenum TargetCXXABI { 46ee79a4c30e5d1c5285551c9a25b8ec6d45d46aa7John McCall /// The generic ("Itanium") C++ ABI, documented at: 47ee79a4c30e5d1c5285551c9a25b8ec6d45d46aa7John McCall /// http://www.codesourcery.com/public/cxx-abi/ 4820cf717034ba1f20fc47c025ecb72ed9b631ad13Charles Davis CXXABI_Itanium, 49ee79a4c30e5d1c5285551c9a25b8ec6d45d46aa7John McCall 50ee79a4c30e5d1c5285551c9a25b8ec6d45d46aa7John McCall /// The ARM C++ ABI, based largely on the Itanium ABI but with 51ee79a4c30e5d1c5285551c9a25b8ec6d45d46aa7John McCall /// significant differences. 52ee79a4c30e5d1c5285551c9a25b8ec6d45d46aa7John McCall /// http://infocenter.arm.com 53ee79a4c30e5d1c5285551c9a25b8ec6d45d46aa7John McCall /// /help/topic/com.arm.doc.ihi0041c/IHI0041C_cppabi.pdf 54ee79a4c30e5d1c5285551c9a25b8ec6d45d46aa7John McCall CXXABI_ARM, 55ee79a4c30e5d1c5285551c9a25b8ec6d45d46aa7John McCall 56ee79a4c30e5d1c5285551c9a25b8ec6d45d46aa7John McCall /// The Visual Studio ABI. Only scattered official documentation exists. 5720cf717034ba1f20fc47c025ecb72ed9b631ad13Charles Davis CXXABI_Microsoft 5820cf717034ba1f20fc47c025ecb72ed9b631ad13Charles Davis}; 5920cf717034ba1f20fc47c025ecb72ed9b631ad13Charles Davis 6042e6737f2efb113563140ad794c21c7709250402Chris Lattner/// TargetInfo - This class exposes information about the current target. 615f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer/// 624f32786ac45210143654390177105eb749b614e9Ted Kremenekclass TargetInfo : public llvm::RefCountedBase<TargetInfo> { 631752ee4849f4c37f5e03193e658be92650b0e65aDaniel Dunbar llvm::Triple Triple; 640eaed12e634dfd14f44620f63b8d3276fed028ddChris Lattnerprotected: 65cd4fc42896f926ffc081e1c4a8bf4cd647883c14Chris Lattner // Target values set by the ctor of the actual target implementation. Default 66cd4fc42896f926ffc081e1c4a8bf4cd647883c14Chris Lattner // values are specified by the TargetInfo constructor. 67e6a24e83e71f361c7b7de82cf24ee6f5ddc7f1c2Eli Friedman bool BigEndian; 68b030f0272500c6c5602f587ac029ee0dc0e5a05cEli Friedman bool TLSSupported; 699bffb0701d02a10e77e1ac0f196074eed6466ed0Chris Lattner bool NoAsmVariants; // True if {|} are normal characters. 70927686fe8c968ca786fa44d2353eebf59c4f5b8aChris Lattner unsigned char PointerWidth, PointerAlign; 71c81f2a2c7f83e64b3ef2b77030536290d0e2b350Roman Divacky unsigned char BoolWidth, BoolAlign; 72927686fe8c968ca786fa44d2353eebf59c4f5b8aChris Lattner unsigned char IntWidth, IntAlign; 73aa4a99b4a62615db243f7a5c433169f2fc704420Anton Korobeynikov unsigned char HalfWidth, HalfAlign; 7461538a7d1336f3ef3cb81e09f11a1cbb282bcf81Eli Friedman unsigned char FloatWidth, FloatAlign; 75927686fe8c968ca786fa44d2353eebf59c4f5b8aChris Lattner unsigned char DoubleWidth, DoubleAlign; 7661538a7d1336f3ef3cb81e09f11a1cbb282bcf81Eli Friedman unsigned char LongDoubleWidth, LongDoubleAlign; 776deecb0d46bcfd048e651d2db7c4fb0d6407da96Rafael Espindola unsigned char LargeArrayMinWidth, LargeArrayAlign; 78927686fe8c968ca786fa44d2353eebf59c4f5b8aChris Lattner unsigned char LongWidth, LongAlign; 79927686fe8c968ca786fa44d2353eebf59c4f5b8aChris Lattner unsigned char LongLongWidth, LongLongAlign; 807ec59c78f1e19157767648cbe3f0e3630ca1afe7Nick Lewycky unsigned char SuitableAlign; 812be460723940f8184ec36529b6f6ddf59c04e411Eli Friedman unsigned char MaxAtomicPromoteWidth, MaxAtomicInlineWidth; 8277e8b53fe3ff630d8d1454db94e38bedda14d5caDaniel Dunbar const char *DescriptionString; 833fdf4678935b27c3d3fd4eb10bf9f5ab98dc0d99Chris Lattner const char *UserLabelPrefix; 84be4c8705e499b55548467eb7adaa23cbc6edfef9Roman Divacky const char *MCountName; 85aa4a99b4a62615db243f7a5c433169f2fc704420Anton Korobeynikov const llvm::fltSemantics *HalfFormat, *FloatFormat, *DoubleFormat, 86aa4a99b4a62615db243f7a5c433169f2fc704420Anton Korobeynikov *LongDoubleFormat; 87264a76cdf382c507f4d43e64c89f1503f003ac95Anton Korobeynikov unsigned char RegParmMax, SSERegParmMax; 8820cf717034ba1f20fc47c025ecb72ed9b631ad13Charles Davis TargetCXXABI CXXABI; 89207f4d8543529221932af82836016a2ef066c917Peter Collingbourne const LangAS::Map *AddrSpaceMap; 90bbced580c92afa09cd4423a9bdc90ff61cb1e79aTed Kremenek 91686775deca8b8685eb90801495880e3abdd844c2Chris Lattner mutable StringRef PlatformName; 920a0d2b179085a52c10402feebeb6db8b4d96a140Douglas Gregor mutable VersionTuple PlatformMinVersion; 930a0d2b179085a52c10402feebeb6db8b4d96a140Douglas Gregor 94613fd67e575ff1c038535b18dafebca070f3ed91Daniel Dunbar unsigned HasAlignMac68kSupport : 1; 95dacf9dda17346c628fdd8c5df53c681738db0dc5Daniel Dunbar unsigned RealTypeUsesObjCFPRet : 3; 96eea64802558cc398571938b1f28cda1d4fa79ec3Anders Carlsson unsigned ComplexLongDoubleUsesFP2Ret : 1; 97613fd67e575ff1c038535b18dafebca070f3ed91Daniel Dunbar 98cd4fc42896f926ffc081e1c4a8bf4cd647883c14Chris Lattner // TargetInfo Constructor. Default initializes all fields. 99cd4fc42896f926ffc081e1c4a8bf4cd647883c14Chris Lattner TargetInfo(const std::string &T); 1001eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump 1011eb4433ac451dc16f4133a88af2d002ac26c58efMike Stumppublic: 102d58c03f42ebb4e548c2b53fa25b1cfe02ebb9ac0Daniel Dunbar /// CreateTargetInfo - Construct a target for the given options. 103b93292ab7f2b3d43a9e0ad6421f572d1f5a323b4Daniel Dunbar /// 104b93292ab7f2b3d43a9e0ad6421f572d1f5a323b4Daniel Dunbar /// \param Opts - The options to use to initialize the target. The target may 105b93292ab7f2b3d43a9e0ad6421f572d1f5a323b4Daniel Dunbar /// modify the options to canonicalize the target feature information to match 106b93292ab7f2b3d43a9e0ad6421f572d1f5a323b4Daniel Dunbar /// what the backend expects. 107d6471f7c1921c7802804ce3ff6fe9768310f72b9David Blaikie static TargetInfo* CreateTargetInfo(DiagnosticsEngine &Diags, 108d6471f7c1921c7802804ce3ff6fe9768310f72b9David Blaikie TargetOptions &Opts); 109bbced580c92afa09cd4423a9bdc90ff61cb1e79aTed Kremenek 1100eaed12e634dfd14f44620f63b8d3276fed028ddChris Lattner virtual ~TargetInfo(); 111fb79f7cc00f9c1e04f11ed636eefb36d246b0fb8Ted Kremenek 1129c4bea1fa7291035325575c02d33552a124d8ef3Chris Lattner ///===---- Target Data Type Query Methods -------------------------------===// 11331fc07df7f0fc89ebf83ca05a20b29de45a7598dSanjiv Gupta enum IntType { 1142b5abf515f9696912452f431c7738691cf97f4f1Chris Lattner NoInt = 0, 11531fc07df7f0fc89ebf83ca05a20b29de45a7598dSanjiv Gupta SignedShort, 11631fc07df7f0fc89ebf83ca05a20b29de45a7598dSanjiv Gupta UnsignedShort, 11731fc07df7f0fc89ebf83ca05a20b29de45a7598dSanjiv Gupta SignedInt, 11831fc07df7f0fc89ebf83ca05a20b29de45a7598dSanjiv Gupta UnsignedInt, 11931fc07df7f0fc89ebf83ca05a20b29de45a7598dSanjiv Gupta SignedLong, 12031fc07df7f0fc89ebf83ca05a20b29de45a7598dSanjiv Gupta UnsignedLong, 12131fc07df7f0fc89ebf83ca05a20b29de45a7598dSanjiv Gupta SignedLongLong, 12231fc07df7f0fc89ebf83ca05a20b29de45a7598dSanjiv Gupta UnsignedLongLong 1233fa8f7491a6a6c1445768ea23ec85d3554c3ba98Chris Lattner }; 124dacf9dda17346c628fdd8c5df53c681738db0dc5Daniel Dunbar 125dacf9dda17346c628fdd8c5df53c681738db0dc5Daniel Dunbar enum RealType { 126dacf9dda17346c628fdd8c5df53c681738db0dc5Daniel Dunbar Float = 0, 127dacf9dda17346c628fdd8c5df53c681738db0dc5Daniel Dunbar Double, 128dacf9dda17346c628fdd8c5df53c681738db0dc5Daniel Dunbar LongDouble 129dacf9dda17346c628fdd8c5df53c681738db0dc5Daniel Dunbar }; 130dacf9dda17346c628fdd8c5df53c681738db0dc5Daniel Dunbar 1313fa8f7491a6a6c1445768ea23ec85d3554c3ba98Chris Lattnerprotected: 1323c7b6e46c5f9bdbe0676c52d80df98b68b02be99Eli Friedman IntType SizeType, IntMaxType, UIntMaxType, PtrDiffType, IntPtrType, WCharType, 1339cf910efc4fb7001a6d276ed2eabf01f0f0efaaaEdward O'Callaghan WIntType, Char16Type, Char32Type, Int64Type, SigAtomicType; 134b6a169395c1b30c76daffebcbd2164b6247a5d21Daniel Dunbar 135b6a169395c1b30c76daffebcbd2164b6247a5d21Daniel Dunbar /// Control whether the alignment of bit-field types is respected when laying 136b6a169395c1b30c76daffebcbd2164b6247a5d21Daniel Dunbar /// out structures. If true, then the alignment of the bit-field type will be 137b6a169395c1b30c76daffebcbd2164b6247a5d21Daniel Dunbar /// used to (a) impact the alignment of the containing structure, and (b) 138b6a169395c1b30c76daffebcbd2164b6247a5d21Daniel Dunbar /// ensure that the individual bit-field will not straddle an alignment 139b6a169395c1b30c76daffebcbd2164b6247a5d21Daniel Dunbar /// boundary. 140b6830d616a068971f13e1e213e06a945c8c93ceaDaniel Dunbar unsigned UseBitFieldTypeAlignment : 1; 141b6a169395c1b30c76daffebcbd2164b6247a5d21Daniel Dunbar 14261a62216a0bb33fb668ab653d9f9a704e43d2fc6Chad Rosier /// Control whether zero length bitfields (e.g., int : 0;) force alignment of 14361a62216a0bb33fb668ab653d9f9a704e43d2fc6Chad Rosier /// the next bitfield. If the alignment of the zero length bitfield is 14461a62216a0bb33fb668ab653d9f9a704e43d2fc6Chad Rosier /// greater than the member that follows it, `bar', `bar' will be aligned as 14561a62216a0bb33fb668ab653d9f9a704e43d2fc6Chad Rosier /// the type of the zero-length bitfield. 14661a62216a0bb33fb668ab653d9f9a704e43d2fc6Chad Rosier unsigned UseZeroLengthBitfieldAlignment : 1; 14761a62216a0bb33fb668ab653d9f9a704e43d2fc6Chad Rosier 14861a62216a0bb33fb668ab653d9f9a704e43d2fc6Chad Rosier /// If non-zero, specifies a fixed alignment value for bitfields that follow 14961a62216a0bb33fb668ab653d9f9a704e43d2fc6Chad Rosier /// zero length bitfield, regardless of the zero length bitfield type. 15061a62216a0bb33fb668ab653d9f9a704e43d2fc6Chad Rosier unsigned ZeroLengthBitfieldBoundary; 15161a62216a0bb33fb668ab653d9f9a704e43d2fc6Chad Rosier 1523fa8f7491a6a6c1445768ea23ec85d3554c3ba98Chris Lattnerpublic: 1533fa8f7491a6a6c1445768ea23ec85d3554c3ba98Chris Lattner IntType getSizeType() const { return SizeType; } 1543fa8f7491a6a6c1445768ea23ec85d3554c3ba98Chris Lattner IntType getIntMaxType() const { return IntMaxType; } 1553fa8f7491a6a6c1445768ea23ec85d3554c3ba98Chris Lattner IntType getUIntMaxType() const { return UIntMaxType; } 1563fa8f7491a6a6c1445768ea23ec85d3554c3ba98Chris Lattner IntType getPtrDiffType(unsigned AddrSpace) const { 15731fc07df7f0fc89ebf83ca05a20b29de45a7598dSanjiv Gupta return AddrSpace == 0 ? PtrDiffType : getPtrDiffTypeV(AddrSpace); 15831fc07df7f0fc89ebf83ca05a20b29de45a7598dSanjiv Gupta } 1596ad474f82f0cf32e13128d89fa5ad3a37ae73530Chris Lattner IntType getIntPtrType() const { return IntPtrType; } 1603fa8f7491a6a6c1445768ea23ec85d3554c3ba98Chris Lattner IntType getWCharType() const { return WCharType; } 161e64ef80363c84f4f431e26b61db554c89beeddb6Chris Lattner IntType getWIntType() const { return WIntType; } 162f5c209d23b20ada4a9b6235db50317239cbf6ae1Alisdair Meredith IntType getChar16Type() const { return Char16Type; } 163f5c209d23b20ada4a9b6235db50317239cbf6ae1Alisdair Meredith IntType getChar32Type() const { return Char32Type; } 1643c7b6e46c5f9bdbe0676c52d80df98b68b02be99Eli Friedman IntType getInt64Type() const { return Int64Type; } 1659cf910efc4fb7001a6d276ed2eabf01f0f0efaaaEdward O'Callaghan IntType getSigAtomicType() const { return SigAtomicType; } 1665f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer 167b304f77cb621a47221f2aa2d35acdb5c730421ffChris Lattner 168237cf582b89bbcc22640cea15426ddc7ada8412bMichael J. Spencer /// getTypeWidth - Return the width (in bits) of the specified integer type 169b304f77cb621a47221f2aa2d35acdb5c730421ffChris Lattner /// enum. For example, SignedInt -> getIntWidth(). 170b304f77cb621a47221f2aa2d35acdb5c730421ffChris Lattner unsigned getTypeWidth(IntType T) const; 171b304f77cb621a47221f2aa2d35acdb5c730421ffChris Lattner 1729099e7bcda3922cee0cffcdf21332ac4aa193ceaChris Lattner /// getTypeAlign - Return the alignment (in bits) of the specified integer 1739099e7bcda3922cee0cffcdf21332ac4aa193ceaChris Lattner /// type enum. For example, SignedInt -> getIntAlign(). 1749099e7bcda3922cee0cffcdf21332ac4aa193ceaChris Lattner unsigned getTypeAlign(IntType T) const; 1759099e7bcda3922cee0cffcdf21332ac4aa193ceaChris Lattner 176961f0708fb66375acf47f9e9bc1aecfb3f992aeaChris Lattner /// isTypeSigned - Return whether an integer types is signed. Returns true if 177b304f77cb621a47221f2aa2d35acdb5c730421ffChris Lattner /// the type is signed; false otherwise. 1783f59c975aa5d047f7edd1b900b5e885c38af0ef7Chris Lattner static bool isTypeSigned(IntType T); 179b304f77cb621a47221f2aa2d35acdb5c730421ffChris Lattner 180f72a44330b9d9a4b2d93e9b91cfb8ab7bd4a0643Chris Lattner /// getPointerWidth - Return the width of pointers on this target, for the 181927686fe8c968ca786fa44d2353eebf59c4f5b8aChris Lattner /// specified address space. 182927686fe8c968ca786fa44d2353eebf59c4f5b8aChris Lattner uint64_t getPointerWidth(unsigned AddrSpace) const { 183927686fe8c968ca786fa44d2353eebf59c4f5b8aChris Lattner return AddrSpace == 0 ? PointerWidth : getPointerWidthV(AddrSpace); 184927686fe8c968ca786fa44d2353eebf59c4f5b8aChris Lattner } 185927686fe8c968ca786fa44d2353eebf59c4f5b8aChris Lattner uint64_t getPointerAlign(unsigned AddrSpace) const { 186927686fe8c968ca786fa44d2353eebf59c4f5b8aChris Lattner return AddrSpace == 0 ? PointerAlign : getPointerAlignV(AddrSpace); 187927686fe8c968ca786fa44d2353eebf59c4f5b8aChris Lattner } 1881eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump 1899e9b6dc3fd413f5341fab54b681420eeb21cd169Chris Lattner /// getBoolWidth/Align - Return the size of '_Bool' and C++ 'bool' for this 1909e9b6dc3fd413f5341fab54b681420eeb21cd169Chris Lattner /// target, in bits. 191c81f2a2c7f83e64b3ef2b77030536290d0e2b350Roman Divacky unsigned getBoolWidth() const { return BoolWidth; } 192c81f2a2c7f83e64b3ef2b77030536290d0e2b350Roman Divacky unsigned getBoolAlign() const { return BoolAlign; } 1931eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump 194f5c209d23b20ada4a9b6235db50317239cbf6ae1Alisdair Meredith unsigned getCharWidth() const { return 8; } // FIXME 195f5c209d23b20ada4a9b6235db50317239cbf6ae1Alisdair Meredith unsigned getCharAlign() const { return 8; } // FIXME 1961eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump 1979e9b6dc3fd413f5341fab54b681420eeb21cd169Chris Lattner /// getShortWidth/Align - Return the size of 'signed short' and 1981eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump /// 'unsigned short' for this target, in bits. 1999e9b6dc3fd413f5341fab54b681420eeb21cd169Chris Lattner unsigned getShortWidth() const { return 16; } // FIXME 2009e9b6dc3fd413f5341fab54b681420eeb21cd169Chris Lattner unsigned getShortAlign() const { return 16; } // FIXME 2011eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump 2029e9b6dc3fd413f5341fab54b681420eeb21cd169Chris Lattner /// getIntWidth/Align - Return the size of 'signed int' and 'unsigned int' for 2039e9b6dc3fd413f5341fab54b681420eeb21cd169Chris Lattner /// this target, in bits. 2042621fd1d6d3c5eadcae246859f62738645df7540Chris Lattner unsigned getIntWidth() const { return IntWidth; } 2052621fd1d6d3c5eadcae246859f62738645df7540Chris Lattner unsigned getIntAlign() const { return IntAlign; } 2061eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump 2079e9b6dc3fd413f5341fab54b681420eeb21cd169Chris Lattner /// getLongWidth/Align - Return the size of 'signed long' and 'unsigned long' 2089e9b6dc3fd413f5341fab54b681420eeb21cd169Chris Lattner /// for this target, in bits. 2098059e997ee05e4aa87f7e21fed630429a140ee53Chris Lattner unsigned getLongWidth() const { return LongWidth; } 2108059e997ee05e4aa87f7e21fed630429a140ee53Chris Lattner unsigned getLongAlign() const { return LongAlign; } 2111eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump 2129e9b6dc3fd413f5341fab54b681420eeb21cd169Chris Lattner /// getLongLongWidth/Align - Return the size of 'signed long long' and 2139e9b6dc3fd413f5341fab54b681420eeb21cd169Chris Lattner /// 'unsigned long long' for this target, in bits. 214ec10f5886526124ba733fbd0ef8665d576285daaChris Lattner unsigned getLongLongWidth() const { return LongLongWidth; } 215ec10f5886526124ba733fbd0ef8665d576285daaChris Lattner unsigned getLongLongAlign() const { return LongLongAlign; } 2161eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump 2177ec59c78f1e19157767648cbe3f0e3630ca1afe7Nick Lewycky /// getSuitableAlign - Return the alignment that is suitable for storing any 2187ec59c78f1e19157767648cbe3f0e3630ca1afe7Nick Lewycky /// object with a fundamental alignment requirement. 2197ec59c78f1e19157767648cbe3f0e3630ca1afe7Nick Lewycky unsigned getSuitableAlign() const { return SuitableAlign; } 2207ec59c78f1e19157767648cbe3f0e3630ca1afe7Nick Lewycky 221f5c209d23b20ada4a9b6235db50317239cbf6ae1Alisdair Meredith /// getWCharWidth/Align - Return the size of 'wchar_t' for this target, in 2229e9b6dc3fd413f5341fab54b681420eeb21cd169Chris Lattner /// bits. 2239184646509d015ea66e796113a8c68598681374bChris Lattner unsigned getWCharWidth() const { return getTypeWidth(WCharType); } 2249184646509d015ea66e796113a8c68598681374bChris Lattner unsigned getWCharAlign() const { return getTypeAlign(WCharType); } 225f72a44330b9d9a4b2d93e9b91cfb8ab7bd4a0643Chris Lattner 226f5c209d23b20ada4a9b6235db50317239cbf6ae1Alisdair Meredith /// getChar16Width/Align - Return the size of 'char16_t' for this target, in 227f5c209d23b20ada4a9b6235db50317239cbf6ae1Alisdair Meredith /// bits. 2289184646509d015ea66e796113a8c68598681374bChris Lattner unsigned getChar16Width() const { return getTypeWidth(Char16Type); } 2299184646509d015ea66e796113a8c68598681374bChris Lattner unsigned getChar16Align() const { return getTypeAlign(Char16Type); } 230f5c209d23b20ada4a9b6235db50317239cbf6ae1Alisdair Meredith 231f5c209d23b20ada4a9b6235db50317239cbf6ae1Alisdair Meredith /// getChar32Width/Align - Return the size of 'char32_t' for this target, in 232f5c209d23b20ada4a9b6235db50317239cbf6ae1Alisdair Meredith /// bits. 2339184646509d015ea66e796113a8c68598681374bChris Lattner unsigned getChar32Width() const { return getTypeWidth(Char32Type); } 2349184646509d015ea66e796113a8c68598681374bChris Lattner unsigned getChar32Align() const { return getTypeAlign(Char32Type); } 235f5c209d23b20ada4a9b6235db50317239cbf6ae1Alisdair Meredith 236aa4a99b4a62615db243f7a5c433169f2fc704420Anton Korobeynikov /// getHalfWidth/Align/Format - Return the size/align/format of 'half'. 237aa4a99b4a62615db243f7a5c433169f2fc704420Anton Korobeynikov unsigned getHalfWidth() const { return HalfWidth; } 238aa4a99b4a62615db243f7a5c433169f2fc704420Anton Korobeynikov unsigned getHalfAlign() const { return HalfAlign; } 239aa4a99b4a62615db243f7a5c433169f2fc704420Anton Korobeynikov const llvm::fltSemantics &getHalfFormat() const { return *HalfFormat; } 240aa4a99b4a62615db243f7a5c433169f2fc704420Anton Korobeynikov 2419e9b6dc3fd413f5341fab54b681420eeb21cd169Chris Lattner /// getFloatWidth/Align/Format - Return the size/align/format of 'float'. 24261538a7d1336f3ef3cb81e09f11a1cbb282bcf81Eli Friedman unsigned getFloatWidth() const { return FloatWidth; } 24361538a7d1336f3ef3cb81e09f11a1cbb282bcf81Eli Friedman unsigned getFloatAlign() const { return FloatAlign; } 244b7cfe88e88cb4f46308de89cf3f0c81bfe624128Chris Lattner const llvm::fltSemantics &getFloatFormat() const { return *FloatFormat; } 2459e9b6dc3fd413f5341fab54b681420eeb21cd169Chris Lattner 2469e9b6dc3fd413f5341fab54b681420eeb21cd169Chris Lattner /// getDoubleWidth/Align/Format - Return the size/align/format of 'double'. 247c8b1227fa8c17d9881815e40c04e19334be536f8Nate Begeman unsigned getDoubleWidth() const { return DoubleWidth; } 248c8b1227fa8c17d9881815e40c04e19334be536f8Nate Begeman unsigned getDoubleAlign() const { return DoubleAlign; } 249b7cfe88e88cb4f46308de89cf3f0c81bfe624128Chris Lattner const llvm::fltSemantics &getDoubleFormat() const { return *DoubleFormat; } 2509e9b6dc3fd413f5341fab54b681420eeb21cd169Chris Lattner 2519e9b6dc3fd413f5341fab54b681420eeb21cd169Chris Lattner /// getLongDoubleWidth/Align/Format - Return the size/align/format of 'long 2529e9b6dc3fd413f5341fab54b681420eeb21cd169Chris Lattner /// double'. 25361538a7d1336f3ef3cb81e09f11a1cbb282bcf81Eli Friedman unsigned getLongDoubleWidth() const { return LongDoubleWidth; } 25461538a7d1336f3ef3cb81e09f11a1cbb282bcf81Eli Friedman unsigned getLongDoubleAlign() const { return LongDoubleAlign; } 255b7cfe88e88cb4f46308de89cf3f0c81bfe624128Chris Lattner const llvm::fltSemantics &getLongDoubleFormat() const { 256b7cfe88e88cb4f46308de89cf3f0c81bfe624128Chris Lattner return *LongDoubleFormat; 257cd4fc42896f926ffc081e1c4a8bf4cd647883c14Chris Lattner } 2581eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump 259b406669fea7c8db83a377f368f1689c848296974Benjamin Kramer /// getFloatEvalMethod - Return the value for the C99 FLT_EVAL_METHOD macro. 260b406669fea7c8db83a377f368f1689c848296974Benjamin Kramer virtual unsigned getFloatEvalMethod() const { return 0; } 261b406669fea7c8db83a377f368f1689c848296974Benjamin Kramer 2626deecb0d46bcfd048e651d2db7c4fb0d6407da96Rafael Espindola // getLargeArrayMinWidth/Align - Return the minimum array size that is 2636deecb0d46bcfd048e651d2db7c4fb0d6407da96Rafael Espindola // 'large' and its alignment. 2646deecb0d46bcfd048e651d2db7c4fb0d6407da96Rafael Espindola unsigned getLargeArrayMinWidth() const { return LargeArrayMinWidth; } 2656deecb0d46bcfd048e651d2db7c4fb0d6407da96Rafael Espindola unsigned getLargeArrayAlign() const { return LargeArrayAlign; } 2666deecb0d46bcfd048e651d2db7c4fb0d6407da96Rafael Espindola 2672be460723940f8184ec36529b6f6ddf59c04e411Eli Friedman /// getMaxAtomicPromoteWidth - Return the maximum width lock-free atomic 2682be460723940f8184ec36529b6f6ddf59c04e411Eli Friedman /// operation which will ever be supported for the given target 2692be460723940f8184ec36529b6f6ddf59c04e411Eli Friedman unsigned getMaxAtomicPromoteWidth() const { return MaxAtomicPromoteWidth; } 2702be460723940f8184ec36529b6f6ddf59c04e411Eli Friedman /// getMaxAtomicInlineWidth - Return the maximum width lock-free atomic 2712be460723940f8184ec36529b6f6ddf59c04e411Eli Friedman /// operation which can be inlined given the supported features of the 2722be460723940f8184ec36529b6f6ddf59c04e411Eli Friedman /// given target. 2732be460723940f8184ec36529b6f6ddf59c04e411Eli Friedman unsigned getMaxAtomicInlineWidth() const { return MaxAtomicInlineWidth; } 2742be460723940f8184ec36529b6f6ddf59c04e411Eli Friedman 2755f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer /// getIntMaxTWidth - Return the size of intmax_t and uintmax_t for this 2761eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump /// target, in bits. 2770eaed12e634dfd14f44620f63b8d3276fed028ddChris Lattner unsigned getIntMaxTWidth() const { 2789184646509d015ea66e796113a8c68598681374bChris Lattner return getTypeWidth(IntMaxType); 2795f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer } 2801eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump 28108737c49bd98f73b50fe90fd19f97c41cd29e3d1Daniel Dunbar /// getRegisterWidth - Return the "preferred" register width on this target. 28208737c49bd98f73b50fe90fd19f97c41cd29e3d1Daniel Dunbar uint64_t getRegisterWidth() const { 28308737c49bd98f73b50fe90fd19f97c41cd29e3d1Daniel Dunbar // Currently we assume the register width on the target matches the pointer 28408737c49bd98f73b50fe90fd19f97c41cd29e3d1Daniel Dunbar // width, we can introduce a new variable for this if/when some target wants 28508737c49bd98f73b50fe90fd19f97c41cd29e3d1Daniel Dunbar // it. 28608737c49bd98f73b50fe90fd19f97c41cd29e3d1Daniel Dunbar return LongWidth; 28708737c49bd98f73b50fe90fd19f97c41cd29e3d1Daniel Dunbar } 28808737c49bd98f73b50fe90fd19f97c41cd29e3d1Daniel Dunbar 2893fdf4678935b27c3d3fd4eb10bf9f5ab98dc0d99Chris Lattner /// getUserLabelPrefix - This returns the default value of the 2903fdf4678935b27c3d3fd4eb10bf9f5ab98dc0d99Chris Lattner /// __USER_LABEL_PREFIX__ macro, which is the prefix given to user symbols by 2913fdf4678935b27c3d3fd4eb10bf9f5ab98dc0d99Chris Lattner /// default. On most platforms this is "_", but it is "" on some, and "." on 2923fdf4678935b27c3d3fd4eb10bf9f5ab98dc0d99Chris Lattner /// others. 2933fdf4678935b27c3d3fd4eb10bf9f5ab98dc0d99Chris Lattner const char *getUserLabelPrefix() const { 2943fdf4678935b27c3d3fd4eb10bf9f5ab98dc0d99Chris Lattner return UserLabelPrefix; 2953fdf4678935b27c3d3fd4eb10bf9f5ab98dc0d99Chris Lattner } 2961eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump 297be4c8705e499b55548467eb7adaa23cbc6edfef9Roman Divacky /// MCountName - This returns name of the mcount instrumentation function. 298be4c8705e499b55548467eb7adaa23cbc6edfef9Roman Divacky const char *getMCountName() const { 299be4c8705e499b55548467eb7adaa23cbc6edfef9Roman Divacky return MCountName; 300be4c8705e499b55548467eb7adaa23cbc6edfef9Roman Divacky } 301be4c8705e499b55548467eb7adaa23cbc6edfef9Roman Divacky 30270529099e60c0bb53fdf0f31b387f487807b3d99Chad Rosier /// useBitFieldTypeAlignment() - Check whether the alignment of bit-field 30370529099e60c0bb53fdf0f31b387f487807b3d99Chad Rosier /// types is respected when laying out structures. 304b6830d616a068971f13e1e213e06a945c8c93ceaDaniel Dunbar bool useBitFieldTypeAlignment() const { 305b6830d616a068971f13e1e213e06a945c8c93ceaDaniel Dunbar return UseBitFieldTypeAlignment; 306b6a169395c1b30c76daffebcbd2164b6247a5d21Daniel Dunbar } 307b6a169395c1b30c76daffebcbd2164b6247a5d21Daniel Dunbar 30861a62216a0bb33fb668ab653d9f9a704e43d2fc6Chad Rosier /// useZeroLengthBitfieldAlignment() - Check whether zero length bitfields 30961a62216a0bb33fb668ab653d9f9a704e43d2fc6Chad Rosier /// should force alignment of the next member. 31061a62216a0bb33fb668ab653d9f9a704e43d2fc6Chad Rosier bool useZeroLengthBitfieldAlignment() const { 31161a62216a0bb33fb668ab653d9f9a704e43d2fc6Chad Rosier return UseZeroLengthBitfieldAlignment; 31261a62216a0bb33fb668ab653d9f9a704e43d2fc6Chad Rosier } 31361a62216a0bb33fb668ab653d9f9a704e43d2fc6Chad Rosier 3146e43f3f0e2fa7a4b50d2497de94a40437cd26003Chad Rosier /// getZeroLengthBitfieldBoundary() - Get the fixed alignment value in bits 3156e43f3f0e2fa7a4b50d2497de94a40437cd26003Chad Rosier /// for a member that follows a zero length bitfield. 31661a62216a0bb33fb668ab653d9f9a704e43d2fc6Chad Rosier unsigned getZeroLengthBitfieldBoundary() const { 31761a62216a0bb33fb668ab653d9f9a704e43d2fc6Chad Rosier return ZeroLengthBitfieldBoundary; 31861a62216a0bb33fb668ab653d9f9a704e43d2fc6Chad Rosier } 31961a62216a0bb33fb668ab653d9f9a704e43d2fc6Chad Rosier 320613fd67e575ff1c038535b18dafebca070f3ed91Daniel Dunbar /// hasAlignMac68kSupport - Check whether this target support '#pragma options 321613fd67e575ff1c038535b18dafebca070f3ed91Daniel Dunbar /// align=mac68k'. 322613fd67e575ff1c038535b18dafebca070f3ed91Daniel Dunbar bool hasAlignMac68kSupport() const { 323613fd67e575ff1c038535b18dafebca070f3ed91Daniel Dunbar return HasAlignMac68kSupport; 324613fd67e575ff1c038535b18dafebca070f3ed91Daniel Dunbar } 325613fd67e575ff1c038535b18dafebca070f3ed91Daniel Dunbar 3262b5abf515f9696912452f431c7738691cf97f4f1Chris Lattner /// getTypeName - Return the user string for the specified integer type enum. 3272b5abf515f9696912452f431c7738691cf97f4f1Chris Lattner /// For example, SignedShort -> "short". 3282b5abf515f9696912452f431c7738691cf97f4f1Chris Lattner static const char *getTypeName(IntType T); 3291eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump 330b304f77cb621a47221f2aa2d35acdb5c730421ffChris Lattner /// getTypeConstantSuffix - Return the constant suffix for the specified 331b304f77cb621a47221f2aa2d35acdb5c730421ffChris Lattner /// integer type enum. For example, SignedLong -> "L". 332b304f77cb621a47221f2aa2d35acdb5c730421ffChris Lattner static const char *getTypeConstantSuffix(IntType T); 333b304f77cb621a47221f2aa2d35acdb5c730421ffChris Lattner 334dacf9dda17346c628fdd8c5df53c681738db0dc5Daniel Dunbar /// \brief Check whether the given real type should use the "fpret" flavor of 335dacf9dda17346c628fdd8c5df53c681738db0dc5Daniel Dunbar /// Obj-C message passing on this target. 336dacf9dda17346c628fdd8c5df53c681738db0dc5Daniel Dunbar bool useObjCFPRetForRealType(RealType T) const { 337dacf9dda17346c628fdd8c5df53c681738db0dc5Daniel Dunbar return RealTypeUsesObjCFPRet & (1 << T); 338dacf9dda17346c628fdd8c5df53c681738db0dc5Daniel Dunbar } 339dacf9dda17346c628fdd8c5df53c681738db0dc5Daniel Dunbar 340eea64802558cc398571938b1f28cda1d4fa79ec3Anders Carlsson /// \brief Check whether _Complex long double should use the "fp2ret" flavor 341eea64802558cc398571938b1f28cda1d4fa79ec3Anders Carlsson /// of Obj-C message passing on this target. 342eea64802558cc398571938b1f28cda1d4fa79ec3Anders Carlsson bool useObjCFP2RetForComplexLongDouble() const { 343eea64802558cc398571938b1f28cda1d4fa79ec3Anders Carlsson return ComplexLongDoubleUsesFP2Ret; 344eea64802558cc398571938b1f28cda1d4fa79ec3Anders Carlsson } 345eea64802558cc398571938b1f28cda1d4fa79ec3Anders Carlsson 3469c4bea1fa7291035325575c02d33552a124d8ef3Chris Lattner ///===---- Other target property query methods --------------------------===// 3471eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump 3489c4bea1fa7291035325575c02d33552a124d8ef3Chris Lattner /// getTargetDefines - Appends the target-specific #define values for this 3499c4bea1fa7291035325575c02d33552a124d8ef3Chris Lattner /// target set to the specified buffer. 35033328642a7a8a126918814ddcbcebf83c121ad54Chris Lattner virtual void getTargetDefines(const LangOptions &Opts, 351a99927774d07af9c6f0e1945531eadc910592945Benjamin Kramer MacroBuilder &Builder) const = 0; 3521eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump 353b304f77cb621a47221f2aa2d35acdb5c730421ffChris Lattner 3545f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer /// getTargetBuiltins - Return information about target-specific builtins for 3555f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer /// the current primary target, and info about which builtins are non-portable 3565f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer /// across the current set of primary and secondary targets. 3571eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump virtual void getTargetBuiltins(const Builtin::Info *&Records, 3580eaed12e634dfd14f44620f63b8d3276fed028ddChris Lattner unsigned &NumRecords) const = 0; 3595f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer 3608b30a9379f730875ba8fb2d0fe2d43611e0c20ffBob Wilson /// isCLZForZeroUndef - The __builtin_clz* and __builtin_ctz* built-in 3618b30a9379f730875ba8fb2d0fe2d43611e0c20ffBob Wilson /// functions are specified to have undefined results for zero inputs, but 3628b30a9379f730875ba8fb2d0fe2d43611e0c20ffBob Wilson /// on targets that support these operations in a way that provides 3638b30a9379f730875ba8fb2d0fe2d43611e0c20ffBob Wilson /// well-defined results for zero without loss of performance, it is a good 3648b30a9379f730875ba8fb2d0fe2d43611e0c20ffBob Wilson /// idea to avoid optimizing based on that undef behavior. 3658b30a9379f730875ba8fb2d0fe2d43611e0c20ffBob Wilson virtual bool isCLZForZeroUndef() const { return true; } 3668b30a9379f730875ba8fb2d0fe2d43611e0c20ffBob Wilson 367d19144b244f86227fcc2b0da794929fe83968dd5Chris Lattner /// getVAListDeclaration - Return the declaration to use for 368d19144b244f86227fcc2b0da794929fe83968dd5Chris Lattner /// __builtin_va_list, which is target-specific. 3690eaed12e634dfd14f44620f63b8d3276fed028ddChris Lattner virtual const char *getVAListDeclaration() const = 0; 370fb5e5ba3c7708f3aef4db0ed30e8470b3ed4206aAnders Carlsson 371de31fd7eeebdc64fb043463e7f515dab8eccac8dEric Christopher /// isValidClobber - Returns whether the passed in string is 372de31fd7eeebdc64fb043463e7f515dab8eccac8dEric Christopher /// a valid clobber in an inline asm statement. This is used by 373de31fd7eeebdc64fb043463e7f515dab8eccac8dEric Christopher /// Sema. 374686775deca8b8685eb90801495880e3abdd844c2Chris Lattner bool isValidClobber(StringRef Name) const; 375de31fd7eeebdc64fb043463e7f515dab8eccac8dEric Christopher 3763346ae6bba10da0d08c8d548134ddab4e13d040fAnders Carlsson /// isValidGCCRegisterName - Returns whether the passed in string 3773346ae6bba10da0d08c8d548134ddab4e13d040fAnders Carlsson /// is a valid register name according to GCC. This is used by Sema for 3783346ae6bba10da0d08c8d548134ddab4e13d040fAnders Carlsson /// inline asm statements. 379686775deca8b8685eb90801495880e3abdd844c2Chris Lattner bool isValidGCCRegisterName(StringRef Name) const; 380d04c6e23f2e10eeb9936778d67f4a1c4a14cc4f6Anders Carlsson 381d04c6e23f2e10eeb9936778d67f4a1c4a14cc4f6Anders Carlsson // getNormalizedGCCRegisterName - Returns the "normalized" GCC register name. 382d04c6e23f2e10eeb9936778d67f4a1c4a14cc4f6Anders Carlsson // For example, on x86 it will return "ax" when "eax" is passed in. 383686775deca8b8685eb90801495880e3abdd844c2Chris Lattner StringRef getNormalizedGCCRegisterName(StringRef Name) const; 3841eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump 38544def070435a2b5d67f0534f7a3a85a7389d60f2Chris Lattner struct ConstraintInfo { 38644def070435a2b5d67f0534f7a3a85a7389d60f2Chris Lattner enum { 38744def070435a2b5d67f0534f7a3a85a7389d60f2Chris Lattner CI_None = 0x00, 38844def070435a2b5d67f0534f7a3a85a7389d60f2Chris Lattner CI_AllowsMemory = 0x01, 38944def070435a2b5d67f0534f7a3a85a7389d60f2Chris Lattner CI_AllowsRegister = 0x02, 390fa780fc4a4983003633c9b560387266101839923Chris Lattner CI_ReadWrite = 0x04, // "+r" output constraint (read and write). 391fa780fc4a4983003633c9b560387266101839923Chris Lattner CI_HasMatchingInput = 0x08 // This output operand has a matching input. 39244def070435a2b5d67f0534f7a3a85a7389d60f2Chris Lattner }; 39344def070435a2b5d67f0534f7a3a85a7389d60f2Chris Lattner unsigned Flags; 39444def070435a2b5d67f0534f7a3a85a7389d60f2Chris Lattner int TiedOperand; 3951eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump 3962819fa85651526d59ade4fdc9da2cadd7b132973Chris Lattner std::string ConstraintStr; // constraint: "=rm" 3972819fa85651526d59ade4fdc9da2cadd7b132973Chris Lattner std::string Name; // Operand name: [foo] with no []'s. 398432c86969eced2ce658b3f3f2aa7407c8864f21bChris Lattner public: 399686775deca8b8685eb90801495880e3abdd844c2Chris Lattner ConstraintInfo(StringRef ConstraintStr, StringRef Name) 400237cf582b89bbcc22640cea15426ddc7ada8412bMichael J. Spencer : Flags(0), TiedOperand(-1), ConstraintStr(ConstraintStr.str()), 401f959fb5fb82ae2cbdf8635d734613a01818fb7bfAnders Carlsson Name(Name.str()) {} 402432c86969eced2ce658b3f3f2aa7407c8864f21bChris Lattner 403432c86969eced2ce658b3f3f2aa7407c8864f21bChris Lattner const std::string &getConstraintStr() const { return ConstraintStr; } 4042819fa85651526d59ade4fdc9da2cadd7b132973Chris Lattner const std::string &getName() const { return Name; } 40544def070435a2b5d67f0534f7a3a85a7389d60f2Chris Lattner bool isReadWrite() const { return (Flags & CI_ReadWrite) != 0; } 40644def070435a2b5d67f0534f7a3a85a7389d60f2Chris Lattner bool allowsRegister() const { return (Flags & CI_AllowsRegister) != 0; } 40744def070435a2b5d67f0534f7a3a85a7389d60f2Chris Lattner bool allowsMemory() const { return (Flags & CI_AllowsMemory) != 0; } 4081eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump 409fa780fc4a4983003633c9b560387266101839923Chris Lattner /// hasMatchingInput - Return true if this output operand has a matching 410fa780fc4a4983003633c9b560387266101839923Chris Lattner /// (tied) input operand. 411fa780fc4a4983003633c9b560387266101839923Chris Lattner bool hasMatchingInput() const { return (Flags & CI_HasMatchingInput) != 0; } 4121eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump 413fa780fc4a4983003633c9b560387266101839923Chris Lattner /// hasTiedOperand() - Return true if this input operand is a matching 414fa780fc4a4983003633c9b560387266101839923Chris Lattner /// constraint that ties it to an output operand. If this returns true, 415fa780fc4a4983003633c9b560387266101839923Chris Lattner /// then getTiedOperand will indicate which output operand this is tied to. 41644def070435a2b5d67f0534f7a3a85a7389d60f2Chris Lattner bool hasTiedOperand() const { return TiedOperand != -1; } 41744def070435a2b5d67f0534f7a3a85a7389d60f2Chris Lattner unsigned getTiedOperand() const { 41844def070435a2b5d67f0534f7a3a85a7389d60f2Chris Lattner assert(hasTiedOperand() && "Has no tied operand!"); 41944def070435a2b5d67f0534f7a3a85a7389d60f2Chris Lattner return (unsigned)TiedOperand; 42044def070435a2b5d67f0534f7a3a85a7389d60f2Chris Lattner } 4211eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump 42244def070435a2b5d67f0534f7a3a85a7389d60f2Chris Lattner void setIsReadWrite() { Flags |= CI_ReadWrite; } 42344def070435a2b5d67f0534f7a3a85a7389d60f2Chris Lattner void setAllowsMemory() { Flags |= CI_AllowsMemory; } 42444def070435a2b5d67f0534f7a3a85a7389d60f2Chris Lattner void setAllowsRegister() { Flags |= CI_AllowsRegister; } 425fa780fc4a4983003633c9b560387266101839923Chris Lattner void setHasMatchingInput() { Flags |= CI_HasMatchingInput; } 4261eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump 427d68876176a0d2c19e3864e7d38f6036c4f72f0a3Chris Lattner /// setTiedOperand - Indicate that this is an input operand that is tied to 428d68876176a0d2c19e3864e7d38f6036c4f72f0a3Chris Lattner /// the specified output operand. Copy over the various constraint 429d68876176a0d2c19e3864e7d38f6036c4f72f0a3Chris Lattner /// information from the output. 430d68876176a0d2c19e3864e7d38f6036c4f72f0a3Chris Lattner void setTiedOperand(unsigned N, ConstraintInfo &Output) { 431fa780fc4a4983003633c9b560387266101839923Chris Lattner Output.setHasMatchingInput(); 432d68876176a0d2c19e3864e7d38f6036c4f72f0a3Chris Lattner Flags = Output.Flags; 433d68876176a0d2c19e3864e7d38f6036c4f72f0a3Chris Lattner TiedOperand = N; 434d68876176a0d2c19e3864e7d38f6036c4f72f0a3Chris Lattner // Don't copy Name or constraint string. 435d68876176a0d2c19e3864e7d38f6036c4f72f0a3Chris Lattner } 436d04c6e23f2e10eeb9936778d67f4a1c4a14cc4f6Anders Carlsson }; 437d04c6e23f2e10eeb9936778d67f4a1c4a14cc4f6Anders Carlsson 438d04c6e23f2e10eeb9936778d67f4a1c4a14cc4f6Anders Carlsson // validateOutputConstraint, validateInputConstraint - Checks that 439d04c6e23f2e10eeb9936778d67f4a1c4a14cc4f6Anders Carlsson // a constraint is valid and provides information about it. 440d04c6e23f2e10eeb9936778d67f4a1c4a14cc4f6Anders Carlsson // FIXME: These should return a real error instead of just true/false. 441432c86969eced2ce658b3f3f2aa7407c8864f21bChris Lattner bool validateOutputConstraint(ConstraintInfo &Info) const; 4422819fa85651526d59ade4fdc9da2cadd7b132973Chris Lattner bool validateInputConstraint(ConstraintInfo *OutputConstraints, 4432819fa85651526d59ade4fdc9da2cadd7b132973Chris Lattner unsigned NumOutputs, 44445b050e72d058131e6f169fe54888bb91a003fb5Anders Carlsson ConstraintInfo &info) const; 44542e1ee0702d8267d632df0fdb5c479a582877c6fAnders Carlsson bool resolveSymbolicName(const char *&Name, 4462819fa85651526d59ade4fdc9da2cadd7b132973Chris Lattner ConstraintInfo *OutputConstraints, 4472819fa85651526d59ade4fdc9da2cadd7b132973Chris Lattner unsigned NumOutputs, unsigned &Index) const; 4481eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump 4496ce33d67e2ed4f8c9395a807bebd25be04580c0fStuart Hastings // Constraint parm will be left pointing at the last character of 4506ce33d67e2ed4f8c9395a807bebd25be04580c0fStuart Hastings // the constraint. In practice, it won't be changed unless the 4516ce33d67e2ed4f8c9395a807bebd25be04580c0fStuart Hastings // constraint is longer than one character. 452002333f8b2cf1a8614e532f6ce366b21af85142cStuart Hastings virtual std::string convertConstraint(const char *&Constraint) const { 453cee55018570c0c46262c6e4ef7beaa707c93fc86Dale Johannesen // 'p' defaults to 'r', but can be overridden by targets. 454002333f8b2cf1a8614e532f6ce366b21af85142cStuart Hastings if (*Constraint == 'p') 455cee55018570c0c46262c6e4ef7beaa707c93fc86Dale Johannesen return std::string("r"); 456002333f8b2cf1a8614e532f6ce366b21af85142cStuart Hastings return std::string(1, *Constraint); 4570eaed12e634dfd14f44620f63b8d3276fed028ddChris Lattner } 4581eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump 459d04c6e23f2e10eeb9936778d67f4a1c4a14cc4f6Anders Carlsson // Returns a string of target-specific clobbers, in LLVM format. 4600eaed12e634dfd14f44620f63b8d3276fed028ddChris Lattner virtual const char *getClobbers() const = 0; 4611eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump 4627a4718e813e5e99d478567a482217c7eef8572c5Devang Patel 4631752ee4849f4c37f5e03193e658be92650b0e65aDaniel Dunbar /// getTriple - Return the target triple of the primary target. 4641752ee4849f4c37f5e03193e658be92650b0e65aDaniel Dunbar const llvm::Triple &getTriple() const { 4651752ee4849f4c37f5e03193e658be92650b0e65aDaniel Dunbar return Triple; 4660eaed12e634dfd14f44620f63b8d3276fed028ddChris Lattner } 4671eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump 468ae3607684c5978dc2d877141015056c9d24f17eaTed Kremenek const char *getTargetDescription() const { 469364af81157a81cf34bb058a7d5b0185020e5164bSanjiv Gupta return DescriptionString; 4707a4718e813e5e99d478567a482217c7eef8572c5Devang Patel } 4713346ae6bba10da0d08c8d548134ddab4e13d040fAnders Carlsson 4723346ae6bba10da0d08c8d548134ddab4e13d040fAnders Carlsson struct GCCRegAlias { 4733346ae6bba10da0d08c8d548134ddab4e13d040fAnders Carlsson const char * const Aliases[5]; 4743346ae6bba10da0d08c8d548134ddab4e13d040fAnders Carlsson const char * const Register; 4753346ae6bba10da0d08c8d548134ddab4e13d040fAnders Carlsson }; 4762621fd1d6d3c5eadcae246859f62738645df7540Chris Lattner 477cfd323d0d4476dd4ff64097c91b114067ecaa82bEric Christopher struct AddlRegName { 478cfd323d0d4476dd4ff64097c91b114067ecaa82bEric Christopher const char * const Names[5]; 479cfd323d0d4476dd4ff64097c91b114067ecaa82bEric Christopher const unsigned RegNum; 480cfd323d0d4476dd4ff64097c91b114067ecaa82bEric Christopher }; 481cfd323d0d4476dd4ff64097c91b114067ecaa82bEric Christopher 482dcb4a1a6dd55fdf6c073d2761096f42e26be105aDaniel Dunbar virtual bool useGlobalsForAutomaticVariables() const { return false; } 483dcb4a1a6dd55fdf6c073d2761096f42e26be105aDaniel Dunbar 4846d7d8398e71a8bd121d3b46e250f1dbcfb9679d4Daniel Dunbar /// getCFStringSection - Return the section to use for CFString 4858e5c2b8072f4409c7c0004331d1db9652d5209c0Daniel Dunbar /// literals, or 0 if no special section is used. 4861eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump virtual const char *getCFStringSection() const { 4878e5c2b8072f4409c7c0004331d1db9652d5209c0Daniel Dunbar return "__DATA,__cfstring"; 4888e5c2b8072f4409c7c0004331d1db9652d5209c0Daniel Dunbar } 4898e5c2b8072f4409c7c0004331d1db9652d5209c0Daniel Dunbar 4902bb5ddaff86ee73d2cea7ec1835978afc88a83f0Fariborz Jahanian /// getNSStringSection - Return the section to use for NSString 4912bb5ddaff86ee73d2cea7ec1835978afc88a83f0Fariborz Jahanian /// literals, or 0 if no special section is used. 4922bb5ddaff86ee73d2cea7ec1835978afc88a83f0Fariborz Jahanian virtual const char *getNSStringSection() const { 4932bb5ddaff86ee73d2cea7ec1835978afc88a83f0Fariborz Jahanian return "__OBJC,__cstring_object,regular,no_dead_strip"; 4942bb5ddaff86ee73d2cea7ec1835978afc88a83f0Fariborz Jahanian } 4952bb5ddaff86ee73d2cea7ec1835978afc88a83f0Fariborz Jahanian 496237cf582b89bbcc22640cea15426ddc7ada8412bMichael J. Spencer /// getNSStringNonFragileABISection - Return the section to use for 497ec951e0c2fc0db00c36bc60c900331dde32c1b43Fariborz Jahanian /// NSString literals, or 0 if no special section is used (NonFragile ABI). 498ec951e0c2fc0db00c36bc60c900331dde32c1b43Fariborz Jahanian virtual const char *getNSStringNonFragileABISection() const { 499ec951e0c2fc0db00c36bc60c900331dde32c1b43Fariborz Jahanian return "__DATA, __objc_stringobj, regular, no_dead_strip"; 500ec951e0c2fc0db00c36bc60c900331dde32c1b43Fariborz Jahanian } 501ec951e0c2fc0db00c36bc60c900331dde32c1b43Fariborz Jahanian 502797c3c4f5dc4fda735e55c6b5d6270a54cf6d263Chris Lattner /// isValidSectionSpecifier - This is an optional hook that targets can 503797c3c4f5dc4fda735e55c6b5d6270a54cf6d263Chris Lattner /// implement to perform semantic checking on attribute((section("foo"))) 504797c3c4f5dc4fda735e55c6b5d6270a54cf6d263Chris Lattner /// specifiers. In this case, "foo" is passed in to be checked. If the 505797c3c4f5dc4fda735e55c6b5d6270a54cf6d263Chris Lattner /// section specifier is invalid, the backend should return a non-empty string 506797c3c4f5dc4fda735e55c6b5d6270a54cf6d263Chris Lattner /// that indicates the problem. 507797c3c4f5dc4fda735e55c6b5d6270a54cf6d263Chris Lattner /// 508797c3c4f5dc4fda735e55c6b5d6270a54cf6d263Chris Lattner /// This hook is a simple quality of implementation feature to catch errors 509797c3c4f5dc4fda735e55c6b5d6270a54cf6d263Chris Lattner /// and give good diagnostics in cases when the assembler or code generator 510797c3c4f5dc4fda735e55c6b5d6270a54cf6d263Chris Lattner /// would otherwise reject the section specifier. 511797c3c4f5dc4fda735e55c6b5d6270a54cf6d263Chris Lattner /// 512686775deca8b8685eb90801495880e3abdd844c2Chris Lattner virtual std::string isValidSectionSpecifier(StringRef SR) const { 513797c3c4f5dc4fda735e55c6b5d6270a54cf6d263Chris Lattner return ""; 514797c3c4f5dc4fda735e55c6b5d6270a54cf6d263Chris Lattner } 5158e5c2b8072f4409c7c0004331d1db9652d5209c0Daniel Dunbar 516a6fda124bf380479529d6a80b84b62cacd3cb707John Thompson /// setForcedLangOptions - Set forced language options. 517a6fda124bf380479529d6a80b84b62cacd3cb707John Thompson /// Apply changes to the target information with respect to certain 518a6fda124bf380479529d6a80b84b62cacd3cb707John Thompson /// language options which change the target configuration. 519a6fda124bf380479529d6a80b84b62cacd3cb707John Thompson virtual void setForcedLangOptions(LangOptions &Opts); 520a6fda124bf380479529d6a80b84b62cacd3cb707John Thompson 521c3a2e654f1e1c5cf956d0666d9c4c2f60a66f112Chandler Carruth /// getDefaultFeatures - Get the default set of target features for the CPU; 522c3a2e654f1e1c5cf956d0666d9c4c2f60a66f112Chandler Carruth /// this should include all legal feature strings on the target. 523c3a2e654f1e1c5cf956d0666d9c4c2f60a66f112Chandler Carruth virtual void getDefaultFeatures(llvm::StringMap<bool> &Features) const { 52417ca3638e852ba81f389e9f896ed0420b52ae606Daniel Dunbar } 52517ca3638e852ba81f389e9f896ed0420b52ae606Daniel Dunbar 526018ba5ab0671d9b6eefecaffc118c869bea151a1Daniel Dunbar /// getABI - Get the ABI in use. 527018ba5ab0671d9b6eefecaffc118c869bea151a1Daniel Dunbar virtual const char *getABI() const { 528018ba5ab0671d9b6eefecaffc118c869bea151a1Daniel Dunbar return ""; 529018ba5ab0671d9b6eefecaffc118c869bea151a1Daniel Dunbar } 530018ba5ab0671d9b6eefecaffc118c869bea151a1Daniel Dunbar 53198b7c5c496dfccb39287b8f7d8f1444594936d10Charles Davis /// getCXXABI - Get the C++ ABI in use. 53220cf717034ba1f20fc47c025ecb72ed9b631ad13Charles Davis virtual TargetCXXABI getCXXABI() const { 53398b7c5c496dfccb39287b8f7d8f1444594936d10Charles Davis return CXXABI; 53498b7c5c496dfccb39287b8f7d8f1444594936d10Charles Davis } 53598b7c5c496dfccb39287b8f7d8f1444594936d10Charles Davis 536eac7c53f16bc12bcd9baac756b6f9bb77b74b0adDaniel Dunbar /// setCPU - Target the specific CPU. 537eac7c53f16bc12bcd9baac756b6f9bb77b74b0adDaniel Dunbar /// 538eac7c53f16bc12bcd9baac756b6f9bb77b74b0adDaniel Dunbar /// \return - False on error (invalid CPU name). 539eac7c53f16bc12bcd9baac756b6f9bb77b74b0adDaniel Dunbar virtual bool setCPU(const std::string &Name) { 540c3a2e654f1e1c5cf956d0666d9c4c2f60a66f112Chandler Carruth return false; 541eac7c53f16bc12bcd9baac756b6f9bb77b74b0adDaniel Dunbar } 542eac7c53f16bc12bcd9baac756b6f9bb77b74b0adDaniel Dunbar 54373b79596bac6f6169e5979d0c7241924259d2a76Daniel Dunbar /// setABI - Use the specific ABI. 54473b79596bac6f6169e5979d0c7241924259d2a76Daniel Dunbar /// 54573b79596bac6f6169e5979d0c7241924259d2a76Daniel Dunbar /// \return - False on error (invalid ABI name). 54673b79596bac6f6169e5979d0c7241924259d2a76Daniel Dunbar virtual bool setABI(const std::string &Name) { 54773b79596bac6f6169e5979d0c7241924259d2a76Daniel Dunbar return false; 54873b79596bac6f6169e5979d0c7241924259d2a76Daniel Dunbar } 54973b79596bac6f6169e5979d0c7241924259d2a76Daniel Dunbar 55098b7c5c496dfccb39287b8f7d8f1444594936d10Charles Davis /// setCXXABI - Use this specific C++ ABI. 55198b7c5c496dfccb39287b8f7d8f1444594936d10Charles Davis /// 55220cf717034ba1f20fc47c025ecb72ed9b631ad13Charles Davis /// \return - False on error (invalid C++ ABI name). 553ee79a4c30e5d1c5285551c9a25b8ec6d45d46aa7John McCall bool setCXXABI(const std::string &Name) { 554ee79a4c30e5d1c5285551c9a25b8ec6d45d46aa7John McCall static const TargetCXXABI Unknown = static_cast<TargetCXXABI>(-1); 555ee79a4c30e5d1c5285551c9a25b8ec6d45d46aa7John McCall TargetCXXABI ABI = llvm::StringSwitch<TargetCXXABI>(Name) 556ee79a4c30e5d1c5285551c9a25b8ec6d45d46aa7John McCall .Case("arm", CXXABI_ARM) 55720cf717034ba1f20fc47c025ecb72ed9b631ad13Charles Davis .Case("itanium", CXXABI_Itanium) 55820cf717034ba1f20fc47c025ecb72ed9b631ad13Charles Davis .Case("microsoft", CXXABI_Microsoft) 559ee79a4c30e5d1c5285551c9a25b8ec6d45d46aa7John McCall .Default(Unknown); 560ee79a4c30e5d1c5285551c9a25b8ec6d45d46aa7John McCall if (ABI == Unknown) return false; 561ee79a4c30e5d1c5285551c9a25b8ec6d45d46aa7John McCall return setCXXABI(ABI); 562ee79a4c30e5d1c5285551c9a25b8ec6d45d46aa7John McCall } 563ee79a4c30e5d1c5285551c9a25b8ec6d45d46aa7John McCall 564ee79a4c30e5d1c5285551c9a25b8ec6d45d46aa7John McCall /// setCXXABI - Set the C++ ABI to be used by this implementation. 565ee79a4c30e5d1c5285551c9a25b8ec6d45d46aa7John McCall /// 566ee79a4c30e5d1c5285551c9a25b8ec6d45d46aa7John McCall /// \return - False on error (ABI not valid on this target) 567ee79a4c30e5d1c5285551c9a25b8ec6d45d46aa7John McCall virtual bool setCXXABI(TargetCXXABI ABI) { 568ee79a4c30e5d1c5285551c9a25b8ec6d45d46aa7John McCall CXXABI = ABI; 56998b7c5c496dfccb39287b8f7d8f1444594936d10Charles Davis return true; 57098b7c5c496dfccb39287b8f7d8f1444594936d10Charles Davis } 57198b7c5c496dfccb39287b8f7d8f1444594936d10Charles Davis 57217ca3638e852ba81f389e9f896ed0420b52ae606Daniel Dunbar /// setFeatureEnabled - Enable or disable a specific target feature, 57317ca3638e852ba81f389e9f896ed0420b52ae606Daniel Dunbar /// the feature name must be valid. 57417ca3638e852ba81f389e9f896ed0420b52ae606Daniel Dunbar /// 57517ca3638e852ba81f389e9f896ed0420b52ae606Daniel Dunbar /// \return - False on error (invalid feature name). 57617ca3638e852ba81f389e9f896ed0420b52ae606Daniel Dunbar virtual bool setFeatureEnabled(llvm::StringMap<bool> &Features, 57717ca3638e852ba81f389e9f896ed0420b52ae606Daniel Dunbar const std::string &Name, 57817ca3638e852ba81f389e9f896ed0420b52ae606Daniel Dunbar bool Enabled) const { 57917ca3638e852ba81f389e9f896ed0420b52ae606Daniel Dunbar return false; 580868bd0aa9281929ef50d2e9a8c82a036906f53f5Daniel Dunbar } 581868bd0aa9281929ef50d2e9a8c82a036906f53f5Daniel Dunbar 58229a790ba422cfeeea9546b6e76777d98fa73cd67Daniel Dunbar /// HandleTargetOptions - Perform initialization based on the user configured 58329a790ba422cfeeea9546b6e76777d98fa73cd67Daniel Dunbar /// set of features (e.g., +sse4). The list is guaranteed to have at most one 58429a790ba422cfeeea9546b6e76777d98fa73cd67Daniel Dunbar /// entry per feature. 585b93292ab7f2b3d43a9e0ad6421f572d1f5a323b4Daniel Dunbar /// 586b93292ab7f2b3d43a9e0ad6421f572d1f5a323b4Daniel Dunbar /// The target may modify the features list, to change which options are 587b93292ab7f2b3d43a9e0ad6421f572d1f5a323b4Daniel Dunbar /// passed onwards to the backend. 588b93292ab7f2b3d43a9e0ad6421f572d1f5a323b4Daniel Dunbar virtual void HandleTargetFeatures(std::vector<std::string> &Features) { 58916167a6e3f7dfb7ed0babc5e0baab9fd140e959dChris Lattner } 590264a76cdf382c507f4d43e64c89f1503f003ac95Anton Korobeynikov 591264a76cdf382c507f4d43e64c89f1503f003ac95Anton Korobeynikov // getRegParmMax - Returns maximal number of args passed in registers. 592264a76cdf382c507f4d43e64c89f1503f003ac95Anton Korobeynikov unsigned getRegParmMax() const { 5937e47e1e7e6a2b83d903c97129f27e92f584c3dc2Douglas Gregor assert(RegParmMax < 7 && "RegParmMax value is larger than AST can handle"); 594264a76cdf382c507f4d43e64c89f1503f003ac95Anton Korobeynikov return RegParmMax; 595264a76cdf382c507f4d43e64c89f1503f003ac95Anton Korobeynikov } 596264a76cdf382c507f4d43e64c89f1503f003ac95Anton Korobeynikov 59721fb98ee003e992b0c4e204d98a19e0ef544cae3Chris Lattner /// isTLSSupported - Whether the target supports thread-local storage. 5986a3bc6df36848188e9d0c1d978170c2b0918c6a3Chris Lattner bool isTLSSupported() const { 599b030f0272500c6c5602f587ac029ee0dc0e5a05cEli Friedman return TLSSupported; 600b030f0272500c6c5602f587ac029ee0dc0e5a05cEli Friedman } 601237cf582b89bbcc22640cea15426ddc7ada8412bMichael J. Spencer 6029bffb0701d02a10e77e1ac0f196074eed6466ed0Chris Lattner /// hasNoAsmVariants - Return true if {|} are normal characters in the 6039bffb0701d02a10e77e1ac0f196074eed6466ed0Chris Lattner /// asm string. If this returns false (the default), then {abc|xyz} is syntax 60437de281ac149a5c5f14e4935a3738d87370da3edChris Lattner /// that says that when compiling for asm variant #0, "abc" should be 6059bffb0701d02a10e77e1ac0f196074eed6466ed0Chris Lattner /// generated, but when compiling for asm variant #1, "xyz" should be 6069bffb0701d02a10e77e1ac0f196074eed6466ed0Chris Lattner /// generated. 6079bffb0701d02a10e77e1ac0f196074eed6466ed0Chris Lattner bool hasNoAsmVariants() const { 6089bffb0701d02a10e77e1ac0f196074eed6466ed0Chris Lattner return NoAsmVariants; 6099bffb0701d02a10e77e1ac0f196074eed6466ed0Chris Lattner } 610237cf582b89bbcc22640cea15426ddc7ada8412bMichael J. Spencer 61121fb98ee003e992b0c4e204d98a19e0ef544cae3Chris Lattner /// getEHDataRegisterNumber - Return the register number that 61221fb98ee003e992b0c4e204d98a19e0ef544cae3Chris Lattner /// __builtin_eh_return_regno would return with the specified argument. 61321fb98ee003e992b0c4e204d98a19e0ef544cae3Chris Lattner virtual int getEHDataRegisterNumber(unsigned RegNo) const { 614237cf582b89bbcc22640cea15426ddc7ada8412bMichael J. Spencer return -1; 61521fb98ee003e992b0c4e204d98a19e0ef544cae3Chris Lattner } 616237cf582b89bbcc22640cea15426ddc7ada8412bMichael J. Spencer 617237cf582b89bbcc22640cea15426ddc7ada8412bMichael J. Spencer /// getStaticInitSectionSpecifier - Return the section to use for C++ static 61818af368c080b9d60e34e670cd01f7d2d3ad2ba48Anders Carlsson /// initialization functions. 61918af368c080b9d60e34e670cd01f7d2d3ad2ba48Anders Carlsson virtual const char *getStaticInitSectionSpecifier() const { 62018af368c080b9d60e34e670cd01f7d2d3ad2ba48Anders Carlsson return 0; 62118af368c080b9d60e34e670cd01f7d2d3ad2ba48Anders Carlsson } 622207f4d8543529221932af82836016a2ef066c917Peter Collingbourne 623207f4d8543529221932af82836016a2ef066c917Peter Collingbourne const LangAS::Map &getAddressSpaceMap() const { 624207f4d8543529221932af82836016a2ef066c917Peter Collingbourne return *AddrSpaceMap; 625207f4d8543529221932af82836016a2ef066c917Peter Collingbourne } 626207f4d8543529221932af82836016a2ef066c917Peter Collingbourne 6270a0d2b179085a52c10402feebeb6db8b4d96a140Douglas Gregor /// \brief Retrieve the name of the platform as it is used in the 6280a0d2b179085a52c10402feebeb6db8b4d96a140Douglas Gregor /// availability attribute. 629686775deca8b8685eb90801495880e3abdd844c2Chris Lattner StringRef getPlatformName() const { return PlatformName; } 6300a0d2b179085a52c10402feebeb6db8b4d96a140Douglas Gregor 6310a0d2b179085a52c10402feebeb6db8b4d96a140Douglas Gregor /// \brief Retrieve the minimum desired version of the platform, to 6320a0d2b179085a52c10402feebeb6db8b4d96a140Douglas Gregor /// which the program should be compiled. 6330a0d2b179085a52c10402feebeb6db8b4d96a140Douglas Gregor VersionTuple getPlatformMinVersion() const { return PlatformMinVersion; } 6340a0d2b179085a52c10402feebeb6db8b4d96a140Douglas Gregor 635e6a24e83e71f361c7b7de82cf24ee6f5ddc7f1c2Eli Friedman bool isBigEndian() const { return BigEndian; } 636e6a24e83e71f361c7b7de82cf24ee6f5ddc7f1c2Eli Friedman 6370eaed12e634dfd14f44620f63b8d3276fed028ddChris Lattnerprotected: 6380e5d4ef3155651af17a90fdc07d9f80b33935c0cChris Lattner virtual uint64_t getPointerWidthV(unsigned AddrSpace) const { 6390e5d4ef3155651af17a90fdc07d9f80b33935c0cChris Lattner return PointerWidth; 6400e5d4ef3155651af17a90fdc07d9f80b33935c0cChris Lattner } 6410e5d4ef3155651af17a90fdc07d9f80b33935c0cChris Lattner virtual uint64_t getPointerAlignV(unsigned AddrSpace) const { 6420e5d4ef3155651af17a90fdc07d9f80b33935c0cChris Lattner return PointerAlign; 6430e5d4ef3155651af17a90fdc07d9f80b33935c0cChris Lattner } 64431fc07df7f0fc89ebf83ca05a20b29de45a7598dSanjiv Gupta virtual enum IntType getPtrDiffTypeV(unsigned AddrSpace) const { 64531fc07df7f0fc89ebf83ca05a20b29de45a7598dSanjiv Gupta return PtrDiffType; 64631fc07df7f0fc89ebf83ca05a20b29de45a7598dSanjiv Gupta } 6471eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump virtual void getGCCRegNames(const char * const *&Names, 6480eaed12e634dfd14f44620f63b8d3276fed028ddChris Lattner unsigned &NumNames) const = 0; 6491eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump virtual void getGCCRegAliases(const GCCRegAlias *&Aliases, 6503346ae6bba10da0d08c8d548134ddab4e13d040fAnders Carlsson unsigned &NumAliases) const = 0; 651cfd323d0d4476dd4ff64097c91b114067ecaa82bEric Christopher virtual void getGCCAddlRegNames(const AddlRegName *&Addl, 652cfd323d0d4476dd4ff64097c91b114067ecaa82bEric Christopher unsigned &NumAddl) const { 653cfd323d0d4476dd4ff64097c91b114067ecaa82bEric Christopher Addl = 0; 654cfd323d0d4476dd4ff64097c91b114067ecaa82bEric Christopher NumAddl = 0; 655cfd323d0d4476dd4ff64097c91b114067ecaa82bEric Christopher } 6561eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump virtual bool validateAsmConstraint(const char *&Name, 657d04c6e23f2e10eeb9936778d67f4a1c4a14cc4f6Anders Carlsson TargetInfo::ConstraintInfo &info) const= 0; 6585f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer}; 6595f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer 6605f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer} // end namespace clang 6615f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer 6625f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer#endif 663