diff options
author | Chris Lattner <sabre@nondot.org> | 2006-03-24 23:10:39 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2006-03-24 23:10:39 +0000 |
commit | 5a1df389a675c8f9bb73afc95132751508e24762 (patch) | |
tree | b2f59274cec4f67bf0ee1b5b2ac96d734efc2291 /utils/TableGen/DAGISelEmitter.h | |
parent | 7255a545613f9e713779ca81f55711c0863d9cc9 (diff) | |
download | external_llvm-5a1df389a675c8f9bb73afc95132751508e24762.zip external_llvm-5a1df389a675c8f9bb73afc95132751508e24762.tar.gz external_llvm-5a1df389a675c8f9bb73afc95132751508e24762.tar.bz2 |
Change approach so that we get codegen for free for intrinsics. With this,
intrinsics that don't take pointer arguments now work. For example, we can
compile this:
int test3( __m128d *A) {
return _mm_movemask_pd(*A);
}
int test4( __m128 *A) {
return _mm_movemask_ps(*A);
}
to this:
_test3:
movl 4(%esp), %eax
movapd (%eax), %xmm0
movmskpd %xmm0, %eax
ret
_test4:
movl 4(%esp), %eax
movaps (%eax), %xmm0
movmskps %xmm0, %eax
ret
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27090 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/TableGen/DAGISelEmitter.h')
-rw-r--r-- | utils/TableGen/DAGISelEmitter.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/utils/TableGen/DAGISelEmitter.h b/utils/TableGen/DAGISelEmitter.h index 10b997d..8ed66be 100644 --- a/utils/TableGen/DAGISelEmitter.h +++ b/utils/TableGen/DAGISelEmitter.h @@ -421,6 +421,10 @@ private: std::map<Record*, TreePattern*> PatternFragments; std::map<Record*, DAGInstruction> Instructions; + // Specific SDNode definitions: + Record *intrinsic_void_sdnode; + Record *intrinsic_w_chain_sdnode, *intrinsic_wo_chain_sdnode; + /// PatternsToMatch - All of the things we are matching on the DAG. The first /// value is the pattern to match, the second pattern is the result to /// emit. @@ -457,6 +461,18 @@ public: abort(); } + const CodeGenIntrinsic &getIntrinsicInfo(unsigned IID) const { + assert(IID-1 < Intrinsics.size() && "Bad intrinsic ID!"); + return Intrinsics[IID-1]; + } + + unsigned getIntrinsicID(Record *R) const { + for (unsigned i = 0, e = Intrinsics.size(); i != e; ++i) + if (Intrinsics[i].TheDef == R) return i; + assert(0 && "Unknown intrinsic!"); + abort(); + } + TreePattern *getPatternFragment(Record *R) const { assert(PatternFragments.count(R) && "Invalid pattern fragment request!"); return PatternFragments.find(R)->second; @@ -467,6 +483,17 @@ public: return Instructions.find(R)->second; } + Record *get_intrinsic_void_sdnode() const { + return intrinsic_void_sdnode; + } + Record *get_intrinsic_w_chain_sdnode() const { + return intrinsic_w_chain_sdnode; + } + Record *get_intrinsic_wo_chain_sdnode() const { + return intrinsic_wo_chain_sdnode; + } + + private: void ParseNodeInfo(); void ParseNodeTransforms(std::ostream &OS); |