aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/Instructions.h
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-05-06 20:26:26 +0000
committerChris Lattner <sabre@nondot.org>2005-05-06 20:26:26 +0000
commit3340ffe85431f705e91aa4d4b64207f80d0d8c2f (patch)
treea155906865d7e65af09bb816149d4fdedd1420b3 /include/llvm/Instructions.h
parenta62e52ab181c10738066e65a6dcc6c3cdfa5d806 (diff)
downloadexternal_llvm-3340ffe85431f705e91aa4d4b64207f80d0d8c2f.zip
external_llvm-3340ffe85431f705e91aa4d4b64207f80d0d8c2f.tar.gz
external_llvm-3340ffe85431f705e91aa4d4b64207f80d0d8c2f.tar.bz2
Add support for explicit calling conventions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21745 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Instructions.h')
-rw-r--r--include/llvm/Instructions.h29
1 files changed, 24 insertions, 5 deletions
diff --git a/include/llvm/Instructions.h b/include/llvm/Instructions.h
index b398361..6964668 100644
--- a/include/llvm/Instructions.h
+++ b/include/llvm/Instructions.h
@@ -467,8 +467,9 @@ public:
//===----------------------------------------------------------------------===//
/// CallInst - This class represents a function call, abstracting a target
-/// machine's calling convention. This class uses the SubClassData field to
-/// indicate whether or not this is a tail call.
+/// machine's calling convention. This class uses low bit of the SubClassData
+/// field to indicate whether or not this is a tail call. The rest of the bits
+/// hold the calling convention of the call.
///
class CallInst : public Instruction {
CallInst(const CallInst &CI);
@@ -502,8 +503,17 @@ public:
virtual CallInst *clone() const;
bool mayWriteToMemory() const { return true; }
- bool isTailCall() const { return SubclassData; }
- void setTailCall(bool isTailCall = true) { SubclassData = isTailCall; }
+ bool isTailCall() const { return SubclassData & 1; }
+ void setTailCall(bool isTailCall = true) {
+ SubclassData = (SubclassData & ~1) | isTailCall;
+ }
+
+ /// getCallingConv/setCallingConv - Get or set the calling convention of this
+ /// function call.
+ unsigned getCallingConv() const { return SubclassData >> 1; }
+ void setCallingConv(unsigned CC) {
+ SubclassData = (SubclassData & 1) | (CC << 1);
+ }
/// getCalledFunction - Return the function being called by this instruction
/// if it is a direct call. If it is a call through a function pointer,
@@ -1165,7 +1175,9 @@ private:
//===----------------------------------------------------------------------===//
//===---------------------------------------------------------------------------
-/// InvokeInst - Invoke instruction
+
+/// InvokeInst - Invoke instruction. The SubclassData field is used to hold the
+/// calling convention of the call.
///
class InvokeInst : public TerminatorInst {
InvokeInst(const InvokeInst &BI);
@@ -1184,6 +1196,13 @@ public:
bool mayWriteToMemory() const { return true; }
+ /// getCallingConv/setCallingConv - Get or set the calling convention of this
+ /// function call.
+ unsigned getCallingConv() const { return SubclassData; }
+ void setCallingConv(unsigned CC) {
+ SubclassData = CC;
+ }
+
/// getCalledFunction - Return the function called, or null if this is an
/// indirect function invocation.
///