[ARM] Generate 8.1-m CSINC, CSNEG and CSINV instructions.
[llvm-core.git] / lib / MC / MCXCOFFStreamer.cpp
blob760bdefd424b85ef6dc02502659f9b0ab770703d
1 //===- lib/MC/MCXCOFFStreamer.cpp - XCOFF Object Output -------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file assembles .s files and emits XCOFF .o object files.
11 //===----------------------------------------------------------------------===//
13 #include "llvm/BinaryFormat/XCOFF.h"
14 #include "llvm/MC/MCAsmBackend.h"
15 #include "llvm/MC/MCCodeEmitter.h"
16 #include "llvm/MC/MCObjectWriter.h"
17 #include "llvm/MC/MCSymbolXCOFF.h"
18 #include "llvm/MC/MCXCOFFStreamer.h"
19 #include "llvm/Support/TargetRegistry.h"
21 using namespace llvm;
23 MCXCOFFStreamer::MCXCOFFStreamer(MCContext &Context,
24 std::unique_ptr<MCAsmBackend> MAB,
25 std::unique_ptr<MCObjectWriter> OW,
26 std::unique_ptr<MCCodeEmitter> Emitter)
27 : MCObjectStreamer(Context, std::move(MAB), std::move(OW),
28 std::move(Emitter)) {}
30 bool MCXCOFFStreamer::EmitSymbolAttribute(MCSymbol *Symbol,
31 MCSymbolAttr Attribute) {
32 report_fatal_error("Symbol attributes not implemented for XCOFF.");
35 void MCXCOFFStreamer::EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
36 unsigned ByteAlignment) {
37 getAssembler().registerSymbol(*Symbol);
38 Symbol->setExternal(cast<MCSymbolXCOFF>(Symbol)->getStorageClass() !=
39 XCOFF::C_HIDEXT);
40 Symbol->setCommon(Size, ByteAlignment);
42 // Need to add this symbol to the current Fragment which will belong to the
43 // containing CSECT.
44 auto *F = dyn_cast_or_null<MCDataFragment>(getCurrentFragment());
45 assert(F && "Expected a valid section with a fragment set.");
46 Symbol->setFragment(F);
48 // Emit the alignment and storage for the variable to the section.
49 EmitValueToAlignment(ByteAlignment);
50 EmitZeros(Size);
53 void MCXCOFFStreamer::EmitZerofill(MCSection *Section, MCSymbol *Symbol,
54 uint64_t Size, unsigned ByteAlignment,
55 SMLoc Loc) {
56 report_fatal_error("Zero fill not implemented for XCOFF.");
59 void MCXCOFFStreamer::EmitInstToData(const MCInst &Inst,
60 const MCSubtargetInfo &) {
61 report_fatal_error("Instruction emission not implemented for XCOFF.");
64 MCStreamer *llvm::createXCOFFStreamer(MCContext &Context,
65 std::unique_ptr<MCAsmBackend> &&MAB,
66 std::unique_ptr<MCObjectWriter> &&OW,
67 std::unique_ptr<MCCodeEmitter> &&CE,
68 bool RelaxAll) {
69 MCXCOFFStreamer *S = new MCXCOFFStreamer(Context, std::move(MAB),
70 std::move(OW), std::move(CE));
71 if (RelaxAll)
72 S->getAssembler().setRelaxAll(true);
73 return S;
76 void MCXCOFFStreamer::EmitXCOFFLocalCommonSymbol(MCSymbol *Symbol,
77 uint64_t Size,
78 unsigned ByteAlignment) {
79 EmitCommonSymbol(Symbol, Size, ByteAlignment);