comparison lib/CodeGen/AsmPrinter/OcamlGCPrinter.cpp @ 77:54457678186b LLVM3.6

LLVM 3.6
author Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
date Mon, 08 Sep 2014 22:06:00 +0900
parents 95c75e76d11b
children 60c9769439b8
comparison
equal deleted inserted replaced
34:e874dbf0ad9d 77:54457678186b
14 #include "llvm/CodeGen/GCs.h" 14 #include "llvm/CodeGen/GCs.h"
15 #include "llvm/ADT/SmallString.h" 15 #include "llvm/ADT/SmallString.h"
16 #include "llvm/CodeGen/AsmPrinter.h" 16 #include "llvm/CodeGen/AsmPrinter.h"
17 #include "llvm/CodeGen/GCMetadataPrinter.h" 17 #include "llvm/CodeGen/GCMetadataPrinter.h"
18 #include "llvm/IR/DataLayout.h" 18 #include "llvm/IR/DataLayout.h"
19 #include "llvm/IR/Mangler.h"
19 #include "llvm/IR/Module.h" 20 #include "llvm/IR/Module.h"
20 #include "llvm/MC/MCAsmInfo.h" 21 #include "llvm/MC/MCAsmInfo.h"
21 #include "llvm/MC/MCContext.h" 22 #include "llvm/MC/MCContext.h"
22 #include "llvm/MC/MCStreamer.h" 23 #include "llvm/MC/MCStreamer.h"
23 #include "llvm/MC/MCSymbol.h" 24 #include "llvm/MC/MCSymbol.h"
24 #include "llvm/Support/ErrorHandling.h" 25 #include "llvm/Support/ErrorHandling.h"
25 #include "llvm/Support/FormattedStream.h" 26 #include "llvm/Support/FormattedStream.h"
26 #include "llvm/Target/Mangler.h"
27 #include "llvm/Target/TargetLoweringObjectFile.h" 27 #include "llvm/Target/TargetLoweringObjectFile.h"
28 #include "llvm/Target/TargetMachine.h" 28 #include "llvm/Target/TargetMachine.h"
29 #include "llvm/Target/TargetSubtargetInfo.h"
29 #include <cctype> 30 #include <cctype>
30 using namespace llvm; 31 using namespace llvm;
31 32
32 namespace { 33 namespace {
33 34
34 class OcamlGCMetadataPrinter : public GCMetadataPrinter { 35 class OcamlGCMetadataPrinter : public GCMetadataPrinter {
35 public: 36 public:
36 void beginAssembly(AsmPrinter &AP); 37 void beginAssembly(AsmPrinter &AP) override;
37 void finishAssembly(AsmPrinter &AP); 38 void finishAssembly(AsmPrinter &AP) override;
38 }; 39 };
39 40
40 } 41 }
41 42
42 static GCMetadataPrinterRegistry::Add<OcamlGCMetadataPrinter> 43 static GCMetadataPrinterRegistry::Add<OcamlGCMetadataPrinter>
89 /// Note that this precludes programs from stack frames larger than 64K 90 /// Note that this precludes programs from stack frames larger than 64K
90 /// (FrameSize and LiveOffsets would overflow). FrameTablePrinter will abort if 91 /// (FrameSize and LiveOffsets would overflow). FrameTablePrinter will abort if
91 /// either condition is detected in a function which uses the GC. 92 /// either condition is detected in a function which uses the GC.
92 /// 93 ///
93 void OcamlGCMetadataPrinter::finishAssembly(AsmPrinter &AP) { 94 void OcamlGCMetadataPrinter::finishAssembly(AsmPrinter &AP) {
94 unsigned IntPtrSize = AP.TM.getDataLayout()->getPointerSize(); 95 unsigned IntPtrSize =
96 AP.TM.getSubtargetImpl()->getDataLayout()->getPointerSize();
95 97
96 AP.OutStreamer.SwitchSection(AP.getObjFileLowering().getTextSection()); 98 AP.OutStreamer.SwitchSection(AP.getObjFileLowering().getTextSection());
97 EmitCamlGlobal(getModule(), AP, "code_end"); 99 EmitCamlGlobal(getModule(), AP, "code_end");
98 100
99 AP.OutStreamer.SwitchSection(AP.getObjFileLowering().getDataSection()); 101 AP.OutStreamer.SwitchSection(AP.getObjFileLowering().getDataSection());