[llvm-commits] CVS: llvm/include/llvm/Function.h Instructions.h
Chris Lattner
lattner at cs.uiuc.edu
Fri May 6 13:26:37 PDT 2005
Changes in directory llvm/include/llvm:
Function.h updated: 1.64 -> 1.65
Instructions.h updated: 1.19 -> 1.20
---
Log message:
Add support for explicit calling conventions
---
Diffs of the changes: (+31 -5)
Function.h | 7 +++++++
Instructions.h | 29 ++++++++++++++++++++++++-----
2 files changed, 31 insertions(+), 5 deletions(-)
Index: llvm/include/llvm/Function.h
diff -u llvm/include/llvm/Function.h:1.64 llvm/include/llvm/Function.h:1.65
--- llvm/include/llvm/Function.h:1.64 Thu Apr 21 15:11:51 2005
+++ llvm/include/llvm/Function.h Fri May 6 15:26:24 2005
@@ -66,6 +66,7 @@
ArgumentListType ArgumentList; // The formal arguments
SymbolTable *SymTab;
+ unsigned CallingConvention;
friend class SymbolTableListTraits<Function, Module, Module>;
@@ -106,6 +107,12 @@
unsigned getIntrinsicID() const;
bool isIntrinsic() const { return getIntrinsicID() != 0; }
+ /// getCallingConv()/setCallingConv(uint) - These method get and set the
+ /// calling convention of this function. The enum values for the known
+ /// calling conventions are defined in CallingConv.h.
+ unsigned getCallingConv() const { return CallingConvention; }
+ void setCallingConv(unsigned CC) { CallingConvention = CC; }
+
/// renameLocalSymbols - This method goes through the Function's symbol table
/// and renames any symbols that conflict with symbols at global scope. This
/// is required before printing out to a textual form, to ensure that there is
Index: llvm/include/llvm/Instructions.h
diff -u llvm/include/llvm/Instructions.h:1.19 llvm/include/llvm/Instructions.h:1.20
--- llvm/include/llvm/Instructions.h:1.19 Fri May 6 01:22:10 2005
+++ llvm/include/llvm/Instructions.h Fri May 6 15:26:24 2005
@@ -467,8 +467,9 @@
//===----------------------------------------------------------------------===//
/// 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 @@
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 @@
//===----------------------------------------------------------------------===//
//===---------------------------------------------------------------------------
-/// 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 @@
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.
///
More information about the llvm-commits
mailing list