[llvm-commits] [llvm-gcc-4.2] r57227 - in /llvm-gcc-4.2/trunk/gcc: config.gcc config/alpha/alpha.h config/alpha/llvm-alpha.cpp

Andrew Lenharth alenhar2 at cs.uiuc.edu
Mon Oct 6 19:11:11 PDT 2008


Author: alenhar2
Date: Mon Oct  6 21:11:11 2008
New Revision: 57227

URL: http://llvm.org/viewvc/llvm-project?rev=57227&view=rev
Log:
Get alpha closer to building libgcc2

Added:
    llvm-gcc-4.2/trunk/gcc/config/alpha/llvm-alpha.cpp
Modified:
    llvm-gcc-4.2/trunk/gcc/config.gcc
    llvm-gcc-4.2/trunk/gcc/config/alpha/alpha.h

Modified: llvm-gcc-4.2/trunk/gcc/config.gcc
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config.gcc?rev=57227&r1=57226&r2=57227&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config.gcc (original)
+++ llvm-gcc-4.2/trunk/gcc/config.gcc Mon Oct  6 21:11:11 2008
@@ -248,6 +248,9 @@
 alpha*-*-*)
 	cpu_type=alpha
 	need_64bit_hwint=yes
+# LLVM LOCAL begin
+	out_cxx_file=alpha/llvm-alpha.cpp
+# LLVM LOCAL end                               
 	;;
 am33_2.0-*-linux*)
 	cpu_type=mn10300

Modified: llvm-gcc-4.2/trunk/gcc/config/alpha/alpha.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/alpha/alpha.h?rev=57227&r1=57226&r2=57227&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/alpha/alpha.h (original)
+++ llvm-gcc-4.2/trunk/gcc/config/alpha/alpha.h Mon Oct  6 21:11:11 2008
@@ -1591,3 +1591,22 @@
 
 /* The system headers under Alpha systems are generally C++-aware.  */
 #define NO_IMPLICIT_EXTERN_C
+
+/* LLVM LOCAL begin */
+#ifdef ENABLE_LLVM
+
+/* LLVM_TARGET_INTRINSIC_PREFIX - Specify what prefix this target uses for its
+ * intrinsics.
+ */
+#define LLVM_TARGET_INTRINSIC_PREFIX "alpha"
+
+/* LLVM_TARGET_INTRINSIC_LOWER - To handle builtins, we want to expand the
+ * invocation into normal LLVM code.  If the target can handle the builtin, this
+ * macro should call the target TreeToLLVM::TargetIntrinsicLower method and
+ *  return true.This macro is invoked from a method in the TreeToLLVM class.
+ */
+#define LLVM_TARGET_INTRINSIC_LOWER(EXP, BUILTIN_CODE, DESTLOC, RESULT,       \
+                                    DESTTY, OPS)                              \
+        TargetIntrinsicLower(EXP, BUILTIN_CODE, DESTLOC, RESULT, DESTTY, OPS);
+#endif /* ENABLE_LLVM */
+/* LLVM LOCAL end */

