llvm.org GIT mirror llvm / e99ebe7
Make getTargetStreamer return a possibly null pointer. This will allow it to be called from target independent parts of the main streamer that don't know if there is a registered target streamer or not. This in turn will allow targets to perform extra actions at specified points in the interface: add extra flags for some labels, extra work during finalization, etc. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199174 91177308-0d34-0410-b5e6-96231b3b80d8 Rafael Espindola 6 years ago
9 changed file(s) with 12 addition(s) and 12 deletion(s). Raw diff Collapse all Expand all
170170
171171 MCContext &getContext() const { return Context; }
172172
173 MCTargetStreamer &getTargetStreamer() {
174 assert(TargetStreamer);
175 return *TargetStreamer;
173 MCTargetStreamer *getTargetStreamer() {
174 return TargetStreamer.get();
176175 }
177176
178177 unsigned getNumFrameInfos() { return FrameInfos.size(); }
4747 ARMException::~ARMException() {}
4848
4949 ARMTargetStreamer &ARMException::getTargetStreamer() {
50 MCTargetStreamer &TS = Asm->OutStreamer.getTargetStreamer();
50 MCTargetStreamer &TS = *Asm->OutStreamer.getTargetStreamer();
5151 return static_cast(TS);
5252 }
5353
615615 }
616616
617617 void ARMAsmPrinter::emitAttributes() {
618 MCTargetStreamer &TS = OutStreamer.getTargetStreamer();
618 MCTargetStreamer &TS = *OutStreamer.getTargetStreamer();
619619 ARMTargetStreamer &ATS = static_cast(TS);
620620
621621 ATS.switchVendor("aeabi");
982982 assert(MI->getFlag(MachineInstr::FrameSetup) &&
983983 "Only instruction which are involved into frame setup code are allowed");
984984
985 MCTargetStreamer &TS = OutStreamer.getTargetStreamer();
985 MCTargetStreamer &TS = *OutStreamer.getTargetStreamer();
986986 ARMTargetStreamer &ATS = static_cast(TS);
987987 const MachineFunction &MF = *MI->getParent()->getParent();
988988 const TargetRegisterInfo *RegInfo = MF.getTarget().getRegisterInfo();
191191 }
192192
193193 ARMTargetStreamer &getTargetStreamer() {
194 MCTargetStreamer &TS = getParser().getStreamer().getTargetStreamer();
194 MCTargetStreamer &TS = *getParser().getStreamer().getTargetStreamer();
195195 return static_cast(TS);
196196 }
197197
924924 }
925925
926926 void ARMELFStreamer::FinishImpl() {
927 MCTargetStreamer &TS = getTargetStreamer();
927 MCTargetStreamer &TS = *getTargetStreamer();
928928 ARMTargetStreamer &ATS = static_cast(TS);
929929 ATS.finishAttributeSection();
930930
5656 class MipsAsmParser : public MCTargetAsmParser {
5757
5858 MipsTargetStreamer &getTargetStreamer() {
59 MCTargetStreamer &TS = Parser.getStreamer().getTargetStreamer();
59 MCTargetStreamer &TS = *Parser.getStreamer().getTargetStreamer();
6060 return static_cast(TS);
6161 }
6262
4545 using namespace llvm;
4646
4747 MipsTargetStreamer &MipsAsmPrinter::getTargetStreamer() {
48 return static_cast(OutStreamer.getTargetStreamer());
48 return static_cast(*OutStreamer.getTargetStreamer());
4949 }
5050
5151 bool MipsAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
768768 bool isPPC64 = TD->getPointerSizeInBits() == 64;
769769
770770 PPCTargetStreamer &TS =
771 static_cast(OutStreamer.getTargetStreamer());
771 static_cast(*OutStreamer.getTargetStreamer());
772772
773773 if (isPPC64 && !TOC.empty()) {
774774 const MCSectionELF *Section = OutStreamer.getContext().getELFSection(".toc",
3636 namespace {
3737 class SparcAsmPrinter : public AsmPrinter {
3838 SparcTargetStreamer &getTargetStreamer() {
39 return static_cast&>(OutStreamer.getTargetStreamer());
39 return static_cast &>(
40 *OutStreamer.getTargetStreamer());
4041 }
4142 public:
4243 explicit SparcAsmPrinter(TargetMachine &TM, MCStreamer &Streamer)