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

Unified Diff: src/IceOperand.cpp

Issue 265703002: Add Om1 lowering with no optimizations (Closed) Base URL: https://gerrit.chromium.org/gerrit/p/native_client/pnacl-subzero.git@master
Patch Set: Merge changed from Karl's committed CL Created 6 years, 7 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
« no previous file with comments | « src/IceOperand.h ('k') | src/IceTargetLowering.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceOperand.cpp
diff --git a/src/IceOperand.cpp b/src/IceOperand.cpp
index 1009a33d2cb1664e57ce1de882d3eb11ef0b4d7b..56520d3ef273489968a898d47662f2a3927df3d3 100644
--- a/src/IceOperand.cpp
+++ b/src/IceOperand.cpp
@@ -16,6 +16,7 @@
#include "IceCfg.h"
#include "IceInst.h"
#include "IceOperand.h"
+#include "IceTargetLowering.h" // dumping stack/frame pointer register
namespace Ice {
@@ -27,6 +28,14 @@ bool operator<(const RelocatableTuple &A, const RelocatableTuple &B) {
return A.Name < B.Name;
}
+bool operator<(const RegWeight &A, const RegWeight &B) {
+ return A.getWeight() < B.getWeight();
+}
+bool operator<=(const RegWeight &A, const RegWeight &B) { return !(B < A); }
+bool operator==(const RegWeight &A, const RegWeight &B) {
+ return !(B < A) && !(A < B);
+}
+
void Variable::setUse(const Inst *Inst, const CfgNode *Node) {
if (DefNode == NULL)
return;
@@ -66,19 +75,57 @@ IceString Variable::getName() const {
return buf;
}
+Variable Variable::asType(Type Ty) {
+ Variable V(Ty, DefNode, Number, Name);
+ V.RegNum = RegNum;
+ V.StackOffset = StackOffset;
+ return V;
+}
+
// ======================== dump routines ======================== //
+void Variable::emit(const Cfg *Func) const {
+ Func->getTarget()->emitVariable(this, Func);
+}
+
void Variable::dump(const Cfg *Func) const {
Ostream &Str = Func->getContext()->getStrDump();
const CfgNode *CurrentNode = Func->getCurrentNode();
(void)CurrentNode; // used only in assert()
assert(CurrentNode == NULL || DefNode == NULL || DefNode == CurrentNode);
- Str << "%" << getName();
+ if (Func->getContext()->isVerbose(IceV_RegOrigins) ||
+ (!hasReg() && !Func->getTarget()->hasComputedFrame()))
+ Str << "%" << getName();
+ if (hasReg()) {
+ if (Func->getContext()->isVerbose(IceV_RegOrigins))
+ Str << ":";
+ Str << Func->getTarget()->getRegName(RegNum, getType());
+ } else if (Func->getTarget()->hasComputedFrame()) {
+ if (Func->getContext()->isVerbose(IceV_RegOrigins))
+ Str << ":";
+ Str << "[" << Func->getTarget()->getRegName(
+ Func->getTarget()->getFrameOrStackReg(), IceType_i32);
+ int32_t Offset = getStackOffset();
+ if (Offset) {
+ if (Offset > 0)
+ Str << "+";
+ Str << Offset;
+ }
+ Str << "]";
+ }
}
-void Operand::dump(const Cfg *Func) const {
- Ostream &Str = Func->getContext()->getStrDump();
- Str << "Operand<?>";
+void ConstantRelocatable::emit(const Cfg *Func) const {
+ Ostream &Str = Func->getContext()->getStrEmit();
+ if (SuppressMangling)
+ Str << Name;
+ else
+ Str << Func->getContext()->mangleName(Name);
+ if (Offset) {
+ if (Offset > 0)
+ Str << "+";
+ Str << Offset;
+ }
}
void ConstantRelocatable::dump(const Cfg *Func) const {
@@ -88,4 +135,12 @@ void ConstantRelocatable::dump(const Cfg *Func) const {
Str << "+" << Offset;
}
+Ostream &operator<<(Ostream &Str, const RegWeight &W) {
+ if (W.getWeight() == RegWeight::Inf)
+ Str << "Inf";
+ else
+ Str << W.getWeight();
+ return Str;
+}
+
} // end of namespace Ice
« no previous file with comments | « src/IceOperand.h ('k') | src/IceTargetLowering.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698