summaryrefslogtreecommitdiff
path: root/lib/Target
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2007-04-09 06:17:21 +0000
committerReid Spencer <rspencer@reidspencer.com>2007-04-09 06:17:21 +0000
commit5694b6e90eaf94fa7a21f101a8e4424d813a85ce (patch)
tree98d20adc25b36faa5f6fe589d942cf04173281d3 /lib/Target
parent7b5d466c88aacdf1c11a1651a00d2c0fa29fb4d6 (diff)
downloadllvm-5694b6e90eaf94fa7a21f101a8e4424d813a85ce.tar.gz
llvm-5694b6e90eaf94fa7a21f101a8e4424d813a85ce.tar.bz2
llvm-5694b6e90eaf94fa7a21f101a8e4424d813a85ce.tar.xz
For PR1146:
Adapt handling of parameter attributes to use the new ParamAttrsList class. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35814 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target')
-rw-r--r--lib/Target/CBackend/CBackend.cpp21
-rw-r--r--lib/Target/MSIL/MSILWriter.cpp6
2 files changed, 17 insertions, 10 deletions
diff --git a/lib/Target/CBackend/CBackend.cpp b/lib/Target/CBackend/CBackend.cpp
index 6b17293ab4..af502cea9d 100644
--- a/lib/Target/CBackend/CBackend.cpp
+++ b/lib/Target/CBackend/CBackend.cpp
@@ -18,6 +18,7 @@
#include "llvm/DerivedTypes.h"
#include "llvm/Module.h"
#include "llvm/Instructions.h"
+#include "llvm/ParameterAttributes.h"
#include "llvm/Pass.h"
#include "llvm/PassManager.h"
#include "llvm/TypeSymbolTable.h"
@@ -350,11 +351,12 @@ void CWriter::printStructReturnPointerFunctionType(std::ostream &Out,
FunctionType::param_iterator I = FTy->param_begin(), E = FTy->param_end();
const Type *RetTy = cast<PointerType>(I->get())->getElementType();
unsigned Idx = 1;
+ const ParamAttrsList *Attrs = FTy->getParamAttrs();
for (++I; I != E; ++I) {
if (PrintedType)
FunctionInnards << ", ";
printType(FunctionInnards, *I,
- /*isSigned=*/FTy->paramHasAttr(Idx, FunctionType::SExtAttribute), "");
+ /*isSigned=*/Attrs && Attrs->paramHasAttr(Idx, SExtAttribute), "");
PrintedType = true;
}
if (FTy->isVarArg()) {
@@ -366,7 +368,7 @@ void CWriter::printStructReturnPointerFunctionType(std::ostream &Out,
FunctionInnards << ')';
std::string tstr = FunctionInnards.str();
printType(Out, RetTy,
- /*isSigned=*/FTy->paramHasAttr(0, FunctionType::SExtAttribute), tstr);
+ /*isSigned=*/Attrs && Attrs->paramHasAttr(0, SExtAttribute), tstr);
}
std::ostream &
@@ -421,13 +423,14 @@ std::ostream &CWriter::printType(std::ostream &Out, const Type *Ty,
const FunctionType *FTy = cast<FunctionType>(Ty);
std::stringstream FunctionInnards;
FunctionInnards << " (" << NameSoFar << ") (";
+ const ParamAttrsList *Attrs = FTy->getParamAttrs();
unsigned Idx = 1;
for (FunctionType::param_iterator I = FTy->param_begin(),
E = FTy->param_end(); I != E; ++I) {
if (I != FTy->param_begin())
FunctionInnards << ", ";
printType(FunctionInnards, *I,
- /*isSigned=*/FTy->paramHasAttr(Idx, FunctionType::SExtAttribute), "");
+ /*isSigned=*/Attrs && Attrs->paramHasAttr(Idx, SExtAttribute), "");
++Idx;
}
if (FTy->isVarArg()) {
@@ -439,7 +442,7 @@ std::ostream &CWriter::printType(std::ostream &Out, const Type *Ty,
FunctionInnards << ')';
std::string tstr = FunctionInnards.str();
printType(Out, FTy->getReturnType(),
- /*isSigned=*/FTy->paramHasAttr(0, FunctionType::SExtAttribute), tstr);
+ /*isSigned=*/Attrs && Attrs->paramHasAttr(0, SExtAttribute), tstr);
return Out;
}
case Type::StructTyID: {
@@ -1801,6 +1804,7 @@ void CWriter::printFunctionSignature(const Function *F, bool Prototype) {
// Loop over the arguments, printing them...
const FunctionType *FT = cast<FunctionType>(F->getFunctionType());
+ const ParamAttrsList *Attrs = FT->getParamAttrs();
std::stringstream FunctionInnards;
@@ -1828,7 +1832,7 @@ void CWriter::printFunctionSignature(const Function *F, bool Prototype) {
else
ArgName = "";
printType(FunctionInnards, I->getType(),
- /*isSigned=*/FT->paramHasAttr(Idx, FunctionType::SExtAttribute),
+ /*isSigned=*/Attrs && Attrs->paramHasAttr(Idx, SExtAttribute),
ArgName);
PrintedArg = true;
++Idx;
@@ -1849,7 +1853,7 @@ void CWriter::printFunctionSignature(const Function *F, bool Prototype) {
for (; I != E; ++I) {
if (PrintedArg) FunctionInnards << ", ";
printType(FunctionInnards, *I,
- /*isSigned=*/FT->paramHasAttr(Idx, FunctionType::SExtAttribute));
+ /*isSigned=*/Attrs && Attrs->paramHasAttr(Idx, SExtAttribute));
PrintedArg = true;
++Idx;
}
@@ -1877,7 +1881,7 @@ void CWriter::printFunctionSignature(const Function *F, bool Prototype) {
// Print out the return type and the signature built above.
printType(Out, RetTy,
- /*isSigned=*/FT->paramHasAttr(0, FunctionType::SExtAttribute),
+ /*isSigned=*/ Attrs && Attrs->paramHasAttr(0, SExtAttribute),
FunctionInnards.str());
}
@@ -2573,6 +2577,7 @@ void CWriter::visitCallInst(CallInst &I) {
++ArgNo;
}
+ const ParamAttrsList *Attrs = FTy->getParamAttrs();
bool PrintedArg = false;
unsigned Idx = 1;
for (; AI != AE; ++AI, ++ArgNo, ++Idx) {
@@ -2581,7 +2586,7 @@ void CWriter::visitCallInst(CallInst &I) {
(*AI)->getType() != FTy->getParamType(ArgNo)) {
Out << '(';
printType(Out, FTy->getParamType(ArgNo),
- /*isSigned=*/FTy->paramHasAttr(Idx, FunctionType::SExtAttribute));
+ /*isSigned=*/Attrs && Attrs->paramHasAttr(Idx, SExtAttribute));
Out << ')';
}
writeOperand(*AI);
diff --git a/lib/Target/MSIL/MSILWriter.cpp b/lib/Target/MSIL/MSILWriter.cpp
index bab2904bd1..3aa05e4db8 100644
--- a/lib/Target/MSIL/MSILWriter.cpp
+++ b/lib/Target/MSIL/MSILWriter.cpp
@@ -16,6 +16,7 @@
#include "llvm/DerivedTypes.h"
#include "llvm/Intrinsics.h"
#include "llvm/IntrinsicInst.h"
+#include "llvm/ParameterAttributes.h"
#include "llvm/TypeSymbolTable.h"
#include "llvm/Analysis/ConstantsScanner.h"
#include "llvm/Support/CallSite.h"
@@ -1131,7 +1132,8 @@ void MSILWriter::printStaticInitializerList() {
void MSILWriter::printFunction(const Function& F) {
const FunctionType* FTy = F.getFunctionType();
- bool isSigned = FTy->paramHasAttr(0,FunctionType::SExtAttribute);
+ const ParamAttrsList *Attrs = FTy->getParamAttrs();
+ bool isSigned = Attrs && Attrs->paramHasAttr(0, SExtAttribute);
Out << "\n.method static ";
Out << (F.hasInternalLinkage() ? "private " : "public ");
if (F.isVarArg()) Out << "vararg ";
@@ -1142,7 +1144,7 @@ void MSILWriter::printFunction(const Function& F) {
unsigned ArgIdx = 1;
for (Function::const_arg_iterator I = F.arg_begin(), E = F.arg_end(); I!=E;
++I, ++ArgIdx) {
- isSigned = FTy->paramHasAttr(ArgIdx,FunctionType::SExtAttribute);
+ isSigned = Attrs && Attrs->paramHasAttr(ArgIdx, SExtAttribute);
if (I!=F.arg_begin()) Out << ", ";
Out << getTypeName(I->getType(),isSigned) << getValueName(I);
}