From c2a2396e17f8fd6c78afd81368d2b80e8cfe6c42 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Tue, 11 Sep 2001 23:22:43 +0000 Subject: [PATCH] Eliminate MainTreeNode function git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@550 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/CodeGen/InstrForest.h | 29 ++++--------------- lib/CodeGen/InstrSelection/InstrSelection.cpp | 4 +-- lib/CodeGen/MachineInstr.cpp | 3 +- .../SparcV9/InstrSelection/InstrSelection.cpp | 4 +-- 4 files changed, 12 insertions(+), 28 deletions(-) diff --git a/include/llvm/CodeGen/InstrForest.h b/include/llvm/CodeGen/InstrForest.h index bbfd65d417e..382a72ee11d 100644 --- a/include/llvm/CodeGen/InstrForest.h +++ b/include/llvm/CodeGen/InstrForest.h @@ -24,18 +24,11 @@ #ifndef LLVM_CODEGEN_INSTRFOREST_H #define LLVM_CODEGEN_INSTRFOREST_H -//************************** System Include Files **************************/ - -#include -#include - -//*************************** User Include Files ***************************/ - #include "llvm/Support/NonCopyable.h" #include "llvm/Support/HashExtras.h" #include "llvm/Instruction.h" - -//************************* Opaque Declarations ****************************/ +#include +#include class ConstPoolVal; class BasicBlock; @@ -43,8 +36,6 @@ class Method; class InstrTreeNode; class InstrForest; -/******************** Exported Data Types and Constants ********************/ - //-------------------------------------------------------------------------- // OpLabel values for special-case nodes created for instruction selection. // All op-labels not defined here are identical to the instruction @@ -110,7 +101,7 @@ extern StateLabel burm_state (OpLabel op, StateLabel leftState, extern StateLabel burm_rule (StateLabel state, int goalNT); -extern BasicTreeNode** burm_kids (BasicTreeNode* p, int eruleno, +extern BasicTreeNode** burm_kids (BasicTreeNode* p, int eruleno, BasicTreeNode* kids[]); extern void printcover (BasicTreeNode*, int, int); @@ -119,8 +110,6 @@ extern int treecost (BasicTreeNode*, int, int); extern void printMatches (BasicTreeNode*); -//*********************** Public Class Declarations ************************/ - //------------------------------------------------------------------------ // class InstrTreeNode // @@ -128,12 +117,6 @@ extern void printMatches (BasicTreeNode*); // instruction selection via BURG. //------------------------------------------------------------------------ -inline InstrTreeNode* -MainTreeNode(BasicTreeNode* node) { - return node->treeNodePtr; -} - - class InstrTreeNode : public NonCopyableV { public: enum InstrTreeNodeType { NTInstructionNode, @@ -168,9 +151,9 @@ public: inline InstrTreeNode* rightChild () const { return (InstrTreeNode*) (basicNode.rightChild - ? (MainTreeNode(basicNode.rightChild)->getOpLabel() == VRegListOp - ? MainTreeNode(basicNode.rightChild)->leftChild() - : MainTreeNode(basicNode.rightChild)) + ? (basicNode.rightChild->treeNodePtr->getOpLabel() == VRegListOp + ? basicNode.rightChild->treeNodePtr->leftChild() + : basicNode.rightChild->treeNodePtr) : NULL); } diff --git a/lib/CodeGen/InstrSelection/InstrSelection.cpp b/lib/CodeGen/InstrSelection/InstrSelection.cpp index dbb0f8672a6..e6884ab572a 100644 --- a/lib/CodeGen/InstrSelection/InstrSelection.cpp +++ b/lib/CodeGen/InstrSelection/InstrSelection.cpp @@ -220,7 +220,7 @@ SelectInstructionsForTree(BasicTreeNode* treeRoot, // if (treeRoot->opLabel != VRegListOp) { - InstructionNode* instrNode = (InstructionNode*) MainTreeNode(treeRoot); + InstructionNode* instrNode = (InstructionNode*)treeRoot->treeNodePtr; assert(instrNode->getNodeType() == InstrTreeNode::NTInstructionNode); unsigned N = GetInstructionsByRule(instrNode, ruleForNode, nts, Target, @@ -259,7 +259,7 @@ SelectInstructionsForTree(BasicTreeNode* treeRoot, { assert(i < 2); InstrTreeNode::InstrTreeNodeType - nodeType = MainTreeNode(kids[i])->getNodeType(); + nodeType = kids[i]->treeNodePtr->getNodeType(); if (nodeType == InstrTreeNode::NTVRegListNode || nodeType == InstrTreeNode::NTInstructionNode) { diff --git a/lib/CodeGen/MachineInstr.cpp b/lib/CodeGen/MachineInstr.cpp index 63acea14b41..e5b768eca99 100644 --- a/lib/CodeGen/MachineInstr.cpp +++ b/lib/CodeGen/MachineInstr.cpp @@ -153,7 +153,8 @@ ostream &operator<<(ostream &os, const MachineOperand &mop) { // // For the common case of 2- and 3-operand arithmetic/logical instructions, // set the m/c instr. operands directly from the VM instruction's operands. -// Check whether the first or second operand is 0 and can use a dedicated "0" register. +// Check whether the first or second operand is 0 and can use a dedicated "0" +// register. // Check whether the second operand should use an immediate field or register. // (First and third operands are never immediates for such instructions.) // diff --git a/lib/Target/SparcV9/InstrSelection/InstrSelection.cpp b/lib/Target/SparcV9/InstrSelection/InstrSelection.cpp index dbb0f8672a6..e6884ab572a 100644 --- a/lib/Target/SparcV9/InstrSelection/InstrSelection.cpp +++ b/lib/Target/SparcV9/InstrSelection/InstrSelection.cpp @@ -220,7 +220,7 @@ SelectInstructionsForTree(BasicTreeNode* treeRoot, // if (treeRoot->opLabel != VRegListOp) { - InstructionNode* instrNode = (InstructionNode*) MainTreeNode(treeRoot); + InstructionNode* instrNode = (InstructionNode*)treeRoot->treeNodePtr; assert(instrNode->getNodeType() == InstrTreeNode::NTInstructionNode); unsigned N = GetInstructionsByRule(instrNode, ruleForNode, nts, Target, @@ -259,7 +259,7 @@ SelectInstructionsForTree(BasicTreeNode* treeRoot, { assert(i < 2); InstrTreeNode::InstrTreeNodeType - nodeType = MainTreeNode(kids[i])->getNodeType(); + nodeType = kids[i]->treeNodePtr->getNodeType(); if (nodeType == InstrTreeNode::NTVRegListNode || nodeType == InstrTreeNode::NTInstructionNode) { -- 2.34.1