summaryrefslogtreecommitdiffstats
path: root/clang/lib/Basic/Targets.cpp
diff options
context:
space:
mode:
authorRoman Divacky <rdivacky@freebsd.org>2011-01-06 08:27:10 +0000
committerRoman Divacky <rdivacky@freebsd.org>2011-01-06 08:27:10 +0000
commit965b0b72b1365f6ebc55ecb3d54623036187bf6a (patch)
tree12dd37a8cf7b6d43d262efc071529d5ae4a8de8e /clang/lib/Basic/Targets.cpp
parent7998b1d6fe08c1b3010f790cc96d75137a404bf7 (diff)
downloadbcm5719-llvm-965b0b72b1365f6ebc55ecb3d54623036187bf6a.tar.gz
bcm5719-llvm-965b0b72b1365f6ebc55ecb3d54623036187bf6a.zip
PowerPC fixes.
Fix the width and align of bool type on Darwin to be 32bits while keeping it 8 everywhere else. Change the definition of va_list to default to SV4 ABI one and let darwin subtarget override this. Both changes submitted by Nathan Whitehorn and reviewed by Rafael Espindola. llvm-svn: 122956
Diffstat (limited to 'clang/lib/Basic/Targets.cpp')
-rw-r--r--clang/lib/Basic/Targets.cpp41
1 files changed, 24 insertions, 17 deletions
diff --git a/clang/lib/Basic/Targets.cpp b/clang/lib/Basic/Targets.cpp
index 697603bbac8..f5fb08adcbf 100644
--- a/clang/lib/Basic/Targets.cpp
+++ b/clang/lib/Basic/Targets.cpp
@@ -479,17 +479,6 @@ public:
virtual void getTargetDefines(const LangOptions &Opts,
MacroBuilder &Builder) const;
- virtual const char *getVAListDeclaration() const {
- return "typedef char* __builtin_va_list;";
- // This is the right definition for ABI/V4: System V.4/eabi.
- /*return "typedef struct __va_list_tag {"
- " unsigned char gpr;"
- " unsigned char fpr;"
- " unsigned short reserved;"
- " void* overflow_arg_area;"
- " void* reg_save_area;"
- "} __builtin_va_list[1];";*/
- }
virtual void getGCCRegNames(const char * const *&Names,
unsigned &NumNames) const;
virtual void getGCCRegAliases(const GCCRegAlias *&Aliases,
@@ -754,7 +743,18 @@ public:
"i64:64:64-f32:32:32-f64:64:64-v128:128:128-n32";
if (getTriple().getOS() == llvm::Triple::FreeBSD)
- this->SizeType = TargetInfo::UnsignedInt;
+ SizeType = UnsignedInt;
+ }
+
+ virtual const char *getVAListDeclaration() const {
+ // This is the ELF definition, and is overridden by the Darwin sub-target
+ return "typedef struct __va_list_tag {"
+ " unsigned char gpr;"
+ " unsigned char fpr;"
+ " unsigned short reserved;"
+ " void* overflow_arg_area;"
+ " void* reg_save_area;"
+ "} __builtin_va_list[1];";
}
};
} // end anonymous namespace.
@@ -770,17 +770,24 @@ public:
DescriptionString = "E-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-"
"i64:64:64-f32:32:32-f64:64:64-v128:128:128-n32:64";
}
+ virtual const char *getVAListDeclaration() const {
+ return "typedef char* __builtin_va_list;";
+ }
};
} // end anonymous namespace.
namespace {
-class DarwinPPCTargetInfo :
- public DarwinTargetInfo<PPCTargetInfo> {
+class DarwinPPC32TargetInfo :
+ public DarwinTargetInfo<PPC32TargetInfo> {
public:
- DarwinPPCTargetInfo(const std::string& triple)
- : DarwinTargetInfo<PPCTargetInfo>(triple) {
+ DarwinPPC32TargetInfo(const std::string& triple)
+ : DarwinTargetInfo<PPC32TargetInfo>(triple) {
HasAlignMac68kSupport = true;
+ BoolWidth = BoolAlign = 32; //XXX support -mone-byte-bool?
+ }
+ virtual const char *getVAListDeclaration() const {
+ return "typedef char* __builtin_va_list;";
}
};
@@ -2578,7 +2585,7 @@ static TargetInfo *AllocateTarget(const std::string &T) {
case llvm::Triple::ppc:
if (os == llvm::Triple::Darwin)
- return new DarwinPPCTargetInfo(T);
+ return new DarwinPPC32TargetInfo(T);
else if (os == llvm::Triple::FreeBSD)
return new FreeBSDTargetInfo<PPC32TargetInfo>(T);
return new PPC32TargetInfo(T);
OpenPOWER on IntegriCloud