Commit fd8ea7ce authored by Kevin Modzelewski's avatar Kevin Modzelewski

Run 'make format'

I think the new version of LLVM changed clang-format, and
it reformatted parts of the Pyston codebase.
Maybe we should pin the rev for clang-format?
parent e8120fb1
......@@ -297,8 +297,8 @@ private:
CompilerType* right = getType(node->comparators[0]);
AST_TYPE::AST_TYPE op_type = node->ops[0];
if (op_type == AST_TYPE::Is || op_type == AST_TYPE::IsNot || op_type == AST_TYPE::In || op_type
== AST_TYPE::NotIn) {
if (op_type == AST_TYPE::Is || op_type == AST_TYPE::IsNot || op_type == AST_TYPE::In
|| op_type == AST_TYPE::NotIn) {
assert(node->ops.size() == 1 && "I don't think this should happen");
return BOOL;
}
......
......@@ -203,8 +203,8 @@ void registerCompiledPatchpoint(uint8_t* start_addr, PatchpointSetupInfo* pp, St
uint8_t* rtn_addr;
assembler::GenericRegister return_register;
assert(pp->getCallingConvention() == llvm::CallingConv::C || pp->getCallingConvention()
== llvm::CallingConv::PreserveAll);
assert(pp->getCallingConvention() == llvm::CallingConv::C
|| pp->getCallingConvention() == llvm::CallingConv::PreserveAll);
if (pp->hasReturnValue()) {
static const int DWARF_RAX = 0;
// It's possible that the return value doesn't get used, in which case
......
......@@ -38,35 +38,37 @@ const bool is_callee_save[] = {
false, false, false, false, false, false, true, true, true, true,
};
const int DwarfRegToX86[] = { 0, // 0
2, // 1
1, // 2 -> rcx
3, // 3 -> rbx
6, // 4
7, // 5
5, // 6
4, // 7
8, // 8 -> r8
9, // 9 -> r9
10, // 10 -> r10
11, // 11 -> r11
12, // 12 -> r12
13, // 13 -> r13
14, // 14 -> r14
15, // 15 -> r15
// http://www.x86-64.org/documentation/abi.pdf#page=57
// 16 -> ReturnAddress RA (??)
// 17-32: xmm0-xmm15
const int DwarfRegToX86[] = {
0, // 0
2, // 1
1, // 2 -> rcx
3, // 3 -> rbx
6, // 4
7, // 5
5, // 6
4, // 7
8, // 8 -> r8
9, // 9 -> r9
10, // 10 -> r10
11, // 11 -> r11
12, // 12 -> r12
13, // 13 -> r13
14, // 14 -> r14
15, // 15 -> r15
// http://www.x86-64.org/documentation/abi.pdf#page=57
// 16 -> ReturnAddress RA (??)
// 17-32: xmm0-xmm15
};
const int NUM_ARG_REGS = 6;
const int arg_regs[] = { 7, // rdi
6, // rsi
2, // rdx
1, // rcx
8, // r8
9, // r9
const int arg_regs[] = {
7, // rdi
6, // rsi
2, // rdx
1, // rcx
8, // r8
9, // r9
};
const uint8_t REX_B = 1, REX_X = 2, REX_R = 4, REX_W = 8;
......@@ -556,8 +558,8 @@ private:
}
virtual void _emitGuard(int argnum, int64_t value, int npops, X86::ConditionCode slowpath_condition) {
assert(slowpath_condition == X86::COND_EQUAL || slowpath_condition == X86::COND_NOT_EQUAL
&& "not sure if the cmp operands are in the right order");
assert(slowpath_condition == X86::COND_EQUAL
|| slowpath_condition == X86::COND_NOT_EQUAL && "not sure if the cmp operands are in the right order");
assert(argnum <= X86::NUM_ARG_REGS);
int argreg = convertArgnum(argnum);
......@@ -581,8 +583,8 @@ private:
virtual void _emitAttrGuard(int argnum, int offset, int64_t value, int npops,
X86::ConditionCode slowpath_condition) {
assert(slowpath_condition == X86::COND_EQUAL || slowpath_condition == X86::COND_NOT_EQUAL
&& "not sure if the cmp operands are in the right order");
assert(slowpath_condition == X86::COND_EQUAL
|| slowpath_condition == X86::COND_NOT_EQUAL && "not sure if the cmp operands are in the right order");
assert(argnum <= X86::NUM_ARG_REGS);
int argreg = convertArgnum(argnum);
......
......@@ -84,7 +84,6 @@ extern GlobalState g;
void initGlobalFuncs(GlobalState& g);
const LineInfo* getLineInfoFor(uint64_t inst_addr);
}
#endif
......@@ -224,7 +224,8 @@ void initCodegen() {
// There are some parts of llvm that are only configurable through command line args,
// so construct a fake argc/argv pair and pass it to the llvm command line machinery:
const char* llvm_args[] = { "fake_name", "--enable-stackmap-liveness", "--enable-patchpoint-liveness",
const char* llvm_args[] = {
"fake_name", "--enable-stackmap-liveness", "--enable-patchpoint-liveness",
// Enabling and debugging fast-isel:
//"--fast-isel",
......@@ -235,8 +236,8 @@ void initCodegen() {
//"--debug-only=regalloc",
//"--debug-only=stackmaps",
#endif
//"--print-after-all",
//"--print-machineinstrs",
//"--print-after-all",
//"--print-machineinstrs",
};
int num_llvm_args = sizeof(llvm_args) / sizeof(llvm_args[0]);
llvm::cl::ParseCommandLineOptions(num_llvm_args, llvm_args, "<you should never see this>\n");
......
......@@ -505,15 +505,16 @@ static void emitBBs(IRGenState* irstate, const char* bb_type, GuardList& out_gua
} else if (block == source->cfg->getStartingBlock()) {
assert(entry_descriptor == NULL);
// number of times a function needs to be called to be reoptimized:
static const int REOPT_THRESHOLDS[] = { 10, // INTERPRETED->MINIMAL
250, // MINIMAL->MODERATE
10000, // MODERATE->MAXIMAL
static const int REOPT_THRESHOLDS[] = {
10, // INTERPRETED->MINIMAL
250, // MINIMAL->MODERATE
10000, // MODERATE->MAXIMAL
};
assert(strcmp("opt", bb_type) == 0);
if (ENABLE_REOPT && effort < EffortLevel::MAXIMAL && source->ast != NULL && source->ast->type
!= AST_TYPE::Module) {
if (ENABLE_REOPT && effort < EffortLevel::MAXIMAL && source->ast != NULL
&& source->ast->type != AST_TYPE::Module) {
llvm::BasicBlock* preentry_bb
= llvm::BasicBlock::Create(g.context, "pre_entry", irstate->getLLVMFunction(),
llvm_entry_blocks[source->cfg->getStartingBlock()]);
......
......@@ -946,9 +946,10 @@ private:
}
CompilerVariable* evalExpr(AST_expr* node, ExcInfo exc_info) {
//printf("%d expr: %d\n", node->type, node->lineno);
// printf("%d expr: %d\n", node->type, node->lineno);
if (node->lineno) {
emitter.getBuilder()->SetCurrentDebugLocation(llvm::DebugLoc::get(node->lineno, 0, irstate->getFuncDbgInfo()));
emitter.getBuilder()->SetCurrentDebugLocation(
llvm::DebugLoc::get(node->lineno, 0, irstate->getFuncDbgInfo()));
}
CompilerVariable* rtn = NULL;
......@@ -1762,9 +1763,10 @@ private:
}
void doStmt(AST* node, ExcInfo exc_info) {
//printf("%d stmt: %d\n", node->type, node->lineno);
// printf("%d stmt: %d\n", node->type, node->lineno);
if (node->lineno) {
emitter.getBuilder()->SetCurrentDebugLocation(llvm::DebugLoc::get(node->lineno, 0, irstate->getFuncDbgInfo()));
emitter.getBuilder()->SetCurrentDebugLocation(
llvm::DebugLoc::get(node->lineno, 0, irstate->getFuncDbgInfo()));
}
switch (node->type) {
......
......@@ -255,7 +255,7 @@ const LineInfo* getLineInfoForInterpretedFrame(void* frame_ptr) {
llvm::DISubprogram subprog(debug_loc.getScope(g.context));
// TODO better lifetime management
LineInfo *rtn = new LineInfo(debug_loc.getLine(), debug_loc.getCol(), subprog.getFilename(), subprog.getName());
LineInfo* rtn = new LineInfo(debug_loc.getLine(), debug_loc.getCol(), subprog.getFilename(), subprog.getName());
line_infos.insert(it, std::make_pair(cur_instruction, rtn));
return rtn;
} else {
......
......@@ -29,7 +29,6 @@ Box* interpretFunction(llvm::Function* f, int nargs, Box* arg1, Box* arg2, Box*
void gatherInterpreterRootsForFrame(GCVisitor* visitor, void* frame_ptr);
const LineInfo* getLineInfoForInterpretedFrame(void* frame_ptr);
}
#endif
......@@ -76,9 +76,7 @@ private:
struct LineTableRegistryEntry {
const uint64_t addr, size;
std::vector<std::pair<uint64_t, LineInfo> > linetable;
LineTableRegistryEntry(uint64_t addr, uint64_t size) :
addr(addr), size(size) {
}
LineTableRegistryEntry(uint64_t addr, uint64_t size) : addr(addr), size(size) {}
};
std::vector<LineTableRegistryEntry> entries;
......@@ -89,7 +87,9 @@ public:
auto& entry = entries.back();
for (int i = 0; i < lines.size(); i++) {
entry.linetable.push_back(std::make_pair(lines[i].first, LineInfo(lines[i].second.Line, lines[i].second.Column, lines[i].second.FileName, lines[i].second.FunctionName)));
entry.linetable.push_back(
std::make_pair(lines[i].first, LineInfo(lines[i].second.Line, lines[i].second.Column,
lines[i].second.FileName, lines[i].second.FunctionName)));
}
}
......@@ -135,19 +135,20 @@ public:
if (I->getSize(Size))
continue;
// TODO this should be the Python name, not the C name:
// TODO this should be the Python name, not the C name:
#if LLVMREV < 208921
llvm::DILineInfoTable lines = Context->getLineInfoForAddressRange(
Addr, Size, llvm::DILineInfoSpecifier::FunctionName | llvm::DILineInfoSpecifier::FileLineInfo | llvm::DILineInfoSpecifier::AbsoluteFilePath);
Addr, Size, llvm::DILineInfoSpecifier::FunctionName | llvm::DILineInfoSpecifier::FileLineInfo
| llvm::DILineInfoSpecifier::AbsoluteFilePath);
#else
llvm::DILineInfoTable lines = Context->getLineInfoForAddressRange(
Addr, Size, llvm::DILineInfoSpecifier(llvm::DILineInfoSpecifier::FileLineInfoKind::AbsoluteFilePath,
llvm::DILineInfoSpecifier::FunctionNameKind::LinkageName));
llvm::DILineInfoSpecifier::FunctionNameKind::LinkageName));
#endif
if (VERBOSITY() >= 2) {
for (int i = 0; i < lines.size(); i++) {
printf("%s:%d, %s: %lx\n", lines[i].second.FileName.c_str(), lines[i].second.Line,
lines[i].second.FunctionName.c_str(), lines[i].first);
printf("%s:%d, %s: %lx\n", lines[i].second.FileName.c_str(), lines[i].second.Line,
lines[i].second.FunctionName.c_str(), lines[i].first);
}
}
line_table_registry.registerLineTable(Addr, Size, lines);
......
......@@ -398,11 +398,9 @@ public:
const int line, column;
std::string file, func;
LineInfo(int line, int column, const std::string& file, const std::string& func) :
line(line), column(column), file(file), func(func) {
}
LineInfo(int line, int column, const std::string& file, const std::string& func)
: line(line), column(column), file(file), func(func) {}
};
}
#endif
......@@ -57,9 +57,10 @@ struct Block {
};
static_assert(sizeof(Block) == BLOCK_SIZE, "bad size");
constexpr const size_t sizes[] = { 16, 32, 48, 64, 80, 96, 112, 128, 160, 192, 224, 256,
320, 384, 448, 512, 640, 768, 896, 1024, 1280, 1536, 1792, 2048,
// 2560, 3072, 3584, // 4096,
constexpr const size_t sizes[] = {
16, 32, 48, 64, 80, 96, 112, 128, 160, 192, 224, 256,
320, 384, 448, 512, 640, 768, 896, 1024, 1280, 1536, 1792, 2048,
// 2560, 3072, 3584, // 4096,
};
#define NUM_BUCKETS (sizeof(sizes) / sizeof(sizes[0]))
......
......@@ -136,7 +136,7 @@ void printLastTraceback() {
size_t size;
size_t r = getline(&buf, &size, f);
if (r != -1) {
while (buf[r-1] == '\n' or buf[r-1] == '\r')
while (buf[r - 1] == '\n' or buf[r - 1] == '\r')
r--;
char* ptr = buf;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment