diff options
| author | Vladimir Marko <vmarko@google.com> | 2017-11-01 14:35:42 +0000 |
|---|---|---|
| committer | Vladimir Marko <vmarko@google.com> | 2017-11-02 10:11:02 +0000 |
| commit | 33bff25bcd7a02d35c54f63740eadb1a4833fc92 (patch) | |
| tree | 553db4f60878acf2a0fa7036a739d406df9a29b7 /compiler/debug | |
| parent | 321b3ca9a36d769283c64d4bdee0798db80af524 (diff) | |
| download | art-33bff25bcd7a02d35c54f63740eadb1a4833fc92.tar.gz art-33bff25bcd7a02d35c54f63740eadb1a4833fc92.tar.bz2 art-33bff25bcd7a02d35c54f63740eadb1a4833fc92.zip | |
ART: Make InstructionSet an enum class and add kLast.
Adding InstructionSet::kLast shall make it easier to encode
the InstructionSet in fewer bits using BitField<>. However,
introducing `kLast` into the `art` namespace is not a good
idea, so we change the InstructionSet to an enum class.
This also uncovered a case of InstructionSet::kNone being
erroneously used instead of vixl32::Condition::None(), so
it's good to remove `kNone` from the `art` namespace.
Test: m test-art-host-gtest
Test: testrunner.py --host --optimizing
Change-Id: I6fa6168dfba4ed6da86d021a69c80224f09997a6
Diffstat (limited to 'compiler/debug')
| -rw-r--r-- | compiler/debug/dwarf/dwarf_test.h | 3 | ||||
| -rw-r--r-- | compiler/debug/elf_debug_frame_writer.h | 16 | ||||
| -rw-r--r-- | compiler/debug/elf_debug_line_writer.h | 16 | ||||
| -rw-r--r-- | compiler/debug/elf_debug_loc_writer.h | 34 | ||||
| -rw-r--r-- | compiler/debug/elf_symtab_writer.h | 2 |
5 files changed, 36 insertions, 35 deletions
diff --git a/compiler/debug/dwarf/dwarf_test.h b/compiler/debug/dwarf/dwarf_test.h index b30ff143d3..5405759c1f 100644 --- a/compiler/debug/dwarf/dwarf_test.h +++ b/compiler/debug/dwarf/dwarf_test.h @@ -60,7 +60,8 @@ class DwarfTest : public CommonRuntimeTest { template<typename ElfTypes> std::vector<std::string> Objdump(const char* args) { // Write simple elf file with just the DWARF sections. - InstructionSet isa = (sizeof(typename ElfTypes::Addr) == 8) ? kX86_64 : kX86; + InstructionSet isa = + (sizeof(typename ElfTypes::Addr) == 8) ? InstructionSet::kX86_64 : InstructionSet::kX86; ScratchFile file; linker::FileOutputStream output_stream(file.GetFile()); linker::ElfBuilder<ElfTypes> builder(isa, nullptr, &output_stream); diff --git a/compiler/debug/elf_debug_frame_writer.h b/compiler/debug/elf_debug_frame_writer.h index 6dacdfa48c..d0c98a7b79 100644 --- a/compiler/debug/elf_debug_frame_writer.h +++ b/compiler/debug/elf_debug_frame_writer.h @@ -37,8 +37,8 @@ static void WriteCIE(InstructionSet isa, // debugger that its value in the previous frame is not recoverable. bool is64bit = Is64BitInstructionSet(isa); switch (isa) { - case kArm: - case kThumb2: { + case InstructionSet::kArm: + case InstructionSet::kThumb2: { dwarf::DebugFrameOpCodeWriter<> opcodes; opcodes.DefCFA(Reg::ArmCore(13), 0); // R13(SP). // core registers. @@ -61,7 +61,7 @@ static void WriteCIE(InstructionSet isa, WriteCIE(is64bit, return_reg, opcodes, format, buffer); return; } - case kArm64: { + case InstructionSet::kArm64: { dwarf::DebugFrameOpCodeWriter<> opcodes; opcodes.DefCFA(Reg::Arm64Core(31), 0); // R31(SP). // core registers. @@ -84,8 +84,8 @@ static void WriteCIE(InstructionSet isa, WriteCIE(is64bit, return_reg, opcodes, format, buffer); return; } - case kMips: - case kMips64: { + case InstructionSet::kMips: + case InstructionSet::kMips64: { dwarf::DebugFrameOpCodeWriter<> opcodes; opcodes.DefCFA(Reg::MipsCore(29), 0); // R29(SP). // core registers. @@ -108,7 +108,7 @@ static void WriteCIE(InstructionSet isa, WriteCIE(is64bit, return_reg, opcodes, format, buffer); return; } - case kX86: { + case InstructionSet::kX86: { // FIXME: Add fp registers once libunwind adds support for them. Bug: 20491296 constexpr bool generate_opcodes_for_x86_fp = false; dwarf::DebugFrameOpCodeWriter<> opcodes; @@ -134,7 +134,7 @@ static void WriteCIE(InstructionSet isa, WriteCIE(is64bit, return_reg, opcodes, format, buffer); return; } - case kX86_64: { + case InstructionSet::kX86_64: { dwarf::DebugFrameOpCodeWriter<> opcodes; opcodes.DefCFA(Reg::X86_64Core(4), 8); // R4(RSP). opcodes.Offset(Reg::X86_64Core(16), -8); // R16(RIP). @@ -160,7 +160,7 @@ static void WriteCIE(InstructionSet isa, WriteCIE(is64bit, return_reg, opcodes, format, buffer); return; } - case kNone: + case InstructionSet::kNone: break; } LOG(FATAL) << "Cannot write CIE frame for ISA " << isa; diff --git a/compiler/debug/elf_debug_line_writer.h b/compiler/debug/elf_debug_line_writer.h index 49d52c45c2..6e72b46174 100644 --- a/compiler/debug/elf_debug_line_writer.h +++ b/compiler/debug/elf_debug_line_writer.h @@ -68,19 +68,19 @@ class ElfDebugLineWriter { int code_factor_bits_ = 0; int dwarf_isa = -1; switch (isa) { - case kArm: // arm actually means thumb2. - case kThumb2: + case InstructionSet::kArm: // arm actually means thumb2. + case InstructionSet::kThumb2: code_factor_bits_ = 1; // 16-bit instuctions dwarf_isa = 1; // DW_ISA_ARM_thumb. break; - case kArm64: - case kMips: - case kMips64: + case InstructionSet::kArm64: + case InstructionSet::kMips: + case InstructionSet::kMips64: code_factor_bits_ = 2; // 32-bit instructions break; - case kNone: - case kX86: - case kX86_64: + case InstructionSet::kNone: + case InstructionSet::kX86: + case InstructionSet::kX86_64: break; } std::unordered_set<uint64_t> seen_addresses(compilation_unit.methods.size()); diff --git a/compiler/debug/elf_debug_loc_writer.h b/compiler/debug/elf_debug_loc_writer.h index bf47e8f3d9..bb856b29f4 100644 --- a/compiler/debug/elf_debug_loc_writer.h +++ b/compiler/debug/elf_debug_loc_writer.h @@ -33,20 +33,20 @@ using Reg = dwarf::Reg; static Reg GetDwarfCoreReg(InstructionSet isa, int machine_reg) { switch (isa) { - case kArm: - case kThumb2: + case InstructionSet::kArm: + case InstructionSet::kThumb2: return Reg::ArmCore(machine_reg); - case kArm64: + case InstructionSet::kArm64: return Reg::Arm64Core(machine_reg); - case kX86: + case InstructionSet::kX86: return Reg::X86Core(machine_reg); - case kX86_64: + case InstructionSet::kX86_64: return Reg::X86_64Core(machine_reg); - case kMips: + case InstructionSet::kMips: return Reg::MipsCore(machine_reg); - case kMips64: + case InstructionSet::kMips64: return Reg::Mips64Core(machine_reg); - case kNone: + case InstructionSet::kNone: LOG(FATAL) << "No instruction set"; } UNREACHABLE(); @@ -54,20 +54,20 @@ static Reg GetDwarfCoreReg(InstructionSet isa, int machine_reg) { static Reg GetDwarfFpReg(InstructionSet isa, int machine_reg) { switch (isa) { - case kArm: - case kThumb2: + case InstructionSet::kArm: + case InstructionSet::kThumb2: return Reg::ArmFp(machine_reg); - case kArm64: + case InstructionSet::kArm64: return Reg::Arm64Fp(machine_reg); - case kX86: + case InstructionSet::kX86: return Reg::X86Fp(machine_reg); - case kX86_64: + case InstructionSet::kX86_64: return Reg::X86_64Fp(machine_reg); - case kMips: + case InstructionSet::kMips: return Reg::MipsFp(machine_reg); - case kMips64: + case InstructionSet::kMips64: return Reg::Mips64Fp(machine_reg); - case kNone: + case InstructionSet::kNone: LOG(FATAL) << "No instruction set"; } UNREACHABLE(); @@ -230,7 +230,7 @@ static void WriteDebugLocEntry(const MethodDebugInfo* method_info, break; // the high word is correctly implied by the low word. } } else if (kind == Kind::kInFpuRegister) { - if ((isa == kArm || isa == kThumb2) && + if ((isa == InstructionSet::kArm || isa == InstructionSet::kThumb2) && piece == 0 && reg_hi.GetKind() == Kind::kInFpuRegister && reg_hi.GetValue() == value + 1 && value % 2 == 0) { // Translate S register pair to D register (e.g. S4+S5 to D2). diff --git a/compiler/debug/elf_symtab_writer.h b/compiler/debug/elf_symtab_writer.h index b37f984860..0907e102a0 100644 --- a/compiler/debug/elf_symtab_writer.h +++ b/compiler/debug/elf_symtab_writer.h @@ -89,7 +89,7 @@ static void WriteDebugSymbols(linker::ElfBuilder<ElfTypes>* builder, // instructions, so that disassembler tools can correctly disassemble. // Note that even if we generate just a single mapping symbol, ARM's Streamline // requires it to match function symbol. Just address 0 does not work. - if (info.isa == kThumb2) { + if (info.isa == InstructionSet::kThumb2) { if (address < mapping_symbol_address || !kGenerateSingleArmMappingSymbol) { symtab->Add(strtab->Write("$t"), text, address & ~1, 0, STB_LOCAL, STT_NOTYPE); mapping_symbol_address = address; |
