[Mips] TargetStreamer ELF flag Support for default and commandline options.

This patch uses a common MipsTargetSteamer interface for both 
MipsAsmPrinter and MipsAsmParser for recording default and commandline
driven directives that affect ELF header flags.

It has been noted that the .ll tests affected by this patch belong in
test/Codegen/Mips. I will move them in a separate patch.

Also, a number of directives do not get expressed by AsmPrinter in the 
resultant .s assembly such as setting the correct ASI. I have noted this
in the tests and they will be addressed in later patches.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200051 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Jack Carter
2014-01-25 00:24:07 +00:00
parent f1f5a434ad
commit 998052555a
8 changed files with 162 additions and 76 deletions

View File

@@ -21,23 +21,13 @@
using namespace llvm;
static cl::opt<bool> PrintHackDirectives("print-hack-directives",
cl::init(false), cl::Hidden);
// Pin vtable to this file.
void MipsTargetStreamer::anchor() {}
MipsTargetAsmStreamer::MipsTargetAsmStreamer(formatted_raw_ostream &OS)
: OS(OS) {}
void MipsTargetAsmStreamer::emitMipsHackELFFlags(unsigned Flags) {
if (!PrintHackDirectives)
return;
OS << "\t.mips_hack_elf_flags 0x";
OS.write_hex(Flags);
OS << '\n';
}
void MipsTargetAsmStreamer::emitMipsELFFlags(unsigned Flags) { return; }
void MipsTargetAsmStreamer::emitDirectiveSetMicroMips() {
OS << "\t.set\tmicromips\n";
@@ -85,7 +75,7 @@ MCELFStreamer &MipsTargetELFStreamer::getStreamer() {
return static_cast<MCELFStreamer &>(*Streamer);
}
void MipsTargetELFStreamer::emitMipsHackELFFlags(unsigned Flags) {
void MipsTargetELFStreamer::emitMipsELFFlags(unsigned Flags) {
MCAssembler &MCA = getStreamer().getAssembler();
MCA.setELFHeaderEFlags(Flags);
}