llvm.org GIT mirror llvm / 0c8e806
Drop obsolete hook and change all usage to new interface git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56572 91177308-0d34-0410-b5e6-96231b3b80d8 Anton Korobeynikov 11 years ago
13 changed file(s) with 8 addition(s) and 97 deletion(s). Raw diff Collapse all Expand all
182182 virtual bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo,
183183 unsigned AsmVariant,
184184 const char *ExtraCode);
185
186 /// getSectionForFunction - Return the section that we should emit the
187 /// specified function body into. This defaults to 'TextSection'. This
188 /// should most likely be overridden by the target to put linkonce/weak
189 /// functions into special sections.
190 virtual std::string getSectionForFunction(const Function &F) const;
191185
192186 /// SetupMachineFunction - This should be called when a new MachineFunction
193187 /// is being processed from runOnMachineFunction.
4646 E = GCMetadataPrinters.end(); I != E; ++I)
4747 delete I->second;
4848 }
49
50 std::string AsmPrinter::getSectionForFunction(const Function &F) const {
51 return TAI->getTextSection();
52 }
53
5449
5550 /// SwitchToTextSection - Switch to the specified text section of the executable
5651 /// if we are not already in it!
330325 // function body itself, otherwise the label differences won't make sense.
331326 // We should also do if the section name is NULL or function is declared in
332327 // discardable section.
333 SwitchToTextSection(getSectionForFunction(*F).c_str(), F);
328 SwitchToTextSection(TAI->SectionForGlobal(F).c_str(), F);
334329 } else {
335330 SwitchToDataSection(JumpTableDataSection);
336331 }
129129 bool doInitialization(Module &M);
130130 bool doFinalization(Module &M);
131131
132 /// getSectionForFunction - Return the section that we should emit the
133 /// specified function body into.
134 virtual std::string getSectionForFunction(const Function &F) const;
135
136132 /// EmitMachineConstantPoolValue - Print a machine constantpool value to
137133 /// the .s file.
138134 virtual void EmitMachineConstantPoolValue(MachineConstantPoolValue *MCPV) {
177173 } // end of anonymous namespace
178174
179175 #include "ARMGenAsmWriter.inc"
180
181 // Substitute old hook with new one temporary
182 std::string ARMAsmPrinter::getSectionForFunction(const Function &F) const {
183 return TAI->SectionForGlobal(&F);
184 }
185176
186177 /// runOnMachineFunction - This uses the printInstruction()
187178 /// method to print assembly for each instruction.
148148
149149 // Print out labels for the function.
150150 const Function *F = MF.getFunction();
151 SwitchToTextSection(getSectionForFunction(*F).c_str(), F);
151 SwitchToTextSection(TAI->SectionForGlobal(F).c_str(), F);
152152
153153 EmitAlignment(4, F);
154154 switch (F->getLinkage()) {
296296 SPUAsmPrinter::getAnalysisUsage(AU);
297297 }
298298
299 /// getSectionForFunction - Return the section that we should emit the
300 /// specified function body into.
301 virtual std::string getSectionForFunction(const Function &F) const;
302299 };
303300 } // end of anonymous namespace
304301
405402 printInstruction(MI);
406403 }
407404
408
409
410 std::string LinuxAsmPrinter::getSectionForFunction(const Function &F) const {
411 switch (F.getLinkage()) {
412 default: assert(0 && "Unknown linkage type!");
413 case Function::ExternalLinkage:
414 case Function::InternalLinkage: return TAI->getTextSection();
415 case Function::WeakLinkage:
416 case Function::LinkOnceLinkage:
417 return ""; // Print nothing for the time being...
418 }
419 }
420
421405 /// runOnMachineFunction - This uses the printMachineInstruction()
422406 /// method to print assembly for each instruction.
423407 ///
433417 // Print out labels for the function.
434418 const Function *F = MF.getFunction();
435419
436 SwitchToTextSection(getSectionForFunction(*F).c_str(), F);
420 SwitchToTextSection(TAI->SectionForGlobal(F).c_str(), F);
437421 EmitAlignment(3, F);
438422
439423 switch (F->getLinkage()) {
105105 printOp(MI->getOperand(OpNo), true); // this is a br.call instruction
106106 }
107107
108 std::string getSectionForFunction(const Function &F) const;
109
110108 void printMachineInstruction(const MachineInstr *MI);
111109 void printOp(const MachineOperand &MO, bool isBRCALLinsn= false);
112110 void printModuleLevelGV(const GlobalVariable* GVar);
120118 // Include the auto-generated portion of the assembly writer.
121119 #include "IA64GenAsmWriter.inc"
122120
123
124 // Substitute old hook with new one temporary
125 std::string IA64AsmPrinter::getSectionForFunction(const Function &F) const {
126 return TAI->SectionForGlobal(&F);
127 }
128
129121 /// runOnMachineFunction - This uses the printMachineInstruction()
130122 /// method to print assembly for each instruction.
131123 ///
137129 EmitConstantPool(MF.getConstantPool());
138130
139131 const Function *F = MF.getFunction();
140 SwitchToTextSection(getSectionForFunction(*F).c_str(), F);
132 SwitchToTextSection(TAI->SectionForGlobal(F).c_str(), F);
141133
142134 // Print out labels for the function.
143135 EmitAlignment(5);
5858 return "Mips Assembly Printer";
5959 }
6060
61 virtual std::string getSectionForFunction(const Function &F) const;
6261 bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
6362 unsigned AsmVariant, const char *ExtraCode);
6463 void printOperand(const MachineInstr *MI, int opNum);
217216 assert(0 && "Unknown Mips ABI");
218217 return NULL;
219218 }
220
221 // Substitute old hook with new one temporary
222 std::string MipsAsmPrinter::getSectionForFunction(const Function &F) const {
223 return TAI->SectionForGlobal(&F);
224 }
225219
226220 /// Emit the directives used by GAS on the start of functions
227221 void MipsAsmPrinter::
314314 PPCAsmPrinter::getAnalysisUsage(AU);
315315 }
316316
317 /// getSectionForFunction - Return the section that we should emit the
318 /// specified function body into.
319 virtual std::string getSectionForFunction(const Function &F) const;
320317 void printModuleLevelGV(const GlobalVariable* GVar);
321318 };
322319
346343 PPCAsmPrinter::getAnalysisUsage(AU);
347344 }
348345
349 /// getSectionForFunction - Return the section that we should emit the
350 /// specified function body into.
351 virtual std::string getSectionForFunction(const Function &F) const;
352346 void printModuleLevelGV(const GlobalVariable* GVar);
353347 };
354348 } // end of anonymous namespace
576570
577571 // Print out labels for the function.
578572 const Function *F = MF.getFunction();
579 SwitchToTextSection(getSectionForFunction(*F).c_str(), F);
573 SwitchToTextSection(TAI->SectionForGlobal(F).c_str(), F);
580574
581575 switch (F->getLinkage()) {
582576 default: assert(0 && "Unknown linkage type!");
752746 return AsmPrinter::doFinalization(M);
753747 }
754748
755 std::string PPCLinuxAsmPrinter::getSectionForFunction(const Function &F) const {
756 return TAI->SectionForGlobal(&F);
757 }
758
759 std::string PPCDarwinAsmPrinter::getSectionForFunction(const Function &F) const {
760 return TAI->SectionForGlobal(&F);
761 }
762
763749 /// runOnMachineFunction - This uses the printMachineInstruction()
764750 /// method to print assembly for each instruction.
765751 ///
772758
773759 // Print out labels for the function.
774760 const Function *F = MF.getFunction();
775 SwitchToTextSection(getSectionForFunction(*F).c_str(), F);
761 SwitchToTextSection(TAI->SectionForGlobal(F).c_str(), F);
776762
777763 switch (F->getLinkage()) {
778764 default: assert(0 && "Unknown linkage type!");
6262
6363 bool printInstruction(const MachineInstr *MI); // autogenerated.
6464 bool runOnMachineFunction(MachineFunction &F);
65 std::string getSectionForFunction(const Function &F) const;
6665 bool doInitialization(Module &M);
6766 bool doFinalization(Module &M);
6867 };
8079 return new SparcAsmPrinter(o, tm, tm.getTargetAsmInfo());
8180 }
8281
83 // Substitute old hook with new one temporary
84 std::string SparcAsmPrinter::getSectionForFunction(const Function &F) const {
85 return TAI->SectionForGlobal(&F);
86 }
87
8882 /// runOnMachineFunction - This uses the printInstruction()
8983 /// method to print assembly for each instruction.
9084 ///
10498
10599 // Print out the label for the function.
106100 const Function *F = MF.getFunction();
107 SwitchToTextSection(getSectionForFunction(*F).c_str(), F);
101 SwitchToTextSection(TAI->SectionForGlobal(F).c_str(), F);
108102 EmitAlignment(4, F);
109103 O << "\t.globl\t" << CurrentFnName << '\n';
110104
143143 default:
144144 assert(0 && "Unsupported DecorationStyle");
145145 }
146 }
147
148 // Substitute old hook with new one temporary
149 std::string X86ATTAsmPrinter::getSectionForFunction(const Function &F) const {
150 return TAI->SectionForGlobal(&F);
151146 }
152147
153148 void X86ATTAsmPrinter::emitFunctionHeader(const MachineFunction &MF) {
123123
124124 bool runOnMachineFunction(MachineFunction &F);
125125
126 /// getSectionForFunction - Return the section that we should emit the
127 /// specified function body into.
128 virtual std::string getSectionForFunction(const Function &F) const;
129
130126 void emitFunctionHeader(const MachineFunction &MF);
131127
132128 // Necessary for Darwin to print out the apprioriate types of linker stubs
116116 }
117117 }
118118
119
120 std::string X86IntelAsmPrinter::getSectionForFunction(const Function &F) const {
121 // Intel asm always emits functions to _text.
122 return "_text";
123 }
124
125119 /// runOnMachineFunction - This uses the printMachineInstruction()
126120 /// method to print assembly for each instruction.
127121 ///
143137
144138 decorateName(CurrentFnName, F);
145139
146 SwitchToTextSection(getSectionForFunction(*F).c_str(), F);
140 SwitchToTextSection("_text", F);
147141
148142 unsigned FnAlign = OptimizeForSize ? 1 : 4;
149143 if (!F->isDeclaration() && F->hasNote(FnAttr::OptimizeForSize))
130130
131131 void decorateName(std::string& Name, const GlobalValue* GV);
132132
133 /// getSectionForFunction - Return the section that we should emit the
134 /// specified function body into.
135 virtual std::string getSectionForFunction(const Function &F) const;
136
137133 virtual void EmitString(const ConstantArray *CVA) const;
138134
139135 // Necessary for dllexport support