1*06c3fb27SDimitry Andric //===-- RISCVMCObjectFileInfo.cpp - RISC-V object file properties ---------===// 2349cc55cSDimitry Andric // 3349cc55cSDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4349cc55cSDimitry Andric // See https://llvm.org/LICENSE.txt for license information. 5349cc55cSDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6349cc55cSDimitry Andric // 7349cc55cSDimitry Andric //===----------------------------------------------------------------------===// 8349cc55cSDimitry Andric // 9349cc55cSDimitry Andric // This file contains the declarations of the RISCVMCObjectFileInfo properties. 10349cc55cSDimitry Andric // 11349cc55cSDimitry Andric //===----------------------------------------------------------------------===// 12349cc55cSDimitry Andric 13349cc55cSDimitry Andric #include "RISCVMCObjectFileInfo.h" 14349cc55cSDimitry Andric #include "RISCVMCTargetDesc.h" 15349cc55cSDimitry Andric #include "llvm/MC/MCContext.h" 1681ad6265SDimitry Andric #include "llvm/MC/MCSubtargetInfo.h" 17349cc55cSDimitry Andric 18349cc55cSDimitry Andric using namespace llvm; 19349cc55cSDimitry Andric 20*06c3fb27SDimitry Andric unsigned getTextSectionAlignment(const MCSubtargetInfo & STI)21*06c3fb27SDimitry AndricRISCVMCObjectFileInfo::getTextSectionAlignment(const MCSubtargetInfo &STI) { 22*06c3fb27SDimitry Andric bool RVC = STI.hasFeature(RISCV::FeatureStdExtC) || 23*06c3fb27SDimitry Andric STI.hasFeature(RISCV::FeatureStdExtZca); 24*06c3fb27SDimitry Andric return RVC ? 2 : 4; 25*06c3fb27SDimitry Andric } 26*06c3fb27SDimitry Andric getTextSectionAlignment() const27349cc55cSDimitry Andricunsigned RISCVMCObjectFileInfo::getTextSectionAlignment() const { 28*06c3fb27SDimitry Andric return getTextSectionAlignment(*getContext().getSubtargetInfo()); 29349cc55cSDimitry Andric } 30