summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/PrologEpilogInserter.cpp
diff options
context:
space:
mode:
authorAnton Korobeynikov <asl@math.spbu.ru>2009-07-17 18:07:26 +0000
committerAnton Korobeynikov <asl@math.spbu.ru>2009-07-17 18:07:26 +0000
commitc8ce7b08bae8f86032dca601399fa1d4194db3d2 (patch)
tree6e43a44c9c77e8e5a6ee99108789a450300f8490 /llvm/lib/CodeGen/PrologEpilogInserter.cpp
parent52d436e98b903a46e760e0ca75d6e976cf4ff30a (diff)
downloadbcm5719-llvm-c8ce7b08bae8f86032dca601399fa1d4194db3d2.tar.gz
bcm5719-llvm-c8ce7b08bae8f86032dca601399fa1d4194db3d2.zip
Add support for naked functions
llvm-svn: 76198
Diffstat (limited to 'llvm/lib/CodeGen/PrologEpilogInserter.cpp')
-rw-r--r--llvm/lib/CodeGen/PrologEpilogInserter.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/PrologEpilogInserter.cpp b/llvm/lib/CodeGen/PrologEpilogInserter.cpp
index 546a84ec876..5aa37c9044d 100644
--- a/llvm/lib/CodeGen/PrologEpilogInserter.cpp
+++ b/llvm/lib/CodeGen/PrologEpilogInserter.cpp
@@ -51,6 +51,7 @@ FunctionPass *llvm::createPrologEpilogCodeInserter() { return new PEI(); }
/// frame indexes with appropriate references.
///
bool PEI::runOnMachineFunction(MachineFunction &Fn) {
+ const Function* F = Fn.getFunction();
const TargetRegisterInfo *TRI = Fn.getTarget().getRegisterInfo();
RS = TRI->requiresRegisterScavenging(Fn) ? new RegScavenger() : NULL;
@@ -80,7 +81,8 @@ bool PEI::runOnMachineFunction(MachineFunction &Fn) {
placeCSRSpillsAndRestores(Fn);
// Add the code to save and restore the callee saved registers
- insertCSRSpillsAndRestores(Fn);
+ if (!F->hasFnAttr(Attribute::Naked))
+ insertCSRSpillsAndRestores(Fn);
// Allow the target machine to make final modifications to the function
// before the frame layout is finalized.
@@ -94,7 +96,8 @@ bool PEI::runOnMachineFunction(MachineFunction &Fn) {
// called functions. Because of this, calculateCalleeSavedRegisters
// must be called before this function in order to set the HasCalls
// and MaxCallFrameSize variables.
- insertPrologEpilogCode(Fn);
+ if (!F->hasFnAttr(Attribute::Naked))
+ insertPrologEpilogCode(Fn);
// Replace all MO_FrameIndex operands with physical register references
// and actual offsets.
OpenPOWER on IntegriCloud