diff options
author | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2009-10-15 18:50:52 +0000 |
---|---|---|
committer | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2009-10-15 18:50:52 +0000 |
commit | 6ad8c84d7023d639eda38105625adda060ef045c (patch) | |
tree | 3b904db245de2b13e9bbed2f03973ae6a1fe623f /lib/Target | |
parent | 11ee508d7bd37f2b007da735fbd2c1497ed51848 (diff) | |
download | external_llvm-6ad8c84d7023d639eda38105625adda060ef045c.zip external_llvm-6ad8c84d7023d639eda38105625adda060ef045c.tar.gz external_llvm-6ad8c84d7023d639eda38105625adda060ef045c.tar.bz2 |
Move Blackfin intrinsics into the Target/Blackfin directory.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84194 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target')
-rw-r--r-- | lib/Target/Blackfin/Blackfin.td | 1 | ||||
-rw-r--r-- | lib/Target/Blackfin/BlackfinIntrinsicInfo.cpp | 53 | ||||
-rw-r--r-- | lib/Target/Blackfin/BlackfinIntrinsicInfo.h | 28 | ||||
-rw-r--r-- | lib/Target/Blackfin/BlackfinIntrinsics.td | 34 | ||||
-rw-r--r-- | lib/Target/Blackfin/BlackfinTargetMachine.h | 5 | ||||
-rw-r--r-- | lib/Target/Blackfin/CMakeLists.txt | 2 | ||||
-rw-r--r-- | lib/Target/Blackfin/Makefile | 2 |
7 files changed, 124 insertions, 1 deletions
diff --git a/lib/Target/Blackfin/Blackfin.td b/lib/Target/Blackfin/Blackfin.td index b904638..cd90962 100644 --- a/lib/Target/Blackfin/Blackfin.td +++ b/lib/Target/Blackfin/Blackfin.td @@ -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 index 0000000..544dc68 --- /dev/null +++ b/lib/Target/Blackfin/BlackfinIntrinsicInfo.cpp @@ -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 index 0000000..3b59a60 --- /dev/null +++ b/lib/Target/Blackfin/BlackfinIntrinsicInfo.h @@ -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 index 0000000..bf02cfe --- /dev/null +++ b/lib/Target/Blackfin/BlackfinIntrinsics.td @@ -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]>; + +} diff --git a/lib/Target/Blackfin/BlackfinTargetMachine.h b/lib/Target/Blackfin/BlackfinTargetMachine.h index 73ed314..a14052b 100644 --- a/lib/Target/Blackfin/BlackfinTargetMachine.h +++ b/lib/Target/Blackfin/BlackfinTargetMachine.h @@ -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 diff --git a/lib/Target/Blackfin/CMakeLists.txt b/lib/Target/Blackfin/CMakeLists.txt index 6c3b244..deb005d 100644 --- a/lib/Target/Blackfin/CMakeLists.txt +++ b/lib/Target/Blackfin/CMakeLists.txt @@ -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 diff --git a/lib/Target/Blackfin/Makefile b/lib/Target/Blackfin/Makefile index c0c1bce..c68760b 100644 --- a/lib/Target/Blackfin/Makefile +++ b/lib/Target/Blackfin/Makefile @@ -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 |