[cfe-commits] r48052 - in /cfe/trunk: Basic/TargetInfo.cpp include/clang/Basic/TargetInfo.h
Chris Lattner
sabre at nondot.org
Sat Mar 8 00:59:43 PST 2008
Author: lattner
Date: Sat Mar 8 02:59:43 2008
New Revision: 48052
URL: http://llvm.org/viewvc/llvm-project?rev=48052&view=rev
Log:
make float format handling more regular.
Modified:
cfe/trunk/Basic/TargetInfo.cpp
cfe/trunk/include/clang/Basic/TargetInfo.h
Modified: cfe/trunk/Basic/TargetInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Basic/TargetInfo.cpp?rev=48052&r1=48051&r2=48052&view=diff
==============================================================================
--- cfe/trunk/Basic/TargetInfo.cpp (original)
+++ cfe/trunk/Basic/TargetInfo.cpp Sat Mar 8 02:59:43 2008
@@ -18,24 +18,18 @@
#include "llvm/ADT/STLExtras.h"
using namespace clang;
-// Out of line virtual dtor for TargetInfo.
-TargetInfo::~TargetInfo() {}
-
-//===----------------------------------------------------------------------===//
-// FIXME: These are temporary hacks.
-
-const llvm::fltSemantics *TargetInfo::getFloatFormat() const {
- return &llvm::APFloat::IEEEsingle;
-}
-const llvm::fltSemantics *TargetInfo::getDoubleFormat() const {
- return &llvm::APFloat::IEEEdouble;
-}
-const llvm::fltSemantics *TargetInfo::getLongDoubleFormat() const {
- //Size = 80; Align = 32; // FIXME: implement correctly.
- //Format = &llvm::APFloat::x87DoubleExtended;
- return &llvm::APFloat::IEEEdouble;
+// TargetInfo Constructor.
+TargetInfo::TargetInfo(const std::string &T) : Triple(T) {
+ // Set defaults. These should be overridden by concrete targets as needed.
+ CharIsSigned = true;
+ WCharWidth = WCharAlign = 32;
+ FloatFormat = &llvm::APFloat::IEEEsingle;
+ DoubleFormat = &llvm::APFloat::IEEEdouble;
+ LongDoubleFormat = &llvm::APFloat::IEEEdouble;
}
+// Out of line virtual dtor for TargetInfo.
+TargetInfo::~TargetInfo() {}
//===----------------------------------------------------------------------===//
Modified: cfe/trunk/include/clang/Basic/TargetInfo.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/TargetInfo.h?rev=48052&r1=48051&r2=48052&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/TargetInfo.h (original)
+++ cfe/trunk/include/clang/Basic/TargetInfo.h Sat Mar 8 02:59:43 2008
@@ -32,16 +32,14 @@
class TargetInfo {
std::string Triple;
protected:
- /// These are all caches for target values.
+ // Target values set by the ctor of the actual target implementation. Default
+ // values are specified by the TargetInfo constructor.
bool CharIsSigned;
unsigned WCharWidth, WCharAlign;
+ const llvm::fltSemantics *FloatFormat, *DoubleFormat, *LongDoubleFormat;
- // TargetInfo Constructor.
- TargetInfo(const std::string &T) : Triple(T) {
- // Set defaults. These should be overridden by concrete targets as needed.
- CharIsSigned = true;
- WCharWidth = WCharAlign = 32;
- }
+ // TargetInfo Constructor. Default initializes all fields.
+ TargetInfo(const std::string &T);
public:
/// CreateTargetInfo - Return the target info object for the specified target
@@ -106,18 +104,20 @@
/// getFloatWidth/Align/Format - Return the size/align/format of 'float'.
unsigned getFloatWidth() const { return 32; } // FIXME
unsigned getFloatAlign() const { return 32; } // FIXME
- const llvm::fltSemantics *getFloatFormat() const;
+ const llvm::fltSemantics *getFloatFormat() const { return FloatFormat; }
/// getDoubleWidth/Align/Format - Return the size/align/format of 'double'.
unsigned getDoubleWidth() const { return 64; } // FIXME
unsigned getDoubleAlign() const { return 32; } // FIXME
- const llvm::fltSemantics *getDoubleFormat() const;
+ const llvm::fltSemantics *getDoubleFormat() const { return DoubleFormat; }
/// getLongDoubleWidth/Align/Format - Return the size/align/format of 'long
/// double'.
unsigned getLongDoubleWidth() const { return 64; } // FIXME
unsigned getLongDoubleAlign() const { return 64; } // FIXME
- const llvm::fltSemantics *getLongDoubleFormat() const;
+ const llvm::fltSemantics *getLongDoubleFormat() const {
+ return LongDoubleFormat;
+ }
/// getIntMaxTWidth - Return the size of intmax_t and uintmax_t for this
More information about the cfe-commits
mailing list