Home | History | Annotate | Download | only in MC

Lines Matching full:streamer

354 /// Utility function to emit the encoding to a streamer.
808 static int getDataAlignmentFactor(MCStreamer &streamer) {
809 MCContext &context = streamer.getContext();
818 static unsigned getSizeForEncoding(MCStreamer &streamer,
820 MCContext &context = streamer.getContext();
839 static void EmitSymbol(MCStreamer &streamer, const MCSymbol &symbol,
841 MCContext &context = streamer.getContext();
845 streamer);
846 unsigned size = getSizeForEncoding(streamer, symbolEncoding);
847 if (streamer.isVerboseAsm() && comment) streamer.AddComment(comment);
848 streamer.EmitAbsValue(v, size);
851 static void EmitPersonality(MCStreamer &streamer, const MCSymbol &symbol,
853 MCContext &context = streamer.getContext();
857 streamer);
858 unsigned size = getSizeForEncoding(streamer, symbolEncoding);
859 streamer.EmitValue(v, size);
879 void EmitCompactUnwind(MCStreamer &streamer,
882 const MCSymbol &EmitCIE(MCStreamer &streamer,
888 MCSymbol *EmitFDE(MCStreamer &streamer,
891 void EmitCFIInstructions(MCStreamer &streamer,
894 void EmitCFIInstruction(MCStreamer &Streamer,
900 static void EmitEncodingByte(MCStreamer &Streamer, unsigned Encoding,
902 if (Streamer.isVerboseAsm()) {
939 Streamer.AddComment(Twine(Prefix) + " = " + EncStr);
942 Streamer.EmitIntValue(Encoding, 1);
945 void FrameEmitterImpl::EmitCFIInstruction(MCStreamer &Streamer,
947 int dataAlignmentFactor = getDataAlignmentFactor(Streamer);
948 bool VerboseAsm = Streamer.isVerboseAsm();
955 Streamer.AddComment("DW_CFA_register");
956 Streamer.AddComment(Twine("Reg1 ") + Twine(Reg1));
957 Streamer.AddComment(Twine("Reg2 ") + Twine(Reg2));
959 Streamer.EmitIntValue(dwarf::DW_CFA_register, 1);
960 Streamer.EmitULEB128IntValue(Reg1);
961 Streamer.EmitULEB128IntValue(Reg2);
967 Streamer.AddComment("DW_CFA_undefined");
968 Streamer.AddComment(Twine("Reg ") + Twine(Reg));
970 Streamer.EmitIntValue(dwarf::DW_CFA_undefined, 1);
971 Streamer.EmitULEB128IntValue(Reg);
980 Streamer.AddComment("DW_CFA_def_cfa_offset");
981 Streamer.EmitIntValue(dwarf::DW_CFA_def_cfa_offset, 1);
989 Streamer.AddComment(Twine("Offset " + Twine(CFAOffset)));
990 Streamer.EmitULEB128IntValue(CFAOffset);
996 Streamer.AddComment("DW_CFA_def_cfa");
997 Streamer.EmitIntValue(dwarf::DW_CFA_def_cfa, 1);
1000 Streamer.AddComment(Twine("Reg ") + Twine(Instr.getRegister()));
1001 Streamer.EmitULEB128IntValue(Instr.getRegister());
1006 Streamer.AddComment(Twine("Offset " + Twine(CFAOffset)));
1007 Streamer.EmitULEB128IntValue(CFAOffset);
1014 Streamer.AddComment("DW_CFA_def_cfa_register");
1015 Streamer.EmitIntValue(dwarf::DW_CFA_def_cfa_register, 1);
1018 Streamer.AddComment(Twine("Reg ") + Twine(Instr.getRegister()));
1019 Streamer.EmitULEB128IntValue(Instr.getRegister());
1036 if (VerboseAsm) Streamer.AddComment("DW_CFA_offset_extended_sf");
1037 Streamer.EmitIntValue(dwarf::DW_CFA_offset_extended_sf, 1);
1038 if (VerboseAsm) Streamer.AddComment(Twine("Reg ") + Twine(Reg));
1039 Streamer.EmitULEB128IntValue(Reg);
1040 if (VerboseAsm) Streamer.AddComment(Twine("Offset ") + Twine(Offset));
1041 Streamer.EmitSLEB128IntValue(Offset);
1043 if (VerboseAsm) Streamer.AddComment(Twine("DW_CFA_offset + Reg(") +
1045 Streamer.EmitIntValue(dwarf::DW_CFA_offset + Reg, 1);
1046 if (VerboseAsm) Streamer.AddComment(Twine("Offset ") + Twine(Offset));
1047 Streamer.EmitULEB128IntValue(Offset);
1049 if (VerboseAsm) Streamer.AddComment("DW_CFA_offset_extended");
1050 Streamer.EmitIntValue(dwarf::DW_CFA_offset_extended, 1);
1051 if (VerboseAsm) Streamer.AddComment(Twine("Reg ") + Twine(Reg));
1052 Streamer.EmitULEB128IntValue(Reg);
1053 if (VerboseAsm) Streamer.AddComment(Twine("Offset ") + Twine(Offset));
1054 Streamer.EmitULEB128IntValue(Offset);
1059 if (VerboseAsm) Streamer.AddComment("DW_CFA_remember_state");
1060 Streamer.EmitIntValue(dwarf::DW_CFA_remember_state, 1);
1063 if (VerboseAsm) Streamer.AddComment("DW_CFA_restore_state");
1064 Streamer.EmitIntValue(dwarf::DW_CFA_restore_state, 1);
1068 if (VerboseAsm) Streamer.AddComment("DW_CFA_same_value");
1069 Streamer.EmitIntValue(dwarf::DW_CFA_same_value, 1);
1070 if (VerboseAsm) Streamer.AddComment(Twine("Reg ") + Twine(Reg));
1071 Streamer.EmitULEB128IntValue(Reg);
1077 Streamer.AddComment("DW_CFA_restore");
1078 Streamer.AddComment(Twine("Reg ") + Twine(Reg));
1080 Streamer.EmitIntValue(dwarf::DW_CFA_restore | Reg, 1);
1084 if (VerboseAsm) Streamer.AddComment("Escape bytes");
1085 Streamer.EmitBytes(Instr.getValues());
1093 void FrameEmitterImpl::EmitCFIInstructions(MCStreamer &streamer,
1106 if (streamer.isVerboseAsm()) streamer.AddComment("DW_CFA_advance_loc4");
1107 streamer.EmitDwarfAdvanceFrameAddr(BaseLabel, ThisSym);
1112 EmitCFIInstruction(streamer, Instr);
1119 void FrameEmitterImpl::EmitCompactUnwind(MCStreamer &Streamer,
1121 MCContext &Context = Streamer.getContext();
1123 bool VerboseAsm = Streamer.isVerboseAsm();
1157 unsigned Size = getSizeForEncoding(Streamer, FDEEncoding);
1158 if (VerboseAsm) Streamer.AddComment("Range Start");
1159 Streamer.EmitSymbolValue(Frame.Function, Size);
1162 const MCExpr *Range = MakeStartMinusEndExpr(Streamer, *Frame.Begin,
1164 if (VerboseAsm) Streamer.AddComment("Range Length");
1165 Streamer.EmitAbsValue(Range, 4);
1168 Size = getSizeForEncoding(Streamer, dwarf::DW_EH_PE_udata4);
1169 if (VerboseAsm) Streamer.AddComment("Compact Unwind Encoding: 0x" +
1171 Streamer.EmitIntValue(Encoding, Size);
1174 Size = getSizeForEncoding(Streamer, dwarf::DW_EH_PE_absptr);
1175 if (VerboseAsm) Streamer.AddComment("Personality Function");
1177 Streamer.EmitSymbolValue(Frame.Personality, Size);
1179 Streamer.EmitIntValue(0, Size); // No personality fn
1182 Size = getSizeForEncoding(Streamer, Frame.LsdaEncoding);
1183 if (VerboseAsm) Streamer.AddComment("LSDA");
1185 Streamer.EmitSymbolValue(Frame.Lsda, Size);
1187 Streamer.EmitIntValue(0, Size); // No LSDA
1190 const MCSymbol &FrameEmitterImpl::EmitCIE(MCStreamer &streamer,
1196 MCContext &context = streamer.getContext();
1199 bool verboseAsm = streamer.isVerboseAsm();
1207 streamer.EmitLabel(sectionStart);
1213 const MCExpr *Length = MakeStartMinusEndExpr(streamer, *sectionStart,
1215 if (verboseAsm) streamer.AddComment("CIE Length");
1216 streamer.EmitAbsValue(Length, 4);
1220 if (verboseAsm) streamer.AddComment("CIE ID Tag");
1221 streamer.EmitIntValue(CIE_ID, 4);
1224 if (verboseAsm) streamer.AddComment("DW_CIE_VERSION");
1225 streamer.EmitIntValue(dwarf::DW_CIE_VERSION, 1);
1230 if (verboseAsm) streamer.AddComment("CIE Augmentation");
1239 streamer.EmitBytes(Augmentation.str());
1241 streamer.EmitIntValue(0, 1);
1244 if (verboseAsm) streamer.AddComment("CIE Code Alignment Factor");
1245 streamer.EmitULEB128IntValue(context.getAsmInfo()->getMinInstAlignment());
1248 if (verboseAsm) streamer.AddComment("CIE Data Alignment Factor");
1249 streamer.EmitSLEB128IntValue(getDataAlignmentFactor(streamer));
1252 if (verboseAsm) streamer.AddComment("CIE Return Address Column");
1253 streamer.EmitULEB128IntValue(MRI->getDwarfRegNum(MRI->getRARegister(), true));
1263 augmentationLength += getSizeForEncoding(streamer, personalityEncoding);
1270 if (verboseAsm) streamer.AddComment("Augmentation Size");
1271 streamer.EmitULEB128IntValue(augmentationLength);
1276 EmitEncodingByte(streamer, personalityEncoding,
1279 if (verboseAsm) streamer.AddComment("Personality");
1280 EmitPersonality(streamer, *personality, personalityEncoding);
1284 EmitEncodingByte(streamer, lsdaEncoding, "LSDA Encoding");
1287 EmitEncodingByte(streamer, MOFI->getFDEEncoding(UsingCFI),
1296 EmitCFIInstructions(streamer, Instructions, NULL);
1299 streamer
1301 streamer.EmitLabel(sectionEnd);
1305 MCSymbol *FrameEmitterImpl::EmitFDE(MCStreamer &streamer,
1308 MCContext &context = streamer.getContext();
1312 bool verboseAsm = streamer.isVerboseAsm();
1317 streamer.EmitEHSymAttributes(frame.Function, EHSym);
1318 streamer.EmitLabel(EHSym);
1322 const MCExpr *Length = MakeStartMinusEndExpr(streamer, *fdeStart, *fdeEnd, 0);
1323 if (verboseAsm) streamer.AddComment("FDE Length");
1324 streamer.EmitAbsValue(Length, 4);
1326 streamer.EmitLabel(fdeStart);
1331 const MCExpr *offset = MakeStartMinusEndExpr(streamer, cieStart, *fdeStart,
1333 if (verboseAsm) streamer.AddComment("FDE CIE Offset");
1334 streamer.EmitAbsValue(offset, 4);
1336 const MCExpr *offset = MakeStartMinusEndExpr(streamer, *SectionStart,
1338 streamer.EmitAbsValue(offset, 4);
1340 streamer.EmitSymbolValue(&cieStart, 4);
1346 unsigned PCSize = getSizeForEncoding(streamer, PCEncoding);
1347 EmitSymbol(streamer, *frame.Begin, PCEncoding, "FDE initial location");
1350 const MCExpr *Range = MakeStartMinusEndExpr(streamer, *frame.Begin,
1352 if (verboseAsm) streamer.AddComment("FDE address range");
1353 streamer.EmitAbsValue(Range, PCSize);
1360 augmentationLength += getSizeForEncoding(streamer, frame.LsdaEncoding);
1362 if (verboseAsm) streamer.AddComment("Augmentation size");
1363 streamer.EmitULEB128IntValue(augmentationLength);
1367 EmitSymbol(streamer, *frame.Lsda, frame.LsdaEncoding,
1372 EmitCFIInstructions(streamer, frame.Instructions, frame.Begin);
1375 streamer.EmitValueToAlignment(PCSize);
1422 void MCDwarfFrameEmitter::Emit(MCStreamer &Streamer,
1425 MCContext &Context = Streamer.getContext();
1428 ArrayRef<MCDwarfFrameInfo> FrameArray = Streamer.getFrameInfos();
1437 Streamer.SwitchSection(MOFI->getCompactUnwindSection());
1438 Streamer.EmitValueToAlignment(Context.getAsmInfo()->getPointerSize());
1441 Emitter.EmitCompactUnwind(Streamer, Frame);
1448 Streamer.SwitchSection(&Section);
1450 Streamer.EmitLabel(SectionStart);
1463 CIEStart = &Emitter.EmitCIE(Streamer, Frame.Personality,
1468 FDEEnd = Emitter.EmitFDE(Streamer, *CIEStart, Frame);
1471 Streamer.EmitLabel(FDEEnd);
1474 Streamer.EmitValueToAlignment(Context.getAsmInfo()->getPointerSize());
1476 Streamer.EmitLabel(FDEEnd);
1479 void MCDwarfFrameEmitter::EmitAdvanceLoc(MCStreamer &Streamer,
1481 MCContext &Context = Streamer.getContext();
1485 Streamer.EmitBytes(OS.str());