From b40eddfc96b9ac235dea562e55ce2ad7b1cfb7c9 Mon Sep 17 00:00:00 2001 From: Dragos Sbirlea Date: Wed, 31 Jul 2013 13:37:31 -0700 Subject: Added SEA IR type infrastructure (and a bit of cleanup). compiler/Android.mk: Added new files to compile. instruction_nodes.h, code_gen.cc: Renamed GetSSAUses to GetSSAProducers to avoid confusion (uses of what?). sea.cc: Added invoke of type inference framework. sea.h: Expose dex_file through GetDexFile(). Added GetPositionInSIgnature() for SignatureNodes. sea.cc: Cleanup of debug output. visitor.h: Removed dependence on LLVM (now only in code_gen.*). Corrected minor typo in comment. frontend.cc: Renamed access_flags for clarity. Change-Id: I211d2e9ff1e0c4f910de73a52a5ac2c50e4ca7df --- compiler/sea_ir/code_gen.cc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'compiler/sea_ir/code_gen.cc') diff --git a/compiler/sea_ir/code_gen.cc b/compiler/sea_ir/code_gen.cc index a513907b38..0ef21b4800 100644 --- a/compiler/sea_ir/code_gen.cc +++ b/compiler/sea_ir/code_gen.cc @@ -123,14 +123,14 @@ void CodeGenVisitor::Visit(ConstInstructionNode* instruction) { void CodeGenVisitor::Visit(ReturnInstructionNode* instruction) { std::string instr = instruction->GetInstruction()->DumpString(NULL); std::cout << "2.Instruction: " << instr << std::endl; - DCHECK_GT(instruction->GetSSAUses().size(), 0u); - llvm::Value* return_value = llvm_data_->GetValue(instruction->GetSSAUses().at(0)); + DCHECK_GT(instruction->GetSSAProducers().size(), 0u); + llvm::Value* return_value = llvm_data_->GetValue(instruction->GetSSAProducers().at(0)); llvm_data_->builder_.CreateRet(return_value); } void CodeGenVisitor::Visit(IfNeInstructionNode* instruction) { std::string instr = instruction->GetInstruction()->DumpString(NULL); std::cout << "3.Instruction: " << instr << std::endl; - std::vector ssa_uses = instruction->GetSSAUses(); + std::vector ssa_uses = instruction->GetSSAProducers(); DCHECK_GT(ssa_uses.size(), 1u); InstructionNode* use_l = ssa_uses.at(0); llvm::Value* left = llvm_data_->GetValue(use_l); @@ -171,7 +171,7 @@ void CodeGenVisitor::Visit(MoveResultInstructionNode* instruction) { // since their purpose of minimizing the number of opcodes in dex is // not relevant for the IR. (Will need to have different // instruction subclasses for functions and procedures.) - std::vector ssa_uses = instruction->GetSSAUses(); + std::vector ssa_uses = instruction->GetSSAProducers(); InstructionNode* use_l = ssa_uses.at(0); llvm::Value* left = llvm_data_->GetValue(use_l); llvm::Value* right = llvm::ConstantInt::get(*llvm_data_->context_, llvm::APInt(32, 0)); @@ -187,7 +187,7 @@ void CodeGenVisitor::Visit(InvokeStaticInstructionNode* invoke) { // TODO: Add proper checking of the matching between formal and actual signature. DCHECK(NULL != callee); std::vector parameter_values; - std::vector parameter_sources = invoke->GetSSAUses(); + std::vector parameter_sources = invoke->GetSSAProducers(); for (std::vector::const_iterator cit = parameter_sources.begin(); cit != parameter_sources.end(); ++cit) { llvm::Value* parameter_value = llvm_data_->GetValue((*cit)); @@ -201,7 +201,7 @@ void CodeGenVisitor::Visit(InvokeStaticInstructionNode* invoke) { void CodeGenVisitor::Visit(AddIntInstructionNode* instruction) { std::string instr = instruction->GetInstruction()->DumpString(NULL); std::cout << "7.Instruction: " << instr << std::endl; - std::vector ssa_uses = instruction->GetSSAUses(); + std::vector ssa_uses = instruction->GetSSAProducers(); DCHECK_GT(ssa_uses.size(), 1u); InstructionNode* use_l = ssa_uses.at(0); InstructionNode* use_r = ssa_uses.at(1); @@ -221,7 +221,7 @@ void CodeGenVisitor::Visit(GotoInstructionNode* instruction) { void CodeGenVisitor::Visit(IfEqzInstructionNode* instruction) { std::string instr = instruction->GetInstruction()->DumpString(NULL); std::cout << "9. Instruction: " << instr << "; Id: " < ssa_uses = instruction->GetSSAUses(); + std::vector ssa_uses = instruction->GetSSAProducers(); DCHECK_GT(ssa_uses.size(), 0u); InstructionNode* use_l = ssa_uses.at(0); llvm::Value* left = llvm_data_->GetValue(use_l); -- cgit v1.2.3-59-g8ed1b