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

Unified Diff: src/IceInstX8632.h

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 side-by-side diff with in-line comments
Download patch
Index: src/IceInstX8632.h
diff --git a/src/IceInstX8632.h b/src/IceInstX8632.h
index 8a6f14a9efe5cce8a3d7e2ebfb3ea8e6dccbb2c0..037a1dfbd9815c00b6b76ad679975e65d3fc5ec9 100644
--- a/src/IceInstX8632.h
+++ b/src/IceInstX8632.h
@@ -26,12 +26,13 @@ namespace Ice {
class TargetX8632;
// OperandX8632 extends the Operand hierarchy. Its subclasses are
-// OperandX8632Mem and VariableSplit.
+// OperandX8632Mem, OperandX8632MemOffSeg, and VariableSplit.
class OperandX8632 : public Operand {
public:
enum OperandKindX8632 {
k__Start = Operand::kTarget,
kMem,
+ kMemOffSeg,
kSplit
};
virtual void emit(const Cfg *Func) const = 0;
@@ -81,6 +82,37 @@ private:
uint32_t Shift;
};
+// OperandX8632MemOffSeg represents the moffs addressing mode, where
+// the address is given by an offset relative to the segment base.
+class OperandX8632MemOffSeg : public OperandX8632 {
Jim Stichnoth 2014/06/10 22:58:28 Instead of creating this new class, couldn't we ju
jvoung (off chromium) 2014/06/12 05:48:30 Done. The initial concern was that we would be wa
Jim Stichnoth 2014/06/12 20:52:06 You're right, I should have been looking at create
+public:
+ static OperandX8632MemOffSeg *create(Cfg *Func, Type Ty,
+ Constant *Offset,
+ SizeT SegmentReg) {
+ return new (Func->allocate<OperandX8632MemOffSeg>())
+ OperandX8632MemOffSeg(Ty, Offset, SegmentReg);
+ }
+ Constant *getOffset() const { return Offset; }
+ SizeT getSegmentRegister() const { return SegmentReg; }
JF 2014/06/10 03:50:41 It seems weird to have SegmentReg as a SizeT. Shou
Jim Stichnoth 2014/06/10 22:58:28 The regular registers are using int32_t, but I won
jvoung (off chromium) 2014/06/12 05:48:30 Moved to using the enum.
+ virtual void emit(const Cfg *Func) const;
+ virtual void dump(const Cfg *Func) const;
+
+ static bool classof(const Operand *Operand) {
+ return Operand->getKind() == static_cast<OperandKind>(kMemOffSeg);
+ }
+
+private:
+ OperandX8632MemOffSeg(Type Ty, Constant *Offset, SizeT SegmentReg)
+ : OperandX8632(kMemOffSeg, Ty), Offset(Offset), SegmentReg(SegmentReg) {}
+ OperandX8632MemOffSeg(
+ const OperandX8632MemOffSeg &) LLVM_DELETED_FUNCTION;
+ OperandX8632MemOffSeg &operator=(
+ const OperandX8632MemOffSeg &) LLVM_DELETED_FUNCTION;
+ virtual ~OperandX8632MemOffSeg() {}
+ Constant *Offset;
+ SizeT SegmentReg;
+};
+
// VariableSplit is a way to treat an f64 memory location as a pair
// of i32 locations (Low and High). This is needed for some cases
// of the Bitcast instruction. Since it's not possible for integer
@@ -160,6 +192,7 @@ public:
Subss,
Test,
Ucomiss,
+ UD2,
Xor
};
static const char *getWidthString(Type Ty);
@@ -531,6 +564,24 @@ private:
virtual ~InstX8632Ucomiss() {}
};
+// UD2 instruction.
+class InstX8632UD2 : public InstX8632 {
+public:
+ static InstX8632UD2 *create(Cfg *Func) {
+ return new (Func->allocate<InstX8632UD2>())
+ InstX8632UD2(Func);
+ }
+ virtual void emit(const Cfg *Func) const;
+ virtual void dump(const Cfg *Func) const;
+ static bool classof(const Inst *Inst) { return isClassof(Inst, UD2); }
+
+private:
+ InstX8632UD2(Cfg *Func);
+ InstX8632UD2(const InstX8632UD2 &) LLVM_DELETED_FUNCTION;
+ InstX8632UD2 &operator=(const InstX8632UD2 &) LLVM_DELETED_FUNCTION;
+ virtual ~InstX8632UD2() {}
+};
+
// Test instruction.
class InstX8632Test : public InstX8632 {
public:

Powered by Google App Engine
This is Rietveld 408576698