Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(162)

Side by Side Diff: src/IceIntrinsics.cpp

Issue 321993002: Add a few Subzero intrinsics (not the atomic ones yet). (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: doesn't matter if eax or not Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 //===- subzero/src/IceIntrinsics.cpp - Functions related to intrinsics ----===//
2 //
3 // The Subzero Code Generator
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file implements the Intrinsics utilities for matching and
11 // then dispatching by name.
12 //
13 //===----------------------------------------------------------------------===//
14
15 #include "IceCfg.h"
16 #include "IceCfgNode.h"
17 #include "IceIntrinsics.h"
18 #include "IceLiveness.h"
19 #include "IceOperand.h"
20
21 #include <utility>
22
23 namespace Ice {
24
25 const IntrinsicInfo UnknownIntrinsicInfo = { UnknownIntrinsic, false };
26
27 bool operator==(const IntrinsicInfo &A, const IntrinsicInfo &B) {
28 return A.ID == B.ID && A.HasSideEffects == B.HasSideEffects;
29 }
30
31 // TODO(jvoung): vet and test the HasSideEffects attributes.
32 // Reduce the amount of duplication for overloaded intrinsics.
33 const struct IceIntrinsicsEntry_ {
JF 2014/06/10 03:50:41 This should be in an anonymous namespace.
jvoung (off chromium) 2014/06/12 05:48:30 Done.
34 IntrinsicInfo Info;
35 const char *IntrinsicName;
36 } IceIntrinsicsTable [] = {
37 { {AtomicCmpxchg, true}, "nacl.atomic.cmpxchg.i8" },
38 { {AtomicCmpxchg, true}, "nacl.atomic.cmpxchg.i16" },
39 { {AtomicCmpxchg, true}, "nacl.atomic.cmpxchg.i32" },
40 { {AtomicCmpxchg, true}, "nacl.atomic.cmpxchg.i64" },
41 { {AtomicFence, true}, "nacl.atomic.fence"},
42 { {AtomicFenceAll, true}, "nacl.atomic.fence.all" },
43 { {AtomicIsLockFree, true}, "nacl.atomic.is.lock.free" },
44 { {AtomicLoad, true}, "nacl.atomic.load.i8" },
45 { {AtomicLoad, true}, "nacl.atomic.load.i16" },
46 { {AtomicLoad, true}, "nacl.atomic.load.i32" },
47 { {AtomicLoad, true}, "nacl.atomic.load.i64" },
48 { {AtomicRMW, true}, "nacl.atomic.rmw.i8" },
49 { {AtomicRMW, true}, "nacl.atomic.rmw.i16" },
50 { {AtomicRMW, true}, "nacl.atomic.rmw.i32" },
51 { {AtomicRMW, true}, "nacl.atomic.rmw.i64" },
52 { {AtomicStore, true}, "nacl.atomic.store.i8" },
53 { {AtomicStore, true}, "nacl.atomic.store.i16" },
54 { {AtomicStore, true}, "nacl.atomic.store.i32" },
55 { {AtomicStore, true}, "nacl.atomic.store.i64" },
56 { {Bswap, false}, "bswap.i16" },
57 { {Bswap, false}, "bswap.i32" },
58 { {Bswap, false}, "bswap.i64" },
59 { {Ctlz, false}, "ctlz.i32" },
60 { {Ctlz, false}, "ctlz.i64" },
61 { {Ctpop, false}, "ctpop.i32" },
62 { {Ctpop, false}, "ctpop.i64" },
63 { {Cttz, false}, "cttz.i32" },
64 { {Cttz, false}, "cttz.i64" },
65 { {Longjmp, true}, "nacl.longjmp" },
66 { {Memcpy, true}, "memcpy.p0i8.p0i8.i32" },
67 { {Memmove, true}, "memmove.p0i8.p0i8.i32" },
68 { {Memset, true}, "memset.p0i8.i32" },
69 { {NaClReadTP, false}, "nacl.read.tp" },
70 { {Setjmp, true}, "nacl.setjmp" },
71 { {Sqrt, false}, "sqrt.f32" },
72 { {Sqrt, false}, "sqrt.f64" },
73 { {Stacksave, true}, "stacksave" },
74 { {Stackrestore, true}, "stackrestore" },
75 { {Trap, true}, "trap" }
JF 2014/06/10 03:50:41 Do you need the function signatures too? The lower
Jim Stichnoth 2014/06/10 22:58:28 I'm not sure what in particular the lowering code
jvoung (off chromium) 2014/06/12 05:48:30 Yeah, I think type signatures would be most useful
JF 2014/06/12 15:43:02 I was thinking of something similar to llvm/IR/NaC
76 };
77
78 const size_t IceIntrinsicsTableSize = llvm::array_lengthof(IceIntrinsicsTable);
79
80 void BuildIntrinsicMap(IntrinsicMap *OutMap) {
81 for (size_t I = 0; I < IceIntrinsicsTableSize; ++I) {
82 const struct IceIntrinsicsEntry_ &Entry = IceIntrinsicsTable[I];
83 OutMap->insert(std::make_pair(IceString(Entry.IntrinsicName), Entry.Info));
84 }
85 }
86
87 } // end of namespace Ice
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698