mirror of
https://github.com/RPCS3/llvm.git
synced 2025-01-22 18:35:45 +00:00
Unbreak
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76064 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
c975180624
commit
7df8462038
@ -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);
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ BUILT_SOURCES = SystemZGenRegisterInfo.h.inc SystemZGenRegisterNames.inc \
|
||||
SystemZGenInstrInfo.inc SystemZGenAsmWriter.inc \
|
||||
SystemZGenDAGISel.inc SystemZGenSubtarget.inc SystemZGenCallingConv.inc
|
||||
|
||||
DIRS = AsmPrinter
|
||||
DIRS = AsmPrinter TargetInfo
|
||||
|
||||
include $(LEVEL)/Makefile.common
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
namespace llvm {
|
||||
class SystemZTargetMachine;
|
||||
class FunctionPass;
|
||||
class raw_ostream;
|
||||
class formatted_raw_ostream;
|
||||
|
||||
namespace SystemZCC {
|
||||
// SystemZ specific condition code. These correspond to SYSTEMZ_*_COND in
|
||||
@ -46,10 +46,9 @@ namespace llvm {
|
||||
|
||||
FunctionPass *createSystemZISelDag(SystemZTargetMachine &TM,
|
||||
CodeGenOpt::Level OptLevel);
|
||||
FunctionPass *createSystemZCodePrinterPass(raw_ostream &o,
|
||||
SystemZTargetMachine &tm,
|
||||
CodeGenOpt::Level OptLevel,
|
||||
bool verbose);
|
||||
FunctionPass *createSystemZCodePrinterPass(formatted_raw_ostream &o,
|
||||
TargetMachine &tm,
|
||||
bool verbose);
|
||||
|
||||
} // end namespace llvm;
|
||||
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include "llvm/Target/TargetLowering.h"
|
||||
#include "llvm/Support/Compiler.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
using namespace llvm;
|
||||
|
||||
static const unsigned subreg_even32 = 1;
|
||||
|
@ -203,7 +203,7 @@ SDValue SystemZTargetLowering::LowerCCCArguments(SDValue Op,
|
||||
|
||||
// Assign locations to all of the incoming arguments.
|
||||
SmallVector<CCValAssign, 16> ArgLocs;
|
||||
CCState CCInfo(CC, isVarArg, getTargetMachine(), ArgLocs);
|
||||
CCState CCInfo(CC, isVarArg, getTargetMachine(), ArgLocs, DAG.getContext());
|
||||
CCInfo.AnalyzeFormalArguments(Op.getNode(), CC_SystemZ);
|
||||
|
||||
assert(!isVarArg && "Varargs not supported yet");
|
||||
@ -292,7 +292,7 @@ SDValue SystemZTargetLowering::LowerCCCCallTo(SDValue Op, SelectionDAG &DAG,
|
||||
|
||||
// Analyze operands of the call, assigning locations to each operand.
|
||||
SmallVector<CCValAssign, 16> ArgLocs;
|
||||
CCState CCInfo(CC, isVarArg, getTargetMachine(), ArgLocs);
|
||||
CCState CCInfo(CC, isVarArg, getTargetMachine(), ArgLocs, DAG.getContext());
|
||||
|
||||
CCInfo.AnalyzeCallOperands(TheCall, CC_SystemZ);
|
||||
|
||||
@ -422,7 +422,8 @@ SystemZTargetLowering::LowerCallResult(SDValue Chain, SDValue InFlag,
|
||||
|
||||
// Assign locations to each value returned by this call.
|
||||
SmallVector<CCValAssign, 16> RVLocs;
|
||||
CCState CCInfo(CallingConv, isVarArg, getTargetMachine(), RVLocs);
|
||||
CCState CCInfo(CallingConv, isVarArg, getTargetMachine(), RVLocs,
|
||||
DAG.getContext());
|
||||
|
||||
CCInfo.AnalyzeCallResult(TheCall, RetCC_SystemZ);
|
||||
SmallVector<SDValue, 8> ResultVals;
|
||||
@ -468,7 +469,7 @@ SDValue SystemZTargetLowering::LowerRET(SDValue Op, SelectionDAG &DAG) {
|
||||
DebugLoc dl = Op.getDebugLoc();
|
||||
|
||||
// CCState - Info about the registers and stack slot.
|
||||
CCState CCInfo(CC, isVarArg, getTargetMachine(), RVLocs);
|
||||
CCState CCInfo(CC, isVarArg, getTargetMachine(), RVLocs, DAG.getContext());
|
||||
|
||||
// Analize return values of ISD::RET
|
||||
CCInfo.AnalyzeReturn(Op.getNode(), RetCC_SystemZ);
|
||||
|
@ -64,6 +64,11 @@ namespace llvm {
|
||||
/// DAG node.
|
||||
virtual const char *getTargetNodeName(unsigned Opcode) const;
|
||||
|
||||
/// getFunctionAlignment - Return the Log2 alignment of this function.
|
||||
virtual unsigned getFunctionAlignment(const Function *F) const {
|
||||
return 1;
|
||||
}
|
||||
|
||||
SDValue LowerFORMAL_ARGUMENTS(SDValue Op, SelectionDAG &DAG);
|
||||
SDValue LowerRET(SDValue Op, SelectionDAG &DAG);
|
||||
SDValue LowerCALL(SDValue Op, SelectionDAG &DAG);
|
||||
|
@ -18,17 +18,18 @@
|
||||
#include "llvm/Target/TargetMachineRegistry.h"
|
||||
using namespace llvm;
|
||||
|
||||
/// SystemZTargetMachineModule - Note that this is used on hosts that
|
||||
/// cannot link in a library unless there are references into the
|
||||
/// library. In particular, it seems that it is not possible to get
|
||||
/// things to work on Win32 without this. Though it is unused, do not
|
||||
/// remove it.
|
||||
extern "C" int SystemZTargetMachineModule;
|
||||
int SystemZTargetMachineModule = 0;
|
||||
extern Target TheSystemZTarget;
|
||||
namespace {
|
||||
// Register the target.
|
||||
RegisterTarget<SystemZTargetMachine> X(TheSystemZTarget,
|
||||
"systemz",
|
||||
"SystemZ [experimental]");
|
||||
}
|
||||
|
||||
// Register the target.
|
||||
static RegisterTarget<SystemZTargetMachine>
|
||||
X("systemz", "SystemZ [experimental]");
|
||||
// Force static initialization.
|
||||
extern "C" void LLVMInitializeSystemZTarget() {
|
||||
|
||||
}
|
||||
|
||||
const TargetAsmInfo *SystemZTargetMachine::createTargetAsmInfo() const {
|
||||
// FIXME: Handle Solaris subtarget someday :)
|
||||
@ -37,9 +38,13 @@ const TargetAsmInfo *SystemZTargetMachine::createTargetAsmInfo() const {
|
||||
|
||||
/// SystemZTargetMachine ctor - Create an ILP64 architecture model
|
||||
///
|
||||
SystemZTargetMachine::SystemZTargetMachine(const Module &M, const std::string &FS)
|
||||
: Subtarget(*this, M, FS),
|
||||
DataLayout("E-p:64:64:64-i8:8:16-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-f128:128:128-a0:16:16"),
|
||||
SystemZTargetMachine::SystemZTargetMachine(const Target &T,
|
||||
const Module &M,
|
||||
const std::string &FS)
|
||||
: LLVMTargetMachine(T),
|
||||
Subtarget(*this, M, FS),
|
||||
DataLayout("E-p:64:64:64-i8:8:16-i16:16:16-i32:32:32-i64:64:64-f32:32:32"
|
||||
"-f64:64:64-f128:128:128-a0:16:16"),
|
||||
InstrInfo(*this), TLInfo(*this),
|
||||
FrameInfo(TargetFrameInfo::StackGrowsDown, 8, -160) {
|
||||
|
||||
@ -54,15 +59,6 @@ bool SystemZTargetMachine::addInstSelector(PassManagerBase &PM,
|
||||
return false;
|
||||
}
|
||||
|
||||
bool SystemZTargetMachine::addAssemblyEmitter(PassManagerBase &PM,
|
||||
CodeGenOpt::Level OptLevel,
|
||||
bool Verbose,
|
||||
raw_ostream &Out) {
|
||||
// Output assembly language.
|
||||
PM.add(createSystemZCodePrinterPass(Out, *this, OptLevel, Verbose));
|
||||
return false;
|
||||
}
|
||||
|
||||
unsigned SystemZTargetMachine::getModuleMatchQuality(const Module &M) {
|
||||
std::string TT = M.getTargetTriple();
|
||||
|
||||
|
@ -41,7 +41,7 @@ protected:
|
||||
virtual const TargetAsmInfo *createTargetAsmInfo() const;
|
||||
|
||||
public:
|
||||
SystemZTargetMachine(const Module &M, const std::string &FS);
|
||||
SystemZTargetMachine(const Target &T, const Module &M, const std::string &FS);
|
||||
|
||||
virtual const TargetFrameInfo *getFrameInfo() const { return &FrameInfo; }
|
||||
virtual const SystemZInstrInfo *getInstrInfo() const { return &InstrInfo; }
|
||||
@ -57,9 +57,6 @@ public:
|
||||
}
|
||||
|
||||
virtual bool addInstSelector(PassManagerBase &PM, CodeGenOpt::Level OptLevel);
|
||||
virtual bool addAssemblyEmitter(PassManagerBase &PM,
|
||||
CodeGenOpt::Level OptLevel, bool Verbose,
|
||||
raw_ostream &Out);
|
||||
static unsigned getModuleMatchQuality(const Module &M);
|
||||
}; // SystemZTargetMachine.
|
||||
|
||||
|
6
lib/Target/SystemZ/TargetInfo/CMakeLists.txt
Normal file
6
lib/Target/SystemZ/TargetInfo/CMakeLists.txt
Normal file
@ -0,0 +1,6 @@
|
||||
include_directories( ${CMAKE_CURRENT_BINARY_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR}/.. )
|
||||
|
||||
add_llvm_library(LLVMSystemZInfo
|
||||
SystemZTargetInfo.cpp
|
||||
)
|
||||
|
15
lib/Target/SystemZ/TargetInfo/Makefile
Normal file
15
lib/Target/SystemZ/TargetInfo/Makefile
Normal file
@ -0,0 +1,15 @@
|
||||
##===- lib/Target/SystemZ/TargetInfo/Makefile --------------*- Makefile -*-===##
|
||||
#
|
||||
# The LLVM Compiler Infrastructure
|
||||
#
|
||||
# This file is distributed under the University of Illinois Open Source
|
||||
# License. See LICENSE.TXT for details.
|
||||
#
|
||||
##===----------------------------------------------------------------------===##
|
||||
LEVEL = ../../../..
|
||||
LIBRARYNAME = LLVMSystemZInfo
|
||||
|
||||
# Hack: we need to include 'main' target directory to grab private headers
|
||||
CPPFLAGS = -I$(PROJ_OBJ_DIR)/.. -I$(PROJ_SRC_DIR)/..
|
||||
|
||||
include $(LEVEL)/Makefile.common
|
44
lib/Target/SystemZ/TargetInfo/SystemZTargetInfo.cpp
Normal file
44
lib/Target/SystemZ/TargetInfo/SystemZTargetInfo.cpp
Normal file
@ -0,0 +1,44 @@
|
||||
//===-- SystemZTargetInfo.cpp - SystemZ Target Implementation -----------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/Module.h"
|
||||
#include "llvm/Target/TargetRegistry.h"
|
||||
using namespace llvm;
|
||||
|
||||
Target TheSystemZTarget;
|
||||
|
||||
static unsigned SystemZ_JITMatchQuality() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static unsigned SystemZ_TripleMatchQuality(const std::string &TT) {
|
||||
// We strongly match s390x
|
||||
if (TT.size() >= 5 && TT[0] == 's' && TT[1] == '3' && TT[2] == '9' &&
|
||||
TT[3] == '0' && TT[4] == 'x')
|
||||
return 20;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static unsigned SystemZ_ModuleMatchQuality(const Module &M) {
|
||||
// Check for a triple match.
|
||||
if (unsigned Q = SystemZ_TripleMatchQuality(M.getTargetTriple()))
|
||||
return Q;
|
||||
|
||||
// Otherwise we don't match.
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern "C" void LLVMInitializeSystemZTargetInfo() {
|
||||
TargetRegistry::RegisterTarget(TheSystemZTarget, "systemz",
|
||||
"SystemZ",
|
||||
&SystemZ_TripleMatchQuality,
|
||||
&SystemZ_ModuleMatchQuality,
|
||||
&SystemZ_JITMatchQuality);
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user