1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 03:23:01 +02:00

Remove the DisasmEnabled AsmPrinter variable and just look it

up on the subtarget where it's set anyhow than looking it up
2-3 times in the same place.

llvm-svn: 229802
This commit is contained in:
Eric Christopher 2015-02-19 01:10:49 +00:00
parent ce7b5daef7
commit 414a86c35b
3 changed files with 3 additions and 6 deletions

View File

@ -86,9 +86,7 @@ extern "C" void LLVMInitializeR600AsmPrinter() {
AMDGPUAsmPrinter::AMDGPUAsmPrinter(TargetMachine &TM, AMDGPUAsmPrinter::AMDGPUAsmPrinter(TargetMachine &TM,
std::unique_ptr<MCStreamer> Streamer) std::unique_ptr<MCStreamer> Streamer)
: AsmPrinter(TM, std::move(Streamer)) { : AsmPrinter(TM, std::move(Streamer)) {}
DisasmEnabled = TM.getSubtarget<AMDGPUSubtarget>().dumpCode();
}
void AMDGPUAsmPrinter::EmitEndOfAsmFile(Module &M) { void AMDGPUAsmPrinter::EmitEndOfAsmFile(Module &M) {
@ -160,7 +158,7 @@ bool AMDGPUAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
} }
} }
if (STM.dumpCode() && DisasmEnabled) { if (STM.dumpCode()) {
OutStreamer.SwitchSection( OutStreamer.SwitchSection(
Context.getELFSection(".AMDGPU.disasm", ELF::SHT_NOTE, 0)); Context.getELFSection(".AMDGPU.disasm", ELF::SHT_NOTE, 0));

View File

@ -100,7 +100,6 @@ public:
void EmitEndOfAsmFile(Module &M) override; void EmitEndOfAsmFile(Module &M) override;
protected: protected:
bool DisasmEnabled;
std::vector<std::string> DisasmLines, HexLines; std::vector<std::string> DisasmLines, HexLines;
size_t DisasmLineMaxLen; size_t DisasmLineMaxLen;
}; };

View File

@ -116,7 +116,7 @@ void AMDGPUAsmPrinter::EmitInstruction(const MachineInstr *MI) {
MCInstLowering.lower(MI, TmpInst); MCInstLowering.lower(MI, TmpInst);
EmitToStreamer(OutStreamer, TmpInst); EmitToStreamer(OutStreamer, TmpInst);
if (DisasmEnabled) { if (MF->getSubtarget<AMDGPUSubtarget>().dumpCode()) {
// Disassemble instruction/operands to text. // Disassemble instruction/operands to text.
DisasmLines.resize(DisasmLines.size() + 1); DisasmLines.resize(DisasmLines.size() + 1);
std::string &DisasmLine = DisasmLines.back(); std::string &DisasmLine = DisasmLines.back();