41 #define GET_INSTRINFO_MC_DESC
42 #include "HexagonGenInstrInfo.inc"
44 #define GET_SUBTARGETINFO_MC_DESC
45 #include "HexagonGenSubtargetInfo.inc"
47 #define GET_REGINFO_MC_DESC
48 #include "HexagonGenRegisterInfo.inc"
52 cl::desc(
"Disable looking for compound instructions for Hexagon"));
56 cl::desc(
"Disable looking for duplex instructions for Hexagon"));
74 cl::desc(
"Enable Hexagon Vector Extension (HVX)"));
126 InstPrinter.
printInst(&Inst, TempStream,
"", STI);
129 auto PacketBundle = Contents.rsplit(
'\n');
130 auto HeadTail = PacketBundle.first.split(
'\n');
134 while (!HeadTail.first.empty()) {
136 auto Duplex = HeadTail.first.
split(
'\v');
137 if (!Duplex.second.empty()) {
138 OS << Indent << Duplex.first <<
Separator;
139 InstTxt = Duplex.second;
140 }
else if (!HeadTail.first.trim().startswith(
"immext")) {
141 InstTxt = Duplex.first;
143 if (!InstTxt.
empty())
144 OS << Indent << InstTxt << Separator;
145 HeadTail = HeadTail.second.
split(
'\n');
147 OS <<
"\t}" << PacketBundle.second;
165 unsigned AccessSize)
override {
172 void EmitLocalCommonSymbolSorted(
MCSymbol *Symbol, uint64_t Size,
173 unsigned ByteAlignment,
174 unsigned AccessSize)
override {
178 Symbol, Size, ByteAlignment, AccessSize);
186 InitHexagonMCInstrInfo(X);
192 InitHexagonMCRegisterInfo(X, Hexagon::R31);
210 unsigned SyntaxVariant,
215 if (SyntaxVariant == 0)
224 return new HexagonTargetAsmStreamer(S, OS, IsVerboseAsm, *IP);
238 return new HexagonTargetELFStreamer(S, STI);
243 if (FB & (1ULL << F))
249 return (FB & (1ULL << F)) != 0;
265 std::vector<std::string> table
274 return std::find(table.begin(), table.end(), CPU) != table.end();
283 errs() <<
"error: invalid CPU \"" << CPUName.
str().c_str()
297 static std::map<StringRef,unsigned> ElfFlags = {
305 auto F = ElfFlags.find(STI.
getCPU());
306 assert(
F != ElfFlags.end() &&
"Unrecognized Architecture");
320 bool isConditionalBranch(
MCInst const &Inst)
const override {
325 bool evaluateBranch(
MCInst const &Inst, uint64_t Addr,
326 uint64_t
Size, uint64_t &
Target)
const override {
331 assert(Extended.isExpr());
333 if(!Extended.getExpr()->evaluateAsAbsolute(Value))
342 return new HexagonMCInstrAnalysis(Info);
void setELFHeaderEFlags(unsigned Flags)
int getDwarfRegNum(unsigned RegNum, bool isEH) const
Map a target register to an equivalent dwarf register number.
raw_ostream & errs()
This returns a reference to a raw_ostream for standard error.
static cl::opt< bool > HexagonV55ArchVariant("mv55", cl::Hidden, cl::init(false), cl::desc("Build for Hexagon V55"))
static cl::opt< bool > HexagonV5ArchVariant("mv5", cl::Hidden, cl::init(false), cl::desc("Build for Hexagon V5"))
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
void setFeatureBits(const FeatureBitset &FeatureBits_)
setFeatureBits - Set the feature bits.
virtual void printInst(const MCInst *MI, raw_ostream &OS, StringRef Annot, const MCSubtargetInfo &STI)=0
Print the specified MCInst to the specified raw_ostream.
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
static void RegisterMCInstrAnalysis(Target &T, Target::MCInstrAnalysisCtorFnTy Fn)
RegisterMCInstrAnalysis - Register a MCInstrAnalysis implementation for the given target...
Target specific streamer interface.
StringRef selectHexagonCPU(const Triple &TT, StringRef CPU)
LLVM_NODISCARD bool equals_lower(StringRef RHS) const
equals_lower - Check for string equality, ignoring case.
bool isBundle(MCInst const &MCI)
unsigned HexagonGetLastSlot()
static cl::opt< bool > HexagonV62ArchVariant("mv62", cl::Hidden, cl::init(false), cl::desc("Build for Hexagon V62"))
static void RegisterMCInstPrinter(Target &T, Target::MCInstPrinterCtorTy Fn)
RegisterMCInstPrinter - Register a MCInstPrinter implementation for the given target.
MCAsmBackend * createHexagonAsmBackend(const Target &T, const MCRegisterInfo &MRI, const Triple &TT, StringRef CPU, const MCTargetOptions &Options)
void LLVMInitializeHexagonTargetMC()
static void RegisterAsmTargetStreamer(Target &T, Target::AsmTargetStreamerCtorTy Fn)
MCCodeEmitter * createHexagonMCCodeEmitter(const MCInstrInfo &MCII, const MCRegisterInfo &MRI, MCContext &MCT)
MCStreamer * createHexagonELFStreamer(Triple const &TT, MCContext &Context, MCAsmBackend &MAB, raw_pwrite_stream &OS, MCCodeEmitter *CE)
#define HEXAGON_PACKET_SIZE
StringRef getCPU() const
getCPU - Return the CPU string.
static cl::opt< bool > HexagonV4ArchVariant("mv4", cl::Hidden, cl::init(false), cl::desc("Build for Hexagon V4"))
Context object for machine code objects.
static MCInstrAnalysis * createHexagonMCInstrAnalysis(const MCInstrInfo *Info)
static StringRef DefaultArch
void addInitialFrameState(const MCCFIInstruction &Inst)
MCInstrInfo * createHexagonMCInstrInfo()
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE size_t size() const
size - Get the string size.
Instances of this class represent a single low-level machine instruction.
virtual bool isUnconditionalBranch(const MCInst &Inst) const
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
This class is intended to be used as a base class for asm properties and features specific to the tar...
FeatureBitset ToggleFeature(uint64_t FB)
ToggleFeature - Toggle a feature and returns the re-computed feature bits.
static void RegisterMCAsmBackend(Target &T, Target::MCAsmBackendCtorTy Fn)
RegisterMCAsmBackend - Register a MCAsmBackend implementation for the given target.
initializer< Ty > init(const Ty &Val)
Streaming machine code generation interface.
unsigned const MachineRegisterInfo * MRI
Container class for subtarget features.
static MCCFIInstruction createDefCfa(MCSymbol *L, unsigned Register, int Offset)
.cfi_def_cfa defines a rule for computing CFA as: take address from Register and add Offset to it...
static MCInstPrinter * createHexagonMCInstPrinter(const Triple &T, unsigned SyntaxVariant, const MCAsmInfo &MAI, const MCInstrInfo &MII, const MCRegisterInfo &MRI)
MCCodeEmitter - Generic instruction encoding interface.
Interface to description of machine instruction set.
cl::opt< bool > HexagonDisableCompound
MCSubtargetInfo * createHexagonMCSubtargetInfo(const Triple &TT, StringRef CPU, StringRef FS)
Create a Hexagon MCSubtargetInfo instance.
#define LLVM_ATTRIBUTE_UNUSED
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang","erlang-compatible garbage collector")
static MCTargetStreamer * createMCAsmTargetStreamer(MCStreamer &S, formatted_raw_ostream &OS, MCInstPrinter *IP, bool IsVerboseAsm)
static void LLVM_ATTRIBUTE_UNUSED clearFeature(MCSubtargetInfo *STI, uint64_t F)
LLVM_NODISCARD std::string str() const
str - Get the contents as an std::string.
static MCTargetStreamer * createHexagonObjectTargetStreamer(MCStreamer &S, const MCSubtargetInfo &STI)
static void RegisterMCSubtargetInfo(Target &T, Target::MCSubtargetInfoCtorFnTy Fn)
RegisterMCSubtargetInfo - Register a MCSubtargetInfo implementation for the given target...
static void RegisterObjectTargetStreamer(Target &T, Target::ObjectTargetStreamerCtorTy Fn)
unsigned GetELFFlags(const MCSubtargetInfo &STI)
Triple - Helper class for working with autoconf configuration names.
Prints bundles as a newline separated list of individual instructions Duplexes are separated by a ver...
static cl::opt< bool > HexagonV60ArchVariant("mv60", cl::Hidden, cl::init(false), cl::desc("Build for Hexagon V60"))
void HexagonMCEmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size, unsigned ByteAlignment, unsigned AccessSize)
static bool isCPUValid(std::string CPU)
auto find(R &&Range, const T &Val) -> decltype(std::begin(Range))
Provide wrappers to std::find which take ranges instead of having to pass begin/end explicitly...
bool isExtendable(MCInstrInfo const &MCII, MCInst const &MCI)
virtual bool isConditionalBranch(const MCInst &Inst) const
static const char * Separator
static void RegisterMCCodeEmitter(Target &T, Target::MCCodeEmitterCtorTy Fn)
RegisterMCCodeEmitter - Register a MCCodeEmitter implementation for the given target.
const FeatureBitset & getFeatureBits() const
getFeatureBits - Return the feature bits.
static void RegisterMCRegInfo(Target &T, Target::MCRegInfoCtorFnTy Fn)
RegisterMCRegInfo - Register a MCRegisterInfo implementation for the given target.
Target - Wrapper for Target specific information.
LLVM_NODISCARD std::pair< StringRef, StringRef > split(char Separator) const
Split into two substrings around the first occurrence of a separator character.
static bool isUnconditionalBranch(TerminatorInst *Term)
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool empty() const
empty - Check if the string is empty.
RegisterMCAsmInfoFn - Helper template for registering a target assembly info implementation.
constexpr char Size[]
Key for Kernel::Arg::Metadata::mSize.
static StringRef HexagonGetArchVariant()
This is an instance of a target assembly language printer that converts an MCInst to valid target ass...
static void RegisterMCInstrInfo(Target &T, Target::MCInstrInfoCtorFnTy Fn)
RegisterMCInstrInfo - Register a MCInstrInfo implementation for the given target. ...
MCSubtargetInfo - Generic base class for all target subtargets.
size_t bundleSize(MCInst const &MCI)
static void RegisterELFStreamer(Target &T, Target::ELFStreamerCtorTy Fn)
An abstract base class for streams implementations that also support a pwrite operation.
static bool LLVM_ATTRIBUTE_UNUSED checkFeature(MCSubtargetInfo *STI, uint64_t F)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
cl::opt< bool > RelaxAll("mc-relax-all", cl::desc("When used with filetype=obj, ""relax all fixups in the emitted object file"))
A raw_ostream that writes to an std::string.
LLVM Value Representation.
Generic interface to target specific assembler backends.
static MCAsmInfo * createHexagonMCAsmInfo(const MCRegisterInfo &MRI, const Triple &TT)
const FeatureBitset Features
This class implements an extremely fast bulk output stream that can only output to a stream...
static cl::opt< bool > EnableHVX("mhvx", cl::Hidden, cl::init(false), cl::desc("Enable Hexagon Vector Extension (HVX)"))
StringRef - Represent a constant reference to a string, i.e.
static MCStreamer * createMCStreamer(Triple const &T, MCContext &Context, MCAsmBackend &MAB, raw_pwrite_stream &OS, MCCodeEmitter *Emitter, bool RelaxAll)
StringRef ParseHexagonTriple(const Triple &TT, StringRef CPU)
MCOperand const & getExtendableOperand(MCInstrInfo const &MCII, MCInst const &MCI)
MCRegisterInfo * createHexagonMCRegisterInfo(StringRef TT)
Target & getTheHexagonTarget()
cl::opt< bool > HexagonDisableDuplex
void HexagonMCEmitCommonSymbol(MCSymbol *Symbol, uint64_t Size, unsigned ByteAlignment, unsigned AccessSize)