[cfe-commits] r69668 - in /cfe/trunk/lib: Basic/Targets.cpp CodeGen/CGCall.cpp
Sanjiv Gupta
sanjiv.gupta at microchip.com
Mon Apr 20 23:01:17 PDT 2009
Author: sgupta
Date: Tue Apr 21 01:01:16 2009
New Revision: 69668
URL: http://llvm.org/viewvc/llvm-project?rev=69668&view=rev
Log:
Pass and return aggregate types directly to function calls.
Modified:
cfe/trunk/lib/Basic/Targets.cpp
cfe/trunk/lib/CodeGen/CGCall.cpp
Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=69668&r1=69667&r2=69668&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Tue Apr 21 01:01:16 2009
@@ -1184,7 +1184,7 @@
unsigned &NumRecords) const {}
virtual const char *getVAListDeclaration() const { return "";}
virtual const char *getClobbers() const {return "";}
- virtual const char *getTargetPrefix() const {return "";}
+ virtual const char *getTargetPrefix() const {return "pic16";}
virtual void getGCCRegNames(const char * const *&Names,
unsigned &NumNames) const {}
virtual bool validateAsmConstraint(const char *&Name,
Modified: cfe/trunk/lib/CodeGen/CGCall.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.cpp?rev=69668&r1=69667&r2=69668&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGCall.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCall.cpp Tue Apr 21 01:01:16 2009
@@ -1272,6 +1272,45 @@
return ResAddr;
}
+// ABI Info for PIC16
+class PIC16ABIInfo : public ABIInfo {
+ ABIArgInfo classifyReturnType(QualType RetTy,
+ ASTContext &Context) const;
+
+ ABIArgInfo classifyArgumentType(QualType RetTy,
+ ASTContext &Context) const;
+
+ virtual void computeInfo(CGFunctionInfo &FI, ASTContext &Context) const {
+ FI.getReturnInfo() = classifyReturnType(FI.getReturnType(), Context);
+ for (CGFunctionInfo::arg_iterator it = FI.arg_begin(), ie = FI.arg_end();
+ it != ie; ++it)
+ it->info = classifyArgumentType(it->type, Context);
+ }
+
+ virtual llvm::Value *EmitVAArg(llvm::Value *VAListAddr, QualType Ty,
+ CodeGenFunction &CGF) const;
+
+};
+
+ABIArgInfo PIC16ABIInfo::classifyReturnType(QualType RetTy,
+ ASTContext &Context) const {
+ if (RetTy->isVoidType()) {
+ return ABIArgInfo::getIgnore();
+ } else {
+ return ABIArgInfo::getDirect();
+ }
+}
+
+ABIArgInfo PIC16ABIInfo::classifyArgumentType(QualType Ty,
+ ASTContext &Context) const {
+ return ABIArgInfo::getDirect();
+}
+
+llvm::Value *PIC16ABIInfo::EmitVAArg(llvm::Value *VAListAddr, QualType Ty,
+ CodeGenFunction &CGF) const {
+ return 0;
+}
+
class ARMABIInfo : public ABIInfo {
ABIArgInfo classifyReturnType(QualType RetTy,
ASTContext &Context) const;
@@ -1400,6 +1439,8 @@
} else if (strcmp(TargetPrefix, "arm") == 0) {
// FIXME: Support for OABI?
return *(TheABIInfo = new ARMABIInfo());
+ } else if (strcmp(TargetPrefix, "pic16") == 0) {
+ return *(TheABIInfo = new PIC16ABIInfo());
}
return *(TheABIInfo = new DefaultABIInfo);
More information about the cfe-commits
mailing list