diff options
author | Chris Lattner <sabre@nondot.org> | 2006-11-29 01:12:32 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2006-11-29 01:12:32 +0000 |
commit | 90f4238c38a4c6a21491b0e23e2a9b682368701c (patch) | |
tree | b2fa6f6388048b3e1760a687b1fd9faca83c01bd /llvm/lib/CodeGen | |
parent | a736fdf21692b6897d5584a18cbdd6b36402c330 (diff) | |
download | bcm5719-llvm-90f4238c38a4c6a21491b0e23e2a9b682368701c.tar.gz bcm5719-llvm-90f4238c38a4c6a21491b0e23e2a9b682368701c.zip |
add a hook to allow targets to hack on inline asms to lower them to llvm
when they want to.
llvm-svn: 31997
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp index 0257e1b7753..fbfd3f7b710 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp @@ -33,6 +33,7 @@ #include "llvm/CodeGen/SelectionDAG.h" #include "llvm/CodeGen/SSARegMap.h" #include "llvm/Target/MRegisterInfo.h" +#include "llvm/Target/TargetAsmInfo.h" #include "llvm/Target/TargetData.h" #include "llvm/Target/TargetFrameInfo.h" #include "llvm/Target/TargetInstrInfo.h" @@ -3780,7 +3781,17 @@ bool SelectionDAGISel::runOnFunction(Function &Fn) { for (BasicBlock::iterator BBI = BB->begin(), E = BB->end(); BBI != E; ) { Instruction *I = BBI++; - if (GetElementPtrInst *GEPI = dyn_cast<GetElementPtrInst>(I)) { + + if (CallInst *CI = dyn_cast<CallInst>(I)) { + // If we found an inline asm expession, and if the target knows how to + // lower it to normal LLVM code, do so now. + if (isa<InlineAsm>(CI->getCalledValue())) + if (const TargetAsmInfo *TAI = + TLI.getTargetMachine().getTargetAsmInfo()) { + if (TAI->ExpandInlineAsm(CI)) + BBI = BB->begin(); + } + } else if (GetElementPtrInst *GEPI = dyn_cast<GetElementPtrInst>(I)) { MadeChange |= OptimizeGEPExpression(GEPI, TLI.getTargetData()); } else if (CastInst *CI = dyn_cast<CastInst>(I)) { // If the source of the cast is a constant, then this should have @@ -4004,6 +4015,7 @@ void SelectionDAGISel::BuildSelectionDAG(SelectionDAG &DAG, BasicBlock *LLVMBB, unsigned Reg; Value *PHIOp = PN->getIncomingValueForBlock(LLVMBB); + if (Constant *C = dyn_cast<Constant>(PHIOp)) { unsigned &RegOut = ConstantsOut[C]; if (RegOut == 0) { |