Move Blackfin intrinsics into the Target/Blackfin directory.
authorJakob Stoklund Olesen <stoklund@2pi.dk>
Thu, 15 Oct 2009 18:50:52 +0000 (18:50 +0000)
committerJakob Stoklund Olesen <stoklund@2pi.dk>
Thu, 15 Oct 2009 18:50:52 +0000 (18:50 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84194 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Intrinsics.td
include/llvm/IntrinsicsBlackfin.td [deleted file]
lib/Target/Blackfin/Blackfin.td
lib/Target/Blackfin/BlackfinIntrinsicInfo.cpp [new file with mode: 0644]
lib/Target/Blackfin/BlackfinIntrinsicInfo.h [new file with mode: 0644]
lib/Target/Blackfin/BlackfinIntrinsics.td [new file with mode: 0644]
lib/Target/Blackfin/BlackfinTargetMachine.h
lib/Target/Blackfin/CMakeLists.txt
lib/Target/Blackfin/Makefile
test/CodeGen/Blackfin/sync-intr.ll

index 38ac4c2927c0b109182e3654996420d43906795d..e6d8007523b972d2b4d30a66737d9ba93d6b12e9 100644 (file)
@@ -474,4 +474,3 @@ include "llvm/IntrinsicsARM.td"
 include "llvm/IntrinsicsCellSPU.td"
 include "llvm/IntrinsicsAlpha.td"
 include "llvm/IntrinsicsXCore.td"
-include "llvm/IntrinsicsBlackfin.td"
diff --git a/include/llvm/IntrinsicsBlackfin.td b/include/llvm/IntrinsicsBlackfin.td
deleted file mode 100644 (file)
index 188e18c..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-//===- IntrinsicsBlackfin.td - Defines Blackfin intrinsics -*- tablegen -*-===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file defines all of the blackfin-specific intrinsics.
-//
-//===----------------------------------------------------------------------===//
-
-//===----------------------------------------------------------------------===//
-// Core synchronisation etc.
-//
-// These intrinsics have sideeffects. Each represent a single instruction, but
-// workarounds are sometimes required depending on the cpu.
-
-let TargetPrefix = "bfin" in {
-
-  // Execute csync instruction with workarounds
-  def int_bfin_csync : GCCBuiltin<"__builtin_bfin_csync">,
-          Intrinsic<[llvm_void_ty]>;
-
-  // Execute ssync instruction with workarounds
-  def int_bfin_ssync : GCCBuiltin<"__builtin_bfin_ssync">,
-          Intrinsic<[llvm_void_ty]>;
-
-  // Execute idle instruction with workarounds
-  def int_bfin_idle : GCCBuiltin<"__builtin_bfin_idle">,
-          Intrinsic<[llvm_void_ty]>;
-
-}
index b9046383fa6a9aab876226af55cc436e0b0e90f8..cd90962a95407f77665449f193188f5f32533e82 100644 (file)
@@ -74,6 +74,7 @@ def WA_IND_CALL : SubtargetFeature<"ind-call-anomaly", "wa_ind_call", "true",
 
 include "BlackfinRegisterInfo.td"
 include "BlackfinCallingConv.td"
+include "BlackfinIntrinsics.td"
 include "BlackfinInstrInfo.td"
 
 def BlackfinInstrInfo : InstrInfo {}
diff --git a/lib/Target/Blackfin/BlackfinIntrinsicInfo.cpp b/lib/Target/Blackfin/BlackfinIntrinsicInfo.cpp
new file mode 100644 (file)
index 0000000..544dc68
--- /dev/null
@@ -0,0 +1,53 @@
+//===- BlackfinIntrinsicInfo.cpp - Intrinsic Information --------*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file contains the Blackfin implementation of TargetIntrinsicInfo.
+//
+//===----------------------------------------------------------------------===//
+
+#include "BlackfinIntrinsicInfo.h"
+#include "llvm/Intrinsics.h"
+#include "llvm/Support/raw_ostream.h"
+#include <cstring>
+
+using namespace llvm;
+
+namespace bfinIntrinsic {
+
+  enum ID {
+    last_non_bfin_intrinsic = Intrinsic::num_intrinsics-1,
+#define GET_INTRINSIC_ENUM_VALUES
+#include "BlackfinGenIntrinsics.inc"
+#undef GET_INTRINSIC_ENUM_VALUES
+    , num_bfin_intrinsics
+  };
+
+}
+
+const char *BlackfinIntrinsicInfo::getName(unsigned IntrID) const {
+  static const char *const names[] = {
+#define GET_INTRINSIC_NAME_TABLE
+#include "BlackfinGenIntrinsics.inc"
+#undef GET_INTRINSIC_NAME_TABLE
+  };
+
+  if (IntrID < Intrinsic::num_intrinsics)
+    return 0;
+  assert(IntrID < bfinIntrinsic::num_bfin_intrinsics && "Invalid intrinsic ID");
+
+  return names[IntrID - Intrinsic::num_intrinsics];
+}
+
+unsigned
+BlackfinIntrinsicInfo::lookupName(const char *Name, unsigned Len) const {
+#define GET_FUNCTION_RECOGNIZER
+#include "BlackfinGenIntrinsics.inc"
+#undef GET_FUNCTION_RECOGNIZER
+  return 0;
+}
diff --git a/lib/Target/Blackfin/BlackfinIntrinsicInfo.h b/lib/Target/Blackfin/BlackfinIntrinsicInfo.h
new file mode 100644 (file)
index 0000000..3b59a60
--- /dev/null
@@ -0,0 +1,28 @@
+//===- BlackfinIntrinsicInfo.h - Blackfin Intrinsic Information -*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file contains the Blackfin implementation of TargetIntrinsicInfo.
+//
+//===----------------------------------------------------------------------===//
+#ifndef BLACKFININTRINSICS_H
+#define BLACKFININTRINSICS_H
+
+#include "llvm/Target/TargetIntrinsicInfo.h"
+
+namespace llvm {
+
+  class BlackfinIntrinsicInfo : public TargetIntrinsicInfo {
+  public:
+    const char *getName(unsigned IntrID) const;
+    unsigned lookupName(const char *Name, unsigned Len) const;
+  };
+
+}
+
+#endif
diff --git a/lib/Target/Blackfin/BlackfinIntrinsics.td b/lib/Target/Blackfin/BlackfinIntrinsics.td
new file mode 100644 (file)
index 0000000..bf02cfe
--- /dev/null
@@ -0,0 +1,34 @@
+//===- BlackfinIntrinsics.td - Defines Blackfin intrinsics -*- tablegen -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file defines all of the blackfin-specific intrinsics.
+//
+//===----------------------------------------------------------------------===//
+
+let TargetPrefix = "bfin", isTarget = 1 in {
+
+//===----------------------------------------------------------------------===//
+// Core synchronisation etc.
+//
+// These intrinsics have sideeffects. Each represent a single instruction, but
+// workarounds are sometimes required depending on the cpu.
+
+// Execute csync instruction with workarounds
+def int_bfin_csync : GCCBuiltin<"__builtin_bfin_csync">,
+        Intrinsic<[llvm_void_ty]>;
+
+// Execute ssync instruction with workarounds
+def int_bfin_ssync : GCCBuiltin<"__builtin_bfin_ssync">,
+        Intrinsic<[llvm_void_ty]>;
+
+// Execute idle instruction with workarounds
+def int_bfin_idle : GCCBuiltin<"__builtin_bfin_idle">,
+        Intrinsic<[llvm_void_ty]>;
+
+}
index 73ed3143f5309cf81d6699e22928b8421d62cb7e..a14052bc4db54d111ef3fd5b0bbf0606bf7192fe 100644 (file)
@@ -20,6 +20,7 @@
 #include "BlackfinInstrInfo.h"
 #include "BlackfinSubtarget.h"
 #include "BlackfinISelLowering.h"
+#include "BlackfinIntrinsicInfo.h"
 
 namespace llvm {
 
@@ -29,6 +30,7 @@ namespace llvm {
     BlackfinTargetLowering TLInfo;
     BlackfinInstrInfo InstrInfo;
     TargetFrameInfo FrameInfo;
+    BlackfinIntrinsicInfo IntrinsicInfo;
   public:
     BlackfinTargetMachine(const Target &T, const std::string &TT,
                           const std::string &FS);
@@ -47,6 +49,9 @@ namespace llvm {
     virtual const TargetData *getTargetData() const { return &DataLayout; }
     virtual bool addInstSelector(PassManagerBase &PM,
                                  CodeGenOpt::Level OptLevel);
+    const TargetIntrinsicInfo *getIntrinsicInfo() const {
+      return &IntrinsicInfo;
+    }
   };
 
 } // end namespace llvm
index 6c3b2447a6946bc6b739815c53b0b9a6b457b863..deb005d89eb517fe30d7dde039c763b18793eb43 100644 (file)
@@ -9,9 +9,11 @@ tablegen(BlackfinGenAsmWriter.inc -gen-asm-writer)
 tablegen(BlackfinGenDAGISel.inc -gen-dag-isel)
 tablegen(BlackfinGenSubtarget.inc -gen-subtarget)
 tablegen(BlackfinGenCallingConv.inc -gen-callingconv)
+tablegen(BlackfinGenIntrinsics.inc -gen-tgt-intrinsic)
 
 add_llvm_target(BlackfinCodeGen
   BlackfinInstrInfo.cpp
+  BlackfinIntrinsicInfo.cpp
   BlackfinISelDAGToDAG.cpp
   BlackfinISelLowering.cpp
   BlackfinMCAsmInfo.cpp
index c0c1bce793d0af1e4531457a9ca43a4898bc3507..c68760b2ece9cc9c1dd6d625d27a8548b2d1f0e5 100644 (file)
@@ -15,7 +15,7 @@ BUILT_SOURCES = BlackfinGenRegisterInfo.h.inc BlackfinGenRegisterNames.inc \
                 BlackfinGenRegisterInfo.inc BlackfinGenInstrNames.inc \
                 BlackfinGenInstrInfo.inc BlackfinGenAsmWriter.inc \
                 BlackfinGenDAGISel.inc BlackfinGenSubtarget.inc \
-               BlackfinGenCallingConv.inc
+               BlackfinGenCallingConv.inc BlackfinGenIntrinsics.inc
 
 DIRS = AsmPrinter TargetInfo
 
index 75084f01e560797fb145545c68ca343cd1fb9e4f..0b103a3bf77a870c9334162a018e20968a86a1eb 100644 (file)
@@ -2,8 +2,11 @@
 
 define void @f() nounwind {
 entry:
+        ; CHECK-NOT: llvm.bfin
         ; CHECK: csync;
         call void @llvm.bfin.csync()
+
+        ; CHECK-NOT: llvm.bfin
         ; CHECK: ssync;
         call void @llvm.bfin.ssync()
        ret void