add haiku support, patch by Paul Davey!

llvm-svn: 100982
This commit is contained in:
Chris Lattner 2010-04-11 19:29:39 +00:00
parent 2532856704
commit b986aba6db
3 changed files with 67 additions and 0 deletions

View File

@ -1225,6 +1225,23 @@ public:
};
} // end anonymous namespace
namespace {
// x86-32 Haiku target
class HaikuX86_32TargetInfo : public X86_32TargetInfo {
public:
HaikuX86_32TargetInfo(const std::string& triple)
: X86_32TargetInfo(triple) {
SizeType = UnsignedLong;
}
virtual void getTargetDefines(const LangOptions &Opts,
MacroBuilder &Builder) const {
X86_32TargetInfo::getTargetDefines(Opts, Builder);
Builder.defineMacro("__INTEL__");
Builder.defineMacro("__HAIKU__");
}
};
} // end anonymous namespace
namespace {
// x86-64 generic target
class X86_64TargetInfo : public X86TargetInfo {
@ -2351,6 +2368,8 @@ static TargetInfo *AllocateTarget(const std::string &T) {
return new MinGWX86_32TargetInfo(T);
case llvm::Triple::Win32:
return new VisualStudioWindowsX86_32TargetInfo(T);
case llvm::Triple::Haiku:
return new HaikuX86_32TargetInfo(T);
default:
return new X86_32TargetInfo(T);
}

View File

@ -619,6 +619,11 @@ void Clang::AddX86TargetArgs(const ArgList &Args,
CPUName = "core2";
else if (getToolChain().getArchName() == "i386")
CPUName = "yonah";
} else if (getToolChain().getOS().startswith("haiku")) {
if (getToolChain().getArchName() == "x86_64")
CPUName = "x86-64";
else if (getToolChain().getArchName() == "i386")
CPUName = "i586";
} else {
if (getToolChain().getArchName() == "x86_64")
CPUName = "x86-64";

View File

@ -429,6 +429,49 @@ void InitHeaderSearch::AddDefaultCIncludePaths(const llvm::Triple &triple) {
}
}
break;
case llvm::Triple::Haiku:
AddPath("/boot/common/include", System, true, false, false);
AddPath("/boot/develop/headers/os", System, true, false, false);
AddPath("/boot/develop/headers/os/app", System, true, false, false);
AddPath("/boot/develop/headers/os/arch", System, true, false, false);
AddPath("/boot/develop/headers/os/device", System, true, false, false);
AddPath("/boot/develop/headers/os/drivers", System, true, false, false);
AddPath("/boot/develop/headers/os/game", System, true, false, false);
AddPath("/boot/develop/headers/os/interface", System, true, false, false);
AddPath("/boot/develop/headers/os/kernel", System, true, false, false);
AddPath("/boot/develop/headers/os/locale", System, true, false, false);
AddPath("/boot/develop/headers/os/mail", System, true, false, false);
AddPath("/boot/develop/headers/os/media", System, true, false, false);
AddPath("/boot/develop/headers/os/midi", System, true, false, false);
AddPath("/boot/develop/headers/os/midi2", System, true, false, false);
AddPath("/boot/develop/headers/os/net", System, true, false, false);
AddPath("/boot/develop/headers/os/storage", System, true, false, false);
AddPath("/boot/develop/headers/os/support", System, true, false, false);
AddPath("/boot/develop/headers/os/translation",
System, true, false, false);
AddPath("/boot/develop/headers/os/add-ons/graphics",
System, true, false, false);
AddPath("/boot/develop/headers/os/add-ons/input_server",
System, true, false, false);
AddPath("/boot/develop/headers/os/add-ons/screen_saver",
System, true, false, false);
AddPath("/boot/develop/headers/os/add-ons/tracker",
System, true, false, false);
AddPath("/boot/develop/headers/os/be_apps/Deskbar",
System, true, false, false);
AddPath("/boot/develop/headers/os/be_apps/NetPositive",
System, true, false, false);
AddPath("/boot/develop/headers/os/be_apps/Tracker",
System, true, false, false);
AddPath("/boot/develop/headers/cpp", System, true, false, false);
AddPath("/boot/develop/headers/cpp/i586-pc-haiku",
System, true, false, false);
AddPath("/boot/develop/headers/3rdparty", System, true, false, false);
AddPath("/boot/develop/headers/bsd", System, true, false, false);
AddPath("/boot/develop/headers/glibc", System, true, false, false);
AddPath("/boot/develop/headers/posix", System, true, false, false);
AddPath("/boot/develop/headers", System, true, false, false);
break;
case llvm::Triple::MinGW64:
case llvm::Triple::MinGW32:
AddPath("c:/mingw/include", System, true, false, false);