TargetInfo.h revision b6a169395c1b30c76daffebcbd2164b6247a5d21
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
17868bd0aa9281929ef50d2e9a8c82a036906f53f5Daniel Dunbar// FIXME: Daniel isn't smart enough to use a prototype for this.
18868bd0aa9281929ef50d2e9a8c82a036906f53f5Daniel Dunbar#include "llvm/ADT/StringMap.h"
191752ee4849f4c37f5e03193e658be92650b0e65aDaniel Dunbar#include "llvm/ADT/Triple.h"
209f8eb2032030482b1d3de86e9bee725d93564302Chandler Carruth#include "llvm/System/DataTypes.h"
215414fbac5f1749c0e85a8c4eeb5dfece59c3e30aTorok Edwin#include <cassert>
225f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer#include <vector>
235f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer#include <string>
245f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer
25797c3c4f5dc4fda735e55c6b5d6270a54cf6d263Chris Lattnernamespace llvm {
26797c3c4f5dc4fda735e55c6b5d6270a54cf6d263Chris Lattnerstruct fltSemantics;
27797c3c4f5dc4fda735e55c6b5d6270a54cf6d263Chris Lattnerclass StringRef;
28797c3c4f5dc4fda735e55c6b5d6270a54cf6d263Chris Lattner}
29525a05093a4816af961fe2bc6b8a81c17e2e26c2Chris Lattner
305f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencernamespace clang {
315f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencerclass Diagnostic;
32d58c03f42ebb4e548c2b53fa25b1cfe02ebb9ac0Daniel Dunbarclass LangOptions;
33103b71c37a3c3a3da7128c1d0232a89b1e8d0d90Chandler Carruthclass MacroBuilder;
34797c3c4f5dc4fda735e55c6b5d6270a54cf6d263Chris Lattnerclass SourceLocation;
357a9d49fd2bfac00e905b361ba76d26ab5b6c3b09Ted Kremenekclass SourceManager;
36d58c03f42ebb4e548c2b53fa25b1cfe02ebb9ac0Daniel Dunbarclass TargetOptions;
37d58c03f42ebb4e548c2b53fa25b1cfe02ebb9ac0Daniel Dunbar
385f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencernamespace Builtin { struct Info; }
391eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
4042e6737f2efb113563140ad794c21c7709250402Chris Lattner/// TargetInfo - This class exposes information about the current target.
415f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer///
425f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencerclass TargetInfo {
431752ee4849f4c37f5e03193e658be92650b0e65aDaniel Dunbar  llvm::Triple Triple;
440eaed12e634dfd14f44620f63b8d3276fed028ddChris Lattnerprotected:
45cd4fc42896f926ffc081e1c4a8bf4cd647883c14Chris Lattner  // Target values set by the ctor of the actual target implementation.  Default
46cd4fc42896f926ffc081e1c4a8bf4cd647883c14Chris Lattner  // values are specified by the TargetInfo constructor.
47b030f0272500c6c5602f587ac029ee0dc0e5a05cEli Friedman  bool TLSSupported;
48927686fe8c968ca786fa44d2353eebf59c4f5b8aChris Lattner  unsigned char PointerWidth, PointerAlign;
49927686fe8c968ca786fa44d2353eebf59c4f5b8aChris Lattner  unsigned char IntWidth, IntAlign;
5061538a7d1336f3ef3cb81e09f11a1cbb282bcf81Eli Friedman  unsigned char FloatWidth, FloatAlign;
51927686fe8c968ca786fa44d2353eebf59c4f5b8aChris Lattner  unsigned char DoubleWidth, DoubleAlign;
5261538a7d1336f3ef3cb81e09f11a1cbb282bcf81Eli Friedman  unsigned char LongDoubleWidth, LongDoubleAlign;
53927686fe8c968ca786fa44d2353eebf59c4f5b8aChris Lattner  unsigned char LongWidth, LongAlign;
54927686fe8c968ca786fa44d2353eebf59c4f5b8aChris Lattner  unsigned char LongLongWidth, LongLongAlign;
5577e8b53fe3ff630d8d1454db94e38bedda14d5caDaniel Dunbar  const char *DescriptionString;
563fdf4678935b27c3d3fd4eb10bf9f5ab98dc0d99Chris Lattner  const char *UserLabelPrefix;
57cd4fc42896f926ffc081e1c4a8bf4cd647883c14Chris Lattner  const llvm::fltSemantics *FloatFormat, *DoubleFormat, *LongDoubleFormat;
58264a76cdf382c507f4d43e64c89f1503f003ac95Anton Korobeynikov  unsigned char RegParmMax, SSERegParmMax;
59bbced580c92afa09cd4423a9bdc90ff61cb1e79aTed Kremenek
60cd4fc42896f926ffc081e1c4a8bf4cd647883c14Chris Lattner  // TargetInfo Constructor.  Default initializes all fields.
61cd4fc42896f926ffc081e1c4a8bf4cd647883c14Chris Lattner  TargetInfo(const std::string &T);
621eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
631eb4433ac451dc16f4133a88af2d002ac26c58efMike Stumppublic:
64d58c03f42ebb4e548c2b53fa25b1cfe02ebb9ac0Daniel Dunbar  /// CreateTargetInfo - Construct a target for the given options.
65b93292ab7f2b3d43a9e0ad6421f572d1f5a323b4Daniel Dunbar  ///
66b93292ab7f2b3d43a9e0ad6421f572d1f5a323b4Daniel Dunbar  /// \param Opts - The options to use to initialize the target. The target may
67b93292ab7f2b3d43a9e0ad6421f572d1f5a323b4Daniel Dunbar  /// modify the options to canonicalize the target feature information to match
68b93292ab7f2b3d43a9e0ad6421f572d1f5a323b4Daniel Dunbar  /// what the backend expects.
69b93292ab7f2b3d43a9e0ad6421f572d1f5a323b4Daniel Dunbar  static TargetInfo* CreateTargetInfo(Diagnostic &Diags, TargetOptions &Opts);
70bbced580c92afa09cd4423a9bdc90ff61cb1e79aTed Kremenek
710eaed12e634dfd14f44620f63b8d3276fed028ddChris Lattner  virtual ~TargetInfo();
72fb79f7cc00f9c1e04f11ed636eefb36d246b0fb8Ted Kremenek
739c4bea1fa7291035325575c02d33552a124d8ef3Chris Lattner  ///===---- Target Data Type Query Methods -------------------------------===//
7431fc07df7f0fc89ebf83ca05a20b29de45a7598dSanjiv Gupta  enum IntType {
752b5abf515f9696912452f431c7738691cf97f4f1Chris Lattner    NoInt = 0,
7631fc07df7f0fc89ebf83ca05a20b29de45a7598dSanjiv Gupta    SignedShort,
7731fc07df7f0fc89ebf83ca05a20b29de45a7598dSanjiv Gupta    UnsignedShort,
7831fc07df7f0fc89ebf83ca05a20b29de45a7598dSanjiv Gupta    SignedInt,
7931fc07df7f0fc89ebf83ca05a20b29de45a7598dSanjiv Gupta    UnsignedInt,
8031fc07df7f0fc89ebf83ca05a20b29de45a7598dSanjiv Gupta    SignedLong,
8131fc07df7f0fc89ebf83ca05a20b29de45a7598dSanjiv Gupta    UnsignedLong,
8231fc07df7f0fc89ebf83ca05a20b29de45a7598dSanjiv Gupta    SignedLongLong,
8331fc07df7f0fc89ebf83ca05a20b29de45a7598dSanjiv Gupta    UnsignedLongLong
843fa8f7491a6a6c1445768ea23ec85d3554c3ba98Chris Lattner  };
853fa8f7491a6a6c1445768ea23ec85d3554c3ba98Chris Lattnerprotected:
863c7b6e46c5f9bdbe0676c52d80df98b68b02be99Eli Friedman  IntType SizeType, IntMaxType, UIntMaxType, PtrDiffType, IntPtrType, WCharType,
879cf910efc4fb7001a6d276ed2eabf01f0f0efaaaEdward O'Callaghan          WIntType, Char16Type, Char32Type, Int64Type, SigAtomicType;
88b6a169395c1b30c76daffebcbd2164b6247a5d21Daniel Dunbar
89b6a169395c1b30c76daffebcbd2164b6247a5d21Daniel Dunbar  /// Control whether the alignment of bit-field types is respected when laying
90b6a169395c1b30c76daffebcbd2164b6247a5d21Daniel Dunbar  /// out structures. If true, then the alignment of the bit-field type will be
91b6a169395c1b30c76daffebcbd2164b6247a5d21Daniel Dunbar  /// used to (a) impact the alignment of the containing structure, and (b)
92b6a169395c1b30c76daffebcbd2164b6247a5d21Daniel Dunbar  /// ensure that the individual bit-field will not straddle an alignment
93b6a169395c1b30c76daffebcbd2164b6247a5d21Daniel Dunbar  /// boundary.
94b6a169395c1b30c76daffebcbd2164b6247a5d21Daniel Dunbar  unsigned UseBitfieldTypeAlignment : 1;
95b6a169395c1b30c76daffebcbd2164b6247a5d21Daniel Dunbar
963fa8f7491a6a6c1445768ea23ec85d3554c3ba98Chris Lattnerpublic:
973fa8f7491a6a6c1445768ea23ec85d3554c3ba98Chris Lattner  IntType getSizeType() const { return SizeType; }
983fa8f7491a6a6c1445768ea23ec85d3554c3ba98Chris Lattner  IntType getIntMaxType() const { return IntMaxType; }
993fa8f7491a6a6c1445768ea23ec85d3554c3ba98Chris Lattner  IntType getUIntMaxType() const { return UIntMaxType; }
1003fa8f7491a6a6c1445768ea23ec85d3554c3ba98Chris Lattner  IntType getPtrDiffType(unsigned AddrSpace) const {
10131fc07df7f0fc89ebf83ca05a20b29de45a7598dSanjiv Gupta    return AddrSpace == 0 ? PtrDiffType : getPtrDiffTypeV(AddrSpace);
10231fc07df7f0fc89ebf83ca05a20b29de45a7598dSanjiv Gupta  }
1036ad474f82f0cf32e13128d89fa5ad3a37ae73530Chris Lattner  IntType getIntPtrType() const { return IntPtrType; }
1043fa8f7491a6a6c1445768ea23ec85d3554c3ba98Chris Lattner  IntType getWCharType() const { return WCharType; }
105e64ef80363c84f4f431e26b61db554c89beeddb6Chris Lattner  IntType getWIntType() const { return WIntType; }
106f5c209d23b20ada4a9b6235db50317239cbf6ae1Alisdair Meredith  IntType getChar16Type() const { return Char16Type; }
107f5c209d23b20ada4a9b6235db50317239cbf6ae1Alisdair Meredith  IntType getChar32Type() const { return Char32Type; }
1083c7b6e46c5f9bdbe0676c52d80df98b68b02be99Eli Friedman  IntType getInt64Type() const { return Int64Type; }
1099cf910efc4fb7001a6d276ed2eabf01f0f0efaaaEdward O'Callaghan  IntType getSigAtomicType() const { return SigAtomicType; }
1105f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer
111b304f77cb621a47221f2aa2d35acdb5c730421ffChris Lattner
112b304f77cb621a47221f2aa2d35acdb5c730421ffChris Lattner  /// getTypeWidth - Return the width (in bits) of the specified integer type
113b304f77cb621a47221f2aa2d35acdb5c730421ffChris Lattner  /// enum. For example, SignedInt -> getIntWidth().
114b304f77cb621a47221f2aa2d35acdb5c730421ffChris Lattner  unsigned getTypeWidth(IntType T) const;
115b304f77cb621a47221f2aa2d35acdb5c730421ffChris Lattner
1169099e7bcda3922cee0cffcdf21332ac4aa193ceaChris Lattner  /// getTypeAlign - Return the alignment (in bits) of the specified integer
1179099e7bcda3922cee0cffcdf21332ac4aa193ceaChris Lattner  /// type enum. For example, SignedInt -> getIntAlign().
1189099e7bcda3922cee0cffcdf21332ac4aa193ceaChris Lattner  unsigned getTypeAlign(IntType T) const;
1199099e7bcda3922cee0cffcdf21332ac4aa193ceaChris Lattner
120961f0708fb66375acf47f9e9bc1aecfb3f992aeaChris Lattner  /// isTypeSigned - Return whether an integer types is signed. Returns true if
121b304f77cb621a47221f2aa2d35acdb5c730421ffChris Lattner  /// the type is signed; false otherwise.
122961f0708fb66375acf47f9e9bc1aecfb3f992aeaChris Lattner  bool isTypeSigned(IntType T) const;
123b304f77cb621a47221f2aa2d35acdb5c730421ffChris Lattner
124f72a44330b9d9a4b2d93e9b91cfb8ab7bd4a0643Chris Lattner  /// getPointerWidth - Return the width of pointers on this target, for the
125927686fe8c968ca786fa44d2353eebf59c4f5b8aChris Lattner  /// specified address space.
126927686fe8c968ca786fa44d2353eebf59c4f5b8aChris Lattner  uint64_t getPointerWidth(unsigned AddrSpace) const {
127927686fe8c968ca786fa44d2353eebf59c4f5b8aChris Lattner    return AddrSpace == 0 ? PointerWidth : getPointerWidthV(AddrSpace);
128927686fe8c968ca786fa44d2353eebf59c4f5b8aChris Lattner  }
129927686fe8c968ca786fa44d2353eebf59c4f5b8aChris Lattner  uint64_t getPointerAlign(unsigned AddrSpace) const {
130927686fe8c968ca786fa44d2353eebf59c4f5b8aChris Lattner    return AddrSpace == 0 ? PointerAlign : getPointerAlignV(AddrSpace);
131927686fe8c968ca786fa44d2353eebf59c4f5b8aChris Lattner  }
1321eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
1339e9b6dc3fd413f5341fab54b681420eeb21cd169Chris Lattner  /// getBoolWidth/Align - Return the size of '_Bool' and C++ 'bool' for this
1349e9b6dc3fd413f5341fab54b681420eeb21cd169Chris Lattner  /// target, in bits.
1359e9b6dc3fd413f5341fab54b681420eeb21cd169Chris Lattner  unsigned getBoolWidth(bool isWide = false) const { return 8; }  // FIXME
1369e9b6dc3fd413f5341fab54b681420eeb21cd169Chris Lattner  unsigned getBoolAlign(bool isWide = false) const { return 8; }  // FIXME
1371eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
138f5c209d23b20ada4a9b6235db50317239cbf6ae1Alisdair Meredith  unsigned getCharWidth() const { return 8; } // FIXME
139f5c209d23b20ada4a9b6235db50317239cbf6ae1Alisdair Meredith  unsigned getCharAlign() const { return 8; } // FIXME
1401eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
1419e9b6dc3fd413f5341fab54b681420eeb21cd169Chris Lattner  /// getShortWidth/Align - Return the size of 'signed short' and
1421eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump  /// 'unsigned short' for this target, in bits.
1439e9b6dc3fd413f5341fab54b681420eeb21cd169Chris Lattner  unsigned getShortWidth() const { return 16; } // FIXME
1449e9b6dc3fd413f5341fab54b681420eeb21cd169Chris Lattner  unsigned getShortAlign() const { return 16; } // FIXME
1451eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
1469e9b6dc3fd413f5341fab54b681420eeb21cd169Chris Lattner  /// getIntWidth/Align - Return the size of 'signed int' and 'unsigned int' for
1479e9b6dc3fd413f5341fab54b681420eeb21cd169Chris Lattner  /// this target, in bits.
1482621fd1d6d3c5eadcae246859f62738645df7540Chris Lattner  unsigned getIntWidth() const { return IntWidth; }
1492621fd1d6d3c5eadcae246859f62738645df7540Chris Lattner  unsigned getIntAlign() const { return IntAlign; }
1501eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
1519e9b6dc3fd413f5341fab54b681420eeb21cd169Chris Lattner  /// getLongWidth/Align - Return the size of 'signed long' and 'unsigned long'
1529e9b6dc3fd413f5341fab54b681420eeb21cd169Chris Lattner  /// for this target, in bits.
1538059e997ee05e4aa87f7e21fed630429a140ee53Chris Lattner  unsigned getLongWidth() const { return LongWidth; }
1548059e997ee05e4aa87f7e21fed630429a140ee53Chris Lattner  unsigned getLongAlign() const { return LongAlign; }
1551eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
1569e9b6dc3fd413f5341fab54b681420eeb21cd169Chris Lattner  /// getLongLongWidth/Align - Return the size of 'signed long long' and
1579e9b6dc3fd413f5341fab54b681420eeb21cd169Chris Lattner  /// 'unsigned long long' for this target, in bits.
158ec10f5886526124ba733fbd0ef8665d576285daaChris Lattner  unsigned getLongLongWidth() const { return LongLongWidth; }
159ec10f5886526124ba733fbd0ef8665d576285daaChris Lattner  unsigned getLongLongAlign() const { return LongLongAlign; }
1601eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
161f5c209d23b20ada4a9b6235db50317239cbf6ae1Alisdair Meredith  /// getWCharWidth/Align - Return the size of 'wchar_t' for this target, in
1629e9b6dc3fd413f5341fab54b681420eeb21cd169Chris Lattner  /// bits.
1639184646509d015ea66e796113a8c68598681374bChris Lattner  unsigned getWCharWidth() const { return getTypeWidth(WCharType); }
1649184646509d015ea66e796113a8c68598681374bChris Lattner  unsigned getWCharAlign() const { return getTypeAlign(WCharType); }
165f72a44330b9d9a4b2d93e9b91cfb8ab7bd4a0643Chris Lattner
166f5c209d23b20ada4a9b6235db50317239cbf6ae1Alisdair Meredith  /// getChar16Width/Align - Return the size of 'char16_t' for this target, in
167f5c209d23b20ada4a9b6235db50317239cbf6ae1Alisdair Meredith  /// bits.
1689184646509d015ea66e796113a8c68598681374bChris Lattner  unsigned getChar16Width() const { return getTypeWidth(Char16Type); }
1699184646509d015ea66e796113a8c68598681374bChris Lattner  unsigned getChar16Align() const { return getTypeAlign(Char16Type); }
170f5c209d23b20ada4a9b6235db50317239cbf6ae1Alisdair Meredith
171f5c209d23b20ada4a9b6235db50317239cbf6ae1Alisdair Meredith  /// getChar32Width/Align - Return the size of 'char32_t' for this target, in
172f5c209d23b20ada4a9b6235db50317239cbf6ae1Alisdair Meredith  /// bits.
1739184646509d015ea66e796113a8c68598681374bChris Lattner  unsigned getChar32Width() const { return getTypeWidth(Char32Type); }
1749184646509d015ea66e796113a8c68598681374bChris Lattner  unsigned getChar32Align() const { return getTypeAlign(Char32Type); }
175f5c209d23b20ada4a9b6235db50317239cbf6ae1Alisdair Meredith
1769e9b6dc3fd413f5341fab54b681420eeb21cd169Chris Lattner  /// getFloatWidth/Align/Format - Return the size/align/format of 'float'.
17761538a7d1336f3ef3cb81e09f11a1cbb282bcf81Eli Friedman  unsigned getFloatWidth() const { return FloatWidth; }
17861538a7d1336f3ef3cb81e09f11a1cbb282bcf81Eli Friedman  unsigned getFloatAlign() const { return FloatAlign; }
179b7cfe88e88cb4f46308de89cf3f0c81bfe624128Chris Lattner  const llvm::fltSemantics &getFloatFormat() const { return *FloatFormat; }
1809e9b6dc3fd413f5341fab54b681420eeb21cd169Chris Lattner
1819e9b6dc3fd413f5341fab54b681420eeb21cd169Chris Lattner  /// getDoubleWidth/Align/Format - Return the size/align/format of 'double'.
182c8b1227fa8c17d9881815e40c04e19334be536f8Nate Begeman  unsigned getDoubleWidth() const { return DoubleWidth; }
183c8b1227fa8c17d9881815e40c04e19334be536f8Nate Begeman  unsigned getDoubleAlign() const { return DoubleAlign; }
184b7cfe88e88cb4f46308de89cf3f0c81bfe624128Chris Lattner  const llvm::fltSemantics &getDoubleFormat() const { return *DoubleFormat; }
1859e9b6dc3fd413f5341fab54b681420eeb21cd169Chris Lattner
1869e9b6dc3fd413f5341fab54b681420eeb21cd169Chris Lattner  /// getLongDoubleWidth/Align/Format - Return the size/align/format of 'long
1879e9b6dc3fd413f5341fab54b681420eeb21cd169Chris Lattner  /// double'.
18861538a7d1336f3ef3cb81e09f11a1cbb282bcf81Eli Friedman  unsigned getLongDoubleWidth() const { return LongDoubleWidth; }
18961538a7d1336f3ef3cb81e09f11a1cbb282bcf81Eli Friedman  unsigned getLongDoubleAlign() const { return LongDoubleAlign; }
190b7cfe88e88cb4f46308de89cf3f0c81bfe624128Chris Lattner  const llvm::fltSemantics &getLongDoubleFormat() const {
191b7cfe88e88cb4f46308de89cf3f0c81bfe624128Chris Lattner    return *LongDoubleFormat;
192cd4fc42896f926ffc081e1c4a8bf4cd647883c14Chris Lattner  }
1931eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
1945f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  /// getIntMaxTWidth - Return the size of intmax_t and uintmax_t for this
1951eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump  /// target, in bits.
1960eaed12e634dfd14f44620f63b8d3276fed028ddChris Lattner  unsigned getIntMaxTWidth() const {
1979184646509d015ea66e796113a8c68598681374bChris Lattner    return getTypeWidth(IntMaxType);
1985f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  }
1991eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
2003fdf4678935b27c3d3fd4eb10bf9f5ab98dc0d99Chris Lattner  /// getUserLabelPrefix - This returns the default value of the
2013fdf4678935b27c3d3fd4eb10bf9f5ab98dc0d99Chris Lattner  /// __USER_LABEL_PREFIX__ macro, which is the prefix given to user symbols by
2023fdf4678935b27c3d3fd4eb10bf9f5ab98dc0d99Chris Lattner  /// default.  On most platforms this is "_", but it is "" on some, and "." on
2033fdf4678935b27c3d3fd4eb10bf9f5ab98dc0d99Chris Lattner  /// others.
2043fdf4678935b27c3d3fd4eb10bf9f5ab98dc0d99Chris Lattner  const char *getUserLabelPrefix() const {
2053fdf4678935b27c3d3fd4eb10bf9f5ab98dc0d99Chris Lattner    return UserLabelPrefix;
2063fdf4678935b27c3d3fd4eb10bf9f5ab98dc0d99Chris Lattner  }
2071eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
208b6a169395c1b30c76daffebcbd2164b6247a5d21Daniel Dunbar  bool useBitfieldTypeAlignment() const {
209b6a169395c1b30c76daffebcbd2164b6247a5d21Daniel Dunbar    return UseBitfieldTypeAlignment;
210b6a169395c1b30c76daffebcbd2164b6247a5d21Daniel Dunbar  }
211b6a169395c1b30c76daffebcbd2164b6247a5d21Daniel Dunbar
2122b5abf515f9696912452f431c7738691cf97f4f1Chris Lattner  /// getTypeName - Return the user string for the specified integer type enum.
2132b5abf515f9696912452f431c7738691cf97f4f1Chris Lattner  /// For example, SignedShort -> "short".
2142b5abf515f9696912452f431c7738691cf97f4f1Chris Lattner  static const char *getTypeName(IntType T);
2151eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
216b304f77cb621a47221f2aa2d35acdb5c730421ffChris Lattner  /// getTypeConstantSuffix - Return the constant suffix for the specified
217b304f77cb621a47221f2aa2d35acdb5c730421ffChris Lattner  /// integer type enum. For example, SignedLong -> "L".
218b304f77cb621a47221f2aa2d35acdb5c730421ffChris Lattner  static const char *getTypeConstantSuffix(IntType T);
219b304f77cb621a47221f2aa2d35acdb5c730421ffChris Lattner
2209c4bea1fa7291035325575c02d33552a124d8ef3Chris Lattner  ///===---- Other target property query methods --------------------------===//
2211eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
2229c4bea1fa7291035325575c02d33552a124d8ef3Chris Lattner  /// getTargetDefines - Appends the target-specific #define values for this
2239c4bea1fa7291035325575c02d33552a124d8ef3Chris Lattner  /// target set to the specified buffer.
22433328642a7a8a126918814ddcbcebf83c121ad54Chris Lattner  virtual void getTargetDefines(const LangOptions &Opts,
225a99927774d07af9c6f0e1945531eadc910592945Benjamin Kramer                                MacroBuilder &Builder) const = 0;
2261eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
227b304f77cb621a47221f2aa2d35acdb5c730421ffChris Lattner
2285f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  /// getTargetBuiltins - Return information about target-specific builtins for
2295f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  /// the current primary target, and info about which builtins are non-portable
2305f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  /// across the current set of primary and secondary targets.
2311eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump  virtual void getTargetBuiltins(const Builtin::Info *&Records,
2320eaed12e634dfd14f44620f63b8d3276fed028ddChris Lattner                                 unsigned &NumRecords) const = 0;
2335f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer
234d19144b244f86227fcc2b0da794929fe83968dd5Chris Lattner  /// getVAListDeclaration - Return the declaration to use for
235d19144b244f86227fcc2b0da794929fe83968dd5Chris Lattner  /// __builtin_va_list, which is target-specific.
2360eaed12e634dfd14f44620f63b8d3276fed028ddChris Lattner  virtual const char *getVAListDeclaration() const = 0;
237fb5e5ba3c7708f3aef4db0ed30e8470b3ed4206aAnders Carlsson
2383346ae6bba10da0d08c8d548134ddab4e13d040fAnders Carlsson  /// isValidGCCRegisterName - Returns whether the passed in string
2393346ae6bba10da0d08c8d548134ddab4e13d040fAnders Carlsson  /// is a valid register name according to GCC. This is used by Sema for
2403346ae6bba10da0d08c8d548134ddab4e13d040fAnders Carlsson  /// inline asm statements.
24183c021c6d33aa173cf1a6e3bc61006dabb042703Anders Carlsson  bool isValidGCCRegisterName(llvm::StringRef Name) const;
242d04c6e23f2e10eeb9936778d67f4a1c4a14cc4f6Anders Carlsson
243d04c6e23f2e10eeb9936778d67f4a1c4a14cc4f6Anders Carlsson  // getNormalizedGCCRegisterName - Returns the "normalized" GCC register name.
244d04c6e23f2e10eeb9936778d67f4a1c4a14cc4f6Anders Carlsson  // For example, on x86 it will return "ax" when "eax" is passed in.
24583c021c6d33aa173cf1a6e3bc61006dabb042703Anders Carlsson  llvm::StringRef getNormalizedGCCRegisterName(llvm::StringRef Name) const;
2461eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
24744def070435a2b5d67f0534f7a3a85a7389d60f2Chris Lattner  struct ConstraintInfo {
24844def070435a2b5d67f0534f7a3a85a7389d60f2Chris Lattner    enum {
24944def070435a2b5d67f0534f7a3a85a7389d60f2Chris Lattner      CI_None = 0x00,
25044def070435a2b5d67f0534f7a3a85a7389d60f2Chris Lattner      CI_AllowsMemory = 0x01,
25144def070435a2b5d67f0534f7a3a85a7389d60f2Chris Lattner      CI_AllowsRegister = 0x02,
252fa780fc4a4983003633c9b560387266101839923Chris Lattner      CI_ReadWrite = 0x04,       // "+r" output constraint (read and write).
253fa780fc4a4983003633c9b560387266101839923Chris Lattner      CI_HasMatchingInput = 0x08 // This output operand has a matching input.
25444def070435a2b5d67f0534f7a3a85a7389d60f2Chris Lattner    };
25544def070435a2b5d67f0534f7a3a85a7389d60f2Chris Lattner    unsigned Flags;
25644def070435a2b5d67f0534f7a3a85a7389d60f2Chris Lattner    int TiedOperand;
2571eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
2582819fa85651526d59ade4fdc9da2cadd7b132973Chris Lattner    std::string ConstraintStr;  // constraint: "=rm"
2592819fa85651526d59ade4fdc9da2cadd7b132973Chris Lattner    std::string Name;           // Operand name: [foo] with no []'s.
260432c86969eced2ce658b3f3f2aa7407c8864f21bChris Lattner  public:
261f959fb5fb82ae2cbdf8635d734613a01818fb7bfAnders Carlsson    ConstraintInfo(llvm::StringRef ConstraintStr, llvm::StringRef Name)
262f959fb5fb82ae2cbdf8635d734613a01818fb7bfAnders Carlsson      : Flags(0), TiedOperand(-1), ConstraintStr(ConstraintStr.str()),
263f959fb5fb82ae2cbdf8635d734613a01818fb7bfAnders Carlsson      Name(Name.str()) {}
264432c86969eced2ce658b3f3f2aa7407c8864f21bChris Lattner
265432c86969eced2ce658b3f3f2aa7407c8864f21bChris Lattner    const std::string &getConstraintStr() const { return ConstraintStr; }
2662819fa85651526d59ade4fdc9da2cadd7b132973Chris Lattner    const std::string &getName() const { return Name; }
26744def070435a2b5d67f0534f7a3a85a7389d60f2Chris Lattner    bool isReadWrite() const { return (Flags & CI_ReadWrite) != 0; }
26844def070435a2b5d67f0534f7a3a85a7389d60f2Chris Lattner    bool allowsRegister() const { return (Flags & CI_AllowsRegister) != 0; }
26944def070435a2b5d67f0534f7a3a85a7389d60f2Chris Lattner    bool allowsMemory() const { return (Flags & CI_AllowsMemory) != 0; }
2701eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
271fa780fc4a4983003633c9b560387266101839923Chris Lattner    /// hasMatchingInput - Return true if this output operand has a matching
272fa780fc4a4983003633c9b560387266101839923Chris Lattner    /// (tied) input operand.
273fa780fc4a4983003633c9b560387266101839923Chris Lattner    bool hasMatchingInput() const { return (Flags & CI_HasMatchingInput) != 0; }
2741eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
275fa780fc4a4983003633c9b560387266101839923Chris Lattner    /// hasTiedOperand() - Return true if this input operand is a matching
276fa780fc4a4983003633c9b560387266101839923Chris Lattner    /// constraint that ties it to an output operand.  If this returns true,
277fa780fc4a4983003633c9b560387266101839923Chris Lattner    /// then getTiedOperand will indicate which output operand this is tied to.
27844def070435a2b5d67f0534f7a3a85a7389d60f2Chris Lattner    bool hasTiedOperand() const { return TiedOperand != -1; }
27944def070435a2b5d67f0534f7a3a85a7389d60f2Chris Lattner    unsigned getTiedOperand() const {
28044def070435a2b5d67f0534f7a3a85a7389d60f2Chris Lattner      assert(hasTiedOperand() && "Has no tied operand!");
28144def070435a2b5d67f0534f7a3a85a7389d60f2Chris Lattner      return (unsigned)TiedOperand;
28244def070435a2b5d67f0534f7a3a85a7389d60f2Chris Lattner    }
2831eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
28444def070435a2b5d67f0534f7a3a85a7389d60f2Chris Lattner    void setIsReadWrite() { Flags |= CI_ReadWrite; }
28544def070435a2b5d67f0534f7a3a85a7389d60f2Chris Lattner    void setAllowsMemory() { Flags |= CI_AllowsMemory; }
28644def070435a2b5d67f0534f7a3a85a7389d60f2Chris Lattner    void setAllowsRegister() { Flags |= CI_AllowsRegister; }
287fa780fc4a4983003633c9b560387266101839923Chris Lattner    void setHasMatchingInput() { Flags |= CI_HasMatchingInput; }
2881eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
289d68876176a0d2c19e3864e7d38f6036c4f72f0a3Chris Lattner    /// setTiedOperand - Indicate that this is an input operand that is tied to
290d68876176a0d2c19e3864e7d38f6036c4f72f0a3Chris Lattner    /// the specified output operand.  Copy over the various constraint
291d68876176a0d2c19e3864e7d38f6036c4f72f0a3Chris Lattner    /// information from the output.
292d68876176a0d2c19e3864e7d38f6036c4f72f0a3Chris Lattner    void setTiedOperand(unsigned N, ConstraintInfo &Output) {
293fa780fc4a4983003633c9b560387266101839923Chris Lattner      Output.setHasMatchingInput();
294d68876176a0d2c19e3864e7d38f6036c4f72f0a3Chris Lattner      Flags = Output.Flags;
295d68876176a0d2c19e3864e7d38f6036c4f72f0a3Chris Lattner      TiedOperand = N;
296d68876176a0d2c19e3864e7d38f6036c4f72f0a3Chris Lattner      // Don't copy Name or constraint string.
297d68876176a0d2c19e3864e7d38f6036c4f72f0a3Chris Lattner    }
298d04c6e23f2e10eeb9936778d67f4a1c4a14cc4f6Anders Carlsson  };
299d04c6e23f2e10eeb9936778d67f4a1c4a14cc4f6Anders Carlsson
300d04c6e23f2e10eeb9936778d67f4a1c4a14cc4f6Anders Carlsson  // validateOutputConstraint, validateInputConstraint - Checks that
301d04c6e23f2e10eeb9936778d67f4a1c4a14cc4f6Anders Carlsson  // a constraint is valid and provides information about it.
302d04c6e23f2e10eeb9936778d67f4a1c4a14cc4f6Anders Carlsson  // FIXME: These should return a real error instead of just true/false.
303432c86969eced2ce658b3f3f2aa7407c8864f21bChris Lattner  bool validateOutputConstraint(ConstraintInfo &Info) const;
3042819fa85651526d59ade4fdc9da2cadd7b132973Chris Lattner  bool validateInputConstraint(ConstraintInfo *OutputConstraints,
3052819fa85651526d59ade4fdc9da2cadd7b132973Chris Lattner                               unsigned NumOutputs,
30645b050e72d058131e6f169fe54888bb91a003fb5Anders Carlsson                               ConstraintInfo &info) const;
30742e1ee0702d8267d632df0fdb5c479a582877c6fAnders Carlsson  bool resolveSymbolicName(const char *&Name,
3082819fa85651526d59ade4fdc9da2cadd7b132973Chris Lattner                           ConstraintInfo *OutputConstraints,
3092819fa85651526d59ade4fdc9da2cadd7b132973Chris Lattner                           unsigned NumOutputs, unsigned &Index) const;
3101eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
3110eaed12e634dfd14f44620f63b8d3276fed028ddChris Lattner  virtual std::string convertConstraint(const char Constraint) const {
3120eaed12e634dfd14f44620f63b8d3276fed028ddChris Lattner    return std::string(1, Constraint);
3130eaed12e634dfd14f44620f63b8d3276fed028ddChris Lattner  }
3141eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
315d04c6e23f2e10eeb9936778d67f4a1c4a14cc4f6Anders Carlsson  // Returns a string of target-specific clobbers, in LLVM format.
3160eaed12e634dfd14f44620f63b8d3276fed028ddChris Lattner  virtual const char *getClobbers() const = 0;
3171eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
3187a4718e813e5e99d478567a482217c7eef8572c5Devang Patel
3191752ee4849f4c37f5e03193e658be92650b0e65aDaniel Dunbar  /// getTriple - Return the target triple of the primary target.
3201752ee4849f4c37f5e03193e658be92650b0e65aDaniel Dunbar  const llvm::Triple &getTriple() const {
3211752ee4849f4c37f5e03193e658be92650b0e65aDaniel Dunbar    return Triple;
3220eaed12e634dfd14f44620f63b8d3276fed028ddChris Lattner  }
3231eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
324ae3607684c5978dc2d877141015056c9d24f17eaTed Kremenek  const char *getTargetDescription() const {
325364af81157a81cf34bb058a7d5b0185020e5164bSanjiv Gupta    return DescriptionString;
3267a4718e813e5e99d478567a482217c7eef8572c5Devang Patel  }
3273346ae6bba10da0d08c8d548134ddab4e13d040fAnders Carlsson
3283346ae6bba10da0d08c8d548134ddab4e13d040fAnders Carlsson  struct GCCRegAlias {
3293346ae6bba10da0d08c8d548134ddab4e13d040fAnders Carlsson    const char * const Aliases[5];
3303346ae6bba10da0d08c8d548134ddab4e13d040fAnders Carlsson    const char * const Register;
3313346ae6bba10da0d08c8d548134ddab4e13d040fAnders Carlsson  };
3322621fd1d6d3c5eadcae246859f62738645df7540Chris Lattner
333dcb4a1a6dd55fdf6c073d2761096f42e26be105aDaniel Dunbar  virtual bool useGlobalsForAutomaticVariables() const { return false; }
334dcb4a1a6dd55fdf6c073d2761096f42e26be105aDaniel Dunbar
3356d7d8398e71a8bd121d3b46e250f1dbcfb9679d4Daniel Dunbar  /// getCFStringSection - Return the section to use for CFString
3368e5c2b8072f4409c7c0004331d1db9652d5209c0Daniel Dunbar  /// literals, or 0 if no special section is used.
3371eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump  virtual const char *getCFStringSection() const {
3388e5c2b8072f4409c7c0004331d1db9652d5209c0Daniel Dunbar    return "__DATA,__cfstring";
3398e5c2b8072f4409c7c0004331d1db9652d5209c0Daniel Dunbar  }
3408e5c2b8072f4409c7c0004331d1db9652d5209c0Daniel Dunbar
341797c3c4f5dc4fda735e55c6b5d6270a54cf6d263Chris Lattner  /// isValidSectionSpecifier - This is an optional hook that targets can
342797c3c4f5dc4fda735e55c6b5d6270a54cf6d263Chris Lattner  /// implement to perform semantic checking on attribute((section("foo")))
343797c3c4f5dc4fda735e55c6b5d6270a54cf6d263Chris Lattner  /// specifiers.  In this case, "foo" is passed in to be checked.  If the
344797c3c4f5dc4fda735e55c6b5d6270a54cf6d263Chris Lattner  /// section specifier is invalid, the backend should return a non-empty string
345797c3c4f5dc4fda735e55c6b5d6270a54cf6d263Chris Lattner  /// that indicates the problem.
346797c3c4f5dc4fda735e55c6b5d6270a54cf6d263Chris Lattner  ///
347797c3c4f5dc4fda735e55c6b5d6270a54cf6d263Chris Lattner  /// This hook is a simple quality of implementation feature to catch errors
348797c3c4f5dc4fda735e55c6b5d6270a54cf6d263Chris Lattner  /// and give good diagnostics in cases when the assembler or code generator
349797c3c4f5dc4fda735e55c6b5d6270a54cf6d263Chris Lattner  /// would otherwise reject the section specifier.
350797c3c4f5dc4fda735e55c6b5d6270a54cf6d263Chris Lattner  ///
351f959fb5fb82ae2cbdf8635d734613a01818fb7bfAnders Carlsson  virtual std::string isValidSectionSpecifier(llvm::StringRef SR) const {
352797c3c4f5dc4fda735e55c6b5d6270a54cf6d263Chris Lattner    return "";
353797c3c4f5dc4fda735e55c6b5d6270a54cf6d263Chris Lattner  }
3548e5c2b8072f4409c7c0004331d1db9652d5209c0Daniel Dunbar
355a6fda124bf380479529d6a80b84b62cacd3cb707John Thompson  /// setForcedLangOptions - Set forced language options.
356a6fda124bf380479529d6a80b84b62cacd3cb707John Thompson  /// Apply changes to the target information with respect to certain
357a6fda124bf380479529d6a80b84b62cacd3cb707John Thompson  /// language options which change the target configuration.
358a6fda124bf380479529d6a80b84b62cacd3cb707John Thompson  virtual void setForcedLangOptions(LangOptions &Opts);
359a6fda124bf380479529d6a80b84b62cacd3cb707John Thompson
360868bd0aa9281929ef50d2e9a8c82a036906f53f5Daniel Dunbar  /// getDefaultFeatures - Get the default set of target features for
361868bd0aa9281929ef50d2e9a8c82a036906f53f5Daniel Dunbar  /// the \args CPU; this should include all legal feature strings on
362868bd0aa9281929ef50d2e9a8c82a036906f53f5Daniel Dunbar  /// the target.
3631eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump  virtual void getDefaultFeatures(const std::string &CPU,
36417ca3638e852ba81f389e9f896ed0420b52ae606Daniel Dunbar                                  llvm::StringMap<bool> &Features) const {
36517ca3638e852ba81f389e9f896ed0420b52ae606Daniel Dunbar  }
36617ca3638e852ba81f389e9f896ed0420b52ae606Daniel Dunbar
367018ba5ab0671d9b6eefecaffc118c869bea151a1Daniel Dunbar  /// getABI - Get the ABI in use.
368018ba5ab0671d9b6eefecaffc118c869bea151a1Daniel Dunbar  virtual const char *getABI() const {
369018ba5ab0671d9b6eefecaffc118c869bea151a1Daniel Dunbar    return "";
370018ba5ab0671d9b6eefecaffc118c869bea151a1Daniel Dunbar  }
371018ba5ab0671d9b6eefecaffc118c869bea151a1Daniel Dunbar
372eac7c53f16bc12bcd9baac756b6f9bb77b74b0adDaniel Dunbar  /// setCPU - Target the specific CPU.
373eac7c53f16bc12bcd9baac756b6f9bb77b74b0adDaniel Dunbar  ///
374eac7c53f16bc12bcd9baac756b6f9bb77b74b0adDaniel Dunbar  /// \return - False on error (invalid CPU name).
375eac7c53f16bc12bcd9baac756b6f9bb77b74b0adDaniel Dunbar  //
376eac7c53f16bc12bcd9baac756b6f9bb77b74b0adDaniel Dunbar  // FIXME: Remove this.
377eac7c53f16bc12bcd9baac756b6f9bb77b74b0adDaniel Dunbar  virtual bool setCPU(const std::string &Name) {
378eac7c53f16bc12bcd9baac756b6f9bb77b74b0adDaniel Dunbar    return true;
379eac7c53f16bc12bcd9baac756b6f9bb77b74b0adDaniel Dunbar  }
380eac7c53f16bc12bcd9baac756b6f9bb77b74b0adDaniel Dunbar
38173b79596bac6f6169e5979d0c7241924259d2a76Daniel Dunbar  /// setABI - Use the specific ABI.
38273b79596bac6f6169e5979d0c7241924259d2a76Daniel Dunbar  ///
38373b79596bac6f6169e5979d0c7241924259d2a76Daniel Dunbar  /// \return - False on error (invalid ABI name).
38473b79596bac6f6169e5979d0c7241924259d2a76Daniel Dunbar  virtual bool setABI(const std::string &Name) {
38573b79596bac6f6169e5979d0c7241924259d2a76Daniel Dunbar    return false;
38673b79596bac6f6169e5979d0c7241924259d2a76Daniel Dunbar  }
38773b79596bac6f6169e5979d0c7241924259d2a76Daniel Dunbar
38817ca3638e852ba81f389e9f896ed0420b52ae606Daniel Dunbar  /// setFeatureEnabled - Enable or disable a specific target feature,
38917ca3638e852ba81f389e9f896ed0420b52ae606Daniel Dunbar  /// the feature name must be valid.
39017ca3638e852ba81f389e9f896ed0420b52ae606Daniel Dunbar  ///
39117ca3638e852ba81f389e9f896ed0420b52ae606Daniel Dunbar  /// \return - False on error (invalid feature name).
39217ca3638e852ba81f389e9f896ed0420b52ae606Daniel Dunbar  virtual bool setFeatureEnabled(llvm::StringMap<bool> &Features,
39317ca3638e852ba81f389e9f896ed0420b52ae606Daniel Dunbar                                 const std::string &Name,
39417ca3638e852ba81f389e9f896ed0420b52ae606Daniel Dunbar                                 bool Enabled) const {
39517ca3638e852ba81f389e9f896ed0420b52ae606Daniel Dunbar    return false;
396868bd0aa9281929ef50d2e9a8c82a036906f53f5Daniel Dunbar  }
397868bd0aa9281929ef50d2e9a8c82a036906f53f5Daniel Dunbar
39829a790ba422cfeeea9546b6e76777d98fa73cd67Daniel Dunbar  /// HandleTargetOptions - Perform initialization based on the user configured
39929a790ba422cfeeea9546b6e76777d98fa73cd67Daniel Dunbar  /// set of features (e.g., +sse4). The list is guaranteed to have at most one
40029a790ba422cfeeea9546b6e76777d98fa73cd67Daniel Dunbar  /// entry per feature.
401b93292ab7f2b3d43a9e0ad6421f572d1f5a323b4Daniel Dunbar  ///
402b93292ab7f2b3d43a9e0ad6421f572d1f5a323b4Daniel Dunbar  /// The target may modify the features list, to change which options are
403b93292ab7f2b3d43a9e0ad6421f572d1f5a323b4Daniel Dunbar  /// passed onwards to the backend.
404b93292ab7f2b3d43a9e0ad6421f572d1f5a323b4Daniel Dunbar  virtual void HandleTargetFeatures(std::vector<std::string> &Features) {
40516167a6e3f7dfb7ed0babc5e0baab9fd140e959dChris Lattner  }
406264a76cdf382c507f4d43e64c89f1503f003ac95Anton Korobeynikov
407264a76cdf382c507f4d43e64c89f1503f003ac95Anton Korobeynikov  // getRegParmMax - Returns maximal number of args passed in registers.
408264a76cdf382c507f4d43e64c89f1503f003ac95Anton Korobeynikov  unsigned getRegParmMax() const {
409264a76cdf382c507f4d43e64c89f1503f003ac95Anton Korobeynikov    return RegParmMax;
410264a76cdf382c507f4d43e64c89f1503f003ac95Anton Korobeynikov  }
411264a76cdf382c507f4d43e64c89f1503f003ac95Anton Korobeynikov
41221fb98ee003e992b0c4e204d98a19e0ef544cae3Chris Lattner  /// isTLSSupported - Whether the target supports thread-local storage.
4136a3bc6df36848188e9d0c1d978170c2b0918c6a3Chris Lattner  bool isTLSSupported() const {
414b030f0272500c6c5602f587ac029ee0dc0e5a05cEli Friedman    return TLSSupported;
415b030f0272500c6c5602f587ac029ee0dc0e5a05cEli Friedman  }
41621fb98ee003e992b0c4e204d98a19e0ef544cae3Chris Lattner
41721fb98ee003e992b0c4e204d98a19e0ef544cae3Chris Lattner  /// getEHDataRegisterNumber - Return the register number that
41821fb98ee003e992b0c4e204d98a19e0ef544cae3Chris Lattner  /// __builtin_eh_return_regno would return with the specified argument.
41921fb98ee003e992b0c4e204d98a19e0ef544cae3Chris Lattner  virtual int getEHDataRegisterNumber(unsigned RegNo) const {
42021fb98ee003e992b0c4e204d98a19e0ef544cae3Chris Lattner    return -1;
42121fb98ee003e992b0c4e204d98a19e0ef544cae3Chris Lattner  }
42221fb98ee003e992b0c4e204d98a19e0ef544cae3Chris Lattner
423b030f0272500c6c5602f587ac029ee0dc0e5a05cEli Friedman
4240eaed12e634dfd14f44620f63b8d3276fed028ddChris Lattnerprotected:
4250e5d4ef3155651af17a90fdc07d9f80b33935c0cChris Lattner  virtual uint64_t getPointerWidthV(unsigned AddrSpace) const {
4260e5d4ef3155651af17a90fdc07d9f80b33935c0cChris Lattner    return PointerWidth;
4270e5d4ef3155651af17a90fdc07d9f80b33935c0cChris Lattner  }
4280e5d4ef3155651af17a90fdc07d9f80b33935c0cChris Lattner  virtual uint64_t getPointerAlignV(unsigned AddrSpace) const {
4290e5d4ef3155651af17a90fdc07d9f80b33935c0cChris Lattner    return PointerAlign;
4300e5d4ef3155651af17a90fdc07d9f80b33935c0cChris Lattner  }
43131fc07df7f0fc89ebf83ca05a20b29de45a7598dSanjiv Gupta  virtual enum IntType getPtrDiffTypeV(unsigned AddrSpace) const {
43231fc07df7f0fc89ebf83ca05a20b29de45a7598dSanjiv Gupta    return PtrDiffType;
43331fc07df7f0fc89ebf83ca05a20b29de45a7598dSanjiv Gupta  }
4341eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump  virtual void getGCCRegNames(const char * const *&Names,
4350eaed12e634dfd14f44620f63b8d3276fed028ddChris Lattner                              unsigned &NumNames) const = 0;
4361eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump  virtual void getGCCRegAliases(const GCCRegAlias *&Aliases,
4373346ae6bba10da0d08c8d548134ddab4e13d040fAnders Carlsson                                unsigned &NumAliases) const = 0;
4381eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump  virtual bool validateAsmConstraint(const char *&Name,
439d04c6e23f2e10eeb9936778d67f4a1c4a14cc4f6Anders Carlsson                                     TargetInfo::ConstraintInfo &info) const= 0;
4405f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer};
4415f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer
4425f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer}  // end namespace clang
4435f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer
4445f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer#endif
445