X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FTarget%2FARM%2FAsmPrinter%2FARMAsmPrinter.cpp;h=a64c5453385878320f861a8e0bbae103962160a3;hb=e53a600f065075731d0aeb9dc8f4f3d75f5a05f8;hp=3c1f6cb00a0b14bfa5b64ca63d6a228f481d3d3b;hpb=93b67e40de356569493c285b86b138a3f11b5035;p=oota-llvm.git diff --git a/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp b/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp index 3c1f6cb00a0..a64c5453385 100644 --- a/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp +++ b/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp @@ -21,7 +21,7 @@ #include "ARMMachineFunctionInfo.h" #include "llvm/Constants.h" #include "llvm/Module.h" -#include "llvm/MDNode.h" +#include "llvm/Metadata.h" #include "llvm/CodeGen/AsmPrinter.h" #include "llvm/CodeGen/DwarfWriter.h" #include "llvm/CodeGen/MachineModuleInfo.h" @@ -29,6 +29,7 @@ #include "llvm/CodeGen/MachineJumpTableInfo.h" #include "llvm/Target/TargetAsmInfo.h" #include "llvm/Target/TargetData.h" +#include "llvm/Target/TargetLoweringObjectFile.h" #include "llvm/Target/TargetMachine.h" #include "llvm/Target/TargetOptions.h" #include "llvm/Target/TargetRegistry.h" @@ -161,6 +162,7 @@ namespace { const char *Modifier); void printJTBlockOperand(const MachineInstr *MI, int OpNum); void printJT2BlockOperand(const MachineInstr *MI, int OpNum); + void printTBAddrMode(const MachineInstr *MI, int OpNum); virtual bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNum, unsigned AsmVariant, const char *ExtraCode); @@ -963,15 +965,39 @@ void ARMAsmPrinter::printJT2BlockOperand(const MachineInstr *MI, int OpNum) { const MachineJumpTableInfo *MJTI = MF->getJumpTableInfo(); const std::vector &JT = MJTI->getJumpTables(); const std::vector &JTBBs = JT[JTI].MBBs; + bool ByteOffset = false, HalfWordOffset = false; + if (MI->getOpcode() == ARM::t2TBB) + ByteOffset = true; + else if (MI->getOpcode() == ARM::t2TBH) + HalfWordOffset = true; + for (unsigned i = 0, e = JTBBs.size(); i != e; ++i) { MachineBasicBlock *MBB = JTBBs[i]; - O << "\tb.w "; - printBasicBlockLabel(MBB, false, false, false); + if (ByteOffset) + O << TAI->getData8bitsDirective(); + else if (HalfWordOffset) + O << TAI->getData16bitsDirective(); + if (ByteOffset || HalfWordOffset) { + O << '('; + printBasicBlockLabel(MBB, false, false, false); + O << "-" << TAI->getPrivateGlobalPrefix() << "JTI" << getFunctionNumber() + << '_' << JTI << '_' << MO2.getImm() << ")/2"; + } else { + O << "\tb.w "; + printBasicBlockLabel(MBB, false, false, false); + } if (i != e-1) O << '\n'; } } +void ARMAsmPrinter::printTBAddrMode(const MachineInstr *MI, int OpNum) { + O << "[pc, " << TRI->getAsmName(MI->getOperand(OpNum).getReg()); + if (MI->getOpcode() == ARM::t2TBH) + O << ", lsl #1"; + O << ']'; +} + bool ARMAsmPrinter::PrintAsmOperand(const MachineInstr *MI, unsigned OpNum, unsigned AsmVariant, const char *ExtraCode){ @@ -1127,12 +1153,14 @@ void ARMAsmPrinter::PrintGlobalVariable(const GlobalVariable* GVar) { if (Subtarget->isTargetELF()) O << "\t.type " << name << ",%object\n"; - const Section *TheSection = TAI->SectionForGlobal(GVar); + const Section *TheSection = + getObjFileLowering().SectionForGlobal(GVar, Mang, TM); SwitchToSection(TheSection); + // FIXME: get this stuff from section kind flags. if (C->isNullValue() && !GVar->hasSection() && !GVar->isThreadLocal() && // Don't put things that should go in the cstring section into "comm". - !TheSection->hasFlag(SectionFlags::Strings)) { + !TheSection->getKind().isMergeableCString()) { if (GVar->hasExternalLinkage()) { if (const char *Directive = TAI->getZeroFillDirective()) { O << "\t.globl\t" << name << "\n"; @@ -1153,7 +1181,7 @@ void ARMAsmPrinter::PrintGlobalVariable(const GlobalVariable* GVar) { O << TAI->getCOMMDirective() << name << "," << Size << ',' << Align; } else { - SwitchToSection(TAI->SectionForGlobal(GVar)); + SwitchToSection(getObjFileLowering().SectionForGlobal(GVar, Mang,TM)); O << "\t.globl " << name << '\n' << TAI->getWeakDefDirective() << name << '\n'; EmitAlignment(Align, GVar); @@ -1284,7 +1312,7 @@ bool ARMAsmPrinter::doFinalization(Module &M) { } if (!HiddenGVNonLazyPtrs.empty()) { - SwitchToSection(TAI->getDataSection()); + SwitchToSection(getObjFileLowering().getDataSection()); for (StringMap::iterator I = HiddenGVNonLazyPtrs.begin(), E = HiddenGVNonLazyPtrs.end(); I != E; ++I) { EmitAlignment(2);