[llvm-commits] [llvm] r151792 - in /llvm/trunk: lib/Target/MBlaze/MBlazeIntrinsicInfo.cpp lib/VMCore/Function.cpp utils/TableGen/IntrinsicEmitter.cpp
Benjamin Kramer
benny.kra at googlemail.com
Wed Feb 29 18:16:58 PST 2012
Author: d0k
Date: Wed Feb 29 20:16:57 2012
New Revision: 151792
URL: http://llvm.org/viewvc/llvm-project?rev=151792&view=rev
Log:
Emit the "is an intrinsic overloaded" table as a bitfield.
Modified:
llvm/trunk/lib/Target/MBlaze/MBlazeIntrinsicInfo.cpp
llvm/trunk/lib/VMCore/Function.cpp
llvm/trunk/utils/TableGen/IntrinsicEmitter.cpp
Modified: llvm/trunk/lib/Target/MBlaze/MBlazeIntrinsicInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/MBlaze/MBlazeIntrinsicInfo.cpp?rev=151792&r1=151791&r2=151792&view=diff
==============================================================================
--- llvm/trunk/lib/Target/MBlaze/MBlazeIntrinsicInfo.cpp (original)
+++ llvm/trunk/lib/Target/MBlaze/MBlazeIntrinsicInfo.cpp Wed Feb 29 20:16:57 2012
@@ -74,16 +74,13 @@
}
bool MBlazeIntrinsicInfo::isOverloaded(unsigned IntrID) const {
- // Overload Table
- const bool OTable[] = {
+ if (IntrID == 0)
+ return false;
+
+ unsigned id = IntrID - Intrinsic::num_intrinsics + 1;
#define GET_INTRINSIC_OVERLOAD_TABLE
#include "MBlazeGenIntrinsics.inc"
#undef GET_INTRINSIC_OVERLOAD_TABLE
- };
- if (IntrID == 0)
- return false;
- else
- return OTable[IntrID - Intrinsic::num_intrinsics];
}
/// This defines the "getAttributes(ID id)" method.
Modified: llvm/trunk/lib/VMCore/Function.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Function.cpp?rev=151792&r1=151791&r2=151792&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Function.cpp (original)
+++ llvm/trunk/lib/VMCore/Function.cpp Wed Feb 29 20:16:57 2012
@@ -372,13 +372,9 @@
}
bool Intrinsic::isOverloaded(ID id) {
- static const bool OTable[] = {
- false,
#define GET_INTRINSIC_OVERLOAD_TABLE
#include "llvm/Intrinsics.gen"
#undef GET_INTRINSIC_OVERLOAD_TABLE
- };
- return OTable[id];
}
/// This defines the "Intrinsic::getAttributes(ID id)" method.
Modified: llvm/trunk/utils/TableGen/IntrinsicEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/IntrinsicEmitter.cpp?rev=151792&r1=151791&r2=151792&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/IntrinsicEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/IntrinsicEmitter.cpp Wed Feb 29 20:16:57 2012
@@ -160,17 +160,20 @@
void IntrinsicEmitter::
EmitIntrinsicToOverloadTable(const std::vector<CodeGenIntrinsic> &Ints,
raw_ostream &OS) {
- OS << "// Intrinsic ID to overload table\n";
+ OS << "// Intrinsic ID to overload bitset\n";
OS << "#ifdef GET_INTRINSIC_OVERLOAD_TABLE\n";
- OS << " // Note that entry #0 is the invalid intrinsic!\n";
+ OS << "static const uint8_t OTable[] = {\n";
+ OS << " 0";
for (unsigned i = 0, e = Ints.size(); i != e; ++i) {
- OS << " ";
+ // Add one to the index so we emit a null bit for the invalid #0 intrinsic.
+ if ((i+1)%8 == 0)
+ OS << ",\n 0";
if (Ints[i].isOverloaded)
- OS << "true";
- else
- OS << "false";
- OS << ",\n";
+ OS << " | (1<<" << (i+1)%8 << ')';
}
+ OS << "\n};\n\n";
+ // OTable contains a true bit at the position if the intrinsic is overloaded.
+ OS << "return (OTable[id/8] & (1 << (id%8))) != 0;\n";
OS << "#endif\n\n";
}
More information about the llvm-commits
mailing list