Go to the documentation of this file.
38 cl::desc(
"Enable generating trap for unreachable"));
42 assert(
MRI &&
"Unable to create reg info");
44 assert(
MII &&
"Unable to create instruction info");
51 assert(
STI &&
"Unable to create subtarget info");
59 assert(TmpAsmInfo &&
"MCAsmInfo not initialized. "
60 "Make sure you include the correct TargetSelect.h"
61 "and that InitializeAllTargetMCs() is being invoked!");
132 if (
auto Err = MCStreamerOrErr.
takeError())
149 Context.setAllowTemporaryLabels(
false);
156 std::unique_ptr<MCStreamer> AsmStreamer;
164 std::unique_ptr<MCCodeEmitter> MCE;
168 bool UseDwarfDirectory =
false;
171 UseDwarfDirectory =
false;
174 UseDwarfDirectory =
true;
181 std::unique_ptr<MCAsmBackend> MAB(
183 auto FOut = std::make_unique<formatted_raw_ostream>(Out);
196 return make_error<StringError>(
"createMCCodeEmitter failed",
201 return make_error<StringError>(
"createMCAsmBackend failed",
205 AsmStreamer.reset(
getTarget().createMCObjectStreamer(
206 T,
Context, std::unique_ptr<MCAsmBackend>(MAB),
256 bool DisableVerify) {
264 "Cannot emit MC with limited codegen pipeline");
284 std::unique_ptr<MCStreamer> AsmStreamer(
getTarget().createMCObjectStreamer(
void setRelaxELFRelocations(bool V)
This is an optimization pass for GlobalISel generic memory operations.
std::unique_ptr< const MCSubtargetInfo > STI
const MCContext & getContext() const
static bool willCompleteCodeGenPipeline()
Returns true if none of the -stop-before and -stop-after options is set.
Context object for machine code objects.
const Target & TheTarget
The Target that this machine was created for.
Target - Wrapper for Target specific information.
This class is intended to be used as a base class for asm properties and features specific to the tar...
MCAsmInfo * createMCAsmInfo(const MCRegisterInfo &MRI, StringRef TheTriple, const MCTargetOptions &Options) const
createMCAsmInfo - Create a MCAsmInfo implementation for the specified target triple.
const MCRegisterInfo * getMCRegisterInfo() const
Triple - Helper class for working with autoconf configuration names.
unsigned TrapUnreachable
Emit target-specific trap instruction for 'unreachable' IR instructions.
std::unique_ptr< const MCInstrInfo > MII
MachineModuleInfo & getMMI()
DebugCompressionType CompressDebugSections
Compress DWARF debug sections.
MCStreamer * createAsmStreamer(MCContext &Ctx, std::unique_ptr< formatted_raw_ostream > OS, bool IsVerboseAsm, bool UseDwarfDirectory, MCInstPrinter *InstPrint, std::unique_ptr< MCCodeEmitter > &&CE, std::unique_ptr< MCAsmBackend > &&TAB, bool ShowInst) const
unsigned getAssemblerDialect() const
Tagged union holding either a T or a Error.
std::unique_ptr< MCObjectWriter > createDwoObjectWriter(raw_pwrite_stream &OS, raw_pwrite_stream &DwoOS) const
Create an MCObjectWriter that writes two object files: a .o file which is linked into the final progr...
MCInstrInfo * createMCInstrInfo() const
createMCInstrInfo - Create a MCInstrInfo implementation.
MCRegisterInfo * createMCRegInfo(StringRef TT) const
createMCRegInfo - Create a MCRegisterInfo implementation.
MCCodeEmitter * createMCCodeEmitter(const MCInstrInfo &II, MCContext &Ctx) const
createMCCodeEmitter - Create a target specific code emitter.
Streaming machine code generation interface.
print alias Alias Set Printer
void setExceptionsType(ExceptionHandling EH)
Generic interface to target specific assembler backends.
void setDisableVerify(bool Disable)
bool enableDwarfFileDirectoryDefault() const
MCTargetOptions MCOptions
Machine level options.
ExceptionHandling ExceptionModel
What exception model to use.
DwarfDirectory MCUseDwarfDirectory
void setAllowTemporaryLabels(bool Value)
const char LLVMTargetMachineRef LLVMPassBuilderOptionsRef Options
bool addPassesToEmitFile(PassManagerBase &PM, raw_pwrite_stream &Out, raw_pwrite_stream *DwoOut, CodeGenFileType FileType, bool DisableVerify=true, MachineModuleInfoWrapperPass *MMIWP=nullptr) override
Add passes to the specified pass manager to get the specified file emitted.
unsigned RelaxELFRelocations
static TargetPassConfig * addPassesToGenerateCode(LLVMTargetMachine &TM, PassManagerBase &PM, bool DisableVerify, MachineModuleInfoWrapperPass &MMIWP)
addPassesToX helper drives creation and initialization of TargetPassConfig.
const MCInstrInfo * getMCInstrInfo() const
virtual void setUseIntegratedAssembler(bool Value)
Set whether assembly (inline or otherwise) should be parsed.
virtual void add(Pass *P)=0
Add a pass to the queue of passes to run.
FileType
Defines the file type this file represents.
Target-Independent Code Generator Pass Configuration Options.
bool addPassesToEmitMC(PassManagerBase &PM, MCContext *&Ctx, raw_pwrite_stream &Out, bool DisableVerify=true) override
Add passes to the specified pass manager to get machine code emitted with the MCJIT.
EmitDwarfUnwindType EmitDwarfUnwind
virtual void addMachinePasses()
Add the complete, standard set of LLVM CodeGen passes.
LLVMTargetMachine(const Target &T, StringRef DataLayoutString, const Triple &TT, StringRef CPU, StringRef FS, const TargetOptions &Options, Reloc::Model RM, CodeModel::Model CM, CodeGenOpt::Level OL)
bool MCIncrementalLinkerCompatible
An abstract base class for streams implementations that also support a pwrite operation.
TargetTransformInfo getTargetTransformInfo(const Function &F) const override
Get a TargetTransformInfo implementation for the target.
This is an instance of a target assembly language printer that converts an MCInst to valid target ass...
MachineFunctionPass * createPrintMIRPass(raw_ostream &OS)
MIRPrinting pass - this pass prints out the LLVM IR into the given stream using the MIR serialization...
const MCSubtargetInfo * getMCSubtargetInfo() const
static cl::opt< bool > EnableTrapUnreachable("trap-unreachable", cl::Hidden, cl::desc("Enable generating trap for unreachable"))
compiles ldr LCPI1_0 ldr ldr mov lsr tst moveq r1 ldr LCPI1_1 and r0 bx lr It would be better to do something like to fold the shift into the conditional move
CodeGenOpt::Level OptLevel
MCStreamer * createNullStreamer(MCContext &Ctx)
Create a dummy machine code streamer, which does nothing.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
Primary interface to the complete machine description for the target machine.
AsmPrinter * createAsmPrinter(TargetMachine &TM, std::unique_ptr< MCStreamer > &&Streamer) const
createAsmPrinter - Create a target specific assembly printer pass.
bool addISelPasses()
High level function that adds all passes necessary to go from llvm IR representation to the MI repres...
virtual void setParseInlineAsmUsingAsmParser(bool Value)
Set whether target want to use AsmParser to parse inlineasm.
FunctionPass * createFreeMachineFunctionPass()
This pass frees the memory occupied by the MachineFunction.
const MCAsmInfo * getMCAsmInfo() const
Return target specific asm information.
MCAsmBackend * createMCAsmBackend(const MCSubtargetInfo &STI, const MCRegisterInfo &MRI, const MCTargetOptions &Options) const
createMCAsmBackend - Create a target specific assembly parser.
CodeGenFileType
These enums are meant to be passed into addPassesToEmitFile to indicate what type of file to emit,...
StringRef - Represent a constant reference to a string, i.e.
std::pair< int, int > BinutilsVersion
If greater than 0, override the default value of MCAsmInfo::BinutilsVersion.
StringRef getTargetFeatureString() const
add sub stmia L5 ldr r0 bl L_printf $stub Instead of a and a wouldn t it be better to do three moves *Return an aggregate type is even return S
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
void setBinutilsVersion(std::pair< int, int > Value)
MCSubtargetInfo * createMCSubtargetInfo(StringRef TheTriple, StringRef CPU, StringRef Features) const
createMCSubtargetInfo - Create a MCSubtargetInfo implementation.
Interface to description of machine instruction set.
MCInstPrinter * createMCInstPrinter(const Triple &T, unsigned SyntaxVariant, const MCAsmInfo &MAI, const MCInstrInfo &MII, const MCRegisterInfo &MRI) const
Concrete BasicTTIImpl that can be used if no further customization is needed.
std::error_code inconvertibleErrorCode()
The value returned by this function can be returned from convertToErrorCode for Error values where no...
MCCodeEmitter - Generic instruction encoding interface.
This class describes a target machine that is implemented with the LLVM target-independent code gener...
void setCompressDebugSections(DebugCompressionType CompressDebugSections)
@ None
No exception support.
Error takeError()
Take ownership of the stored error.
StringRef getTargetCPU() const
std::unique_ptr< MCObjectWriter > createObjectWriter(raw_pwrite_stream &OS) const
Create a new MCObjectWriter instance for use by the assembler backend to emit the final object file.
std::unique_ptr< const MCAsmInfo > AsmInfo
Contains target specific asm information.
const Triple & getTargetTriple() const
virtual void setPreserveAsmComments(bool Value)
Set whether assembly (inline or otherwise) should be parsed.
PassManagerBase - An abstract interface to allow code to add passes to a pass manager without having ...
const char LLVMTargetMachineRef TM
bool PreserveAsmComments
Preserve Comments in Assembly.
FunctionPass class - This class is used to implement most global optimizations.
unsigned DisableIntegratedAS
Disable the integrated assembler.
const Target & getTarget() const
Generic base class for all target subtargets.
std::unique_ptr< const MCRegisterInfo > MRI
Expected< std::unique_ptr< MCStreamer > > createMCStreamer(raw_pwrite_stream &Out, raw_pwrite_stream *DwoOut, CodeGenFileType FileType, MCContext &Ctx)
virtual void reset()
State management.
bool addAsmPrinter(PassManagerBase &PM, raw_pwrite_stream &Out, raw_pwrite_stream *DwoOut, CodeGenFileType FileType, MCContext &Context)
Adds an AsmPrinter pass to the pipeline that prints assembly or machine code from the MI representati...