You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by va...@apache.org on 2007/04/11 14:28:48 UTC
svn commit: r527470 [2/2] - in
/harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf: ./ include/
Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/include/IpfCfg.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/include/IpfCfg.h?view=diff&rev=527470&r1=527469&r2=527470
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/include/IpfCfg.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/include/IpfCfg.h Wed Apr 11 05:28:45 2007
@@ -137,7 +137,7 @@
public:
Opnd(uint32, OpndKind=OPND_INVALID, DataKind=DATA_INVALID, int64=0);
- uint32 getId() { return id; }
+ uint16 getId() { return id; }
OpndKind getOpndKind() { return opndKind; }
DataKind getDataKind() { return dataKind; }
void setValue(int64 value_) { value = value_; }
@@ -147,19 +147,20 @@
bool isGReg() { return IpfType::isGReg(opndKind); }
bool isFReg() { return IpfType::isFReg(opndKind); }
bool isImm() { return IpfType::isImm(opndKind); }
+ bool isQp() { return opndKind == OPND_P_REG; }
bool isFloating() { return IpfType::isFloating(dataKind); }
bool isSigned() { return IpfType::isSigned(dataKind); }
int16 getSize() { return IpfType::getSize(dataKind); }
bool isWritable();
bool isConstant();
bool isMem();
-
- bool isFoldableImm(int16 size) { return isFoldableImm(value, size); }
bool isImm(int);
+
+ bool isFoldableImm(int16 size) { return isFoldableImm(value, size); }
static bool isFoldableImm(int64 value, int16 size);
protected:
- uint32 id;
+ uint16 id;
OpndKind opndKind;
DataKind dataKind;
int64 value;
@@ -176,13 +177,18 @@
void setLocation(int32 value_) { value = value_; }
int32 getLocation() { return value; }
+ QpMask getQpMask() { return qpMask; }
+ void andQpMask(QpMask mask) { qpMask &= mask; }
+ void orQpMask(QpMask mask) { qpMask |= mask; }
+ bool isAlive(QpMask mask) { return mask & qpMask; }
+
void incSpillCost(uint32 spillCost_) { spillCost += spillCost_; }
uint32 getSpillCost() { return spillCost; }
RegOpndSet &getDepOpnds() { return depOpnds; }
void insertDepOpnds(RegOpndSet &opnds) { depOpnds.insert(opnds.begin(), opnds.end()); }
void insertDepOpnd(RegOpnd*);
void setCrossCallSite(bool crossCallSite_) { crossCallSite = crossCallSite_; }
- bool getCrossCallSite() { return crossCallSite; }
+ bool isCrossCallSite() { return crossCallSite; }
Int2OpndMap &getCoalesceCands() { return coalesceCands; }
void addCoalesceCand(uint32 execCnt, RegOpnd *opnd) { coalesceCands.insert(make_pair(execCnt, opnd)); }
@@ -190,6 +196,7 @@
virtual ~RegOpnd() {}
protected:
+ QpMask qpMask; // mask of predicate spaces opnd alive in
// These fields are for register allocation algorithm
uint32 spillCost; // number of opnd uses
RegOpndSet depOpnds; // opnds which can not be placed in the same reg with the opnd
@@ -358,29 +365,31 @@
Node *getDispatchNode();
void mergeOutLiveSets(RegOpndSet &resultSet);
+ uint16 getId() { return id; }
void setExecCounter(uint32 execCounter_) { execCounter = execCounter_; }
uint32 getExecCounter() { return execCounter; }
- EdgeVector &getInEdges() { return inEdges; }
- EdgeVector &getOutEdges() { return outEdges; }
void setNodeKind(NodeKind kind_) { nodeKind = kind_; }
NodeKind getNodeKind() { return nodeKind; }
- void setId(uint32 id_) { id = id_; }
- uint32 getId() { return id; }
+ EdgeVector &getInEdges() { return inEdges; }
+ EdgeVector &getOutEdges() { return outEdges; }
void setLiveSet(RegOpndSet& liveSet_) { liveSet = liveSet_; }
- RegOpndSet &getLiveSet() { return liveSet; }
- void clearLiveSet() { liveSet.clear(); }
void setLoopHeader(Node *loopHeader_) { loopHeader = loopHeader_; }
Node *getLoopHeader() { return loopHeader; }
+ RegOpndSet &getLiveSet() { return liveSet; }
+ void clearLiveSet() { liveSet.clear(); }
+ void setVisited(bool visited_) { visited = visited_; }
+ bool isVisited() { return visited; }
bool isBb() { return nodeKind == NODE_BB; }
protected:
- uint32 id; // node unique Id
+ uint16 id; // node unique Id
uint32 execCounter; // profile info (how many times the node executes)
NodeKind nodeKind; //
EdgeVector inEdges; // in edges list
EdgeVector outEdges; // out edges list
Node *loopHeader; // header of loop containing this node, if NULL - node is not in loop
RegOpndSet liveSet; // set of opnds alive on node enter
+ bool visited; // flag used in node iterating algorithms (live analysis)
};
//========================================================================================//
@@ -393,10 +402,10 @@
void addInst(Inst *inst) { insts.push_back(inst); }
void removeInst(Inst *inst) { insts.erase(find(insts.begin(),insts.end(),inst)); }
InstVector &getInsts() { return insts; }
- void setAddress(uint64 address_) { address = address_; }
- uint64 getAddress() { return address; }
void setLayoutSucc(BbNode *layoutSucc_) { layoutSucc = layoutSucc_; }
BbNode *getLayoutSucc() { return layoutSucc; }
+ void setAddress(uint64 address_) { address = address_; }
+ uint64 getAddress() { return address; }
uint64 getInstAddr(Inst *inst) { return ((uint64)address + inst->getAddr()); }
protected:
@@ -414,16 +423,14 @@
Cfg(MemoryManager &mm, CompilationInterface &compilationInterface);
NodeVector &search(SearchKind searchKind);
- MemoryManager &getMM() { return mm; }
- CompilationInterface &getCompilationInterface() { return compilationInterface; }
- uint16 getNextNodeId() { return maxNodeId++; }
- uint16 getMaxNodeId() { return maxNodeId; }
- void setEnterNode(Node *enterNode_) { enterNode = enterNode_; }
- void setExitNode(Node *exitNode_) { exitNode = exitNode_; }
- Node *getEnterNode() { return enterNode; }
- Node *getExitNode() { return exitNode; }
- OpndManager *getOpndManager() { return opndManager; }
- MethodDesc *getMethodDesc() { return compilationInterface.getMethodToCompile(); }
+ MemoryManager &getMM() { return mm; }
+ CompilationInterface &getCompilationInterface() { return compilationInterface; }
+ void setEnterNode(BbNode *node) { enterNode = node; }
+ void setExitNode(BbNode *node) { exitNode = node; }
+ BbNode *getEnterNode() { return enterNode; }
+ BbNode *getExitNode() { return exitNode; }
+ OpndManager *getOpndManager() { return opndManager; }
+ MethodDesc *getMethodDesc() { return compilationInterface.getMethodToCompile(); }
protected:
void makePostOrdered(Node *node, NodeSet &visitedNodes);
@@ -433,10 +440,9 @@
MemoryManager &mm;
CompilationInterface &compilationInterface;
- uint16 maxNodeId;
OpndManager *opndManager;
- Node *enterNode;
- Node *exitNode;
+ BbNode *enterNode;
+ BbNode *exitNode;
NodeVector searchResult;
SearchKind lastSearchKind;
};
Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/include/IpfCodeGenerator.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/include/IpfCodeGenerator.h?view=diff&rev=527470&r1=527469&r2=527470
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/include/IpfCodeGenerator.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/include/IpfCodeGenerator.h Wed Apr 11 05:28:45 2007
@@ -43,8 +43,9 @@
protected:
CompilationInterface *compilationInterface;
MethodDesc *methodDesc;
+
Cfg *cfg;
-};
+};
} // IPF
} // Jitrino
Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/include/IpfCodeLayouter.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/include/IpfCodeLayouter.h?view=diff&rev=527470&r1=527469&r2=527470
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/include/IpfCodeLayouter.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/include/IpfCodeLayouter.h Wed Apr 11 05:28:45 2007
@@ -67,6 +67,7 @@
MemoryManager &mm;
Cfg &cfg;
+ OpndManager *opndManager;
ChainList chains;
NodeSet visitedNodes;
};
Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/include/IpfCodeSelector.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/include/IpfCodeSelector.h?view=diff&rev=527470&r1=527469&r2=527470
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/include/IpfCodeSelector.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/include/IpfCodeSelector.h Wed Apr 11 05:28:45 2007
@@ -103,6 +103,7 @@
NodeVector &nodes;
OpndVector &opnds;
CompilationInterface &compilationInterface;
+ OpndManager *opndManager;
};
//========================================================================================//
@@ -390,7 +391,6 @@
OpndVector &opnds;
CompilationInterface &compilationInterface;
OpndManager *opndManager;
- int32 numFpInArgs;
RegOpnd *p0;
};
Added: harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/include/IpfInstrumentator.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/include/IpfInstrumentator.h?view=auto&rev=527470
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/include/IpfInstrumentator.h (added)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/include/IpfInstrumentator.h Wed Apr 11 05:28:45 2007
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @author Intel, Konstantin M. Anisimov, Igor V. Chebykin
+ * @version $Revision: 1.1 $
+ *
+ */
+
+#ifndef IPFINSTRUMENTATOR_H_
+#define IPFINSTRUMENTATOR_H_
+
+#include "IpfCfg.h"
+#include "IpfOpndManager.h"
+#include "DrlVMInterface.h"
+
+namespace Jitrino {
+namespace IPF {
+
+//=======================================================================================//
+// Instrumentator
+//========================================================================================//
+
+class Instrumentator {
+public:
+ Instrumentator(Cfg&);
+ void instrument();
+ static void methodStart(Method_Handle);
+ static void methodEnd(Method_Handle);
+
+protected:
+ void instrumentStart();
+ void instrumentEnd();
+ void genNativeCall(uint64, InstVector&);
+
+ MemoryManager &mm;
+ OpndManager *opndManager;
+ Cfg &cfg;
+};
+
+} // IPF
+} // Jitrino
+
+#endif /*IPFINSTRUMENTATOR_H_*/
Propchange: harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/include/IpfInstrumentator.h
------------------------------------------------------------------------------
svn:eol-style = native
Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/include/IpfIrPrinter.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/include/IpfIrPrinter.h?view=diff&rev=527470&r1=527469&r2=527470
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/include/IpfIrPrinter.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/include/IpfIrPrinter.h Wed Apr 11 05:28:45 2007
@@ -27,6 +27,7 @@
#include <iostream>
#include <fstream>
#include "IpfCfg.h"
+#include "IpfLiveManager.h"
namespace Jitrino {
namespace IPF {
@@ -42,8 +43,10 @@
void printLayoutDot(char*);
void printAsm(ostream&);
+ static string toString(MethodDesc*);
static string toString(Inst*);
static string toString(Opnd*);
+ static string toString(QpNode*);
static string toString(OpndSet&);
static string toString(RegOpndSet&);
static string toString(OpndVector&);
@@ -54,6 +57,7 @@
static string toString(EdgeKind);
static string toString(OpndKind);
static string toString(DataKind);
+ static string boolString(uint64, uint16=16);
protected:
void printEdgeDot(Edge*);
@@ -67,6 +71,7 @@
Cfg &cfg;
ostream *os; // output stream
ofstream *ofs; // file output stream
+ char logDir[500];
};
} // IPF
Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/include/IpfLiveAnalyzer.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/include/IpfLiveAnalyzer.h?view=diff&rev=527470&r1=527469&r2=527470
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/include/IpfLiveAnalyzer.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/include/IpfLiveAnalyzer.h Wed Apr 11 05:28:45 2007
@@ -24,6 +24,7 @@
#define IPFLIVEANALYZER_H_
#include "IpfCfg.h"
+#include "IpfLiveManager.h"
using namespace std;
@@ -36,18 +37,22 @@
class LiveAnalyzer {
public:
- LiveAnalyzer(Cfg&);
- void makeLiveSets(bool);
-
- static void updateLiveSet(RegOpndSet&, Inst*);
- static void defOpnds(RegOpndSet&, Inst*);
- static void useOpnds(RegOpndSet&, Inst*);
+ LiveAnalyzer(Cfg&);
+ void analyze();
+ void dce();
+ void verify();
protected:
- bool analyzeNode(Node*);
-
- Cfg &cfg;
- bool verify;
+ bool analyzeNode(Node*);
+ void pushPreds(Node*);
+ bool isInstDead(Inst*);
+
+ Cfg &cfg;
+ MemoryManager &mm;
+ NodeVector workSet; // nodes to be iterated during liveSets calculation or dce
+ LiveManager liveManager; // Live Manager evaluates current live set from inst to inst
+ RegOpndSet &liveSet; // reference on current live set in liveManager
+ bool dceFlag; // make dce if flag is on
};
} // IPF
Added: harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/include/IpfLiveManager.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/include/IpfLiveManager.h?view=auto&rev=527470
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/include/IpfLiveManager.h (added)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/include/IpfLiveManager.h Wed Apr 11 05:28:45 2007
@@ -0,0 +1,112 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @author Intel, Konstantin M. Anisimov, Igor V. Chebykin
+ * @version $Revision: 1.1 $
+ *
+ */
+
+#ifndef IPFLIVEMANAGER_H_
+#define IPFLIVEMANAGER_H_
+
+#include "IpfCfg.h"
+
+using namespace std;
+
+namespace Jitrino {
+namespace IPF {
+
+//========================================================================================//
+// QpNode
+//========================================================================================//
+
+class QpNode {
+public:
+ QpNode(QpNode*, QpMask);
+ void initLiveMask();
+ void initCompMask();
+ QpNode* getPredNode() { return predNode; }
+ QpMask getNodeMask() { return nodeMask; }
+ QpMask getCompMask() { return compMask; }
+ QpMask getLiveMask() { return liveMask; }
+ void setCompNode(QpNode *node) { compNode = node; }
+ void setNodeMask(QpMask mask) { nodeMask = mask; }
+ void orNodeMask(QpMask mask) { nodeMask |= mask; }
+
+protected:
+ QpNode *predNode; // predecessor in QpTree tree
+ QpNode *compNode; // qpNode that complements current one (NULL if there is no complement)
+ QpMask nodeMask; // predicates alive in current predicate space
+ QpMask compMask; // mask of compNode (to speed up "getCompMask" method)
+ QpMask liveMask; // mask of prdicate spaces interfering with current (all
+ // predicates except complementing ones)
+};
+
+//========================================================================================//
+// QpTree
+//========================================================================================//
+
+class QpTree {
+public:
+ QpTree(Cfg&);
+ void makeQpTree(InstVector&);
+ QpNode* findQpNode(Opnd*);
+ void removeQpNode(Opnd*);
+ void printQpTree();
+
+protected:
+ QpNode* makeQpNode(QpNode*, Opnd*);
+ void printQpNode(QpMap::iterator, uint16);
+ bool isDefOnePred(Inst*);
+ bool isDefTwoPreds(Inst*);
+ bool isDefComps(Inst*);
+
+ Cfg &cfg;
+ MemoryManager &mm;
+ QpMap qpMap; // map containing qpNodes for current node
+ QpMask slot; // current available position in mask
+ RegOpnd *p0; // opnd representing p0
+};
+
+//========================================================================================//
+// LiveManager
+//========================================================================================//
+
+class LiveManager {
+public:
+ LiveManager(Cfg&);
+ void init(Node*);
+ void def(Inst*);
+ void use(Inst*);
+ QpMask getLiveMask(RegOpnd*);
+ void printQpTree() { qpTree.printQpTree(); }
+ RegOpndSet& getLiveSet() { return liveSet; }
+
+protected:
+ void useOpnd(QpNode*, RegOpnd*);
+ bool defOpnd(QpNode*, RegOpnd*);
+
+ Cfg &cfg;
+ QpTree qpTree; // tree definind relations between qualifying predicates in node
+ RegOpndSet liveSet; // current liveSet used in liveness analysis (DCE, register allocator ...)
+};
+
+} // IPF
+} // Jitrino
+
+#endif /*IPFLIVEMANAGER_H_*/
Propchange: harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/include/IpfLiveManager.h
------------------------------------------------------------------------------
svn:eol-style = native
Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/include/IpfOpndManager.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/include/IpfOpndManager.h?view=diff&rev=527470&r1=527469&r2=527470
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/include/IpfOpndManager.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/include/IpfOpndManager.h Wed Apr 11 05:28:45 2007
@@ -35,6 +35,7 @@
class Opnd;
class RegOpnd;
+class Cfg;
//========================================================================================//
// RegStack
@@ -138,10 +139,10 @@
class StackInfo {
public:
StackInfo();
- int32 rpBak; // num of gr or stack offset containing return pointer (e.g. r33)
- int32 prBak; // num of gr or stack offset containing predicate registers (e.g. r34)
- int32 pfsBak; // num of gr or stack offset containing AR.PFS (e.g. r35)
- int32 unatBak; // num of gr or stack offset containing AR.UNAT (e.g. r36)
+ int32 rpBak; // gr num or stack offset containing return pointer (e.g. r33)
+ int32 prBak; // gr num or stack offset containing predicate registers (e.g. r34)
+ int32 pfsBak; // gr num or stack offset containing AR.PFS (e.g. r35)
+ int32 unatBak; // gr num or stack offset containing AR.UNAT (e.g. r36)
int32 savedBase; // mem stack offset of first saved gr (bytes)
uint32 savedGrMask; // mask of preserved grs saved on stack
uint32 savedFrMask; // mask of preserved frs saved on stack
@@ -155,47 +156,49 @@
class OpndManager : public RegStack, public MemStack, public StackInfo {
public:
- OpndManager(MemoryManager&, CompilationInterface&);
+ OpndManager(MemoryManager&, CompilationInterface&);
//----------------------------------------------------------------------------//
// Opnd constructors
//----------------------------------------------------------------------------//
- Opnd *newOpnd(OpndKind = OPND_INVALID);
- RegOpnd *newRegOpnd(OpndKind, DataKind, int32 = LOCATION_INVALID);
- Opnd *newImm(int64 = 0);
- ConstantRef *newConstantRef(Constant*, DataKind = DATA_CONST_REF);
- NodeRef *newNodeRef(BbNode* = NULL);
- MethodRef *newMethodRef(MethodDesc* = NULL);
+ Opnd *newOpnd(OpndKind = OPND_INVALID);
+ RegOpnd *newRegOpnd(OpndKind, DataKind, int32 = LOCATION_INVALID);
+ Opnd *newImm(int64 = 0);
+ ConstantRef *newConstantRef(Constant*, DataKind = DATA_CONST_REF);
+ NodeRef *newNodeRef(BbNode* = NULL);
+ MethodRef *newMethodRef(MethodDesc* = NULL);
+ Opnd *newInArg(OpndKind, DataKind, uint32);
+ uint16 getFpArgsNum();
//----------------------------------------------------------------------------//
// set / get methods
//----------------------------------------------------------------------------//
- RegOpnd *getR0();
- RegOpnd *getR0(RegOpnd*);
- RegOpnd *getF0();
- RegOpnd *getF1();
-
- RegOpnd *getP0();
- RegOpnd *getB0();
- RegOpnd *getR12();
- RegOpnd *getR8();
- RegOpnd *getF8();
- RegOpnd *getTau();
-
- void setContainCall(bool containCall_) { containCall = containCall_; }
- bool getContainCall() { return containCall; }
-
- uint getNumOpnds() { return maxOpndId; }
+ RegOpnd *getR0();
+ RegOpnd *getR0(RegOpnd*);
+ RegOpnd *getF0();
+ RegOpnd *getF1();
+
+ RegOpnd *getP0();
+ RegOpnd *getB0();
+ RegOpnd *getR12();
+ RegOpnd *getR8();
+ RegOpnd *getF8();
+ RegOpnd *getTau();
+
+ void setContainCall(bool containCall_) { containCall = containCall_; }
+ bool getContainCall() { return containCall; }
+ uint16 getNextNodeId() { return maxNodeId++; }
+ BbNode *getPrologNode() { return prologNode; }
//----------------------------------------------------------------------------//
// Reg allocation support
//----------------------------------------------------------------------------//
- int32 newLocation(OpndKind, DataKind, RegBitSet, bool);
- int32 newScratchReg(OpndKind, RegBitSet&);
- int32 newPreservReg(OpndKind, RegBitSet&);
+ int32 newLocation(OpndKind, DataKind, RegBitSet, bool);
+ int32 newScratchReg(OpndKind, RegBitSet&);
+ int32 newPreservReg(OpndKind, RegBitSet&);
//----------------------------------------------------------------------------//
// Compressed references
@@ -214,27 +217,32 @@
// Misc
//----------------------------------------------------------------------------//
- int64 getElemBaseOffset();
- void printStackInfo();
- void saveThisArg();
- void initSavedBase();
- void initMemStackSize();
+ void insertProlog(Cfg&);
+ int64 getElemBaseOffset();
+ void printStackInfo();
+ void saveThisArg();
+ void initSavedBase();
+ void initMemStackSize();
+ RegOpndVector& getInArgs() { return inArgs; }
protected:
MemoryManager &mm;
CompilationInterface &compilationInterface;
- int32 maxOpndId; // used for creating new opnds
-
- RegOpnd *r0; // 0 (8 bytes unsigned)
- RegOpnd *f0; // 0.0
- RegOpnd *f1; // 1.0
- RegOpnd *p0; // true
- RegOpnd *b0; // return address
- RegOpnd *r12; // stack pointer
- RegOpnd *r8; // return value (general)
- RegOpnd *f8; // return value (floating point)
- RegOpnd *tau; // opnd ignored
+ uint16 maxOpndId; // used for creating new opnds
+ uint16 maxNodeId; // used for creating new nodes
+ RegOpndVector inArgs; // input args vector
+ BbNode *prologNode;
+
+ RegOpnd *r0; // 0 (8 bytes unsigned)
+ RegOpnd *f0; // 0.0
+ RegOpnd *f1; // 1.0
+ RegOpnd *p0; // true
+ RegOpnd *b0; // return address
+ RegOpnd *r12; // stack pointer
+ RegOpnd *r8; // return value (general)
+ RegOpnd *f8; // return value (floating point)
+ RegOpnd *tau; // opnd ignored
RegOpnd *heapBase; // Reg opnd containing base for references decompression
Opnd *heapBaseImm; // Imm opnd containing base for references decompression
Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/include/IpfRegisterAllocator.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/include/IpfRegisterAllocator.h?view=diff&rev=527470&r1=527469&r2=527470
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/include/IpfRegisterAllocator.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/include/IpfRegisterAllocator.h Wed Apr 11 05:28:45 2007
@@ -24,6 +24,7 @@
#define IPFREGISTERALLOCATOR_H_
#include "IpfCfg.h"
+#include "IpfLiveManager.h"
namespace Jitrino {
namespace IPF {
@@ -43,8 +44,8 @@
void assignLocations();
void assignLocation(RegOpnd*);
- void updateAllocSet(Opnd*, uint32);
- void checkCallSite(Inst*);
+ void updateAllocSet(Opnd*, uint32, QpMask);
+ void checkCallSite(Inst*, QpMask);
void checkCoalescing(uint32, Inst*);
void removeSameRegMoves();
@@ -52,8 +53,9 @@
MemoryManager &mm;
Cfg &cfg;
OpndManager *opndManager;
+ LiveManager liveManager;
RegOpndSet allocSet; // set of all opnds that need allocation
- RegOpndSet liveSet; // set of opnds alive in current node (buildInterferenceMatrix)
+ RegOpndSet &liveSet; // set of opnds alive in current node
};
} // IPF
Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/include/IpfRuntimeSupport.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/include/IpfRuntimeSupport.h?view=diff&rev=527470&r1=527469&r2=527470
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/include/IpfRuntimeSupport.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/include/IpfRuntimeSupport.h Wed Apr 11 05:28:45 2007
@@ -108,7 +108,8 @@
// Exception registration
void registerExceptionHandlers();
- void makeRegion(Byte* startAddr, Byte* endAddr, Node* dispatchNode);
+ void makeRegion(BbNode*, BbNode*, Node*);
+ void inserFakeLastNode(NodeVector&);
RegionVector tryRegions;
@@ -116,7 +117,7 @@
StackInfo *makeStackInfo();
// Build root set and extend bases live range
- void newSafePoint(BbNode*, Inst*, RegOpndSet&);
+ void newSafePoint(BbNode*, Inst*, RegOpndSet&, QpMask);
void defMptr(BbNode*, Inst*);
void mergeBase(BbNode*, Inst*, RegOpnd*, RegOpnd*);
void replaceBase(Inst*, Opnd*, Opnd*);
Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/include/IpfType.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/include/IpfType.h?view=diff&rev=527470&r1=527469&r2=527470
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/include/IpfType.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ipf/include/IpfType.h Wed Apr 11 05:28:45 2007
@@ -54,6 +54,7 @@
class BbNode;
class Edge;
class Cfg;
+class QpNode;
//========================================================================================//
// Defines
@@ -100,16 +101,18 @@
#define ROOT_SET_HEADER_SIZE 4 // header size in root set info block
#define SAFE_POINT_HEADER_SIZE 12 // header size in safe points info block
-#define LOG_ON 1 // Log for Code Generator is on
-#define VERIFY_ON 1 // verification for Code Generator is on
+#define MAX_QP_MASK 0xffffffffffffffff // max value of predicate mask used in LiveManager
+
+#define LOG_ON 0 // Log for Code Generator is on
+#define VERIFY_ON 0 // verification for Code Generator is on
#define LOG_OUT Log::out()
-#define STAT_ON 0 // Log for statistic
+#define STAT_ON 0 // Log for statistic
#define IPF_ERROR "ERROR in file " << __FILE__ << " line " << __LINE__ << " "
#define IPF_LOG if (LOG_ON) LOG_OUT
#define IPF_STAT if (STAT_ON) LOG_OUT
#define IPF_ERR cerr << IPF_ERROR
-#define IPF_ASSERT(condition) if (VERIFY_ON && !(condition)) { IPF_ERR << (#condition) << endl; }
+#define IPF_ASSERT(condition) if (LOG_ON && !(condition)) { IPF_ERR << (#condition) << endl; }
extern bool ipfLogIsOn;
extern bool ipfVerifyIsOn;
@@ -191,22 +194,22 @@
// Typedefs
//========================================================================================//
-typedef StlVector< Opnd* > OpndVector;
-typedef StlVector< RegOpnd* > RegOpndVector;
-typedef StlVector< Inst* > InstVector;
-typedef StlVector< Node* > NodeVector;
-typedef StlVector< Edge* > EdgeVector;
-typedef StlVector< uint32 > Uint32Vector;
-typedef StlList< Inst* > InstList;
-typedef StlList< Node* > NodeList;
-typedef StlList< Edge* > EdgeList;
-typedef StlSet< Opnd* > OpndSet;
-typedef StlSet< RegOpnd* > RegOpndSet;
-typedef StlSet< Node* > NodeSet;
-typedef StlMap< RegOpnd*, RegOpnd* > RegOpnd2RegOpndMap;
-typedef StlMap< Inst*, RegOpndSet > Inst2RegOpndSetMap;
-typedef StlMap< uint64, RegOpndSet > Uint642RegOpndSetMap;
-typedef bitset< NUM_G_REG > RegBitSet;
+typedef StlVector< Opnd* > OpndVector;
+typedef StlVector< RegOpnd* > RegOpndVector;
+typedef StlVector< Inst* > InstVector;
+typedef StlVector< Node* > NodeVector;
+typedef StlVector< Edge* > EdgeVector;
+typedef StlVector< uint32 > Uint32Vector;
+typedef StlList< Inst* > InstList;
+typedef StlList< Node* > NodeList;
+typedef StlList< Edge* > EdgeList;
+typedef StlSet< Opnd* > OpndSet;
+typedef StlSet< RegOpnd* > RegOpndSet;
+typedef StlSet< Node* > NodeSet;
+typedef StlMap< RegOpnd*, RegOpnd* > RegOpnd2RegOpndMap;
+typedef StlMap< Inst*, RegOpndSet > Inst2RegOpndSetMap;
+typedef StlMap< uint64, RegOpndSet > Uint642RegOpndSetMap;
+typedef bitset< NUM_G_REG > RegBitSet;
typedef StlMultiMap <uint32, RegOpnd*, greater <uint32> > Int2OpndMap;
typedef NodeVector::iterator NodeIterator;
@@ -223,11 +226,14 @@
typedef Uint642RegOpndSetMap::iterator Uint642RegOpndSetMapIterator;
typedef NodeList Chain;
-typedef StlList< Chain* > ChainList;
+typedef StlList< Chain* > ChainList;
typedef StlMultiMap< uint32, Chain*, greater < uint32 > > ChainMap;
typedef Chain::iterator ChainIterator;
typedef ChainList::iterator ChainListIterator;
typedef ChainMap::iterator ChainMapIterator;
+
+typedef StlMultiMap <Opnd*, QpNode*> QpMap;
+typedef uint64 QpMask;
//========================================================================================//
// IpfType