summaryrefslogtreecommitdiff
path: root/lib/Target/SystemZ/AsmPrinter/SystemZAsmPrinter.cpp
diff options
context:
space:
mode:
authorAnton Korobeynikov <asl@math.spbu.ru>2009-07-16 14:36:52 +0000
committerAnton Korobeynikov <asl@math.spbu.ru>2009-07-16 14:36:52 +0000
commit7df8462038c4393771a0961c60a2686169e4fd9a (patch)
treef1772da62843e3dca4748ab533e1931bfa29abc0 /lib/Target/SystemZ/AsmPrinter/SystemZAsmPrinter.cpp
parentc9751806242a1e893f05cdbd3cc22c4685a971d4 (diff)
downloadllvm-7df8462038c4393771a0961c60a2686169e4fd9a.tar.gz
llvm-7df8462038c4393771a0961c60a2686169e4fd9a.tar.bz2
llvm-7df8462038c4393771a0961c60a2686169e4fd9a.tar.xz
Unbreak
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76064 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/SystemZ/AsmPrinter/SystemZAsmPrinter.cpp')
-rw-r--r--lib/Target/SystemZ/AsmPrinter/SystemZAsmPrinter.cpp42
1 files changed, 22 insertions, 20 deletions
diff --git a/lib/Target/SystemZ/AsmPrinter/SystemZAsmPrinter.cpp b/lib/Target/SystemZ/AsmPrinter/SystemZAsmPrinter.cpp
index f778197be7..24f4114ebc 100644
--- a/lib/Target/SystemZ/AsmPrinter/SystemZAsmPrinter.cpp
+++ b/lib/Target/SystemZ/AsmPrinter/SystemZAsmPrinter.cpp
@@ -27,10 +27,11 @@
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/Target/TargetAsmInfo.h"
#include "llvm/Target/TargetData.h"
+#include "llvm/Target/TargetRegistry.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Support/Compiler.h"
+#include "llvm/Support/FormattedStream.h"
#include "llvm/Support/Mangler.h"
-#include "llvm/Support/raw_ostream.h"
using namespace llvm;
@@ -39,10 +40,9 @@ STATISTIC(EmittedInsts, "Number of machine instrs printed");
namespace {
class VISIBILITY_HIDDEN SystemZAsmPrinter : public AsmPrinter {
public:
- SystemZAsmPrinter(raw_ostream &O, SystemZTargetMachine &TM,
- const TargetAsmInfo *TAI,
- CodeGenOpt::Level OL, bool V)
- : AsmPrinter(O, TM, TAI, OL, V) {}
+ SystemZAsmPrinter(formatted_raw_ostream &O, TargetMachine &TM,
+ const TargetAsmInfo *TAI, bool V)
+ : AsmPrinter(O, TM, TAI, V) {}
virtual const char *getPassName() const {
return "SystemZ Assembly Printer";
@@ -85,11 +85,10 @@ namespace {
/// using the given target machine description. This should work
/// regardless of whether the function is in SSA form.
///
-FunctionPass *llvm::createSystemZCodePrinterPass(raw_ostream &o,
- SystemZTargetMachine &tm,
- CodeGenOpt::Level OptLevel,
- bool verbose) {
- return new SystemZAsmPrinter(o, tm, tm.getTargetAsmInfo(), OptLevel, verbose);
+FunctionPass *llvm::createSystemZCodePrinterPass(formatted_raw_ostream &o,
+ TargetMachine &tm,
+ bool verbose) {
+ return new SystemZAsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose);
}
bool SystemZAsmPrinter::doInitialization(Module &M) {
@@ -108,14 +107,11 @@ bool SystemZAsmPrinter::doFinalization(Module &M) {
}
void SystemZAsmPrinter::emitFunctionHeader(const MachineFunction &MF) {
+ unsigned FnAlign = MF.getAlignment();
const Function *F = MF.getFunction();
SwitchToSection(TAI->SectionForGlobal(F));
- unsigned FnAlign = 4;
- if (F->hasFnAttr(Attribute::OptimizeForSize))
- FnAlign = 1;
-
EmitAlignment(FnAlign, F);
switch (F->getLinkage()) {
@@ -201,7 +197,7 @@ void SystemZAsmPrinter::printPCRelImmOperand(const MachineInstr *MI, int OpNum)
return;
case MachineOperand::MO_GlobalAddress: {
const GlobalValue *GV = MO.getGlobal();
- std::string Name = Mang->getValueName(GV);
+ std::string Name = Mang->getMangledName(GV);
O << Name;
@@ -269,7 +265,7 @@ void SystemZAsmPrinter::printOperand(const MachineInstr *MI, int OpNum,
break;
case MachineOperand::MO_GlobalAddress: {
const GlobalValue *GV = MO.getGlobal();
- std::string Name = Mang->getValueName(GV);
+ std::string Name = Mang->getMangledName(GV);
O << Name;
break;
@@ -334,7 +330,7 @@ void SystemZAsmPrinter::printRRIAddrOperand(const MachineInstr *MI, int OpNum,
/// PrintUnmangledNameSafely - Print out the printable characters in the name.
/// Don't print things like \\n or \\0.
-static void PrintUnmangledNameSafely(const Value *V, raw_ostream &OS) {
+static void PrintUnmangledNameSafely(const Value *V, formatted_raw_ostream &OS) {
for (const char *Name = V->getNameStart(), *E = Name+V->getNameLen();
Name != E; ++Name)
if (isprint(*Name))
@@ -351,10 +347,9 @@ void SystemZAsmPrinter::printModuleLevelGV(const GlobalVariable* GVar) {
if (EmitSpecialLLVMGlobal(GVar))
return;
- std::string name = Mang->getValueName(GVar);
+ std::string name = Mang->getMangledName(GVar);
Constant *C = GVar->getInitializer();
- const Type *Type = C->getType();
- unsigned Size = TD->getTypeAllocSize(Type);
+ unsigned Size = TD->getTypeAllocSize(C->getType());
unsigned Align = std::max(1U, TD->getPreferredAlignmentLog(GVar));
printVisibility(name, GVar->getVisibility());
@@ -420,3 +415,10 @@ void SystemZAsmPrinter::printModuleLevelGV(const GlobalVariable* GVar) {
EmitGlobalConstant(C);
}
+
+// Force static initialization.
+extern "C" void LLVMInitializeSystemZAsmPrinter() {
+ extern Target TheSystemZTarget;
+ TargetRegistry::RegisterAsmPrinter(TheSystemZTarget,
+ createSystemZCodePrinterPass);
+}