[polly] r175874 - Support: clang-format
Tobias Grosser
grosser at fim.uni-passau.de
Fri Feb 22 00:21:52 PST 2013
Author: grosser
Date: Fri Feb 22 02:21:52 2013
New Revision: 175874
URL: http://llvm.org/viewvc/llvm-project?rev=175874&view=rev
Log:
Support: clang-format
Modified:
polly/trunk/lib/Support/GICHelper.cpp
polly/trunk/lib/Support/SCEVValidator.cpp
Modified: polly/trunk/lib/Support/GICHelper.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Support/GICHelper.cpp?rev=175874&r1=175873&r2=175874&view=diff
==============================================================================
--- polly/trunk/lib/Support/GICHelper.cpp (original)
+++ polly/trunk/lib/Support/GICHelper.cpp Fri Feb 22 02:21:52 2013
@@ -21,33 +21,34 @@
using namespace llvm;
-void polly::MPZ_from_APInt (mpz_t v, const APInt apint, bool is_signed) {
+void polly::MPZ_from_APInt(mpz_t v, const APInt apint, bool is_signed) {
// There is no sign taken from the data, rop will simply be a positive
// integer. An application can handle any sign itself, and apply it for
// instance with mpz_neg.
APInt abs;
if (is_signed)
- abs = apint.abs();
+ abs = apint.abs();
else
- abs = apint;
+ abs = apint;
const uint64_t *rawdata = abs.getRawData();
unsigned numWords = abs.getNumWords();
// TODO: Check if this is true for all platforms.
- mpz_import(v, numWords, 1, sizeof (uint64_t), 0, 0, rawdata);
+ mpz_import(v, numWords, 1, sizeof(uint64_t), 0, 0, rawdata);
- if (is_signed && apint.isNegative()) mpz_neg(v, v);
+ if (is_signed && apint.isNegative())
+ mpz_neg(v, v);
}
-APInt polly::APInt_from_MPZ (const mpz_t mpz) {
+APInt polly::APInt_from_MPZ(const mpz_t mpz) {
uint64_t *p = NULL;
size_t sz;
- p = (uint64_t*) mpz_export(p, &sz, 1, sizeof(uint64_t), 0, 0, mpz);
+ p = (uint64_t *)mpz_export(p, &sz, 1, sizeof(uint64_t), 0, 0, mpz);
if (p) {
- APInt A((unsigned)mpz_sizeinbase(mpz, 2), (unsigned)sz , p);
+ APInt A((unsigned) mpz_sizeinbase(mpz, 2), (unsigned) sz, p);
A = A.zext(A.getBitWidth() + 1);
free(p);
@@ -61,9 +62,10 @@ APInt polly::APInt_from_MPZ (const mpz_t
}
}
-template<typename ISLTy, typename ISL_CTX_GETTER, typename ISL_PRINTER>
-static inline std::string stringFromIslObjInternal(/*__isl_keep*/
- ISLTy *isl_obj, ISL_CTX_GETTER ctx_getter_fn, ISL_PRINTER printer_fn) {
+template <typename ISLTy, typename ISL_CTX_GETTER, typename ISL_PRINTER>
+static inline std::string
+stringFromIslObjInternal(__isl_keep ISLTy *isl_obj,
+ ISL_CTX_GETTER ctx_getter_fn, ISL_PRINTER printer_fn) {
isl_ctx *ctx = ctx_getter_fn(isl_obj);
isl_printer *p = isl_printer_to_str(ctx);
printer_fn(p, isl_obj);
@@ -74,50 +76,48 @@ static inline std::string stringFromIslO
return string;
}
-static inline isl_ctx *schedule_get_ctx(/*__isl_keep*/ isl_schedule *schedule) {
+static inline isl_ctx *schedule_get_ctx(__isl_keep isl_schedule *schedule) {
return isl_union_map_get_ctx(isl_schedule_get_map(schedule));
}
-std::string polly::stringFromIslObj(/*__isl_keep*/ isl_map *map) {
- return stringFromIslObjInternal(map, isl_map_get_ctx,
- isl_printer_print_map);
+std::string polly::stringFromIslObj(__isl_keep isl_map *map) {
+ return stringFromIslObjInternal(map, isl_map_get_ctx, isl_printer_print_map);
}
-std::string polly::stringFromIslObj(/*__isl_keep*/ isl_set *set) {
- return stringFromIslObjInternal(set, isl_set_get_ctx,
- isl_printer_print_set);
+std::string polly::stringFromIslObj(__isl_keep isl_set *set) {
+ return stringFromIslObjInternal(set, isl_set_get_ctx, isl_printer_print_set);
}
-std::string polly::stringFromIslObj(/*__isl_keep*/ isl_union_map *umap) {
+std::string polly::stringFromIslObj(__isl_keep isl_union_map *umap) {
return stringFromIslObjInternal(umap, isl_union_map_get_ctx,
isl_printer_print_union_map);
}
-std::string polly::stringFromIslObj(/*__isl_keep*/ isl_union_set *uset) {
+std::string polly::stringFromIslObj(__isl_keep isl_union_set *uset) {
return stringFromIslObjInternal(uset, isl_union_set_get_ctx,
isl_printer_print_union_set);
}
-std::string polly::stringFromIslObj(/*__isl_keep*/ isl_schedule *schedule) {
+std::string polly::stringFromIslObj(__isl_keep isl_schedule *schedule) {
return stringFromIslObjInternal(schedule, schedule_get_ctx,
isl_printer_print_schedule);
}
-std::string polly::stringFromIslObj(/*__isl_keep*/ isl_multi_aff *maff) {
+std::string polly::stringFromIslObj(__isl_keep isl_multi_aff *maff) {
return stringFromIslObjInternal(maff, isl_multi_aff_get_ctx,
isl_printer_print_multi_aff);
}
-std::string polly::stringFromIslObj(/*__isl_keep*/ isl_pw_multi_aff *pma) {
+std::string polly::stringFromIslObj(__isl_keep isl_pw_multi_aff *pma) {
return stringFromIslObjInternal(pma, isl_pw_multi_aff_get_ctx,
isl_printer_print_pw_multi_aff);
}
-std::string polly::stringFromIslObj(/*__isl_keep*/ isl_aff *aff) {
+std::string polly::stringFromIslObj(__isl_keep isl_aff *aff) {
return stringFromIslObjInternal(aff, isl_aff_get_ctx, isl_printer_print_aff);
}
-std::string polly::stringFromIslObj(/*__isl_keep*/ isl_pw_aff *pwaff) {
+std::string polly::stringFromIslObj(__isl_keep isl_pw_aff *pwaff) {
return stringFromIslObjInternal(pwaff, isl_pw_aff_get_ctx,
isl_printer_print_pw_aff);
}
Modified: polly/trunk/lib/Support/SCEVValidator.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Support/SCEVValidator.cpp?rev=175874&r1=175873&r2=175874&view=diff
==============================================================================
--- polly/trunk/lib/Support/SCEVValidator.cpp (original)
+++ polly/trunk/lib/Support/SCEVValidator.cpp Fri Feb 22 02:21:52 2013
@@ -12,26 +12,26 @@
using namespace llvm;
namespace SCEVType {
- /// @brief The type of a SCEV
- ///
- /// To check for the validity of a SCEV we assign to each SCEV a type. The
- /// possible types are INT, PARAM, IV and INVALID. The order of the types is
- /// important. The subexpressions of SCEV with a type X can only have a type
- /// that is smaller or equal than X.
- enum TYPE {
- // An integer value.
- INT,
-
- // An expression that is constant during the execution of the Scop,
- // but that may depend on parameters unknown at compile time.
- PARAM,
-
- // An expression that may change during the execution of the SCoP.
- IV,
-
- // An invalid expression.
- INVALID
- };
+/// @brief The type of a SCEV
+///
+/// To check for the validity of a SCEV we assign to each SCEV a type. The
+/// possible types are INT, PARAM, IV and INVALID. The order of the types is
+/// important. The subexpressions of SCEV with a type X can only have a type
+/// that is smaller or equal than X.
+enum TYPE {
+ // An integer value.
+ INT,
+
+ // An expression that is constant during the execution of the Scop,
+ // but that may depend on parameters unknown at compile time.
+ PARAM,
+
+ // An expression that may change during the execution of the SCoP.
+ IV,
+
+ // An invalid expression.
+ INVALID
+};
}
/// @brief The result the validator returns for a SCEV expression.
@@ -40,64 +40,49 @@ class ValidatorResult {
SCEVType::TYPE Type;
/// @brief The set of Parameters in the expression.
- std::vector<const SCEV*> Parameters;
+ std::vector<const SCEV *> Parameters;
public:
/// @brief The copy constructor
ValidatorResult(const ValidatorResult &Source) {
Type = Source.Type;
Parameters = Source.Parameters;
- };
+ }
/// @brief Construct a result with a certain type and no parameters.
ValidatorResult(SCEVType::TYPE Type) : Type(Type) {
assert(Type != SCEVType::PARAM && "Did you forget to pass the parameter");
- };
+ }
/// @brief Construct a result with a certain type and a single parameter.
ValidatorResult(SCEVType::TYPE Type, const SCEV *Expr) : Type(Type) {
Parameters.push_back(Expr);
- };
+ }
/// @brief Get the type of the ValidatorResult.
- SCEVType::TYPE getType() {
- return Type;
- }
+ SCEVType::TYPE getType() { return Type; }
/// @brief Is the analyzed SCEV constant during the execution of the SCoP.
- bool isConstant() {
- return Type == SCEVType::INT || Type == SCEVType::PARAM;
- }
+ bool isConstant() { return Type == SCEVType::INT || Type == SCEVType::PARAM; }
/// @brief Is the analyzed SCEV valid.
- bool isValid() {
- return Type != SCEVType::INVALID;
- }
+ bool isValid() { return Type != SCEVType::INVALID; }
/// @brief Is the analyzed SCEV of Type IV.
- bool isIV() {
- return Type == SCEVType::IV;
- }
+ bool isIV() { return Type == SCEVType::IV; }
/// @brief Is the analyzed SCEV of Type INT.
- bool isINT() {
- return Type == SCEVType::INT;
- }
+ bool isINT() { return Type == SCEVType::INT; }
/// @brief Is the analyzed SCEV of Type PARAM.
- bool isPARAM() {
- return Type == SCEVType::PARAM;
- }
+ bool isPARAM() { return Type == SCEVType::PARAM; }
/// @brief Get the parameters of this validator result.
- std::vector<const SCEV*> getParameters() {
- return Parameters;
- }
+ std::vector<const SCEV *> getParameters() { return Parameters; }
/// @brief Add the parameters of Source to this result.
void addParamsFrom(class ValidatorResult &Source) {
- Parameters.insert(Parameters.end(),
- Source.Parameters.begin(),
+ Parameters.insert(Parameters.end(), Source.Parameters.begin(),
Source.Parameters.end());
}
@@ -112,17 +97,17 @@ public:
void print(raw_ostream &OS) {
switch (Type) {
- case SCEVType::INT:
- OS << "SCEVType::INT";
+ case SCEVType::INT:
+ OS << "SCEVType::INT";
break;
- case SCEVType::PARAM:
- OS << "SCEVType::PARAM";
+ case SCEVType::PARAM:
+ OS << "SCEVType::PARAM";
break;
- case SCEVType::IV:
- OS << "SCEVType::IV";
+ case SCEVType::IV:
+ OS << "SCEVType::IV";
break;
- case SCEVType::INVALID:
- OS << "SCEVType::INVALID";
+ case SCEVType::INVALID:
+ OS << "SCEVType::INVALID";
break;
}
}
@@ -134,17 +119,16 @@ raw_ostream &operator<<(raw_ostream &OS,
}
/// Check if a SCEV is valid in a SCoP.
-struct SCEVValidator
- : public SCEVVisitor<SCEVValidator, class ValidatorResult> {
+struct SCEVValidator :
+ public SCEVVisitor<SCEVValidator, class ValidatorResult> {
private:
const Region *R;
ScalarEvolution &SE;
const Value *BaseAddress;
public:
- SCEVValidator(const Region *R, ScalarEvolution &SE,
- const Value *BaseAddress) : R(R), SE(SE),
- BaseAddress(BaseAddress) {};
+ SCEVValidator(const Region *R, ScalarEvolution &SE, const Value *BaseAddress)
+ : R(R), SE(SE), BaseAddress(BaseAddress) {}
class ValidatorResult visitConstant(const SCEVConstant *Constant) {
return ValidatorResult(SCEVType::INT);
@@ -154,17 +138,17 @@ public:
ValidatorResult Op = visit(Expr->getOperand());
switch (Op.getType()) {
- case SCEVType::INT:
- case SCEVType::PARAM:
- // We currently do not represent a truncate expression as an affine
- // expression. If it is constant during Scop execution, we treat it as a
- // parameter.
- return ValidatorResult(SCEVType::PARAM, Expr);
- case SCEVType::IV:
- DEBUG(dbgs() << "INVALID: Truncation of SCEVType::IV expression");
- return ValidatorResult(SCEVType::INVALID);
- case SCEVType::INVALID:
- return Op;
+ case SCEVType::INT:
+ case SCEVType::PARAM:
+ // We currently do not represent a truncate expression as an affine
+ // expression. If it is constant during Scop execution, we treat it as a
+ // parameter.
+ return ValidatorResult(SCEVType::PARAM, Expr);
+ case SCEVType::IV:
+ DEBUG(dbgs() << "INVALID: Truncation of SCEVType::IV expression");
+ return ValidatorResult(SCEVType::INVALID);
+ case SCEVType::INVALID:
+ return Op;
}
llvm_unreachable("Unknown SCEVType");
@@ -174,17 +158,17 @@ public:
ValidatorResult Op = visit(Expr->getOperand());
switch (Op.getType()) {
- case SCEVType::INT:
- case SCEVType::PARAM:
- // We currently do not represent a truncate expression as an affine
- // expression. If it is constant during Scop execution, we treat it as a
- // parameter.
- return ValidatorResult(SCEVType::PARAM, Expr);
- case SCEVType::IV:
- DEBUG(dbgs() << "INVALID: ZeroExtend of SCEVType::IV expression");
- return ValidatorResult(SCEVType::INVALID);
- case SCEVType::INVALID:
- return Op;
+ case SCEVType::INT:
+ case SCEVType::PARAM:
+ // We currently do not represent a truncate expression as an affine
+ // expression. If it is constant during Scop execution, we treat it as a
+ // parameter.
+ return ValidatorResult(SCEVType::PARAM, Expr);
+ case SCEVType::IV:
+ DEBUG(dbgs() << "INVALID: ZeroExtend of SCEVType::IV expression");
+ return ValidatorResult(SCEVType::INVALID);
+ case SCEVType::INVALID:
+ return Op;
}
llvm_unreachable("Unknown SCEVType");
@@ -223,12 +207,12 @@ public:
if (Op.isINT())
continue;
- if ((Op.isIV() || Op.isPARAM()) && !Return.isINT() ) {
+ if ((Op.isIV() || Op.isPARAM()) && !Return.isINT()) {
DEBUG(dbgs() << "INVALID: More than one non-int operand in MulExpr\n"
<< "\tExpr: " << *Expr << "\n"
<< "\tPrevious expression type: " << Return << "\n"
- << "\tNext operand (" << Op << "): "
- << *Expr->getOperand(i) << "\n");
+ << "\tNext operand (" << Op
+ << "): " << *Expr->getOperand(i) << "\n");
return ValidatorResult(SCEVType::INVALID);
}
@@ -281,8 +265,8 @@ public:
return ValidatorResult(SCEVType::INVALID);
}
- assert (Start.isConstant() && Recurrence.isConstant()
- && "Expected 'Start' and 'Recurrence' to be constant");
+ assert(Start.isConstant() && Recurrence.isConstant() &&
+ "Expected 'Start' and 'Recurrence' to be constant");
return ValidatorResult(SCEVType::PARAM, Expr);
}
@@ -353,41 +337,41 @@ public:
};
namespace polly {
- bool isAffineExpr(const Region *R, const SCEV *Expr, ScalarEvolution &SE,
- const Value *BaseAddress) {
- if (isa<SCEVCouldNotCompute>(Expr))
- return false;
-
- SCEVValidator Validator(R, SE, BaseAddress);
- DEBUG(
- dbgs() << "\n";
- dbgs() << "Expr: " << *Expr << "\n";
- dbgs() << "Region: " << R->getNameStr() << "\n";
- dbgs() << " -> ");
-
- ValidatorResult Result = Validator.visit(Expr);
-
- DEBUG(
- if (Result.isValid())
- dbgs() << "VALID\n";
- dbgs() << "\n";
- );
-
- return Result.isValid();
- }
-
- std::vector<const SCEV*> getParamsInAffineExpr(const Region *R,
- const SCEV *Expr,
- ScalarEvolution &SE,
- const Value *BaseAddress) {
- if (isa<SCEVCouldNotCompute>(Expr))
- return std::vector<const SCEV*>();
+bool isAffineExpr(const Region *R, const SCEV *Expr, ScalarEvolution &SE,
+ const Value *BaseAddress) {
+ if (isa<SCEVCouldNotCompute>(Expr))
+ return false;
+
+ SCEVValidator Validator(R, SE, BaseAddress);
+ DEBUG(
+ dbgs() << "\n";
+ dbgs() << "Expr: " << *Expr << "\n";
+ dbgs() << "Region: " << R->getNameStr() << "\n";
+ dbgs() << " -> "
+ );
+
+ ValidatorResult Result = Validator.visit(Expr);
+
+ DEBUG(
+ if (Result.isValid())
+ dbgs() << "VALID\n";
+ dbgs() << "\n";
+ );
- SCEVValidator Validator(R, SE, BaseAddress);
- ValidatorResult Result = Validator.visit(Expr);
+ return Result.isValid();
+}
- return Result.getParameters();
- }
+std::vector<const SCEV *>
+getParamsInAffineExpr(const Region *R, const SCEV *Expr, ScalarEvolution &SE,
+ const Value *BaseAddress) {
+ if (isa<SCEVCouldNotCompute>(Expr))
+ return std::vector<const SCEV *>();
+
+ SCEVValidator Validator(R, SE, BaseAddress);
+ ValidatorResult Result = Validator.visit(Expr);
+
+ return Result.getParameters();
+}
}
More information about the llvm-commits
mailing list