aboutsummaryrefslogtreecommitdiffstats
path: root/tools/llvm-mc
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2010-12-09 23:48:29 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2010-12-09 23:48:29 +0000
commit1c952b9cc98e84b28f68f0f6cf11197263f89863 (patch)
tree10680a5a866de550f53f801df27d9192f02cae80 /tools/llvm-mc
parent29012319cd1a6dee716c3149ead614a8271f7338 (diff)
downloadexternal_llvm-1c952b9cc98e84b28f68f0f6cf11197263f89863.zip
external_llvm-1c952b9cc98e84b28f68f0f6cf11197263f89863.tar.gz
external_llvm-1c952b9cc98e84b28f68f0f6cf11197263f89863.tar.bz2
Initial support for the cfi directives. This is just enough to get
f: .cfi_startproc nop .cfi_endproc assembled (on ELF). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121434 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-mc')
-rw-r--r--tools/llvm-mc/llvm-mc.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/tools/llvm-mc/llvm-mc.cpp b/tools/llvm-mc/llvm-mc.cpp
index 46eb372..1d42c46 100644
--- a/tools/llvm-mc/llvm-mc.cpp
+++ b/tools/llvm-mc/llvm-mc.cpp
@@ -24,6 +24,9 @@
#include "llvm/Target/TargetData.h"
#include "llvm/Target/TargetRegistry.h"
#include "llvm/Target/SubtargetFeature.h" // FIXME.
+#include "llvm/Target/TargetAsmInfo.h" // FIXME.
+#include "llvm/Target/TargetLowering.h" // FIXME.
+#include "llvm/Target/TargetLoweringObjectFile.h" // FIXME.
#include "llvm/Target/TargetMachine.h" // FIXME.
#include "llvm/Target/TargetSelect.h"
#include "llvm/ADT/OwningPtr.h"
@@ -298,8 +301,6 @@ static int AssembleInput(const char *ProgName) {
llvm::OwningPtr<MCAsmInfo> MAI(TheTarget->createAsmInfo(TripleName));
assert(MAI && "Unable to create target asm info!");
- MCContext Ctx(*MAI);
-
// Package up features to be passed to target/subtarget
std::string FeaturesStr;
if (MCPU.size()) {
@@ -321,6 +322,9 @@ static int AssembleInput(const char *ProgName) {
return 1;
}
+ const TargetAsmInfo tai(*TM);
+ MCContext Ctx(*MAI, &tai);
+
OwningPtr<tool_output_file> Out(GetOutputStream());
if (!Out)
return 1;
@@ -328,15 +332,18 @@ static int AssembleInput(const char *ProgName) {
formatted_raw_ostream FOS(Out->os());
OwningPtr<MCStreamer> Str;
+ const TargetLoweringObjectFile &TLOF =
+ TM->getTargetLowering()->getObjFileLowering();
+ const_cast<TargetLoweringObjectFile&>(TLOF).Initialize(Ctx, *TM);
+
if (FileType == OFT_AssemblyFile) {
MCInstPrinter *IP =
TheTarget->createMCInstPrinter(OutputAsmVariant, *MAI);
MCCodeEmitter *CE = 0;
if (ShowEncoding)
CE = TheTarget->createCodeEmitter(*TM, Ctx);
- Str.reset(TheTarget->createAsmStreamer(Ctx, FOS,
- TM->getTargetData()->isLittleEndian(),
- /*asmverbose*/true, IP, CE, ShowInst));
+ Str.reset(TheTarget->createAsmStreamer(Ctx, FOS, /*asmverbose*/true,
+ /*useLoc*/ true, IP, CE, ShowInst));
} else if (FileType == OFT_Null) {
Str.reset(createNullStreamer(Ctx));
} else {