aboutsummaryrefslogtreecommitdiff
path: root/tools
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
parent29012319cd1a6dee716c3149ead614a8271f7338 (diff)
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')
-rw-r--r--tools/llvm-mc/llvm-mc.cpp17
-rw-r--r--tools/lto/LTOCodeGenerator.cpp2
-rw-r--r--tools/lto/LTOModule.cpp2
3 files changed, 14 insertions, 7 deletions
diff --git a/tools/llvm-mc/llvm-mc.cpp b/tools/llvm-mc/llvm-mc.cpp
index 46eb3727d6..1d42c4666a 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 {
diff --git a/tools/lto/LTOCodeGenerator.cpp b/tools/lto/LTOCodeGenerator.cpp
index f1c5680add..d49e6a77b3 100644
--- a/tools/lto/LTOCodeGenerator.cpp
+++ b/tools/lto/LTOCodeGenerator.cpp
@@ -347,7 +347,7 @@ void LTOCodeGenerator::applyScopeRestrictions() {
// mark which symbols can not be internalized
if (!_mustPreserveSymbols.empty()) {
- MCContext Context(*_target->getMCAsmInfo());
+ MCContext Context(*_target->getMCAsmInfo(), NULL);
Mangler mangler(Context, *_target->getTargetData());
std::vector<const char*> mustPreserveList;
for (Module::iterator f = mergedModule->begin(),
diff --git a/tools/lto/LTOModule.cpp b/tools/lto/LTOModule.cpp
index 2453e2b2c2..a33b8b473e 100644
--- a/tools/lto/LTOModule.cpp
+++ b/tools/lto/LTOModule.cpp
@@ -428,7 +428,7 @@ void LTOModule::lazyParseSymbols() {
_symbolsParsed = true;
// Use mangler to add GlobalPrefix to names to match linker names.
- MCContext Context(*_target->getMCAsmInfo());
+ MCContext Context(*_target->getMCAsmInfo(), NULL);
Mangler mangler(Context, *_target->getTargetData());
// add functions