llvm.org GIT mirror llvm / 918f55f
Allow MCCodeEmitter access to the target MCRegisterInfo. Add the MCRegisterInfo to the factories and constructors. Patch by Tom Stellard <Tom.Stellard@amd.com>. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@156828 91177308-0d34-0410-b5e6-96231b3b80d8 Jim Grosbach 8 years ago
13 changed file(s) with 30 addition(s) and 8 deletion(s). Raw diff Collapse all Expand all
107107 const MCRegisterInfo &MRI,
108108 const MCSubtargetInfo &STI);
109109 typedef MCCodeEmitter *(*MCCodeEmitterCtorTy)(const MCInstrInfo &II,
110 const MCRegisterInfo &MRI,
110111 const MCSubtargetInfo &STI,
111112 MCContext &Ctx);
112113 typedef MCStreamer *(*MCObjectStreamerCtorTy)(const Target &T,
404405
405406 /// createMCCodeEmitter - Create a target specific code emitter.
406407 MCCodeEmitter *createMCCodeEmitter(const MCInstrInfo &II,
408 const MCRegisterInfo &MRI,
407409 const MCSubtargetInfo &STI,
408410 MCContext &Ctx) const {
409411 if (!MCCodeEmitterCtorFn)
410412 return 0;
411 return MCCodeEmitterCtorFn(II, STI, Ctx);
413 return MCCodeEmitterCtorFn(II, MRI, STI, Ctx);
412414 }
413415
414416 /// createMCObjectStreamer - Create a target specific MCStreamer.
11431145
11441146 private:
11451147 static MCCodeEmitter *Allocator(const MCInstrInfo &II,
1148 const MCRegisterInfo &MRI,
11461149 const MCSubtargetInfo &STI,
11471150 MCContext &Ctx) {
11481151 return new MCCodeEmitterImpl();
164164 Context->setAllowTemporaryLabels(false);
165165
166166 const MCAsmInfo &MAI = *getMCAsmInfo();
167 const MCRegisterInfo &MRI = *getTarget().createMCRegInfo(getTargetTriple());
167168 const MCSubtargetInfo &STI = getSubtarget();
168169 OwningPtr AsmStreamer;
169170
179180 MCAsmBackend *MAB = 0;
180181 if (ShowMCEncoding) {
181182 const MCSubtargetInfo &STI = getSubtarget();
182 MCE = getTarget().createMCCodeEmitter(*getInstrInfo(), STI, *Context);
183 MCE = getTarget().createMCCodeEmitter(*getInstrInfo(), MRI, STI,
184 *Context);
183185 MAB = getTarget().createMCAsmBackend(getTargetTriple());
184186 }
185187
197199 case CGFT_ObjectFile: {
198200 // Create the code emitter for the target if it exists. If not, .o file
199201 // emission fails.
200 MCCodeEmitter *MCE = getTarget().createMCCodeEmitter(*getInstrInfo(), STI,
201 *Context);
202 MCCodeEmitter *MCE = getTarget().createMCCodeEmitter(*getInstrInfo(), MRI,
203 STI, *Context);
202204 MCAsmBackend *MAB = getTarget().createMCAsmBackend(getTargetTriple());
203205 if (MCE == 0 || MAB == 0)
204206 return true;
270272
271273 // Create the code emitter for the target if it exists. If not, .o file
272274 // emission fails.
275 const MCRegisterInfo &MRI = *getTarget().createMCRegInfo(getTargetTriple());
273276 const MCSubtargetInfo &STI = getSubtarget();
274 MCCodeEmitter *MCE = getTarget().createMCCodeEmitter(*getInstrInfo(),STI,
275 *Ctx);
277 MCCodeEmitter *MCE = getTarget().createMCCodeEmitter(*getInstrInfo(), MRI,
278 STI, *Ctx);
276279 MCAsmBackend *MAB = getTarget().createMCAsmBackend(getTargetTriple());
277280 if (MCE == 0 || MAB == 0)
278281 return true;
335335 } // end anonymous namespace
336336
337337 MCCodeEmitter *llvm::createARMMCCodeEmitter(const MCInstrInfo &MCII,
338 const MCRegisterInfo &MRI,
338339 const MCSubtargetInfo &STI,
339340 MCContext &Ctx) {
340341 return new ARMMCCodeEmitter(MCII, STI, Ctx);
2222 class MCContext;
2323 class MCInstrInfo;
2424 class MCObjectWriter;
25 class MCRegisterInfo;
2526 class MCSubtargetInfo;
2627 class StringRef;
2728 class Target;
4041 }
4142
4243 MCCodeEmitter *createARMMCCodeEmitter(const MCInstrInfo &MCII,
44 const MCRegisterInfo &MRI,
4345 const MCSubtargetInfo &STI,
4446 MCContext &Ctx);
4547
9797
9898
9999 MCCodeEmitter *llvm::createMBlazeMCCodeEmitter(const MCInstrInfo &MCII,
100 const MCRegisterInfo &MRI,
100101 const MCSubtargetInfo &STI,
101102 MCContext &Ctx) {
102103 return new MBlazeMCCodeEmitter(MCII, STI, Ctx);
2121 class MCCodeEmitter;
2222 class MCInstrInfo;
2323 class MCObjectWriter;
24 class MCRegisterInfo;
2425 class MCSubtargetInfo;
2526 class Target;
2627 class StringRef;
2930 extern Target TheMBlazeTarget;
3031
3132 MCCodeEmitter *createMBlazeMCCodeEmitter(const MCInstrInfo &MCII,
33 const MCRegisterInfo &MRI,
3234 const MCSubtargetInfo &STI,
3335 MCContext &Ctx);
3436
9090 } // namespace
9191
9292 MCCodeEmitter *llvm::createMipsMCCodeEmitterEB(const MCInstrInfo &MCII,
93 const MCRegisterInfo &MRI,
9394 const MCSubtargetInfo &STI,
9495 MCContext &Ctx)
9596 {
9798 }
9899
99100 MCCodeEmitter *llvm::createMipsMCCodeEmitterEL(const MCInstrInfo &MCII,
101 const MCRegisterInfo &MRI,
100102 const MCSubtargetInfo &STI,
101103 MCContext &Ctx)
102104 {
2121 class MCContext;
2222 class MCInstrInfo;
2323 class MCObjectWriter;
24 class MCRegisterInfo;
2425 class MCSubtargetInfo;
2526 class StringRef;
2627 class Target;
3233 extern Target TheMips64elTarget;
3334
3435 MCCodeEmitter *createMipsMCCodeEmitterEB(const MCInstrInfo &MCII,
36 const MCRegisterInfo &MRI,
3537 const MCSubtargetInfo &STI,
3638 MCContext &Ctx);
3739 MCCodeEmitter *createMipsMCCodeEmitterEL(const MCInstrInfo &MCII,
40 const MCRegisterInfo &MRI,
3841 const MCSubtargetInfo &STI,
3942 MCContext &Ctx);
4043
7676 } // end anonymous namespace
7777
7878 MCCodeEmitter *llvm::createPPCMCCodeEmitter(const MCInstrInfo &MCII,
79 const MCRegisterInfo &MRI,
7980 const MCSubtargetInfo &STI,
8081 MCContext &Ctx) {
8182 return new PPCMCCodeEmitter(MCII, STI, Ctx);
2121 class MCContext;
2222 class MCInstrInfo;
2323 class MCObjectWriter;
24 class MCRegisterInfo;
2425 class MCSubtargetInfo;
2526 class Target;
2627 class StringRef;
3031 extern Target ThePPC64Target;
3132
3233 MCCodeEmitter *createPPCMCCodeEmitter(const MCInstrInfo &MCII,
34 const MCRegisterInfo &MRI,
3335 const MCSubtargetInfo &STI,
3436 MCContext &Ctx);
3537
138138
139139
140140 MCCodeEmitter *llvm::createX86MCCodeEmitter(const MCInstrInfo &MCII,
141 const MCRegisterInfo &MRI,
141142 const MCSubtargetInfo &STI,
142143 MCContext &Ctx) {
143144 return new X86MCCodeEmitter(MCII, STI, Ctx);
7575 }
7676
7777 MCCodeEmitter *createX86MCCodeEmitter(const MCInstrInfo &MCII,
78 const MCRegisterInfo &MRI,
7879 const MCSubtargetInfo &STI,
7980 MCContext &Ctx);
8081
407407 MCCodeEmitter *CE = 0;
408408 MCAsmBackend *MAB = 0;
409409 if (ShowEncoding) {
410 CE = TheTarget->createMCCodeEmitter(*MCII, *STI, Ctx);
410 CE = TheTarget->createMCCodeEmitter(*MCII, *MRI, *STI, Ctx);
411411 MAB = TheTarget->createMCAsmBackend(TripleName);
412412 }
413413 Str.reset(TheTarget->createAsmStreamer(Ctx, FOS, /*asmverbose*/true,
420420 Str.reset(createNullStreamer(Ctx));
421421 } else {
422422 assert(FileType == OFT_ObjectFile && "Invalid file type!");
423 MCCodeEmitter *CE = TheTarget->createMCCodeEmitter(*MCII, *STI, Ctx);
423 MCCodeEmitter *CE = TheTarget->createMCCodeEmitter(*MCII, *MRI, *STI, Ctx);
424424 MCAsmBackend *MAB = TheTarget->createMCAsmBackend(TripleName);
425425 Str.reset(TheTarget->createMCObjectStreamer(TripleName, Ctx, *MAB,
426426 FOS, CE, RelaxAll,