summaryrefslogtreecommitdiffstats
path: root/compiler/sea_ir
diff options
context:
space:
mode:
authorDragos Sbirlea <dragoss@google.com>2013-07-23 16:29:09 -0700
committerDragos Sbirlea <dragoss@google.com>2013-07-23 16:32:28 -0700
commitdb06306be76bcea3aabab2cecfb16ae2af542801 (patch)
treefc83c823a67a5e259dc19d81f9cba6b147124cf0 /compiler/sea_ir
parent81f79a6672a0bd610f05770d8c96e03e276798da (diff)
downloadart-db06306be76bcea3aabab2cecfb16ae2af542801.zip
art-db06306be76bcea3aabab2cecfb16ae2af542801.tar.gz
art-db06306be76bcea3aabab2cecfb16ae2af542801.tar.bz2
Continued refactoring of strings & headers.
Change-Id: I420ffc5d861af3dcea65942ce8823be834fdcdec
Diffstat (limited to 'compiler/sea_ir')
-rw-r--r--compiler/sea_ir/code_gen.cc2
-rw-r--r--compiler/sea_ir/sea.cc8
-rw-r--r--compiler/sea_ir/sea.h22
-rw-r--r--compiler/sea_ir/sea_node.h6
4 files changed, 13 insertions, 25 deletions
diff --git a/compiler/sea_ir/code_gen.cc b/compiler/sea_ir/code_gen.cc
index 4e15cf6..41bf9a6 100644
--- a/compiler/sea_ir/code_gen.cc
+++ b/compiler/sea_ir/code_gen.cc
@@ -79,7 +79,7 @@ void CodeGenPrepassVisitor::Visit(SeaGraph* graph) {
param_id != llvm_data_->function_->arg_size(); ++arg_it, ++param_id) {
DCHECK(parameters->size() > param_id) << "Insufficient parameters for function signature";
// Build parameter register name for LLVM IR clarity.
- std::string arg_name = art::StringPrintf("r%d", parameters->at(param_id));
+ std::string arg_name = art::StringPrintf("r%d", parameters->at(param_id)->GetResultRegister());
arg_it->setName(arg_name);
SignatureNode* parameter = parameters->at(param_id);
llvm_data_->AddValue(parameter, arg_it);
diff --git a/compiler/sea_ir/sea.cc b/compiler/sea_ir/sea.cc
index ae0cb17..d1db7b6 100644
--- a/compiler/sea_ir/sea.cc
+++ b/compiler/sea_ir/sea.cc
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#include "runtime/base/stringprintf.h"
+#include "base/stringprintf.h"
#include "file_output_stream.h"
#include "instruction_tools.h"
#include "sea.h"
@@ -492,7 +492,7 @@ SeaNode* Region::GetLastChild() const {
void Region::ToDot(std::string& result) const {
result += "\n// Region: \n" + StringId() + " [label=\"region " + StringId() + "(rpo=";
- result += art::StringPrintf("%", rpo_number_);
+ result += art::StringPrintf("%d", rpo_number_);
if (NULL != GetIDominator()) {
result += " dom=" + GetIDominator()->StringId();
}
@@ -710,7 +710,7 @@ void InstructionNode::ToDot(std::string& result) const {
def_it != definition_edges_.end(); def_it++) {
if (NULL != def_it->second) {
result += def_it->second->StringId() + " -> " + StringId() +"[color=red,label=\"";
- result.append(art::StringPrintf("%", def_it->first));
+ result += art::StringPrintf("%d", def_it->first);
result += "\"] ; // ssa edge\n";
}
}
@@ -769,7 +769,7 @@ void PhiInstructionNode::ToDot(std::string& result) const {
for (std::vector<InstructionNode* >::const_iterator def_it = defs_from_pred->begin();
def_it != defs_from_pred->end(); def_it++) {
result += (*def_it)->StringId() + " -> " + StringId() +"[color=red,label=\"vR = ";
- result += StringPrintf("%d", GetRegisterNumber());
+ result += art::StringPrintf("%d", GetRegisterNumber());
result += "\"] ; // phi-ssa edge\n";
}
}
diff --git a/compiler/sea_ir/sea.h b/compiler/sea_ir/sea.h
index 28d0c17..a0a8086 100644
--- a/compiler/sea_ir/sea.h
+++ b/compiler/sea_ir/sea.h
@@ -46,29 +46,17 @@ class SignatureNode;
// can return from the GetSSAUses() calls, instead of having missing SSA edges.
class SignatureNode: public InstructionNode {
public:
- explicit SignatureNode(unsigned int parameter_register):
- InstructionNode(NULL), defined_regs_() {
- defined_regs_.push_back(parameter_register);
- }
+ explicit SignatureNode(unsigned int parameter_register):InstructionNode(NULL),
+ parameter_register_(parameter_register) { }
void ToDot(std::string& result) const {
result += StringId() +" [label=\"signature:";
- std::stringstream vector_printer;
- if (!defined_regs_.empty()) {
- for (unsigned int crt_el = 0; crt_el < defined_regs_.size()-1; crt_el++) {
- vector_printer << defined_regs_[crt_el] <<",";
- }
- vector_printer << defined_regs_[defined_regs_.size()-1] <<";";
- }
+ result += art::StringPrintf("r%d", GetResultRegister());
result += "\"] // signature node\n";
}
- std::vector<int> GetDefinitions() const {
- return defined_regs_;
- }
-
int GetResultRegister() const {
- return NO_REGISTER;
+ return parameter_register_;
}
std::vector<int> GetUses() {
@@ -81,7 +69,7 @@ class SignatureNode: public InstructionNode {
}
private:
- std::vector<int> defined_regs_;
+ unsigned int parameter_register_;
};
class PhiInstructionNode: public InstructionNode {
diff --git a/compiler/sea_ir/sea_node.h b/compiler/sea_ir/sea_node.h
index 88ebe23..efc1b0d 100644
--- a/compiler/sea_ir/sea_node.h
+++ b/compiler/sea_ir/sea_node.h
@@ -17,7 +17,7 @@
#ifndef ART_COMPILER_SEA_IR_SEA_NODE_H_
#define ART_COMPILER_SEA_IR_SEA_NODE_H_
-#include "runtime/base/stringprintf.h"
+#include "base/stringprintf.h"
namespace sea_ir {
class Region;
@@ -40,7 +40,7 @@ class IVisitable {
class SeaNode: public IVisitable {
public:
explicit SeaNode():id_(GetNewId()), string_id_() {
- string_id_ = art::StringPrintf("%", id_);
+ string_id_ = art::StringPrintf("%d", id_);
}
// Adds CFG predecessors and successors to each block.
void AddSuccessor(Region* successor);
@@ -71,10 +71,10 @@ class SeaNode: public IVisitable {
std::string string_id_;
private:
+ static int current_max_node_id_;
// Creating new instances of sea node objects should not be done through copy or assignment
// operators because that would lead to duplication of their unique ids.
DISALLOW_COPY_AND_ASSIGN(SeaNode);
- static int current_max_node_id_;
};
} // end namespace sea_ir
#endif // ART_COMPILER_SEA_IR_SEA_NODE_H_