Added: llvm-gcc-4.2/trunk/gcc/config/alpha/llvm-alpha.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/alpha/llvm-alpha.cpp?rev=57227&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/alpha/llvm-alpha.cpp (added)
+++ llvm-gcc-4.2/trunk/gcc/config/alpha/llvm-alpha.cpp Mon Oct  6 21:11:11 2008
@@ -0,0 +1,121 @@
+/* LLVM LOCAL begin (ENTIRE FILE!)  */
+/* High-level LLVM backend interface 
+Copyright (C) 2005 Free Software Foundation, Inc.
+Contributed by Evan Cheng (evan.cheng at apple.com)
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 2, or (at your option) any later
+version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING.  If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA.  */
+
+//===----------------------------------------------------------------------===//
+// This is a C++ source file that implements specific llvm alpha ABI.
+//===----------------------------------------------------------------------===//
+
+#include "llvm-abi.h"
+#include "llvm-internal.h"
+#include "llvm/DerivedTypes.h"
+#include "llvm/Instructions.h"
+#include "llvm/Intrinsics.h"
+#include "llvm/Module.h"
+
+extern "C" {
+#include "toplev.h"
+}
+
+enum alpha_builtin
+{
+  ALPHA_BUILTIN_CMPBGE,
+  ALPHA_BUILTIN_EXTBL,
+  ALPHA_BUILTIN_EXTWL,
+  ALPHA_BUILTIN_EXTLL,
+  ALPHA_BUILTIN_EXTQL,
+  ALPHA_BUILTIN_EXTWH,
+  ALPHA_BUILTIN_EXTLH,
+  ALPHA_BUILTIN_EXTQH,
+  ALPHA_BUILTIN_INSBL,
+  ALPHA_BUILTIN_INSWL,
+  ALPHA_BUILTIN_INSLL,
+  ALPHA_BUILTIN_INSQL,
+  ALPHA_BUILTIN_INSWH,
+  ALPHA_BUILTIN_INSLH,
+  ALPHA_BUILTIN_INSQH,
+  ALPHA_BUILTIN_MSKBL,
+  ALPHA_BUILTIN_MSKWL,
+  ALPHA_BUILTIN_MSKLL,
+  ALPHA_BUILTIN_MSKQL,
+  ALPHA_BUILTIN_MSKWH,
+  ALPHA_BUILTIN_MSKLH,
+  ALPHA_BUILTIN_MSKQH,
+  ALPHA_BUILTIN_UMULH,
+  ALPHA_BUILTIN_ZAP,
+  ALPHA_BUILTIN_ZAPNOT,
+  ALPHA_BUILTIN_AMASK,
+  ALPHA_BUILTIN_IMPLVER,
+  ALPHA_BUILTIN_RPCC,
+  ALPHA_BUILTIN_THREAD_POINTER,
+  ALPHA_BUILTIN_SET_THREAD_POINTER,
+
+  /* TARGET_MAX */
+  ALPHA_BUILTIN_MINUB8,
+  ALPHA_BUILTIN_MINSB8,
+  ALPHA_BUILTIN_MINUW4,
+  ALPHA_BUILTIN_MINSW4,
+  ALPHA_BUILTIN_MAXUB8,
+  ALPHA_BUILTIN_MAXSB8,
+  ALPHA_BUILTIN_MAXUW4,
+  ALPHA_BUILTIN_MAXSW4,
+  ALPHA_BUILTIN_PERR,
+  ALPHA_BUILTIN_PKLB,
+  ALPHA_BUILTIN_PKWB,
+  ALPHA_BUILTIN_UNPKBL,
+  ALPHA_BUILTIN_UNPKBW,
+
+  /* TARGET_CIX */
+  ALPHA_BUILTIN_CTTZ,
+  ALPHA_BUILTIN_CTLZ,
+  ALPHA_BUILTIN_CTPOP,
+
+  ALPHA_BUILTIN_max
+};
+
+/* TargetIntrinsicLower - For builtins that we want to expand to normal LLVM
+ * code, emit the code now.  If we can handle the code, this macro should emit
+ * the code, return true.
+ */
+bool TreeToLLVM::TargetIntrinsicLower(tree exp,
+                                      unsigned FnCode,
+                                      const MemRef *DestLoc,
+                                      Value *&Result,
+                                      const Type *ResultType,
+                                      std::vector<Value*> &Ops) {
+  switch (FnCode) {
+  case ALPHA_BUILTIN_UMULH: {
+    Function *f =
+      Intrinsic::getDeclaration(TheModule, Intrinsic::alpha_umulh);
+    Value *Arg0 = Ops[0];
+    Value *Arg1 = Ops[1];
+    Value *CallOps[2] = { Arg0, Arg1};
+    Result = Builder.CreateCall(f, CallOps, CallOps+2, "tmp");
+    Result = Builder.CreateBitCast(Result, ResultType, "tmp");
+    return true;
+  }
+  default: break;
+  }
+
+  return false;
+}
+
+/* LLVM LOCAL end (ENTIRE FILE!)  */





More information about the llvm-commits mailing list