llvm.org GIT mirror llvm / 86020e4
give MCCodeEmitters access to the current MCContext. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96038 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Lattner 10 years ago
6 changed file(s) with 25 addition(s) and 16 deletion(s). Raw diff Collapse all Expand all
7171 const MCAsmInfo &MAI,
7272 raw_ostream &O);
7373 typedef MCCodeEmitter *(*CodeEmitterCtorTy)(const Target &T,
74 TargetMachine &TM);
74 TargetMachine &TM,
75 MCContext &Ctx);
7576
7677 private:
7778 /// Next - The next registered target in the linked list, maintained by the
235236
236237
237238 /// createCodeEmitter - Create a target specific code emitter.
238 MCCodeEmitter *createCodeEmitter(TargetMachine &TM) const {
239 MCCodeEmitter *createCodeEmitter(TargetMachine &TM, MCContext &Ctx) const {
239240 if (!CodeEmitterCtorFn)
240241 return 0;
241 return CodeEmitterCtorFn(*this, TM);
242 return CodeEmitterCtorFn(*this, TM, Ctx);
242243 }
243244
244245 /// @}
612613 }
613614
614615 private:
615 static MCCodeEmitter *Allocator(const Target &T, TargetMachine &TM) {
616 return new CodeEmitterImpl(T, TM);
616 static MCCodeEmitter *Allocator(const Target &T, TargetMachine &TM,
617 MCContext &Ctx) {
618 return new CodeEmitterImpl(T, TM, Ctx);
617619 }
618620 };
619621
140140 case CGFT_ObjectFile: {
141141 // Create the code emitter for the target if it exists. If not, .o file
142142 // emission fails.
143 MCCodeEmitter *MCE = getTarget().createCodeEmitter(*this);
143 MCCodeEmitter *MCE = getTarget().createCodeEmitter(*this, *Context);
144144 if (MCE == 0)
145145 return true;
146146
2222 class FunctionPass;
2323 class MachineCodeEmitter;
2424 class MCCodeEmitter;
25 class MCContext;
2526 class JITCodeEmitter;
2627 class Target;
2728 class formatted_raw_ostream;
4849 FunctionPass *createX86JITCodeEmitterPass(X86TargetMachine &TM,
4950 JITCodeEmitter &JCE);
5051
51 MCCodeEmitter *createHeinousX86MCCodeEmitter(const Target &, TargetMachine &TM);
52 MCCodeEmitter *createX86_32MCCodeEmitter(const Target &, TargetMachine &TM);
53 MCCodeEmitter *createX86_64MCCodeEmitter(const Target &, TargetMachine &TM);
52 MCCodeEmitter *createHeinousX86MCCodeEmitter(const Target &, TargetMachine &TM,
53 MCContext &Ctx);
54 MCCodeEmitter *createX86_32MCCodeEmitter(const Target &, TargetMachine &TM,
55 MCContext &Ctx);
56 MCCodeEmitter *createX86_64MCCodeEmitter(const Target &, TargetMachine &TM,
57 MCContext &Ctx);
5458
5559 /// createX86EmitCodeToMemory - Returns a pass that converts a register
5660 /// allocated function into raw machine code in a dynamically
12101210
12111211 // Ok, now you can look.
12121212 MCCodeEmitter *llvm::createHeinousX86MCCodeEmitter(const Target &T,
1213 TargetMachine &TM) {
1213 TargetMachine &TM,
1214 MCContext &Ctx) {
12141215
12151216 // FIXME: Remove the heinous one when the new one works.
12161217 if (EnableNewEncoder) {
12171218 if (TM.getTargetData()->getPointerSize() == 4)
1218 return createX86_32MCCodeEmitter(T, TM);
1219 return createX86_64MCCodeEmitter(T, TM);
1219 return createX86_32MCCodeEmitter(T, TM, Ctx);
1220 return createX86_64MCCodeEmitter(T, TM, Ctx);
12201221 }
12211222
12221223 return new X86MCCodeEmitter(static_cast(TM));
119119
120120
121121 MCCodeEmitter *llvm::createX86_32MCCodeEmitter(const Target &,
122 TargetMachine &TM) {
122 TargetMachine &TM,
123 MCContext &Ctx) {
123124 return new X86MCCodeEmitter(TM, false);
124125 }
125126
126127 MCCodeEmitter *llvm::createX86_64MCCodeEmitter(const Target &,
127 TargetMachine &TM) {
128 TargetMachine &TM,
129 MCContext &Ctx) {
128130 return new X86MCCodeEmitter(TM, true);
129131 }
130132
265265 if (FileType == OFT_AssemblyFile) {
266266 IP.reset(TheTarget->createMCInstPrinter(OutputAsmVariant, *MAI, *Out));
267267 if (ShowEncoding)
268 CE.reset(TheTarget->createCodeEmitter(*TM));
268 CE.reset(TheTarget->createCodeEmitter(*TM, Ctx));
269269 Str.reset(createAsmStreamer(Ctx, *Out, *MAI,
270270 TM->getTargetData()->isLittleEndian(),
271271 /*asmverbose*/true, IP.get(), CE.get(),
272272 ShowInst));
273273 } else {
274274 assert(FileType == OFT_ObjectFile && "Invalid file type!");
275 CE.reset(TheTarget->createCodeEmitter(*TM));
275 CE.reset(TheTarget->createCodeEmitter(*TM, Ctx));
276276 Str.reset(createMachOStreamer(Ctx, *Out, CE.get()));
277277 }
278278