mirror of
https://github.com/RPCSX/llvm.git
synced 2024-12-03 17:31:50 +00:00
Code that needs a TargetMachine should have access to one directly, rather
than just getting one through a TargetLowering. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101802 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
46007b3712
commit
55e59c1863
@ -199,7 +199,7 @@ namespace llvm {
|
|||||||
|
|
||||||
/// createDwarfEHPass - This pass mulches exception handling code into a form
|
/// createDwarfEHPass - This pass mulches exception handling code into a form
|
||||||
/// adapted to code generation. Required if using dwarf exception handling.
|
/// adapted to code generation. Required if using dwarf exception handling.
|
||||||
FunctionPass *createDwarfEHPass(const TargetLowering *tli, bool fast);
|
FunctionPass *createDwarfEHPass(const TargetMachine *tm, bool fast);
|
||||||
|
|
||||||
/// createSjLjEHPass - This pass adapts exception handling code to use
|
/// createSjLjEHPass - This pass adapts exception handling code to use
|
||||||
/// the GCC-style builtin setjmp/longjmp (sjlj) to handling EH control flow.
|
/// the GCC-style builtin setjmp/longjmp (sjlj) to handling EH control flow.
|
||||||
|
@ -34,6 +34,7 @@ STATISTIC(NumStackTempsIntroduced, "Number of stack temporaries introduced");
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
class DwarfEHPrepare : public FunctionPass {
|
class DwarfEHPrepare : public FunctionPass {
|
||||||
|
const TargetMachine *TM;
|
||||||
const TargetLowering *TLI;
|
const TargetLowering *TLI;
|
||||||
bool CompileFast;
|
bool CompileFast;
|
||||||
|
|
||||||
@ -154,8 +155,9 @@ namespace {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
static char ID; // Pass identification, replacement for typeid.
|
static char ID; // Pass identification, replacement for typeid.
|
||||||
DwarfEHPrepare(const TargetLowering *tli, bool fast) :
|
DwarfEHPrepare(const TargetMachine *tm, bool fast) :
|
||||||
FunctionPass(&ID), TLI(tli), CompileFast(fast),
|
FunctionPass(&ID), TM(tm), TLI(TM->getTargetLowering()),
|
||||||
|
CompileFast(fast),
|
||||||
ExceptionValueIntrinsic(0), SelectorIntrinsic(0),
|
ExceptionValueIntrinsic(0), SelectorIntrinsic(0),
|
||||||
URoR(0), EHCatchAllValue(0), RewindFunction(0) {}
|
URoR(0), EHCatchAllValue(0), RewindFunction(0) {}
|
||||||
|
|
||||||
@ -180,8 +182,8 @@ namespace {
|
|||||||
|
|
||||||
char DwarfEHPrepare::ID = 0;
|
char DwarfEHPrepare::ID = 0;
|
||||||
|
|
||||||
FunctionPass *llvm::createDwarfEHPass(const TargetLowering *tli, bool fast) {
|
FunctionPass *llvm::createDwarfEHPass(const TargetMachine *tm, bool fast) {
|
||||||
return new DwarfEHPrepare(tli, fast);
|
return new DwarfEHPrepare(tm, fast);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// FindAllCleanupSelectors - Find all eh.selector calls that are clean-ups.
|
/// FindAllCleanupSelectors - Find all eh.selector calls that are clean-ups.
|
||||||
@ -421,7 +423,7 @@ bool DwarfEHPrepare::HandleURoRInvokes() {
|
|||||||
bool DwarfEHPrepare::NormalizeLandingPads() {
|
bool DwarfEHPrepare::NormalizeLandingPads() {
|
||||||
bool Changed = false;
|
bool Changed = false;
|
||||||
|
|
||||||
const MCAsmInfo *MAI = TLI->getTargetMachine().getMCAsmInfo();
|
const MCAsmInfo *MAI = TM->getMCAsmInfo();
|
||||||
bool usingSjLjEH = MAI->getExceptionHandlingType() == ExceptionHandling::SjLj;
|
bool usingSjLjEH = MAI->getExceptionHandlingType() == ExceptionHandling::SjLj;
|
||||||
|
|
||||||
for (Function::iterator I = F->begin(), E = F->end(); I != E; ++I) {
|
for (Function::iterator I = F->begin(), E = F->end(); I != E; ++I) {
|
||||||
|
@ -248,10 +248,10 @@ bool LLVMTargetMachine::addCommonCodeGenPasses(PassManagerBase &PM,
|
|||||||
// pad is shared by multiple invokes and is also a target of a normal
|
// pad is shared by multiple invokes and is also a target of a normal
|
||||||
// edge from elsewhere.
|
// edge from elsewhere.
|
||||||
PM.add(createSjLjEHPass(getTargetLowering()));
|
PM.add(createSjLjEHPass(getTargetLowering()));
|
||||||
PM.add(createDwarfEHPass(getTargetLowering(), OptLevel==CodeGenOpt::None));
|
PM.add(createDwarfEHPass(this, OptLevel==CodeGenOpt::None));
|
||||||
break;
|
break;
|
||||||
case ExceptionHandling::Dwarf:
|
case ExceptionHandling::Dwarf:
|
||||||
PM.add(createDwarfEHPass(getTargetLowering(), OptLevel==CodeGenOpt::None));
|
PM.add(createDwarfEHPass(this, OptLevel==CodeGenOpt::None));
|
||||||
break;
|
break;
|
||||||
case ExceptionHandling::None:
|
case ExceptionHandling::None:
|
||||||
PM.add(createLowerInvokePass(getTargetLowering()));
|
PM.add(createLowerInvokePass(getTargetLowering()));
|
||||||
|
@ -53,6 +53,7 @@ using namespace llvm;
|
|||||||
///
|
///
|
||||||
namespace {
|
namespace {
|
||||||
class SelectionDAGLegalize {
|
class SelectionDAGLegalize {
|
||||||
|
const TargetMachine &TM;
|
||||||
const TargetLowering &TLI;
|
const TargetLowering &TLI;
|
||||||
SelectionDAG &DAG;
|
SelectionDAG &DAG;
|
||||||
CodeGenOpt::Level OptLevel;
|
CodeGenOpt::Level OptLevel;
|
||||||
@ -211,7 +212,8 @@ SelectionDAGLegalize::ShuffleWithNarrowerEltType(EVT NVT, EVT VT, DebugLoc dl,
|
|||||||
|
|
||||||
SelectionDAGLegalize::SelectionDAGLegalize(SelectionDAG &dag,
|
SelectionDAGLegalize::SelectionDAGLegalize(SelectionDAG &dag,
|
||||||
CodeGenOpt::Level ol)
|
CodeGenOpt::Level ol)
|
||||||
: TLI(dag.getTargetLoweringInfo()), DAG(dag), OptLevel(ol),
|
: TM(dag.getTarget()), TLI(dag.getTargetLoweringInfo()),
|
||||||
|
DAG(dag), OptLevel(ol),
|
||||||
ValueTypeActions(TLI.getValueTypeActions()) {
|
ValueTypeActions(TLI.getValueTypeActions()) {
|
||||||
assert(MVT::LAST_VALUETYPE <= MVT::MAX_ALLOWED_VALUETYPE &&
|
assert(MVT::LAST_VALUETYPE <= MVT::MAX_ALLOWED_VALUETYPE &&
|
||||||
"Too many value types for ValueTypeActions to hold!");
|
"Too many value types for ValueTypeActions to hold!");
|
||||||
@ -1661,8 +1663,7 @@ void SelectionDAGLegalize::ExpandDYNAMIC_STACKALLOC(SDNode* Node,
|
|||||||
SDValue SP = DAG.getCopyFromReg(Chain, dl, SPReg, VT);
|
SDValue SP = DAG.getCopyFromReg(Chain, dl, SPReg, VT);
|
||||||
Chain = SP.getValue(1);
|
Chain = SP.getValue(1);
|
||||||
unsigned Align = cast<ConstantSDNode>(Tmp3)->getZExtValue();
|
unsigned Align = cast<ConstantSDNode>(Tmp3)->getZExtValue();
|
||||||
unsigned StackAlign =
|
unsigned StackAlign = TM.getFrameInfo()->getStackAlignment();
|
||||||
TLI.getTargetMachine().getFrameInfo()->getStackAlignment();
|
|
||||||
if (Align > StackAlign)
|
if (Align > StackAlign)
|
||||||
SP = DAG.getNode(ISD::AND, dl, VT, SP,
|
SP = DAG.getNode(ISD::AND, dl, VT, SP,
|
||||||
DAG.getConstant(-(uint64_t)Align, VT));
|
DAG.getConstant(-(uint64_t)Align, VT));
|
||||||
@ -2920,7 +2921,7 @@ void SelectionDAGLegalize::ExpandNode(SDNode *Node,
|
|||||||
PseudoSourceValue::getJumpTable(), 0, MemVT,
|
PseudoSourceValue::getJumpTable(), 0, MemVT,
|
||||||
false, false, 0);
|
false, false, 0);
|
||||||
Addr = LD;
|
Addr = LD;
|
||||||
if (TLI.getTargetMachine().getRelocationModel() == Reloc::PIC_) {
|
if (TM.getRelocationModel() == Reloc::PIC_) {
|
||||||
// For PIC, the sequence is:
|
// For PIC, the sequence is:
|
||||||
// BRIND(load(Jumptable + index) + RelocBase)
|
// BRIND(load(Jumptable + index) + RelocBase)
|
||||||
// RelocBase can be JumpTable, GOT or some sort of global base.
|
// RelocBase can be JumpTable, GOT or some sort of global base.
|
||||||
|
@ -2619,8 +2619,7 @@ void SelectionDAGBuilder::visitAlloca(const AllocaInst &I) {
|
|||||||
// Handle alignment. If the requested alignment is less than or equal to
|
// Handle alignment. If the requested alignment is less than or equal to
|
||||||
// the stack alignment, ignore it. If the size is greater than or equal to
|
// the stack alignment, ignore it. If the size is greater than or equal to
|
||||||
// the stack alignment, we note this in the DYNAMIC_STACKALLOC node.
|
// the stack alignment, we note this in the DYNAMIC_STACKALLOC node.
|
||||||
unsigned StackAlign =
|
unsigned StackAlign = TM.getFrameInfo()->getStackAlignment();
|
||||||
TLI.getTargetMachine().getFrameInfo()->getStackAlignment();
|
|
||||||
if (Align <= StackAlign)
|
if (Align <= StackAlign)
|
||||||
Align = 0;
|
Align = 0;
|
||||||
|
|
||||||
@ -4510,7 +4509,7 @@ void SelectionDAGBuilder::visitCall(const CallInst &I) {
|
|||||||
const char *RenameFn = 0;
|
const char *RenameFn = 0;
|
||||||
if (Function *F = I.getCalledFunction()) {
|
if (Function *F = I.getCalledFunction()) {
|
||||||
if (F->isDeclaration()) {
|
if (F->isDeclaration()) {
|
||||||
const TargetIntrinsicInfo *II = TLI.getTargetMachine().getIntrinsicInfo();
|
const TargetIntrinsicInfo *II = TM.getIntrinsicInfo();
|
||||||
if (II) {
|
if (II) {
|
||||||
if (unsigned IID = II->getIntrinsicID(F)) {
|
if (unsigned IID = II->getIntrinsicID(F)) {
|
||||||
RenameFn = visitIntrinsicCall(I, IID);
|
RenameFn = visitIntrinsicCall(I, IID);
|
||||||
|
@ -257,6 +257,7 @@ public:
|
|||||||
// TLI - This is information that describes the available target features we
|
// TLI - This is information that describes the available target features we
|
||||||
// need for lowering. This indicates when operations are unavailable,
|
// need for lowering. This indicates when operations are unavailable,
|
||||||
// implemented with a libcall, etc.
|
// implemented with a libcall, etc.
|
||||||
|
const TargetMachine &TM;
|
||||||
const TargetLowering &TLI;
|
const TargetLowering &TLI;
|
||||||
SelectionDAG &DAG;
|
SelectionDAG &DAG;
|
||||||
const TargetData *TD;
|
const TargetData *TD;
|
||||||
@ -303,10 +304,10 @@ public:
|
|||||||
|
|
||||||
LLVMContext *Context;
|
LLVMContext *Context;
|
||||||
|
|
||||||
SelectionDAGBuilder(SelectionDAG &dag, const TargetLowering &tli,
|
SelectionDAGBuilder(SelectionDAG &dag, FunctionLoweringInfo &funcinfo,
|
||||||
FunctionLoweringInfo &funcinfo,
|
|
||||||
CodeGenOpt::Level ol)
|
CodeGenOpt::Level ol)
|
||||||
: SDNodeOrder(0), TLI(tli), DAG(dag), FuncInfo(funcinfo), OptLevel(ol),
|
: SDNodeOrder(0), TM(dag.getTarget()), TLI(dag.getTargetLoweringInfo()),
|
||||||
|
DAG(dag), FuncInfo(funcinfo), OptLevel(ol),
|
||||||
HasTailCall(false), Context(dag.getContext()) {
|
HasTailCall(false), Context(dag.getContext()) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -168,7 +168,7 @@ SelectionDAGISel::SelectionDAGISel(TargetMachine &tm, CodeGenOpt::Level OL) :
|
|||||||
MachineFunctionPass(&ID), TM(tm), TLI(*tm.getTargetLowering()),
|
MachineFunctionPass(&ID), TM(tm), TLI(*tm.getTargetLowering()),
|
||||||
FuncInfo(new FunctionLoweringInfo(TLI)),
|
FuncInfo(new FunctionLoweringInfo(TLI)),
|
||||||
CurDAG(new SelectionDAG(TLI, *FuncInfo)),
|
CurDAG(new SelectionDAG(TLI, *FuncInfo)),
|
||||||
SDB(new SelectionDAGBuilder(*CurDAG, TLI, *FuncInfo, OL)),
|
SDB(new SelectionDAGBuilder(*CurDAG, *FuncInfo, OL)),
|
||||||
GFI(),
|
GFI(),
|
||||||
OptLevel(OL),
|
OptLevel(OL),
|
||||||
DAGSize(0)
|
DAGSize(0)
|
||||||
@ -705,8 +705,7 @@ void SelectionDAGISel::PrepareEHLandingPad(MachineBasicBlock *BB) {
|
|||||||
// landing pad can thus be detected via the MachineModuleInfo.
|
// landing pad can thus be detected via the MachineModuleInfo.
|
||||||
MCSymbol *Label = MF->getMMI().addLandingPad(BB);
|
MCSymbol *Label = MF->getMMI().addLandingPad(BB);
|
||||||
|
|
||||||
const TargetInstrDesc &II =
|
const TargetInstrDesc &II = TM.getInstrInfo()->get(TargetOpcode::EH_LABEL);
|
||||||
TLI.getTargetMachine().getInstrInfo()->get(TargetOpcode::EH_LABEL);
|
|
||||||
BuildMI(BB, SDB->getCurDebugLoc(), II).addSym(Label);
|
BuildMI(BB, SDB->getCurDebugLoc(), II).addSym(Label);
|
||||||
|
|
||||||
// Mark exception register as live in.
|
// Mark exception register as live in.
|
||||||
|
Loading…
Reference in New Issue
Block a user