+ virtual void EmitIdent(StringRef IdentString);
+ virtual void EmitWin64EHHandlerData();
+ virtual void FinishImpl();
+
+private:
+ virtual void EmitInstToData(const MCInst &Inst) {
+ MCDataFragment *DF = getOrCreateDataFragment();
+
+ SmallVector<MCFixup, 4> Fixups;
+ SmallString<256> Code;
+ raw_svector_ostream VecOS(Code);
+ getAssembler().getEmitter().EncodeInstruction(Inst, VecOS, Fixups);
+ VecOS.flush();
+
+ // Add the fixups and data.
+ for (unsigned i = 0, e = Fixups.size(); i != e; ++i) {
+ Fixups[i].setOffset(Fixups[i].getOffset() + DF->getContents().size());
+ DF->getFixups().push_back(Fixups[i]);
+ }
+ DF->getContents().append(Code.begin(), Code.end());
+ }
+
+ const MCSectionCOFF *getSectionText() {
+ return getContext().getCOFFSection(
+ ".text", COFF::IMAGE_SCN_CNT_CODE | COFF::IMAGE_SCN_MEM_EXECUTE |
+ COFF::IMAGE_SCN_MEM_READ,
+ SectionKind::getText());
+ }
+
+ const MCSectionCOFF *getSectionData() {
+ return getContext().getCOFFSection(
+ ".data", COFF::IMAGE_SCN_CNT_INITIALIZED_DATA |
+ COFF::IMAGE_SCN_MEM_READ | COFF::IMAGE_SCN_MEM_WRITE,
+ SectionKind::getDataRel());
+ }
+
+ const MCSectionCOFF *getSectionBSS() {
+ return getContext().getCOFFSection(
+ ".bss", COFF::IMAGE_SCN_CNT_UNINITIALIZED_DATA |
+ COFF::IMAGE_SCN_MEM_READ | COFF::IMAGE_SCN_MEM_WRITE,
+ SectionKind::getBSS());
+ }
+
+ void SetSectionText() {
+ SwitchSection(getSectionText());
+ EmitCodeAlignment(4, 0);
+ }
+
+ void SetSectionData() {
+ SwitchSection(getSectionData());
+ EmitCodeAlignment(4, 0);
+ }
+
+ void SetSectionBSS() {
+ SwitchSection(getSectionBSS());
+ EmitCodeAlignment(4, 0);
+ }