summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAnton Korobeynikov <asl@math.spbu.ru>2007-01-28 13:31:35 +0000
committerAnton Korobeynikov <asl@math.spbu.ru>2007-01-28 13:31:35 +0000
commitb10308e440c80dd6ffb4b478f741ff7e5f30cb48 (patch)
tree90dcc14295ce38dc9d4bc3626e48cd5311770810 /include
parentf0876c7cb7ab68bf81e71537ae04b831df01e1ca (diff)
downloadllvm-b10308e440c80dd6ffb4b478f741ff7e5f30cb48.tar.gz
llvm-b10308e440c80dd6ffb4b478f741ff7e5f30cb48.tar.bz2
llvm-b10308e440c80dd6ffb4b478f741ff7e5f30cb48.tar.xz
Propagate changes from my local tree. This patch includes:
1. New parameter attribute called 'inreg'. It has meaning "place this parameter in registers, if possible". This is some generalization of gcc's regparm(n) attribute. It's currently used only in X86-32 backend. 2. Completely rewritten CC handling/lowering code inside X86 backend. Merged stdcall + c CCs and fastcall + fast CC. 3. Dropped CSRET CC. We cannot add struct return variant for each target-specific CC (e.g. stdcall + csretcc and so on). 4. Instead of CSRET CC introduced 'sret' parameter attribute. Setting in on first attribute has meaning 'This is hidden pointer to structure return. Handle it gently'. 5. Fixed small bug in llvm-extract + add new feature to FunctionExtraction pass, which relinks all internal-linkaged callees from deleted function to external linkage. This will allow further linking everything together. NOTEs: 1. Documentation will be updated soon. 2. llvm-upgrade should be improved to translate csret => sret. Before this, there will be some unexpected test fails. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33597 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/CallingConv.h8
-rw-r--r--include/llvm/CodeGen/SelectionDAGNodes.h23
-rw-r--r--include/llvm/DerivedTypes.h8
-rw-r--r--include/llvm/Target/TargetLowering.h2
-rw-r--r--include/llvm/Transforms/IPO.h3
5 files changed, 25 insertions, 19 deletions
diff --git a/include/llvm/CallingConv.h b/include/llvm/CallingConv.h
index e6ffd281e6..4bacb1d954 100644
--- a/include/llvm/CallingConv.h
+++ b/include/llvm/CallingConv.h
@@ -30,14 +30,6 @@ namespace CallingConv {
/// certain amounts of prototype mismatch.
C = 0,
- /// CSRet - C Struct Return calling convention. This convention requires
- /// that the function return void and take a pointer as the first argument
- /// of the struct. This is used by targets which need to distinguish
- /// between C functions returning a structure, and C functions taking a
- /// structure pointer as the first argument to the function.
- CSRet = 1,
-
-
// Generic LLVM calling conventions. None of these calling conventions
// support varargs calls, and all assume that the caller and callee
// prototype exactly match.
diff --git a/include/llvm/CodeGen/SelectionDAGNodes.h b/include/llvm/CodeGen/SelectionDAGNodes.h
index faa0e35da0..11c6ad6c53 100644
--- a/include/llvm/CodeGen/SelectionDAGNodes.h
+++ b/include/llvm/CodeGen/SelectionDAGNodes.h
@@ -133,20 +133,25 @@ namespace ISD {
// UNDEF - An undefined node
UNDEF,
- /// FORMAL_ARGUMENTS(CHAIN, CC#, ISVARARG) - This node represents the formal
- /// arguments for a function. CC# is a Constant value indicating the
- /// calling convention of the function, and ISVARARG is a flag that
- /// indicates whether the function is varargs or not. This node has one
- /// result value for each incoming argument, plus one for the output chain.
- /// It must be custom legalized.
+ /// FORMAL_ARGUMENTS(CHAIN, CC#, ISVARARG, FLAG0, ..., FLAGn) - This node
+ /// represents the formal arguments for a function. CC# is a Constant value
+ /// indicating the calling convention of the function, and ISVARARG is a
+ /// flag that indicates whether the function is varargs or not. This node
+ /// has one result value for each incoming argument, plus one for the output
+ /// chain. It must be custom legalized. See description of CALL node for
+ /// FLAG argument contents explanation.
///
FORMAL_ARGUMENTS,
/// RV1, RV2...RVn, CHAIN = CALL(CHAIN, CC#, ISVARARG, ISTAILCALL, CALLEE,
- /// ARG0, SIGN0, ARG1, SIGN1, ... ARGn, SIGNn)
+ /// ARG0, FLAG0, ARG1, FLAG1, ... ARGn, FLAGn)
/// This node represents a fully general function call, before the legalizer
- /// runs. This has one result value for each argument / signness pair, plus
- /// a chain result. It must be custom legalized.
+ /// runs. This has one result value for each argument / flag pair, plus
+ /// a chain result. It must be custom legalized. Flag argument indicates
+ /// misc. argument attributes. Currently:
+ /// Bit 0 - signness
+ /// Bit 1 - 'inreg' attribute
+ /// Bit 2 - 'sret' attribute
CALL,
// EXTRACT_ELEMENT - This is used to get the first or second (determined by
diff --git a/include/llvm/DerivedTypes.h b/include/llvm/DerivedTypes.h
index c1e3a98a04..06f3a98807 100644
--- a/include/llvm/DerivedTypes.h
+++ b/include/llvm/DerivedTypes.h
@@ -134,7 +134,9 @@ public:
NoAttributeSet = 0, ///< No attribute value has been set
ZExtAttribute = 1, ///< zero extended before/after call
SExtAttribute = 1 << 1, ///< sign extended before/after call
- NoReturnAttribute = 1 << 2 ///< mark the function as not returning
+ NoReturnAttribute = 1 << 2, ///< mark the function as not returning
+ InRegAttribute = 1 << 3, ///< force argument to be passed in register
+ StructRetAttribute= 1 << 4 ///< hidden pointer to structure to return
};
typedef std::vector<ParameterAttributes> ParamAttrsList;
private:
@@ -176,6 +178,10 @@ public:
///
unsigned getNumParams() const { return unsigned(ContainedTys.size()-1); }
+ bool isStructReturn() const {
+ return (getNumParams() && paramHasAttr(1, StructRetAttribute));
+ }
+
/// The parameter attributes for the \p ith parameter are returned. The 0th
/// parameter refers to the return type of the function.
/// @returns The ParameterAttributes for the \p ith parameter.
diff --git a/include/llvm/Target/TargetLowering.h b/include/llvm/Target/TargetLowering.h
index 34bc3ad7ee..49d6624f8e 100644
--- a/include/llvm/Target/TargetLowering.h
+++ b/include/llvm/Target/TargetLowering.h
@@ -730,6 +730,8 @@ public:
SDOperand Node;
const Type* Ty;
bool isSigned;
+ bool isInReg;
+ bool isSRet;
};
typedef std::vector<ArgListEntry> ArgListTy;
virtual std::pair<SDOperand, SDOperand>
diff --git a/include/llvm/Transforms/IPO.h b/include/llvm/Transforms/IPO.h
index 44ffa473e4..b24857e967 100644
--- a/include/llvm/Transforms/IPO.h
+++ b/include/llvm/Transforms/IPO.h
@@ -82,7 +82,8 @@ ModulePass *createGlobalDCEPass();
/// the specified function. Otherwise, it deletes as much of the module as
/// possible, except for the function specified.
///
-ModulePass *createFunctionExtractionPass(Function *F, bool deleteFn = false);
+ModulePass *createFunctionExtractionPass(Function *F, bool deleteFn = false,
+ bool relinkCallees = false);
//===----------------------------------------------------------------------===//