[llvm-commits] [llvm] r84192 - in /llvm/trunk: include/llvm/Target/TargetIntrinsicInfo.h lib/Target/TargetIntrinsicInfo.cpp
Jakob Stoklund Olesen
stoklund at 2pi.dk
Thu Oct 15 11:49:29 PDT 2009
Author: stoklund
Date: Thu Oct 15 13:49:26 2009
New Revision: 84192
URL: http://llvm.org/viewvc/llvm-project?rev=84192&view=rev
Log:
Clean up TargetIntrinsicInfo API. Add pure virtual methods.
Modified:
llvm/trunk/include/llvm/Target/TargetIntrinsicInfo.h
llvm/trunk/lib/Target/TargetIntrinsicInfo.cpp
Modified: llvm/trunk/include/llvm/Target/TargetIntrinsicInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetIntrinsicInfo.h?rev=84192&r1=84191&r2=84192&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Target/TargetIntrinsicInfo.h (original)
+++ llvm/trunk/include/llvm/Target/TargetIntrinsicInfo.h Thu Oct 15 13:49:26 2009
@@ -25,35 +25,21 @@
/// TargetIntrinsicInfo - Interface to description of machine instruction set
///
class TargetIntrinsicInfo {
-
- const char **Intrinsics; // Raw array to allow static init'n
- unsigned NumIntrinsics; // Number of entries in the desc array
-
- TargetIntrinsicInfo(const TargetIntrinsicInfo &); // DO NOT IMPLEMENT
- void operator=(const TargetIntrinsicInfo &); // DO NOT IMPLEMENT
+ TargetIntrinsicInfo(const TargetIntrinsicInfo &); // DO NOT IMPLEMENT
+ void operator=(const TargetIntrinsicInfo &); // DO NOT IMPLEMENT
public:
- TargetIntrinsicInfo(const char **desc, unsigned num);
+ TargetIntrinsicInfo();
virtual ~TargetIntrinsicInfo();
- unsigned getNumIntrinsics() const { return NumIntrinsics; }
-
- virtual Function *getDeclaration(Module *M, const char *BuiltinName) const {
- return 0;
- }
-
- // Returns the Function declaration for intrinsic BuiltinName. If the
- // intrinsic can be overloaded, uses Tys to return the correct function.
- virtual Function *getDeclaration(Module *M, const char *BuiltinName,
- const Type **Tys, unsigned numTys) const {
- return 0;
- }
+ /// Return the name of a target intrinsic, e.g. "llvm.bfin.ssync".
+ virtual const char *getName(unsigned IntrID) const =0;
- // Returns true if the Builtin can be overloaded.
- virtual bool isOverloaded(Module *M, const char *BuiltinName) const {
- return false;
- }
+ /// Look up target intrinsic by name. Return intrinsic ID or 0 for unknown
+ /// names.
+ virtual unsigned lookupName(const char *Name, unsigned Len) const =0;
- virtual unsigned getIntrinsicID(Function *F) const { return 0; }
+ /// Return the target intrinsic ID of a function, or 0.
+ virtual unsigned getIntrinsicID(Function *F) const;
};
} // End llvm namespace
Modified: llvm/trunk/lib/Target/TargetIntrinsicInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetIntrinsicInfo.cpp?rev=84192&r1=84191&r2=84192&view=diff
==============================================================================
--- llvm/trunk/lib/Target/TargetIntrinsicInfo.cpp (original)
+++ llvm/trunk/lib/Target/TargetIntrinsicInfo.cpp Thu Oct 15 13:49:26 2009
@@ -12,11 +12,19 @@
//===----------------------------------------------------------------------===//
#include "llvm/Target/TargetIntrinsicInfo.h"
+#include "llvm/Function.h"
+#include "llvm/ADT/StringMap.h"
using namespace llvm;
-TargetIntrinsicInfo::TargetIntrinsicInfo(const char **desc, unsigned count)
- : Intrinsics(desc), NumIntrinsics(count) {
+TargetIntrinsicInfo::TargetIntrinsicInfo() {
}
TargetIntrinsicInfo::~TargetIntrinsicInfo() {
}
+
+unsigned TargetIntrinsicInfo::getIntrinsicID(Function *F) const {
+ const ValueName *ValName = F->getValueName();
+ if (!ValName)
+ return 0;
+ return lookupName(ValName->getKeyData(), ValName->getKeyLength());
+}
More information about the llvm-commits
mailing list